style: 代码格式化,优化导入和组件结构

This commit is contained in:
Wenjie Zhang 2026-01-18 23:07:21 +08:00
parent 0f684851bc
commit f686c2873c
4 changed files with 35 additions and 14 deletions

View File

@ -2,12 +2,7 @@
* 部门管理 API * 部门管理 API
*/ */
import { import { apiSuperAdminGet, apiSuperAdminPost, apiSuperAdminPut, apiSuperAdminDelete } from './base'
apiSuperAdminGet,
apiSuperAdminPost,
apiSuperAdminPut,
apiSuperAdminDelete
} from './base'
const BASE_URL = '/api/departments' const BASE_URL = '/api/departments'

View File

@ -23,7 +23,7 @@
<a-table <a-table
:dataSource="departmentManagement.departments" :dataSource="departmentManagement.departments"
:columns="columns" :columns="columns"
:rowKey="record => record.id" :rowKey="(record) => record.id"
:pagination="false" :pagination="false"
class="department-table" class="department-table"
> >
@ -42,7 +42,12 @@
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-space> <a-space>
<a-tooltip title="编辑部门"> <a-tooltip title="编辑部门">
<a-button type="text" size="small" @click="showEditDepartmentModal(record)" class="action-btn"> <a-button
type="text"
size="small"
@click="showEditDepartmentModal(record)"
class="action-btn"
>
<EditOutlined /> <EditOutlined />
</a-button> </a-button>
</a-tooltip> </a-tooltip>
@ -108,7 +113,9 @@
<TeamOutlined /> <TeamOutlined />
<span>部门管理员</span> <span>部门管理员</span>
</div> </div>
<p class="admin-section-hint">创建部门时必须同时创建管理员该管理员将负责管理本部门用户</p> <p class="admin-section-hint">
创建部门时必须同时创建管理员该管理员将负责管理本部门用户
</p>
<a-form-item label="管理员用户ID" required class="form-item"> <a-form-item label="管理员用户ID" required class="form-item">
<a-input <a-input
@ -359,13 +366,18 @@ const handleDepartmentFormSubmit = async () => {
return return
} }
if (departmentManagement.form.adminPassword !== departmentManagement.form.adminConfirmPassword) { if (
departmentManagement.form.adminPassword !== departmentManagement.form.adminConfirmPassword
) {
notification.error({ message: '两次输入的密码不一致' }) notification.error({ message: '两次输入的密码不一致' })
return return
} }
// //
if (departmentManagement.form.adminPhone && !validatePhoneNumber(departmentManagement.form.adminPhone)) { if (
departmentManagement.form.adminPhone &&
!validatePhoneNumber(departmentManagement.form.adminPhone)
) {
notification.error({ message: '请输入正确的手机号格式' }) notification.error({ message: '请输入正确的手机号格式' })
return return
} }

View File

@ -135,7 +135,13 @@
<script setup> <script setup>
import { ref, computed, watch } from 'vue' import { ref, computed, watch } from 'vue'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { SettingOutlined, CodeOutlined, UserOutlined, ApiOutlined, TeamOutlined } from '@ant-design/icons-vue' import {
SettingOutlined,
CodeOutlined,
UserOutlined,
ApiOutlined,
TeamOutlined
} from '@ant-design/icons-vue'
import BasicSettingsSection from '@/components/BasicSettingsSection.vue' import BasicSettingsSection from '@/components/BasicSettingsSection.vue'
import ModelProvidersComponent from '@/components/ModelProvidersComponent.vue' import ModelProvidersComponent from '@/components/ModelProvidersComponent.vue'
import UserManagementComponent from '@/components/UserManagementComponent.vue' import UserManagementComponent from '@/components/UserManagementComponent.vue'

View File

@ -207,8 +207,16 @@
<!-- 部门选择器仅超级管理员可见 --> <!-- 部门选择器仅超级管理员可见 -->
<a-form-item v-if="userStore.isSuperAdmin" label="部门" class="form-item"> <a-form-item v-if="userStore.isSuperAdmin" label="部门" class="form-item">
<a-select v-model:value="userManagement.form.departmentId" size="large" placeholder="请选择部门"> <a-select
<a-select-option v-for="dept in departmentManagement.departments" :key="dept.id" :value="dept.id"> v-model:value="userManagement.form.departmentId"
size="large"
placeholder="请选择部门"
>
<a-select-option
v-for="dept in departmentManagement.departments"
:key="dept.id"
:value="dept.id"
>
{{ dept.name }} {{ dept.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>