ellisran 5 часов назад
Родитель
Сommit
63fab44850
2 измененных файлов с 10 добавлено и 1 удалено
  1. 7 1
      app/public/js/contract_detail.js
  2. 3 0
      app/service/contract_pay.js

+ 7 - 1
app/public/js/contract_detail.js

@@ -607,12 +607,18 @@ $(document).ready(function() {
                 } else if (!node.settle_code && pay_shenpi_status && (pay.status === auditConst.status.checking || pay.status === auditConst.status.checkNoPre) && pay.curAuditorIds && pay.curAuditorIds.length > 0 && pay.curAuditorIds.indexOf(user_id) !== -1) {
                 } else if (!node.settle_code && pay_shenpi_status && (pay.status === auditConst.status.checking || pay.status === auditConst.status.checkNoPre) && pay.curAuditorIds && pay.curAuditorIds.length > 0 && pay.curAuditorIds.indexOf(user_id) !== -1) {
                     showEdit = true;
                     showEdit = true;
                 }
                 }
+                if (pay.rela_stage && !node.settle_code && (node.uid === user_id || permission_add_pay || is_admin)) {
+                    showEdit = false;
+                    showDel = true;
+                }
                 return {...pay, showEdit, showDel}
                 return {...pay, showEdit, showDel}
             })
             })
             console.log(pays);
             console.log(pays);
             newPays.forEach((pay, idx) => {
             newPays.forEach((pay, idx) => {
                 const shenpi_html = setPayShenpiHtml(pay, false, node);
                 const shenpi_html = setPayShenpiHtml(pay, false, node);
-                const operationHtml = !pay.fpcid ? `<a href="javascript:void(0);" class="text-primary pay-edit" data-id="${pay.id}" ${!pay.showEdit ? `style="display:none"` : ''}>编辑</a> <a href="javascript:void(0);" class="text-danger pay-del" data-id="${pay.id}" ${!pay.showDel ? `style="display:none"` : ''}>删除</a>` : '';
+                const editHtml = !pay.rela_stage ? `<a href="javascript:void(0);" class="text-primary pay-edit" data-id="${pay.id}" ${!pay.showEdit ? 'style="display:none"' : ''}>编辑</a>` : '';
+                const delHtml = `<a href="javascript:void(0);" class="text-danger pay-del" data-id="${pay.id}" ${!pay.showDel ? 'style="display:none"' : ''}>删除</a>`;
+                const operationHtml = !pay.fpcid ? `${editHtml}${editHtml ? ' ' : ''}${delHtml}` : '';
                 const sourceIconHtml = pay.fpcid
                 const sourceIconHtml = pay.fpcid
                     ? '<a href="javascript:void(0);" title="关联资金支付" style="position: absolute;right: 2px;top:50%;transform: translate(-50%, -50%);"><i class="fa fa-cny"></i></a>'
                     ? '<a href="javascript:void(0);" title="关联资金支付" style="position: absolute;right: 2px;top:50%;transform: translate(-50%, -50%);"><i class="fa fa-cny"></i></a>'
                     : pay.rela_stage
                     : pay.rela_stage

+ 3 - 0
app/service/contract_pay.js

@@ -252,6 +252,9 @@ module.exports = app => {
             if (!cpInfo) {
             if (!cpInfo) {
                 throw '合同' + contractConst.typeName[cpInfo.contract_type] + '不存在';
                 throw '合同' + contractConst.typeName[cpInfo.contract_type] + '不存在';
             }
             }
+            if (cpInfo.rela_stage) {
+                throw '关联标段期的合同支付不能编辑';
+            }
             const transaction = await this.db.beginTransaction();
             const transaction = await this.db.beginTransaction();
             try {
             try {
                 await transaction.update(this.tableName, data);
                 await transaction.update(this.tableName, data);