浏览代码

账号设置-权限控制更新

ellisran 3 月之前
父节点
当前提交
1f0e811a99

+ 12 - 7
app/public/js/sp_setting_permission.js

@@ -62,22 +62,27 @@ $(document).ready(() => {
         if (ptype === 'contract') {
             const pvalue = $(this).attr('pvalue');
             if (this.checked) {
-                if ((pvalue === '1' || pvalue === '2') && !$('[ptype=contract][pvalue="3"]').prop('checked') && !$('[ptype=contract][pvalue="4"]').prop('checked')) {
-                    $('[ptype=contract][pvalue="5"]').prop('checked', true);
+                if ((pvalue === '1' || pvalue === '2') && !$(this).parents('.permission-parent').find('[ptype=contract][pvalue="3"]').prop('checked') && !$(this).parents('.permission-parent').find('[ptype=contract][pvalue="4"]').prop('checked')) {
+                    $(this).parents('.permission-parent').find('[ptype=contract][pvalue="5"]').prop('checked', true);
                 }
                 if (pvalue === '3' || pvalue === '4') {
-                    $('[ptype=contract][pvalue="5"]').prop('checked', false);
+                    $(this).parents('.permission-parent').find('[ptype=contract][pvalue="5"]').prop('checked', false);
                 } else if (pvalue === '5') {
-                    $('[ptype=contract][pvalue="3"]').prop('checked', false);
-                    $('[ptype=contract][pvalue="4"]').prop('checked', false);
+                    $(this).parents('.permission-parent').find('[ptype=contract][pvalue="3"]').prop('checked', false);
+                    $(this).parents('.permission-parent').find('[ptype=contract][pvalue="4"]').prop('checked', false);
                 }
             } else if (!this.checked) {
                 if (pvalue === '3' || pvalue === '4') {
-                    if (!$('[ptype=contract][pvalue="3"]').prop('checked') && !$('[ptype=contract][pvalue="4"]').prop('checked')) {
-                        $('[ptype=contract][pvalue="5"]').prop('checked', true);
+                    if (!$(this).parents('.permission-parent').find('[ptype=contract][pvalue="3"]').prop('checked') && !$(this).parents('.permission-parent').find('[ptype=contract][pvalue="4"]').prop('checked')) {
+                        $(this).parents('.permission-parent').find('[ptype=contract][pvalue="5"]').prop('checked', true);
                     }
                 }
             }
+        } else if (ptype === 'payment') {
+            const pvalue = $(this).attr('pvalue');
+            if (this.checked && pvalue === '2') {
+                $(this).parents('.permission-parent').find('[ptype=payment][pvalue="3"]').prop('checked', true);
+            }
         }
     });
     $('[name=set-permission]').click(function() {

+ 2 - 2
app/service/sub_proj_permission.js

@@ -49,8 +49,8 @@ module.exports = app => {
                 contract: {
                     edit: { title: '编辑节点', value: 1 },
                     add: { title: '添加合同', value: 2 },
-                    node: { title: '授权查看本节点合同', value: 3 },
-                    unit: { title: '授权查看本单位合同', value: 4 },
+                    node: { title: '授权节点下查看本节点合同', value: 3 },
+                    unit: { title: '授权节点下查看本单位合同', value: 4 },
                     view: { title: '查看所有合同', value: 5 },
                 },
                 fund_trans: {

+ 3 - 2
app/view/sp_setting/permission.ejs

@@ -36,6 +36,7 @@
                                     <dd class="list-group-item">资金监管</dd>
                                     <a href="/sp/<%- ctx.subProject.id %>/setting/user/permission?ptype=fund_trans<%- (keyword ? '&keyword=' + keyword : '')%>" class="list-group-item list-group-item-action  <%- (ptype === 'fund_trans' ? 'active' : '') %>"><span class="ml-4"></span>资金划拨</a>
                                     <a href="/sp/<%- ctx.subProject.id %>/setting/user/permission?ptype=fund_pay<%- (keyword ? '&keyword=' + keyword : '')%>" class="list-group-item list-group-item-action  <%- (ptype === 'fund_pay' ? 'active' : '') %>"><span class="ml-4"></span>资金支付</a>
+                                    <a href="/sp/<%- ctx.subProject.id %>/setting/user/permission?ptype=payment<%- (keyword ? '&keyword=' + keyword : '')%>" class="list-group-item list-group-item-action  <%- (ptype === 'payment' ? 'active' : '') %>">支付审批</a>
                                 </dl>
                             </div>
                             <div class="col-9">
@@ -67,12 +68,12 @@
                                             <tbody class="text-center">
                                             <% for (const user of subProjectAccountList) { %>
                                             <% const tp = user[ptype + '_permission'].split(','); %>
-                                            <tr name="user-permission" pid="<%- user.permission_id %>">
+                                            <tr name="user-permission" class="permission-parent" pid="<%- user.permission_id %>">
                                                 <td><%- user.name %></td>
                                                 <td><%- user.company %></td>
                                                 <td><%- user.role %></td>
                                                 <% for (const key in permissionConst) { %>
-                                                <td><input type="checkbox" ptype="<%- ptype %>" pvalue="<%- permissionConst[key].value %>" <%- (tp.indexOf(permissionConst[key].value + '') >= 0 ? 'checked' : '') %> onchange="$('#save-permission').show();"></td>
+                                                <td><input type="checkbox" name="permission-check" ptype="<%- ptype %>" pvalue="<%- permissionConst[key].value %>" <%- (tp.indexOf(permissionConst[key].value + '') >= 0 ? 'checked' : '') %> onchange="$('#save-permission').show();"></td>
                                                 <% } %>
                                             </tr>
                                             <% } %>

+ 1 - 1
app/view/sp_setting/user_modal.ejs

@@ -49,7 +49,7 @@
                         </div>
                         <% } %>
                     </h6>
-                    <div class="card-body">
+                    <div class="card-body permission-parent">
                         <% if (pb.children) { %>
                         <% for (const [i, c] of pb.children.entries()) { %>
                         <% if (i !== 0) { %><hr/><% } %>