王晓迪
1 week ago
11 changed files with 597 additions and 125 deletions
@ -0,0 +1,328 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('驳回调整')" /> |
||||
|
<th:block th:include="include :: datetimepicker-css" /> |
||||
|
<th:block th:include="include :: summernote-css" /> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-outsource_quote-edit" th:object="${outsourceQuote}"> |
||||
|
<h4 class="form-header h4">委外报价信息</h4> |
||||
|
<input name="outsourceQuoteId" th:field="*{outsourceQuoteId}" type="hidden"> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label is-required">委外报价单号:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="outsourceQuoteCode" th:field="*{outsourceQuoteCode}" class="form-control" type="text" required readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label is-required">供应商编号:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input id="selectSupplierQuoteCode" name="supplierQuoteCode" th:field="*{supplierQuoteCode}" class="form-control" required> |
||||
|
<!-- <select id="selectSupplierQuoteCode" name="supplierQuoteCode" th:field="*{supplierQuoteCode}" class="form-control" required>--> |
||||
|
<!-- <option value="">请选择供应商</option>--> |
||||
|
<!-- </select>--> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label is-required">供应商名称:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="supplierName" th:field="*{supplierName}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">工序合计:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="processAmount" th:field="*{processAmount}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">税率:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<div class="input-group"> |
||||
|
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text"> |
||||
|
<span class="input-group-addon">%</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">定价日期:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<div class="input-group date"> |
||||
|
<input name="pricingDate" class="form-control" type="text" th:field="*{pricingDate}" placeholder="请选择定价时间"> |
||||
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!-- <div class="col-sm-8">--> |
||||
|
<!-- <input name="pricingDate" th:field="*{pricingDate}" class="form-control" type="text">--> |
||||
|
<!-- </div>--> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">备注:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="remark" th:field="*{remark}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label" for="reApply">是否继续申请:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<select id="reApply" name="p_B_reApply" class="form-control m-b"> |
||||
|
<option value="true">重新申请</option> |
||||
|
<option value="false">结束流程</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<h4 class="form-header h4">委外报价工序信息</h4> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-12"> |
||||
|
<button type="button" class="btn btn-blue btn-sm" onclick="processadd()"><i class="fa fa-plus"> 增加</i></button> |
||||
|
<div class="col-sm-12 select-table table-striped"> |
||||
|
<table id="bootstrap-table-process"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<th:block th:include="include :: datetimepicker-js" /> |
||||
|
<th:block th:include="include :: summernote-js" /> |
||||
|
<script th:inline="javascript"> |
||||
|
var prefix = ctx + "system/outsource_quote"; |
||||
|
$("#form-outsource_quote-edit").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
var processData = [[${outsourceQuote.outsourceQuoteChildList}]] |
||||
|
$("input[name='pricingDate']").datetimepicker({ |
||||
|
format: "yyyy-mm-dd", |
||||
|
minView: "month", |
||||
|
todayBtn: true, |
||||
|
autoClose: true |
||||
|
}); |
||||
|
|
||||
|
function submitHandler() { |
||||
|
if ($.validate.form()) { |
||||
|
var taskId = [[${taskId}]]; |
||||
|
$.operate.save(prefix + "/complete/" + taskId, $('#form-aftersalesOrder-edit').serialize()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function processadd() { |
||||
|
var url = prefix + "/processadd"; |
||||
|
var options = { |
||||
|
title: '选择委外工序', |
||||
|
height: "500", |
||||
|
url: url, |
||||
|
callBack: doSubmit |
||||
|
}; |
||||
|
$.modal.openOptions(options); |
||||
|
} |
||||
|
/* 选择委外工序回调 */ |
||||
|
function doSubmit(index, layero){ |
||||
|
// // 这里取到的是多行的 |
||||
|
var rowData = layero.find("iframe")[0].contentWindow.getSelections(); |
||||
|
//判断是否重复 |
||||
|
var rows = $("#bootstrap-table-process").bootstrapTable('getData').length; |
||||
|
if(rows>0){ |
||||
|
for(var i=0;i<rows;i++){ |
||||
|
var data = $("#bootstrap-table-process").bootstrapTable('getData')[i]; |
||||
|
for(var j=0;j<rowData.length;j++){ |
||||
|
if(data.outsourceProcessNo==rowData[j].outsourceProcessNo){ |
||||
|
$.modal.alertError("不能选择已添加过的相同工序"); |
||||
|
return; |
||||
|
} |
||||
|
insertTable(rowData[i]); |
||||
|
} |
||||
|
}; |
||||
|
}else{ |
||||
|
for(i=0;i<rowData.length;i++){ |
||||
|
insertTable(rowData[i]); |
||||
|
} |
||||
|
} |
||||
|
layer.closeAll(); |
||||
|
} |
||||
|
function insertTable(rowData) { |
||||
|
$("#bootstrap-table-process").bootstrapTable('insertRow', { |
||||
|
index: 1, |
||||
|
row: { |
||||
|
outsourceProcessNo: rowData.outsourceProcessNo, |
||||
|
outsourceProcessCode: rowData.outsourceProcessCode, |
||||
|
outsourceProcessName: rowData.outsourceProcessName, |
||||
|
materialNoRmb: 0.00, |
||||
|
materialRmb: 0.00, |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
function getUnit(){ |
||||
|
var selectElements = $('#bootstrap-table-process').find('select[id^="chargeUnit"]'); |
||||
|
// 遍历每个下拉框 |
||||
|
var unit = []; |
||||
|
selectElements.each(function() { |
||||
|
// 获取当前下拉框的值 |
||||
|
var selectedValue = $(this).val(); |
||||
|
unit.push(selectedValue); |
||||
|
}); |
||||
|
console.log(unit); |
||||
|
return unit; |
||||
|
} |
||||
|
function getNoRmb(){ |
||||
|
var selectElements = $('#bootstrap-table-process').find('input[id^="materialNormb"]'); |
||||
|
// 遍历每个下拉框 |
||||
|
var noRmb = []; |
||||
|
selectElements.each(function() { |
||||
|
// 获取当前下拉框的值 |
||||
|
var selectedValue = $(this).val(); |
||||
|
noRmb.push(selectedValue); |
||||
|
}); |
||||
|
// console.log(noRmb); |
||||
|
return noRmb; |
||||
|
}; |
||||
|
function getRmb(){ |
||||
|
var selectElements = $('#bootstrap-table-process').find('input[id^="materialRmb"]'); |
||||
|
// 遍历每个输入框 |
||||
|
var rmb = []; |
||||
|
selectElements.each(function() { |
||||
|
// 获取当前输入框的值 |
||||
|
var selectedValue = $(this).val(); |
||||
|
rmb.push(selectedValue); |
||||
|
}); |
||||
|
return rmb; |
||||
|
}; |
||||
|
|
||||
|
function initProcessTable(data,index){ |
||||
|
$("#bootstrap-table-process").bootstrapTable('insertRow', { |
||||
|
index:1, |
||||
|
row: { |
||||
|
outsourceProcessNo: data.outsourceProcessNo, |
||||
|
outsourceProcessCode: data.outsourceProcessCode, |
||||
|
outsourceProcessName: data.outsourceProcessName, |
||||
|
} |
||||
|
}); |
||||
|
$('#bootstrap-table-process').find('select[id="chargeUnit'+index+'"]').val(data.chargeUnit); |
||||
|
$('#bootstrap-table-process').find('input[id="materialNormb'+index+'"]').val(data.materialNormb); |
||||
|
$('#bootstrap-table-process').find('input[id="materialRmb'+index+'"]').val(data.materialRmb); |
||||
|
|
||||
|
}; |
||||
|
$(function() { |
||||
|
var options = { |
||||
|
id: "bootstrap-table-process", |
||||
|
pagination: false, |
||||
|
showSearch: false, |
||||
|
showRefresh: false, |
||||
|
showToggle: false, |
||||
|
showColumns: false, |
||||
|
sidePagination: "client", |
||||
|
data: [[${outsourceQuote.outsourceQuoteChildList}]], |
||||
|
columns: [ |
||||
|
{ |
||||
|
field: 'outsourceProcessId', |
||||
|
align: 'center', |
||||
|
title: '委外工序主键', |
||||
|
visible: false, |
||||
|
}, |
||||
|
{ |
||||
|
field: 'outsourceProcessNo', |
||||
|
align: 'center', |
||||
|
title: '委外工序编号', |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
field: 'outsourceProcessName', |
||||
|
align: 'center', |
||||
|
title: '委外工序名称', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'chargeUnit', |
||||
|
align: 'center', |
||||
|
title: '计价单位', |
||||
|
width: 120, |
||||
|
// overflow: visible, |
||||
|
formatter: function(value, row, index) { |
||||
|
var html = $.common.sprintf("<select class='form-control' id='chargeUnit" + index + "' name='outsourceQuoteChildList[%s].chargeUnit' value='%s' data-first-title= '请选择' > " + |
||||
|
"<option value=''>请选择</option>" + |
||||
|
"<option value='0'>按重量计</option>" + |
||||
|
"<option value='1'>按数量计</option>" + |
||||
|
"<option value='2'>按面积计</option>" + |
||||
|
"</select>", index, value); |
||||
|
return html; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialNormb', |
||||
|
align: 'center', |
||||
|
title: '工序的不含税单价(RMB) ', |
||||
|
formatter: function(value, row, index) { |
||||
|
var html = $.common.sprintf("<input class='form-control' type='text' id='materialNormb" + index + "' name='outsourceQuoteChildList[%s].materialNormb' value='%s'>", index, value); |
||||
|
return html; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialRmb', |
||||
|
align: 'center', |
||||
|
title: '工序的含税单价(RMB)', |
||||
|
formatter: function(value, row, index) { |
||||
|
var html = $.common.sprintf("<input class='form-control' type='text' id='materialRmb" + index + "' name='outsourceQuoteChildList[%s].materialRmb' value='%s'>", index, value); |
||||
|
return html; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作', |
||||
|
align: 'center', |
||||
|
formatter: function (value, row, index) { |
||||
|
var actions = []; |
||||
|
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.outsourceProcessCode + '\')"><i class="fa fa-remove"></i>删除</a> '); |
||||
|
return actions.join(''); |
||||
|
} |
||||
|
}] |
||||
|
}; |
||||
|
$.table.init(options); |
||||
|
var quoteDetail = options.data; |
||||
|
console.log(quoteDetail); |
||||
|
$.each(quoteDetail, function(index, item) { |
||||
|
// 设置下拉框的值 |
||||
|
$('#chargeUnit' + index).val(item.chargeUnit); |
||||
|
|
||||
|
$('#materialNormb' + index).val(item.materialNormb); |
||||
|
$('#materialRmb' + index).val(item.materialRmb); |
||||
|
}); |
||||
|
|
||||
|
// 监听刷新事件 |
||||
|
$('#bootstrap-table-process').on('refresh.bs.table', function () { |
||||
|
$.each(quoteDetail, function(index, item) { |
||||
|
// 设置下拉框的值 |
||||
|
$('#chargeUnit' + index).val(item.chargeUnit); |
||||
|
|
||||
|
$('#materialNormb' + index).val(item.materialNormb); |
||||
|
$('#materialRmb' + index).val(item.materialRmb); |
||||
|
}); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
function removeRow(outsourceProcessCode){ |
||||
|
$("#bootstrap-table-process").bootstrapTable('remove', { |
||||
|
field: 'outsourceProcessCode', |
||||
|
values: outsourceProcessCode |
||||
|
}) |
||||
|
} |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
Loading…
Reference in new issue