Commit 81f1707e authored by 罗林杰's avatar 罗林杰

修改用户管理

parent 67a998bd
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
:content="`账号:${userName}     :content="`账号:${userName}    
姓名:${name}     姓名:${name}    
邮箱:${email}     邮箱:${email}    
创建时间:${createDate}     创建时间:${createDate}    `"
所属机构:${dept}`"
class="content-padding" class="content-padding"
contentBackground contentBackground
@back="goBack" @back="goBack"
...@@ -67,14 +66,13 @@ ...@@ -67,14 +66,13 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref } from 'vue'; import { onMounted, reactive, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { PageWrapper } from '@/components/Page'; import { PageWrapper } from '@/components/Page';
import { useGo } from '@/hooks/web/usePage'; import { useGo } from '@/hooks/web/usePage';
import { useTabs } from '@/hooks/web/useTabs'; import { useTabs } from '@/hooks/web/useTabs';
import { Tabs } from 'ant-design-vue'; import { Tabs } from 'ant-design-vue';
import { BasicTable, TableAction, useTable } from '@/components/Table'; import { BasicTable, TableAction, useTable } from '@/components/Table';
import { deleteUser, getAccountList } from '@/api/system/user/user';
import { useMessage } from '@/hooks/web/useMessage'; import { useMessage } from '@/hooks/web/useMessage';
import { useModal } from '@/components/Modal'; import { useModal } from '@/components/Modal';
import AccountModal from '@/views/system/user/AccountModal.vue'; import AccountModal from '@/views/system/user/AccountModal.vue';
...@@ -83,12 +81,26 @@ ...@@ -83,12 +81,26 @@
groupColumns, groupColumns,
searchDetailFormSchema, searchDetailFormSchema,
} from '@/views/system/user/account.data'; } from '@/views/system/user/account.data';
import { roleData } from '@/views/system/user/userData';
defineOptions({ name: 'AccountDetail' }); defineOptions({ name: 'AccountDetail' });
const [registerTable, { reload, updateTableDataRecord, getForm }] = useTable({ const [registerTable, { reload, updateTableDataRecord, getForm }] = useTable({
title: '角色列表', title: '角色列表',
api: getAccountList, api: async () => {
const response = {
pageNu: '1',
pageSize: '10',
pages: '1',
total: tableData.value.length,
code: '',
message: '',
data: [],
};
//过滤data中的数据,取出等于params.deptId的数据
var data = tableData.value;
return { ...response, data: data };
},
columns: detailColumns, columns: detailColumns,
formConfig: { formConfig: {
labelWidth: 100, labelWidth: 100,
...@@ -108,7 +120,19 @@ ...@@ -108,7 +120,19 @@
}); });
const [registerGroupTable, { reloadGroup, getGroupForm }] = useTable({ const [registerGroupTable, { reloadGroup, getGroupForm }] = useTable({
title: '工作组角色列表', title: '工作组角色列表',
api: getAccountList, api: async () => {
const response = {
pageNu: '1',
pageSize: '10',
pages: '1',
total: tableData.value.length,
code: '',
message: '',
data: [],
};
var data = tableData.value;
return { ...response, data: data };
},
columns: groupColumns, columns: groupColumns,
formConfig: { formConfig: {
labelWidth: 100, labelWidth: 100,
...@@ -122,7 +146,6 @@ ...@@ -122,7 +146,6 @@
width: 80, width: 80,
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
// slots: { customRender: 'action' },
fixed: undefined, fixed: undefined,
}, },
}); });
...@@ -131,7 +154,7 @@ ...@@ -131,7 +154,7 @@
const searchInfo = reactive<Recordable>({}); const searchInfo = reactive<Recordable>({});
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const tableData = ref([]);
const ATabs = Tabs; const ATabs = Tabs;
const ATabPane = Tabs.TabPane; const ATabPane = Tabs.TabPane;
const route = useRoute(); const route = useRoute();
...@@ -141,7 +164,6 @@ ...@@ -141,7 +164,6 @@
const name = ref(route.query.name); const name = ref(route.query.name);
const email = ref(route.query.email); const email = ref(route.query.email);
const createDate = ref(route.query.createDate); const createDate = ref(route.query.createDate);
const dept = ref(route.query.dept);
const currentKey = ref('global'); const currentKey = ref('global');
const { setTitle } = useTabs(); const { setTitle } = useTabs();
// 设置Tab的标题(不会影响页面标题) // 设置Tab的标题(不会影响页面标题)
...@@ -149,8 +171,6 @@ ...@@ -149,8 +171,6 @@
/** 删除按钮*/ /** 删除按钮*/
function handleDelete(record: Recordable) { function handleDelete(record: Recordable) {
console.log(record);
deleteUser({ id: record.businessId });
createMessage.success('删除成功!'); createMessage.success('删除成功!');
reload(); reload();
} }
...@@ -178,6 +198,9 @@ ...@@ -178,6 +198,9 @@
// 本例的效果时点击返回始终跳转到账号列表页,实际应用时可返回上一页 // 本例的效果时点击返回始终跳转到账号列表页,实际应用时可返回上一页
go('/system/user'); go('/system/user');
} }
onMounted(() => {
tableData.value = roleData;
});
</script> </script>
<style></style> <style></style>
...@@ -127,23 +127,13 @@ export const resetPasswordFormSchema: any[] = [ ...@@ -127,23 +127,13 @@ export const resetPasswordFormSchema: any[] = [
// ifShow: false, // ifShow: false,
}, },
]; ];
function passwordCheck(rule, value, callback) { const passwordCheck = (rule, value, callback) => {
const hasUpperCase = /[A-Z]/.test(value); const pattern = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/;
const hasLowerCase = /[a-z]/.test(value); if (!pattern.test(value)) {
const hasNumber = /\d/.test(value); callback(new Error('新密码必须为数字与字母的组合'));
const hasSpecialChar = /[~`!@#$%^&*()_\-={}\[\]\\|;:"'<,>.?\/]/.test(value);
// 检查密码组成
let count = 0;
if (hasUpperCase) count++;
if (hasLowerCase) count++;
if (hasNumber) count++;
if (hasSpecialChar) count++;
if (count < 3) {
return callback(new Error('密码中需至少包含大写字母、小写字母、数字及特殊字符中的 3 种'));
} }
// 如果所有检查都通过,则调用callback无参数表示验证成功
callback(); callback();
} };
export const accountFormSchema: any[] = [ export const accountFormSchema: any[] = [
{ {
field: 'username', field: 'username',
...@@ -166,7 +156,7 @@ export const accountFormSchema: any[] = [ ...@@ -166,7 +156,7 @@ export const accountFormSchema: any[] = [
required: true, required: true,
message: '请输入用户密码', message: '请输入用户密码',
}, },
{ min: 8, max: 25, message: '长度在 8 到 25 个字符', trigger: 'blur' }, { min: 8, max: 16, message: '长度在 8 到 16 个字符', trigger: 'blur' },
{ {
validator: passwordCheck, validator: passwordCheck,
trigger: 'blur', trigger: 'blur',
...@@ -277,7 +267,6 @@ export const accountFormSchema: any[] = [ ...@@ -277,7 +267,6 @@ export const accountFormSchema: any[] = [
}, },
]; ];
export const searchDetailFormSchema: FormSchema[] = [ export const searchDetailFormSchema: FormSchema[] = [
{ {
field: 'username', field: 'username',
...@@ -290,24 +279,24 @@ export const searchDetailFormSchema: FormSchema[] = [ ...@@ -290,24 +279,24 @@ export const searchDetailFormSchema: FormSchema[] = [
export const detailColumns: BasicColumn[] = [ export const detailColumns: BasicColumn[] = [
{ {
title: '角色名称', title: '角色名称',
dataIndex: 'roleNames', dataIndex: 'roleName',
width: 200, width: 200,
}, },
{ {
title: '角色描述', title: '角色描述',
dataIndex: 'phone', dataIndex: 'remark',
width: 200, width: 200,
}, },
]; ];
export const groupColumns: BasicColumn[] = [ export const groupColumns: BasicColumn[] = [
{ {
title: '工作区名称', title: '工作区名称',
dataIndex: 'username', dataIndex: 'workspaceName',
width: 200, width: 200,
}, },
{ {
title: '赋予角色', title: '赋予角色',
dataIndex: 'phone', dataIndex: 'roleName',
width: 200, width: 200,
}, },
]; ];
...@@ -165,7 +165,6 @@ ...@@ -165,7 +165,6 @@
name: record.name, name: record.name,
email: record.email, email: record.email,
createDate: record.createDate, createDate: record.createDate,
dept: record.deptName
}, },
}); });
} }
......
export const roleData: any[] = [
{
delFlag: '0',
flag: '1',
businessId: 101,
roleName: '超级管理员',
parentId: 0,
'code:': '001',
ancestors: '0',
orderNum: 1,
selectType: null,
createTime: '2024-10-24 10:04:04',
createBy: 'admin',
remark: '超级管理员',
workspaceName: '数据平台治理部',
},
{
delFlag: '0',
flag: '1',
businessId: 102,
roleName: '一级用户',
parentId: 101,
'code:': '002',
ancestors: '0,101',
orderNum: 2,
selectType: null,
createTime: '2024-10-24 10:04:04',
createBy: 'admin',
remark: '一级用户',
workspaceName: '数据平台治理部',
},
{
delFlag: '0',
flag: '1',
businessId: 103,
roleName: '二级用户',
parentId: 101,
'code:': '003',
ancestors: '0,101',
orderNum: 3,
selectType: null,
createTime: '2024-10-24 10:04:04',
createBy: 'admin',
remark: '二级用户',
workspaceName: '数据平台治理部',
},
{
delFlag: '0',
flag: '1',
businessId: 104,
roleName: '三级用户',
parentId: 101,
'code:': '004',
ancestors: '0,101',
orderNum: 4,
selectType: null,
createTime: '2024-10-24 10:04:04',
createBy: 'admin',
remark: '三级用户',
workspaceName: '数据平台治理部',
},
{
delFlag: '0',
flag: '1',
businessId: 105,
roleName: '四级用户',
parentId: 101,
'code:': '005',
ancestors: '0,101',
orderNum: 5,
selectType: null,
createTime: '2024-10-24 10:04:04',
createBy: 'admin',
remark: '四级用户',
workspaceName: '数据平台治理部',
},
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment