From 1b0bbe7fbe3d62779356f0729f086ceb3901e17b Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期三, 09 四月 2025 16:39:18 +0800
Subject: [PATCH] feat: 接口
---
src/views/Account/AccountManageList.vue | 154 ++++++++++++++++++++++++++++++---------------------
1 files changed, 90 insertions(+), 64 deletions(-)
diff --git a/src/views/Account/AccountManageList.vue b/src/views/Account/AccountManageList.vue
index 3633a05..77fa4ba 100644
--- a/src/views/Account/AccountManageList.vue
+++ b/src/views/Account/AccountManageList.vue
@@ -5,7 +5,7 @@
<template #query>
<QueryFilterItem>
<SearchInput
- v-model="extraParamState.keyword"
+ v-model="extraParamState.queryCondition"
style="width: 200px"
placeholder="璐﹀彿/濮撳悕/鎵嬫満鍙�"
@on-click-search="getList"
@@ -14,26 +14,20 @@
</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">
</ProTableV2>
</AppContainer>
<AddOrEditAccountDialog v-bind="dialogProps" />
+ <ResetPasswordDialog v-bind="resetPasswordDialogProps"></ResetPasswordDialog>
</LoadingLayout>
</template>
<script setup lang="ts">
import {
ProTableQueryFilterBar,
- OperationBtnType,
ProTableV2,
SearchInput,
LoadingLayout,
@@ -41,25 +35,61 @@
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 userRoleServices from '@/services/api/UserRole';
import { Message, OrderInputType } from '@bole-core/core';
import AddOrEditAccountDialog from './components/AddOrEditAccountDialog.vue';
+import ResetPasswordDialog from './components/ResetPasswordDialog.vue';
import { formatRoleName } from '@/utils';
defineOptions({
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) => handleResetPasswordAdd(),
+ },
+ },
+]);
const BaseState = {
loading: true,
@@ -81,15 +111,15 @@
} = useTable(
async ({ pageIndex, pageSize }, extraParamState) => {
try {
- let params: API.QueryUserPageInput = {
+ let params: API.GetBackClientUsersInput = {
pageModel: {
rows: pageSize,
page: pageIndex,
orderInput: extraParamState.orderInput,
},
- searchKey: extraParamState.keyword,
+ queryCondition: extraParamState.queryCondition,
};
- let res = await userServices.getUserPage(params, {
+ let res = await userRoleServices.getGovermentClientUsers(params, {
showLoading: !state.loading,
});
return res;
@@ -98,31 +128,21 @@
{
defaultExtraParams: {
orderInput: [{ property: 'id', order: OrderInputType.Desc }],
- keyword: '',
+ queryCondition: '',
},
- columnsRenderProps: {
- roleNames: {
- formatter: (row: API.UserListOutput) => row.roleNames.map(formatRoleName).join(','),
- },
- },
+ columnsRenderProps: {},
}
);
-function openDialog(row?: API.UserListOutput) {
+function openDialog(row?: API.UserDto) {
if (row) {
handleEdit({
id: row.id,
userName: row.userName,
name: row.name,
phoneNumber: row.phoneNumber,
- channel: row.channel,
password: '',
- roleName: row.roleNames?.[0] ?? '',
remark: row.remark,
-
- isSendMessage: row?.isSendMessage ?? false,
- sendClaimMessage: row?.sendClaimMessage ?? false,
- sendBillExpireMessage: row?.sendBillExpireMessage ?? false,
});
} else {
handleAdd();
@@ -136,41 +156,47 @@
userName: '',
name: '',
phoneNumber: '',
- channel: '',
password: '',
- roleName: '',
remark: '',
-
- isSendMessage: false,
- sendClaimMessage: false,
- sendBillExpireMessage: false,
},
});
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) {}
}
+
+const {
+ dialogProps: resetPasswordDialogProps,
+ handleAdd: handleResetPasswordAdd,
+ editForm: resetPasswordEditForm,
+} = useFormDialog({
+ onConfirm: handleAddOrEdit,
+ defaultFormParams: {
+ id: '',
+ password: '',
+ },
+});
</script>
--
Gitblit v1.9.1