| 
					
				 | 
			
			
				@@ -47,25 +47,46 @@ function customizeStageTreeSetting(setting, customDisplay) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 初始化 树结构 列事件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @param setting 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+function initTreeColSettingEvents(setting) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const Events = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        readOnly: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            measureData: function (node) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return node.children && node.children.length > 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const getEvent = function (eventName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const names = eventName.split('.'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let event = Events; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (let name of names) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (event[name]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                event = event[name]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (event && Object.prototype.toString.apply(event) !== "[object Function]") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return event; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for (const col of setting.cols) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (col.readOnly && Object.prototype.toString.apply(col.readOnly) === "[object String]") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            col.readOnly = getEvent(col.readOnly); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 界面布局 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     autoFlashHeight(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 初始化 台账 spread 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const slSpread = SpreadJsObj.createNewSpread($('#stage-ledger')[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    customizeStageTreeSetting(ledgerSpreadSetting, customColDisplay()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 数量变更列,添加按钮 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const col = _.find(ledgerSpreadSetting.cols, {field: 'qc_qty'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    col.readOnly = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    col.cellType = 'imageBtn'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    col.hoverImg = '#ellipsis-icon'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    col.indent = 5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    ledgerSpreadSetting.imageClick = function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        postData(window.location.pathname + 'valid-change', data, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            $('#use-bg').modal('show'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    SpreadJsObj.initSheet(slSpread.getActiveSheet(), ledgerSpreadSetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 初始化 台账树结构 数据结构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const stageTreeSetting = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         id: 'ledger_id', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         pid: 'ledger_pid', 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -95,16 +116,8 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             node.dgn_price = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 初始化 台账树结构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const stageTree = createNewPathTree('stage', stageTreeSetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    stageTree.loadDatas(ledgerData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    stageTree.loadCurStageData(curStageData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 根据设置 计算 台账树结构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    treeCalc.calculateAll(stageTree); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 绘制界面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    SpreadJsObj.loadSheetData(slSpread.getActiveSheet(), 'tree', stageTree); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 初始化 部位明细 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 初始化 部位明细 数据结构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const stagePosSetting = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         id: 'id', ledgerId: 'lid', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         updateFields: ['contract_qty', 'qc_qty', 'postil'], 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -116,7 +129,169 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         pos.end_gather_qty = _.add(pos.pre_gather_qty, pos.gather_qty); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const stagePos = new StagePosData(stagePosSetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    class Changes { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        constructor(obj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const self = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.obj = obj; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 初始化 清单编号窗口 参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.spreadSetting = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cols: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    {title: '已用', field: 'used', width: 45, formatter: '@', cellType: 'checkbox', readOnly: true, hAlign: 1,}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    {title: '变更令号', field: 'code', width: 100, formatter: '@', readOnly: true}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    {title: '名称', field: 'name', width: 120, formatter: '@', readOnly: true}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    {title: '总数量', field: 'amount', width: 60, formatter: '@', readOnly: true}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    {title: '可变更数量', field: 'vamount', width: 60, readOnly: true}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    {title: '本期计量', field: 'uamount', width: 60, formatter: '@'}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                emptyRows: 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                headRows: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                headRowHeight: [40], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.curChangeId = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.spread = SpreadJsObj.createNewSpread($('#change-spread')[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.firstView = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 初次显示,需刷新spread界面,保证界面绘制正确 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.obj.bind('shown.bs.modal', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (self.firstView) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    self.firstView = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    self.spread.refresh(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 切换变更令,加载右侧明细数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.spread.bind(spreadNS.Events.SelectionChanged, function (e, info) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const change = SpreadJsObj.getSelectObject(info.sheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                self._loadChangeDetail(change); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 过滤可变更数量为0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#customCheckDisabled').click(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                self._filterEmptyChange(!this.checked); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        _loadChangeDetail(change) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (change) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (change.cid === this.curChangeId) { return; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.curChangeId = change.cid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const inputs = $('input[type!=checkbox]', this.obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const i of inputs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const field = $(i).attr('name'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const text = (field && change[field]) ? change[field] : ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $(i).val(text); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const textareas = $('textarea', this.obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const ta of textareas) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const field = $(ta).attr('name'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const text = (field && change[field]) ? change[field] : ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ta.innerText = text; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const html = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const a of change.attachments) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    html.push('<tr>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    html.push('<td>', a.filename + a.fileext, '</td>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    html.push('<td>', a.u_name, '</td>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    html.push('</tr>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 变更类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const cType = change.type.split(','); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('input[name="type"]').prop("checked", false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const c of cType) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('input[name="type"][value='+ c +']').prop("checked", true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 变更类别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('select[name=class]').val(change.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 变更性质 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('select[name=quality]').val(change.quality); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 变更单位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('select[name=company]').html('<option>' + change.company + '</option>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 费用承担方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('input[name=charge][value=' + change.charge + ']').prop('checked', true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 附件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#attachment').html(html.join('')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const inputs = $('input', this.obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const i of inputs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $(i).val(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const textareas = $('textarea', this.obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const ta of textareas) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ta.innerText = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#attachment').html(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        _viewChanges() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const sheet = this.spread.getActiveSheet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (this.changes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                SpreadJsObj.loadSheetData(sheet, SpreadJsObj.DataType.Data, this.changes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sheet.setSelection(0, 0, 1, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this._loadChangeDetail(this.changes[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this._filterEmptyChange(!$('#customCheckDisabled')[0].checked); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toast('查询变更令有误,请刷新页面后重试', 'warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        _filterEmptyChange(isFilter) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (const c of this.changes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                c.visible = isFilter ? (c.vamount || c.vamount === 0) : true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SpreadJsObj.refreshTreeRowVisible(this.spread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        loadChanges(data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.callData = data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const self = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData(window.location.pathname + '/valid-change', data, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                self.changes = result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                self._viewChanges(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                self.obj.modal('show'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const changesObj = new Changes($('#use-bg')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 初始化 台账 spread 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const slSpread = SpreadJsObj.createNewSpread($('#stage-ledger')[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    customizeStageTreeSetting(ledgerSpreadSetting, customColDisplay()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 数量变更列,添加按钮 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const col = _.find(ledgerSpreadSetting.cols, {field: 'qc_qty'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    col.readOnly = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    col.cellType = 'imageBtn'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    col.hoverImg = '#ellipsis-icon'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    col.indent = 5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    col.showImage = function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!data || (data.children && data.children.length > 0)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const nodePos = stagePos.getLedgerPos(data.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return !(nodePos && nodePos.length > 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ledgerSpreadSetting.imageClick = function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        changesObj.loadChanges({bills: data}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    SpreadJsObj.initSheet(slSpread.getActiveSheet(), ledgerSpreadSetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    stageTree.loadDatas(ledgerData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    stageTree.loadCurStageData(curStageData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 根据设置 计算 台账树结构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    treeCalc.calculateAll(stageTree); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 绘制界面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    SpreadJsObj.loadSheetData(slSpread.getActiveSheet(), 'tree', stageTree); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 初始化 部位明细 Spread 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const spSpread = SpreadJsObj.createNewSpread($('#stage-pos')[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const spCol = _.find(posSpreadSetting.cols, {field: 'qc_qty'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    spCol.readOnly = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    spCol.cellType = 'imageBtn'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    spCol.hoverImg = '#ellipsis-icon'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    spCol.indent = 5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    spCol.showImage = function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    posSpreadSetting.imageClick = function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        changesObj.loadChanges({pos: data}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     SpreadJsObj.initSheet(spSpread.getActiveSheet(), posSpreadSetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const stageTreeSpreadObj = { 
			 |