| 
					
				 | 
			
			
				@@ -34,7 +34,7 @@ function makeAttTable(payNode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let html = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (attachment !== null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (const [index, att] of attachment.entries()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            const delhtml = !readOnly && uploadPermission && (parseInt(att.uid) === parseInt(userID) || payNode.uid === parseInt(userID) || (payNode.uid === -1 && parseInt(userID) === stage.user_id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const delhtml = !readOnly && uploadPermission && (parseInt(att.uid) === userID || payNode.uid === userID || (payNode.uid === -1 && userID === stage.user_id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ? '<a class="delete-att text-danger" href="javascript:void(0);" data-payid="'+ id +'" data-attindex="'+ index +'" title="删除"><i class="fa fa-remove "></i></a>' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 : ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             html += '<tr><td style="width: 200px">' + att.filename + att.fileext + '</td><td>' + att.username + '</td><td>' + att.in_time + '</td>' + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -162,6 +162,42 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return defaultColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const payBase = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isNonZero: function (num) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return !(!num || num === 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isYF: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return data.ptype === 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isWC: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return data.ptype === 4; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isSF: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return data.ptype === 3; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isSpecial: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return data.ptype !== 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isOld: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (data.csorder === 0 && payBase.isYB) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return stage.order > 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return stage.order > data.csorder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isYB: function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return userID === stage.user_id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isOwner: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return data.uid === 0 ? payCol.isYB() : data.uid === userID; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isStarted: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return data.pre_used; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isFinish: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return data.pre_finish; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const payCol = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         getValue: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             attachment: function (data) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -179,63 +215,57 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         readOnly: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            isNonZero: function (num) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return !(!num || num === 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            isYF: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return data.ptype === 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            isSpecial: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return data.ptype !== 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            isOld: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (data.csorder === 0 && payCol.readOnly.isYB(data)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return stage.order > 1 || stage.times > 1 || stage.curOrder > 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return stage.order > data.csorder || stage.times > data.cstimes || stage.curOrder > data.csaorder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            isYB: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return (stage.status === 1 || stage.status === 4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            isStarted: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return ((payCol.readOnly.isNonZero(data.end_tp) || payCol.readOnly.isNonZero(data.tp)) && data.tp !== data.end_tp) || payCol.readOnly.isNonZero(data.pre_tp) || data.pre_used; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             name: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return payCol.readOnly.isSpecial(data); //所有人,轮到自己时,均可修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return payBase.isSpecial(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             minus: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (payCol.readOnly.isOld(data)) { // 上报或审批后,仅原报,在未开始计量前,可修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return payCol.readOnly.isSpecial(data) || payCol.readOnly.isStarted(data) || !payCol.readOnly.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } else { // 新增时,新增人可修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return payCol.readOnly.isSpecial(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (payBase.isOld(data)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return payBase.isSpecial(data) || payBase.isStarted(data) || !payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return !payBase.isOwner(data) || !payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             tp: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return data.ptype === 2 || data.ptype === 4; // 仅本期完成计量、本期应付,不可修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return payBase.isWC(data) || payBase.isYF(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sprice: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (payCol.readOnly.isOld(data)) { // 上报或审批后,仅原报,在未开始计量前,可修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return payCol.readOnly.isYF(data) || payCol.readOnly.isStarted(data) || !payCol.readOnly.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } else { // 新增时,新增人可修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return payCol.readOnly.isSpecial(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (payBase.isOld(data)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return payBase.isStarted(data) || !payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return payBase.isWC(data) || payBase.isSF(data) || !payBase.isOwner(data) || !payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             rprice: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (payCol.readOnly.isOld(data)) { // 上报或审批后,仅原报,在未开始计量前,可修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return payCol.readOnly.isYF(data) || !payCol.readOnly.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } else { // 新增时,新增人可修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return payCol.readOnly.isSpecial(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (payBase.isOld(data)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return !payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return payBase.isWC(data) || payBase.isSF(data) && !payBase.isOwner(data) || !payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        menuVisible: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             pause: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (payCol.readOnly.isOld(data)) { // 上报或审批后,仅原报,可修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return payCol.readOnly.isSpecial(data) || !payCol.readOnly.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } else { // 新增时,新增人可修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return payCol.readOnly.isSpecial(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (payBase.isOld(data)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return payBase.isOwner(data) || payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            deadline: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (payBase.isOld(data)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return !payBase.isFinish(data) && payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return payBase.isOwner(data) || payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            belongYF: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (payBase.isOld(data)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return !payBase.isStarted(data) && payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return payBase.isOwner(data) || payBase.isYB(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     SpreadJsObj.initSpreadSettingEvents(paySpreadSetting, payCol); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     SpreadJsObj.initSheet(paySpread.getActiveSheet(), paySpreadSetting); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -246,7 +276,7 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!payNode) return [false, '数据错误']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const num = text ? _.toNumber(text) : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const expr = text ? (num ? null : text) : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (payCol.readOnly.isStarted(payNode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (payBase.isStarted(payNode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return [false, '已经开始计量,请勿修改起扣金额']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (stage.order > 1) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -267,7 +297,7 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!payNode) return [false, '数据错误']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const num = text ? _.toNumber(text) : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const expr = text ? (num ? null : text) : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (payCol.readOnly.isStarted(payNode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (payBase.isStarted(payNode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (payNode.pre_finish) return [false, '已达扣款限额,请勿修改']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const value = expr ? payCalc.calculateExpr(expr) : num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (payNode.pre_tp && value < payNode.pre_tp) return [false, '截止上期已计量' + payNode.pre_tp + ',扣款限额请勿少于改值']; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -306,10 +336,12 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const sheet = paySpread.getActiveSheet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const select = SpreadJsObj.getSelectObject(sheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             setObjEnable($('#add'), !readOnly); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            setObjEnable($('#del'), !readOnly && select && (!payCol.readOnly.isOld(select) || 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                (!payCol.readOnly.isStarted(select) && payCol.readOnly.isYB(select)))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            setObjEnable($('#up-move'), !readOnly && select && select.ptype === 1 && dealPay.indexOf(select) > 3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            setObjEnable($('#down-move'), !readOnly && select && select.ptype === 1 && dealPay.indexOf(select) < dealPay.length - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const delValid = payBase.isOld(select) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ? !payBase.isStarted(select) && payBase.isYB() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                : payBase.isYB() || payBase.isOwner(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setObjEnable($('#del'), !readOnly && select && delValid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setObjEnable($('#up-move'), !readOnly && select && !payBase.isSpecial(select) && dealPay.indexOf(select) > 3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setObjEnable($('#down-move'), !readOnly && select && !payBase.isSpecial(select) && dealPay.indexOf(select) < dealPay.length - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         add: function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const sheet = paySpread.getActiveSheet(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -326,11 +358,11 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         del: function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const sheet = paySpread.getActiveSheet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const select = SpreadJsObj.getSelectObject(sheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (payCol.readOnly.isNonZero(select.tp)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (payBase.isNonZero(select.tp)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 toast('该支付(扣款)项存在数据,如需删除请先清除本期金额!'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } else if (payCol.readOnly.isOld(select)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (payCol.readOnly.isStarted(select)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (payBase.isOld(select)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (payBase.isStarted(select)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     toast('该合同支付项往期已进行计算,不允许删除'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -393,13 +425,13 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const data = SpreadJsObj.getSelectObject(info.sheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (col.field === 'tp') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $('#expr').val(data.expr).attr('field', 'expr').attr('org', data.expr) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    .attr('readOnly', readOnly|| payCol.readOnly.isSpecial(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .attr('readOnly', readOnly|| payBase.isSpecial(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else if (col.field === 'sprice') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $('#expr').val(data.sexpr).attr('field', 'sexpr').attr('org', data.sexpr) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    .attr('readOnly', readOnly|| payCol.readOnly.isSpecial(data) || payCol.readOnly.isOld(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .attr('readOnly', readOnly|| payCol.readOnly.sprice(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else if (col.field === 'rprice') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $('#expr').val(data.rexpr).attr('field', 'rexpr').attr('org', data.rexpr) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    .attr('readOnly', readOnly|| payCol.readOnly.isSpecial(data) || payCol.readOnly.isOld(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .attr('readOnly', readOnly|| payCol.readOnly.rprice(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $('#expr').val('').attr('readOnly', true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -646,7 +678,7 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const expr = $(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = expr.val(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (orgValue === newValue) { return; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (orgValue === newValue || (!orgValue && newValue == '')) { return; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const data = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (field === 'expr') { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -654,11 +686,22 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 data.updateData = { pid: select.pid, tp: null, expr: newValue } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else if (field === 'sexpr') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 data.type = 'info'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                data.updateData = {id: select.pid, sprice: null, sexpr: newValue}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                data.updateData = {id: select.pid}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const [valid, msg] = paySpreadObj._checkSExpr(select, newValue, data.updateData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!valid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    toastr.warning(msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.value = select.sexpr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else if (field === 'rexpr') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 data.type = 'info'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                data.updateData = {id: select.pid, rprice: null, rexpr: newValue}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                data.updateData = {id: select.pid}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const [valid, msg] = paySpreadObj._checkRExpr(select, newValue, data.updateData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!valid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    toastr.warning(msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.value = select.rexpr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 expr.val(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -726,7 +769,6 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $('#dl-hint').show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 右键菜单 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -762,7 +804,7 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 visible: function(key, opt){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return select.ptype === 4; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return payBase.isWC(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             'start': { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -785,11 +827,7 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 visible: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return select.ptype === 1 && select.pause; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                disabled: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return readOnly || payCol.readOnly.pause(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return !payBase.isSpecial(select) && !readOnly && select.pause && payCol.menuVisible.pause(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             'stop': { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -812,33 +850,24 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 visible: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return select.ptype === 1 && !select.pause; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return !payBase.isSpecial(select) && !readOnly && !payBase.pause && payCol.menuVisible.pause(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                disabled: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return readOnly || payCol.readOnly.pause(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             'setDeadline': { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 name: '设置计提期限', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 icon: 'fa-clipboard', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                visible: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const stageId = getStageId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return select.ptype === 1 && (select.csorder == stageId || stageId == 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 callback: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     deadlineObj.initView(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (select.rprice) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         $('#deadline').modal('show'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        toast('计提期限用于达到条件时,即刻计量至付(扣)款限额,应先设置付(扣)款限额', 'warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        toastr.warning('计提期限用于达到条件时,即刻计量至付(扣)款限额,应先设置付(扣)款限额'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                disabled: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                visible: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return readOnly || payCol.readOnly.minus(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return !payBase.isSpecial(select) && !readOnly && payCol.menuVisible.deadline(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             'dropYF': { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -846,8 +875,7 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 icon: 'fa-chain-broken', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 visible: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const stageId = getStageId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return select.ptype === 1 && select.is_yf && (select.csorder == stageId || stageId == 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return !payBase.isSpecial(select) && select.is_yf && payCol.menuVisible.belongYF(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 callback: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -863,10 +891,6 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         loadUpdateDealPays(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         SpreadJsObj.reLoadSheetData(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                disabled: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return readOnly || payCol.readOnly.minus(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             'belongYF': { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -874,8 +898,7 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 icon: 'fa-chain', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 visible: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const stageId = getStageId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return select.ptype === 1 && !select.is_yf && (select.csorder == stageId || stageId == 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return !payBase.isSpecial(select) && !select.is_yf && payCol.menuVisible.belongYF(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 callback: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -886,15 +909,10 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             is_yf: true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // 更新至服务器 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     postData(window.location.pathname + '/save', data, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         loadUpdateDealPays(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         SpreadJsObj.reLoadSheetData(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                disabled: function (key, opt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return readOnly || payCol.readOnly.minus(select); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -905,6 +923,10 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $('#tp').change(deadlineObj.getTotalPriceHint); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $('#deadline-ok').click(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const select = SpreadJsObj.getSelectObject(paySpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (payBase.isFinish(select)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.warning('已达扣款限额,请勿修改'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             type: 'info', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             updateData: { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -915,6 +937,22 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         data.updateData.dl_count = parseInt($('#stage-count').val()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         data.updateData.dl_tp_type = $('[name=tp-type]:checked').val(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         data.updateData.dl_tp = parseFloat($('#tp').val()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (data.updateData.dl_type === 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (data.updateData.dl_count < stage.order) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.warning('已计量至第' + stage.order + '期,不可设置计提期限为第' + data.updateData.dl_count + '期'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (data.updateData.dl_tp_type === 'contract' && preContractTp && data.updateData.dl_tp < preContractTp) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.warning('截止上期,合同已计量' + preContractTp + ',不可设置计提期限为累计合同计量达' + data.updateData.dl_tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (data.updateData.dl_tp_type === 'gather' && preGatherTp && data.updateData.dl_tp < preGatherTp) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.warning('截止上期,合同+变更已计量' + preGatherTp + ',不可设置计提期限为累计完成计量达' + data.updateData.dl_tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (data.updateData.dl_tp_type === 'qc' && preGatherTp && data.updateData.dl_tp < preQcTp) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.warning('截止上期,变更已计量' + preQcTp + ',不可设置计提期限为累计变更计量达' + data.updateData.dl_tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         postData(window.location.pathname + '/save', data, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             loadUpdateDealPays(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             SpreadJsObj.reLoadSheetData(paySpread.getActiveSheet()); 
			 |