|
@@ -39,7 +39,7 @@ function makeChecklistData(lists, checklists) {
|
|
|
const isChecked = checklistInfo ? ' checked' : '';
|
|
|
const isDisabled = checklistInfo && checklistInfo.had_bills === 1 ? ' disabled' : '';
|
|
|
html += '<tr>\n' +
|
|
|
- ' <td onselectstart="return false" style="{-moz-user-select:none}"><div class="text-center custom-control custom-checkbox mb-2">\n' +
|
|
|
+ ' <td><div class="text-center custom-control custom-checkbox mb-2">\n' +
|
|
|
' <input type="checkbox" id="lists_'+ i +'" value="'+ i +'" name="customCheckbox" class="custom-control-input"'+ isChecked + isDisabled +'>\n' +
|
|
|
' <label class="custom-control-label" for="lists_'+ i +'"></label>\n' +
|
|
|
' </div></td>\n' +
|
|
@@ -139,8 +139,10 @@ $(document).ready(() => {
|
|
|
gclGatherData = gclGatherModel.gatherGclData();
|
|
|
console.log(gclGatherData);
|
|
|
const hadBillsidList = _.uniq(_.map(materialListData, 'gcl_id'));
|
|
|
+ console.log(hadBillsidList);
|
|
|
// 对比清单设置和调差清单,还要和台账对比,显示已选清单列表 不同则更新到清单设置页中
|
|
|
const pushData = [];
|
|
|
+ const updateData = [];
|
|
|
for (const hb of hadBillsidList) {
|
|
|
const gcl = _.find(gclGatherData, function (item) {
|
|
|
return item.leafXmjs && item.leafXmjs.length > 0 && _.findIndex(item.leafXmjs, { gcl_id : hb }) !== -1;
|
|
@@ -160,12 +162,18 @@ $(document).ready(() => {
|
|
|
if (!gcl) {
|
|
|
removeData.push(mc.id);
|
|
|
}
|
|
|
+ // 更新had_bills值
|
|
|
+ if (mc.had_bills === 1) {
|
|
|
+ if (_.indexOf(hadBillsidList, gcl.leafXmjs ? gcl.leafXmjs[0].gcl_id : null) === -1) {
|
|
|
+ updateData.push({ id: mc.id, mid: materialID, had_bills: 0 });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- setChecklistData(pushData, removeData, true);
|
|
|
+ setChecklistData(pushData, removeData, updateData, true);
|
|
|
});
|
|
|
- function setChecklistData(pushData, removeData, sendmsg = false) {
|
|
|
- if (pushData.length > 0 || removeData.length > 0) {
|
|
|
- postData(window.location.pathname + '/save', { type: 'resetChecklist', pushData, removeData }, function (result2) {
|
|
|
+ function setChecklistData(pushData, removeData, updateData = [], sendmsg = false) {
|
|
|
+ if (pushData.length > 0 || removeData.length > 0 || updateData.length > 0) {
|
|
|
+ postData(window.location.pathname + '/save', { type: 'resetChecklist', pushData, removeData, updateData }, function (result2) {
|
|
|
if (sendmsg && pushData.length > 0) {
|
|
|
toastr.success('已同步并添加到调差清单数据至本页中');
|
|
|
}
|