refactor:基于 lint 处理排版
This commit is contained in:
@@ -3,7 +3,6 @@ import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { OnActionClickFn } from '#/adapter/vxe-table';
|
||||
import type { SystemDeptApi } from '#/api/system/dept';
|
||||
import type { SystemUserApi } from '#/api/system/user';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
|
||||
@@ -124,9 +123,9 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(
|
||||
onActionClick?: OnActionClickFn<SystemDeptApi.SystemDept>,
|
||||
onActionClick?: OnActionClickFn<SystemDeptApi.Dept>,
|
||||
getLeaderName?: (userId: number) => string | undefined,
|
||||
): VxeTableGridOptions<SystemDeptApi.SystemDept>['columns'] {
|
||||
): VxeTableGridOptions<SystemDeptApi.Dept>['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'name',
|
||||
@@ -192,7 +191,7 @@ export function useGridColumns(
|
||||
{
|
||||
code: 'delete',
|
||||
show: hasAccessByCodes(['system:dept:delete']),
|
||||
disabled: (row: SystemDeptApi.SystemDept) => {
|
||||
disabled: (row: SystemDeptApi.Dept) => {
|
||||
return !!(row.children && row.children.length > 0);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -26,7 +26,7 @@ const [FormModal, formModalApi] = useVbenModal({
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
const userList = ref<SystemUserApi.SystemUser[]>([]);
|
||||
const userList = ref<SystemUserApi.User[]>([]);
|
||||
|
||||
/** 获取负责人名称 */
|
||||
const getLeaderName = (userId: number) => {
|
||||
@@ -51,17 +51,17 @@ function onCreate() {
|
||||
}
|
||||
|
||||
/** 添加下级部门 */
|
||||
function onAppend(row: SystemDeptApi.SystemDept) {
|
||||
function onAppend(row: SystemDeptApi.Dept) {
|
||||
formModalApi.setData({ parentId: row.id }).open();
|
||||
}
|
||||
|
||||
/** 编辑部门 */
|
||||
function onEdit(row: SystemDeptApi.SystemDept) {
|
||||
function onEdit(row: SystemDeptApi.Dept) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除部门 */
|
||||
async function onDelete(row: SystemDeptApi.SystemDept) {
|
||||
async function onDelete(row: SystemDeptApi.Dept) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
duration: 0,
|
||||
@@ -80,10 +80,7 @@ async function onDelete(row: SystemDeptApi.SystemDept) {
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
function onActionClick({
|
||||
code,
|
||||
row,
|
||||
}: OnActionClickParams<SystemDeptApi.SystemDept>) {
|
||||
function onActionClick({ code, row }: OnActionClickParams<SystemDeptApi.Dept>) {
|
||||
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<SystemDeptApi.SystemDept>();
|
||||
const formData = ref<SystemDeptApi.Dept>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['部门'])
|
||||
@@ -35,7 +35,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as SystemDeptApi.SystemDept;
|
||||
const data = (await formApi.getValues()) as SystemDeptApi.Dept;
|
||||
try {
|
||||
await (formData.value?.id ? updateDept(data) : createDept(data));
|
||||
// 关闭并提示
|
||||
@@ -54,7 +54,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
let data = modalApi.getData<SystemDeptApi.SystemDept>();
|
||||
let data = modalApi.getData<SystemDeptApi.Dept>();
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user