浏览代码

新增管理员

huangbin 4 年之前
父节点
当前提交
232050f67d

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

@@ -41,6 +41,11 @@ 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_reset: string; // 管理账户 重置密码
+    account_info_manager_btn_locked: string; // 管理账户 锁定
+    account_info_manager_btn_unlocked: string; // 管理账户 解锁
+    account_info_manager_btn_logout: string; // 管理账户 注销
 
     account_info_futures_btn_add: string; // 期货账户 新增
     account_info_futures_btn_modify: string; // 期货账户 修改

+ 2 - 2
src/common/setup/table/button.ts

@@ -67,8 +67,8 @@ export function handleBtnList(list: OperationTabMenu | undefined, menuType: keyo
  * @param hasDetail 操作按钮是否需要详情按钮(详情按钮服务 不配置)
  * @returns 
  */
-export function getBtnList(menuType: keyof ButtonListKey, hasDetail: boolean) {
+export function getBtnList(menuType: keyof ButtonListKey, hasDetail: boolean, commonName: string[] = ['新增']) {
     const data = getThirdMenuData()
     const list = data.find((e) => e.code === menuType);
-    return handleBtnList(list, menuType, hasDetail)
+    return handleBtnList(list, menuType, hasDetail, commonName)
 }

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

@@ -20,42 +20,49 @@
       <a-row :gutter="24">
         <a-col :span="12">
           <a-form-item label="账户权限"
-                       name="">
+                       name="userid">
             <a-select class="inlineFormSelect"
                       style="width: 200px"
+                      v-model:value="formState.userid"
                       placeholder="请选择账户权限">
-              <a-select-option value="权限一">权限一</a-select-option>
+              <a-select-option v-for="(item, index) in tableList"
+                               :key="index"
+                               :value="item.roleid">{{item.rolename}}</a-select-option>
             </a-select>
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="账户名称"
-                       name="">
+                       name="logincode">
             <a-input class="dialogInput"
                      style="width: 200px"
+                     v-model:value="formState.logincode"
                      placeholder="请输入账户名称" />
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="登录账号"
-                       name="">
+                       name="accountname">
             <a-input class="dialogInput"
                      style="width: 200px"
+                     v-model:value="formState.accountname"
                      placeholder="请输入登录账号" />
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="登录密码"
-                       name="">
+                       name="password">
             <a-input-password class="dialogInput"
                               style="width: 200px"
+                              v-model:value="formState.password"
                               placeholder="请输入登录密码" />
           </a-form-item>
         </a-col>
         <a-col :span="24">
           <a-form-item label="手机号码"
-                       name="">
+                       name="mobile">
             <a-input class="dialogInput"
+                     v-model:value="formState.mobile"
                      style="width: 200px"
                      placeholder="请输入手机号码" />
           </a-form-item>
@@ -67,55 +74,38 @@
 
 <script lang="ts">
 import { closeModal } from '@/common/setup/modal/index';
-import { initData } from '@/common/methods/index';
-import { defineComponent, ref, reactive, toRaw, UnwrapRef } from 'vue';
-import { AllEnums } from '@/services/go/commonService/interface';
-import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
+import { defineComponent, ref, PropType } from 'vue';
+import { handleBusinessForm } from '../setup';
+import { ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
+import { validateAction } from '@/common/setup/form';
+import { BusinessFormState } from '../interface';
 
 export default defineComponent({
-    name: 'add-custom',
+    name: 'account_info_manager_btn_add',
     components: {},
+    props: {
+        tableList: {
+            default: [],
+            type: Array as PropType<ErmcpLoginUserEx[]>,
+        },
+    },
     setup() {
         // 控制关闭弹窗
         const { visible, cancel } = closeModal('account_info_manager_btn_add');
-        // 证件类型
-        // const cardTypeList = ref<AllEnums[]>(getCardType());
-        // // 表单
-        // const formRef = ref();
-        // const formState: UnwrapRef<FormState> = reactive(initFormState());
-        // const rules = {
-        //     userinfotype: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
-        //     customername: [{ required: true, message: '请输入企业名称', trigger: 'blur' }],
-        //     nickname: [{ required: true, message: '请输入企业简称', trigger: 'blur' }],
-        //     cardtype: [{ required: true, message: '请选择证件类型', trigger: 'change' }],
-        // };
-        // // 下单方法
-        // const { loading, applyAction } = handleApply();
-        // function isPersonal(): boolean {
-        //     return formState.userinfotype === '1';
-        // }
-        // function submit() {
-        //     formRef.value
-        //         .validate()
-        //         .then(() => {
-        //             const param = toRaw(formState);
-        //             applyAction(param);
-        //             console.log('values', formState);
-        //         })
-        //         .catch((error: ValidateErrorEntity<FormState>) => {
-        //             console.log('error', error);
-        //         });
-        // }
+        const { rules, formState, formRef } = handleBusinessForm();
+        const loading = ref<boolean>(false);
+
+        function submit() {
+            validateAction<BusinessFormState>(formRef, formState).then((res) => {});
+        }
         return {
-            // formState,
-            // rules,
-            // formRef,
-            // cardTypeList,
-            // isPersonal,
+            formState,
+            rules,
+            formRef,
             visible,
             cancel,
-            // submit,
-            // loading,
+            submit,
+            loading,
         };
     },
 });

+ 1 - 0
src/views/information/account_info/compoments/interface.ts

@@ -1,6 +1,7 @@
 
 export interface BusinessFormState {
     logincode: string // 登录账号
+    userid: string | undefined// 登录账号
     accountname: string // 账户名称
     password: string // 登录密码(明文)
     mobile?: string // 手机号码(明文)

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

@@ -73,11 +73,11 @@ import { AllEnums } from '@/services/go/commonService/interface';
 import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
 
 export default defineComponent({
-    name: 'add-custom',
+    name: 'account_info_manager_btn_modify',
     components: {},
     setup() {
         // 控制关闭弹窗
-        const { visible, cancel } = closeModal('account_info_business_btn_modify');
+        const { visible, cancel } = closeModal('account_info_manager_btn_modify');
         // 证件类型
         // const cardTypeList = ref<AllEnums[]>(getCardType());
         // // 表单

+ 3 - 0
src/views/information/account_info/compoments/setup.ts

@@ -11,6 +11,7 @@ export function handleBusinessForm() {
     const formRef = ref();
     const formState: UnwrapRef<BusinessFormState> = reactive({
         logincode: '',
+        userid: undefined,
         accountname: '',
         password: '',
         mobile: '',
@@ -21,6 +22,8 @@ export function handleBusinessForm() {
         logincode: [{ required: true, message: '请输入登录账号', trigger: 'blur' }],
         accountname: [{ required: true, message: '请输入账户名称', trigger: 'blur' }],
         password: [{ required: true, message: '请输入账户密码', trigger: 'blur' }],
+        mobile: [{ required: true, message: '请输入手机号码', trigger: 'blur' }],
+        userid: [{ required: true, message: '请输入账户权限' }],
         roleids: [{ required: true, message: '请选择账号角色', trigger: 'change', type: 'array', }],
         logintaaccounts: [{ required: true, message: '请选择期货账户', trigger: 'change', type: 'array', }],
     }

+ 34 - 10
src/views/information/account_info/list/account_info_manager/index.vue

@@ -33,38 +33,47 @@
           <a-row class="headRow">
             <a-col :span="12">{{item.rolename}}({{item.userlist.length}})</a-col>
             <a-col :span="12">
-              <BtnList :btnList="commonBtn" />
+              <BtnList :selectedData="item"
+                       :btnList="commonBtn"
+                       @onClick="openAction" />
             </a-col>
           </a-row>
         </template>
         <a-collapse class="busyCollapse"
+                    v-for="(sub, i) in item.userlist"
+                    :key="i + '11'"
                     :bordered="false">
           <a-collapse-panel :show-arrow="false">
             <template #header>
-              <a-row class="contRow"
-                     v-for="(sub, i) in item.userlist"
-                     :key="i + '11'">
+              <a-row class="contRow">
                 <a-col :span="12">{{sub.accountname}}-{{sub.logincode}}</a-col>
                 <a-col :span="12">{{getLoginStatusEnumItemName(sub.loginstatus)}}</a-col>
               </a-row>
             </template>
-            <BtnList :btnList="forDataBtn" />
+            <BtnList :btnList="sub.btnList"
+                     :selectedData="sub"
+                     @onClick="moreOptenAction" />
           </a-collapse-panel>
         </a-collapse>
       </a-collapse-panel>
     </a-collapse>
-    <Add />
+    <Add @refresh="handleBtnAction"
+         :tableList="tableList" />
+    <Modify />
   </div>
 </template>
 
 <script lang="ts">
 import { defineComponent, initData, getBtnList, contextMenu, BtnList } from '@/common/export/table';
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
+import { getLoginStatusEnumItemName } from '@/common/constants/enumsName';
 import { ref } from 'vue';
-import { getAccountStatus } from '../setup';
+import { getAccountStatus, handleModalData, handleTableList } from '../setup';
 import { queryTableList } from './setup';
 import { getUserName } from '@/services/bus/user';
 import Add from '../../compoments/add-managers/index.vue';
+import Modify from '../../compoments/modify-managers/index.vue';
+import { ErmcpLoginUser, ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
 
 export default defineComponent({
     name: 'account_info_manager',
@@ -73,12 +82,21 @@ export default defineComponent({
         BtnList,
         filterCustomTable,
         Add,
+        Modify,
     },
     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>();
+        // 修改 重置密码、详情等弹窗
+        const { selectedData: moreModelData, openAction: moreOptenAction } = handleModalData<ErmcpLoginUser>();
+        // 处理根据状态显示对应按钮
+        function handleBtnAction() {
+            handleTableList(queryTable, tableList, forDataBtn.value);
+        }
         initData(() => {
-            queryTable();
+            handleBtnAction();
         });
 
         // 查询
@@ -92,6 +110,12 @@ export default defineComponent({
             tableList,
             getAccountStatus,
             getUserName,
+            getLoginStatusEnumItemName,
+            addModelData,
+            openAction,
+            moreModelData,
+            moreOptenAction,
+            handleBtnAction,
         };
     },
 });
@@ -99,7 +123,7 @@ export default defineComponent({
 
 <style lang="less">
 .account_info_manager {
-  .tltLeft {
+    .tltLeft {
         padding-left: 12px;
     }
     .btn-list {

+ 1 - 1
src/views/information/account_info/list/account_info_manager/setup.ts

@@ -9,7 +9,7 @@ export function queryTableList() {
     // 表格数据
     const tableList = ref<ErmcpLoginUserEx[]>([]);
     function queryTable() {
-        queryResultLoadingAndInfo(QueryAccMgrLoginUser, loading, 3)
+        return queryResultLoadingAndInfo(QueryAccMgrLoginUser, loading, 3)
             .then(res => tableList.value = res)
     }
     return { loading, tableList, queryTable }