|
@@ -143,7 +143,7 @@ $(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: {
|
|
@@ -197,7 +197,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 +226,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);
|
|
@@ -560,14 +560,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;
|
|
@@ -595,7 +595,9 @@ $(document).ready(() => {
|
|
gcl = gclGatherData[$(this).data('gcl')];
|
|
gcl = gclGatherData[$(this).data('gcl')];
|
|
}
|
|
}
|
|
codeHtml = '';
|
|
codeHtml = '';
|
|
|
|
+ console.log(changeUsedData);
|
|
for (const leaf of gcl.leafXmjs) {
|
|
for (const leaf of gcl.leafXmjs) {
|
|
|
|
+ console.log(leaf);
|
|
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 : '';
|
|
@@ -605,6 +607,9 @@ $(document).ready(() => {
|
|
+ '!_!' + (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: leaf.bwmx });
|
|
|
|
+ console.log(isUsed);
|
|
|
|
+ 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 +617,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 +691,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 +904,7 @@ 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));
|
|
|
|
|
|
+ return (item.bwmx === undefined || item.bwmx === clinfo.bwmx) && item.gcl_id === clinfo.gcl_id && item.code === clinfo.xmj_code && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
|
|
});
|
|
});
|
|
if (leafInfo) {
|
|
if (leafInfo) {
|
|
pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
|
|
pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
|
|
@@ -928,8 +934,9 @@ function tableDataRemake(changeListData) {
|
|
$('#table-list-select tr[data-lid="'+ clinfo.lid +'"]').addClass('table-success');
|
|
$('#table-list-select tr[data-lid="'+ clinfo.lid +'"]').addClass('table-success');
|
|
let pushbwmx = '0*;*0';
|
|
let pushbwmx = '0*;*0';
|
|
if (listinfo.leafXmjs !== undefined) {
|
|
if (listinfo.leafXmjs !== undefined) {
|
|
|
|
+ console.log(listinfo.leafXmjs, clinfo);
|
|
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));
|
|
|
|
|
|
+ return (item.bwmx === undefined || item.bwmx === clinfo.bwmx || item.jldy === clinfo.bwmx) && item.gcl_id === clinfo.gcl_id && item.code === clinfo.xmj_code && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
|
|
});
|
|
});
|
|
if (leafInfo) {
|
|
if (leafInfo) {
|
|
pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
|
|
pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
|