|
@@ -86,12 +86,12 @@ $.event.special.valuechange = {
|
|
$(document).ready(() => {
|
|
$(document).ready(() => {
|
|
const changeSpreadSetting = {
|
|
const changeSpreadSetting = {
|
|
cols: [
|
|
cols: [
|
|
- {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
|
- {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
|
|
|
+ {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit2'},
|
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.isEdit2'},
|
|
{title: '变更部位', colSpan: '1', rowSpan: '2', field: 'bwmx', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
{title: '变更部位', colSpan: '1', rowSpan: '2', field: 'bwmx', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
{title: '变更详情', colSpan: '1', rowSpan: '2', field: 'detail', hAlign: 0, width: 120, formatter: '@', readOnly: false},
|
|
{title: '变更详情', colSpan: '1', rowSpan: '2', field: 'detail', hAlign: 0, width: 120, formatter: '@', readOnly: false},
|
|
- {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit', cellType: 'unit', comboItems: changeUnits, comboEdit: true},
|
|
|
|
- {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit', getValue: 'getValue.unit_price'},
|
|
|
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit2', cellType: 'unit', comboItems: changeUnits, comboEdit: true},
|
|
|
|
+ {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit2', getValue: 'getValue.unit_price'},
|
|
{title: '原设计|数量', colSpan: '2|1', rowSpan: '1|1', field: 'oamount', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit', getValue: 'getValue.oamount'},
|
|
{title: '原设计|数量', colSpan: '2|1', rowSpan: '1|1', field: 'oamount', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit', getValue: 'getValue.oamount'},
|
|
{title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'oa_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.oa_tp'},
|
|
{title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'oa_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.oa_tp'},
|
|
{title: '申请变更增(+)减(-)|数量', colSpan: '2|1', rowSpan: '1|1', field: 'camount', hAlign: 2, width: 60, type: 'Number', readOnly: false, getValue: 'getValue.camount'},
|
|
{title: '申请变更增(+)减(-)|数量', colSpan: '2|1', rowSpan: '1|1', field: 'camount', hAlign: 2, width: 60, type: 'Number', readOnly: false, getValue: 'getValue.camount'},
|
|
@@ -143,13 +143,16 @@ $(document).ready(() => {
|
|
return ZhCalc.round(data.camount, findDecimal(data.unit));
|
|
return ZhCalc.round(data.camount, findDecimal(data.unit));
|
|
},
|
|
},
|
|
del_list: function (data) {
|
|
del_list: function (data) {
|
|
- return '移除';
|
|
|
|
|
|
+ return !_.find(changeUsedData, { id: data.id }) ? '移除' : '';
|
|
}
|
|
}
|
|
},
|
|
},
|
|
readOnly: {
|
|
readOnly: {
|
|
isEdit: function (data) {
|
|
isEdit: function (data) {
|
|
return !readOnly && data.lid != 0;
|
|
return !readOnly && data.lid != 0;
|
|
},
|
|
},
|
|
|
|
+ isEdit2: function (data) {
|
|
|
|
+ return !readOnly && (data.lid != 0 || (data.lid == 0 && _.find(changeUsedData, { id: data.id })));
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
|
|
|
|
@@ -197,7 +200,7 @@ $(document).ready(() => {
|
|
del: function () {
|
|
del: function () {
|
|
const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
const index = changeList.indexOf(select);
|
|
const index = changeList.indexOf(select);
|
|
- if (index > -1) {
|
|
|
|
|
|
+ if (index > -1 && !_.find(changeUsedData, { id: select.id })) {
|
|
postData(window.location.pathname + '/save', {type: 'del', id: select.id}, function (result) {
|
|
postData(window.location.pathname + '/save', {type: 'del', id: select.id}, function (result) {
|
|
changeList.splice(index, 1);
|
|
changeList.splice(index, 1);
|
|
changeSpreadSheet.deleteRows(index, 1);
|
|
changeSpreadSheet.deleteRows(index, 1);
|
|
@@ -226,7 +229,7 @@ $(document).ready(() => {
|
|
const sel = info.sheet.getSelections()[0];
|
|
const sel = info.sheet.getSelections()[0];
|
|
const col = info.sheet.zh_setting.cols[sel.col];
|
|
const col = info.sheet.zh_setting.cols[sel.col];
|
|
const data = SpreadJsObj.getSelectObject(info.sheet);
|
|
const data = SpreadJsObj.getSelectObject(info.sheet);
|
|
- if (col && col.field === 'del_list') {
|
|
|
|
|
|
+ if (col && col.field === 'del_list' && !_.find(changeUsedData, { id: data.id })) {
|
|
changeSpreadObj.del();
|
|
changeSpreadObj.del();
|
|
}
|
|
}
|
|
changeSpreadObj.resetXmjSpread(data);
|
|
changeSpreadObj.resetXmjSpread(data);
|
|
@@ -265,10 +268,17 @@ $(document).ready(() => {
|
|
select.camount = ZhCalc.round(select.camount, findDecimal(validText)) || 0;
|
|
select.camount = ZhCalc.round(select.camount, findDecimal(validText)) || 0;
|
|
select.oamount = ZhCalc.round(select.oamount, findDecimal(validText)) || 0;
|
|
select.oamount = ZhCalc.round(select.oamount, findDecimal(validText)) || 0;
|
|
}
|
|
}
|
|
- select[col.field] = validText;
|
|
|
|
if(col.field === 'camount') {
|
|
if(col.field === 'camount') {
|
|
- select.spamount = ZhCalc.round(select.camount, findDecimal(select.unit)) || 0;
|
|
|
|
|
|
+ // 判断是否大于等于限制值,否则无法更改
|
|
|
|
+ const usedInfo = _.find(changeUsedData, { id: select.id });
|
|
|
|
+ if (usedInfo && validText < usedInfo.used_qty) {
|
|
|
|
+ toastr.error('已调用清单更改数值必须大于等于已调用值');
|
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ select.spamount = ZhCalc.round(validText, findDecimal(select.unit)) || 0;
|
|
}
|
|
}
|
|
|
|
+ select[col.field] = validText;
|
|
console.log(select);
|
|
console.log(select);
|
|
delete select.waitingLoading;
|
|
delete select.waitingLoading;
|
|
|
|
|
|
@@ -560,14 +570,14 @@ $(document).ready(() => {
|
|
name: '删除',
|
|
name: '删除',
|
|
icon: 'fa-remove',
|
|
icon: 'fa-remove',
|
|
callback: function (key, opt) {
|
|
callback: function (key, opt) {
|
|
- changeSpreadObj.del(changeSpreadSheet);
|
|
|
|
|
|
+ // changeSpreadObj.del(changeSpreadSheet);
|
|
},
|
|
},
|
|
disabled: function (key, opt) {
|
|
disabled: function (key, opt) {
|
|
const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
const sel = changeSpreadSheet.getSelections()[0];
|
|
const sel = changeSpreadSheet.getSelections()[0];
|
|
changeSpreadObj.resetXmjSpread(select);
|
|
changeSpreadObj.resetXmjSpread(select);
|
|
console.log(select, sel);
|
|
console.log(select, sel);
|
|
- if (!readOnly && select && sel.row !== changeSpreadSheet.getRowCount() - 1) {
|
|
|
|
|
|
+ if (!readOnly && select && sel.row !== changeSpreadSheet.getRowCount() - 1 && !_.find(changeUsedData, { id: select.id })) {
|
|
return false;
|
|
return false;
|
|
} else {
|
|
} else {
|
|
return true;
|
|
return true;
|
|
@@ -598,13 +608,15 @@ $(document).ready(() => {
|
|
for (const leaf of gcl.leafXmjs) {
|
|
for (const leaf of gcl.leafXmjs) {
|
|
const quantity = leaf.quantity !== undefined && leaf.quantity !== null ? leaf.quantity : 0;
|
|
const quantity = leaf.quantity !== undefined && leaf.quantity !== null ? leaf.quantity : 0;
|
|
const gcl_id = leaf.gcl_id ? leaf.gcl_id : '';
|
|
const gcl_id = leaf.gcl_id ? leaf.gcl_id : '';
|
|
- const bwmx = leaf.bwmx !== undefined ? leaf.bwmx : '';
|
|
|
|
|
|
+ const bwmx = leaf.bwmx !== undefined ? leaf.bwmx : (gcl.leafXmjs.length > 1 && gcl.name ? gcl.name : '');
|
|
const isChecked = data_bwmx.indexOf(
|
|
const isChecked = data_bwmx.indexOf(
|
|
leaf.code + '!_!' + (leaf.jldy ? leaf.jldy : '') + '!_!' +
|
|
leaf.code + '!_!' + (leaf.jldy ? leaf.jldy : '') + '!_!' +
|
|
(leaf.dwgc ? leaf.dwgc : '') + '!_!' + (leaf.fbgc ? leaf.fbgc : '') + '!_!' + (leaf.fxgc ? leaf.fxgc : '')
|
|
(leaf.dwgc ? leaf.dwgc : '') + '!_!' + (leaf.fbgc ? leaf.fbgc : '') + '!_!' + (leaf.fxgc ? leaf.fxgc : '')
|
|
+ '!_!' + (leaf.gcl_id ? leaf.gcl_id : '0') + '!_!' +
|
|
+ '!_!' + (leaf.gcl_id ? leaf.gcl_id : '0') + '!_!' +
|
|
(bwmx !== '' ? bwmx : leaf.jldy ? leaf.jldy : '') + '*;*' + quantity) !== -1 && isCheck ?
|
|
(bwmx !== '' ? bwmx : leaf.jldy ? leaf.jldy : '') + '*;*' + quantity) !== -1 && isCheck ?
|
|
'checked' : '';
|
|
'checked' : '';
|
|
|
|
+ const isUsed = _.find(changeUsedData, { gcl_id: leaf.gcl_id, bwmx: bwmx, oamount: leaf.quantity });
|
|
|
|
+ const isDisabled = isUsed ? 'disabled ' : '';
|
|
codeHtml += '<tr quantity="' + quantity + '" gcl_id="' + gcl_id + '"><td>' + leaf.code + '</td>' +
|
|
codeHtml += '<tr quantity="' + quantity + '" gcl_id="' + gcl_id + '"><td>' + leaf.code + '</td>' +
|
|
'<td>' + (leaf.jldy ? leaf.jldy: '') + '</td>' +
|
|
'<td>' + (leaf.jldy ? leaf.jldy: '') + '</td>' +
|
|
'<td>' + (leaf.dwgc ? leaf.dwgc : '') + '</td>' +
|
|
'<td>' + (leaf.dwgc ? leaf.dwgc : '') + '</td>' +
|
|
@@ -612,7 +624,7 @@ $(document).ready(() => {
|
|
'<td>' + (leaf.fxgc ? leaf.fxgc : '') + '</td>' +
|
|
'<td>' + (leaf.fxgc ? leaf.fxgc : '') + '</td>' +
|
|
'<td>' + bwmx + '</td>' +
|
|
'<td>' + bwmx + '</td>' +
|
|
'<td class="text-right">' + (ZhCalc.round(quantity, findDecimal(gcl.unit)) ? ZhCalc.round(quantity, findDecimal(gcl.unit)) : 0) + '</td>' +
|
|
'<td class="text-right">' + (ZhCalc.round(quantity, findDecimal(gcl.unit)) ? ZhCalc.round(quantity, findDecimal(gcl.unit)) : 0) + '</td>' +
|
|
- '<td class="text-center"><input type="checkbox"' + isChecked +
|
|
|
|
|
|
+ '<td class="text-center"><input type="checkbox" ' + isDisabled + isChecked +
|
|
'></td></tr>';
|
|
'></td></tr>';
|
|
}
|
|
}
|
|
} else if (!isDeal && isCheck) {
|
|
} else if (!isDeal && isCheck) {
|
|
@@ -686,7 +698,8 @@ $(document).ready(() => {
|
|
const newLedgerList = remakeChangeSpread();
|
|
const newLedgerList = remakeChangeSpread();
|
|
// 更新至服务器
|
|
// 更新至服务器
|
|
postData(window.location.pathname + '/save', { type:'ledger_list', updateData: newLedgerList }, function (result) {
|
|
postData(window.location.pathname + '/save', { type:'ledger_list', updateData: newLedgerList }, function (result) {
|
|
- changeList = result;
|
|
|
|
|
|
+ changeList = result.changeList;
|
|
|
|
+ changeUsedData = result.usedList;
|
|
SpreadJsObj.loadSheetData(changeSpreadSheet, SpreadJsObj.DataType.Data, changeList);
|
|
SpreadJsObj.loadSheetData(changeSpreadSheet, SpreadJsObj.DataType.Data, changeList);
|
|
changeSpreadObj.makeSjsFooter();
|
|
changeSpreadObj.makeSjsFooter();
|
|
const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
@@ -898,7 +911,11 @@ function tableDataRemake(changeListData) {
|
|
let pushbwmx = '0*;*0';
|
|
let pushbwmx = '0*;*0';
|
|
if (listinfo.leafXmjs !== undefined) {
|
|
if (listinfo.leafXmjs !== undefined) {
|
|
const leafInfo = listinfo.leafXmjs.find(function (item) {
|
|
const leafInfo = listinfo.leafXmjs.find(function (item) {
|
|
- return (item.bwmx === undefined || item.bwmx === clinfo.bwmx) && item.code === clinfo.xmj_code && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
|
|
|
|
|
|
+ const flag = (item.bwmx === undefined || item.bwmx === clinfo.bwmx || item.jldy === clinfo.bwmx) && item.gcl_id === clinfo.gcl_id && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
|
|
|
|
+ if (flag && item.code === clinfo.xmj_code) {
|
|
|
|
+ return flag && item.code === clinfo.xmj_code;
|
|
|
|
+ }
|
|
|
|
+ return flag;
|
|
});
|
|
});
|
|
if (leafInfo) {
|
|
if (leafInfo) {
|
|
pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
|
|
pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
|
|
@@ -906,7 +923,7 @@ function tableDataRemake(changeListData) {
|
|
(leafInfo.fbgc ? leafInfo.fbgc : '') + '!_!' +
|
|
(leafInfo.fbgc ? leafInfo.fbgc : '') + '!_!' +
|
|
(leafInfo.fxgc ? leafInfo.fxgc : '') + '!_!' +
|
|
(leafInfo.fxgc ? leafInfo.fxgc : '') + '!_!' +
|
|
(leafInfo.gcl_id ? leafInfo.gcl_id : '') + '!_!' +
|
|
(leafInfo.gcl_id ? leafInfo.gcl_id : '') + '!_!' +
|
|
- (leafInfo.bwmx !== undefined ? leafInfo.bwmx : (leafInfo.jldy !== undefined ? leafInfo.jldy : '')) + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
|
|
|
|
|
|
+ (leafInfo.bwmx !== undefined ? leafInfo.bwmx : (listinfo.leafXmjs.length > 1 && listinfo.name ? listinfo.name : (leafInfo.jldy !== undefined ? leafInfo.jldy : ''))) + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
|
|
} else {
|
|
} else {
|
|
toastr.warning('台账清单列表已不存在'+ clinfo.code +',已更新变更清单列表');
|
|
toastr.warning('台账清单列表已不存在'+ clinfo.code +',已更新变更清单列表');
|
|
// changeList.splice(index, 1);
|
|
// changeList.splice(index, 1);
|
|
@@ -929,7 +946,11 @@ function tableDataRemake(changeListData) {
|
|
let pushbwmx = '0*;*0';
|
|
let pushbwmx = '0*;*0';
|
|
if (listinfo.leafXmjs !== undefined) {
|
|
if (listinfo.leafXmjs !== undefined) {
|
|
const leafInfo = listinfo.leafXmjs.find(function (item) {
|
|
const leafInfo = listinfo.leafXmjs.find(function (item) {
|
|
- return (item.bwmx === undefined || item.bwmx === clinfo.bwmx || item.jldy === clinfo.bwmx) && item.code === clinfo.xmj_code && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
|
|
|
|
|
|
+ const flag = (item.bwmx === undefined || item.bwmx === clinfo.bwmx || item.jldy === clinfo.bwmx) && item.gcl_id === clinfo.gcl_id && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
|
|
|
|
+ if (flag && item.code === clinfo.xmj_code) {
|
|
|
|
+ return flag && item.code === clinfo.xmj_code;
|
|
|
|
+ }
|
|
|
|
+ return flag;
|
|
});
|
|
});
|
|
if (leafInfo) {
|
|
if (leafInfo) {
|
|
pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
|
|
pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
|
|
@@ -937,7 +958,7 @@ function tableDataRemake(changeListData) {
|
|
(leafInfo.fbgc ? leafInfo.fbgc : '') + '!_!' +
|
|
(leafInfo.fbgc ? leafInfo.fbgc : '') + '!_!' +
|
|
(leafInfo.fxgc ? leafInfo.fxgc : '') + '!_!' +
|
|
(leafInfo.fxgc ? leafInfo.fxgc : '') + '!_!' +
|
|
(leafInfo.gcl_id ? leafInfo.gcl_id : '') + '!_!' +
|
|
(leafInfo.gcl_id ? leafInfo.gcl_id : '') + '!_!' +
|
|
- (leafInfo.bwmx !== undefined ? leafInfo.bwmx : (leafInfo.jldy !== undefined ? leafInfo.jldy : '')) + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
|
|
|
|
|
|
+ (leafInfo.bwmx !== undefined ? leafInfo.bwmx : (listinfo.leafXmjs.length > 1 && listinfo.name ? listinfo.name : (leafInfo.jldy !== undefined ? leafInfo.jldy : ''))) + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
|
|
} else {
|
|
} else {
|
|
toastr.warning('台账清单列表已不存在'+ clinfo.code +',已更新变更清单列表');
|
|
toastr.warning('台账清单列表已不存在'+ clinfo.code +',已更新变更清单列表');
|
|
// changeList.splice(index, 1);
|
|
// changeList.splice(index, 1);
|
|
@@ -1046,7 +1067,7 @@ function remakeChangeSpread() {
|
|
gcl_id,
|
|
gcl_id,
|
|
};
|
|
};
|
|
const radionInfo = changeList.find(function (info) {
|
|
const radionInfo = changeList.find(function (info) {
|
|
- return info.code === code && (info.lid == lid || parseInt(info.lid) === parseInt(lindex)) && gcl_id == info.gcl_id && info.bwmx === bwmx;
|
|
|
|
|
|
+ return info.code === code && (info.lid == lid || parseInt(info.lid) === parseInt(lindex)) && gcl_id == info.gcl_id && (info.bwmx === bwmx || info.bwmx === xmj_jldy) && parseInt(info.oamount) === parseInt(oamount);
|
|
});
|
|
});
|
|
if (radionInfo) {
|
|
if (radionInfo) {
|
|
trlist.camount = radionInfo.camount;
|
|
trlist.camount = radionInfo.camount;
|