style: system views code style

This commit is contained in:
xingyu4j
2025-04-22 11:25:11 +08:00
parent 4e1d6812ff
commit da3fd5b718
84 changed files with 1200 additions and 624 deletions

View File

@@ -1,15 +1,17 @@
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 { useAccess } from '@vben/access';
import { z } from '#/adapter/form';
import { getDeptList } from '#/api/system/dept';
import { getSimpleUserList } from '#/api/system/user';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { handleTree } from '#/utils/tree';
import { useAccess } from '@vben/access';
const { hasAccessByCodes } = useAccess();
@@ -93,7 +95,7 @@ export function useFormSchema(): VbenFormSchema[] {
rules: z
.string()
// TODO @芋艿:未来怎么拓展一个手机的
.regex(/^1[3|4|5|6|7|8|9][0-9]\d{8}$/, '请输入正确的手机号码')
.regex(/^1[3-9|]\d{9}$/, '请输入正确的手机号码')
.optional(),
},
{
@@ -103,10 +105,7 @@ export function useFormSchema(): VbenFormSchema[] {
componentProps: {
placeholder: '请输入邮箱',
},
rules: z
.string()
.email('请输入正确的邮箱地址')
.optional(),
rules: z.string().email('请输入正确的邮箱地址').optional(),
},
{
fieldName: 'status',
@@ -141,7 +140,9 @@ export function useGridColumns(
title: '负责人',
minWidth: 150,
formatter: (row) => {
return userList.find((user) => user.id === row.cellValue)?.nickname || '-';
return (
userList.find((user) => user.id === row.cellValue)?.nickname || '-'
);
},
},
{

View File

@@ -1,18 +1,23 @@
<script lang="ts" setup>
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type {
OnActionClickParams,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { SystemDeptApi } from '#/api/system/dept';
import { Page, useVbenModal } from '@vben/common-ui';
import { Button, message } from 'ant-design-vue';
import { Plus } from '@vben/icons';
import Form from './modules/form.vue';
import { ref } from 'vue';
import { $t } from '#/locales';
import { Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons';
import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getDeptList, deleteDept } from '#/api/system/dept';
import { deleteDept, getDeptList } from '#/api/system/dept';
import { $t } from '#/locales';
import { useGridColumns } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
@@ -60,7 +65,7 @@ async function onDelete(row: SystemDeptApi.SystemDept) {
key: 'action_process_msg',
});
onRefresh();
} catch (error) {
} catch {
hideLoading();
}
}
@@ -75,14 +80,14 @@ function onActionClick({
onAppend(row);
break;
}
case 'edit': {
onEdit(row);
break;
}
case 'delete': {
onDelete(row);
break;
}
case 'edit': {
onEdit(row);
break;
}
}
}
@@ -123,7 +128,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" />
<Grid table-title="部门列表">
<template #toolbar-tools>
<Button type="primary" @click="onCreate" v-access:code="['system:dept:create']">
<Button
type="primary"
@click="onCreate"
v-access:code="['system:dept:create']"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', ['部门']) }}
</Button>

View File

@@ -1,13 +1,15 @@
<script lang="ts" setup>
import type { SystemDeptApi } from '#/api/system/dept';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { computed, ref } from 'vue';
import { $t } from '#/locales';
import { useVbenForm } from '#/adapter/form';
import { createDept, updateDept, getDept } from '#/api/system/dept';
import { createDept, getDept, updateDept } from '#/api/system/dept';
import { $t } from '#/locales';
import { useFormSchema } from '../data';