From 55dc8d799de193e682e97e5333b6baa9a0e26361 Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期四, 03 四月 2025 15:49:49 +0800 Subject: [PATCH] feat: init --- src/views/Account/AccountManageList.vue | 148 +++++++++++++++++++++++++++++-------------------- 1 files changed, 87 insertions(+), 61 deletions(-) diff --git a/src/views/Account/AccountManageList.vue b/src/views/Account/AccountManageList.vue index 3633a05..c4a301b 100644 --- a/src/views/Account/AccountManageList.vue +++ b/src/views/Account/AccountManageList.vue @@ -14,13 +14,7 @@ </QueryFilterItem> </template> <template #btn> - <el-button - v-if="checkSubModuleItemShow('pageButton', 'addBtn')" - @click="openDialog()" - icon="Plus" - type="primary" - >鏂板</el-button - > + <el-button @click="openDialog()" icon="Plus" type="primary">鏂板</el-button> </template> </ProTableQueryFilterBar> <ProTableV2 v-bind="proTableProps" :columns="column" :operationBtns="operationBtns"> @@ -33,7 +27,6 @@ <script setup lang="ts"> import { ProTableQueryFilterBar, - OperationBtnType, ProTableV2, SearchInput, LoadingLayout, @@ -41,10 +34,9 @@ QueryFilterItem, useTable, useFormDialog, + defineOperationBtns, } from '@bole-core/components'; -import { useAccess } from '@/hooks'; -import * as userServices from '@/services/api/User'; -import { RoleClientType } from '@/constants'; +import * as accountServices from '@/services/api/Account'; import { Message, OrderInputType } from '@bole-core/core'; import AddOrEditAccountDialog from './components/AddOrEditAccountDialog.vue'; import { formatRoleName } from '@/utils'; @@ -53,13 +45,49 @@ name: 'AccountManageList', }); -const operationBtnMap: Record<string, OperationBtnType> = { - editBtn: { emits: { onClick: (role) => openDialog(role) } }, -}; +const column: API.CustomModuleColumnDto[] = [ + { + id: '1', + enCode: 'changeFlag', + name: '璐﹀彿', + }, + { + id: '2', + enCode: 'name', + name: '濮撳悕', + }, + { + id: '3', + enCode: 'idNumber', + name: '鎵嬫満鍙�', + }, + { + id: '4', + enCode: 'workType', + name: '澶囨敞', + }, +]; -const { checkSubModuleItemShow, column, operationBtns } = useAccess({ - operationBtnMap, -}); +const operationBtns = defineOperationBtns([ + { + data: { + enCode: 'editBtn', + name: '缂栬緫', + }, + emits: { + onClick: (role) => openDialog(role), + }, + }, + { + data: { + enCode: 'resetPasswordBtn', + name: '閲嶇疆瀵嗙爜', + }, + emits: { + onClick: (role) => handleResetPassword(), + }, + }, +]); const BaseState = { loading: true, @@ -80,35 +108,31 @@ reset, } = useTable( async ({ pageIndex, pageSize }, extraParamState) => { - try { - let params: API.QueryUserPageInput = { - pageModel: { - rows: pageSize, - page: pageIndex, - orderInput: extraParamState.orderInput, - }, - searchKey: extraParamState.keyword, - }; - let res = await userServices.getUserPage(params, { - showLoading: !state.loading, - }); - return res; - } catch (error) {} + // try { + // let params: API.QueryUserPageInput = { + // pageModel: { + // rows: pageSize, + // page: pageIndex, + // orderInput: extraParamState.orderInput, + // }, + // searchKey: extraParamState.keyword, + // }; + // let res = await userServices.getUserPage(params, { + // showLoading: !state.loading, + // }); + // return res; + // } catch (error) {} }, { defaultExtraParams: { orderInput: [{ property: 'id', order: OrderInputType.Desc }], keyword: '', }, - columnsRenderProps: { - roleNames: { - formatter: (row: API.UserListOutput) => row.roleNames.map(formatRoleName).join(','), - }, - }, + columnsRenderProps: {}, } ); -function openDialog(row?: API.UserListOutput) { +function openDialog(row?: any) { if (row) { handleEdit({ id: row.id, @@ -148,29 +172,31 @@ }); async function handleAddOrEdit() { - try { - let isEdit = !!editForm.id; - let params: API.CreateAccountInput = { - name: editForm.name, - userName: editForm.userName, - remark: editForm.remark, - password: editForm.password, - phoneNumber: editForm.phoneNumber, - channel: editForm.channel, - // clientId: RoleClientType.RoleBackendClientId, - roleNames: [editForm.roleName], - }; - let res; - if (isEdit) { - (params as API.UpdateAccountInput).id = editForm.id; - res = await userServices.updateAccount(params); - } else { - res = await userServices.createAccount(params); - } - if (res) { - Message.successMessage('鎿嶄綔鎴愬姛'); - getList(isEdit ? paginationState.pageIndex : 1); - } - } catch (error) {} + // try { + // let isEdit = !!editForm.id; + // let params: API.CreateAccountInput = { + // name: editForm.name, + // userName: editForm.userName, + // remark: editForm.remark, + // password: editForm.password, + // phoneNumber: editForm.phoneNumber, + // channel: editForm.channel, + // // clientId: RoleClientType.RoleBackendClientId, + // roleNames: [editForm.roleName], + // }; + // let res; + // if (isEdit) { + // (params as API.UpdateAccountInput).id = editForm.id; + // res = await accountServices.updateAccount(params); + // } else { + // res = await accountServices.createAccount(params); + // } + // if (res) { + // Message.successMessage('鎿嶄綔鎴愬姛'); + // getList(isEdit ? paginationState.pageIndex : 1); + // } + // } catch (error) {} } + +function handleResetPassword() {} </script> -- Gitblit v1.9.1