|
|
@ -2,30 +2,32 @@ |
|
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|
|
|
<head> |
|
|
|
<th:block th:include="include :: header('新增请购单')" /> |
|
|
|
<th:block th:include="include :: select2-css" /> |
|
|
|
<th:block th:include="include :: bootstrap-editable-css" /> |
|
|
|
</head> |
|
|
|
<body class="white-bg"> |
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|
|
|
<form class="form-horizontal m" id="form-requisitioning-add"> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">部门:</label> |
|
|
|
<label class="col-sm-3 control-label is-required">部门:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<select name="dept" class="form-control"></select> |
|
|
|
<select name="dept" class="form-control" required></select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">岗位:</label> |
|
|
|
<label class="col-sm-3 control-label is-required" >岗位:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<select name="post" class="form-control"></select> |
|
|
|
<select name="post" class="form-control" required></select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">姓名:</label> |
|
|
|
<label class="col-sm-3 control-label is-required">姓名:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<select name="userName" class="form-control"></select> |
|
|
|
<select name="userName" class="form-control" required></select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">关联单号:</label> |
|
|
|
<label class="col-sm-3 control-label ">关联单号:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="correlationCode" class="form-control" type="text"> |
|
|
|
</div> |
|
|
@ -48,11 +50,14 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<th:block th:include="include :: footer" /> |
|
|
|
<th:block th:include="include :: select2-js" /> |
|
|
|
<th:block th:include="include :: bootstrap-table-editable-js" /> |
|
|
|
<script th:inline="javascript"> |
|
|
|
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; |
|
|
|
var auditStatusDatas = [[${@dict.getType('auditStatus')}]]; |
|
|
|
var sysUnitClassDatas = [[${@dict.getType('sys_unit_class')}]]; |
|
|
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
|
|
|
var user = [[${user}]]; |
|
|
|
var prefix = ctx + "system/requisitioning"; |
|
|
|
$("#form-requisitioning-add").validate({focusCleanup: true}); |
|
|
|
//获取子表信息 |
|
|
@ -97,9 +102,52 @@ |
|
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{title: '物料的数量', field: 'materialNum',align: 'center',editable: true,}, |
|
|
|
{title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',}, |
|
|
|
{title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',}, |
|
|
|
{title: '物料的数量', field: 'materialNum',align: 'center', |
|
|
|
editable : { |
|
|
|
type : 'text', |
|
|
|
mode:'inline', |
|
|
|
title : '物料的数量', |
|
|
|
validate : function(value) { |
|
|
|
if (!value) { |
|
|
|
return '用量不能为空'; |
|
|
|
} |
|
|
|
if (isNaN(value)) { |
|
|
|
return '用量必须为数字'; |
|
|
|
}else if(value < 0){ |
|
|
|
return "输入数值不能小于0"; |
|
|
|
} |
|
|
|
} |
|
|
|
}}, |
|
|
|
{title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',editable : { |
|
|
|
type : 'text', |
|
|
|
mode:'inline', |
|
|
|
title : '不含税单价', |
|
|
|
validate : function(value) { |
|
|
|
if (!value) { |
|
|
|
return '用量不能为空'; |
|
|
|
} |
|
|
|
if (isNaN(value)) { |
|
|
|
return '用量必须为数字'; |
|
|
|
}else if(value < 0){ |
|
|
|
return "输入数值不能小于0"; |
|
|
|
} |
|
|
|
} |
|
|
|
}}, |
|
|
|
{title: '物料的含税单价(RMB)', field: 'materialRmb', align: 'center',editable : { |
|
|
|
type : 'text', |
|
|
|
mode:'inline', |
|
|
|
title : '含税单价', |
|
|
|
validate : function(value) { |
|
|
|
if (!value) { |
|
|
|
return '用量不能为空'; |
|
|
|
} |
|
|
|
if (isNaN(value)) { |
|
|
|
return '用量必须为数字'; |
|
|
|
}else if(value < 0){ |
|
|
|
return "输入数值不能小于0"; |
|
|
|
} |
|
|
|
} |
|
|
|
}}, |
|
|
|
{title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',}, |
|
|
|
{title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center',}, |
|
|
|
{title: '录入人',field: 'createBy',align: 'center',visible: false}, |
|
|
@ -115,12 +163,13 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
onEditableSave:function(field, row, oldValue, $el){ |
|
|
|
row.materialNoRmbSum = Number(row.materialNum * Number(row.materialNoRmb)).toFixed(2); |
|
|
|
row.materialRmbSum = Number(row.materialRmb * row.materialNum).toFixed(2); |
|
|
|
}, |
|
|
|
onEditableSave: function (field, row, oldValue, $el) { |
|
|
|
row.materialNoRmbSum = row.materialNum * row.materialNoRmb; |
|
|
|
row.materialRmbSum = row.materialNum * row.materialRmb; |
|
|
|
} |
|
|
|
}; |
|
|
|
$.table.init(options); |
|
|
|
getSelections(); |
|
|
|
}); |
|
|
|
function doSubmit(index, layero,uniqueId){ |
|
|
|
console.log(uniqueId); |
|
|
@ -139,11 +188,11 @@ |
|
|
|
unit: rowData.unit, |
|
|
|
processMethod: rowData.processMethod, |
|
|
|
photoUrl: rowData.photoUrl, |
|
|
|
materialNum: "", |
|
|
|
materialRmb: "", |
|
|
|
materialNoRmb: "", |
|
|
|
materialNoRmbSum: "", |
|
|
|
materialRmbSum: "", |
|
|
|
materialNum: 1, |
|
|
|
materialRmb: rowData.materialRmb, |
|
|
|
materialNoRmb: rowData.materialNoRmb, |
|
|
|
materialNoRmbSum: rowData.materialNoRmbSum, |
|
|
|
materialRmbSum: rowData.materialRmbSum, |
|
|
|
remark: "" |
|
|
|
} |
|
|
|
}) |
|
|
@ -167,9 +216,33 @@ |
|
|
|
} |
|
|
|
function submitHandler() { |
|
|
|
if ($.validate.form()) { |
|
|
|
$.operate.save(prefix + "/add", $('#form-requisitioning-add').serialize()); |
|
|
|
var formData = $("#form-requisitionChild-add").serializeArray(); |
|
|
|
console.log("formData",formData); |
|
|
|
var tableData = $("#bootstrap-sub-table-requisitionChild").bootstrapTable('getData'); |
|
|
|
let rows = tableData.length; |
|
|
|
if(rows==0){ |
|
|
|
$.modal.msgError("子表数据不能为空!"); |
|
|
|
}else{ |
|
|
|
formData.push({"name": "baseRequisitioningOrderChildList", "value": tableData}); |
|
|
|
var jsonData = $.common.formDataToJson(formData); |
|
|
|
$.operate.saveJson(prefix + "/add", jsonData); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
function getSelections(){ |
|
|
|
$.ajax({ |
|
|
|
url: ctx + "system/requisitioning/getEmpUserName", |
|
|
|
type: "get", |
|
|
|
dataType: "json", |
|
|
|
success: function (data) { |
|
|
|
console.log(data); |
|
|
|
$("select[name='dept']").append($('<option></option>').val(data.deptName).html(data.deptName)); |
|
|
|
$("select[name='userName']").append($('<option></option>').val(data.userName).html(data.userName)); |
|
|
|
$("select[name='post']").append($('<option></option>').val(data.postName).html(data.postName)); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</body> |
|
|
|
</html> |