diff --git a/src/api/common/data/entity/index.ts b/src/api/common/data/entity/index.ts
index bb5ba68..0716e6c 100644
--- a/src/api/common/data/entity/index.ts
+++ b/src/api/common/data/entity/index.ts
@@ -6,6 +6,8 @@
* @create: 2022/4/8
*/
+import { BaseEntity } from '/@/api/common/base/entity';
+
/** 分页模型 */
export interface Page {
size: number;
@@ -15,7 +17,7 @@ export interface Page {
}
/** 通用模型 */
-export interface CommonEntity {
+export interface CommonEntity extends BaseEntity {
createById: string;
createByName: string;
createTime: string;
diff --git a/src/api/platform/system/controller/ssoUser.ts b/src/api/platform/system/controller/ssoUser.ts
new file mode 100644
index 0000000..b65e1dc
--- /dev/null
+++ b/src/api/platform/system/controller/ssoUser.ts
@@ -0,0 +1,31 @@
+/**
+ * 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致
+ * Copyright © 2023-2023 海豚生态开源社区 All rights reserved.
+ * author wangxiang4
+ */
+import type { SsoUserParams, SsoUser ,SsoUserResult } from '/@/api/platform/system/entity/ssoUser';
+import { defHttp } from '/@/utils/http/axios';
+
+enum Api {
+ list = '/system_proxy/system/ssoUser/list',
+ add = '/system_proxy/system/ssoUser/save',
+ get = '/system_proxy/system/ssoUser',
+ edit = '/system_proxy/system/ssoUser/update',
+ del = '/system_proxy/system/ssoUser/remove',
+ updatePwd = '/system_proxy/system/ssoUser/updatePwd',
+ resetPwd='/system_proxy/system/ssoUser/resetPwd',
+}
+
+export const listSsoUser = (params?: Partial) => defHttp.get({ url: Api.list, params }, { isReturnResultResponse: true });
+
+export const addSsoUser = (params: Partial) => defHttp.post({ url: Api.add, data: params });
+
+export const editSsoUser = (params: Partial) => defHttp.put({ url: Api.edit, data: params });
+
+export const getSsoUser = (id: string) => defHttp.get({ url: `${Api.get}/${id}` });
+
+export const delSsoUser = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` });
+
+export const updatePwd = (params: Partial) => defHttp.put({ url: Api.updatePwd, params });
+
+export const resetPwd = (params: Partial) => defHttp.put({ url: Api.resetPwd, data: params });
diff --git a/src/api/platform/system/entity/ssoUser.ts b/src/api/platform/system/entity/ssoUser.ts
new file mode 100644
index 0000000..b6f5a37
--- /dev/null
+++ b/src/api/platform/system/entity/ssoUser.ts
@@ -0,0 +1,37 @@
+/**
+ * @program: kicc-ui
+ * @description: SSO用户统一实体类
+ * 类型定义
+ * @author: wangxiang4
+ * @create: 2022/4/8
+ */
+import type { R } from '/#/axios';
+import type { Page } from '/@/api/common/data/entity';
+import { CommonEntity } from '/@/api/common/data/entity';
+export type SsoUserParams = Page & SsoUser;
+
+export interface SsoUser extends CommonEntity {
+ // 用户id
+ id: string;
+ // 用户名
+ userName: string;
+ // 昵称
+ nickName: string;
+ // 头像
+ avatar: string;
+ // 邮箱
+ email: string;
+ // 手机号
+ phone: string;
+ // 用户密码
+ password: string;
+ // 用户性别
+ sex: string;
+ // 最后登陆IP
+ loginIp: string;
+ // 最后登陆时间
+ loginTime: string;
+ [key: string]: any;
+}
+
+export type SsoUserResult = R;
diff --git a/src/views/system/user/sso/ResetPwdModal.vue b/src/views/system/user/sso/ResetPwdModal.vue
new file mode 100644
index 0000000..5acc970
--- /dev/null
+++ b/src/views/system/user/sso/ResetPwdModal.vue
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
diff --git a/src/views/system/user/sso/SsoModal.vue b/src/views/system/user/sso/SsoModal.vue
index 0d36ad4..87b3445 100644
--- a/src/views/system/user/sso/SsoModal.vue
+++ b/src/views/system/user/sso/SsoModal.vue
@@ -5,7 +5,23 @@
@ok="handleSubmit"
@register="registerModal"
>
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/user/sso/index.vue b/src/views/system/user/sso/index.vue
index d4b25ef..0605c0f 100644
--- a/src/views/system/user/sso/index.vue
+++ b/src/views/system/user/sso/index.vue
@@ -15,41 +15,41 @@
@click="handleEdit()"
>修改用户
删除用户
-
+
+
+
+
-
+
@@ -58,19 +58,18 @@
/**
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致
* 采用vben-动态表格表单封装组件编写,不采用 setup 写法
- * Copyright © 2020-2022 entfrm All rights reserved.
+ * Copyright © 2023-2023 海豚生态开源社区 All rights reserved.
* author wangxiang4
*/
import { defineComponent, reactive, toRaw } from 'vue';
- import { BasicTable, useTable, TableAction } from '/@/components/Table';
- import { listUser, delUser } from '/@/api/platform/system/controller/user';
+ import { BasicTable, useTable, TableAction, TableImg } from '/@/components/Table';
+ import { listSsoUser, delSsoUser } from '/@/api/platform/system/controller/ssoUser';
import ResetPwdModal from './ResetPwdModal.vue';
import { useModal } from '/@/components/Modal';
- import UserModal from './UserModal.vue';
+ import SsoModal from './SsoModal.vue';
import { columns, searchFormSchema } from './sso.data';
import { useMessage } from '/@/hooks/web/useMessage';
- /** 类型规范统一声明定义区域 */
interface TableState {
ids: string[];
single: boolean;
@@ -78,11 +77,12 @@
}
export default defineComponent({
- name: 'SsoUserManagement',
+ name: 'SSOUserManagement',
components: {
+ TableImg,
BasicTable,
TableAction,
- UserModal,
+ SsoModal,
ResetPwdModal,
},
setup() {
@@ -98,7 +98,7 @@
const [registerModal, { openModal }] = useModal();
const [registerResetPwdModal, { openModal: openResetPwdModal }] = useModal();
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
- api: listUser,
+ api: listSsoUser,
rowKey: 'id',
columns,
formConfig: {
@@ -146,7 +146,6 @@
/** 处理重置用户密码 */
function handleResetPassword(record: Recordable) {
- record = record || { id: toRaw(state.ids) };
openResetPwdModal(true, { record });
}
@@ -158,7 +157,7 @@
title: '警告',
content: `是否确认删除用户编号为${ids}用户吗?`,
onOk: async () => {
- await delUser(ids);
+ await delSsoUser(ids);
createMessage.success('删除成功!');
handleRefreshTable();
}
diff --git a/src/views/system/user/sso/sso.data.ts b/src/views/system/user/sso/sso.data.ts
index 5cb369b..d4962c3 100644
--- a/src/views/system/user/sso/sso.data.ts
+++ b/src/views/system/user/sso/sso.data.ts
@@ -1,81 +1,52 @@
-/**
- * @program: kicc-ui
- * @description: 用户模块动态渲染配置
- * @author: wangxiang4
- * @create: 2022/4/21
- */
-
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
-import { Switch } from 'ant-design-vue';
+import {Switch, Tag} from 'ant-design-vue';
import { listRole } from '/@/api/platform/system/controller/role';
import { changeStatus } from '/@/api/platform/system/controller/user';
import { useMessage } from '/@/hooks/web/useMessage';
import { getUserTypeList } from '/@/api/platform/system/controller/user';
import { SystemUserType } from '/@/enums/permissionEnum';
-/** 通用变量统一声明区域 */
-const { createConfirm } = useMessage();
-
/** 表格列配置 */
export const columns: BasicColumn[] = [
{
- title: '用户名称',
+ title: '用户名',
dataIndex: 'userName',
width: 120
},
{
- title: '用户昵称',
+ title: '昵称',
dataIndex: 'nickName',
width: 120
},
{
- title: '机构名称',
- dataIndex: 'deptName',
+ title: '邮箱',
+ dataIndex: 'phone',
width: 200
},
{
- title: '手机号码',
+ title: '手机号',
dataIndex: 'phone',
width: 200
},
{
- title: '状态',
- dataIndex: 'status',
- width: 120,
+ title: '性别',
+ dataIndex: 'sex',
+ width: 80,
customRender: ({ record }) => {
- // 设置请求加载状态标识
- if (!Reflect.has(record, 'pendingStatus')) {
- record.pendingStatus = false;
- }
- return h(Switch, {
- checked: record.status === '0',
- checkedChildren: '已启用',
- unCheckedChildren: '已禁用',
- loading: record.pendingStatus,
- onChange(checked: boolean) {
- const text = checked ? '启用' : '停用';
- createConfirm({
- iconType: 'warning',
- title: '警告',
- content: `确认要"${text}${record.userName}用户吗?`,
- onOk: async () => {
- record.pendingStatus = true;
- const newStatus = checked ? '0' : '1';
- const { createMessage } = useMessage();
- changeStatus(record.id, newStatus).then(() => {
- record.status = newStatus;
- createMessage.success(`${text}成功`);
- }).catch(() => {
- createMessage.error(`${text}失败`);
- }).finally(() => record.pendingStatus = false);
- }
- });
- }
- });
+ const sex = record.sex;
+ const enable = ~~sex === 0;
+ const color = enable ? '#6AB5F9' : '#F087BD';
+ const text = enable ? '男' : '女';
+ return h(Tag, { color: color }, () => text);
}
},
+ {
+ title: '头像',
+ dataIndex: 'avatar',
+ width: 120,
+ },
{
title: '创建时间',
dataIndex: 'createTime',
@@ -116,8 +87,8 @@ export const userFormSchema: FormSchema[] = [
show: false
},
{
- field: 'nickName',
- label: '用户昵称',
+ field: 'userName',
+ label: '用户名',
component: 'Input',
required: true,
colProps: {
@@ -125,29 +96,39 @@ export const userFormSchema: FormSchema[] = [
}
},
{
- field: 'avatar',
- label: '头像',
+ field: 'nickName',
+ label: '用户昵称',
component: 'Input',
- defaultValue: 'https://godolphinx.org/dolphin1024x1024.png',
- show: false
- },
- {
- field: 'deptId',
- label: '归属机构',
- component: 'TreeSelect',
- componentProps: {
- fieldNames: {
- label: 'name',
- key: 'deptId',
- value: 'deptId'
- },
- getPopupContainer: () => document.body
- },
required: true,
colProps: {
span: 12
}
},
+ {
+ field: 'password',
+ label: '密码',
+ component: 'InputPassword',
+ colProps: {
+ span: 12
+ },
+ rules: [
+ {
+ required: true,
+ whitespace: true,
+ message: '请输入密码!',
+ },
+ {
+ pattern: new RegExp('[^\\u4e00-\\u9fa5]+'),
+ type: 'string',
+ message: '密码不能输入汉字!',
+ },
+ {
+ min: 6,
+ max: 32,
+ message: '长度必需在6-32之间!',
+ }
+ ]
+ },
{
field: 'phone',
label: '手机号',
@@ -180,40 +161,6 @@ export const userFormSchema: FormSchema[] = [
}
]
},
- {
- field: 'userName',
- label: '用户名',
- component: 'Input',
- required: true,
- colProps: {
- span: 12
- }
- },
- {
- field: 'password',
- label: '密码',
- component: 'InputPassword',
- colProps: {
- span: 12
- },
- rules: [
- {
- required: true,
- whitespace: true,
- message: '请输入密码!',
- },
- {
- pattern: new RegExp('[^\\u4e00-\\u9fa5]+'),
- type: 'string',
- message: '密码不能输入汉字!',
- },
- {
- min: 6,
- max: 32,
- message: '长度必需在6-32之间!',
- }
- ]
- },
{
field: 'sex',
label: '性别',
@@ -230,77 +177,8 @@ export const userFormSchema: FormSchema[] = [
}
},
{
- field: 'status',
- label: '状态',
- component: 'RadioGroup',
- defaultValue: '0',
- componentProps: {
- options: [
- { label: '正常', value: '0' },
- { label: '停用', value: '1' }
- ]
- },
- colProps: {
- span: 12
- }
- },
- {
- field: 'roleIds',
- label: '授权角色',
- component: 'ApiSelect',
- required: true,
- componentProps: {
- mode: 'multiple',
- api: listRole,
- labelField: 'name',
- valueField: 'id',
- resultField: 'data'
- },
- colProps: {
- span: 12
- }
- },
- {
- field: 'userType',
- label: '用户类型',
- component: 'ApiSelect',
- required: true,
- componentProps: {
- api: getUserTypeList,
- resultField: 'data'
- },
- colProps: {
- span: 12
- }
- },
- {
- field: 'mapCenter',
- label: '地图中心点',
- component: 'Input',
- required: true,
- colProps: {
- span: 12
- },
- ifShow: ({values}) => values.userType == SystemUserType.CUSTOMER_SERVICE
- },
- {
- field: 'mapOrientation',
- label: '图片旋转值',
- component: 'InputNumber',
- defaultValue: 0,
- componentProps: {
- style: { width:'100%' },
- min: 0
- },
- colProps: {
- span: 12
- },
- ifShow: ({ values }) => values.userType == SystemUserType.CUSTOMER_SERVICE,
- required: true,
- },
- {
- label: '备注',
field: 'remarks',
+ label: '备注',
component: 'InputTextArea',
componentProps: {
rows: 6