优化菜单、租户
This commit is contained in:
parent
1b77f96704
commit
62bcc3c098
@ -11,7 +11,7 @@ export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '菜单名称',
|
||||
key: 'name',
|
||||
width: 150,
|
||||
width: 200,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
|
@ -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,
|
||||
});
|
||||
|
@ -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),
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
|
@ -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,
|
||||
});
|
||||
|
@ -27,7 +27,6 @@
|
||||
</template>
|
||||
新建
|
||||
</n-button>
|
||||
|
||||
<n-button
|
||||
type="error"
|
||||
@click="handleDelete"
|
||||
@ -68,13 +67,9 @@
|
||||
} from '@/api/system/tenant';
|
||||
import { columns } from './columns';
|
||||
import { PlusOutlined, DeleteOutlined, FormOutlined } from '@vicons/antd';
|
||||
import CreateModal from './CreateModal.vue';
|
||||
import editDialog from './edit.vue';
|
||||
import { basicModal, useModal } from '@/components/Modal';
|
||||
import { downloadByData } from '@/utils/file/download';
|
||||
import { schemas } from './querySchemas';
|
||||
import { renderIcon } from '@/utils';
|
||||
import printJS from 'print-js';
|
||||
|
||||
const message = useMessage();
|
||||
const dialog = useDialog();
|
||||
@ -83,15 +78,23 @@
|
||||
const editVisible = ref(false);
|
||||
const tenantId = ref(0);
|
||||
const rowKeys = ref([]);
|
||||
|
||||
const showModal = ref(false);
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
// 租户名称
|
||||
name: '',
|
||||
// 租户状态
|
||||
status: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 200,
|
||||
width: 320,
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
key: 'action',
|
||||
@ -119,24 +122,36 @@
|
||||
},
|
||||
});
|
||||
|
||||
function addTable() {
|
||||
showModal.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
* @param res 参数
|
||||
*/
|
||||
const loadDataTable = async (res) => {
|
||||
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();
|
||||
},
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user