From 1b77f9670458c372a8e387ace5e6550aed911794 Mon Sep 17 00:00:00 2001 From: zjl Date: Wed, 11 Dec 2024 15:47:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E9=97=A8=E3=80=81?= =?UTF-8?q?=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/dept/columns.ts | 4 +-- src/views/system/dept/edit.vue | 12 +++++++-- src/views/system/dept/index.vue | 5 +++- src/views/system/role/auth.vue | 20 +++++++++++--- src/views/system/role/edit.vue | 12 +++++++-- src/views/system/role/index.vue | 46 +++++++++++++++++++++++++------- src/views/system/user/index.vue | 2 +- 7 files changed, 80 insertions(+), 21 deletions(-) diff --git a/src/views/system/dept/columns.ts b/src/views/system/dept/columns.ts index 6c2288e..09d796f 100644 --- a/src/views/system/dept/columns.ts +++ b/src/views/system/dept/columns.ts @@ -5,7 +5,7 @@ export const columns = [ { title: '部门名称', key: 'name', - width: 150, + width: 250, align: 'left', }, { @@ -54,7 +54,7 @@ export const columns = [ { title: '部门备注', key: 'note', - width: 100, + width: 200, }, { title: '创建人', diff --git a/src/views/system/dept/edit.vue b/src/views/system/dept/edit.vue index 7b0a550..80ad9c8 100644 --- a/src/views/system/dept/edit.vue +++ b/src/views/system/dept/edit.vue @@ -135,13 +135,18 @@ sort: 0, note: '', }); + + /** + * 定义模态 + */ const [modalRegister, { openModal, setSubLoading }] = useModal({ title: props.deptId ? '编辑部门' : '添加部门', subBtuText: '确定', width: 600, }); + /** - * 关闭窗体 + * 执行关闭窗体 */ const handleClose = () => { emit('update:visible', false); @@ -208,7 +213,10 @@ formData.parentId = props.pid; } }); - //导出方法 + + /** + * 定义函数 + */ defineExpose({ openModal, }); diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 0a64187..d3bbc0d 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -64,8 +64,11 @@ const deptId = ref(0); const pid = ref(0); + /** + * 定义操作栏 + */ const actionColumn = reactive({ - width: 220, + width: 250, title: '操作', align: 'center', key: 'action', diff --git a/src/views/system/role/auth.vue b/src/views/system/role/auth.vue index 15762fd..609eecd 100644 --- a/src/views/system/role/auth.vue +++ b/src/views/system/role/auth.vue @@ -22,7 +22,7 @@ children-field="children" cascade virtual-scroll - style="height: 350px" + style="height: 450px" :checked-keys="checkedKeys" :expanded-keys="expandedKeys" :indeterminate-keys="halfCheckedIds" @@ -42,7 +42,6 @@ import { useMessage } from 'naive-ui'; import { onMounted, ref } from 'vue'; import { useModal } from '@/components/Modal'; - import { isArray } from '@/utils/is'; /** * 定义接收的参数 @@ -75,11 +74,15 @@ const menuArray = ref([]); const menuTree = ref([]); + /** + * 定义模态 + */ const [modalRegister, { openModal, setSubLoading }] = useModal({ title: '分配权限', subBtuText: '确定', width: 600, }); + /** * 执行扩展、收缩 */ @@ -102,7 +105,9 @@ } }; - // 获取所有选择的节点 + /** + * 获取所有选择的节点 + */ const getDeptAllCheckedKeys = () => { const checkedKeys = treeRef.value?.getCheckedData().keys; const halfCheckedKeys = treeRef.value?.getIndeterminateData().keys; @@ -137,6 +142,10 @@ checkedKeys.value = node; }; + /** + * 执行收缩、展开 + * @param node 参数 + */ const handleExpands = (node) => { expandedKeys.value = node; }; @@ -155,6 +164,7 @@ checkedKeys.value = keys.checkedIds; halfCheckedIds.value = keys.halfCheckedIds; }; + /** * 选中树结构 * @param nodes 节点 @@ -210,6 +220,10 @@ onMounted(() => { setFormData(); }); + + /** + * 定义函数 + */ defineExpose({ openModal, }); diff --git a/src/views/system/role/edit.vue b/src/views/system/role/edit.vue index 1949942..f7520b7 100644 --- a/src/views/system/role/edit.vue +++ b/src/views/system/role/edit.vue @@ -79,13 +79,18 @@ default: 0, }, }); + + /** + * 定义模态 + */ const [modalRegister, { openModal, setSubLoading }] = useModal({ title: props.roleId ? '编辑角色' : '添加角色', subBtuText: '确定', width: 600, }); + /** - * 执行提交 + * 执行提交表单 */ const handleSubmit = async () => { formRef.value @@ -129,7 +134,10 @@ setFormData(); } }); - //导出方法 + + /** + * 定义函数 + */ defineExpose({ openModal, }); diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index e31409f..7508e0b 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -27,7 +27,6 @@ 新建 - + + { rowKeys.value = []; const result = await getRoleList({ ...formParams, ...res }); return result; }; + /** + * 数据行选中事件 + * @param keys 参数 + */ function onCheckedRow(keys) { rowKeys.value = keys; } + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { for (const key in formParams) { formParams[key] = ''; @@ -157,6 +173,10 @@ reloadTable(); } + /** + * 执行重置 + * @param values 参数 + */ function handleReset(values: Recordable) { for (const key in formParams) { formParams[key] = ''; @@ -167,6 +187,9 @@ reloadTable(); } + /** + * 执行注册 + */ const [register, {}] = useForm({ gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' }, labelWidth: 80, @@ -182,6 +205,7 @@ await nextTick(); createModalRef.value.openModal(); }; + /** * 执行编辑 */ @@ -191,6 +215,7 @@ await nextTick(); createModalRef.value.openModal(); } + /** * 执行分配权限 */ @@ -200,6 +225,7 @@ await nextTick(); authRef.value.openModal(); } + /** * 执行删除 * @param id 参数 diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 451180b..92ab66e 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -131,7 +131,7 @@ * 定义操作栏 */ const actionColumn = reactive({ - width: 400, + width: 380, title: '操作', align: 'center', key: 'action',