Просмотр исходного кода

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

Tony Kang 2 лет назад
Родитель
Сommit
c08b288956

+ 1 - 0
app/base/base_controller.js

@@ -35,6 +35,7 @@ class BaseController extends Controller {
                 }
             }
         }
+        if (ctx.controllerName === 'sp') ctx.menu = menuList.file;
         menuList.datacollect.display = ctx.session && ctx.session.sessionProject ? ctx.session.sessionProject.showDataCollect : false;
         menuList.payment.display = ctx.session && ctx.session.sessionProject ? ctx.session.sessionProject.showPayment : false;
         if (ctx.session && ctx.session.sessionProject && ctx.session.sessionProject.page_show && ctx.session.sessionProject.page_show.openManagement) {

+ 1 - 0
app/const/material.js

@@ -22,6 +22,7 @@ const m_type = [
     { text: '水泥', value: 5 },
     { text: '半成品', value: 6 },
     { text: '砂石料', value: 8 },
+    { text: '沥青', value: 9 },
     { text: '其他', value: 7 },
 ];
 // 指数调差类型

+ 4 - 3
app/controller/advance_controller.js

@@ -91,9 +91,10 @@ module.exports = app => {
                     columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                 });
                 data.accountList = accountList;
-                data.accountGroup = accountGroup.map((item, idx) => {
-                    const groupList = accountList.filter(item => item.account_group === idx);
-                    return { groupName: item, groupList };
+                const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                data.accountGroup = unitList.map(item => {
+                    const groupList = accountList.filter(item1 => item1.company === item.name);
+                    return { groupName: item.name, groupList };
                 });
                 data.auditorList = await ctx.service.advanceAudit.getAuditors(ctx.advance.id, ctx.advance.times);
             }

+ 20 - 15
app/controller/change_controller.js

@@ -358,9 +358,10 @@ module.exports = app => {
                         columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group'],
                     });
                     renderData.accountList = accountList;
