| 
					
				 | 
			
			
				@@ -48,6 +48,9 @@ $(document).ready(function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         rootId: -1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         keys: ['id', 'tender_id', 'ledger_id'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         preUrl: '/tender/' + getTenderId() + '/ledger', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //treeCacheKey: 'ledger_bills_fold' + '_' + getTenderId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        markFoldKey: 'bills-fold', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        markFoldSubKey: window.location.pathname.split('/')[2], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (checkTzMeasureType()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         treeSetting.calcFields = ['sgfh_tp', 'sjcl_tp', 'qtcl_tp', 'total_price']; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2190,14 +2193,14 @@ $(document).ready(function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (!dealBills) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     dealBills = new DealBills('#deal-bills-spread', { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         cols: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            {title: '清单编号', field: 'code', hAlign: 0, width: 85, formatter: '@', readOnly: true}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@', readOnly: true}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            {title: '单价', field: 'unit_price', hAlign: 2, width: 50, readOnly: true}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            {title: '数量', field: 'quantity', hAlign: 2, width: 50, readOnly: true}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            {title: '金额', field: 'total_price', hAlign: 2, width: 50, readOnly: true}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            {title: '清单编号', field: 'code', hAlign: 0, width: 85, formatter: '@'}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@'}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@'}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            {title: '单价', field: 'unit_price', hAlign: 2, width: 50}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            {title: '数量', field: 'quantity', hAlign: 2, width: 50}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            {title: '金额', field: 'total_price', hAlign: 2, width: 50}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        emptyRows: 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        emptyRows: 3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         headRows: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         headRowHeight: [32], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         defaultRowHeight: 21, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2205,6 +2208,7 @@ $(document).ready(function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         font: '12px 微软雅黑', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         headColWidth: [0], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         selectedBackColor: '#fffacd', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        readOnly: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     dealBills.loadData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2260,44 +2264,47 @@ $(document).ready(function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.url = '/tender/' + getTenderId() + '/deal'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.spreadSetting = spreadSetting; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.spread = SpreadJsObj.createNewSpread(this.obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.sheet = this.spread.getActiveSheet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!readOnly) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const dealSheet = info.sheet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const mainSheet = ledgerSpread.getActiveSheet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const dealSheet = info.sheet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!dealSheet.zh_setting.readOnly) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const dealBills = SpreadJsObj.getSelectObject(dealSheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!dealBills) { return; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const mainTree = mainSheet.zh_tree; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const mainNode = SpreadJsObj.getSelectObject(mainSheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!mainNode || !mainTree) { return; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const mainSheet = ledgerSpread.getActiveSheet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (mainNode.code && mainNode.code !== '' && !mainTree.isLeafXmj(mainNode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    toastr.error('非最底层项目下,不应添加清单'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const dealBills = SpreadJsObj.getSelectObject(dealSheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!dealBills) { return; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const mainTree = mainSheet.zh_tree; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const mainNode = SpreadJsObj.getSelectObject(mainSheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!mainNode || !mainTree) { return; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                postData(window.location.pathname + '/update', { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    postType: 'add-deal', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    postData: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        id: mainNode.ledger_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        type: mainNode.code ? 'child' : 'next', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        dealBills: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            b_code: dealBills.code, name: dealBills.name, unit: dealBills.unit, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            unit_price: dealBills.unit_price, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const refreshData = mainTree.loadPostData(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    treeOperationObj.refreshTree(mainSheet, refreshData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const sel = mainSheet.getSelections()[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    mainSheet.setSelection(refreshData.create[0].index, sel.col, sel.rowCount, sel.colCount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, refreshData.create[0].index]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    treeOperationObj.refreshOperationValid(mainSheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    ledgerSpread.focus(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    posOperationObj.loadCurPosData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (mainNode.code && mainNode.code !== '' && !mainTree.isLeafXmj(mainNode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        toastr.error('非最底层项目下,不应添加清单'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    postData(window.location.pathname + '/update', { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        postType: 'add-deal', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        postData: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            id: mainNode.ledger_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            type: mainNode.code ? 'child' : 'next', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            dealBills: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                b_code: dealBills.code, name: dealBills.name, unit: dealBills.unit, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                unit_price: dealBills.unit_price, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        const refreshData = mainTree.loadPostData(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        treeOperationObj.refreshTree(mainSheet, refreshData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        const sel = mainSheet.getSelections()[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        mainSheet.setSelection(refreshData.create[0].index, sel.col, sel.rowCount, sel.colCount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, refreshData.create[0].index]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        treeOperationObj.refreshOperationValid(mainSheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        ledgerSpread.focus(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        posOperationObj.loadCurPosData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $('#upload-deal-bills').click(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const file = $('#deal-bills-file')[0]; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2319,6 +2326,43 @@ $(document).ready(function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     items: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        edit: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            name: '进入编辑模式', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            icon: 'fa-edit', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            visible: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                return self.sheet.zh_setting.readOnly; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            callback: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                self.sheet.zh_setting.readOnly = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                SpreadJsObj.refreshSheetReadOnly(self.sheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        read: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            name: '退出编辑模式', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            icon: 'fa-sign-out', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            visible: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                return !self.sheet.zh_setting.readOnly; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            callback: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                self.sheet.zh_setting.readOnly = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                SpreadJsObj.refreshSheetReadOnly(self.sheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        del: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            name: '删除', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            icon: 'fa-times', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            visible: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                return !self.sheet.zh_setting.readOnly; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            disabled: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                const select = SpreadJsObj.getSelectObject(self.sheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                return !select; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            callback: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        sprEdit: '---------', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         apply: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             name: '应用全部清单单价至台账', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             icon: 'fa-magic', 
			 |