|  | @@ -5,16 +5,31 @@ $(document).ready(() => {
 | 
												
													
														
															|  |              this.spread = SpreadJsObj.createNewSpread(setting.obj);
 |  |              this.spread = SpreadJsObj.createNewSpread(setting.obj);
 | 
												
													
														
															|  |              this.sheet = this.spread.getActiveSheet();
 |  |              this.sheet = this.spread.getActiveSheet();
 | 
												
													
														
															|  |              SpreadJsObj.initSheet(this.sheet, setting.spreadSetting);
 |  |              SpreadJsObj.initSheet(this.sheet, setting.spreadSetting);
 | 
												
													
														
															|  | -            this.data = setting.data;
 |  | 
 | 
												
													
														
															|  | 
 |  | +            if (setting.treeSetting) {
 | 
												
													
														
															|  | 
 |  | +                this.tree = createNewPathTree('base', setting.treeSetting);
 | 
												
													
														
															|  | 
 |  | +                this.tree.loadDatas(setting.data);
 | 
												
													
														
															|  | 
 |  | +            } else {
 | 
												
													
														
															|  | 
 |  | +                this.data = setting.data;
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  |              this.type = setting.type;
 |  |              this.type = setting.type;
 | 
												
													
														
															|  | -            SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Data, this.data);
 |  | 
 | 
												
													
														
															|  | 
 |  | +            if (setting.treeSetting) {
 | 
												
													
														
															|  | 
 |  | +                SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Tree, this.tree);
 | 
												
													
														
															|  | 
 |  | +            } else {
 | 
												
													
														
															|  | 
 |  | +                SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Data, this.data);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |              const self = this;
 |  |              const self = this;
 | 
												
													
														
															|  |              this.sheet.bind(spreadNS.Events.EditEnded, function(e, info) {
 |  |              this.sheet.bind(spreadNS.Events.EditEnded, function(e, info) {
 | 
												
													
														
															|  | -                if (!info.sheet.zh_setting || !info.sheet.zh_data) return;
 |  | 
 | 
												
													
														
															|  | 
 |  | +                if (!info.sheet.zh_setting) {
 | 
												
													
														
															|  | 
 |  | +                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
												
													
														
															|  | 
 |  | +                    return;
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -                const node = info.sheet.zh_data[info.row];
 |  | 
 | 
												
													
														
															|  | -                if (!node) return;
 |  | 
 | 
												
													
														
															|  | 
 |  | +                const node = SpreadJsObj.getRowObject(info.sheet, info.row);
 | 
												
													
														
															|  | 
 |  | +                if (!node || (self.tree && node.children && node.children.length > 0)) {
 | 
												
													
														
															|  | 
 |  | +                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
												
													
														
															|  | 
 |  | +                    return;
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |                  const col = info.sheet.zh_setting.cols[info.col];
 |  |                  const col = info.sheet.zh_setting.cols[info.col];
 | 
												
													
														
															|  |                  const data = {};
 |  |                  const data = {};
 | 
												
											
												
													
														
															|  | @@ -44,10 +59,10 @@ $(document).ready(() => {
 | 
												
													
														
															|  |                  });
 |  |                  });
 | 
												
													
														
															|  |              });
 |  |              });
 | 
												
													
														
															|  |              this.sheet.bind(spreadNS.Events.ClipboardPasting, function(e, info) {
 |  |              this.sheet.bind(spreadNS.Events.ClipboardPasting, function(e, info) {
 | 
												
													
														
															|  | -                const setting = info.sheet.zh_setting, sortData = info.sheet.zh_data;
 |  | 
 | 
												
													
														
															|  |                  info.cancel = true;
 |  |                  info.cancel = true;
 | 
												
													
														
															|  | 
 |  | +                const setting = info.sheet.zh_setting;
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -                if (!setting || !sortData) return;
 |  | 
 | 
												
													
														
															|  | 
 |  | +                if (!setting) return;
 | 
												
													
														
															|  |                  const pasteData = info.pasteData.html
 |  |                  const pasteData = info.pasteData.html
 | 
												
													
														
															|  |                      ? SpreadJsObj.analysisPasteHtml(info.pasteData.html)
 |  |                      ? SpreadJsObj.analysisPasteHtml(info.pasteData.html)
 | 
												
													
														
															|  |                      : (info.pasteData.text === ''
 |  |                      : (info.pasteData.text === ''
 | 
												
											
												
													
														
															|  | @@ -57,7 +72,8 @@ $(document).ready(() => {
 | 
												
													
														
															|  |                  const uDatas = [];
 |  |                  const uDatas = [];
 | 
												
													
														
															|  |                  for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
 |  |                  for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
 | 
												
													
														
															|  |                      const curRow = info.cellRange.row + iRow;
 |  |                      const curRow = info.cellRange.row + iRow;
 | 
												
													
														
															|  | -                    const node = sortData[curRow];
 |  | 
 | 
												
													
														
															|  | 
 |  | +                    const node = SpreadJsObj.getRowObject(info.sheet, curRow);
 | 
												
													
														
															|  | 
 |  | +                    if (self.tree && node.children && node.children.length > 0) continue;
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |                      let bPaste = false;
 |  |                      let bPaste = false;
 | 
												
													
														
															|  |                      const data = {};
 |  |                      const data = {};
 | 
												
											
												
													
														
															|  | @@ -94,16 +110,15 @@ $(document).ready(() => {
 | 
												
													
														
															|  |                  }
 |  |                  }
 | 
												
													
														
															|  |              });
 |  |              });
 | 
												
													
														
															|  |              SpreadJsObj.addDeleteBind(this.spread, function(sheet) {
 |  |              SpreadJsObj.addDeleteBind(this.spread, function(sheet) {
 | 
												
													
														
															|  | -                if (!sheet.zh_setting || !sheet.zh_data) return;
 |  | 
 | 
												
													
														
															|  | 
 |  | +                if (!sheet.zh_setting) return;
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -                const sortData = sheet.zh_data;
 |  | 
 | 
												
													
														
															|  |                  const datas = [];
 |  |                  const datas = [];
 | 
												
													
														
															|  |                  const sels = sheet.getSelections();
 |  |                  const sels = sheet.getSelections();
 | 
												
													
														
															|  |                  if (!sels || !sels[0]) return;
 |  |                  if (!sels || !sels[0]) return;
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |                  for (let iRow = sels[0].row; iRow < sels[0].row + sels[0].rowCount; iRow++) {
 |  |                  for (let iRow = sels[0].row; iRow < sels[0].row + sels[0].rowCount; iRow++) {
 | 
												
													
														
															|  |                      let bDel = false;
 |  |                      let bDel = false;
 | 
												
													
														
															|  | -                    const node = sortData[iRow];
 |  | 
 | 
												
													
														
															|  | 
 |  | +                    const node = SpreadJsObj.getRowObject(info.sheet, iRow);
 | 
												
													
														
															|  |                      if (node) {
 |  |                      if (node) {
 | 
												
													
														
															|  |                          const data = { id: node.id };
 |  |                          const data = { id: node.id };
 | 
												
													
														
															|  |                          for (let iCol = sels[0].col; iCol < sels[0].col + sels[0].colCount; iCol++) {
 |  |                          for (let iCol = sels[0].col; iCol < sels[0].col + sels[0].colCount; iCol++) {
 | 
												
											
												
													
														
															|  | @@ -131,7 +146,9 @@ $(document).ready(() => {
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |          loadUpdateData(data) {
 |  |          loadUpdateData(data) {
 | 
												
													
														
															|  |              for (const d of data) {
 |  |              for (const d of data) {
 | 
												
													
														
															|  | -                const source = this.data.find(x => { return x.id === d.id });
 |  | 
 | 
												
													
														
															|  | 
 |  | +                const source = this.tree
 | 
												
													
														
															|  | 
 |  | +                    ? this.tree.getItems(d.id)
 | 
												
													
														
															|  | 
 |  | +                    : this.data.find(x => { return x.id === d.id });
 | 
												
													
														
															|  |                  if (!source) continue;
 |  |                  if (!source) continue;
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |                  source.dgn_qty = d.dgn_qty;
 |  |                  source.dgn_qty = d.dgn_qty;
 | 
												
											
												
													
														
															|  | @@ -140,30 +157,52 @@ $(document).ready(() => {
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |      }
 |  |      }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -    const spreadSetting = {
 |  | 
 | 
												
													
														
															|  | -        cols: [
 |  | 
 | 
												
													
														
															|  | -            {title: '工程名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 300, formatter: '@', readOnly: true},
 |  | 
 | 
												
													
														
															|  | -            {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
 |  | 
 | 
												
													
														
															|  | -            {title: '设计', colSpan: '1', rowSpan: '1', field: 'dgn_qty', hAlign: 2, width: 100, type: 'Number'},
 |  | 
 | 
												
													
														
															|  | -            {title: '竣工', colSpan: '1', rowSpan: '1', field: 'final_qty', hAlign: 2, width: 100, type: 'Number'},
 |  | 
 | 
												
													
														
															|  | -        ],
 |  | 
 | 
												
													
														
															|  | -        emptyRows: 0,
 |  | 
 | 
												
													
														
															|  | -        headRows: 1,
 |  | 
 | 
												
													
														
															|  | -        headRowHeight: [32],
 |  | 
 | 
												
													
														
															|  | -        defaultRowHeight: 21,
 |  | 
 | 
												
													
														
															|  | -        headerFont: '12px 微软雅黑',
 |  | 
 | 
												
													
														
															|  | -        font: '12px 微软雅黑',
 |  | 
 | 
												
													
														
															|  | -    };
 |  | 
 | 
												
													
														
															|  |      const mainQtyObj = new QtyObj({
 |  |      const mainQtyObj = new QtyObj({
 | 
												
													
														
															|  |          obj: $('#main_qty_spread')[0],
 |  |          obj: $('#main_qty_spread')[0],
 | 
												
													
														
															|  | -        spreadSetting,
 |  | 
 | 
												
													
														
															|  | 
 |  | +        spreadSetting: {
 | 
												
													
														
															|  | 
 |  | +            cols: [
 | 
												
													
														
															|  | 
 |  | +                {title: '工程名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 300, formatter: '@', readOnly: true},
 | 
												
													
														
															|  | 
 |  | +                {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
 | 
												
													
														
															|  | 
 |  | +                {title: '设计', colSpan: '1', rowSpan: '1', field: 'dgn_qty', hAlign: 2, width: 100, type: 'Number'},
 | 
												
													
														
															|  | 
 |  | +                {title: '竣工', colSpan: '1', rowSpan: '1', field: 'final_qty', hAlign: 2, width: 100, type: 'Number'},
 | 
												
													
														
															|  | 
 |  | +            ],
 | 
												
													
														
															|  | 
 |  | +            emptyRows: 0,
 | 
												
													
														
															|  | 
 |  | +            headRows: 1,
 | 
												
													
														
															|  | 
 |  | +            headRowHeight: [32],
 | 
												
													
														
															|  | 
 |  | +            defaultRowHeight: 21,
 | 
												
													
														
															|  | 
 |  | +            headerFont: '12px 微软雅黑',
 | 
												
													
														
															|  | 
 |  | +            font: '12px 微软雅黑',
 | 
												
													
														
															|  | 
 |  | +        },
 | 
												
													
														
															|  |          data: mainQty,
 |  |          data: mainQty,
 | 
												
													
														
															|  | 
 |  | +        isTree: false,
 | 
												
													
														
															|  |          type: 'main_quantity',
 |  |          type: 'main_quantity',
 | 
												
													
														
															|  |      });
 |  |      });
 | 
												
													
														
															|  |      const gclQtyObj = new QtyObj({
 |  |      const gclQtyObj = new QtyObj({
 | 
												
													
														
															|  |          obj: $('#gcl_qty_spread')[0],
 |  |          obj: $('#gcl_qty_spread')[0],
 | 
												
													
														
															|  | -        spreadSetting,
 |  | 
 | 
												
													
														
															|  | 
 |  | +        spreadSetting: {
 | 
												
													
														
															|  | 
 |  | +            cols: [
 | 
												
													
														
															|  | 
 |  | +                {title: '工程名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 300, formatter: '@', readOnly: true, cellType: 'tree'},
 | 
												
													
														
															|  | 
 |  | +                {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
 | 
												
													
														
															|  | 
 |  | +                {title: '设计', colSpan: '1', rowSpan: '1', field: 'dgn_qty', hAlign: 2, width: 100, type: 'Number'},
 | 
												
													
														
															|  | 
 |  | +                {title: '竣工', colSpan: '1', rowSpan: '1', field: 'final_qty', hAlign: 2, width: 100, type: 'Number'},
 | 
												
													
														
															|  | 
 |  | +            ],
 | 
												
													
														
															|  | 
 |  | +            emptyRows: 0,
 | 
												
													
														
															|  | 
 |  | +            headRows: 1,
 | 
												
													
														
															|  | 
 |  | +            headRowHeight: [32],
 | 
												
													
														
															|  | 
 |  | +            defaultRowHeight: 21,
 | 
												
													
														
															|  | 
 |  | +            headerFont: '12px 微软雅黑',
 | 
												
													
														
															|  | 
 |  | +            font: '12px 微软雅黑',
 | 
												
													
														
															|  | 
 |  | +        },
 | 
												
													
														
															|  |          data: gclQty,
 |  |          data: gclQty,
 | 
												
													
														
															|  |          type: 'gcl_quantity',
 |  |          type: 'gcl_quantity',
 | 
												
													
														
															|  | 
 |  | +        isTree: true,
 | 
												
													
														
															|  | 
 |  | +        treeSetting: {
 | 
												
													
														
															|  | 
 |  | +            id: 'id',
 | 
												
													
														
															|  | 
 |  | +            pid: 'pid',
 | 
												
													
														
															|  | 
 |  | +            order: 'order',
 | 
												
													
														
															|  | 
 |  | +            level: 'level',
 | 
												
													
														
															|  | 
 |  | +            fullPath: 'full_path',
 | 
												
													
														
															|  | 
 |  | +            rootId: -1,
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  |      })
 |  |      })
 | 
												
													
														
															|  |  });
 |  |  });
 |