|  | @@ -329,7 +329,7 @@ $(document).ready(function() {
 | 
												
													
														
															|  |                      self.refreshTree(sheet, refreshNode);
 |  |                      self.refreshTree(sheet, refreshNode);
 | 
												
													
														
															|  |                      const sel = sheet.getSelections()[0];
 |  |                      const sel = sheet.getSelections()[0];
 | 
												
													
														
															|  |                      sheet.setSelection(tree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
 |  |                      sheet.setSelection(tree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
 | 
												
													
														
															|  | -                    SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, refreshNode.create[0].index]);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                    SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, tree.nodes.indexOf(node)]);
 | 
												
													
														
															|  |                      self.refreshOperationValid(sheet);
 |  |                      self.refreshOperationValid(sheet);
 | 
												
													
														
															|  |                  });
 |  |                  });
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
											
												
													
														
															|  | @@ -354,7 +354,7 @@ $(document).ready(function() {
 | 
												
													
														
															|  |                      self.refreshTree(sheet, refreshNode);
 |  |                      self.refreshTree(sheet, refreshNode);
 | 
												
													
														
															|  |                      const sel = sheet.getSelections()[0];
 |  |                      const sel = sheet.getSelections()[0];
 | 
												
													
														
															|  |                      sheet.setSelection(tree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
 |  |                      sheet.setSelection(tree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
 | 
												
													
														
															|  | -                    SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, refreshNode.create[0].index]);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                    SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, tree.nodes.indexOf(node)]);
 | 
												
													
														
															|  |                      self.refreshOperationValid(sheet);
 |  |                      self.refreshOperationValid(sheet);
 | 
												
													
														
															|  |                  });
 |  |                  });
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
											
												
													
														
															|  | @@ -737,7 +737,7 @@ $(document).ready(function() {
 | 
												
													
														
															|  |                  const result = tree.loadPostData(data.ledger);
 |  |                  const result = tree.loadPostData(data.ledger);
 | 
												
													
														
															|  |                  self.refreshTree(sheet, result);
 |  |                  self.refreshTree(sheet, result);
 | 
												
													
														
															|  |                  sheet.setSelection(result.create[0].index, sel.col, sel.rowCount, sel.colCount);
 |  |                  sheet.setSelection(result.create[0].index, sel.col, sel.rowCount, sel.colCount);
 | 
												
													
														
															|  | -                SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, refreshNode.create[0].index]);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, result.create[0].index]);
 | 
												
													
														
															|  |                  self.refreshOperationValid(sheet);
 |  |                  self.refreshOperationValid(sheet);
 | 
												
													
														
															|  |                  removeLocalCache(copyBlockTag);
 |  |                  removeLocalCache(copyBlockTag);
 | 
												
													
														
															|  |              }, null, true);
 |  |              }, null, true);
 | 
												
											
												
													
														
															|  | @@ -857,7 +857,7 @@ $(document).ready(function() {
 | 
												
													
														
															|  |                      treeOperationObj.refreshTree(sheet, refreshNode);
 |  |                      treeOperationObj.refreshTree(sheet, refreshNode);
 | 
												
													
														
															|  |                  })
 |  |                  })
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  | -        }
 |  | 
 | 
												
													
														
															|  | 
 |  | +        },
 | 
												
													
														
															|  |      };
 |  |      };
 | 
												
													
														
															|  |      sjsSettingObj.setFxTreeStyle(ledgerSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
 |  |      sjsSettingObj.setFxTreeStyle(ledgerSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
 | 
												
													
														
															|  |      ledgerTreeCol.initSpreadSetting(ledgerSpreadSetting);
 |  |      ledgerTreeCol.initSpreadSetting(ledgerSpreadSetting);
 | 
												
											
												
													
														
															|  | @@ -923,6 +923,8 @@ $(document).ready(function() {
 | 
												
													
														
															|  |          });
 |  |          });
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |          $('#bills-expr').bind('change mouseleave', function () {
 |  |          $('#bills-expr').bind('change mouseleave', function () {
 | 
												
													
														
															|  | 
 |  | +            if (document.activeElement.id !== "bills-expr") return;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  |              const expr = $(this);
 |  |              const expr = $(this);
 | 
												
													
														
															|  |              const sheet = ledgerSpread.getActiveSheet();
 |  |              const sheet = ledgerSpread.getActiveSheet();
 | 
												
													
														
															|  |              const select = SpreadJsObj.getSelectObject(sheet);
 |  |              const select = SpreadJsObj.getSelectObject(sheet);
 | 
												
											
												
													
														
															|  | @@ -1096,6 +1098,13 @@ $(document).ready(function() {
 | 
												
													
														
															|  |              const row = selection[0].row;
 |  |              const row = selection[0].row;
 | 
												
													
														
															|  |              const select = ledgerTree.nodes[row];
 |  |              const select = ledgerTree.nodes[row];
 | 
												
													
														
															|  |              return select;
 |  |              return select;
 | 
												
													
														
															|  | 
 |  | +        },
 | 
												
													
														
															|  | 
 |  | +        disabled: function (key, opt) {
 | 
												
													
														
															|  | 
 |  | +            const sheet = ledgerSpread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +            const selection = sheet.getSelections();
 | 
												
													
														
															|  | 
 |  | +            const row = selection[0].row;
 | 
												
													
														
															|  | 
 |  | +            const select = ledgerTree.nodes[row];
 | 
												
													
														
															|  | 
 |  | +            return select && select.level <= 1;
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |      };
 |  |      };
 | 
												
													
														
															|  |      if (!readOnly) {
 |  |      if (!readOnly) {
 | 
												
											
												
													
														
															|  | @@ -1137,6 +1146,18 @@ $(document).ready(function() {
 | 
												
													
														
															|  |                  return !readOnly;
 |  |                  return !readOnly;
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |          };
 |  |          };
 | 
												
													
														
															|  | 
 |  | +        if (!checkTzMeasureType()) {
 | 
												
													
														
															|  | 
 |  | +            billsContextMenuOptions.items.applyDeal2Sgfh = {
 | 
												
													
														
															|  | 
 |  | +                name: '填设计量',
 | 
												
													
														
															|  | 
 |  | +                callback: function (key, opt) {
 | 
												
													
														
															|  | 
 |  | +                    postData(window.location.pathname + '/deal2sgfh', null, function (result) {
 | 
												
													
														
															|  | 
 |  | +                        ledgerTree.loadDatas(result.bills);
 | 
												
													
														
															|  | 
 |  | +                        treeCalc.calculateAll(ledgerTree);
 | 
												
													
														
															|  | 
 |  | +                        SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), 'tree', ledgerTree);
 | 
												
													
														
															|  | 
 |  | +                    });
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +            };
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  |          billsContextMenuOptions.items.sprSort = '-----------';
 |  |          billsContextMenuOptions.items.sprSort = '-----------';
 | 
												
													
														
															|  |      }
 |  |      }
 | 
												
													
														
															|  |      if (!readOnly) {
 |  |      if (!readOnly) {
 | 
												
											
												
													
														
															|  | @@ -1285,10 +1306,10 @@ $(document).ready(function() {
 | 
												
													
														
															|  |                              if (refreshNode.create[0]) {
 |  |                              if (refreshNode.create[0]) {
 | 
												
													
														
															|  |                                  if (sel && sel[0]) {
 |  |                                  if (sel && sel[0]) {
 | 
												
													
														
															|  |                                      ledgerSheet.setSelection(refreshNode.create[0].index, sel[0].col, sel[0].rowCount, sel[0].colCount);
 |  |                                      ledgerSheet.setSelection(refreshNode.create[0].index, sel[0].col, sel[0].rowCount, sel[0].colCount);
 | 
												
													
														
															|  | -                                    SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, refreshNode.create[0].index]);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                                    SpreadJsObj.reloadRowsBackColor(ledgerSheet, [sel[0].row, refreshNode.create[0].index]);
 | 
												
													
														
															|  |                                  } else {
 |  |                                  } else {
 | 
												
													
														
															|  |                                      ledgerSheet.setSelection(refreshNode.create[0].index, 0, 1, 1);
 |  |                                      ledgerSheet.setSelection(refreshNode.create[0].index, 0, 1, 1);
 | 
												
													
														
															|  | -                                    SpreadJsObj.reloadRowsBackColor(sheet, [refreshNode.create[0].index]);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                                    SpreadJsObj.reloadRowsBackColor(ledgerSheet, [refreshNode.create[0].index]);
 | 
												
													
														
															|  |                                  }
 |  |                                  }
 | 
												
													
														
															|  |                              }
 |  |                              }
 | 
												
													
														
															|  |                              treeOperationObj.refreshOperationValid(ledgerSheet);
 |  |                              treeOperationObj.refreshOperationValid(ledgerSheet);
 | 
												
											
												
													
														
															|  | @@ -1338,6 +1359,24 @@ $(document).ready(function() {
 | 
												
													
														
															|  |          editStarting: function (e, info) {
 |  |          editStarting: function (e, info) {
 | 
												
													
														
															|  |              posOperationObj.ledgerTreeNode = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
 |  |              posOperationObj.ledgerTreeNode = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
 | 
												
													
														
															|  |          },
 |  |          },
 | 
												
													
														
															|  | 
 |  | +        loadExprToInput: function () {
 | 
												
													
														
															|  | 
 |  | +            const sheet = posSpread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +            const sel = sheet.getSelections()[0];
 | 
												
													
														
															|  | 
 |  | +            if (!sel || !sheet.zh_setting) return;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            const col = sheet.zh_setting.cols[sel.col], cell = sheet.getCell(sel.row, sel.col);
 | 
												
													
														
															|  | 
 |  | +            if (col && col.type === 'Number') {
 | 
												
													
														
															|  | 
 |  | +                const data = SpreadJsObj.getSelectObject(sheet);
 | 
												
													
														
															|  | 
 |  | +                if (data) {
 | 
												
													
														
															|  | 
 |  | +                    $('#pos-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field])
 | 
												
													
														
															|  | 
 |  | +                        .attr('row', sel.row).attr('readOnly', readOnly || cell.locked());
 | 
												
													
														
															|  | 
 |  | +                } else {
 | 
												
													
														
															|  | 
 |  | +                    $('#pos-expr').val('').attr('readOnly', true);
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +            } else {
 | 
												
													
														
															|  | 
 |  | +                $('#pos-expr').val('').attr('readOnly', true);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        },
 | 
												
													
														
															|  |          /**
 |  |          /**
 | 
												
													
														
															|  |           * 加载计量单元 根据当前台账选择节点
 |  |           * 加载计量单元 根据当前台账选择节点
 | 
												
													
														
															|  |           */
 |  |           */
 | 
												
											
												
													
														
															|  | @@ -1350,6 +1389,7 @@ $(document).ready(function() {
 | 
												
													
														
															|  |              } else {
 |  |              } else {
 | 
												
													
														
															|  |                  SpreadJsObj.loadSheetData(posSpread.getActiveSheet(), 'data', []);
 |  |                  SpreadJsObj.loadSheetData(posSpread.getActiveSheet(), 'data', []);
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  | 
 |  | +            posOperationObj.loadExprToInput();
 | 
												
													
														
															|  |          },
 |  |          },
 | 
												
													
														
															|  |          /**
 |  |          /**
 | 
												
													
														
															|  |           * 编辑单元格响应事件
 |  |           * 编辑单元格响应事件
 | 
												
											
												
													
														
															|  | @@ -1603,19 +1643,7 @@ $(document).ready(function() {
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |          },
 |  |          },
 | 
												
													
														
															|  |          selectionChanged: function (e, info) {
 |  |          selectionChanged: function (e, info) {
 | 
												
													
														
															|  | -            const col = info.sheet.zh_setting.cols[info.newSelections[0].col];
 |  | 
 | 
												
													
														
															|  | -            const cell = info.sheet.getCell(info.newSelections[0].row, info.newSelections[0].col);
 |  | 
 | 
												
													
														
															|  | -            if (col && col.type === 'Number') {
 |  | 
 | 
												
													
														
															|  | -                const data = SpreadJsObj.getSelectObject(info.sheet);
 |  | 
 | 
												
													
														
															|  | -                if (data) {
 |  | 
 | 
												
													
														
															|  | -                    $('#pos-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field])
 |  | 
 | 
												
													
														
															|  | -                        .attr('row', info.newSelections[0].row).attr('readOnly', readOnly || cell.locked());
 |  | 
 | 
												
													
														
															|  | -                } else {
 |  | 
 | 
												
													
														
															|  | -                    $('#pos-expr').val('').attr('readOnly', true);
 |  | 
 | 
												
													
														
															|  | -                }
 |  | 
 | 
												
													
														
															|  | -            } else {
 |  | 
 | 
												
													
														
															|  | -                $('#pos-expr').val('').attr('readOnly', true);
 |  | 
 | 
												
													
														
															|  | -            }
 |  | 
 | 
												
													
														
															|  | 
 |  | +            posOperationObj.loadExprToInput();
 | 
												
													
														
															|  |          },
 |  |          },
 | 
												
													
														
															|  |          addPegs: function (pegs) {
 |  |          addPegs: function (pegs) {
 | 
												
													
														
															|  |              if (!pegs || pegs.length <= 0) return;
 |  |              if (!pegs || pegs.length <= 0) return;
 | 
												
											
												
													
														
															|  | @@ -1637,10 +1665,12 @@ $(document).ready(function() {
 | 
												
													
														
															|  |      posSpread.bind(spreadNS.Events.SelectionChanged, posOperationObj.selectionChanged);
 |  |      posSpread.bind(spreadNS.Events.SelectionChanged, posOperationObj.selectionChanged);
 | 
												
													
														
															|  |      if (!posSpreadSetting.readOnly) {
 |  |      if (!posSpreadSetting.readOnly) {
 | 
												
													
														
															|  |          $('#pos-expr').bind('change mouseleave', function () {
 |  |          $('#pos-expr').bind('change mouseleave', function () {
 | 
												
													
														
															|  | 
 |  | +            if (document.activeElement.id !== "pos-expr") return;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  |              const expr = $(this);
 |  |              const expr = $(this);
 | 
												
													
														
															|  |              const posSheet = posSpread.getActiveSheet();
 |  |              const posSheet = posSpread.getActiveSheet();
 | 
												
													
														
															|  |              const select = SpreadJsObj.getSelectObject(posSheet);
 |  |              const select = SpreadJsObj.getSelectObject(posSheet);
 | 
												
													
														
															|  | -            if (select) return;
 |  | 
 | 
												
													
														
															|  | 
 |  | +            if (!select) return;
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |              const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = expr.val(), row = trimInvalidChar(expr.attr('row'));
 |  |              const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = expr.val(), row = trimInvalidChar(expr.attr('row'));
 | 
												
													
														
															|  |              if (orgValue === newValue || (!orgValue && newValue == '')) { return; }
 |  |              if (orgValue === newValue || (!orgValue && newValue == '')) { return; }
 | 
												
											
												
													
														
															|  | @@ -1786,12 +1816,12 @@ $(document).ready(function() {
 | 
												
													
														
															|  |              treeOperationObj.refreshTree(mainSheet, refreshNode);
 |  |              treeOperationObj.refreshTree(mainSheet, refreshNode);
 | 
												
													
														
															|  |              if (refreshNode.create && refreshNode.create.length > 0) {
 |  |              if (refreshNode.create && refreshNode.create.length > 0) {
 | 
												
													
														
															|  |                  mainSheet.setSelection(refreshNode.create[refreshNode.create.length - 1].index, sel.col, sel.rowCount, sel.colCount);
 |  |                  mainSheet.setSelection(refreshNode.create[refreshNode.create.length - 1].index, sel.col, sel.rowCount, sel.colCount);
 | 
												
													
														
															|  | -                SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, refreshNode.create[refreshNode.create.length - 1].index]);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, refreshNode.create[refreshNode.create.length - 1].index]);
 | 
												
													
														
															|  |              } else {
 |  |              } else {
 | 
												
													
														
															|  |                  const node = _.find(ledgerTree.nodes, {code: stdNode.code, name: stdNode.name});
 |  |                  const node = _.find(ledgerTree.nodes, {code: stdNode.code, name: stdNode.name});
 | 
												
													
														
															|  |                  if (node) {
 |  |                  if (node) {
 | 
												
													
														
															|  |                      mainSheet.setSelection(ledgerTree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
 |  |                      mainSheet.setSelection(ledgerTree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
 | 
												
													
														
															|  | -                    SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, ledgerTree.nodes.indexOf(node)]);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                    SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, ledgerTree.nodes.indexOf(node)]);
 | 
												
													
														
															|  |                  }
 |  |                  }
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |              treeOperationObj.refreshOperationValid(mainSheet);
 |  |              treeOperationObj.refreshOperationValid(mainSheet);
 | 
												
											
												
													
														
															|  | @@ -2009,14 +2039,13 @@ $(document).ready(function() {
 | 
												
													
														
															|  |                      treeOperationObj.refreshTree(mainSheet, refreshData);
 |  |                      treeOperationObj.refreshTree(mainSheet, refreshData);
 | 
												
													
														
															|  |                      const sel = mainSheet.getSelections()[0];
 |  |                      const sel = mainSheet.getSelections()[0];
 | 
												
													
														
															|  |                      mainSheet.setSelection(refreshData.create[0].index, sel.col, sel.rowCount, sel.colCount);
 |  |                      mainSheet.setSelection(refreshData.create[0].index, sel.col, sel.rowCount, sel.colCount);
 | 
												
													
														
															|  | -                    SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, refreshNode.create[0].index]);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                    SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, refreshData.create[0].index]);
 | 
												
													
														
															|  |                      treeOperationObj.refreshOperationValid(mainSheet);
 |  |                      treeOperationObj.refreshOperationValid(mainSheet);
 | 
												
													
														
															|  |                      ledgerSpread.focus();
 |  |                      ledgerSpread.focus();
 | 
												
													
														
															|  |                      posOperationObj.loadCurPosData();
 |  |                      posOperationObj.loadCurPosData();
 | 
												
													
														
															|  |                  });
 |  |                  });
 | 
												
													
														
															|  |              });
 |  |              });
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  | -            SpreadJsObj.forbiddenSpreadContextMenu(selector, this.spread);
 |  | 
 | 
												
													
														
															|  |              $('#upload-deal-bills').click(function () {
 |  |              $('#upload-deal-bills').click(function () {
 | 
												
													
														
															|  |                      const file = $('#deal-bills-file')[0];
 |  |                      const file = $('#deal-bills-file')[0];
 | 
												
													
														
															|  |                      const formData = new FormData();
 |  |                      const formData = new FormData();
 | 
												
											
												
													
														
															|  | @@ -2029,12 +2058,49 @@ $(document).ready(function() {
 | 
												
													
														
															|  |                          $('#upload-deal').modal('hide');
 |  |                          $('#upload-deal').modal('hide');
 | 
												
													
														
															|  |                      });
 |  |                      });
 | 
												
													
														
															|  |                  });
 |  |                  });
 | 
												
													
														
															|  | 
 |  | +            if (!readOnly) {
 | 
												
													
														
															|  | 
 |  | +                $.contextMenu({
 | 
												
													
														
															|  | 
 |  | +                    selector: selector,
 | 
												
													
														
															|  | 
 |  | +                    build: function ($trigger, e) {
 | 
												
													
														
															|  | 
 |  | +                        const target = SpreadJsObj.safeRightClickSelection($trigger, e, self.spread);
 | 
												
													
														
															|  | 
 |  | +                        return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
 | 
												
													
														
															|  | 
 |  | +                    },
 | 
												
													
														
															|  | 
 |  | +                    items: {
 | 
												
													
														
															|  | 
 |  | +                        apply: {
 | 
												
													
														
															|  | 
 |  | +                            name: '应用全部清单单价至台账',
 | 
												
													
														
															|  | 
 |  | +                            disabled: function (key, opt) {
 | 
												
													
														
															|  | 
 |  | +                                const sheet = self.spread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +                                return sheet.getRowCount() === 0;
 | 
												
													
														
															|  | 
 |  | +                            },
 | 
												
													
														
															|  | 
 |  | +                            callback: function (key, opt) {
 | 
												
													
														
															|  | 
 |  | +                                const datas = [], sourceData = self.spread.getActiveSheet().zh_data;
 | 
												
													
														
															|  | 
 |  | +                                for (const db of sourceData) {
 | 
												
													
														
															|  | 
 |  | +                                    const targets = ledgerTree.nodes.filter(function (x) {
 | 
												
													
														
															|  | 
 |  | +                                        return x.b_code === db.code && x.name === db.name && x.unit === db.unit;
 | 
												
													
														
															|  | 
 |  | +                                    });
 | 
												
													
														
															|  | 
 |  | +                                    for (const t of targets) {
 | 
												
													
														
															|  | 
 |  | +                                        if (t.children && t.children.length > 0) continue;
 | 
												
													
														
															|  | 
 |  | +                                        const data = ledgerTree.getNodeKeyData(t);
 | 
												
													
														
															|  | 
 |  | +                                        data.unit_price = db.unit_price;
 | 
												
													
														
															|  | 
 |  | +                                        datas.push(data);
 | 
												
													
														
															|  | 
 |  | +                                    }
 | 
												
													
														
															|  | 
 |  | +                                }
 | 
												
													
														
															|  | 
 |  | +                                postData(window.location.pathname + '/update', {postType: 'update', postData: datas}, function (result) {
 | 
												
													
														
															|  | 
 |  | +                                    const refreshNode = ledgerTree.loadPostData(result);
 | 
												
													
														
															|  | 
 |  | +                                    treeOperationObj.refreshTree(ledgerSpread.getActiveSheet(), refreshNode);
 | 
												
													
														
															|  | 
 |  | +                                });
 | 
												
													
														
															|  | 
 |  | +                            }
 | 
												
													
														
															|  | 
 |  | +                        }
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +                });
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |          loadData () {
 |  |          loadData () {
 | 
												
													
														
															|  |              const self = this;
 |  |              const self = this;
 | 
												
													
														
															|  |              postData(this.url+'/get-data', {}, function (data) {
 |  |              postData(this.url+'/get-data', {}, function (data) {
 | 
												
													
														
															|  |                  self.data = data;
 |  |                  self.data = data;
 | 
												
													
														
															|  |                  SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', data);
 |  |                  SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', data);
 | 
												
													
														
															|  | 
 |  | +                if (data.length > 0) self.spread.getActiveSheet().setSelection(0, 0, 1, 1);
 | 
												
													
														
															|  |              });
 |  |              });
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |          calculateData () {
 |  |          calculateData () {
 | 
												
											
												
													
														
															|  | @@ -2182,6 +2248,20 @@ $(document).ready(function() {
 | 
												
													
														
															|  |                          posSheet.getCell(0, i + 2 - 1, spreadNS.SheetArea.colHeader).text('清单' + i);
 |  |                          posSheet.getCell(0, i + 2 - 1, spreadNS.SheetArea.colHeader).text('清单' + i);
 | 
												
													
														
															|  |                      }
 |  |                      }
 | 
												
													
														
															|  |                  }
 |  |                  }
 | 
												
													
														
															|  | 
 |  | +                if (info.cellRange.col === 0 && info.cellRange.colCount === 1) {
 | 
												
													
														
															|  | 
 |  | +                    const dealBills = self.dealSpread.getActiveSheet().zh_data;
 | 
												
													
														
															|  | 
 |  | +                    if (dealBills && dealBills.length > 0) {
 | 
												
													
														
															|  | 
 |  | +                        for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
 | 
												
													
														
															|  | 
 |  | +                            const curRow = iRow + info.cellRange.row;
 | 
												
													
														
															|  | 
 |  | +                            const bills = _.find(dealBills, {code: info.sheet.getText(curRow, 0)});
 | 
												
													
														
															|  | 
 |  | +                            if (bills) {
 | 
												
													
														
															|  | 
 |  | +                                info.sheet.getCell(curRow, 1).value(bills.name);
 | 
												
													
														
															|  | 
 |  | +                                info.sheet.getCell(curRow, 2).value(bills.unit);
 | 
												
													
														
															|  | 
 |  | +                                info.sheet.getCell(curRow, 3).value(bills.unit_price);
 | 
												
													
														
															|  | 
 |  | +                            }
 | 
												
													
														
															|  | 
 |  | +                        }
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  |              });
 |  |              });
 | 
												
													
														
															|  |              this.qdSpread.bind(spreadNS.Events.EditEnded, function (e, info) {
 |  |              this.qdSpread.bind(spreadNS.Events.EditEnded, function (e, info) {
 | 
												
													
														
															|  |                  if (info.col === 0) {
 |  |                  if (info.col === 0) {
 | 
												
											
												
													
														
															|  | @@ -2219,7 +2299,7 @@ $(document).ready(function() {
 | 
												
													
														
															|  |                              const result = ledgerTree.loadPostData(data.ledger);
 |  |                              const result = ledgerTree.loadPostData(data.ledger);
 | 
												
													
														
															|  |                              treeOperationObj.refreshTree(sheet, result);
 |  |                              treeOperationObj.refreshTree(sheet, result);
 | 
												
													
														
															|  |                              sheet.setSelection(result.create[0].index, sel.col, sel.rowCount, sel.colCount);
 |  |                              sheet.setSelection(result.create[0].index, sel.col, sel.rowCount, sel.colCount);
 | 
												
													
														
															|  | -                            SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, refreshNode.create[0].index]);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                            SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, result.create[0].index]);
 | 
												
													
														
															|  |                              treeOperationObj.refreshOperationValid(sheet);
 |  |                              treeOperationObj.refreshOperationValid(sheet);
 | 
												
													
														
															|  |                              self.obj.modal('hide');
 |  |                              self.obj.modal('hide');
 | 
												
													
														
															|  |                          }, null, true);
 |  |                          }, null, true);
 |