|
|
@@ -578,6 +578,7 @@ $(document).ready(() => {
|
|
|
const changeSpreadSetting = {
|
|
|
cols: [
|
|
|
{title: '计价', colSpan: '1', rowSpan: '2', field: 'is_valuation', hAlign: 1, width: 50, cellType: 'checkbox', readOnly: 'readOnly.isValuation'},
|
|
|
+ {title: '新增单价', colSpan: '1', rowSpan: '2', field: 'is_new_price', hAlign: 1, width: 35, cellType: 'checkbox', readOnly: 'readOnly.isNewPrice'},
|
|
|
{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: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit', cellType: 'unit', comboItems: changeUnits, comboEdit: true},
|
|
|
@@ -699,6 +700,13 @@ $(document).ready(() => {
|
|
|
},
|
|
|
isSettle2: function (data) {
|
|
|
return !(!readOnly && ((data.id && !checkIsSettle(data)) || (data.children && data.children.length === 1 && !checkIsSettle(data.children[0]))));
|
|
|
+ },
|
|
|
+ isNewPrice: function (data) {
|
|
|
+ if (!data || readOnly) return true;
|
|
|
+ if (!readOnly && data.is_add_list) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
},
|
|
|
};
|
|
|
@@ -897,6 +905,11 @@ $(document).ready(() => {
|
|
|
let i = 0;
|
|
|
// 重算金额和数量汇总
|
|
|
for (const node of newChangeList) {
|
|
|
+ if (node.gcl_id && _.findIndex(changeLedgerList, { id: node.gcl_id }) !== -1) {
|
|
|
+ node.is_add_list = 1;
|
|
|
+ const ledger = _.find(changeLedgerList, { id: node.gcl_id });
|
|
|
+ node.is_new_price = ledger ? ledger.is_new_price : 0;
|
|
|
+ }
|
|
|
if (node.children && node.children.length > 0) {
|
|
|
changeSpreadObj.calcOneSum(node);
|
|
|
node.order = i + 1;
|
|
|
@@ -1336,7 +1349,7 @@ $(document).ready(() => {
|
|
|
return;
|
|
|
}
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
- if (col.field === 'is_valuation') {
|
|
|
+ if (col.field === 'is_valuation' || col.field === 'is_new_price') {
|
|
|
return;
|
|
|
}
|
|
|
let validText = is_numeric(info.editingText) && _.indexOf(numField, col.field) !== -1 ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : '');
|
|
|
@@ -1588,21 +1601,21 @@ $(document).ready(() => {
|
|
|
};
|
|
|
changeSpreadObj.buttonClicked = function(e, info) {
|
|
|
if (info.sheet.zh_setting) {
|
|
|
- const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
- if (!select || !select.id) {
|
|
|
- changeSpreadObj.reloadRow(info.sheet, info.row);
|
|
|
- return;
|
|
|
- }
|
|
|
- const cInfo = _.find(changeList, { id: select.id });
|
|
|
- if (!cInfo) {
|
|
|
- toastr.error('数据错误,请刷新页面重试');
|
|
|
- changeSpreadObj.reloadRow(info.sheet, info.row);
|
|
|
- return;
|
|
|
+ if (info.sheet.isEditing()) {
|
|
|
+ info.sheet.endEdit(true);
|
|
|
}
|
|
|
+ const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
if (col.field === 'is_valuation') {
|
|
|
- if (info.sheet.isEditing()) {
|
|
|
- info.sheet.endEdit(true);
|
|
|
+ if (!select || !select.id) {
|
|
|
+ changeSpreadObj.reloadRow(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const cInfo = _.find(changeList, { id: select.id });
|
|
|
+ if (!cInfo) {
|
|
|
+ toastr.error('数据错误,请刷新页面重试');
|
|
|
+ changeSpreadObj.reloadRow(info.sheet, info.row);
|
|
|
+ return;
|
|
|
}
|
|
|
if (_.findIndex(changeUsedData, { cbid: select.id }) !== -1) {
|
|
|
return;
|
|
|
@@ -1623,6 +1636,32 @@ $(document).ready(() => {
|
|
|
cInfo.is_valuation = select.is_valuation;
|
|
|
changeSpreadObj.reloadRow(info.sheet, info.row);
|
|
|
});
|
|
|
+ } else if (col.field === 'is_new_price') {
|
|
|
+ // 判断是否为新增清单,是新增清单允许修改此项
|
|
|
+ if (changeCol.readOnly.isNewPrice(select)) {
|
|
|
+ changeSpreadObj.reloadRow(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ select.is_new_price = info.sheet.getValue(info.row, info.col) ? 0 : 1;
|
|
|
+ const c = _.find(changeLedgerList, { id: select.gcl_id });
|
|
|
+ const data = {
|
|
|
+ id: c.id,
|
|
|
+ tender_id: c.tender_id,
|
|
|
+ ledger_id: c.ledger_id,
|
|
|
+ is_new_price: select.is_new_price,
|
|
|
+ };
|
|
|
+ // 单独更新到新增部位
|
|
|
+ postData(window.location.pathname + '/revise/update', { postType: 'update', postData: data }, function (result) {
|
|
|
+ c.is_new_price = select.is_new_price;
|
|
|
+ const ledger = _.find(ledgerList, { id: c.id });
|
|
|
+ if (ledger) {
|
|
|
+ ledger.is_new_price = select.is_new_price;
|
|
|
+ }
|
|
|
+ changeSpreadObj.reloadRow(info.sheet, info.row);
|
|
|
+ }, function () {
|
|
|
+ select.is_new_price = info.sheet.getValue(info.row, info.col) ? 1 : 0;
|
|
|
+ changeSpreadObj.reloadRow(info.sheet, info.row);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -2763,6 +2802,7 @@ $(document).ready(() => {
|
|
|
const ledgerSpreadSetting = {
|
|
|
cols: [
|
|
|
{title: '计价', colSpan: '1', rowSpan: '2', field: 'is_valuation', hAlign: 1, width: 50, cellType: 'checkbox', getValue: 'getValue.is_valuation', readOnly: 'readOnly.isValuation'},
|
|
|
+ {title: '新增单价', colSpan: '1', rowSpan: '2', field: 'is_new_price', hAlign: 1, width: 35, cellType: 'checkbox', readOnly: 'readOnly.isNewPrice'},
|
|
|
{title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true, cellType: 'tree' },
|
|
|
{title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit2'},
|
|
|
{title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.isEdit2'},
|
|
|
@@ -2890,6 +2930,13 @@ $(document).ready(() => {
|
|
|
},
|
|
|
isSettle2: function (data) {
|
|
|
return !(!readOnly && data.clid && !checkIsSettle(data));
|
|
|
+ },
|
|
|
+ isNewPrice: function (data) {
|
|
|
+ if (!data || readOnly) return true;
|
|
|
+ if (!readOnly && data.is_leaf === 1 && _.findIndex(changeLedgerList, { id: data.id }) !== -1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
},
|
|
|
};
|
|
|
@@ -3445,7 +3492,7 @@ $(document).ready(() => {
|
|
|
return;
|
|
|
}
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
- if (col.field === 'is_valuation') {
|
|
|
+ if (col.field === 'is_valuation' || col.field === 'is_new_price') {
|
|
|
return;
|
|
|
}
|
|
|
const sortData = info.sheet.zh_dataType === 'tree' ? info.sheet.zh_tree.nodes : info.sheet.zh_data;
|
|
|
@@ -3736,21 +3783,21 @@ $(document).ready(() => {
|
|
|
};
|
|
|
ledgerTreeSpreadObj.buttonClicked = function(e, info) {
|
|
|
if (info.sheet.zh_setting) {
|
|
|
- const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
- if (!select || !select.clid) {
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- return;
|
|
|
- }
|
|
|
- const cInfo = _.find(changeList, { id: select.clid });
|
|
|
- if (!cInfo) {
|
|
|
- toastr.error('数据错误,请刷新页面重试');
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- return;
|
|
|
+ if (info.sheet.isEditing()) {
|
|
|
+ info.sheet.endEdit(true);
|
|
|
}
|
|
|
+ const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
if (col.field === 'is_valuation') {
|
|
|
- if (info.sheet.isEditing()) {
|
|
|
- info.sheet.endEdit(true);
|
|
|
+ if (!select || !select.clid) {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const cInfo = _.find(changeList, { id: select.clid });
|
|
|
+ if (!cInfo) {
|
|
|
+ toastr.error('数据错误,请刷新页面重试');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
}
|
|
|
if (_.findIndex(changeUsedData, { cbid: select.clid }) !== -1) {
|
|
|
return;
|
|
|
@@ -3770,6 +3817,37 @@ $(document).ready(() => {
|
|
|
cInfo.is_valuation = select.is_valuation;
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
});
|
|
|
+ } else if (col.field === 'is_new_price') {
|
|
|
+ if (ledgerCol.readOnly.isNewPrice(select)) {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ select.is_new_price = info.sheet.getValue(info.row, info.col) ? 0 : 1;
|
|
|
+ const c = _.find(changeLedgerList, { id: select.id });
|
|
|
+ const data = {
|
|
|
+ id: c.id,
|
|
|
+ tender_id: c.tender_id,
|
|
|
+ ledger_id: c.ledger_id,
|
|
|
+ is_new_price: select.is_new_price,
|
|
|
+ };
|
|
|
+ // 单独更新到新增部位
|
|
|
+ postData(window.location.pathname + '/revise/update', { postType: 'update', postData: data }, function (result) {
|
|
|
+ c.is_new_price = select.is_new_price;
|
|
|
+ const ledger = _.find(ledgerList, { id: c.id });
|
|
|
+ if (ledger) {
|
|
|
+ ledger.is_new_price = select.is_new_price;
|
|
|
+ }
|
|
|
+ const loadResult = {
|
|
|
+ update: [select],
|
|
|
+ };
|
|
|
+ const refreshData = ledgerTree.loadPostData(loadResult);
|
|
|
+ console.log(select, loadResult, refreshData);
|
|
|
+ ledgerTreeSpreadObj.refreshTree(ledgerSheet, refreshData);
|
|
|
+ }, function () {
|
|
|
+ select.is_new_price = info.sheet.getValue(info.row, info.col) ? 1 : 0;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -5514,7 +5592,7 @@ $(document).ready(() => {
|
|
|
ledgerTree.loadDatas(changeLedgers);
|
|
|
pos.loadDatas(changePoss);
|
|
|
treeCalc.calculateAll(ledgerTree);
|
|
|
- console.log(ledgerTree);
|
|
|
+ console.log(changeLedgers, ledgerTree);
|
|
|
SpreadJsObj.loadSheetData(ledgerSheet, SpreadJsObj.DataType.Tree, ledgerTree);
|
|
|
ledgerTree.expandByCustom(() => { return true; });
|
|
|
SpreadJsObj.refreshTreeRowVisible(ledgerSheet);
|