Browse Source

未审核签名UI调整

TonyKang 5 years ago
parent
commit
65b7dbfc5b
2 changed files with 43 additions and 67 deletions
  1. 2 1
      app/controller/report_controller.js
  2. 41 66
      app/public/report/js/rpt_signature.js

+ 2 - 1
app/controller/report_controller.js

@@ -173,7 +173,8 @@ module.exports = app => {
                 // console.log('get the template!');
                 const pageRst = await getAllPagesCommon(ctx, rptTpl, params, JV.PAGING_OPTION_NORMAL, JV.OUTPUT_TYPE_NORMAL, this.app.baseDir);
                 // console.log(pageRst);
-                const roleRel = (params.stage_status === 3) ? (await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_tpl_id)) : [];
+                // const roleRel = (params.stage_status === 3) ? (await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_tpl_id)) : [];
+                const roleRel = await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_tpl_id); // 新需求中,允许在非审核状态下设置签名
                 const stgAudit = await ctx.service.stageAudit.getStageAudit(params.stage_id, params.stage_times);
                 // console.log('after role stage!');
                 // console.log(roleRel);

+ 41 - 66
app/public/report/js/rpt_signature.js

@@ -163,68 +163,41 @@ let rptSignatureHelper = {
                 elementsStrArr.push('<div class="col-sm-9">');
                 elementsStrArr.push('<ul class="list-group">');
                 elementsStrArr.push('<li class="list-group-item">');
-                if (sCell.path || sCell.pic) {
-                    let hasPic = false;
-                    for (let idx = 0; idx < ROLE_REL_LIST.length; idx++) {
-                        const role_rel = ROLE_REL_LIST[idx];
-                        if (role_rel.signature_name === sCell.signature_name) {
-                            if (role_rel.type === '用户') {
-                                rptSignatureHelper.pushDomElementByUser(elementsStrArr, role_rel.user_name, role_rel.role);
-                            } else {
-                                //角色
-                                rptSignatureHelper.pushDomElementByRole(elementsStrArr, role_rel.role_name, role_rel.user_name);
-                            }
-                            const idSuffixStr = 'dtp_' + role_rel.signature_name;
-                            /*
-                            elementsStrArr.push('<div class="dropdown">');
-                            if (role_rel.sign_date !== '') {
-                                //elementsStrArr.push('<a href="" data-toggle="dropdown">' + (new Date(role_rel.sign_date)).Format('yyyy-M-d') + '</a>');
-                                elementsStrArr.push('<a href="" data-toggle="dropdown"><i class="fa fa-calendar" title="添加签名日期"></i></a>');
-                            } else {
-                                elementsStrArr.push('<a href="" data-toggle="dropdown"><i class="fa fa-calendar" title="添加签名日期"></i></a>');
-                            }
-                            elementsStrArr.push('<form class="dropdown-menu p-2">');
-                            elementsStrArr.push('<div class="form-group">');
-                            elementsStrArr.push('<label for="exampleDropdownFormEmail2">签名日期</label>');
-                            if (role_rel.sign_date !== '') {
-                                //elementsStrArr.push('<input class="datepicker-here form-control form-control-sm mt-0" placeholder="选择签名日期" data-language="zh" type="text" value="' + (new Date(role_rel.sign_date)).Format('yyyy-M-d') + '">');
-                                elementsStrArr.push('<input id="' + idSuffixStr + '" class="datepicker-here form-control form-control-sm mt-0" placeholder="选择签名日期" data-language="zh" type="text">');
-                            } else {
-                                elementsStrArr.push('<input id="' + idSuffixStr + '" class="datepicker-here form-control form-control-sm mt-0" placeholder="选择签名日期" data-language="zh" type="text">');
-                            }
-                            elementsStrArr.push('</div>');
-                            if (role_rel.sign_date !== '') {
-                                //elementsStrArr.push('<button type="submit" class="btn btn-sm btn-outline-danger">移除日期</button> <button type="submit" class="btn btn-sm btn-primary">确认</button>');
-                                elementsStrArr.push('<button type="submit" class="btn btn-sm btn-primary">确认</button>');
-                            } else {
-                                elementsStrArr.push('<button type="submit" class="btn btn-sm btn-primary">确认</button>');
-                            }
-                            elementsStrArr.push('</form>');
-                            elementsStrArr.push('</div>');
-                            /*/
-                            elementsStrArr.push('<div class="">');
-                            if (role_rel.sign_date !== '') {
-                                const dt = new Date(role_rel.sign_date);
-                                const dtVal = dt.Format('yyyy-M-dd');
-                                //elementsStrArr.push('<input class="datepicker-here form-control form-control-sm mt-0" placeholder="选择签名日期" data-language="zh" type="text" value="' + (new Date(role_rel.sign_date)).Format('yyyy-M-d') + '">');
-                                elementsStrArr.push('<input id="' + idSuffixStr + '" class="datepicker-here form-control form-control-sm mt-0" placeholder="选择签名日期" data-language="zh" type="text" readonly="true" value="' + dtVal + '"');
-                            } else {
-                                elementsStrArr.push('<input id="' + idSuffixStr + '" class="datepicker-here form-control form-control-sm mt-0" placeholder="选择签名日期" data-language="zh" type="text" readonly="true"');
-                            }
-                            elementsStrArr.push('</div>');
-                            //*/
-
-                            hasPic = true;
-                            break;
+                let hasPic = false;
+                //新需求中,即使没有审核,也可以设置签名
+                for (let idx = 0; idx < ROLE_REL_LIST.length; idx++) {
+                    const role_rel = ROLE_REL_LIST[idx];
+                    if (role_rel.signature_name === sCell.signature_name) {
+                        if (role_rel.type === '用户') {
+                            rptSignatureHelper.pushDomElementByUser(elementsStrArr, role_rel.user_name, role_rel.role);
+                        } else {
+                            //角色
+                            rptSignatureHelper.pushDomElementByRole(elementsStrArr, role_rel.role_name, role_rel.user_name);
                         }
-                        if (!hasPic) {
-                            // 在交互操作中,有可能实际上是没有
-                            // elementsStrArr.push('<a href="#add-sign" onclick="rptSignatureHelper.currentSelectedESignAccDom = this.parentNode; rptSignatureHelper.currentSelectedESignAccName = \'' + sCell.signature_name + '\'" data-toggle="modal" data-target="#add-sign"><i class="fa fa-plus"></i> 添加签名</a>');
+                        const idSuffixStr = 'dtp_' + role_rel.signature_name;
+                        elementsStrArr.push('<div class="">');
+                        if (role_rel.sign_date !== '') {
+                            const dt = new Date(role_rel.sign_date);
+                            const dtVal = dt.Format('yyyy-M-dd');
+                            //elementsStrArr.push('<input class="datepicker-here form-control form-control-sm mt-0" placeholder="选择签名日期" data-language="zh" type="text" value="' + (new Date(role_rel.sign_date)).Format('yyyy-M-d') + '">');
+                            elementsStrArr.push('<input id="' + idSuffixStr + '" class="datepicker-here form-control form-control-sm mt-0" placeholder="选择签名日期" data-language="zh" type="text" readonly="true" value="' + dtVal + '"');
+                        } else {
+                            elementsStrArr.push('<input id="' + idSuffixStr + '" class="datepicker-here form-control form-control-sm mt-0" placeholder="选择签名日期" data-language="zh" type="text" readonly="true"');
                         }
+                        elementsStrArr.push('</div>');
+
+                        hasPic = true;
+                        break;
+                    }
+                    if (!hasPic) {
+                        // 在交互操作中,有可能实际上是没有
+                        elementsStrArr.push('<a href="#add-sign" onclick="rptSignatureHelper.currentSelectedESignAccDom = this.parentNode; rptSignatureHelper.currentSelectedESignAccName = \'' + sCell.signature_name + '\'" data-toggle="modal" data-target="#add-sign"><i class="fa fa-plus"></i> 添加签名</a>');
                     }
-                } else {
-                    elementsStrArr.push('<a href="#add-sign" onclick="rptSignatureHelper.currentSelectedESignAccDom = this.parentNode; rptSignatureHelper.currentSelectedESignAccName = \'' + sCell.signature_name + '\'" data-toggle="modal" data-target="#add-sign"><i class="fa fa-plus"></i> 添加签名</a>');
                 }
+                // if (sCell.path || sCell.pic) {
+                // } else {
+                //     elementsStrArr.push('<a href="#add-sign" onclick="rptSignatureHelper.currentSelectedESignAccDom = this.parentNode; rptSignatureHelper.currentSelectedESignAccName = \'' + sCell.signature_name + '\'" data-toggle="modal" data-target="#add-sign"><i class="fa fa-plus"></i> 添加签名</a>');
+                // }
                 elementsStrArr.push('</li>');
                 elementsStrArr.push('</ul>');
                 elementsStrArr.push('</div>');
@@ -355,18 +328,20 @@ let rptSignatureHelper = {
     setupAfterSelectSignature: function () {
         //0. 签名日期
         rptSignatureHelper.resetSignDate();
-        //1. 重刷page
-        for (const page of zTreeOprObj.currentRptPageRst.items) {
-            if (page.signature_cells) {
-                for (const sCell of page.signature_cells) {
-                    if (sCell.hasOwnProperty('pre_path')) {
-                        sCell.path = sCell.pre_path;
-                        delete sCell.pre_path;
+        if (current_stage_status === 3) {
+            //1. 重刷page
+            for (const page of zTreeOprObj.currentRptPageRst.items) {
+                if (page.signature_cells) {
+                    for (const sCell of page.signature_cells) {
+                        if (sCell.hasOwnProperty('pre_path')) {
+                            sCell.path = sCell.pre_path;
+                            delete sCell.pre_path;
+                        }
                     }
                 }
             }
+            zTreeOprObj.showPage(zTreeOprObj.currentPage, zTreeOprObj.canvas);
         }
-        zTreeOprObj.showPage(zTreeOprObj.currentPage, zTreeOprObj.canvas);
         //2. 更新数据
         const params = {};
         params.id = CURRENT_ROLE_REL_ID;