|  | @@ -90,7 +90,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.isEdit'},
 | 
	
		
			
				|  |  |              {title: '变更部位', colSpan: '1', rowSpan: '2', field: 'bwmx', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.isEdit'},
 | 
	
		
			
				|  |  |              {title: '变更详情', colSpan: '1', rowSpan: '2', field: 'detail', hAlign: 0, width: 120, formatter: '@', readOnly: false},
 | 
	
		
			
				|  |  | -            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit', cellType: 'unit', comboItems: changeUnits},
 | 
	
		
			
				|  |  | +            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit', cellType: 'unit', comboItems: changeUnits, comboEdit: true},
 | 
	
		
			
				|  |  |              {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit', getValue: 'getValue.unit_price'},
 | 
	
		
			
				|  |  |              {title: '原设计|数量', colSpan: '2|1', rowSpan: '1|1', field: 'oamount', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit', getValue: 'getValue.oamount'},
 | 
	
		
			
				|  |  |              {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'oa_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.oa_tp'},
 | 
	
	
		
			
				|  | @@ -119,6 +119,10 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                  },
 | 
	
		
			
				|  |  |              },
 | 
	
		
			
				|  |  |          ],
 | 
	
		
			
				|  |  | +        localCache: {
 | 
	
		
			
				|  |  | +            key: 'changes-spread',
 | 
	
		
			
				|  |  | +            colWidth: true,
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      const changeCol = {
 | 
	
	
		
			
				|  | @@ -180,6 +184,16 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  | +        batchAdd: function(num) {
 | 
	
		
			
				|  |  | +            postData(window.location.pathname + '/save', {type: 'batchadd', num}, function (result) {
 | 
	
		
			
				|  |  | +                if (result) {
 | 
	
		
			
				|  |  | +                    changeList = _.concat(changeList, result);
 | 
	
		
			
				|  |  | +                    SpreadJsObj.loadSheetData(changeSpreadSheet, SpreadJsObj.DataType.Data, changeList);
 | 
	
		
			
				|  |  | +                    changeSpreadObj.makeSjsFooter();
 | 
	
		
			
				|  |  | +                    changeSpreadObj.resetXmjSpread();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  |          del: function () {
 | 
	
		
			
				|  |  |              const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
 | 
	
		
			
				|  |  |              const index = changeList.indexOf(select);
 | 
	
	
		
			
				|  | @@ -318,6 +332,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          continue;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                      if (colSetting.type === 'Number') {
 | 
	
		
			
				|  |  |                          if (isNaN(validText)) {
 | 
	
		
			
				|  |  |                              toastMessageUniq(getPasteHint(hint.numberExpr, hintRow));
 | 
	
	
		
			
				|  | @@ -330,17 +345,18 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                              validText = ZhCalc.round(validText, findDecimal(sortData[curRow].unit)) || 0;
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | +                    let unitdecimal = validText;
 | 
	
		
			
				|  |  |                      if (colSetting.field === 'unit') {
 | 
	
		
			
				|  |  |                          //粘贴内容要为下拉列表里所有的单位,不然为空
 | 
	
		
			
				|  |  |                          if (changeUnits.indexOf(validText) === -1) {
 | 
	
		
			
				|  |  | -                            validText = '';
 | 
	
		
			
				|  |  | +                            unitdecimal = '';
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  | -                        cLData.camount = ZhCalc.round(sortData[curRow].camount, findDecimal(validText)) || 0;
 | 
	
		
			
				|  |  | -                        cLData.oamount = ZhCalc.round(sortData[curRow].oamount, findDecimal(validText)) || 0;
 | 
	
		
			
				|  |  | +                        cLData.camount = ZhCalc.round(sortData[curRow].camount, findDecimal(unitdecimal)) || 0;
 | 
	
		
			
				|  |  | +                        cLData.oamount = ZhCalc.round(sortData[curRow].oamount, findDecimal(unitdecimal)) || 0;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      cLData[colSetting.field] = validText;
 | 
	
		
			
				|  |  |                      sortData[curRow][colSetting.field] = validText;
 | 
	
		
			
				|  |  | -                    cLData.spamount = ZhCalc.round(sortData[curRow].camount, findDecimal(validText)) || 0;
 | 
	
		
			
				|  |  | +                    cLData.spamount = ZhCalc.round(sortData[curRow].camount, findDecimal(unitdecimal)) || 0;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (bPaste) {
 | 
	
		
			
				|  |  |                      data.push(cLData);
 | 
	
	
		
			
				|  | @@ -472,6 +488,33 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |          SpreadJsObj.addDeleteBind(changeSpread, changeSpreadObj.deletePress);
 | 
	
		
			
				|  |  |          changeSpreadSheet.getCell(-1, 10).foreColor('#dc3545');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        let batchInsertObj;
 | 
	
		
			
				|  |  | +        $.contextMenu.types.batchInsert = function (item, opt, root) {
 | 
	
		
			
				|  |  | +            const self = this;
 | 
	
		
			
				|  |  | +            if ($.isFunction(item.icon)) {
 | 
	
		
			
				|  |  | +                item._icon = item.icon.call(this, this, $t, key, item);
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                if (typeof(item.icon) === 'string' && item.icon.substring(0, 3) === 'fa-') {
 | 
	
		
			
				|  |  | +                    // to enable font awesome
 | 
	
		
			
				|  |  | +                    item._icon = root.classNames.icon + ' ' + root.classNames.icon + '--fa fa ' + item.icon;
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    item._icon = root.classNames.icon + ' ' + root.classNames.icon + '-' + item.icon;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            this.addClass(item._icon);
 | 
	
		
			
				|  |  | +            const $obj = $('<div>' + item.name + '<input class="text-right ml-1 mr-1" type="tel" max="100" min="1" value="' + item.value + '" style="width: 30px; height: 18px; padding-right: 4px;">行</div>')
 | 
	
		
			
				|  |  | +                .appendTo(this);
 | 
	
		
			
				|  |  | +            const $input = $obj.find('input');
 | 
	
		
			
				|  |  | +            const event = () => {
 | 
	
		
			
				|  |  | +                if (self.hasClass('context-menu-disabled')) return;
 | 
	
		
			
				|  |  | +                item.batchInsert($input[0], root);
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +            $obj.on('click', event).keypress(function (e) {if (e.keyCode === 13) { event(); }});
 | 
	
		
			
				|  |  | +            $input.click((e) => {e.stopPropagation();})
 | 
	
		
			
				|  |  | +                .keyup((e) => {if (e.keyCode === 13) item.batchInsert($input[0], root);})
 | 
	
		
			
				|  |  | +                .on('input', function () {this.value = this.value.replace(/[^\d]/g, '');});
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          // 右键菜单
 | 
	
		
			
				|  |  |          $.contextMenu({
 | 
	
		
			
				|  |  |              selector: '#change-spread',
 | 
	
	
		
			
				|  | @@ -494,6 +537,25 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                          changeSpreadObj.add(changeSpreadSheet);
 | 
	
		
			
				|  |  |                      },
 | 
	
		
			
				|  |  |                  },
 | 
	
		
			
				|  |  | +                'batchInsert': {
 | 
	
		
			
				|  |  | +                    name: '批量添加空白清单',
 | 
	
		
			
				|  |  | +                    type: 'batchInsert',
 | 
	
		
			
				|  |  | +                    value: '2',
 | 
	
		
			
				|  |  | +                    icon: 'fa-sign-in',
 | 
	
		
			
				|  |  | +                    batchInsert: function (obj, root) {
 | 
	
		
			
				|  |  | +                        if (_.toNumber(obj.value) > _.toNumber(obj.max)) {
 | 
	
		
			
				|  |  | +                            obj.value = obj.max;
 | 
	
		
			
				|  |  | +                            toastr.warning('批量添加不可多于' + obj.max);
 | 
	
		
			
				|  |  | +                        } else if(_.toNumber(obj.value) < _.toNumber(obj.min)) {
 | 
	
		
			
				|  |  | +                            obj.value = obj.min;
 | 
	
		
			
				|  |  | +                            toastr.warning('批量添加不可少于' + obj.min);
 | 
	
		
			
				|  |  | +                        } else {
 | 
	
		
			
				|  |  | +                            // treeOperationObj.addNode(ledgerSpread.getActiveSheet(), parseInt(obj.value));
 | 
	
		
			
				|  |  | +                            changeSpreadObj.batchAdd(obj.value);
 | 
	
		
			
				|  |  | +                            root.$menu.trigger('contextmenu:hide');
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                },
 | 
	
		
			
				|  |  |                  'delete': {
 | 
	
		
			
				|  |  |                      name: '删除',
 | 
	
		
			
				|  |  |                      icon: 'fa-remove',
 | 
	
	
		
			
				|  | @@ -836,9 +898,8 @@ function tableDataRemake(changeListData) {
 | 
	
		
			
				|  |  |                      let pushbwmx = '0*;*0';
 | 
	
		
			
				|  |  |                      if (listinfo.leafXmjs !== undefined) {
 | 
	
		
			
				|  |  |                          const leafInfo = listinfo.leafXmjs.find(function (item) {
 | 
	
		
			
				|  |  | -                            return (item.bwmx === undefined || item.bwmx === clinfo.bwmx) && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
 | 
	
		
			
				|  |  | +                            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));
 | 
	
		
			
				|  |  |                          });
 | 
	
		
			
				|  |  | -                        console.log(leafInfo);
 | 
	
		
			
				|  |  |                          if (leafInfo) {
 | 
	
		
			
				|  |  |                              pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
 | 
	
		
			
				|  |  |                                  (leafInfo.dwgc ? leafInfo.dwgc : '') + '!_!' +
 | 
	
	
		
			
				|  | @@ -868,7 +929,7 @@ function tableDataRemake(changeListData) {
 | 
	
		
			
				|  |  |                      let pushbwmx = '0*;*0';
 | 
	
		
			
				|  |  |                      if (listinfo.leafXmjs !== undefined) {
 | 
	
		
			
				|  |  |                          const leafInfo = listinfo.leafXmjs.find(function (item) {
 | 
	
		
			
				|  |  | -                            return (item.bwmx === undefined || item.bwmx === clinfo.bwmx || item.jldy === clinfo.bwmx) && (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.code === clinfo.xmj_code && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
 | 
	
		
			
				|  |  |                          });
 | 
	
		
			
				|  |  |                          if (leafInfo) {
 | 
	
		
			
				|  |  |                              pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
 |