refactor:基于 lint 处理排版
This commit is contained in:
@@ -42,7 +42,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
data.unshift({
|
||||
id: 0,
|
||||
name: '顶级部门',
|
||||
} as SystemMenuApi.SystemMenu);
|
||||
} as SystemMenuApi.Menu);
|
||||
return handleTree(data);
|
||||
},
|
||||
class: 'w-full',
|
||||
@@ -270,8 +270,8 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(
|
||||
onActionClick: OnActionClickFn<SystemMenuApi.SystemMenu>,
|
||||
): VxeTableGridOptions<SystemMenuApi.SystemMenu>['columns'] {
|
||||
onActionClick: OnActionClickFn<SystemMenuApi.Menu>,
|
||||
): VxeTableGridOptions<SystemMenuApi.Menu>['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'name',
|
||||
|
||||
@@ -37,17 +37,17 @@ function onCreate() {
|
||||
}
|
||||
|
||||
/** 添加下级菜单 */
|
||||
function onAppend(row: SystemMenuApi.SystemMenu) {
|
||||
function onAppend(row: SystemMenuApi.Menu) {
|
||||
formModalApi.setData({ pid: row.id }).open();
|
||||
}
|
||||
|
||||
/** 编辑菜单 */
|
||||
function onEdit(row: SystemMenuApi.SystemMenu) {
|
||||
function onEdit(row: SystemMenuApi.Menu) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除菜单 */
|
||||
async function onDelete(row: SystemMenuApi.SystemMenu) {
|
||||
async function onDelete(row: SystemMenuApi.Menu) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
duration: 0,
|
||||
@@ -66,10 +66,7 @@ async function onDelete(row: SystemMenuApi.SystemMenu) {
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
function onActionClick({
|
||||
code,
|
||||
row,
|
||||
}: OnActionClickParams<SystemMenuApi.SystemMenu>) {
|
||||
function onActionClick({ code, row }: OnActionClickParams<SystemMenuApi.Menu>) {
|
||||
switch (code) {
|
||||
case 'append': {
|
||||
onAppend(row);
|
||||
|
||||
@@ -14,7 +14,7 @@ import { $t } from '#/locales';
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<SystemMenuApi.SystemMenu>();
|
||||
const formData = ref<SystemMenuApi.Menu>();
|
||||
const getTitle = computed(() =>
|
||||
formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['菜单'])
|
||||
@@ -35,7 +35,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as SystemMenuApi.SystemMenu;
|
||||
const data = (await formApi.getValues()) as SystemMenuApi.Menu;
|
||||
try {
|
||||
await (formData.value?.id ? updateMenu(data) : createMenu(data));
|
||||
// 关闭并提示
|
||||
@@ -54,7 +54,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
let data = modalApi.getData<SystemMenuApi.SystemMenu>();
|
||||
let data = modalApi.getData<SystemMenuApi.Menu>();
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user