From ef8dcd3cbaf66eab5ccde06ddd9bf4186d8ded02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=BA=A2=E4=B8=BD?= <1181930680@qq.com> Date: Thu, 14 Nov 2024 11:26:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Editor/tinymce.vue | 225 ++++++++++---------- src/components/Upload/Image.vue | 3 + src/components/Upload/Images.vue | 4 + src/components/Upload/file.vue | 3 + src/plugins/customComponents.ts | 4 + src/views/system/menu/edit.vue | 31 ++- src/views/system/menu/index.vue | 8 +- src/views/system/user/columns.ts | 121 +++++++---- src/views/system/user/edit.vue | 287 ++++++++++++++++++++++++++ src/views/system/user/index.vue | 274 ++++++++++++++++++++++++ src/views/system/user/querySchemas.ts | 88 +++----- src/views/system/user/user.vue | 229 -------------------- src/views/system/user/userUpload.vue | 132 ++++++++++++ 13 files changed, 944 insertions(+), 465 deletions(-) create mode 100644 src/views/system/user/edit.vue create mode 100644 src/views/system/user/index.vue delete mode 100644 src/views/system/user/user.vue create mode 100644 src/views/system/user/userUpload.vue diff --git a/src/components/Editor/tinymce.vue b/src/components/Editor/tinymce.vue index 6a4bc37..44a9823 100644 --- a/src/components/Editor/tinymce.vue +++ b/src/components/Editor/tinymce.vue @@ -1,58 +1,56 @@ - + diff --git a/src/components/Upload/Image.vue b/src/components/Upload/Image.vue index 9a6c12b..23cd88c 100644 --- a/src/components/Upload/Image.vue +++ b/src/components/Upload/Image.vue @@ -170,12 +170,14 @@ import { useNotification } from 'naive-ui' if (!imgType) notification.warning({ content: '温馨提示', + duration:2000, meta: '上传图片不符合所需的格式!', }); if (!imgSize) setTimeout(() => { notification.warning({ content: '温馨提示', + duration:2000, meta: `上传图片大小不能超过 ${props.fileSize}M!`, }); }, 0); @@ -188,6 +190,7 @@ import { useNotification } from 'naive-ui' const uploadError = () => { notification.error({ content: '温馨提示', + duration:2000, meta: '图片上传失败,请您重新上传!', }); }; diff --git a/src/components/Upload/Images.vue b/src/components/Upload/Images.vue index e9b0676..a59d95e 100644 --- a/src/components/Upload/Images.vue +++ b/src/components/Upload/Images.vue @@ -165,6 +165,7 @@ import { useNotification } from 'naive-ui' } catch (error) { notification.error({ message: '温馨提示', + duration:2000, description: '上传文件失败!', }); if (props.multiple) { @@ -209,6 +210,7 @@ const handleUploadChange= (data: { fileList: UploadFileInfo[] })=> { if (props.limit) { notification.warning({ message: '温馨提示', + duration:2000, description: `最多支持上传${props.limit}张`, }); } @@ -224,6 +226,7 @@ const handleUploadChange= (data: { fileList: UploadFileInfo[] })=> { if (!imgSize) { notification.warning({ message: '温馨提示', + duration:2000, description: `上传文件大小不能超过 ${props.fileSize}M!`, }); return false; @@ -236,6 +239,7 @@ const handleUploadChange= (data: { fileList: UploadFileInfo[] })=> { if (fileType.indexOf(substrName) == -1) { notification.warning({ message: '温馨提示', + duration:2000, description: '上传文件不符合所需的格式!', }); return false; diff --git a/src/components/Upload/file.vue b/src/components/Upload/file.vue index 2b8a960..cd405d5 100644 --- a/src/components/Upload/file.vue +++ b/src/components/Upload/file.vue @@ -160,6 +160,7 @@ const handleHttpUpload = async (options) => { } catch (error) { notification.error({ message: '温馨提示', + duration:2000, description: '上传文件失败!', }); if (props.multiple) { @@ -203,6 +204,7 @@ const beforeUpload = (rawFile) => { if (!imgSize) { notification.warning({ message: '温馨提示', + duration:2000, description: `上传文件大小不能超过 ${props.fileSize}M!`, }); return false; @@ -215,6 +217,7 @@ const beforeUpload = (rawFile) => { if (fileType.indexOf(substrName) == -1) { notification.warning({ message: '温馨提示', + duration:2000, description: '上传文件不符合所需的格式!', }); return false; diff --git a/src/plugins/customComponents.ts b/src/plugins/customComponents.ts index 5c7b9c7..e36eae7 100644 --- a/src/plugins/customComponents.ts +++ b/src/plugins/customComponents.ts @@ -5,13 +5,17 @@ import { App } from 'vue'; import { PageWrapper, PageFooter } from '@/components/Page'; import NumberInput from '@/components/numberInput/index.vue'; +import pagination from '@/components/pagination/index.vue'; +import { BasicTable } from '@/components/Table'; import { basicModal } from '@/components/Modal'; import { Authority } from '@/components/Authority'; export function setupCustomComponents(app: App) { app.component('PageWrapper', PageWrapper); app.component('NumberInput', NumberInput); + app.component('pagination', pagination); app.component('basicModal', basicModal); + app.component('BasicTable',BasicTable) app.component('PageFooter', PageFooter); app.component('Authority', Authority); } diff --git a/src/views/system/menu/edit.vue b/src/views/system/menu/edit.vue index 7bb95a1..758cc5d 100644 --- a/src/views/system/menu/edit.vue +++ b/src/views/system/menu/edit.vue @@ -9,11 +9,12 @@ 按钮 - + - + @@ -38,7 +39,7 @@ + path="path" :rule="{ required: true, message: '请输入路由路径', trigger: 'blur' }">
访问的路由地址
@@ -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 @@ - - - - - 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 @@ + + +