Kaynağa Gözat

管理账户

huangbin 4 yıl önce
ebeveyn
işleme
f579e8a19a

+ 1 - 1
src/common/constants/buttonType.ts

@@ -42,7 +42,7 @@ export interface ButtonType {
     account_info_manager_btn_add: string; // 管理账户 新增
     account_info_manager_btn_child_add: string; // 管理子账户 新增
     account_info_manager_btn_modify: string; // 管理账户 修改
-    account_info_manager_btn_permission: string; // 管理账户 权限设置
+    account_info_manager_btn_setting: string; // 管理账户 权限设置
     account_info_manager_btn_permission_add: string; // 管理账户 新增
     account_info_manager_btn_reset: string; // 管理账户 重置密码
     account_info_manager_btn_locked: string; // 管理账户 锁定

+ 6 - 7
src/common/setup/table/button.ts

@@ -62,20 +62,19 @@ export function handleBtnList(list: OperationTabMenu | undefined, menuType: keyo
 }
 
 export function _handleBtnList(list: OperationTabMenu | undefined, hasDetail: boolean,) {
-    const result = ref<BtnList[][]>([[], [], []])
+    const result = ref<BtnList[][]>([])
     const temp: [number, OperationTabMenu[] | undefined] = [0, list?.children]
     while (temp[1] && temp[1].length) {
         temp[1].forEach((e) => {
             const { code, type, title, isshow } = e;
+            const index = temp[0]
+            if (!Array.isArray(result.value[index])) {
+                result.value[index] = []
+            }
             if (type === 2 && isshow) { // 按钮类型 并且显示
                 const { openAction } = openModal(code as keyof ModalName);
                 const item = { lable: title, callback: openAction, className: getClassName(code) }
-                const index = temp[0]
-                if (Array.isArray(result.value[index])) {   // 如果是数组直接添加
-                    result.value[index].push(item)
-                } else { // 不是,新增数组
-                    result.value[index] = [item]
-                }
+                result.value[index].push(item)
             }
         })
         const children = temp[1][0].children

+ 2 - 2
src/views/information/account_info/compoments/add-managers-permission/index.vue

@@ -77,10 +77,10 @@ import { loginAccountOperate } from '@/services/proto/accountinfo';
 import { QueryAccMgrRoleMenu } from '@/services/go/ermcp/account';
 
 export default defineComponent({
-    name: 'account_info_manager_btn_permission_add',
+    name: 'account_info_manager_btn_add',
     setup(props, context) {
         // 控制关闭弹窗
-        const { visible, cancel } = closeModal('account_info_manager_btn_permission_add');
+        const { visible, cancel } = closeModal('account_info_manager_btn_add');
         const { rules, formState, formRef } = handleBusinessForm();
         const loading = ref<boolean>(false);
         const tableList = ref<ErmcpRoleMenuEx[]>([]);

+ 2 - 2
src/views/information/account_info/compoments/add-managers/index.vue

@@ -84,7 +84,7 @@ import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo
 import { loginAccountOperate } from '@/services/proto/accountinfo';
 
 export default defineComponent({
-    name: 'account_info_manager_btn_add',
+    name: 'account_info_manager_btn_child_add',
     components: {},
     props: {
         tableList: {
@@ -94,7 +94,7 @@ export default defineComponent({
     },
     setup(props, context) {
         // 控制关闭弹窗
-        const { visible, cancel } = closeModal('account_info_manager_btn_add');
+        const { visible, cancel } = closeModal('account_info_manager_btn_child_add');
         const { rules, formState, formRef } = handleBusinessForm();
         const loading = ref<boolean>(false);
 

+ 2 - 2
src/views/information/account_info/compoments/managers-permission/index.vue

@@ -29,10 +29,10 @@ import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { QueryAccMgrRole } from '@/services/go/ermcp/account';
 
 export default defineComponent({
-    name: 'account_info_manager_btn_permission',
+    name: 'account_info_manager_btn_setting',
     setup() {
         // 控制关闭弹窗
-        const { visible, cancel } = closeModal('account_info_manager_btn_permission');
+        const { visible, cancel } = closeModal('account_info_manager_btn_setting');
         const loading = ref<boolean>(false);
         const columns = [
             { title: '角色名称', dataIndex: 'rolename', key: 'rolename' },

+ 6 - 6
src/views/information/account_info/list/account_info_business/index.vue

@@ -33,7 +33,7 @@
           <a-row class="headRow">
             <a-col :span="12">{{item.rolename}}({{item.userlist.length}})</a-col>
             <a-col :span="12">
-              <BtnList :btnList="commonBtn"
+              <BtnList :btnList="firstBtn"
                        :selectedData="item"
                        @onClick="openAction" />
             </a-col>
@@ -74,7 +74,7 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, initData, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { defineComponent, initData, contextMenu, BtnList, _getBtnList } from '@/common/export/table';
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
 import { queryTableList } from './setup';
 import { getLoginStatusEnumItemName } from '@/common/constants/enumsName';
@@ -105,14 +105,14 @@ export default defineComponent({
     },
     setup() {
         const { loading, tableList, queryTable } = queryTableList();
-        const { commonBtn, forDataBtn } = getBtnList('account_info_business', true);
+        const [firstBtn, secondBtn] = _getBtnList('account_info_business', true).value;
         // 新增弹窗 角色类型
         const { selectedData: addModelData, openAction } = handleModalData<ErmcpLoginUserEx>();
         // 修改 重置密码、详情等弹窗
         const { selectedData: moreModelData, openAction: moreOptenAction } = handleModalData<ErmcpLoginUser>();
         // 处理根据状态显示对应按钮
         function handleBtnAction() {
-            handleTableList(queryTable, tableList, forDataBtn.value);
+            handleTableList(queryTable, tableList, secondBtn);
         }
         initData(() => {
             handleBtnAction();
@@ -120,8 +120,8 @@ export default defineComponent({
         // 查询
         function search(value: any) {}
         return {
-            commonBtn,
-            forDataBtn,
+            firstBtn,
+            secondBtn,
             loading,
             search,
             tableList,

+ 8 - 14
src/views/information/account_info/list/account_info_manager/index.vue

@@ -11,8 +11,7 @@
         </svg>
         {{getUserName()}}
       </span>
-      <a-button @click="openPermission">权限设置</a-button>
-      <a-button @click="openAddPermission">新增</a-button>
+      <BtnList :btnList="firstBtn" />
     </div>
 
     <a-collapse class="spotCollapse"
@@ -37,7 +36,7 @@
             <a-col :span="12">{{item.rolename}}({{item.userlist.length}})</a-col>
             <a-col :span="12">
               <BtnList :selectedData="item"
-                       :btnList="commonBtn"
+                       :btnList="secondBtn"
                        @onClick="openAction" />
             </a-col>
           </a-row>
@@ -80,7 +79,7 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, initData, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { defineComponent, initData, contextMenu, BtnList, _getBtnList } from '@/common/export/table';
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
 import { getLoginStatusEnumItemName } from '@/common/constants/enumsName';
 import { getAccountStatus, handleModalData, handleTableList } from '../setup';
@@ -116,19 +115,15 @@ export default defineComponent({
     },
     setup() {
         const { loading, tableList, queryTable } = queryTableList();
-        const { commonBtn, forDataBtn } = getBtnList('account_info_manager', true, ['新增']);
+        const [firstBtn, secondBtn, thirdBtn] = _getBtnList('account_info_manager', true).value;
         // 新增弹窗
         const { selectedData: addModelData, openAction } = handleModalData<ErmcpLoginUserEx>();
         // 修改 重置密码、详情等弹窗
         const { selectedData: moreModelData, openAction: moreOptenAction } = handleModalData<ErmcpLoginUser>();
         // 处理根据状态显示对应按钮
         function handleBtnAction() {
-            handleTableList(queryTable, tableList, forDataBtn.value);
+            handleTableList(queryTable, tableList, thirdBtn);
         }
-        // 新增角色
-        const { openAction: openAddPermission } = openModal('account_info_manager_btn_permission_add');
-        // 权限设置列表
-        const { openAction: openPermission } = openModal('account_info_manager_btn_permission');
         initData(() => {
             handleBtnAction();
         });
@@ -137,8 +132,9 @@ export default defineComponent({
         function search(value: any) {}
 
         return {
-            commonBtn,
-            forDataBtn,
+            firstBtn,
+            secondBtn,
+            thirdBtn,
             loading,
             search,
             tableList,
@@ -150,8 +146,6 @@ export default defineComponent({
             moreModelData,
             moreOptenAction,
             handleBtnAction,
-            openAddPermission,
-            openPermission,
         };
     },
 });