|  | @@ -56,7 +56,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |      let stdXmj, stdGcl, searchLedger;
 | 
	
		
			
				|  |  |      autoFlashHeight();
 | 
	
		
			
				|  |  |      billsSpreadSetting.cols.unshift({ title: '变更清单', colSpan: '1', rowSpan: '2', field: 'is_change', hAlign: 1, width: 60, cellType: 'checkbox', readOnly: 'readOnly.isChangeList', });
 | 
	
		
			
				|  |  | -    const billsIndex = _.findIndex(billsSpreadSetting.cols, { field: 'drawing_code' }) !== -1 ? _.findIndex(billsSpreadSetting.cols, { field: 'drawing_code' }) : (_.findIndex(billsSpreadSetting.cols, { field: 'sgfh_tp' }) !== -1 ? _.findIndex(billsSpreadSetting.cols, { field: 'sgfh_tp' }) + 1 : billsSpreadSetting.cols.length - 1);
 | 
	
		
			
				|  |  | +    const billsIndex = _.findIndex(billsSpreadSetting.cols, { field: 'drawing_code' }) !== -1 ? _.findIndex(billsSpreadSetting.cols, { field: 'drawing_code' }) : (_.findIndex(billsSpreadSetting.cols, { field: 'ex_tp1' }) !== -1 ? _.findIndex(billsSpreadSetting.cols, { field: 'ex_tp1' }) + 1 : billsSpreadSetting.cols.length - 1);
 | 
	
		
			
				|  |  |      console.log(billsSpreadSetting.cols);
 | 
	
		
			
				|  |  |      billsSpreadSetting.cols.splice(billsIndex, 0, { title: '计价', colSpan: '1', rowSpan: '2', field: 'is_valuation', hAlign: 1, width: 60, cellType: 'checkbox', readOnly: 'readOnly.isValuation', getValue: 'getValue.isValuation' });
 | 
	
		
			
				|  |  |      billsSpreadSetting.cols.splice(billsIndex + 1, 0, {title: '申请变更增(+)减(-)|数量', colSpan: '2|1', rowSpan: '1|1', field: 'camount', hAlign: 2, width: 60, readOnly: 'readOnly.isSettle', getValue: 'getValue.camount'},);
 | 
	
	
		
			
				|  | @@ -118,7 +118,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              },
 | 
	
		
			
				|  |  |              isSettle: function (data) {
 | 
	
		
			
				|  |  |                  if (!data) return true;
 | 
	
		
			
				|  |  | -                return !readOnly && !(data && data.name && _.findIndex(changeList, { gcl_id: data.id, mx_id: '' }) !== -1 && (!data.settle_status || (data.settle_status && data.settle_status !== settleStatus.finish)));
 | 
	
		
			
				|  |  | +                return !readOnly && !(!billsCol.readOnly.isChangeList(data) && (!data.settle_status || (data.settle_status && data.settle_status !== settleStatus.finish)));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      };
 | 
	
	
		
			
				|  | @@ -158,7 +158,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              },
 | 
	
		
			
				|  |  |              isSettle: function (data) {
 | 
	
		
			
				|  |  |                  if (!data) return true;
 | 
	
		
			
				|  |  | -                return !readOnly && !(data && data.name && _.findIndex(changeList, { gcl_id: data.lid, mx_id: data.id }) !== -1 && (!data.settle_status || (data.settle_status && data.settle_status !== settleStatus.finish)));
 | 
	
		
			
				|  |  | +                return !readOnly && !(!posCol.readOnly.isChangeList(data) && (!data.settle_status || (data.settle_status && data.settle_status !== settleStatus.finish)));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      };
 | 
	
	
		
			
				|  | @@ -352,8 +352,13 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                  if (data) {
 | 
	
		
			
				|  |  |                      const cInfo = _.find(changeList, { gcl_id: data.id, mx_id: '' });
 | 
	
		
			
				|  |  |                      if (!cInfo) {
 | 
	
		
			
				|  |  | -                        $('#bills-expr').val('').attr('readOnly', true);
 | 
	
		
			
				|  |  | -                        $('#bills-expr').removeAttr('data-row');
 | 
	
		
			
				|  |  | +                        if (billsCol.readOnly.isChangeList(data)) {
 | 
	
		
			
				|  |  | +                            $('#bills-expr').val('').attr('readOnly', true);
 | 
	
		
			
				|  |  | +                            $('#bills-expr').removeAttr('data-row');
 | 
	
		
			
				|  |  | +                        } else {
 | 
	
		
			
				|  |  | +                            $('#bills-expr').val('').attr('field', col.field).attr('org', '')
 | 
	
		
			
				|  |  | +                                .attr('readOnly', false).attr('data-row', sel.row);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  |                          const value = cInfo.camount_expr ? cInfo.camount_expr : ZhCalc.round(cInfo.camount, findDecimal(cInfo.unit));
 | 
	
		
			
				|  |  |                          $('#bills-expr').val(value).attr('field', col.field).attr('org', ZhCalc.round(cInfo.camount, findDecimal(cInfo.unit)))
 | 
	
	
		
			
				|  | @@ -839,11 +844,50 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                          SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  |                          return;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | -                    const cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
 | 
	
		
			
				|  |  | +                    let cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
 | 
	
		
			
				|  |  |                      if (!cInfo) {
 | 
	
		
			
				|  |  | -                        toastr.error('未勾选变更清单,无法编辑申请数量');
 | 
	
		
			
				|  |  | -                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | -                        return;
 | 
	
		
			
				|  |  | +                        if (billsCol.readOnly.isSettle(node)) {
 | 
	
		
			
				|  |  | +                            toastr.error('清单数据未完善,无法编辑申请数量');
 | 
	
		
			
				|  |  | +                            SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                            return;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        makeGclGatherData();
 | 
	
		
			
				|  |  | +                        const gclInfo = _.find(gclGatherData, function (item) {
 | 
	
		
			
				|  |  | +                            return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: node.id });
 | 
	
		
			
				|  |  | +                        });
 | 
	
		
			
				|  |  | +                        const xmjInfo = gclInfo.leafXmjs.find(function (item) {
 | 
	
		
			
				|  |  | +                            return item.gcl_id === node.id;
 | 
	
		
			
				|  |  | +                        });
 | 
	
		
			
				|  |  | +                        const oldCInfo = _.find(oldChangeList, { gcl_id: node.id, mx_id: '' });
 | 
	
		
			
				|  |  | +                        const data = {
 | 
	
		
			
				|  |  | +                            lid: gclInfo.leafXmjs[0].gcl_id || node.id,
 | 
	
		
			
				|  |  | +                            code: gclInfo.b_code,
 | 
	
		
			
				|  |  | +                            name: gclInfo.name || '',
 | 
	
		
			
				|  |  | +                            unit: gclInfo.unit || '',
 | 
	
		
			
				|  |  | +                            unit_price: gclInfo.unit_price,
 | 
	
		
			
				|  |  | +                            oamount: xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                            oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                            bwmx: xmjInfo.bwmx || xmjInfo.jldy,
 | 
	
		
			
				|  |  | +                            xmj_code: xmjInfo.code || '',
 | 
	
		
			
				|  |  | +                            xmj_jldy: xmjInfo.jldy || '',
 | 
	
		
			
				|  |  | +                            xmj_dwgc: xmjInfo.dwgc || '',
 | 
	
		
			
				|  |  | +                            xmj_fbgc: xmjInfo.fbgc || '',
 | 
	
		
			
				|  |  | +                            xmj_fxgc: xmjInfo.fxgc || '',
 | 
	
		
			
				|  |  | +                            gcl_id: node.id,
 | 
	
		
			
				|  |  | +                            mx_id: '',
 | 
	
		
			
				|  |  | +                        };
 | 
	
		
			
				|  |  | +                        if (oldCInfo) {
 | 
	
		
			
				|  |  | +                            data.detail = oldCInfo.detail;
 | 
	
		
			
				|  |  | +                            data.camount = oldCInfo.camount;
 | 
	
		
			
				|  |  | +                            data.camount_expr = oldCInfo.camount_expr;
 | 
	
		
			
				|  |  | +                            data.spamount = oldCInfo.spamount;
 | 
	
		
			
				|  |  | +                            data.is_valuation = oldCInfo.is_valuation;
 | 
	
		
			
				|  |  | +                            data.delimit = oldCInfo.delimit;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        cInfo = data;
 | 
	
		
			
				|  |  | +                        // toastr.error('未勾选变更清单,无法编辑申请数量');
 | 
	
		
			
				|  |  | +                        // SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                        // return;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      let validText = info.editingText ? trimInvalidChar(info.editingText) : '';
 | 
	
		
			
				|  |  |                      const orgValue = validText && validText !== ''
 | 
	
	
		
			
				|  | @@ -869,35 +913,59 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                          return;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      validText = parseFloat(exprQuantity.quantity);
 | 
	
		
			
				|  |  | -                    // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | -                    const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
 | 
	
		
			
				|  |  | -                    if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | -                        toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | -                        return;
 | 
	
		
			
				|  |  | -                    } else if (usedInfo && usedInfo.qty < 0  && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | -                        toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | -                        return;
 | 
	
		
			
				|  |  | +                    if (cInfo.id) {
 | 
	
		
			
				|  |  | +                        // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | +                        const usedInfo = _.find(changeUsedData, {cbid: cInfo.id});
 | 
	
		
			
				|  |  | +                        if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | +                            toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                            SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                            return;
 | 
	
		
			
				|  |  | +                        } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | +                            toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                            SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                            return;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      cInfo[col.field] = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
 | 
	
		
			
				|  |  |                      cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
 | 
	
		
			
				|  |  |                      cInfo.camount_expr = exprQuantity.expr;
 | 
	
		
			
				|  |  |                      node[col.field] = cInfo[col.field];
 | 
	
		
			
				|  |  |                      delete cInfo.waitingLoading;
 | 
	
		
			
				|  |  | -                    postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'update', updateData: cInfo }, function (result) {
 | 
	
		
			
				|  |  | -                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | -                        const billsNode = node;
 | 
	
		
			
				|  |  | -                        billsTreeSpreadObj.reCalcCamount(billsNode);
 | 
	
		
			
				|  |  | -                        const loadResult = { update: [billsNode] };
 | 
	
		
			
				|  |  | -                        const refreshNode = billsTree.loadPostData(loadResult);
 | 
	
		
			
				|  |  | -                        billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | -                    }, function () {
 | 
	
		
			
				|  |  | -                        cInfo[col.field] = orgValue;
 | 
	
		
			
				|  |  | -                        cInfo.spamount = orgValue;
 | 
	
		
			
				|  |  | -                        node[col.field] = orgValue;
 | 
	
		
			
				|  |  | -                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | -                    });
 | 
	
		
			
				|  |  | +                    if (cInfo.id) {
 | 
	
		
			
				|  |  | +                        postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {
 | 
	
		
			
				|  |  | +                            type: 'update',
 | 
	
		
			
				|  |  | +                            updateData: cInfo
 | 
	
		
			
				|  |  | +                        }, function (result) {
 | 
	
		
			
				|  |  | +                            SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                            const billsNode = node;
 | 
	
		
			
				|  |  | +                            billsTreeSpreadObj.reCalcCamount(billsNode);
 | 
	
		
			
				|  |  | +                            const loadResult = {update: [billsNode]};
 | 
	
		
			
				|  |  | +                            const refreshNode = billsTree.loadPostData(loadResult);
 | 
	
		
			
				|  |  | +                            billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | +                        }, function () {
 | 
	
		
			
				|  |  | +                            cInfo[col.field] = orgValue;
 | 
	
		
			
				|  |  | +                            cInfo.spamount = orgValue;
 | 
	
		
			
				|  |  | +                            node[col.field] = orgValue;
 | 
	
		
			
				|  |  | +                            SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                        });
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        // 更新至服务器
 | 
	
		
			
				|  |  | +                        postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'add-change-list', postData: [cInfo]}, function (result) {
 | 
	
		
			
				|  |  | +                            changeList = result.changeList;
 | 
	
		
			
				|  |  | +                            node.is_change = 1;
 | 
	
		
			
				|  |  | +                            node.is_valuation = cInfo.is_valuation !== undefined ? cInfo.is_valuation : 1;
 | 
	
		
			
				|  |  | +                            node.camount = cInfo.camount !== undefined ? cInfo.camount : null;
 | 
	
		
			
				|  |  | +                            billsTreeSpreadObj.reCalcCamount(node);
 | 
	
		
			
				|  |  | +                            const refreshNode = billsTree.loadPostData({ update: [node] });
 | 
	
		
			
				|  |  | +                            billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | +                            SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                        }, function () {
 | 
	
		
			
				|  |  | +                            cInfo[col.field] = orgValue;
 | 
	
		
			
				|  |  | +                            cInfo.spamount = orgValue;
 | 
	
		
			
				|  |  | +                            node[col.field] = orgValue;
 | 
	
		
			
				|  |  | +                            SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                        });
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1031,9 +1099,10 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                  // sameParent: {type: 'warning', msg: '仅可粘贴同层节点'},
 | 
	
		
			
				|  |  |                  settle: {type: 'warning', msg: '已结算节点,不可修改数量、单价、金额'},
 | 
	
		
			
				|  |  |              };
 | 
	
		
			
				|  |  | -            const datas = [], filterNodes = [], camountData = [];
 | 
	
		
			
				|  |  | +            const datas = [], filterNodes = [], camountData = [], insertCamountData = [];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              let pid, level, filterRow = 0;
 | 
	
		
			
				|  |  | +            makeGclGatherData();
 | 
	
		
			
				|  |  |              for (let iRow = 0; iRow < info.cellRange.rowCount; iRow ++) {
 | 
	
		
			
				|  |  |                  const curRow = info.cellRange.row + iRow;
 | 
	
		
			
				|  |  |                  const node = tree.nodes[curRow];
 | 
	
	
		
			
				|  | @@ -1096,10 +1165,43 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      if (colSetting.field === 'camount') {
 | 
	
		
			
				|  |  |                          bPaste = true;
 | 
	
		
			
				|  |  |                          let validText = value;
 | 
	
		
			
				|  |  | -                        const cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
 | 
	
		
			
				|  |  | +                        let cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
 | 
	
		
			
				|  |  |                          if (!cInfo) {
 | 
	
		
			
				|  |  | -                            bPaste = false;
 | 
	
		
			
				|  |  | -                            continue;
 | 
	
		
			
				|  |  | +                            const gclInfo = _.find(gclGatherData, function (item) {
 | 
	
		
			
				|  |  | +                                return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: node.id });
 | 
	
		
			
				|  |  | +                            });
 | 
	
		
			
				|  |  | +                            const xmjInfo = gclInfo.leafXmjs.find(function (item) {
 | 
	
		
			
				|  |  | +                                return item.gcl_id === node.id;
 | 
	
		
			
				|  |  | +                            });
 | 
	
		
			
				|  |  | +                            const oldCInfo = _.find(oldChangeList, { gcl_id: node.id, mx_id: '' });
 | 
	
		
			
				|  |  | +                            const data = {
 | 
	
		
			
				|  |  | +                                lid: gclInfo.leafXmjs[0].gcl_id || node.id,
 | 
	
		
			
				|  |  | +                                code: gclInfo.b_code,
 | 
	
		
			
				|  |  | +                                name: gclInfo.name || '',
 | 
	
		
			
				|  |  | +                                unit: gclInfo.unit || '',
 | 
	
		
			
				|  |  | +                                unit_price: gclInfo.unit_price,
 | 
	
		
			
				|  |  | +                                oamount: xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                                oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                                bwmx: xmjInfo.bwmx || xmjInfo.jldy,
 | 
	
		
			
				|  |  | +                                xmj_code: xmjInfo.code || '',
 | 
	
		
			
				|  |  | +                                xmj_jldy: xmjInfo.jldy || '',
 | 
	
		
			
				|  |  | +                                xmj_dwgc: xmjInfo.dwgc || '',
 | 
	
		
			
				|  |  | +                                xmj_fbgc: xmjInfo.fbgc || '',
 | 
	
		
			
				|  |  | +                                xmj_fxgc: xmjInfo.fxgc || '',
 | 
	
		
			
				|  |  | +                                gcl_id: node.id,
 | 
	
		
			
				|  |  | +                                mx_id: '',
 | 
	
		
			
				|  |  | +                            };
 | 
	
		
			
				|  |  | +                            if (oldCInfo) {
 | 
	
		
			
				|  |  | +                                data.detail = oldCInfo.detail;
 | 
	
		
			
				|  |  | +                                data.camount = oldCInfo.camount;
 | 
	
		
			
				|  |  | +                                data.camount_expr = oldCInfo.camount_expr;
 | 
	
		
			
				|  |  | +                                data.spamount = oldCInfo.spamount;
 | 
	
		
			
				|  |  | +                                data.is_valuation = oldCInfo.is_valuation;
 | 
	
		
			
				|  |  | +                                data.delimit = oldCInfo.delimit;
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            cInfo = data;
 | 
	
		
			
				|  |  | +                            // bPaste = false;
 | 
	
		
			
				|  |  | +                            // continue;
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          const exprQuantity = {
 | 
	
		
			
				|  |  |                              expr: '',
 | 
	
	
		
			
				|  | @@ -1117,21 +1219,30 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                              continue;
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          validText = parseFloat(exprQuantity.quantity);
 | 
	
		
			
				|  |  | -                        // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | -                        const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
 | 
	
		
			
				|  |  | -                        if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | -                            toastr.error(curRow ? '台账第' + (curRow+1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                            bPaste = false;
 | 
	
		
			
				|  |  | -                            continue;
 | 
	
		
			
				|  |  | -                        } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | -                            toastr.error(curRow ? '台账第' + (curRow+1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                            bPaste = false;
 | 
	
		
			
				|  |  | -                            continue;
 | 
	
		
			
				|  |  | +                        if (cInfo.id) {
 | 
	
		
			
				|  |  | +                            // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | +                            const usedInfo = _.find(changeUsedData, {cbid: cInfo.id});
 | 
	
		
			
				|  |  | +                            if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | +                                toastr.error(curRow ? '台账第' + (curRow + 1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                                bPaste = false;
 | 
	
		
			
				|  |  | +                                continue;
 | 
	
		
			
				|  |  | +                            } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | +                                toastr.error(curRow ? '台账第' + (curRow + 1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                                bPaste = false;
 | 
	
		
			
				|  |  | +                                continue;
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          if (bPaste) {
 | 
	
		
			
				|  |  |                              node.camount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
 | 
	
		
			
				|  |  |                              filterNodes.push(node);
 | 
	
		
			
				|  |  | -                            camountData.push({id: cInfo.id, camount: node.camount, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(node.unit)) || 0 });
 | 
	
		
			
				|  |  | +                            if (cInfo.id) {
 | 
	
		
			
				|  |  | +                                camountData.push({id: cInfo.id, camount: node.camount, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(node.unit)) || 0 });
 | 
	
		
			
				|  |  | +                            } else {
 | 
	
		
			
				|  |  | +                                cInfo.camount = node.camount;
 | 
	
		
			
				|  |  | +                                cInfo.camount_expr = exprQuantity.expr;
 | 
	
		
			
				|  |  | +                                cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
 | 
	
		
			
				|  |  | +                                insertCamountData.push(cInfo);
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  |                          } else {
 | 
	
		
			
				|  |  |                              filterNodes.push(node);
 | 
	
		
			
				|  |  |                              SpreadJsObj.reLoadRowData(info.sheet, curRow);
 | 
	
	
		
			
				|  | @@ -1183,9 +1294,13 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      filterNodes.push(node);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            if (camountData.length > 0) {
 | 
	
		
			
				|  |  | -                postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', updateData: camountData }, function (result) {
 | 
	
		
			
				|  |  | +            if (camountData.length > 0 || insertCamountData.length > 0) {
 | 
	
		
			
				|  |  | +                postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', insertData: insertCamountData, updateData: camountData }, function (result) {
 | 
	
		
			
				|  |  |                      changeList = result;
 | 
	
		
			
				|  |  | +                    // 给所有filterNodes 加上is_change=1
 | 
	
		
			
				|  |  | +                    filterNodes.forEach(function (item) {
 | 
	
		
			
				|  |  | +                        item.is_change = 1;
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  |                      const loadResult = { update: filterNodes };
 | 
	
		
			
				|  |  |                      const refreshNode = billsTree.loadPostData(loadResult);
 | 
	
		
			
				|  |  |                      billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
	
		
			
				|  | @@ -1474,8 +1589,11 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              if (col.field === 'camount') {
 | 
	
		
			
				|  |  |                  const cInfo = _.find(changeList, { gcl_id: node.id, mx_id: '' });
 | 
	
		
			
				|  |  |                  if (!cInfo) {
 | 
	
		
			
				|  |  | -                    toastr.error('未勾选变更清单,无法编辑申请数量');
 | 
	
		
			
				|  |  | -                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                    if (billsCol.readOnly.isSettle(node)) {
 | 
	
		
			
				|  |  | +                        toastr.error('清单数据未完善,无法编辑申请数量');
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                        return
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (cInfo.camount_expr && cInfo.camount_expr !== '') {
 | 
	
	
		
			
				|  | @@ -1773,10 +1891,49 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              if (orgValue === newValue || (!orgValue && newValue == '')) { return; }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              if (field === 'camount') {
 | 
	
		
			
				|  |  | -                const cInfo = _.find(changeList, { gcl_id: select.id, mx_id: '' });
 | 
	
		
			
				|  |  | +                let cInfo = _.find(changeList, { gcl_id: select.id, mx_id: '' });
 | 
	
		
			
				|  |  |                  if (!cInfo) {
 | 
	
		
			
				|  |  | -                    toastr.error('未勾选变更清单,无法编辑申请数量');
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | +                    if (billsCol.readOnly.isChangeList(select)) {
 | 
	
		
			
				|  |  | +                        toastr.error('清单数据未完善,无法编辑申请数量');
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(billsSheet, row);
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    makeGclGatherData();
 | 
	
		
			
				|  |  | +                    const gclInfo = _.find(gclGatherData, function (item) {
 | 
	
		
			
				|  |  | +                        return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: select.id });
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                    const xmjInfo = gclInfo.leafXmjs.find(function (item) {
 | 
	
		
			
				|  |  | +                        return item.gcl_id === select.id;
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                    const oldCInfo = _.find(oldChangeList, { gcl_id: select.id, mx_id: '' });
 | 
	
		
			
				|  |  | +                    const data = {
 | 
	
		
			
				|  |  | +                        lid: gclInfo.leafXmjs[0].gcl_id || select.id,
 | 
	
		
			
				|  |  | +                        code: gclInfo.b_code,
 | 
	
		
			
				|  |  | +                        name: gclInfo.name || '',
 | 
	
		
			
				|  |  | +                        unit: gclInfo.unit || '',
 | 
	
		
			
				|  |  | +                        unit_price: gclInfo.unit_price,
 | 
	
		
			
				|  |  | +                        oamount: xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                        oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                        bwmx: xmjInfo.bwmx || xmjInfo.jldy,
 | 
	
		
			
				|  |  | +                        xmj_code: xmjInfo.code || '',
 | 
	
		
			
				|  |  | +                        xmj_jldy: xmjInfo.jldy || '',
 | 
	
		
			
				|  |  | +                        xmj_dwgc: xmjInfo.dwgc || '',
 | 
	
		
			
				|  |  | +                        xmj_fbgc: xmjInfo.fbgc || '',
 | 
	
		
			
				|  |  | +                        xmj_fxgc: xmjInfo.fxgc || '',
 | 
	
		
			
				|  |  | +                        gcl_id: select.id,
 | 
	
		
			
				|  |  | +                        mx_id: '',
 | 
	
		
			
				|  |  | +                    };
 | 
	
		
			
				|  |  | +                    if (oldCInfo) {
 | 
	
		
			
				|  |  | +                        data.detail = oldCInfo.detail;
 | 
	
		
			
				|  |  | +                        data.camount = oldCInfo.camount;
 | 
	
		
			
				|  |  | +                        data.camount_expr = oldCInfo.camount_expr;
 | 
	
		
			
				|  |  | +                        data.spamount = oldCInfo.spamount;
 | 
	
		
			
				|  |  | +                        data.is_valuation = oldCInfo.is_valuation;
 | 
	
		
			
				|  |  | +                        data.delimit = oldCInfo.delimit;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    cInfo = data;
 | 
	
		
			
				|  |  | +                    // toastr.error('未勾选变更清单,无法编辑申请数量');
 | 
	
		
			
				|  |  | +                    // return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  const exprQuantity = {
 | 
	
		
			
				|  |  |                      expr: '',
 | 
	
	
		
			
				|  | @@ -1792,33 +1949,54 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  const camount = parseFloat(exprQuantity.quantity);
 | 
	
		
			
				|  |  | -                // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | -                const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
 | 
	
		
			
				|  |  | -                if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | -                    toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | -                } else if (usedInfo && usedInfo.qty < 0  && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | -                    toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | +                if (cInfo.id) {
 | 
	
		
			
				|  |  | +                    // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | +                    const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
 | 
	
		
			
				|  |  | +                    if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | +                        toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  | +                    } else if (usedInfo && usedInfo.qty < 0  && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | +                        toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  cInfo.camount = ZhCalc.round(camount, findDecimal(select.unit)) || 0;
 | 
	
		
			
				|  |  |                  select.camount = ZhCalc.round(camount, findDecimal(select.unit)) || 0;
 | 
	
		
			
				|  |  |                  cInfo.spamount = ZhCalc.round(camount, findDecimal(select.unit)) || 0;
 | 
	
		
			
				|  |  |                  cInfo.camount_expr = exprQuantity.expr;
 | 
	
		
			
				|  |  |                  delete cInfo.waitingLoading;
 | 
	
		
			
				|  |  | -                postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'update', updateData: cInfo }, function (result) {
 | 
	
		
			
				|  |  | -                    SpreadJsObj.reLoadRowData(billsSheet, row);
 | 
	
		
			
				|  |  | -                    billsTreeSpreadObj.reCalcCamount(select);
 | 
	
		
			
				|  |  | -                    const loadResult = { update: [select] };
 | 
	
		
			
				|  |  | -                    const refreshNode = billsTree.loadPostData(loadResult);
 | 
	
		
			
				|  |  | -                    billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | -                    billsTreeSpreadObj.loadExprToInput(billsSheet);
 | 
	
		
			
				|  |  | -                }, function () {
 | 
	
		
			
				|  |  | -                    cInfo.camount = orgValue;
 | 
	
		
			
				|  |  | -                    cInfo.spamount = orgValue;
 | 
	
		
			
				|  |  | -                    select.camount = orgValue;
 | 
	
		
			
				|  |  | -                    SpreadJsObj.reLoadRowData(billsSheet, row);
 | 
	
		
			
				|  |  | -                });
 | 
	
		
			
				|  |  | +                if (cInfo.id) {
 | 
	
		
			
				|  |  | +                    postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'update', updateData: cInfo }, function (result) {
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(billsSheet, row);
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.reCalcCamount(select);
 | 
	
		
			
				|  |  | +                        const loadResult = { update: [select] };
 | 
	
		
			
				|  |  | +                        const refreshNode = billsTree.loadPostData(loadResult);
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.loadExprToInput(billsSheet);
 | 
	
		
			
				|  |  | +                    }, function () {
 | 
	
		
			
				|  |  | +                        cInfo.camount = orgValue;
 | 
	
		
			
				|  |  | +                        cInfo.spamount = orgValue;
 | 
	
		
			
				|  |  | +                        select.camount = orgValue;
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(billsSheet, row);
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    // 更新至服务器
 | 
	
		
			
				|  |  | +                    postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'add-change-list', postData: [cInfo]}, function (result) {
 | 
	
		
			
				|  |  | +                        changeList = result.changeList;
 | 
	
		
			
				|  |  | +                        select.is_change = 1;
 | 
	
		
			
				|  |  | +                        select.is_valuation = cInfo.is_valuation !== undefined ? cInfo.is_valuation : 1;
 | 
	
		
			
				|  |  | +                        select.camount = cInfo.camount !== undefined ? cInfo.camount : null;
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.reCalcCamount(select);
 | 
	
		
			
				|  |  | +                        const refreshNode = billsTree.loadPostData({ update: [select] });
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(billsSheet, row);
 | 
	
		
			
				|  |  | +                    }, function () {
 | 
	
		
			
				|  |  | +                        cInfo[col.field] = orgValue;
 | 
	
		
			
				|  |  | +                        cInfo.spamount = orgValue;
 | 
	
		
			
				|  |  | +                        node[col.field] = orgValue;
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2201,8 +2379,13 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                  if (data) {
 | 
	
		
			
				|  |  |                      const cInfo = _.find(changeList, { gcl_id: data.lid, mx_id: data.id });
 | 
	
		
			
				|  |  |                      if (!cInfo) {
 | 
	
		
			
				|  |  | -                        $('#pos-expr').val('').attr('readOnly', true);
 | 
	
		
			
				|  |  | -                        $('#pos-expr').removeAttr('data-row');
 | 
	
		
			
				|  |  | +                        if (posCol.readOnly.isChangeList(data)) {
 | 
	
		
			
				|  |  | +                            $('#pos-expr').val('').attr('readOnly', true);
 | 
	
		
			
				|  |  | +                            $('#pos-expr').removeAttr('data-row');
 | 
	
		
			
				|  |  | +                        } else {
 | 
	
		
			
				|  |  | +                            $('#pos-expr').val('').attr('field', col.field).attr('org', '')
 | 
	
		
			
				|  |  | +                                .attr('readOnly', false).attr('data-row', sel.row);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  |                          const value = cInfo.camount_expr ? cInfo.camount_expr : cInfo.camount;
 | 
	
		
			
				|  |  |                          $('#pos-expr').val(value).attr('field', col.field).attr('org', cInfo.camount)
 | 
	
	
		
			
				|  | @@ -2353,9 +2536,12 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              if (col.field === 'camount') {
 | 
	
		
			
				|  |  |                  const cInfo = _.find(changeList, { gcl_id: node.lid, mx_id: node.id });
 | 
	
		
			
				|  |  |                  if (!cInfo) {
 | 
	
		
			
				|  |  | -                    toastr.error('未勾选变更清单,无法编辑申请数量');
 | 
	
		
			
				|  |  | -                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | +                    if (posCol.readOnly.isSettle(node)) {
 | 
	
		
			
				|  |  | +                        toastr.error('清单数据未完善,无法编辑申请数量');
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                        return
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    return
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (cInfo.camount_expr && cInfo.camount_expr !== '') {
 | 
	
		
			
				|  |  |                      info.sheet.getCell(info.row, info.col).text(cInfo.camount_expr);
 | 
	
	
		
			
				|  | @@ -2524,11 +2710,48 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                const cInfo = _.find(changeList, { gcl_id: posData.lid, mx_id: posData.id });
 | 
	
		
			
				|  |  | +                let cInfo = _.find(changeList, { gcl_id: posData.lid, mx_id: posData.id });
 | 
	
		
			
				|  |  |                  if (!cInfo) {
 | 
	
		
			
				|  |  | -                    toastr.error('未勾选变更清单,无法编辑申请数量');
 | 
	
		
			
				|  |  | -                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | +                    if (posCol.readOnly.isSettle(posData)) {
 | 
	
		
			
				|  |  | +                        toastr.error('清单数据未完善,无法编辑申请数量');
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                        return
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    makeGclGatherData();
 | 
	
		
			
				|  |  | +                    const gclInfo = _.find(gclGatherData, function (item) {
 | 
	
		
			
				|  |  | +                        return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: posData.lid, mx_id: posData.id });
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                    const xmjInfo = _.find(gclInfo.leafXmjs, { mx_id: posData.id });
 | 
	
		
			
				|  |  | +                    const oldCInfo = _.find(oldChangeList, { gcl_id: posData.lid, mx_id: posData.id });
 | 
	
		
			
				|  |  | +                    const data = {
 | 
	
		
			
				|  |  | +                        lid: posData.lid,
 | 
	
		
			
				|  |  | +                        code: gclInfo.b_code,
 | 
	
		
			
				|  |  | +                        name: gclInfo.name || '',
 | 
	
		
			
				|  |  | +                        unit: gclInfo.unit || '',
 | 
	
		
			
				|  |  | +                        unit_price: gclInfo.unit_price,
 | 
	
		
			
				|  |  | +                        oamount: xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                        oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                        bwmx: xmjInfo.bwmx || xmjInfo.jldy || '',
 | 
	
		
			
				|  |  | +                        xmj_code: xmjInfo.code || '',
 | 
	
		
			
				|  |  | +                        xmj_jldy: xmjInfo.jldy || '',
 | 
	
		
			
				|  |  | +                        xmj_dwgc: xmjInfo.dwgc || '',
 | 
	
		
			
				|  |  | +                        xmj_fbgc: xmjInfo.fbgc || '',
 | 
	
		
			
				|  |  | +                        xmj_fxgc: xmjInfo.fxgc || '',
 | 
	
		
			
				|  |  | +                        gcl_id: posData.lid,
 | 
	
		
			
				|  |  | +                        mx_id: posData.id,
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    if (oldCInfo) {
 | 
	
		
			
				|  |  | +                        data.detail = oldCInfo.detail;
 | 
	
		
			
				|  |  | +                        data.camount = oldCInfo.camount;
 | 
	
		
			
				|  |  | +                        data.camount_expr = oldCInfo.camount_expr;
 | 
	
		
			
				|  |  | +                        data.spamount = oldCInfo.spamount;
 | 
	
		
			
				|  |  | +                        data.is_valuation = oldCInfo.is_valuation;
 | 
	
		
			
				|  |  | +                        data.delimit = oldCInfo.delimit;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    cInfo = data;
 | 
	
		
			
				|  |  | +                    // toastr.error('未勾选变更清单,无法编辑申请数量');
 | 
	
		
			
				|  |  | +                    // SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                    // return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  let validText = info.editingText ? trimInvalidChar(info.editingText) : '';
 | 
	
		
			
				|  |  |                  const orgValue = validText && validText !== ''
 | 
	
	
		
			
				|  | @@ -2554,33 +2777,57 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  validText = parseFloat(exprQuantity.quantity);
 | 
	
		
			
				|  |  | -                // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | -                const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
 | 
	
		
			
				|  |  | -                if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | -                    toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | -                } else if (usedInfo && usedInfo.qty < 0  && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | -                    toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | +                if (cInfo.id) {
 | 
	
		
			
				|  |  | +                    // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | +                    const usedInfo = _.find(changeUsedData, {cbid: cInfo.id});
 | 
	
		
			
				|  |  | +                    if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | +                        toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  | +                    } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | +                        toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  cInfo[col.field] = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
 | 
	
		
			
				|  |  |                  cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
 | 
	
		
			
				|  |  |                  cInfo.camount_expr = exprQuantity.expr;
 | 
	
		
			
				|  |  |                  delete cInfo.waitingLoading;
 | 
	
		
			
				|  |  | -                postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'update', updateData: cInfo }, function (result) {
 | 
	
		
			
				|  |  | -                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | -                    const billsNode = node;
 | 
	
		
			
				|  |  | -                    billsTreeSpreadObj.reCalcCamount(billsNode);
 | 
	
		
			
				|  |  | -                    const loadResult = { update: [billsNode] };
 | 
	
		
			
				|  |  | -                    const refreshNode = billsTree.loadPostData(loadResult);
 | 
	
		
			
				|  |  | -                    billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | -                }, function () {
 | 
	
		
			
				|  |  | -                    cInfo[col.field] = orgValue;
 | 
	
		
			
				|  |  | -                    cInfo.spamount = orgValue;
 | 
	
		
			
				|  |  | -                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | -                });
 | 
	
		
			
				|  |  | +                if (cInfo.id) {
 | 
	
		
			
				|  |  | +                    postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type: 'update', updateData: cInfo }, function (result) {
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                        const billsNode = node;
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.reCalcCamount(billsNode);
 | 
	
		
			
				|  |  | +                        const loadResult = {update: [billsNode]};
 | 
	
		
			
				|  |  | +                        const refreshNode = billsTree.loadPostData(loadResult);
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | +                    }, function () {
 | 
	
		
			
				|  |  | +                        cInfo[col.field] = orgValue;
 | 
	
		
			
				|  |  | +                        cInfo.spamount = orgValue;
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'add-change-list', postData: [cInfo]}, function (result) {
 | 
	
		
			
				|  |  | +                        changeList = result.changeList;
 | 
	
		
			
				|  |  | +                        posData.is_change = 1;
 | 
	
		
			
				|  |  | +                        posData.is_valuation = cInfo.is_valuation !== undefined ? cInfo.is_valuation : 1;
 | 
	
		
			
				|  |  | +                        posData.camount = cInfo.camount !== undefined ? cInfo.camount : null;
 | 
	
		
			
				|  |  | +                        posData.ca_tp = cInfo.camount !== undefined ? ZhCalc.mul(cInfo.camount, cInfo.unit_price, decimal.tp) : null;
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                        const billsNode = SpreadJsObj.getSelectObject(billsSheet);
 | 
	
		
			
				|  |  | +                        // info.sheet.setValue(info.row, valutaionCol, data.is_valuation !== undefined ? data.is_valuation : 1);
 | 
	
		
			
				|  |  | +                        if (_.findIndex(changeList, { gcl_id: posData.lid }) !== -1) {
 | 
	
		
			
				|  |  | +                            billsNode.is_change = 1;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.reCalcCamount(billsNode);
 | 
	
		
			
				|  |  | +                        const loadResult = { update: [billsNode] };
 | 
	
		
			
				|  |  | +                        const refreshNode = billsTree.loadPostData(loadResult);
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | +                    }, function () {
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2881,7 +3128,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              const data = [];
 | 
	
		
			
				|  |  | -            const camountData = [];
 | 
	
		
			
				|  |  | +            const camountData = [], insertCamountData = [];
 | 
	
		
			
				|  |  |              const sortData = info.sheet.zh_data || [];
 | 
	
		
			
				|  |  |              const hint = {
 | 
	
		
			
				|  |  |                  expr: {type: 'warning', msg: '粘贴了表达式非法,已过滤'},
 | 
	
	
		
			
				|  | @@ -2897,6 +3144,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              let bHint = false;
 | 
	
		
			
				|  |  |              const lastOrder = sortData.length > 0 ? sortData[sortData.length - 1].porder + 1 : 1;
 | 
	
		
			
				|  |  | +            makeGclGatherData();
 | 
	
		
			
				|  |  |              for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
 | 
	
		
			
				|  |  |                  let bPaste = true;
 | 
	
		
			
				|  |  |                  const curRow = info.cellRange.row + iRow;
 | 
	
	
		
			
				|  | @@ -2915,10 +3163,41 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      if (colSetting.field === 'camount') {
 | 
	
		
			
				|  |  |                          bPaste = true;
 | 
	
		
			
				|  |  |                          let validText = posData[colSetting.field];
 | 
	
		
			
				|  |  | -                        const cInfo = _.find(changeList, { gcl_id: posData.lid, mx_id: posData.id });
 | 
	
		
			
				|  |  | +                        let cInfo = _.find(changeList, { gcl_id: posData.lid, mx_id: posData.id });
 | 
	
		
			
				|  |  |                          if (!cInfo) {
 | 
	
		
			
				|  |  | -                            bPaste = false;
 | 
	
		
			
				|  |  | -                            continue;
 | 
	
		
			
				|  |  | +                            const gclInfo = _.find(gclGatherData, function (item) {
 | 
	
		
			
				|  |  | +                                return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: posData.lid, mx_id: posData.id });
 | 
	
		
			
				|  |  | +                            });
 | 
	
		
			
				|  |  | +                            const xmjInfo = _.find(gclInfo.leafXmjs, { mx_id: posData.id });
 | 
	
		
			
				|  |  | +                            const oldCInfo = _.find(oldChangeList, { gcl_id: posData.lid, mx_id: posData.id });
 | 
	
		
			
				|  |  | +                            const data = {
 | 
	
		
			
				|  |  | +                                lid: posData.lid,
 | 
	
		
			
				|  |  | +                                code: gclInfo.b_code,
 | 
	
		
			
				|  |  | +                                name: gclInfo.name || '',
 | 
	
		
			
				|  |  | +                                unit: gclInfo.unit || '',
 | 
	
		
			
				|  |  | +                                unit_price: gclInfo.unit_price,
 | 
	
		
			
				|  |  | +                                oamount: xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                                oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                                bwmx: xmjInfo.bwmx || xmjInfo.jldy || '',
 | 
	
		
			
				|  |  | +                                xmj_code: xmjInfo.code || '',
 | 
	
		
			
				|  |  | +                                xmj_jldy: xmjInfo.jldy || '',
 | 
	
		
			
				|  |  | +                                xmj_dwgc: xmjInfo.dwgc || '',
 | 
	
		
			
				|  |  | +                                xmj_fbgc: xmjInfo.fbgc || '',
 | 
	
		
			
				|  |  | +                                xmj_fxgc: xmjInfo.fxgc || '',
 | 
	
		
			
				|  |  | +                                gcl_id: posData.lid,
 | 
	
		
			
				|  |  | +                                mx_id: posData.id,
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            if (oldCInfo) {
 | 
	
		
			
				|  |  | +                                data.detail = oldCInfo.detail;
 | 
	
		
			
				|  |  | +                                data.camount = oldCInfo.camount;
 | 
	
		
			
				|  |  | +                                data.camount_expr = oldCInfo.camount_expr;
 | 
	
		
			
				|  |  | +                                data.spamount = oldCInfo.spamount;
 | 
	
		
			
				|  |  | +                                data.is_valuation = oldCInfo.is_valuation;
 | 
	
		
			
				|  |  | +                                data.delimit = oldCInfo.delimit;
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            cInfo = data;
 | 
	
		
			
				|  |  | +                            // bPaste = false;
 | 
	
		
			
				|  |  | +                            // continue;
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          const exprQuantity = {
 | 
	
		
			
				|  |  |                              expr: '',
 | 
	
	
		
			
				|  | @@ -2936,19 +3215,28 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                              continue;
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          validText = parseFloat(exprQuantity.quantity);
 | 
	
		
			
				|  |  | -                        // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | -                        const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
 | 
	
		
			
				|  |  | -                        if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | -                            toastr.error(curRow ? '计量单元第' + (curRow+1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                            bPaste = false;
 | 
	
		
			
				|  |  | -                            continue;
 | 
	
		
			
				|  |  | -                        } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | -                            toastr.error(curRow ? '计量单元第' + (curRow+1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                            bPaste = false;
 | 
	
		
			
				|  |  | -                            continue;
 | 
	
		
			
				|  |  | +                        if (cInfo.id) {
 | 
	
		
			
				|  |  | +                            // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | +                            const usedInfo = _.find(changeUsedData, {cbid: cInfo.id});
 | 
	
		
			
				|  |  | +                            if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | +                                toastr.error(curRow ? '计量单元第' + (curRow + 1) + '行变更数值必须大于等于已调用值 ' + usedInfo.qty : '清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                                bPaste = false;
 | 
	
		
			
				|  |  | +                                continue;
 | 
	
		
			
				|  |  | +                            } else if (usedInfo && usedInfo.qty < 0 && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | +                                toastr.error(curRow ? '计量单元第' + (curRow + 1) + '行变更数值必须小于等于已调用值 ' + usedInfo.qty : '清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                                bPaste = false;
 | 
	
		
			
				|  |  | +                                continue;
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          if (bPaste) {
 | 
	
		
			
				|  |  | -                            camountData.push({id: cInfo.id, camount: ZhCalc.round(validText, findDecimal(node.unit)) || 0, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(node.unit)) || 0 });
 | 
	
		
			
				|  |  | +                            if (cInfo.id) {
 | 
	
		
			
				|  |  | +                                camountData.push({id: cInfo.id, camount: ZhCalc.round(validText, findDecimal(node.unit)) || 0, camount_expr: exprQuantity.expr, spamount: ZhCalc.round(validText, findDecimal(node.unit)) || 0 });
 | 
	
		
			
				|  |  | +                            } else {
 | 
	
		
			
				|  |  | +                                cInfo.camount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
 | 
	
		
			
				|  |  | +                                cInfo.camount_expr = exprQuantity.expr;
 | 
	
		
			
				|  |  | +                                cInfo.spamount = ZhCalc.round(validText, findDecimal(node.unit)) || 0;
 | 
	
		
			
				|  |  | +                                insertCamountData.push(cInfo);
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  |                          } else {
 | 
	
		
			
				|  |  |                              SpreadJsObj.reLoadRowData(info.sheet, curRow);
 | 
	
		
			
				|  |  |                          }
 | 
	
	
		
			
				|  | @@ -2992,8 +3280,8 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      data.push(posData);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            if (camountData.length > 0) {
 | 
	
		
			
				|  |  | -                postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', updateData: camountData }, function (result) {
 | 
	
		
			
				|  |  | +            if (camountData.length > 0 || insertCamountData.length > 0) {
 | 
	
		
			
				|  |  | +                postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'paste', insertData: insertCamountData, updateData: camountData }, function (result) {
 | 
	
		
			
				|  |  |                      changeList = result;
 | 
	
		
			
				|  |  |                      const billsNode = SpreadJsObj.getSelectObject(billsSheet);
 | 
	
		
			
				|  |  |                      billsTreeSpreadObj.reCalcCamount(billsNode);
 | 
	
	
		
			
				|  | @@ -3027,8 +3315,9 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      billsNode.camount = null;
 | 
	
		
			
				|  |  |                      billsNode.ca_tp = null;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                if (loadResult.update) {
 | 
	
		
			
				|  |  | +                if (loadResult.update && loadResult.update.length > 0) {
 | 
	
		
			
				|  |  |                      const r = _.find(loadResult.update, { id: billsNode.id });
 | 
	
		
			
				|  |  | +                    console.log(r, billsNode, loadResult.update);
 | 
	
		
			
				|  |  |                      r.is_change = billsNode.is_change;
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      loadResult.update = [billsNode];
 | 
	
	
		
			
				|  | @@ -3082,10 +3371,47 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              if (orgValue === newValue || (!orgValue && newValue == '')) return;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              if (field === 'camount') {
 | 
	
		
			
				|  |  | -                const cInfo = _.find(changeList, { gcl_id: select.lid, mx_id: select.id });
 | 
	
		
			
				|  |  | +                let cInfo = _.find(changeList, { gcl_id: select.lid, mx_id: select.id });
 | 
	
		
			
				|  |  |                  if (!cInfo) {
 | 
	
		
			
				|  |  | -                    toastr.error('未勾选变更清单,无法编辑申请数量');
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | +                    if (posCol.readOnly.isSettle(select)) {
 | 
	
		
			
				|  |  | +                        toastr.error('清单数据未完善,无法编辑申请数量');
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(posSheet, row);
 | 
	
		
			
				|  |  | +                        return
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    makeGclGatherData();
 | 
	
		
			
				|  |  | +                    const gclInfo = _.find(gclGatherData, function (item) {
 | 
	
		
			
				|  |  | +                        return item.leafXmjs && _.find(item.leafXmjs, {gcl_id: select.lid, mx_id: select.id });
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                    const xmjInfo = _.find(gclInfo.leafXmjs, { mx_id: select.id });
 | 
	
		
			
				|  |  | +                    const oldCInfo = _.find(oldChangeList, { gcl_id: select.lid, mx_id: select.id });
 | 
	
		
			
				|  |  | +                    const data = {
 | 
	
		
			
				|  |  | +                        lid: select.lid,
 | 
	
		
			
				|  |  | +                        code: gclInfo.b_code,
 | 
	
		
			
				|  |  | +                        name: gclInfo.name || '',
 | 
	
		
			
				|  |  | +                        unit: gclInfo.unit || '',
 | 
	
		
			
				|  |  | +                        unit_price: gclInfo.unit_price,
 | 
	
		
			
				|  |  | +                        oamount: xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                        oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
 | 
	
		
			
				|  |  | +                        bwmx: xmjInfo.bwmx || xmjInfo.jldy || '',
 | 
	
		
			
				|  |  | +                        xmj_code: xmjInfo.code || '',
 | 
	
		
			
				|  |  | +                        xmj_jldy: xmjInfo.jldy || '',
 | 
	
		
			
				|  |  | +                        xmj_dwgc: xmjInfo.dwgc || '',
 | 
	
		
			
				|  |  | +                        xmj_fbgc: xmjInfo.fbgc || '',
 | 
	
		
			
				|  |  | +                        xmj_fxgc: xmjInfo.fxgc || '',
 | 
	
		
			
				|  |  | +                        gcl_id: select.lid,
 | 
	
		
			
				|  |  | +                        mx_id: select.id,
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    if (oldCInfo) {
 | 
	
		
			
				|  |  | +                        data.detail = oldCInfo.detail;
 | 
	
		
			
				|  |  | +                        data.camount = oldCInfo.camount;
 | 
	
		
			
				|  |  | +                        data.camount_expr = oldCInfo.camount_expr;
 | 
	
		
			
				|  |  | +                        data.spamount = oldCInfo.spamount;
 | 
	
		
			
				|  |  | +                        data.is_valuation = oldCInfo.is_valuation;
 | 
	
		
			
				|  |  | +                        data.delimit = oldCInfo.delimit;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    cInfo = data;
 | 
	
		
			
				|  |  | +                    // toastr.error('未勾选变更清单,无法编辑申请数量');
 | 
	
		
			
				|  |  | +                    // return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  const exprQuantity = {
 | 
	
		
			
				|  |  |                      expr: '',
 | 
	
	
		
			
				|  | @@ -3101,31 +3427,55 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  const camount = parseFloat(exprQuantity.quantity);
 | 
	
		
			
				|  |  | -                // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | -                const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
 | 
	
		
			
				|  |  | -                if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | -                    toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | -                } else if (usedInfo && usedInfo.qty < 0  && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | -                    toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | +                if (cInfo.id) {
 | 
	
		
			
				|  |  | +                    // 判断是否 正数必须大于等于限制值,负数必须小于等于限制值,否则无法更改
 | 
	
		
			
				|  |  | +                    const usedInfo = _.find(changeUsedData, { cbid: cInfo.id });
 | 
	
		
			
				|  |  | +                    if (usedInfo && usedInfo.qty >= 0 && validText < usedInfo.qty) {
 | 
	
		
			
				|  |  | +                        toastr.error('清单变更数值必须大于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  | +                    } else if (usedInfo && usedInfo.qty < 0  && validText > usedInfo.qty) {
 | 
	
		
			
				|  |  | +                        toastr.error('清单变更数值必须小于等于已调用值 ' + usedInfo.qty);
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  cInfo.camount = ZhCalc.round(camount, findDecimal(billsNode.unit)) || 0;
 | 
	
		
			
				|  |  |                  cInfo.spamount = ZhCalc.round(camount, findDecimal(billsNode.unit)) || 0;
 | 
	
		
			
				|  |  |                  cInfo.camount_expr = exprQuantity.expr;
 | 
	
		
			
				|  |  |                  delete cInfo.waitingLoading;
 | 
	
		
			
				|  |  | -                postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'update', updateData: cInfo }, function (result) {
 | 
	
		
			
				|  |  | -                    SpreadJsObj.reLoadRowData(posSheet, row);
 | 
	
		
			
				|  |  | -                    billsTreeSpreadObj.reCalcCamount(billsNode);
 | 
	
		
			
				|  |  | -                    const loadResult = { update: [billsNode] };
 | 
	
		
			
				|  |  | -                    const refreshNode = billsTree.loadPostData(loadResult);
 | 
	
		
			
				|  |  | -                    billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | -                    posSpreadObj.loadExprToInput(posSheet);
 | 
	
		
			
				|  |  | -                }, function () {
 | 
	
		
			
				|  |  | -                    cInfo.camount = orgValue;
 | 
	
		
			
				|  |  | -                    cInfo.spamount = orgValue;
 | 
	
		
			
				|  |  | -                    SpreadJsObj.reLoadRowData(posSheet, row);
 | 
	
		
			
				|  |  | -                });
 | 
	
		
			
				|  |  | +                if (cInfo.id) {
 | 
	
		
			
				|  |  | +                    postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'update', updateData: cInfo }, function (result) {
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(posSheet, row);
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.reCalcCamount(billsNode);
 | 
	
		
			
				|  |  | +                        const loadResult = { update: [billsNode] };
 | 
	
		
			
				|  |  | +                        const refreshNode = billsTree.loadPostData(loadResult);
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | +                        posSpreadObj.loadExprToInput(posSheet);
 | 
	
		
			
				|  |  | +                    }, function () {
 | 
	
		
			
				|  |  | +                        cInfo.camount = orgValue;
 | 
	
		
			
				|  |  | +                        cInfo.spamount = orgValue;
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(posSheet, row);
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'add-change-list', postData: [cInfo]}, function (result) {
 | 
	
		
			
				|  |  | +                        changeList = result.changeList;
 | 
	
		
			
				|  |  | +                        select.is_change = 1;
 | 
	
		
			
				|  |  | +                        select.is_valuation = cInfo.is_valuation !== undefined ? cInfo.is_valuation : 1;
 | 
	
		
			
				|  |  | +                        select.camount = cInfo.camount !== undefined ? cInfo.camount : null;
 | 
	
		
			
				|  |  | +                        select.ca_tp = cInfo.camount !== undefined ? ZhCalc.mul(cInfo.camount, cInfo.unit_price, decimal.tp) : null;
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(posSheet, row);
 | 
	
		
			
				|  |  | +                        const billsNode = SpreadJsObj.getSelectObject(billsSheet);
 | 
	
		
			
				|  |  | +                        // info.sheet.setValue(info.row, valutaionCol, data.is_valuation !== undefined ? data.is_valuation : 1);
 | 
	
		
			
				|  |  | +                        if (_.findIndex(changeList, { gcl_id: select.lid }) !== -1) {
 | 
	
		
			
				|  |  | +                            billsNode.is_change = 1;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.reCalcCamount(billsNode);
 | 
	
		
			
				|  |  | +                        const loadResult = { update: [billsNode] };
 | 
	
		
			
				|  |  | +                        const refreshNode = billsTree.loadPostData(loadResult);
 | 
	
		
			
				|  |  | +                        billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  | +                    }, function () {
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 |