diff --git a/src/views/system/menu/columns.ts b/src/views/system/menu/columns.ts index 372a8e4..21bf8ba 100644 --- a/src/views/system/menu/columns.ts +++ b/src/views/system/menu/columns.ts @@ -11,7 +11,7 @@ export const columns: BasicColumn[] = [ { title: '菜单名称', key: 'name', - width: 150, + width: 200, align: 'left', }, { diff --git a/src/views/system/menu/edit.vue b/src/views/system/menu/edit.vue index 24a35b6..098a5ea 100644 --- a/src/views/system/menu/edit.vue +++ b/src/views/system/menu/edit.vue @@ -128,6 +128,7 @@ import { useMessage, useDialog } from 'naive-ui'; import { useModal } from '@/components/Modal'; import { renderIcon } from '@/utils'; + /** * 定义接收的参数 */ @@ -146,7 +147,6 @@ /** * 定义参数变量 */ - const [modalRegister, { openModal, setSubLoading }] = useModal({ title: props.menuId ? '编辑菜单' : '添加菜单', subBtuText: '确定', @@ -275,7 +275,10 @@ formData.parentId = props.pid; } }); - //导出方法 + + /** + * 定义函数 + */ defineExpose({ openModal, }); diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index d83eb5d..489d324 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -64,26 +64,19 @@ const menuId = ref(0); const pid = ref(0); + /** + * 定义操作栏 + */ const actionColumn = reactive({ - width: 220, + width: 250, title: '操作', - align: 'center', + align: 'left', key: 'action', fixed: 'right', render(record) { return h(TableAction as any, { style: 'button', actions: [ - { - label: '新增', - type: 'info', - icon: renderIcon(PlusOutlined), - auth: ['sys:menu:add'], - ifShow: () => { - return record.type !== 1; - }, - onclick: handleAdd.bind(null, record), - }, { label: '编辑', type: 'warning', @@ -98,6 +91,16 @@ auth: ['sys:menu:delete'], onclick: handleDelete.bind(null, record), }, + { + label: '新增', + type: 'info', + icon: renderIcon(PlusOutlined), + auth: ['sys:menu:add'], + ifShow: () => { + return record.type !== 1; + }, + onclick: handleAdd.bind(null, record), + }, ], }); }, diff --git a/src/views/system/tenant/edit.vue b/src/views/system/tenant/edit.vue index 19b083c..057333e 100644 --- a/src/views/system/tenant/edit.vue +++ b/src/views/system/tenant/edit.vue @@ -218,6 +218,10 @@ subBtuText: '确定', width: 800, }); + + /** + * 定义表单参数 + */ const formData = reactive({ id: 0, code: '', @@ -275,6 +279,7 @@ setSubLoading(false); }); }; + /** * 定义选项数据 */ @@ -285,10 +290,19 @@ positionList: [], }); + /** + * 上传发生变化 + * @param data 参数 + */ function uploadChange(data: string[]) { formData.avatar = data.fileUrl; formData.avatarName = data.fileName; } + + /** + * 执行删除文件 + * @param file 文件参数 + */ const handleDelete = async (file) => { console.log(file); }; @@ -316,7 +330,10 @@ setFormData({ tenantId: props.tenantId }); } }); - //导出方法 + + /** + * 定义函数 + */ defineExpose({ openModal, }); diff --git a/src/views/system/tenant/index.vue b/src/views/system/tenant/index.vue index c73fc6e..022f317 100644 --- a/src/views/system/tenant/index.vue +++ b/src/views/system/tenant/index.vue @@ -27,7 +27,6 @@ 新建 - { rowKeys.value = []; const result = await getTenantList({ ...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] = ''; @@ -147,6 +162,10 @@ reloadTable(); } + /** + * 执行重置 + * @param values 参数 + */ function handleReset(values: Recordable) { for (const key in formParams) { formParams[key] = ''; @@ -157,11 +176,15 @@ reloadTable(); } + /** + * 执行注册 + */ const [register, {}] = useForm({ gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' }, labelWidth: 80, schemas, }); + /** * 执行添加 */ @@ -171,6 +194,7 @@ await nextTick(); createModalRef.value.openModal(); }; + /** * 执行编辑 */ @@ -180,6 +204,7 @@ await nextTick(); createModalRef.value.openModal(); } + /** * 执行删除 * @param id 参数 @@ -191,7 +216,7 @@ positiveText: '确定', negativeText: '取消', onPositiveClick: async () => { - record.id ? await tenantDelete(record.id) : awaittenantBatchDelete(rowKeys.value); + record.id ? await tenantDelete(record.id) : await tenantBatchDelete(rowKeys.value); message.success('删除成功'); reloadTable(); }, diff --git a/src/views/system/tenant/querySchemas.ts b/src/views/system/tenant/querySchemas.ts index 11d98bd..50f5583 100644 --- a/src/views/system/tenant/querySchemas.ts +++ b/src/views/system/tenant/querySchemas.ts @@ -1,16 +1,4 @@ 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: 'realname',