Browse Source

变更修订功能权限细分

ellisran 1 year ago
parent
commit
baf2599d03

+ 9 - 3
app/controller/change_controller.js

@@ -650,11 +650,17 @@ module.exports = app => {
                         break;
                         // 从新增部位页新增清单
                     case 'add-change-list':
+                        if (ctx.change.status !== audit.change.status.uncheck && ctx.change.status !== audit.change.status.checkNo && ctx.change.status !== audit.change.status.revise) {
+                            throw '该变更令正在审批中或已完成,无法操作清单数据';
+                        }
                         await ctx.service.changeAuditList.adds(data.postData);
                         responseData.data = { changeList: await ctx.service.changeAuditList.getList(ctx.change.cid) };
                         break;
                     // 从新增部位页删除清单
                     case 'del-change-list':
+                        if (ctx.change.status !== audit.change.status.uncheck && ctx.change.status !== audit.change.status.checkNo && ctx.change.status !== audit.change.status.revise) {
+                            throw '该变更令正在审批中或已完成,无法操作清单数据';
+                        }
                         await ctx.service.changeAuditList.dels(data);
                         responseData.data = { changeList: await ctx.service.changeAuditList.getList(ctx.change.cid) };
                         break;
@@ -1532,9 +1538,9 @@ module.exports = app => {
          */
         async reviseInfo(ctx) {
             try {
-                if (!ctx.session.sessionProject.page_show.openChangeRevise) {
-                    throw '该功能已关闭';
-                }
+                // if (!ctx.session.sessionProject.page_show.openChangeRevise) {
+                //     throw '该功能已关闭';
+                // }
                 const change = ctx.change;
                 let edit = true;
                 let changing = false;

+ 75 - 21
app/public/js/change_revise.js

@@ -3509,7 +3509,7 @@ $(document).ready(() => {
             }, 100);
         });
     })('a[name=showLevel]', billsSheet);
