|
@@ -24,7 +24,7 @@ $(document).ready(function() {
|
|
|
// 新增编办
|
|
|
$("#add-compilation").click(function() {
|
|
|
try {
|
|
|
- let [name, standardBill, rationLib, standardBillString, rationLibString] = getAndValidData(model);
|
|
|
+ let [name, standardBill, rationLib, gljLib, standardBillString, rationLibString, gljLibString] = getAndValidData(model);
|
|
|
|
|
|
let url = '/compilation/add';
|
|
|
if (model === 'all') {
|
|
@@ -64,6 +64,9 @@ $(document).ready(function() {
|
|
|
addLib.name = rationLibString;
|
|
|
addLib.id = rationLib;
|
|
|
break;
|
|
|
+ case 'glj':
|
|
|
+ addLib.name = gljLibString;
|
|
|
+ addLib.id = gljLib;
|
|
|
}
|
|
|
// 判断是否有重复的数据
|
|
|
if ($("input:hidden[name='"+ model +"_lib'][data-id='"+ addLib.id +"']").length > 0) {
|
|
@@ -129,20 +132,29 @@ $(document).ready(function() {
|
|
|
$("#name-area").show();
|
|
|
$("#bill-area").hide();
|
|
|
$("#ration-area").hide();
|
|
|
+ $("#glj-area").hide();
|
|
|
$("#add-compilation-title").text('添加新编办');
|
|
|
break;
|
|
|
case 'bill':
|
|
|
$("#name-area").hide();
|
|
|
$("#bill-area").show();
|
|
|
$("#ration-area").hide();
|
|
|
+ $("#glj-area").hide();
|
|
|
$("#add-compilation-title").text('添加标准清单');
|
|
|
break;
|
|
|
case 'ration':
|
|
|
$("#name-area").hide();
|
|
|
$("#bill-area").hide();
|
|
|
$("#ration-area").show();
|
|
|
+ $("#glj-area").hide();
|
|
|
$("#add-compilation-title").text('添加定额库');
|
|
|
break;
|
|
|
+ case 'glj':
|
|
|
+ $("#name-area").hide();
|
|
|
+ $("#bill-area").hide();
|
|
|
+ $("#ration-area").hide();
|
|
|
+ $("#glj-area").show();
|
|
|
+ $("#add-compilation-title").text('添加定额库');
|
|
|
}
|
|
|
|
|
|
$("#addcompilation").modal('show');
|
|
@@ -232,8 +244,9 @@ $(document).ready(function() {
|
|
|
function initCompilation() {
|
|
|
let billListData = billList === undefined ? [] : JSON.parse(billList);
|
|
|
let rationLibData = rationList === undefined ? [] : JSON.parse(rationList);
|
|
|
+ let gljLibData = gljList === undefined ? [] : JSON.parse(gljList);
|
|
|
|
|
|
- if (billListData.length <= 0 || rationLibData.length <= 0) {
|
|
|
+ if (billListData.length <= 0 || rationLibData.length <= 0 || gljLibData.length <= 0) {
|
|
|
return false;
|
|
|
}
|
|
|
// 标准清单
|
|
@@ -252,6 +265,14 @@ function initCompilation() {
|
|
|
}
|
|
|
$("select[name='ration_lib']").children("option").first().after(html);
|
|
|
|
|
|
+ // 工料机库
|
|
|
+ html = '';
|
|
|
+ for(let tmp of gljLibData) {
|
|
|
+ let tmpHtml = '<option value="' + tmp.id + '">' + tmp.name + '</option>';
|
|
|
+ html += tmpHtml;
|
|
|
+ }
|
|
|
+ $("select[name='glj_lib']").children("option").first().after(html);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -264,6 +285,7 @@ function getAndValidData(model) {
|
|
|
let name = $("input[name='compilation_name']").val();
|
|
|
let standardBill = $("select[name='standard_bill']").children("option:selected").val();
|
|
|
let rationLib = $("select[name='ration_lib']").children("option:selected").val();
|
|
|
+ let gljLib = $("select[name='glj_lib']").children("option:selected").val();
|
|
|
|
|
|
if (name === '' && model === 'all') {
|
|
|
throw '编办名字不能为空';
|
|
@@ -277,10 +299,15 @@ function getAndValidData(model) {
|
|
|
throw '请选择定额库';
|
|
|
}
|
|
|
|
|
|
+ if (model === 'glj' && (gljLib === '' || gljLib === undefined)) {
|
|
|
+ throw '请选择工料机库';
|
|
|
+ }
|
|
|
+
|
|
|
let standardBillString = $("select[name='standard_bill']").children("option:selected").text();
|
|
|
let rationLibString = $("select[name='ration_lib']").children("option:selected").text();
|
|
|
+ let gljLibString = $("select[name='glj_lib']").children("option:selected").text();
|
|
|
|
|
|
- return [name, standardBill, rationLib, standardBillString, rationLibString];
|
|
|
+ return [name, standardBill, rationLib, gljLib, standardBillString, rationLibString, gljLibString];
|
|
|
}
|
|
|
|
|
|
/**
|