Tony Kang 3 settimane fa
parent
commit
fe1ddd97c8

+ 1 - 1
app/controller/report_controller.js

@@ -149,7 +149,7 @@ module.exports = app => {
         }
 
         async _getPrjAccList(ctx, pageShow) {
-            let prjAccList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject, ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile', 'company_id', 'account', 'telephone', 'permission', 'sign_path', 'stamp_path']);
+            let prjAccList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject, ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile', 'company_id', 'account', 'telephone', 'permission', 'sign_path', 'stamp_path', 'unit_sign_path']);
             // 根据需求,如果开启了‘开启个人「签字」’功能,则只能是本身用户签名,管理员例外
             if (!ctx.session.sessionUser.is_admin && pageShow.individualSign === 1) {
                 // 削减其他account

+ 51 - 14
app/public/report/js/rpt_signature.js

@@ -16,6 +16,10 @@ let rptSignatureHelper = {
     currentSelectedESignAccIdx: -1,
     currentSelectedESignAccName: null,
     currentSelectedESignParentDivId: '',
+    currentSelectedCompanySignDom: null,
+    currentSelectedCompanySignIdx: -1,
+    currentSelectedCompanySignName: null,
+    currentSelectedCompanySignParentDivId: '',
     originalRoleRelList: [],
     collapseExpandTreeNode: (dom, isDblClick = false) => {
         const classMap = {
@@ -190,7 +194,7 @@ let rptSignatureHelper = {
                         sign_date: dftDate,
                         sign_date_format: 'yyyy年M月d日',
                         sign_output: [NORMAL_SIGN_STR], // , PRIVATE_SIGN_STR, COMPANY_SIGN_STR
-                        company_stamp_path: rptSignatureHelper._getCompanySign(sf.company),
+                        company_stamp_path: rptSignatureHelper._getCompanySign(sf.company, null, userAcc),
                         status, // 记录一下吧,没坏处
                     }
                     newRoleRel.private_stamp_path = rptSignatureHelper._get_newPrivate_stamp_path(newRoleRel, userAcc); // 个人章从PRJ_ACCOUNT_LIST中获取
@@ -327,7 +331,7 @@ let rptSignatureHelper = {
                 roleRelObj.acc_id = userAcc.id;
                 roleRelObj.type = '用户';
                 roleRelObj.sign_output = [NORMAL_SIGN_STR]; // 默认是签字(还有:COMPANY_SIGN_STR:单位章, PRIVATE_SIGN_STR:个人章)
-                roleRelObj.company_stamp_path = rptSignatureHelper._getCompanySign(directAcc.company);
+                roleRelObj.company_stamp_path = rptSignatureHelper._getCompanySign(directAcc.company, null, userAcc);
                 roleRelObj.private_stamp_path = rptSignatureHelper._get_newPrivate_stamp_path(roleRelObj,userAcc);
                 roleRelObj.role = (userAcc.role === '')?DFT_ROLE_NAME:userAcc.role;
                 ROLE_REL_LIST.push(roleRelObj);
@@ -345,7 +349,7 @@ let rptSignatureHelper = {
                 roleRelObj.user_name = userAcc.name;
                 roleRelObj.acc_id = userAcc.id;
                 roleRelObj.sign_output = [NORMAL_SIGN_STR]; // 默认是签字(还有:COMPANY_SIGN_STR:单位章, PRIVATE_SIGN_STR:个人章)
-                roleRelObj.company_stamp_path = rptSignatureHelper._getCompanySign(userAcc.company);
+                roleRelObj.company_stamp_path = rptSignatureHelper._getCompanySign(userAcc.company, null, userAcc);
                 roleRelObj.private_stamp_path = rptSignatureHelper._get_newPrivate_stamp_path(roleRelObj,userAcc);
                 roleRelObj.type = '角色';
                 roleRelObj.role = (userAcc.role === '')?DFT_ROLE_NAME:userAcc.role;
@@ -437,14 +441,14 @@ let rptSignatureHelper = {
                                     const userAcc = rptSignatureHelper.getUserAccount(sf.acc_id);
                                     if (userAcc) {
                                         sf.private_stamp_path = rptSignatureHelper._get_newPrivate_stamp_path(sf, userAcc);
-                                        sf.company_stamp_path = rptSignatureHelper._getCompanySign(userAcc.company);
+                                        sf.company_stamp_path = rptSignatureHelper._getCompanySign(userAcc.company, sf.company_stamp_path, userAcc);
                                     }
                                 });
                             } else {
                                 const userAcc = rptSignatureHelper.getUserAccount(role_rel.acc_id);
                                 if (userAcc) {
                                     role_rel.private_stamp_path = rptSignatureHelper._get_newPrivate_stamp_path(role_rel,userAcc);
-                                    role_rel.company_stamp_path = rptSignatureHelper._getCompanySign(userAcc.company);
+                                    role_rel.company_stamp_path = rptSignatureHelper._getCompanySign(userAcc.company, role_rel.company_stamp_path, userAcc);
                                 }
                                 rptSignatureHelper.pushDatePickerDom(elementsStrArr, userAcc, role_rel, idx);
                             }
@@ -521,6 +525,10 @@ let rptSignatureHelper = {
         let rdoNameStr = `dtp_${role_rel.signature_name}_${rptSignatureHelper.currentSelectedESignParentDivId}`;
         // 个人章列表
         const stampPathList=userAcc&&userAcc.stamp_path?userAcc.stamp_path.split('!;!'):[];
+        if (userAcc && userAcc.unit_sign_path) {
+            userAcc.unit_sign_path = userAcc.unit_sign_path.replace(/&%&/g, '!;!');
+        }
+        const companyPathList = userAcc && userAcc.unit_sign_path ? userAcc.unit_sign_path.split('!;!') : [];
 
         if (hasIndividualStamp) {
             elementsStrArr.push('       <div class="form-check form-check-inline mx-1">');
@@ -528,6 +536,9 @@ let rptSignatureHelper = {
             elementsStrArr.push('               <div class="form-check form-check-inline px-1">');
             elementsStrArr.push(`                   <input class="form-check-input" type="${chkType}" id="${idSuffixStr}_sign2" value="companyStamp" name="${rdoNameStr}" onchange="rptSignatureHelper._changeSignType(this, '${role_rel.signature_name}', '${COMPANY_SIGN_STR}')" ${companySignChkStr}>`);
             elementsStrArr.push(`                   <label class="form-check-label" for="${idSuffixStr}_sign2">单位章</label>`);
+            if (companyPathList.length > 1 ) {
+                elementsStrArr.push(`                   <a class="pl-2" href="#chose-company-stamp-path" data-toggle="modal" data-target="#chose-company-stamp-path" onclick="rptSignatureHelper.currentSelectedCompanySignDom = this.parentNode;rptSignatureHelper.initChosePrivateStampPath('${userAcc.unit_sign_path}','${role_rel.signature_name}', -1, 'chose-company-stamp-path') ">选择单位章</a>`);
+            } 
             elementsStrArr.push('               </div>');
             elementsStrArr.push('               <div class="form-check form-check-inline">');
             elementsStrArr.push(`                   <input class="form-check-input" type="${chkType}" id="${idSuffixStr}_sign3" value="individualStamp" name="${rdoNameStr}" onchange="rptSignatureHelper._changeSignType(this, '${role_rel.signature_name}', '${PRIVATE_SIGN_STR}','${userAcc.stamp_path}')" ${privateSignChkStr}>`);
@@ -894,12 +905,18 @@ let rptSignatureHelper = {
         }
         return rst;
     },
-    _getCompanySign: function(companyName) {
-        let rst = '';
-        for (const cUnit of CONSTRUCT_UNIT_LIST) {
-            if (cUnit.name === companyName) {
-                rst = cUnit.sign_path;
-                break;
+    _getCompanySign: function(companyName, orgCompanyPath = null, userAccount = null) {
+        let rst = orgCompanyPath || '';
+        if (rst === '') {
+            if (userAccount && userAccount.unit_sign_path && userAccount.unit_sign_path !== '') {
+                rst = userAccount.unit_sign_path.split('!;!')[0].split('&%&')[0];
+            } else {
+                for (const cUnit of CONSTRUCT_UNIT_LIST) {
+                    if (cUnit.name === companyName) {
+                        rst = cUnit.sign_path;
+                        break;
+                    }
+                }
             }
         }
         return rst;
@@ -1221,7 +1238,8 @@ let rptSignatureHelper = {
                         newRoleRel.sign_output.push(chkStr);
                     }
                     if(chkStr==='private_stamp' && !newRoleRel.private_stamp_path && userStamp){
-                        newRoleRel.private_stamp_path = userStamp.split('!;!')[0] ;
+                        newRoleRel.private_stamp_path = userStamp.split('!;!').split('&%&')[0] ;
+                        // userAcc.unit_sign_path = userAcc.unit_sign_path.replace(/&%&/g, '!;!');
                         // console.log(newRoleRel.private_stamp_path);
                     }
                 } else {
@@ -1264,7 +1282,7 @@ let rptSignatureHelper = {
         targetCell.area.Right = pLeft + STD_STAMP_SIZE_WIDTH;
         targetCell.area.Bottom = pTop + STD_STAMP_SIZE_HEIGHT;
     },
-    initChosePrivateStampPath:function(stampPathList, signature_name, flowIndex = -1){
+    initChosePrivateStampPath:function(stampPathList, signature_name, flowIndex = -1, destDial = 'chose-private-stamp-path'){
         let currentStamp='';
         const targetNode= ROLE_REL_LIST.find(item=>item.signature_name===signature_name);
         if (targetNode) {
@@ -1272,6 +1290,12 @@ let rptSignatureHelper = {
                 currentStamp = targetNode.assFlowInfos[flowIndex].private_stamp_path;
             } else {
                 currentStamp = targetNode.private_stamp_path;
+                if (destDial !== 'chose-private-stamp-path') {
+                    currentStamp = targetNode.company_stamp_path || '';
+                    if (currentStamp.includes('&%&')) {
+                        currentStamp = stampPathList.split('!;!')[0];
+                    }
+                }
             }
         }
         let content=`<div class='row justify-content-md-center'>`;
@@ -1291,7 +1315,8 @@ let rptSignatureHelper = {
         content+=` </div><div class='privateStampRoleName' data-name='${signature_name}'></div>`;
         content += `<div class='privateStampFlowIndex' data-name='${flowIndex}'></div>`;
 
-        $('#chose-private-stamp-path .modal-body').empty().append(content);
+        // $('#chose-private-stamp-path .modal-body').empty().append(content);
+        $(`#${destDial} .modal-body`).empty().append(content);
         $('.stamp-img').on('click',(e)=>{
             $('.stamp-img').removeClass('card-gk-active');
             $('.stamp-img').find('.sel-width').removeClass('sel-blue');
@@ -1311,6 +1336,18 @@ let rptSignatureHelper = {
         }
         $('#chose-private-stamp-path').modal('hide');
     },
+    setCompanyStamp(e, flowIndex = -1) {
+        const imgSrc= $('.stamp-img.card-gk-active').find('.img-fluid').data('src');
+        const privateStampRoleName=$('.privateStampRoleName').data('name');
+        const targetNode = ROLE_REL_LIST.find( item => item.signature_name === privateStampRoleName);
+        if (targetNode.type === '流程') {
+            const flowIndex = +($('.privateStampFlowIndex').data('name'));
+            targetNode.assFlowInfos[flowIndex].company_stamp_path = imgSrc;
+        } else {
+            targetNode.company_stamp_path = imgSrc;
+        }
+        $('#chose-company-stamp-path').modal('hide');
+    },
     _get_newPrivate_stamp_path(roleRelObj,userAcc) {
         if (!roleRelObj.private_stamp_path) {
             if (!userAcc.stamp_path) return '';

+ 21 - 1
app/view/report/rpt_all_popup.ejs

@@ -378,7 +378,27 @@
             </div>
             <div class="modal-footer">
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
-                <button id="audit-select-ok" class="btn btn-primary btn-sm" onclick="rptSignatureHelper.setPrivateStamp(this)">确定</button>
+                <button id="audit-select-ok1" class="btn btn-primary btn-sm" onclick="rptSignatureHelper.setPrivateStamp(this)">确定</button>
+            </div>
+        </div>
+    </div>
+</div>
+<!--选择单位章-->
+<div class="modal fade" id="chose-company-stamp-path" data-backdrop="static">
+    <div class="modal-dialog modal-lg" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title" id="select-company-signature-title">选择单位章</h5>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+               
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
+                <button id="audit-select-ok2" class="btn btn-primary btn-sm" onclick="rptSignatureHelper.setCompanyStamp(this)">确定</button>
             </div>
         </div>
     </div>