-
+if (openRevise) {
     const dataChecker = DataChecker({
         checkUrl: window.location.pathname + '/check',
         completeData: function (data) {
@@ -3545,7 +3545,7 @@ $(document).ready(() => {
         let compilationList = [];
         $('#get-dsk-btn').click(function () {
             // 判断是否已绑定dsk用户
-            postData('/profile/dsk/api', { type: 'hadbind' }, function (result) {
+            postData('/profile/dsk/api', {type: 'hadbind'}, function (result) {
                 if (result === 1) {
                     $('#error-dsk .modal-body').find('h5').eq(0).show();
                     $('#error-dsk .modal-body').find('h5').eq(1).hide();
@@ -3557,7 +3557,11 @@ $(document).ready(() => {
                     $('#error-dsk').modal('show');
                     $('#error-dsk .modal-footer').find('a').eq(0).text('绑定账号');
                 } else {
-                    postData('/profile/dsk/api', { type: 'compilation', getProject: 1, compilationId: getLocalCache(dskCompilation) }, function (result) {
+                    postData('/profile/dsk/api', {
+                        type: 'compilation',
+                        getProject: 1,
+                        compilationId: getLocalCache(dskCompilation)
+                    }, function (result) {
                         let html = '';
                         for (const data of result.compilation) {
                             html += `<option value="${data.ID}" ${result.select_compilation === data.ID ? 'selected' : ''}>${data.name}</option>`;
@@ -3574,7 +3578,7 @@ $(document).ready(() => {
             })
         });
         $('#get-dsk-bills-btn').click(function () {
-            const projectInfo = _.find(dskProjects, { pid: dskAccountData.select_project ? dskAccountData.select_project : null });
+            const projectInfo = _.find(dskProjects, {pid: dskAccountData.select_project ? dskAccountData.select_project : null});
             changeDskProjectTree(projectInfo, dskAccountData.select_tree ? dskAccountData.select_tree : null);
         });
 
@@ -3598,6 +3602,7 @@ $(document).ready(() => {
             grArray: dskProjects ? dskProjects : [],
             orgSelect: null,
         };
+
         function makeDskProjectSjsHtml(datas) {
             if (!dp) {
                 initDskProjectTree();
@@ -3612,13 +3617,19 @@ $(document).ready(() => {
                 $('#show-project-0').hide();
             }
         }
+
         const dskProjectSpreadObj = {
             _addTender: function (tender) {
                 const gr = gsObj.grArray.find(function (x) {
                     return x.pid === tender.pid;
                 });
                 const c_id = getLocalCache(dskCompilation);
-                const t = {pid: tender.pid, name: tender.name, compilationId: c_id, compilationName: _.find(compilationList, { ID: c_id }).name };
+                const t = {
+                    pid: tender.pid,
+                    name: tender.name,
+                    compilationId: c_id,
+                    compilationName: _.find(compilationList, {ID: c_id}).name
+                };
                 if (!gr) gsObj.grArray.push(t);
                 return t;
             },
@@ -3634,7 +3645,7 @@ $(document).ready(() => {
             refreshSourceTree: function () {
                 const c_id = getLocalCache(dskCompilation);
                 if (c_id) {
-                    postData('/profile/dsk/api', { type: 'project', compilationId: c_id }, function (result) {
+                    postData('/profile/dsk/api', {type: 'project', compilationId: c_id}, function (result) {
                         makeDskProjectSjsHtml(result);
                     });
                 }
@@ -3651,7 +3662,7 @@ $(document).ready(() => {
                     const posterity = gsObj.tenderSourceTree.getPosterity(node);
                     for (const p of posterity) {
                         p.selected = node.selected;
-                        if ((!p.children || p.children.length === 0) && p.type === 2){
+                        if ((!p.children || p.children.length === 0) && p.type === 2) {
                             if (p.selected) {
                                 dskProjectSpreadObj._addTender(p);
                             } else {
@@ -3695,8 +3706,25 @@ $(document).ready(() => {
             gsObj.gsSheet = gsSpread.getActiveSheet();
             const gsSpreadSetting = {
                 cols: [
-                    {title: '选择', field: 'selected', hAlign: 1, width: 40, formatter: '@', cellType: 'checkbox', readOnly: true,},
-                    {title: '名称', field: 'name', hAlign: 0, width: 400, formatter: '@', readOnly: true, folderCell: true, cellType: 'tree'},
+                    {
+                        title: '选择',
+                        field: 'selected',
+                        hAlign: 1,
+                        width: 40,
+                        formatter: '@',
+                        cellType: 'checkbox',
+                        readOnly: true,
+                    },
+                    {
+                        title: '名称',
+                        field: 'name',
+                        hAlign: 0,
+                        width: 400,
+                        formatter: '@',
+                        readOnly: true,
+                        folderCell: true,
+                        cellType: 'tree'
+                    },
                 ],
                 emptyRows: 0,
                 headRows: 1,
@@ -3714,8 +3742,28 @@ $(document).ready(() => {
             gsObj.grSheet = grSpread.getActiveSheet();
             const grSpreadSetting = {
                 cols: [
-                    {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 250, formatter: '@', readOnly: true, cellType: 'ellipsisAutoTip', scrollHeightClass: '.modal-height-500'},
-                    {title: '所属编办', colSpan: '1', rowSpan: '1', field: 'compilationName', hAlign: 0, width: 150, formatter: '@', readOnly: true},
+                    {
+                        title: '名称',
+                        colSpan: '1',
+                        rowSpan: '1',
+                        field: 'name',
+                        hAlign: 0,
+                        width: 250,
+                        formatter: '@',
+                        readOnly: true,
+                        cellType: 'ellipsisAutoTip',
+                        scrollHeightClass: '.modal-height-500'
+                    },
+                    {
+                        title: '所属编办',
+                        colSpan: '1',
+                        rowSpan: '1',
+                        field: 'compilationName',
+                        hAlign: 0,
+                        width: 150,
+                        formatter: '@',
+                        readOnly: true
+                    },
                 ],
                 emptyRows: 0,
                 headRows: 1,
@@ -3773,8 +3821,8 @@ $(document).ready(() => {
             const tenderTree = createNewPathTree('gather', treeSetting);
 
             function setChildrenNode(node, files, tenders) {
-                const children = _.filter(files, { parentID: node.pid });
-                const tenderChildren = _.filter(tenders, { parentID: node.pid });
+                const children = _.filter(files, {parentID: node.pid});
+                const tenderChildren = _.filter(tenders, {parentID: node.pid});
                 const checkChildren = _.orderBy([...children, ...tenderChildren], ['seq', 'asc']);
                 for (const c of checkChildren) {
                     // if (c.type === 1 && _.filter(files, { parentID: c.ID }).length === 0 && _.filter(tenders, { parentID: c.ID }).length === 0) {
@@ -3786,19 +3834,19 @@ $(document).ready(() => {
                         parentID: c.parentID,
                         name: c.name,
                         type: c.type,
-                        selected: _.findIndex(gsObj.grArray, { pid: c.ID }) >= 0
+                        selected: _.findIndex(gsObj.grArray, {pid: c.ID}) >= 0
                     };
                     tenderTree.addNode(child, node);
                     if (c.type === 1) setChildrenNode(child, files, tenders);
                 }
             }
 
-            function convert (projects) {
+            function convert(projects) {
                 tenderTree.clearDatas();
                 const result = filterFolders(projects);
-                const topLevel = _.orderBy(_.filter(result, { parentID: '-1' }), ['seq', 'asc']);
-                const files = _.filter(result, { type: 1 });
-                const tenders = _.filter(result, { type: 2 });
+                const topLevel = _.orderBy(_.filter(result, {parentID: '-1'}), ['seq', 'asc']);
+                const files = _.filter(result, {type: 1});
+                const tenders = _.filter(result, {type: 2});
 
                 for (const t of topLevel) {
                     const node = {
@@ -3806,7 +3854,7 @@ $(document).ready(() => {
                         parentID: t.parentID,
                         name: t.name,
                         type: t.type,
-                        selected: t.type === 2 ? _.findIndex(gsObj.grArray, { pid: t.ID }) >= 0 : false,
+                        selected: t.type === 2 ? _.findIndex(gsObj.grArray, {pid: t.ID}) >= 0 : false,
                     };
                     tenderTree.addNode(node, null);
                     if (t.type === 1) setChildrenNode(node, files, tenders);
@@ -3814,7 +3862,8 @@ $(document).ready(() => {
                 tenderTree.sortTreeNode(true);
                 return tenderTree;
             }
-            return { tenderTree, convert }
+
+            return {tenderTree, convert}
         })();
 
         function filterFolders(data) {
@@ -3864,7 +3913,11 @@ $(document).ready(() => {
         }
 
         $('#set-dsk-project').click(function () {
-            postData('/profile/dsk/api', { type: 'save_projects', tid: window.location.pathname.split('/')[2], project_list: gsObj.grArray }, function (result) {
+            postData('/profile/dsk/api', {
+                type: 'save_projects',
+                tid: window.location.pathname.split('/')[2],
+                project_list: gsObj.grArray
+            }, function (result) {
                 // dskAccountData.select_project = result;
                 dskProjects = gsObj.grArray;
                 if (!dskAccountData.select_project || dskAccountData.select_project !== result) {
@@ -3888,6 +3941,7 @@ $(document).ready(() => {
             $('#change-dsk-project').html(html);
         }
     }
+}
 });
 // 编号排序,多重判断
 function sortByCode(a, b, code = 'b_code') {

+ 11 - 0
app/view/change/revise.ejs

@@ -21,6 +21,7 @@
                         </div>
                     </div>
                 </div>
+                <% if (ctx.session.sessionProject.page_show.openChangeRevise) { %>
                 <div class="d-inline-block">
                     <a href="javascript: void(0);" name="base-opr" type="add" class="btn btn-sm btn-light text-primary" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="新增"><i class="fa fa-plus" aria-hidden="true"></i></a>
                     <a href="javascript: void(0);" name="base-opr" type="delete" class="btn btn-sm btn-light text-primary" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
@@ -32,6 +33,7 @@
                     <a href="javascript: void(0);" name="cpc" type="cut" class="btn btn-sm btn-light text-primary" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="剪切"><i class="fa fa-scissors" aria-hidden="true"></i></a>
                     <a href="javascript: void(0);" name="cpc" type="paste" class="btn btn-sm btn-light text-primary" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="粘贴"><i class="fa fa-clipboard" aria-hidden="true"></i></a>
                 </div>
+                <% } %>
                 <div class="d-inline-block">
                     <div class="input-group input-group-sm ml-2">
                         <div class="input-group-prepend">
@@ -41,9 +43,11 @@
                     </div>
                 </div>
             </div>
+            <% if (ctx.session.sessionProject.page_show.openChangeRevise) { %>
             <div class="ml-auto">
                 <a class="btn btn-sm btn-primary mr-1" id="ledger-check2" href="javascript: void(0);">数据检查</a>
             </div>
+            <% } %>
         </div>
     </div>
     <div class="content-wrap row pr-46">
@@ -63,12 +67,14 @@
                             <li class="nav-item">
                                 <a class="nav-link active" href="javascript:void(0)">计量单元</a>
                             </li>
+                            <% if (ctx.session.sessionProject.page_show.openChangeRevise) { %>
                             <li class="ml-2 nav-item">
                                 <div class="d-inline-flex">
                                     <a href="javascript: void(0);" name="pos-opr" type="down-move" class="btn btn-sm btn-light text-primary" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="下移"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
                                     <a href="javascript: void(0);" name="pos-opr" type="up-move" class="btn btn-sm btn-light text-primary" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
                                 </div>
                             </li>
+                            <% } %>
                             <li class="nav-item" id="pos-search">
                             </li>
                             <li class="nav-item">
@@ -94,6 +100,7 @@
                 <div class="tab-content">
                     <div id="search" class="tab-pane">
                     </div>
+                    <% if (ctx.session.sessionProject.page_show.openChangeRevise) { %>
                     <div id="std-xmj" class="tab-pane">
                     </div>
                     <div id="std-gcl" class="tab-pane">
@@ -130,6 +137,7 @@
                             </div>
                         </div>
                     </div>
+                    <% } %>
                 </div>
             </div>
         </div>
@@ -140,6 +148,7 @@
                 <li class="nav-item">
                     <a class="nav-link" content="#search" href="javascript: void(0);">查找定位</a>
                 </li>
+                <% if (ctx.session.sessionProject.page_show.openChangeRevise) { %>
                 <li class="nav-item">
                     <a class="nav-link" content="#std-xmj" href="javascript: void(0);">项目节</a>
                 </li>
@@ -158,6 +167,7 @@
                 <li class="nav-item">
                     <a class="nav-link" content="#dsk-list" href="javascript: void(0);">新增清单</a>
                 </li>
+                <% } %>
             </ul>
         </div>
     </div>
@@ -181,4 +191,5 @@
     const oldChangeList = _.cloneDeep(changeList);
     const settleBills = JSON.parse(unescape('<%- escape(JSON.stringify(settleBills)) %>'));
     const settlePos = JSON.parse(unescape('<%- escape(JSON.stringify(settlePos)) %>'));
+    const openRevise = <%- ctx.session.sessionProject.page_show.openChangeRevise %>;
 </script>

+ 21 - 18
app/view/change/revise_modal.ejs

@@ -1,3 +1,23 @@
+<% if (changing) { %>
+    <!--正在修订提示-->
+    <div class="modal fade" id="unedit2" data-backdrop="static">
+        <div class="modal-dialog " role="document" >
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h5 class="modal-title">提示</h5>
+                </div>
+                <div class="modal-body">
+                    <h5>该变更令正在审批中或已完成,添加台账清单页无法进行任何操作。</h5>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">好的</button>
+                </div>
+            </div>
+        </div>
+    </div>
+    <script type="text/javascript">$('#unedit2').modal('show');</script>
+<% } %>
+<% if (ctx.session.sessionProject.page_show.openChangeRevise) { %>
 <!--批量添加清单部位-->
 <div class="modal fade" id="batch" data-backdrop="static">
     <div class="modal-dialog modal-xl" role="document">
@@ -53,24 +73,6 @@
         </div>
     </div>
     <script type="text/javascript">$('#unedit').modal('show');</script>
-<% } else if (changing && !revising) { %>
-    <!--正在修订提示-->
-    <div class="modal fade" id="unedit2" data-backdrop="static">
-        <div class="modal-dialog " role="document" >
-            <div class="modal-content">
-                <div class="modal-header">
-                    <h5 class="modal-title">提示</h5>
-                </div>
-                <div class="modal-body">
-                    <h5>该变更令正在审批中或已完成,添加台账清单页无法进行任何操作。</h5>
-                </div>
-                <div class="modal-footer">
-                    <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">好的</button>
-                </div>
-            </div>
-        </div>
-    </div>
-    <script type="text/javascript">$('#unedit2').modal('show');</script>
 <% } %>
 <% if (isYb) { %>
 <div class="modal fade" id="error-dsk" data-backdrop="static">
@@ -128,3 +130,4 @@
 <% include ../shares/delete_hint_modal.ejs %>
 <% include ../shares/check_data_modal.ejs %>
 <% include ../shares/check_modal2.ejs %>
+<% } %>