访问的路由地址
@@ -94,11 +95,9 @@ import { menuAdd, menuUpdate, getMenuList, getMenuDetail } from '@/api/system/me
import { onMounted, reactive, ref, shallowRef } from 'vue';
import { getModulesKey } from '@/router';
import { arrayToTree, treeToArray, buildTree } from '@/utils/auth';
-import { useLockFn } from '@/utils/useLockFn';
import IconPicker from '@/components/icon/picker.vue';
import * as VueIcon from '@vicons/antd';
import { useMessage, useDialog } from 'naive-ui';
-import { message } from 'ant-design-vue';
import { useModal } from '@/components/Modal';
import { renderIcon } from '@/utils';
/**
@@ -120,7 +119,7 @@ const props = defineProps({
* 定义参数变量
*/
-const [modalRegister, { openModal, closeModal, setSubLoading, setProps }] = useModal({
+const [modalRegister, { openModal, setSubLoading }] = useModal({
title: props.menuId ? '编辑菜单' : "添加菜单",
subBtuText: '确定',
width: 600,
@@ -195,15 +194,17 @@ const getMenu = async () => {
* 执行提交表单
*/
const handleSubmit = async () => {
- await formRef.value?.validate();
- props.menuId ? await menuUpdate(formData) : await menuAdd(formData);
- message.success('操作成功');
- emit('update:visible', false);
- emit('success');
+ formRef.value.validate().then(async () => {
+ props.menuId ? await menuUpdate(formData) : await menuAdd(formData);
+ message.success('操作成功');
+ setSubLoading(false)
+ emit('update:visible', false);
+ emit('success');
+ }).catch((error) => {
+ setSubLoading(false);
+ });
};
-const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit);
-
/**
* 设置表单数据
* @param data 参数
@@ -247,8 +248,6 @@ onMounted(async () => {
});
//导出方法
defineExpose({
- openModal,
- closeModal,
- setProps,
+ openModal
});
diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue
index d5fbf3b..3c5b523 100644
--- a/src/views/system/menu/index.vue
+++ b/src/views/system/menu/index.vue
@@ -29,7 +29,7 @@
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
new file mode 100644
index 0000000..4aa3978
--- /dev/null
+++ b/src/views/system/user/index.vue
@@ -0,0 +1,274 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 新建
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+ 导入
+
+
+
+
+
+
+
+ 导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/user/querySchemas.ts b/src/views/system/user/querySchemas.ts
index 0255288..66b83da 100644
--- a/src/views/system/user/querySchemas.ts
+++ b/src/views/system/user/querySchemas.ts
@@ -1,80 +1,54 @@
import { FormSchema } from '@/components/Form/index';
-
+import { getRoleAllList } from '@/api/system/role';
+export const loadSelectData = async (res) => {
+ //这里可以进行数据转换处理
+ return (await getRoleAllList({ ...res })).map((item, index) => {
+ return {
+ ...item,
+ label: item.name,
+ value: item.id,
+ index,
+ };
+ });
+};
export const schemas: FormSchema[] = [
{
- field: 'username',
+ field: 'realname',
component: 'NInput',
label: '用户名',
componentProps: {
placeholder: '请输入用户名',
},
},
- {
- field: 'account',
- component: 'NInput',
- label: '登录账号',
- componentProps: {
- placeholder: '请输入登录账号',
- },
- },
- {
- field: 'mobile',
- component: 'NInputNumber',
- label: '手机',
- componentProps: {
- placeholder: '请输入手机号码',
- showButton: false,
- },
- },
- {
- field: 'role',
- component: 'NSelect',
- label: '角色',
- componentProps: {
- placeholder: '请选择角色',
- options: [
- {
- label: '普通用户',
- value: 1,
- },
- {
- label: '推广管理员',
- value: 2,
- },
- {
- label: '发货管理员',
- value: 3,
- },
- {
- label: '财务管理员',
- value: 4,
- },
- ],
- },
- },
- {
- field: 'email',
- component: 'NInput',
- label: '邮箱',
- componentProps: {
- placeholder: '请输入邮箱',
- showButton: false,
- },
- },
+ // {
+ // field: 'role',
+ // component: 'BasicSelect',
+ // label: '角色',
+ // componentProps: {
+ // placeholder: '请选择角色',
+ // block:true,
+ // multiple:true,
+ // request: loadSelectData,
+ // onChange: (e: any) => {
+ // console.log(e);
+ // },
+ // },
+ // },
{
field: 'status',
component: 'NSelect',
label: '状态',
componentProps: {
- placeholder: '请选择角色',
+ placeholder: '请选择状态',
+ clearable: true,
options: [
{
label: '正常',
- value: 'normal',
+ value: '1',
},
{
label: '禁用',
- value: 'disable',
+ value: '2',
},
],
},
diff --git a/src/views/system/user/user.vue b/src/views/system/user/user.vue
deleted file mode 100644
index 331854d..0000000
--- a/src/views/system/user/user.vue
+++ /dev/null
@@ -1,229 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 新建
-
-
-
-
-
-
-
-
- 删除
-
-
-
-
-
-
-
- 导入
-
-
-
-
-
-
-
-
- 您确认要删除用户,{{ rowKeysName }} ?
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/system/user/userUpload.vue b/src/views/system/user/userUpload.vue
new file mode 100644
index 0000000..0ecf841
--- /dev/null
+++ b/src/views/system/user/userUpload.vue
@@ -0,0 +1,132 @@
+
+
+
+ {{ dialogTitle }}
+
+
+
+
+
+
+ 点击或将文件拖拽到这里上传
+
+
+
+ 只能上传 xls、xlsx 文件
+ 下载模板
+
+
+
+
+