ソースを参照

Merge remote-tracking branch 'origin/master'

yu.jie 4 年 前
コミット
2d79e4c31e

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

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

+ 3 - 2
src/services/go/ermcp/account/index.ts

@@ -60,9 +60,10 @@ export function QueryFuturesCompany(): Promise<ErmcpFuturesCompany> {
  * @param roleid  角色id(可多个,逗号隔开)
  * @constructor
  */
-export function QueryAccMgrRoleMenu(roleid: string): Promise<ErmcpRoleMenuEx> {
+export function QueryAccMgrRoleMenu(roleid?: string): Promise<ErmcpRoleMenuEx[]> {
     const userid = getUserId()
-    return commonSearch_go('/Ermcp/QueryAccMgrRoleMenu', { roleid, userid }).catch((err) => {
+    const param = roleid ? { roleid, userid } : { userid }
+    return commonSearch_go('/Ermcp/QueryAccMgrRoleMenu', param).catch((err) => {
         throw new Error(`查询账户管理角色详情: ${err.message}`);
     });
 }

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

@@ -0,0 +1,219 @@
+<template>
+  <!-- 新增角色 -->
+  <a-modal class="commonModal add-powers"
+           title="新增角色"
+           v-model:visible="visible"
+           @cancel="cancel"
+           centered
+           :maskClosable="false"
+           width="890px">
+    <template #footer>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="submit">完成</a-button>
+    </template>
+    <a-form class="inlineForm"
+            ref="formRef"
+            :model="formState"
+            :rules="rules">
+      <a-row :gutter="24">
+        <a-col :span="24">
+          <a-form-item label="模板名称"
+                       name="">
+            <a-input class="dialogInput"
+                     style="width: 200px"
+                     placeholder="请输入模板名称" />
+          </a-form-item>
+        </a-col>
+        <a-col :span="24">
+          <a-form-item label="权限功能"
+                       name="">
+          </a-form-item>
+        </a-col>
+        <a-col :span="24">
+          <div class="powerTable">
+            <a-checkbox-group class="commonCheckboxGroup"
+                              v-for="(item, i) in tableList"
+                              :key="i + '0'">
+              <div class="powerRow">
+                <div class="powerLeft">
+                  <a-checkbox :value="item.Menu.resourcecode">{{item.Menu.resourcename}}</a-checkbox>
+                </div>
+                <template v-for="(sub, j) in item.SubMenu"
+                          :key="j + '1'">
+                  <div class="powerMiddle">
+                    <div>
+                      <a-checkbox :value="sub.Menu.resourcecode">{{sub.Menu.resourcename}}</a-checkbox>
+                    </div>
+                  </div>
+                  <div class="powerRight">
+                    <div>
+                      <a-checkbox v-for="(subNext, l) in sub.SubMenu"
+                                  :key="l + '3'"
+                                  :value="subNext.Menu.resourcecode">{{subNext.Menu.resourcename}}</a-checkbox>
+                    </div>
+                  </div>
+                </template>
+              </div>
+            </a-checkbox-group>
+          </div>
+        </a-col>
+      </a-row>
+    </a-form>
+  </a-modal>
+</template>
+
+<script lang="ts">
+import { closeModal } from '@/common/setup/modal/index';
+import { defineComponent, ref, PropType, watchEffect } from 'vue';
+import { handleBusinessForm } from '../setup';
+import { ErmcpLoginUserEx, ErmcpRoleMenuEx } from '@/services/go/ermcp/account/interface';
+import { validateAction } from '@/common/setup/form';
+import { BusinessFormState } from '../interface';
+import { LoginaccountOperateReq, LoginTaaccount } from '@/services/proto/accountinfo/interface';
+import { queryResultLoadingAndInfo, requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { loginAccountOperate } from '@/services/proto/accountinfo';
+import { QueryAccMgrRoleMenu } from '@/services/go/ermcp/account';
+
+export default defineComponent({
+    name: 'account_info_manager_btn_permission_add',
+    setup(props, context) {
+        // 控制关闭弹窗
+        const { visible, cancel } = closeModal('account_info_manager_btn_permission_add');
+        const { rules, formState, formRef } = handleBusinessForm();
+        const loading = ref<boolean>(false);
+        const tableList = ref<ErmcpRoleMenuEx[]>([]);
+        watchEffect(() => {
+            if (visible.value) {
+                queryResultLoadingAndInfo(QueryAccMgrRoleMenu, loading).then((res) => {
+                    tableList.value = res;
+                });
+            }
+        });
+        function submit() {
+            validateAction<BusinessFormState>(formRef, formState).then((res) => {
+                const reqParam: LoginaccountOperateReq = {
+                    operatetype: 3, // uint32 操作类型-1:新增 2:修改 3:新增管理员 4:修改管理员 5:锁定 6:解锁 7:注销 8:恢复 9:重置密码 10:新增登录帐号 11:停用用户 12:恢复用户 13:修改用户信息
+                    logincode: res.logincode, // string 登录账号
+                    accountname: res.accountname, // string 账户名称
+                    password: res.password, // string 登录密码(明文)
+                    mobile: res.mobile, // string 手机号码(明文)
+                    roleids: [Number(res.userid)], // uint64 账号角色
+                    logintaaccounts: [], // LoginTaaccount 期货账户(勾选交易员必填)
+                };
+                requestResultLoadingAndInfo(loginAccountOperate, reqParam, loading, ['新增成功', '新增失败:']).then(() => {
+                    cancel();
+                    context.emit('refresh');
+                });
+            });
+        }
+        return {
+            formState,
+            rules,
+            formRef,
+            visible,
+            cancel,
+            submit,
+            loading,
+            tableList,
+        };
+    },
+});
+</script>
+
+<style lang="less">
+.add-business-info {
+}
+.add-traders {
+}
+.add-managers {
+}
+.add-powers {
+    .powerTable {
+        width: 100%;
+        height: 100%;
+        border: 3px solid @m-grey11;
+        background-color: @m-black12;
+        font-size: 14px;
+        color: @m-white0;
+        .flex;
+        flex-direction: column;
+        .ant-checkbox-group.commonCheckboxGroup .ant-checkbox-wrapper {
+            width: 90px;
+            span + span {
+                margin-right: 0;
+            }
+        }
+        .powerRow {
+            width: 100%;
+            display: inline-flex;
+            border-bottom: 3px solid @m-grey11;
+            div {
+                align-self: center;
+                align-items: center;
+            }
+            .powerLeft {
+                width: 84px;
+                padding: 0 8px;
+            }
+            .powerMiddle {
+                width: 130px;
+                .flex;
+                flex-direction: column;
+                div {
+                    width: 100%;
+                    height: 40px;
+                    line-height: 40px;
+                    padding: 0 8px;
+                    border: 3px solid @m-grey11;
+                    border-top: 0;
+                }
+                div:last-child {
+                    border-bottom: 0;
+                }
+            }
+            .powerRight {
+                flex: 1;
+                .flex;
+                flex-direction: column;
+                div {
+                    width: 100%;
+                    height: 40px;
+                    line-height: 40px;
+                    padding: 0 8px;
+                    justify-content: flex-start;
+                    border-bottom: 3px solid @m-grey11;
+                }
+                div:last-child {
+                    border-bottom: 0;
+                }
+            }
+        }
+    }
+}
+.add-futures {
+}
+.add-futures-son {
+}
+.add-arbitrage {
+    .ant-checkbox-group.commonCheckboxGroup .ant-checkbox-wrapper {
+        width: 100px;
+        span + span {
+            margin-right: 0;
+        }
+    }
+    .ant-checkbox-group.autoWidth {
+        width: 520px;
+        .ant-checkbox-wrapper {
+            width: auto;
+        }
+    }
+    .checkboxGroupItem {
+        .ant-row {
+            margin-bottom: 10px;
+        }
+    }
+}
+</style
+>;

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

@@ -0,0 +1,156 @@
+<template>
+  <!-- 权限设置 -->
+  <a-modal class="commonModal add-powers"
+           title="权限设置"
+           v-model:visible="visible"
+           @cancel="cancel"
+           :loading="loading"
+           centered
+           :maskClosable="false"
+           width="890px">
+    <template #footer>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="cancel">完成</a-button>
+    </template>
+    <a-table :columns="columns"
+             :data-source="tableList"
+             :pagination="false">
+    </a-table>
+  </a-modal>
+</template>
+
+<script lang="ts">
+import { closeModal } from '@/common/setup/modal/index';
+import { defineComponent, ref, watchEffect } from 'vue';
+import { ErmcpRole } from '@/services/go/ermcp/account/interface';
+import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { QueryAccMgrRole } from '@/services/go/ermcp/account';
+
+export default defineComponent({
+    name: 'account_info_manager_btn_permission',
+    setup() {
+        // 控制关闭弹窗
+        const { visible, cancel } = closeModal('account_info_manager_btn_permission');
+        const loading = ref<boolean>(false);
+        const columns = [
+            { title: '角色名称', dataIndex: 'rolename', key: 'rolename' },
+            { title: '创建人', dataIndex: 'modifiername', key: 'modifiername' },
+            { title: '创建时间', dataIndex: 'modifytime', key: 'modifytime' },
+            { title: '状态', dataIndex: 'rolestatus', key: 'rolestatus' },
+        ];
+        const tableList = ref<ErmcpRole[]>([]);
+        watchEffect(() => {
+            if (visible.value) {
+                queryResultLoadingAndInfo(QueryAccMgrRole, loading).then((res) => {
+                    tableList.value = res;
+                });
+            }
+        });
+        return {
+            visible,
+            cancel,
+            loading,
+            tableList,
+            columns,
+        };
+    },
+});
+</script>
+
+<style lang="less">
+.add-business-info {
+}
+.add-traders {
+}
+.add-managers {
+}
+.add-powers {
+    .powerTable {
+        width: 100%;
+        height: 100%;
+        border: 3px solid @m-grey11;
+        background-color: @m-black12;
+        font-size: 14px;
+        color: @m-white0;
+        .flex;
+        flex-direction: column;
+        .ant-checkbox-group.commonCheckboxGroup .ant-checkbox-wrapper {
+            width: 90px;
+            span + span {
+                margin-right: 0;
+            }
+        }
+        .powerRow {
+            width: 100%;
+            display: inline-flex;
+            border-bottom: 3px solid @m-grey11;
+            div {
+                align-self: center;
+                align-items: center;
+            }
+            .powerLeft {
+                width: 84px;
+                padding: 0 8px;
+            }
+            .powerMiddle {
+                width: 130px;
+                .flex;
+                flex-direction: column;
+                div {
+                    width: 100%;
+                    height: 40px;
+                    line-height: 40px;
+                    padding: 0 8px;
+                    border: 3px solid @m-grey11;
+                    border-top: 0;
+                }
+                div:last-child {
+                    border-bottom: 0;
+                }
+            }
+            .powerRight {
+                flex: 1;
+                .flex;
+                flex-direction: column;
+                div {
+                    width: 100%;
+                    height: 40px;
+                    line-height: 40px;
+                    padding: 0 8px;
+                    justify-content: flex-start;
+                    border-bottom: 3px solid @m-grey11;
+                }
+                div:last-child {
+                    border-bottom: 0;
+                }
+            }
+        }
+    }
+}
+.add-futures {
+}
+.add-futures-son {
+}
+.add-arbitrage {
+    .ant-checkbox-group.commonCheckboxGroup .ant-checkbox-wrapper {
+        width: 100px;
+        span + span {
+            margin-right: 0;
+        }
+    }
+    .ant-checkbox-group.autoWidth {
+        width: 520px;
+        .ant-checkbox-wrapper {
+            width: auto;
+        }
+    }
+    .checkboxGroupItem {
+        .ant-row {
+            margin-bottom: 10px;
+        }
+    }
+}
+</style
+>;

+ 17 - 1
src/views/information/account_info/list/account_info_manager/index.vue

@@ -11,7 +11,10 @@
         </svg>
         {{getUserName()}}
       </span>
+      <a-button @click="openPermission">权限设置</a-button>
+      <a-button @click="openAddPermission">新增</a-button>
     </div>
+
     <a-collapse class="spotCollapse"
                 v-for="(item, i) in tableList"
                 :key="i + '11'"
@@ -71,6 +74,8 @@
     <Reset @refresh="handleBtnAction"
            :selectedData="moreModelData" />
     <Detail :selectedData="moreModelData" />
+    <AddPermission />
+    <Permission />
   </div>
 </template>
 
@@ -88,7 +93,10 @@ import Cancel from '../../compoments/cancel-managers/index.vue';
 import Locked from '../../compoments/locked-managers/index.vue';
 import Unlocked from '../../compoments/unlocked-managers/index.vue';
 import Reset from '../../compoments/reset-managers/index.vue';
+import AddPermission from '../../compoments/add-managers-permission/index.vue';
+import Permission from '../../compoments/managers-permission/index.vue';
 import { ErmcpLoginUser, ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
+import { openModal } from '@/common/setup/modal';
 
 export default defineComponent({
     name: 'account_info_manager',
@@ -103,10 +111,12 @@ export default defineComponent({
         Locked,
         Unlocked,
         Reset,
+        AddPermission,
+        Permission,
     },
     setup() {
         const { loading, tableList, queryTable } = queryTableList();
-        const { commonBtn, forDataBtn } = getBtnList('account_info_manager', true, ['权限设置', '新增']);
+        const { commonBtn, forDataBtn } = getBtnList('account_info_manager', true, ['新增']);
         // 新增弹窗
         const { selectedData: addModelData, openAction } = handleModalData<ErmcpLoginUserEx>();
         // 修改 重置密码、详情等弹窗
@@ -115,6 +125,10 @@ export default defineComponent({
         function handleBtnAction() {
             handleTableList(queryTable, tableList, forDataBtn.value);
         }
+        // 新增角色
+        const { openAction: openAddPermission } = openModal('account_info_manager_btn_permission_add');
+        // 权限设置列表
+        const { openAction: openPermission } = openModal('account_info_manager_btn_permission');
         initData(() => {
             handleBtnAction();
         });
@@ -136,6 +150,8 @@ export default defineComponent({
             moreModelData,
             moreOptenAction,
             handleBtnAction,
+            openAddPermission,
+            openPermission,
         };
     },
 });