-                    renderData.accountGroup = accountGroup.map((item, idx) => {
-                        const groupList = accountList.filter(item => item.account_group === idx);
-                        return { groupName: item, groupList };
+                    const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                    renderData.accountGroup = unitList.map(item => {
+                        const groupList = accountList.filter(item1 => item1.company === item.name);
+                        return { groupName: item.name, groupList };
                     });
                     // 重新上报获取审批流程
                     if (auditStatus === 2 || auditStatus === 9) {
@@ -639,9 +640,10 @@ module.exports = app => {
                         columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group'],
                     });
                     renderData.accountList = accountList;
-                    renderData.accountGroup = accountGroup.map((item, idx) => {
-                        const groupList = accountList.filter(item => item.account_group === idx);
-                        return { groupName: item, groupList };
+                    const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                    renderData.accountGroup = unitList.map(item => {
+                        const groupList = accountList.filter(item1 => item1.company === item.name);
+                        return { groupName: item.name, groupList };
                     });
                     // 重新上报获取审批流程
                     if (auditStatus === 2 || auditStatus === 9) {
@@ -2094,9 +2096,10 @@ module.exports = app => {
                     columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                 });
                 renderData.accountList = accountList;
-                renderData.accountGroup = accountGroup.map((item, idx) => {
-                    const groupList = accountList.filter(item => item.account_group === idx);
-                    return { groupName: item, groupList };
+                const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                renderData.accountGroup = unitList.map(item => {
+                    const groupList = accountList.filter(item1 => item1.company === item.name);
+                    return { groupName: item.name, groupList };
                 });
                 // }
                 await this.layout('change/project_information.ejs', renderData, 'change/project_information_modal.ejs');
@@ -2694,9 +2697,10 @@ module.exports = app => {
                         columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                     });
                     renderData.accountList = accountList;
-                    renderData.accountGroup = accountGroup.map((item, idx) => {
-                        const groupList = accountList.filter(item => item.account_group === idx);
-                        return { groupName: item, groupList };
+                    const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                    renderData.accountGroup = unitList.map(item => {
+                        const groupList = accountList.filter(item1 => item1.company === item.name);
+                        return { groupName: item.name, groupList };
                     });
                 }
                 await this.layout('change/apply_information.ejs', renderData, 'change/apply_information_modal.ejs');
@@ -3315,9 +3319,10 @@ module.exports = app => {
                         columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                     });
                     renderData.accountList = accountList;
-                    renderData.accountGroup = accountGroup.map((item, idx) => {
-                        const groupList = accountList.filter(item => item.account_group === idx);
-                        return { groupName: item, groupList };
+                    const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                    renderData.accountGroup = unitList.map(item => {
+                        const groupList = accountList.filter(item1 => item1.company === item.name);
+                        return { groupName: item.name, groupList };
                     });
                 }
                 await this.layout('change/plan_information.ejs', renderData, 'change/plan_information_modal.ejs');

+ 1 - 1
app/controller/datacollect_controller.js

@@ -115,7 +115,7 @@ module.exports = app => {
 
                     if (t.ledger_status === auditConst.ledger.status.checked) {
                         t.lastStage = await ctx.service.stage.getLastestStage(t.id);
-                        if (t.lastStage) await ctx.service.stage.checkStageGatherData(t.lastStage, true);
+                        if (t.lastStage) await ctx.service.stage.checkStageGatherDataByDataCollect(t.lastStage, true);
                         t.completeStage = await ctx.service.stage.getLastestCompleteStage(t.id);
                         if ((!bCalcTp) && t.measure_type === measureType.gcl.value) {
                             bCalcTp = t.lastStage && t.lastStage.status !== auditConst.stage.status.checked && !t.lastStage.readOnly;

+ 4 - 3
app/controller/ledger_controller.js

@@ -163,9 +163,10 @@ module.exports = app => {
                         columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                     });
                     renderData.accountList = accountList;
-                    renderData.accountGroup = accountGroup.map((item, idx) => {
-                        const groupList = accountList.filter(item => item.account_group === idx);
-                        return { groupName: item, groupList };
+                    const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                    renderData.accountGroup = unitList.map(item => {
+                        const groupList = accountList.filter(item1 => item1.company === item.name);
+                        return { groupName: item.name, groupList };
                     });
                     renderData.auditorList = await ctx.service.ledgerAudit.getAuditors(tender.id, tender.data.ledger_times);
                 }

+ 4 - 3
app/controller/material_controller.js

@@ -244,9 +244,10 @@ module.exports = app => {
                     columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                 });
                 data.accountList = accountList;
-                data.accountGroup = accountGroup.map((item, idx) => {
-                    const groupList = accountList.filter(item => item.account_group === idx);
-                    return { groupName: item, groupList };
+                const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                data.accountGroup = unitList.map(item => {
+                    const groupList = accountList.filter(item1 => item1.company === item.name);
+                    return { groupName: item.name, groupList };
                 });
             }
             data.tenderMenu.back.children[0].url = '/tender/' + ctx.tender.id + '/measure/material';

+ 39 - 14
app/controller/payment_controller.js

@@ -49,10 +49,15 @@ module.exports = app => {
                         where: { project_id: ctx.session.sessionProject.id, enable: 1 },
                         columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                     });
-                    const accountGroupList = accountGroup.map((item, idx) => {
-                        const groupList = accountList.filter(item => item.account_group === idx);
-                        return { groupName: item, groupList };
+                    const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: projectId } });
+                    const accountGroupList = unitList.map(item => {
+                        const groupList = accountList.filter(item1 => item1.company === item.name);
+                        return { groupName: item.name, groupList };
                     });
+                    // const accountGroupList = accountGroup.map((item, idx) => {
+                    //     const groupList = accountList.filter(item => item.account_group === idx);
+                    //     return { groupName: item, groupList };
+                    // });
                     renderData.permissionAudits = permissionAudits;
                     renderData.accountList = accountList;
                     renderData.accountGroup = accountGroupList;
@@ -192,9 +197,9 @@ module.exports = app => {
                             await ctx.service.paymentTender.update(updateData, conditionData);
                         } else {
                             const folderInfo = await ctx.service.paymentFolder.getDataById(conditionData.id);
-                            if (!folderInfo) throw '目录不存在';
+                            if (!folderInfo) throw '文件夹不存在';
                             if (folderInfo.uid !== ctx.session.sessionUser.accountId && !ctx.session.sessionUser.is_admin) {
-                                throw '您没有权限重命名此目录';
+                                throw '您没有权限重命名此文件夹';
                             }
                             await ctx.service.paymentFolder.update(updateData, conditionData);
                         }
@@ -384,12 +389,27 @@ module.exports = app => {
                 const rptAudit = await ctx.service.paymentRptAudit.getDataByCondition({ td_id: ctx.detail.id, uid: ctx.session.sessionUser.accountId });
                 if (report_json.items[0].interact_cells.length > 0) {
                     for (const [i, cell] of report_json.items[0].interact_cells.entries()) {
+                        cell.index = i;
+                    }
+                    const numberList = ctx.helper._.filter(report_json.items[0].interact_cells, { DataType: 'intact_type_number' });
+                    for (const [i, cell] of report_json.items[0].interact_cells.entries()) {
+                        if (cell.Label.indexOf('大写') !== -1 && cell.link === undefined) {
+                            if (numberList.length > 0) {
+                                const numberInfo = ctx.helper._.find(ctx.helper._.orderBy(numberList, ['index'], ['desc']), function(item) {
+                                    return item.index < i;
+                                });
+                                cell.link = numberInfo ? numberInfo.index : '';
+                            } else {
+                                cell.link = '';
+                            }
+                        }
                         const push_item = {
                             type: paymentConst.rpt_dataType[cell.DataType],
                             value: cell.Prefix ? ctx.helper._.replace(cell.Value, cell.Prefix, '') : cell.Value,
                             label: cell.Label,
                             index: i,
                         };
+                        if (cell.link !== undefined) push_item.link = cell.link;
                         const thisBandName = paymentConst.rpt_band_name[cell.BandName] ? cell.BandName : 'content';
                         const oneShowContent = ctx.helper._.find(content, { BandName: thisBandName });
                         if (oneShowContent) {
@@ -402,6 +422,7 @@ module.exports = app => {
                             });
                         }
                     }
+                    renderData.numberList = numberList;
                     if (rptAudit && ((ctx.detail.status !== auditConst.status.checkNo && ctx.detail.status !== auditConst.status.checked) ||
                         (ctx.detail.status === auditConst.status.checked && !renderData.nextDetail) ||
                         (ctx.detail.status === auditConst.status.checkNo && ctx.detail.uid === ctx.session.sessionUser.accountId))) {
@@ -434,10 +455,12 @@ module.exports = app => {
                         columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                     });
                     renderData.accountList = accountList;
-                    renderData.accountGroup = accountGroup.map((item, idx) => {
-                        const groupList = accountList.filter(item => item.account_group === idx);
-                        return { groupName: item, groupList };
+                    const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                    const accountGroupList = unitList.map(item => {
+                        const groupList = accountList.filter(item1 => item1.company === item.name);
+                        return { groupName: item.name, groupList };
                     });
+                    renderData.accountGroup = accountGroupList;
                 }
                 await this.layout('payment/detail.ejs', renderData, 'payment/detail_modal.ejs');
             } catch (err) {
@@ -641,9 +664,10 @@ module.exports = app => {
                     where: { project_id: ctx.session.sessionProject.id, enable: 1 },
                     columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                 });
-                const accountGroupList = accountGroup.map((item, idx) => {
-                    const groupList = accountList.filter(item => item.account_group === idx);
-                    return { groupName: item, groupList };
+                const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                const accountGroupList = unitList.map(item => {
+                    const groupList = accountList.filter(item1 => item1.company === item.name);
+                    return { groupName: item.name, groupList };
                 });
                 const renderData = {
                     tender: ctx.tender,
@@ -823,9 +847,10 @@ module.exports = app => {
                             where: { project_id: ctx.session.sessionProject.id, enable: 1 },
                             columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                         });
-                        const accountGroupList = accountGroup.map((item, idx) => {
-                            const groupList = accountList.filter(item => item.account_group === idx);
-                            return { groupName: item, groupList };
+                        const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                        const accountGroupList = unitList.map(item => {
+                            const groupList = accountList.filter(item1 => item1.company === item.name);
+                            return { groupName: item.name, groupList };
                         });
                         renderData.accountList = accountList;
                         renderData.accountGroup = accountGroupList;

+ 4 - 3
app/controller/revise_controller.js

@@ -355,9 +355,10 @@ module.exports = app => {
                 where: { project_id: ctx.session.sessionProject.id, enable: 1 },
                 columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
             });
-            renderData.accountGroup = accountGroup.map((item, idx) => {
-                const groupList = renderData.accountList.filter(item => item.account_group === idx);
-                return { groupName: item, groupList };
+            const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+            renderData.accountGroup = unitList.map(item => {
+                const groupList = renderData.accountList.filter(item1 => item1.company === item.name);
+                return { groupName: item.name, groupList };
             });
             renderData.auditorList = await ctx.service.reviseAudit.getAuditors(revise.id, revise.times);
             renderData.curAuditor = await ctx.service.reviseAudit.getCurAuditor(revise.id, revise.times);

+ 4 - 3
app/controller/stage_controller.js

@@ -72,9 +72,10 @@ module.exports = app => {
                     columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                 });
                 data.accountList = accountList;
-                data.accountGroup = accountGroup.map((item, idx) => {
-                    const groupList = accountList.filter(item => item.account_group === idx);
-                    return { groupName: item, groupList };
+                const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                data.accountGroup = unitList.map(item => {
+                    const groupList = accountList.filter(item1 => item1.company === item.name);
+                    return { groupName: item.name, groupList };
                 });
             }
             data.tenderMenu.back.children[0].url = '/tender/' + ctx.tender.id + '/measure/stage';

+ 5 - 4
app/controller/sub_proj_controller.js

@@ -32,9 +32,10 @@ module.exports = app => {
                     columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                 });
                 renderData.accountList = accountList;
-                renderData.accountGroup = accountGroup.map((item, idx) => {
-                    const groupList = accountList.filter(item => item.account_group === idx);
-                    return { groupName: item, groupList };
+                const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                renderData.accountGroup = unitList.map(item => {
+                    const groupList = accountList.filter(item1 => item1.company === item.name);
+                    return { groupName: item.name, groupList };
                 });
                 renderData.permissionConst = ctx.service.subProjPermission.PermissionConst;
                 renderData.categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);
@@ -177,4 +178,4 @@ module.exports = app => {
     }
 
     return SubProjController;
-};
+};

+ 8 - 6
app/controller/tender_controller.js

@@ -692,9 +692,10 @@ module.exports = app => {
                         where: { project_id: ctx.session.sessionProject.id, enable: 1 },
                         columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                     });
-                    const accountGroupList = accountGroup.map((item, idx) => {
-                        const groupList = accountList.filter(item => item.account_group === idx);
-                        return { groupName: item, groupList };
+                    const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+                    const accountGroupList = unitList.map(item => {
+                        const groupList = accountList.filter(item1 => item1.company === item.name);
+                        return { groupName: item.name, groupList };
                     });
                     renderData.accountList = accountList;
                     renderData.accountGroup = accountGroupList;
@@ -1027,9 +1028,10 @@ module.exports = app => {
                 where: { project_id: ctx.session.sessionProject.id, enable: 1 },
                 columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
             });
-            const accountGroupList = accountGroup.map((item, idx) => {
-                const groupList = accountList.filter(item => item.account_group === idx);
-                return { groupName: item, groupList };
+            const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
+            const accountGroupList = unitList.map(item => {
+                const groupList = accountList.filter(item1 => item1.company === item.name);
+                return { groupName: item.name, groupList };
             });
             // 获取固定审批流 or 固定终审
             for (const sp of shenpiConst.sp_lc) {

+ 5 - 0
app/extend/helper.js

@@ -1009,6 +1009,11 @@ module.exports = {
         return moment(time).format(style);
     },
 
+    dateTranChinese(day) {
+        const dateParts = day.split('-');
+        return dateParts[0] + '年' + dateParts[1] + '月' + dateParts[2] + '日';
+    },
+
     // 审批日期格式:2020-5-7 9:40:30
     formatFullDate(time) {
         return moment(time).format('YYYY-MM-DD HH:mm:ss');

+ 1 - 1
app/middleware/payment_detail_check.js

@@ -99,7 +99,7 @@ module.exports = options => {
                         yield this.service.paymentDetailAudit.updateLastAudit(detail, auditList, shenpiInfo.audit_id);
                     } else if (!shenpiInfo) {
                         // 不存在终审人的状态下这里恢复为授权审批人
-                        this.detail.sp_status = shenpiConst.sp_status.sqspr;
+                        this.trInfo.sp_status = shenpiConst.sp_status.sqspr;
                     }
                 }
             }

+ 13 - 10
app/public/js/change_information_set.js

@@ -1447,19 +1447,22 @@ $(document).ready(() => {
             if (!gcl) gcl = gclGatherData[$(this).data('gcl')];
             if (!gcl || !gcl.cid) continue;
 
-            let data_bwmx = $(tr).attr('data-bwmx').split(recSpr);
-            data_bwmx = data_bwmx.filter(x => {
-                const rec = x.split(qtySpr);
-                const info = rec[0].split(infoSpr);
-                if (info.length < 8) return true;
+            let data_bwmx = [];
+            if ($(tr).attr('data-bwmx') !== '') {
+                data_bwmx = $(tr).attr('data-bwmx').split(recSpr);
+                data_bwmx = data_bwmx.filter(x => {
+                    const rec = x.split(qtySpr);
+                    const info = rec[0].split(infoSpr);
+                    if (info.length < 8) return true;
 
-                const leaf = gcl.leafXmjs.find(lx => { return lx.mx_id === info[6]});
-                return !leaf || !leaf.cid;
-            });
+                    const leaf = gcl.leafXmjs.find(lx => { return lx.mx_id === info[6]});
+                    return !leaf || !leaf.cid;
+                });
+            }
             for (const [index, leaf] of gcl.leafXmjs.entries()) {
                 if (!leaf.cid) continue;
 
-                const bwmx = [leaf.code, leaf.jldy || '', leaf.dwgc || '', leaf.fbgc || '', leaf.fxgc || '', leaf.gcl_id, leaf.mx_id, leaf.bwmx || ''];
+                const bwmx = [leaf.code, leaf.jldy || '', leaf.dwgc || '', leaf.fbgc || '', leaf.fxgc || '', leaf.gcl_id, leaf.mx_id, leaf.jldy || ''];
                 const de_qu = bwmx.join(infoSpr) + qtySpr + (leaf.quantity || 0);
                 data_bwmx.push(de_qu);
             }
@@ -1911,7 +1914,7 @@ function remakeChangeSpread(cOrder = changeOrder) {
                 mx_id,
             };
             const radionInfo = changeList.find(function (info) {
-                // return info.code === code && (info.lid == lid || parseInt(info.lid) === parseInt(lindex)) && gcl_id == info.gcl_id && (info.bwmx === bwmx || (info.bwmx === xmj_jldy && info.mx_id && info.mx_id === mx_id)) && parseInt(info.oamount) === parseInt(oamount);
+                //return info.code === code && (info.lid == lid || parseInt(info.lid) === parseInt(lindex)) && gcl_id == info.gcl_id && (info.bwmx === bwmx || (info.bwmx === xmj_jldy && info.mx_id && info.mx_id === mx_id)) && parseInt(info.oamount) === parseInt(oamount);
                 return (info.lid == lid || parseInt(info.lid) === parseInt(lindex)) && gcl_id == info.gcl_id && (info.bwmx === bwmx || (info.bwmx === xmj_jldy && info.mx_id && info.mx_id === mx_id));
             });
             if (radionInfo) {

+ 4 - 3
app/public/js/file_detail.js

@@ -490,10 +490,10 @@ $(document).ready(function() {
             toastr.error('批量下载失败');
         });
     });
-    $('#batch-del-file').on('show.bs.modal', function(e) {
+    $('#batch-del-file-btn').click(() => {
         const checkes = $('[name=bd-check]:checked');
         if (checkes.length === 0) {
-            e.preventDefault();
+            return;
         } else {
             for (const c of checkes) {
                 const fid = c.getAttribute('fid');
@@ -502,10 +502,11 @@ $(document).ready(function() {
 
                 if (file.user_id !== userID) {
                     toastr.error(`文件【${file.filename + file.fileext}】不是您上传的文件,请勿删除`);
-                    e.preventDefault();
+                    return;
                 }
             }
         }
+        $('#batch-del-file').modal('show');
     });
     $('#batch-del-file-ok').click(function() {
         const del = [];

+ 111 - 3
app/public/js/payment_detail.js

@@ -28,7 +28,7 @@ $(function () {
     //初始化所有附件列表
     getAllList();
 
-    $('#rpt-form input').on('change', function () {
+    $('#rpt-form input[type!="radio"]').on('change', function () {
        let newVal = $(this).val();
        const index = parseInt($(this).data('index'));
        const type = $(this).attr('type');
@@ -44,10 +44,65 @@ $(function () {
                newVal = ZhCalc.round(val, 6);
                $(this).val(newVal);
            }
+           // find link(大写转换)
+           const linkList = _.filter(tesRpttData.items[0].interact_cells, { link: index });
+           if (linkList.length > 0) {
+               const chineseNum = numberToChinese(newVal);
+               // 赋值到input框并展示在报表里
+               for (const cell of linkList) {
+                   $('#rpt-form input[data-index="'+ cell.index +'"]').val(chineseNum);
+                   tesRpttData.items[0].interact_cells[cell.index].Value =
+                       tesRpttData.items[0].interact_cells[cell.index].Prefix ? tesRpttData.items[0].interact_cells[cell.index].Prefix + chineseNum : chineseNum;
+               }
+           }
        }
+
        checkAndUpdate(index, newVal, $(this));
     });
 
+    $(".link-dropdown").on("click",function (e) {
+        e.stopPropagation();
+    });
+
+    $('.change-link').on('click', function () {
+        const link = $(this).parents('.link-dropdown').find('input:checked').val();
+        const index = parseInt($(this).attr('item-index'));
+        const old_link = $(this).attr('old-link');
+        if (old_link !== link) {
+            let showTips = '';
+            if (link !== '') {
+                const numberInfo = _.find(tesRpttData.items[0].interact_cells, { index: parseInt(link) });
+                if (numberInfo) showTips = '关联数据:' + numberInfo.Label;
+            }
+            $(this).parents('.link-dropdown').siblings('.show-link').html(showTips);
+            $(this).attr('old-link', link);
+            const info = link !== '' ? tesRpttData.items[0].interact_cells[link] : null;
+            const linkValue = info ? removePreFix((info.Prefix ? info.Prefix : null), info.Value) : '';
+            const chineseNum = linkValue ? numberToChinese(linkValue) : '';
+            tesRpttData.items[0].interact_cells[index].link = link !== '' ? parseInt(link) : '';
+            tesRpttData.items[0].interact_cells[index].Value = tesRpttData.items[0].interact_cells[index].Prefix ? tesRpttData.items[0].interact_cells[index].Prefix + chineseNum : chineseNum;
+            const _self = $(this);
+            postData('/payment/' + tenderId + '/detail/' + detailId + '/save', { type: 'update_rpt', report_json: tesRpttData }, function (result) {
+                $('#rpt-form input[data-index="'+ index +'"]').val(chineseNum);
+                auditRptPrintHelper.showPage();
+                _self.parents('.show-link-dropdown').dropdown('toggle');
+            });
+        } else {
+            $(this).parents('.show-link-dropdown').dropdown('toggle');
+        }
+    });
+
+    function removePreFix(prefix, value) {
+       const result = prefix ? _.replace(value, prefix, '') : value;
+       return result ? parseFloat(result) : '';
+    }
+
+    $('.show-link-dropdown').on('show.bs.dropdown', function () {
+        const link = $(this).find('button').attr('old-link');
+        const index = $(this).find('button').attr('item-index');
+        $('input:radio[name="radio_'+ index +'"][value="'+ link + '"]').prop('checked', true);
+    });
+
     $('#rpt-form textarea').on('change', function () {
         const newVal = $(this).val();
         const index = parseInt($(this).data('index'));
@@ -119,7 +174,7 @@ $(function () {
             tesRpttData.items[0].signature_cells[rptAudit.signature_index].path = signArray.length > 0 ? signArray.join('!;!') : null;
             const date_index = _.findIndex(tesRpttData.items[0].signature_date_cells, { signature_name: rptAudit.signature_name + '_签字日期' });
             if (date_index !== -1) {
-                tesRpttData.items[0].signature_date_cells[date_index].Value = rptAudit.signature_msg.date ? rptAudit.signature_msg.date : '';
+                tesRpttData.items[0].signature_date_cells[date_index].Value = rptAudit.signature_msg.date ? dateTranChinese(rptAudit.signature_msg.date) : '';
             }
             const content_index = _.findIndex(tesRpttData.items[0].signature_audit_cells, { signature_name: rptAudit.signature_name + '_审核意见' });
             if (content_index !== -1) {
@@ -143,7 +198,6 @@ $(function () {
         if (tesRpttData.items[0].interact_cells[index].DataType === 'intact_type_number' && _.indexOf(tesRpttData.items[0].interact_cells[index].Value, '元') !== -1) {
             newVal = newVal + '元';
         }
-        console.log(index, newVal);
         clearTimeout(timer);
         timer = setTimeout(() => {
             tesRpttData.items[0].interact_cells[index].Value = tesRpttData.items[0].interact_cells[index].Prefix ? tesRpttData.items[0].interact_cells[index].Prefix + newVal : newVal;
@@ -355,3 +409,57 @@ function bytesToSize(bytes) {
     // return (bytes / Math.pow(k, i)) + ' ' + sizes[i];
     return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
 }
+// 大写转换
+// 向右移位
+function shiftRight(number, digit) {
+    digit = parseInt(digit, 10);
+    var value = number.toString().split('e');
+    return +(value[0] + 'e' + (value[1] ? +value[1] + digit : digit));
+}
+// 向左移位
+function shiftLeft(number, digit) {
+    digit = parseInt(digit, 10);
+    var value = number.toString().split('e');
+    return +(value[0] + 'e' + (value[1] ? +value[1] - digit : -digit));
+}
+
+var numberToChinese = function (n) {
+    var fraction = ['角', '分'];
+    var digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
+    var unit = [
+        ['元', '万', '亿'],
+        ['', '拾', '佰', '仟'],
+    ];
+    var head = n < 0 ? '负' : '';
+    n = Math.abs(n);
+    var s = '';
+    for (var i = 0; i < fraction.length; i++) {
+        s += (digit[Math.floor(shiftRight(n, 1 + i)) % 10] + fraction[i]).replace(
+            /零./,
+            ''
+        );
+    }
+    s = s || '';
+    n = Math.floor(n);
+    for (var i = 0; i < unit[0].length && n > 0; i++) {
+        var p = '';
+        for (var j = 0; j < unit[1].length && n > 0; j++) {
+            p = digit[n % 10] + unit[1][j] + p;
+            n = Math.floor(shiftLeft(n, 1));
+        }
+        s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
+    }
+    return (
+        head +
+        s
+            .replace(/(零.)*零元/, '元')
+            .replace(/(零.)+/g, '零')
+            // .replace(/^整$/, '零元整')
+    );
+};
+
+function dateTranChinese(day) {
+    const dateParts = day.split('-');
+    return dateParts[0] + '年' + dateParts[1] + '月' + dateParts[2] + '日';
+}
+

+ 12 - 12
app/public/js/payment_index.js

@@ -2,7 +2,7 @@ $(function () {
     autoFlashHeight();
     const EmptyTenderHtml = [
         '<div class="jumbotron">',
-        '<h3 class="display-6">还没有标段及目录数据</h3>',
+        '<h3 class="display-6">还没有标段及文件夹数据</h3>',
         '</div>'
     ];
 
@@ -88,7 +88,7 @@ $(function () {
                 html.push('<div class="dropdown-divider"></div>\n');
             }
             if (auditPermission.admin && node.parent_id !== undefined && !node.is_tender) {
-                html.push('<a class="dropdown-item show_new_folder_btn" href="#add-folder" data-toggle="modal" data-target="#add-folder" data-parentName="'+ node.name +'" data-parentId="'+ node.id +'"><i class="fa fa-folder-o mr-2"></i>新建子目录</a>\n');
+                html.push('<a class="dropdown-item show_new_folder_btn" href="#add-folder" data-toggle="modal" data-target="#add-folder" data-parentName="'+ node.name +'" data-parentId="'+ node.id +'"><i class="fa fa-folder-o mr-2"></i>新建子文件夹</a>\n');
             }
             if (auditPermission.admin && node.is_leaf) {
                 html.push('<a class="dropdown-item show_new_tender_btn" href="javascript:void(0);"><i class="fa fa-folder-o mr-2"></i>新建标段</a>\n');
@@ -147,14 +147,14 @@ $(function () {
         if (parseInt($(this).attr('data-parentId')) === 0) {
             $('#parent_folder').hide();
             $('#parent_folder_name').val('');
-            $('#add-folder').find('.modal-title').text('新建目录');
-            $('#new_folder_name').siblings('label').text('目录名称');
+            $('#add-folder').find('.modal-title').text('新建文件夹');
+            $('#new_folder_name').siblings('label').text('文件夹名称');
             $('#parent_id').val(0);
         } else {
             $('#parent_folder').show();
             $('#parent_folder_name').val($(this).attr('data-parentName'));
-            $('#add-folder').find('.modal-title').text('新建子目录');
-            $('#new_folder_name').siblings('label').text('子目录名称');
+            $('#add-folder').find('.modal-title').text('新建子文件夹');
+            $('#new_folder_name').siblings('label').text('子文件夹名称');
             $('#parent_id').val($(this).attr('data-parentId'));
         }
     });
@@ -194,11 +194,11 @@ $(function () {
         const id = parseInt($(this).attr('data-id'));
         const info = type === 'tender' ? _.find(allTenders, { id }) : _.find(allFolders, { id });
         if (!info) {
-            toastr.error('目录或标段不存在');
+            toastr.error('文件夹或标段不存在');
             return;
         }
         $('#edit_name_input').val(info.name);
-        $('#edit-name').find('.modal-title').text(type === 'tender' ? '修改标段' : '修改目录');
+        $('#edit-name').find('.modal-title').text(type === 'tender' ? '修改标段' : '修改文件夹');
         $('#edit_name_id').val(info.id);
         $('#edit_name_type').val(type);
         $('#edit-name').modal('show');
@@ -242,12 +242,12 @@ $(function () {
     $('body').on('click', '.show_new_tender_btn', function () {
         const fid = $('.c-body table').find('.table-warning').attr('fid');
         if (!fid) {
-            toastr.error('请选中目录');
+            toastr.error('请选中文件夹');
             return;
         }
         const folderInfo = _.find(allFolders, { id: parseInt(fid) });
         if (!folderInfo || folderInfo.is_leaf === 0) {
-            toastr.error('目录不存在或存在子目录不能新建标段');
+            toastr.error('文件夹不存在或存在子文件夹不能新建标段');
             return;
         }
         $('#add-tender').modal('show');
@@ -271,11 +271,11 @@ $(function () {
         const id = parseInt($(this).attr('data-id'));
         const info = type === 'tender' ? _.find(allTenders, { id }) : _.find(allFolders, { id });
         if (!info) {
-            toastr.error('目录或标段不存在');
+            toastr.error('文件夹或标段不存在');
             return;
         }
         $('#edit_name_input').val(info.name);
-        $('#del-project').find('.modal-title').text(type === 'tender' ? '删除标段' : '删除目录');
+        $('#del-project').find('.modal-title').text(type === 'tender' ? '删除标段' : '删除文件夹');
         $('#del-project').find('h6 span').text(info.name);
         $('#del_id').val(info.id);
         $('#del_type').val(type);

+ 67 - 67
app/public/js/stage.js

@@ -3900,39 +3900,39 @@ $(document).ready(() => {
                             return !changeBills;
                         }
                     },
-                    'autoUse': {
-                        name: '调用',
-                        icon: 'fa-play',
-                        callback: function (key, opt) {
-                            const curChange = SpreadJsObj.getSelectObject(self.changeSheet);
-                            const changeBills = SpreadJsObj.getSelectObject(self.changeBillsSheet);
-                            const billsPos = self.findBillsPos(curChange, changeBills);
-                            if (!billsPos) toastr.warning('无可调用的清单或计量单元');
-
-                            const data = { autoType: 'bills', bills: [{ ...billsPos, cid: changeBills.cid, cbid: changeBills.cbid }] };
-                            postData(window.location.pathname + '/auto-change', data, function(result) {
-                                if (result.pos) {
-                                    stagePos.loadCurStageData(result.pos.curStageData);
-                                }
-                                const nodes = stageTree.loadPostStageData(result.bills);
-                                stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
-                                stagePosSpreadObj.loadCurPosData();
-                                if (detail) {
-                                    detail.loadStageChangeUpdateData(result, nodes);
-                                } else {
-                                    stageIm.loadUpdateChangeData(result, nodes)
-                                }
-                            });
-                        },
-                        disable: function (key, opt) {
-                            const curChange = SpreadJsObj.getSelectObject(self.changeSheet);
-                            const changeBills = SpreadJsObj.getSelectObject(self.changeBillsSheet);
-                            return !changeBills || curChange.is_import;
-                        },
-                        visible: function (key, opt) {
-                            return is_debug && stage.status === 1;
-                        }
-                    },
+                    // 'autoUse': {
+                    //     name: '调用',
+                    //     icon: 'fa-play',
+                    //     callback: function (key, opt) {
+                    //         const curChange = SpreadJsObj.getSelectObject(self.changeSheet);
+                    //         const changeBills = SpreadJsObj.getSelectObject(self.changeBillsSheet);
+                    //         const billsPos = self.findBillsPos(curChange, changeBills);
+                    //         if (!billsPos) toastr.warning('无可调用的清单或计量单元');
+                    //
+                    //         const data = { autoType: 'bills', bills: [{ ...billsPos, cid: changeBills.cid, cbid: changeBills.cbid }] };
+                    //         postData(window.location.pathname + '/auto-change', data, function(result) {
+                    //             if (result.pos) {
+                    //                 stagePos.loadCurStageData(result.pos.curStageData);
+                    //             }
+                    //             const nodes = stageTree.loadPostStageData(result.bills);
+                    //             stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
+                    //             stagePosSpreadObj.loadCurPosData();
+                    //             if (detail) {
+                    //                 detail.loadStageChangeUpdateData(result, nodes);
+                    //             } else {
+                    //                 stageIm.loadUpdateChangeData(result, nodes)
+                    //             }
+                    //         });
+                    //     },
+                    //     disable: function (key, opt) {
+                    //         const curChange = SpreadJsObj.getSelectObject(self.changeSheet);
+                    //         const changeBills = SpreadJsObj.getSelectObject(self.changeBillsSheet);
+                    //         return !changeBills || curChange.is_import;
+                    //     },
+                    //     visible: function (key, opt) {
+                    //         return is_debug && stage.status === 1;
+                    //     }
+                    // },
                 }
             });
 
@@ -3943,40 +3943,40 @@ $(document).ready(() => {
                     return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
                 },
                 items: {
-                    'autoUseCur': {
-                        name: '自动调用',
-                        icon: 'fa-play',
-                        callback: function (key, opt) {
-                            const curChange = SpreadJsObj.getSelectObject(self.changeSheet);
-                            const changeBills = SpreadJsObj.zh_data;
-                            const data = { bills: [], autoType: 'bills' };
-                            for (const cb of changeBills) {
-                                const billsPos = self.findBillsPos(curChange, cb);
-                                if (billsPos) data.push({ ...billsPos, cid: curChange.cid, cbid: cb.cbid })
-                            }
-                            postData(window.location.pathname + '/auto-use-change', data, function(result) {
-                                if (result.pos) {
-                                    stagePos.loadCurStageData(result.pos.curStageData);
-                                }
-                                const nodes = stageTree.loadPostStageData(result.bills);
-                                stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
-                                stagePosSpreadObj.loadCurPosData();
-                                if (detail) {
-                                    detail.loadStageChangeUpdateData(result, nodes);
-                                } else {
-                                    stageIm.loadUpdateChangeData(result, nodes)
-                                }
-                            });
-                        },
-                        disable: function (key, opt) {
-                            const curChange = SpreadJsObj.getSelectObject(self.changeSheet);
-                            const changeBills = SpreadJsObj.getSelectObject(self.changeBillsSheet);
-                            return !changeBills || curChange.is_import;
-                        },
-                        visible: function (key, opt) {
-                            return is_debug && stage.status === 1;
-                        }
-                    },
+                    // 'autoUseCur': {
+                    //     name: '自动调用',
+                    //     icon: 'fa-play',
+                    //     callback: function (key, opt) {
+                    //         const curChange = SpreadJsObj.getSelectObject(self.changeSheet);
+                    //         const changeBills = SpreadJsObj.zh_data;
+                    //         const data = { bills: [], autoType: 'bills' };
+                    //         for (const cb of changeBills) {
+                    //             const billsPos = self.findBillsPos(curChange, cb);
+                    //             if (billsPos) data.push({ ...billsPos, cid: curChange.cid, cbid: cb.cbid })
+                    //         }
+                    //         postData(window.location.pathname + '/auto-use-change', data, function(result) {
+                    //             if (result.pos) {
+                    //                 stagePos.loadCurStageData(result.pos.curStageData);
+                    //             }
+                    //             const nodes = stageTree.loadPostStageData(result.bills);
+                    //             stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
+                    //             stagePosSpreadObj.loadCurPosData();
+                    //             if (detail) {
+                    //                 detail.loadStageChangeUpdateData(result, nodes);
+                    //             } else {
+                    //                 stageIm.loadUpdateChangeData(result, nodes)
+                    //             }
+                    //         });
+                    //     },
+                    //     disable: function (key, opt) {
+                    //         const curChange = SpreadJsObj.getSelectObject(self.changeSheet);
+                    //         const changeBills = SpreadJsObj.getSelectObject(self.changeBillsSheet);
+                    //         return !changeBills || curChange.is_import;
+                    //     },
+                    //     visible: function (key, opt) {
+                    //         return is_debug && stage.status === 1;
+                    //     }
+                    // },
                     'autoUseAll': {
                         name: '自动调用(全部变更令)',
                         icon: 'fa-play',

+ 1 - 1
app/public/js/sub_project.js

@@ -325,7 +325,7 @@ $(document).ready(function() {
     const generateMemberHtml = function () {
         const html = [];
         for (const mem of newMembers) {
-            html.push('<tr>');
+            html.push(`<tr uid="${mem.uid}">`);
             html.push(`<td>${mem.name}</td>`);
             html.push(`<td>${mem.role}</td>`);
             // 动态投资

+ 1 - 1
app/service/material.js

@@ -76,7 +76,7 @@ module.exports = app => {
             if (this.ctx.session.sessionUser.accountId === this.ctx.material.user_id) {
                 this.ctx.material.curTimes = this.ctx.material.times;
             } else {
-                this.ctx.material.curTimes = this.ctx.material.status === status.checkNo ? this.ctx.material.times - 1 : this.ctx.material.times;
+                this.ctx.material.curTimes = this.ctx.material.status === auditConst.status.checkNo ? this.ctx.material.times - 1 : this.ctx.material.times;
             }
         }
 

+ 1 - 1
app/service/payment_detail.js

@@ -129,7 +129,7 @@ module.exports = app => {
             // 日期
             const dateCells = this._.find(report_json.items[0].signature_date_cells, { signature_name: signature_name + '_签字日期' });
             if (dateCells && sign_msg.date) {
-                dateCells.Value = sign_msg.date;
+                dateCells.Value = this.ctx.helper.dateTranChinese(sign_msg.date);
             }
             // 意见
             const contentCells = this._.find(report_json.items[0].signature_audit_cells, { signature_name: signature_name + '_审核意见' });

+ 4 - 4
app/service/payment_folder.js

@@ -21,13 +21,13 @@ module.exports = app => {
             try {
                 const tenderCount = await this.ctx.service.paymentTender.count({ folder_id: parentId });
                 if (tenderCount > 0) {
-                    throw '目录下存在标段无法创建子目录';
+                    throw '文件夹下存在标段无法创建子文件夹';
                 }
                 let level = 1;
                 let parent_path = '';
                 if (parentId !== 0) {
                     const parentFolderInfo = await this.getDataById(parentId);
-                    if (!parentFolderInfo) throw '父目录不存在';
+                    if (!parentFolderInfo) throw '父文件夹不存在';
                     level = parentFolderInfo.level + level;
                     if (parentFolderInfo.is_leaf) {
                         await transaction.update(this.tableName, { id: parentFolderInfo.id, is_leaf: 0 });
@@ -61,7 +61,7 @@ module.exports = app => {
             try {
                 const info = await this.getDataById(id);
                 if (info.uid !== this.ctx.session.sessionUser.accountId && !this.ctx.session.sessionUser.is_admin) {
-                    throw '您没有权限删除此目录';
+                    throw '您没有权限删除此文件夹';
                 }
                 let ids = [info.id];
                 if (info.parent_id === 0) {
@@ -86,7 +86,7 @@ module.exports = app => {
                 // 判断是否存在标段,有则无法删除目录
                 const tenderCount = await this.ctx.service.paymentTender.count({ folder_id: ids });
                 if (tenderCount > 0) {
-                    throw '目录下存在标段,无法删除';
+                    throw '文件夹下存在标段,无法删除';
                 }
                 await transaction.delete(this.tableName, { id: ids });
                 await transaction.commit();

+ 2 - 2
app/service/payment_tender.js

@@ -55,7 +55,7 @@ module.exports = app => {
             try {
                 const folderInfo = await this.ctx.service.paymentFolder.getDataById(folderId);
                 if (!folderInfo || folderInfo.is_leaf === 0) {
-                    throw '目录不存在或存在子目录不能新建标段';
+                    throw '文件夹不存在或存在子目录不能新建标段';
                 }
                 const insertData = {
                     pid: projectId,
@@ -104,7 +104,7 @@ module.exports = app => {
                 }
                 const folderInfo = await this.ctx.service.paymentFolder.getDataById(tenderInfo.folder_id);
                 if (!folderInfo) {
-                    throw '目录不存在';
+                    throw '文件夹不存在';
                 }
                 // 判断folderInfo下是否还存在tender,不存在则把had_tender为0,并判断父节点是否需要也为0
                 const leafTenderCount = await transaction.count(this.tableName, { folder_id: folderInfo.id });

+ 67 - 1
app/service/stage.js

@@ -763,10 +763,17 @@ module.exports = app => {
 
         async getStageByDataCollect(tenderId) {
             const stages = await this.db.select(this.tableName, {
-                columns: ['s_time', 'contract_tp', 'qc_tp', 'pc_tp', 'pre_contract_tp', 'pre_qc_tp'],
+                columns: ['id', 'times', 'status', 's_time', 'contract_tp', 'qc_tp', 'pc_tp', 'pre_contract_tp', 'pre_qc_tp', 'tp_history'],
                 where: { tid: tenderId },
                 orders: [['order', 'desc']],
             });
+            if (stages.length > 0 && stages[0].status === auditConst.status.uncheck) {
+                stages.splice(0, 1);
+            }
+            // 最新一期计量(未审批完成),取上一个人的期详细数据,应实时计算
+            const stage = stages[0];
+            if (stages.length === 0) return stages;
+            await this.checkStageGatherDataByDataCollect(stage);
             for (const s of stages) {
                 s.tp = this.ctx.helper.sum([s.contract_tp, s.qc_tp, s.pc_tp]);
                 s.pre_tp = this.ctx.helper.add(s.pre_contract_tp, s.pre_qc_tp);
@@ -775,6 +782,65 @@ module.exports = app => {
             return stages;
         }
 
+        async doCheckStageByDataCollect(stage) {
+            const status = auditConst.status;
+            await this.loadStageUser(stage);
+            if (stage.status === status.checkNo) {
+                stage.readOnly = false;
+                const checkNoAudit = await this.service.stageAudit.getDataByCondition({
+                    sid: stage.id, times: stage.times - 1, status: status.checkNo,
+                });
+                stage.curTimes = stage.times - 1;
+                stage.curOrder = checkNoAudit.order;
+            } else if (stage.status === status.checked) {
+                stage.readOnly = true;
+                stage.curTimes = stage.times;
+                stage.curOrder = _.max(_.map(stage.auditors, 'order'));
+            } else {
+                stage.readOnly = false;
+                stage.curTimes = stage.times;
+                stage.curOrder = stage.curAuditor.order - 1;
+            }
+            return stage;
+        }
+
+        async checkStageGatherDataByDataCollect(stage) {
+            // 最新一期计量(未审批完成),当前操作人的期详细数据,应实时计算
+            if (stage.status !== auditConst.status.checked) {
+                await this.doCheckStageByDataCollect(stage);
+                if (!stage.readOnly && stage.check_calc) {
+                    const tpData = await this.ctx.service.stageBills.getSumTotalPrice(stage);
+                    const pcSum = await this.ctx.service.stageBillsPc.getSumTotalPrice(stage);
+                    stage.contract_tp = tpData.contract_tp;
+                    stage.qc_tp = tpData.qc_tp;
+                    stage.positive_qc_tp = tpData.positive_qc_tp;
+                    stage.negative_qc_tp = tpData.negative_qc_tp;
+                    stage.contract_pc_tp = pcSum.contract_pc_tp;
+                    stage.qc_pc_tp = pcSum.qc_pc_tp;
+                    stage.pc_tp = pcSum.pc_tp;
+                    stage.positive_qc_pc_tp = pcSum.positive_qc_pc_tp;
+                    stage.negative_qc_pc_tp = pcSum.negative_qc_pc_tp;
+                    stage.tp = this.ctx.helper.sum([stage.contract_tp, stage.qc_tp, stage.pc_tp]);
+                    const tp = await this.ctx.service.stagePay.getSpecialTotalPrice(stage);
+                    stage.yf_tp = tp.yf;
+                    stage.sf_tp = tp.sf;
+                    stage.end_tp = this.ctx.helper.add(stage.pre_tp, stage.tp);
+                } else if (stage.tp_history) {
+                    const his = this.ctx.helper._.find(stage.tp_history, { times: stage.curTimes, order: stage.curOrder });
+                    if (his) {
+                        stage.contract_tp = his.contract_tp;
+                        stage.qc_tp = his.qc_tp;
+                        stage.positive_qc_tp = his.positive_qc_tp;
+                        stage.negative_qc_tp = his.negative_qc_tp;
+                        stage.yf_tp = his.yf_tp;
+                        stage.sf_tp = his.sf_tp;
+                        stage.tp = this.ctx.helper.sum([stage.contract_tp, stage.qc_tp, stage.pc_tp]);
+                        stage.end_tp = this.ctx.helper.add(stage.pre_tp, stage.tp);
+                    }
+                }
+            }
+        }
+
         async isLastStage(tid, sid) {
             const lastStage = await this.ctx.service.stage.getLastestStage(tid, true);
             return lastStage ? lastStage.id === sid : false;

+ 1 - 1
app/view/change/information_modal.ejs

@@ -157,7 +157,7 @@
                                 <div class="col-12" id="table-list">
                                     <div style="overflow-y:auto" class="sjs-biangeng-height">
                                         <table class="table table-striped table-bordered table-hover table-sm fixed_headers">
-                                            <thead><tr class="text-center"><th width="40">序号</th><th>清单编号</th><th>名称</th><th width="60">单位</th><th width="100">单价</th><th width="100">数量</th></tr></thead>
+                                            <thead><tr class="text-center"><th width="40">序号</th><th width="110">清单编号</th><th>名称</th><th width="60">单位</th><th width="100">单价</th><th width="120">数量</th></tr></thead>
                                             <tbody id="table-list-select">
                                             </tbody>
                                         </table>

+ 1 - 1
app/view/file/file.ejs

@@ -28,7 +28,7 @@
                         <% if (canUpload) { %>
                         <div class="py-2 pr-2"><a href="#add-file" data-toggle="modal" data-target="#add-file">上传文件</a></div>
                         <div class="p-2" id="rela-file-btn"><a href="#rela-file" data-toggle="modal" data-target="#rela-file">导入文件</a></div>
-                        <div class="p-2"><a href="#batch-del-file" data-toggle="modal" data-target="#batch-del-file">批量删除</a></div>
+                        <div class="p-2"><a href="javascript: void(0)" id="batch-del-file-btn">批量删除</a></div>
                         <% } %>
                         <div class="p-2"><a href="javascript: void(0)" id="batch-download">批量下载</a></div>
                         <div class="p-2">

+ 2 - 4
app/view/layout/layout.ejs

@@ -32,7 +32,7 @@
 </div>
 <div class="main">
     <% include ./menu.ejs %>
-    
+
     <div class="main-panel">
         <%- content %>
     </div>
@@ -79,9 +79,7 @@
     }
     const userID = <%- ctx.session.sessionUser.accountId %>;
     let user = '<%= ctx.session.sessionUser.name %>';
-    <% if (ctx.session.sessionUser.loginStatus) { %>
-    const is_debug = true;
-    <% } %>
+    const is_debug = <%- ctx.session.sessionUser.loginStatus ? true : false %>;
 </script>
 <style type="text/css">
 

+ 35 - 1
app/view/payment/detail.ejs

@@ -61,7 +61,41 @@
                                         <h5><%- c.title %>内容</h5>
                                         <% for (const item of c.items) { %>
                                         <div class="form-group">
-                                            <label><%- item.label %></label>
+                                            <label class="d-flex"><%- item.label %>
+                                                <% if (item.link !== undefined) { %>
+                                                    <div class="dropdown dropup mx-2 show-link-dropdown">
+                                                        <% if (ctx.detail.uid === ctx.session.sessionUser.accountId &&
+                                                                (ctx.detail.status === auditConst.status.uncheck || ctx.detail.status === auditConst.status.checkNo)) { %>
+                                                            <a href="javascript:void(0)" data-toggle="dropdown" title="关联数据" data-target="#link-data1"><i class="fa fa-paperclip"></i></a>
+                                                        <% } %>
+                                                        <span class="show-link"><% if (item.link !== '') { %>关联数据:<%= ctx.helper._.find(numberList, { index: item.link }) ? ctx.helper._.find(numberList, { index: item.link }).Label : '' %><% } %></span>
+                                                        <% if (ctx.detail.uid === ctx.session.sessionUser.accountId &&
+                                                                (ctx.detail.status === auditConst.status.uncheck || ctx.detail.status === auditConst.status.checkNo)) { %>
+                                                            <div class="link-dropdown dropdown-menu pb-1" aria-labelledby="dropdownMenuButton">
+                                                                <div class="px-3">
+                                                                    <% if (numberList.length > 0) { %>
+                                                                        <% for (const numberInfo of numberList) { %>
+                                                                            <div class="form-check py-1">
+                                                                                <input class="form form-check-input" type="radio" id="item_<%- item.index %>_number_<%- numberInfo.index %>"
+                                                                                       value="<%- numberInfo.index %>" name="radio_<%- item.index %>" <% if (item.link === numberInfo.index) { %>checked<% } %> />
+                                                                                <label class="form-check-label" for="item_<%- item.index %>_number_<%- numberInfo.index %>"><%- numberInfo.Label %></label>
+                                                                            </div>
+                                                                        <% } %>
+                                                                    <% } %>
+                                                                    <div class="form-check py-1">
+                                                                        <input class="form form-check-input" type="radio" id="item_<%- item.index %>_number_" value="" <% if (item.link === '') { %>checked<% } %> name="radio_<%- item.index %>" />
+                                                                        <label class="form-check-label" for="item_<%- item.index %>_number_">无</label>
+                                                                    </div>
+                                                                    <hr class="m-1">
+                                                                    <div class="float-right">
+                                                                        <button type="button" item-index="<%- item.index %>" old-link="<%- item.link %>" class="btn btn-sm btn-primary change-link">确定</button>
+                                                                    </div>
+                                                                </div>
+                                                            </div>
+                                                        <% } %>
+                                                    </div>
+                                                <% } %>
+                                            </label>
                                             <% if (item.type === 'textarea') { %>
                                                 <textarea <% if (ctx.detail.readOnly) { %>readonly<% } %> class="form-control form-control-sm" data-index="<%- item.index %>"><%- item.value %></textarea>
                                             <% } else { %>

+ 1 - 1
app/view/payment/index.ejs

@@ -5,7 +5,7 @@
             <div>
                 <% if (auditPermission.admin) { %>
                 <a href="javascript:void(0);" style="display: none" id="show_new_tender_btn" class="btn btn-sm btn-primary pull-right show_new_tender_btn">新建标段</a>
-                <a href="#add-folder" data-toggle="modal" data-target="#add-folder" data-parentId="0" class="btn btn-sm btn-primary pull-right mr-2 show_new_folder_btn">新建目录</a>
+                <a href="#add-folder" data-toggle="modal" data-target="#add-folder" data-parentId="0" class="btn btn-sm btn-primary pull-right mr-2 show_new_folder_btn">新建文件夹</a>
                 <% } %>
                 <% if (ctx.session.sessionUser.is_admin) { %>
                 <a href="#authority-list" data-toggle="modal" data-target="#authority-list" class="btn btn-sm btn-outline-secondary pull-right mr-2">权限管理</a>

+ 23 - 19
app/view/payment/modal.ejs

@@ -4,16 +4,16 @@
     <div class="modal-dialog" role="document">
         <div class="modal-content">
             <div class="modal-header">
-                <h5 class="modal-title">新建目录</h5>
+                <h5 class="modal-title">新建文件夹</h5>
             </div>
             <div class="modal-body">
                 <div class="form-group" id="parent_folder" style="display: none">
-                    <label for="parent_folder_name">父目录名称</label>
+                    <label for="parent_folder_name">父文件夹名称</label>
                     <input type="text" class="form-control form-control-sm" id="parent_folder_name" readonly>
                 </div>
                 <div class="form-group">
-                    <label for="new_folder_name">目录名称</label>
-                    <input type="text" class="form-control form-control-sm" id="new_folder_name" placeholder="请输入目录名称" required>
+                    <label for="new_folder_name">文件夹名称</label>
+                    <input type="text" class="form-control form-control-sm" id="new_folder_name" placeholder="请输入文件夹名称" required>
                     <div class="invalid-feedback">
                         <!--名称超过100个字,请缩减名称-->
                     </div>
@@ -31,7 +31,7 @@
     <div class="modal-dialog" role="document">
         <div class="modal-content">
             <div class="modal-header">
-                <h5 class="modal-title">修改目录</h5>
+                <h5 class="modal-title">修改文件夹</h5>
             </div>
             <div class="modal-body">
                 <form>
@@ -62,7 +62,7 @@
             </div>
             <div class="modal-body">
                 <div class="form-group">
-                    <label for="add_tender_folder_name">目录名称</label>
+                    <label for="add_tender_folder_name">文件夹名称</label>
                     <input type="text" class="form-control form-control-sm" id="add_tender_folder_name" readonly>
                 </div>
                 <div class="form-group">
@@ -108,9 +108,11 @@
             /*.bootstrap-table .fixed-table-container.fixed-height:not(.has-footer) {*/
                 /*border-bottom: 0;*/
             /*}*/
-            /*table {*/
-                /*table-layout: fixed;*/
-            /*}*/
+            @-moz-document url-prefix() {
+                table {
+                    table-layout: fixed;
+                }
+            }
         </style>
 <!-- 弹窗编辑项目 -->
 <div class="modal fade" id="authority-list" data-backdrop="static">
@@ -134,7 +136,7 @@
                                     <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
                                            data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
                                     <div class="dd-content" data-toggleid="<%- idx %>">
-                                        <dd class="border-bottom p-2 mb-0" data-groupid="<%- idx %>"><p class="mb-0 d-flex"><span class="text-primary">该单位下所有组员</span></p></dd>
+                                        <dd class="border-bottom p-2 mb-0" data-groupname="<%- group.groupName %>"><p class="mb-0 d-flex"><span class="text-primary">该单位下所有组员</span></p></dd>
                                         <% group.groupList.forEach(item => { %>
                                             <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
                                                 <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
@@ -207,7 +209,7 @@
 <% if (ctx.session.sessionUser.is_admin) { %>
     <script src="/public/js/bootstrap/bootstrap-table.min.js"></script>
     <script src="/public/js/bootstrap/locales/bootstrap-table-zh-CN.min.js"></script>
-    <script src="/public/js/bootstrap/bootstrap-table-fixed-columns.min.js"></script>
+    <!--<script src="/public/js/bootstrap/bootstrap-table-fixed-columns.min.js"></script>-->
 <script>
     $(function () {
         // $("#permission-audit-table").bootstrapTable('destroy').bootstrapTable({
@@ -243,7 +245,7 @@
                             html += `<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="${idx}" data-type="hide"><i class="fa fa-plus-square"></i>
                         </a> ${group.groupName}</dt>
                         <div class="dd-content" data-toggleid="${idx}">
-                        <dd class="border-bottom p-2 mb-0" data-groupid="${idx}"><p class="mb-0 d-flex"><span class="text-primary">该单位下所有组员</span></p></dd>`
+                        <dd class="border-bottom p-2 mb-0" data-groupname="${group.groupName}"><p class="mb-0 d-flex"><span class="text-primary">该单位下所有组员</span></p></dd>`
                             group.groupList.forEach(item => {
                                     html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
                                     <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
@@ -280,18 +282,19 @@
         // 添加到成员中
         $('dl').on('click', 'dd', function () {
             const id = parseInt($(this).data('id'));
-            const groupid = parseInt($(this).data('groupid'));
+            const groupName = $(this).data('groupname');
+            console.log(groupName);
             if (!isNaN(id) && id !== 0) {
                 postData('/payment/permission/save', { type: 'add-audit', id: id }, function (result) {
                     permissionAudits = result;
                     setList(permissionAudits);
                 })
-            } else if (!isNaN(groupid) && groupid !== 0) {
-                const groupAuditList = _.filter(accountList, { account_group: groupid });
+            } else if (groupName && groupName !== '') {
+                const groupAuditList = _.filter(accountList, { company: groupName });
                 const groupAidList = _.map(groupAuditList, 'id');
-                const groupPAList = _.map(_.filter(permissionAudits, { groupid }), 'id');
+                const groupPAList = _.map(permissionAudits, 'uid');
                 const addAidList = _.difference(groupAidList, groupPAList);
-                console.log(addAidList);
+                console.log(groupAidList, groupPAList, addAidList);
                 if (addAidList.length > 0) {
                     postData('/payment/permission/save', { type: 'add-audit', id: addAidList }, function (result) {
                         // toastr.success(`成功添加 位用户`);
@@ -324,9 +327,10 @@
         $('#authority-list').on('shown.bs.modal', function () {
             if (first) {
                 const option = {
-                    fixedColumns: true,
-                    fixedNumber: 1, //固定列数
+                    // fixedColumns: true,
+                    // fixedNumber: 1, //固定列数
                     locale: 'zh-CN',
+                    height: 300,
                 }
                 // if (permissionAudits.length === 0) {
                 //     option.formatName = function () {

+ 16 - 1
publish.md

@@ -10,12 +10,27 @@
 ##特殊操作
 如果没有特殊说明,则在第默认操作的第3步前,执行相关脚本,如果有特殊要求,需特别说明
 
+### V3.5.31.0607
+2023-4-5 ~ 2023-6-6(uat) ~ 2023-6-7(prod)
+1. 执行脚本
+#### uat
+```bash
+$ node sub_project uat
+```
+#### prod
+```bash
+$ node sub_project default
+```
+2. 执行sql
+见update.sql最后
+
+
 ### V3.5.30.0423 优化标段列表相关
 2023-03-31 ~ 2023-4-5(uat&prod)
 3.1 优化:
 #### uat
 ```bash
-$ EGG_SERVER_ENV=uat npm run test-sim /db_script/tender_cache.js
+$ EGG_SERVER_ENV=uat node db_script/tender_cache uat
 ```
 #### prod
 ```bash

Разница между файлами не показана из-за своего большого размера
+ 0 - 211
sql/update.sql


Разница между файлами не показана из-за своего большого размера
+ 213 - 0
sql/update20230607.sql