| 
					
				 | 
			
			
				@@ -165,7 +165,7 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         node.end_contract_tp = ZhCalc.add(node.pre_contract_tp, node.contract_tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         node.end_qc_tp = ZhCalc.add(node.pre_qc_tp, node.qc_tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), tenderInfo.decimal.up); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        node.final_dgn_price = ZhCalc.round(ZhCalc.div(node.end_gather_tp, ZhCalc.add(node.deal_dgn_qty1, node.c_dgn_qty1)), tenderInfo.decimal.up); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const stageTree = createNewPathTree('stage', stageTreeSetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 初始化 部位明细 数据结构 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -458,6 +458,7 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ledgerSpreadSetting.imageClick = function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         changesObj.loadChanges({bills: data}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ledgerSpreadSetting.dgnUpFields = ['deal_dgn_qty1', 'deal_dgn_qty2', 'c_dgn_qty1', 'c_dgn_qty2']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     SpreadJsObj.initSheet(slSpread.getActiveSheet(), ledgerSpreadSetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     stageTree.loadDatas(ledgerData); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -502,9 +503,20 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (info.sheet.zh_setting) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const col = info.sheet.zh_setting.cols[info.col]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const sortData = info.sheet.zh_dataType === 'tree' ? info.sheet.zh_tree.nodes : info.sheet.zh_data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const node = sortData[info.row]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const node = sortData[info.row], updateData = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (col.field !== 'postil') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const orgValue = node[col.field]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const newValue =  col.type === 'Number' ? parseFloat(info.editingText) : info.editingText; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (orgValue == newValue || ((!orgValue || orgValue === '') && (newValue === ''))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (col.field.indexOf('_dgn_') > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (node.b_code && node.b_code !== '') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        toast('仅项目节可输入设计数量'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        SpreadJsObj.reLoadRowData(info.sheet, info.row); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else if (col.field !== 'postil') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (node.children && node.children.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         toast('清单父项不可计量', 'error'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         SpreadJsObj.reLoadRowData(info.sheet, info.row); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -518,12 +530,20 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const billsData = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    lid: node.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                billsData[col.field] = col.type === 'Number' ? parseFloat(info.editingText) : info.editingText; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                postData(window.location.href + '/update', { bills: billsData }, function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (col.field.indexOf('_dgn_') > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    updateData.dgn = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        id: node.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    updateData.dgn[col.field] = newValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    updateData.stage = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        lid: node.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    updateData.stage[col.field] = newValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                postData(window.location.href + '/update', {bills: updateData}, function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const nodes = stageTree.loadPostStageData(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     needCheckDetail(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -550,29 +570,41 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (validCols.length === 0) { return; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const sortData = sheet.zh_tree.nodes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const datas = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const datas = [], dgnDatas = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for (let iRow = sel.row; iRow < sel.row + sel.rowCount; iRow++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const node = sortData[iRow]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (node) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        const data = { lid: node.id }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        let filter = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        const data = { lid: node.id }, dgnData = { id: node.id }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        let filter = true, filterDgn = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         for (const iCol of validCols) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             const colSetting = sheet.zh_setting.cols[iCol]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if (colSetting.field !== 'postil') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (sheet.zh_setting.dgnUpFields.indexOf(colSetting.field) !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (node.b_code && node.b_code !== '') continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } else if (colSetting.field !== 'postil') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 if (node.children && node.children.length > 0) { continue; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 const nodePos = stagePos.getLedgerPos(node.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 if (nodePos && nodePos.length > 0) { continue; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            data[colSetting.field] = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            filter = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (!filter) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            datas.push(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (sheet.zh_setting.dgnUpFields.indexOf(colSetting.field) !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (node[colSetting.field] && node[colSetting.field] !== 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    dgnData[colSetting.field] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    filterDgn = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                data[colSetting.field] = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                filter = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (!filter) datas.push(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (!filterDgn) dgnDatas.push(dgnData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (datas.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    postData(window.location.href + '/update', {bills: datas}, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (datas.length > 0 || dgnDatas.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const bills = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (datas.length > 0) bills.stage = datas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (dgnDatas.length > 0) bills.dgn = dgnDatas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    postData(window.location.href + '/update', {bills: bills}, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         const nodes = stageTree.loadPostStageData(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         needCheckDetail(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -582,12 +614,12 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         clipboardPasting(e, info) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (info.sheet.zh_setting) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const sortData = info.sheet.zh_data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const setting = info.sheet.zh_setting; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const range = info.cellRange; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const validField = ['contract_qty', 'contract_tp', 'qc_qty', 'postil']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const stageField = ['contract_qty', 'contract_tp', 'qc_qty', 'postil']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for (let iCol = range.col; iCol < range.col + range.colCount; iCol++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const col = info.sheet.zh_setting.cols[iCol]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (validField.indexOf(col.field) === -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if ((stageField.indexOf(col.field) === -1) && setting.dgnUpFields.indexOf(col.field) === -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         toast('不可修改此数据', 'error'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         info.cancel = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         return; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -597,41 +629,47 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         clipboardPasted(e, info) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (info.sheet.zh_setting && info.sheet.zh_tree) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const sheet = info.sheet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const filterNodes = [], datas = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const sheet = info.sheet, setting = info.sheet.zh_setting; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const filterNodes = [], datas = [], dgnDatas = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const curRow = iRow + info.cellRange.row; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const node = sheet.zh_tree.getItemsByIndex(curRow); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const data = {lid: node.id}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    let filter = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const data = {lid: node.id}, dgnData = {id: node.id}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    let filter = true, filterDgn = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         const curCol = info.cellRange.col + iCol; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         const col = info.sheet.zh_setting.cols[curCol]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (col.field !== 'postil') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if (node.children && node.children.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (setting.dgnUpFields.indexOf(col.field) !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (node.b_code && node.b_code !== '') continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else if (col.field !== 'postil') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (node.children && node.children.length > 0) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             const nodePos = stagePos.getLedgerPos(node.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if (nodePos && nodePos.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (nodePos && nodePos.length > 0) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        data[col.field] = col.type === 'Number' ? _.toNumber(info.sheet.getText(curRow, curCol)) : info.sheet.getText(curRow, curCol); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        filter = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (setting.dgnUpFields.indexOf(col.field) !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            dgnData[col.field] = _.toNumber(sheet.getText(curRow, curCol)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            filterDgn = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            data[col.field] = col.type === 'Number' ? _.toNumber(sheet.getText(curRow, curCol)) : sheet.getText(curRow, curCol); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            filter = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (filter) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (filter && filterDgn) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         filterNodes.push(node); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        datas.push(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (!filter) datas.push(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (!filterDgn) dgnDatas.push(dgnData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (datas.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    postData(window.location.href + '/update', { bills: datas }, function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (datas.length > 0 || dgnDatas.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const updateData = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (datas.length > 0) updateData.stage = datas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (dgnDatas.length > 0) updateData.dgn = dgnDatas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    postData(window.location.href + '/update', {bills: updateData}, function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         const nodes = stageTree.loadPostStageData(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes.concat(filterNodes)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         needCheckDetail(); 
			 |