refactor:基于 lint 处理排版
This commit is contained in:
@@ -90,7 +90,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns<T = SystemPostApi.SystemPost>(
|
||||
export function useGridColumns<T = SystemPostApi.Post>(
|
||||
onActionClick: OnActionClickFn<T>,
|
||||
): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
|
||||
@@ -40,12 +40,12 @@ function onCreate() {
|
||||
}
|
||||
|
||||
/** 编辑岗位 */
|
||||
function onEdit(row: SystemPostApi.SystemPost) {
|
||||
function onEdit(row: SystemPostApi.Post) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除岗位 */
|
||||
async function onDelete(row: SystemPostApi.SystemPost) {
|
||||
async function onDelete(row: SystemPostApi.Post) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
duration: 0,
|
||||
@@ -64,10 +64,7 @@ async function onDelete(row: SystemPostApi.SystemPost) {
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
function onActionClick({
|
||||
code,
|
||||
row,
|
||||
}: OnActionClickParams<SystemPostApi.SystemPost>) {
|
||||
function onActionClick({ code, row }: OnActionClickParams<SystemPostApi.Post>) {
|
||||
switch (code) {
|
||||
case 'delete': {
|
||||
onDelete(row);
|
||||
@@ -106,7 +103,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<SystemPostApi.SystemPost>,
|
||||
} as VxeTableGridOptions<SystemPostApi.Post>,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import { $t } from '#/locales';
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<SystemPostApi.SystemPost>();
|
||||
const formData = ref<SystemPostApi.Post>();
|
||||
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 SystemPostApi.SystemPost;
|
||||
const data = (await formApi.getValues()) as SystemPostApi.Post;
|
||||
try {
|
||||
await (formData.value?.id ? updatePost(data) : createPost(data));
|
||||
// 关闭并提示
|
||||
@@ -54,7 +54,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<SystemPostApi.SystemPost>();
|
||||
const data = modalApi.getData<SystemPostApi.Post>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user