Merge branch 'dev' of gitee.com:yudaocode/yudao-ui-admin-vue3 into dev
Signed-off-by: 凌太虚 <343015202@qq.com>
This commit is contained in:
commit
8f49426cc3
@ -11,7 +11,7 @@ export type UserGroupVO = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 创建用户组
|
// 创建用户组
|
||||||
export const createUserGroupApi = async (data: UserGroupVO) => {
|
export const createUserGroup = async (data: UserGroupVO) => {
|
||||||
return await request.post({
|
return await request.post({
|
||||||
url: '/bpm/user-group/create',
|
url: '/bpm/user-group/create',
|
||||||
data: data
|
data: data
|
||||||
@ -19,7 +19,7 @@ export const createUserGroupApi = async (data: UserGroupVO) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新用户组
|
// 更新用户组
|
||||||
export const updateUserGroupApi = async (data: UserGroupVO) => {
|
export const updateUserGroup = async (data: UserGroupVO) => {
|
||||||
return await request.put({
|
return await request.put({
|
||||||
url: '/bpm/user-group/update',
|
url: '/bpm/user-group/update',
|
||||||
data: data
|
data: data
|
||||||
@ -27,21 +27,21 @@ export const updateUserGroupApi = async (data: UserGroupVO) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除用户组
|
// 删除用户组
|
||||||
export const deleteUserGroupApi = async (id: number) => {
|
export const deleteUserGroup = async (id: number) => {
|
||||||
return await request.delete({ url: '/bpm/user-group/delete?id=' + id })
|
return await request.delete({ url: '/bpm/user-group/delete?id=' + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获得用户组
|
// 获得用户组
|
||||||
export const getUserGroupApi = async (id: number) => {
|
export const getUserGroup = async (id: number) => {
|
||||||
return await request.get({ url: '/bpm/user-group/get?id=' + id })
|
return await request.get({ url: '/bpm/user-group/get?id=' + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获得用户组分页
|
// 获得用户组分页
|
||||||
export const getUserGroupPageApi = async (params) => {
|
export const getUserGroupPage = async (params) => {
|
||||||
return await request.get({ url: '/bpm/user-group/page', params })
|
return await request.get({ url: '/bpm/user-group/page', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户组精简信息列表
|
// 获取用户组精简信息列表
|
||||||
export const listSimpleUserGroupsApi = async () => {
|
export const listSimpleUserGroup = async () => {
|
||||||
return await request.get({ url: '/bpm/user-group/list-all-simple' })
|
return await request.get({ url: '/bpm/user-group/list-all-simple' })
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ export interface ApiErrorLogExportReqVO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询列表API 访问日志
|
// 查询列表API 访问日志
|
||||||
export const getApiErrorLogPageApi = (params: ApiErrorLogPageReqVO) => {
|
export const getApiErrorLogPageApi = (params: PageParam) => {
|
||||||
return request.get({ url: '/infra/api-error-log/page', params })
|
return request.get({ url: '/infra/api-error-log/page', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ export const updateApiErrorLogPageApi = (id: number, processStatus: number) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 导出API 访问日志
|
// 导出API 访问日志
|
||||||
export const exportApiErrorLogApi = (params: ApiErrorLogExportReqVO) => {
|
export const exportApiErrorLogApi = (params) => {
|
||||||
return request.download({
|
return request.download({
|
||||||
url: '/infra/api-error-log/export-excel',
|
url: '/infra/api-error-log/export-excel',
|
||||||
params
|
params
|
||||||
|
@ -1,36 +1,49 @@
|
|||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
import type { DictDataVO, DictDataPageReqVO, DictDataExportReqVO } from './types'
|
|
||||||
|
export type DictDataVO = {
|
||||||
|
id: number | undefined
|
||||||
|
sort: number | undefined
|
||||||
|
label: string
|
||||||
|
value: string
|
||||||
|
dictType: string
|
||||||
|
status: number
|
||||||
|
colorType: string
|
||||||
|
cssClass: string
|
||||||
|
remark: string
|
||||||
|
createTime: Date
|
||||||
|
}
|
||||||
|
|
||||||
// 查询字典数据(精简)列表
|
// 查询字典数据(精简)列表
|
||||||
export const listSimpleDictDataApi = () => {
|
export const listSimpleDictData = () => {
|
||||||
return request.get({ url: '/system/dict-data/list-all-simple' })
|
return request.get({ url: '/system/dict-data/list-all-simple' })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询字典数据列表
|
// 查询字典数据列表
|
||||||
export const getDictDataPageApi = (params: DictDataPageReqVO) => {
|
export const getDictDataPage = (params: PageParam) => {
|
||||||
return request.get({ url: '/system/dict-data/page', params })
|
return request.get({ url: '/system/dict-data/page', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询字典数据详情
|
// 查询字典数据详情
|
||||||
export const getDictDataApi = (id: number) => {
|
export const getDictData = (id: number) => {
|
||||||
return request.get({ url: '/system/dict-data/get?id=' + id })
|
return request.get({ url: '/system/dict-data/get?id=' + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增字典数据
|
// 新增字典数据
|
||||||
export const createDictDataApi = (data: DictDataVO) => {
|
export const createDictData = (data: DictDataVO) => {
|
||||||
return request.post({ url: '/system/dict-data/create', data })
|
return request.post({ url: '/system/dict-data/create', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改字典数据
|
// 修改字典数据
|
||||||
export const updateDictDataApi = (data: DictDataVO) => {
|
export const updateDictData = (data: DictDataVO) => {
|
||||||
return request.put({ url: '/system/dict-data/update', data })
|
return request.put({ url: '/system/dict-data/update', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除字典数据
|
// 删除字典数据
|
||||||
export const deleteDictDataApi = (id: number) => {
|
export const deleteDictData = (id: number) => {
|
||||||
return request.delete({ url: '/system/dict-data/delete?id=' + id })
|
return request.delete({ url: '/system/dict-data/delete?id=' + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出字典类型数据
|
// 导出字典类型数据
|
||||||
export const exportDictDataApi = (params: DictDataExportReqVO) => {
|
export const exportDictDataApi = (params) => {
|
||||||
return request.get({ url: '/system/dict-data/export', params })
|
return request.get({ url: '/system/dict-data/export', params })
|
||||||
}
|
}
|
||||||
|
@ -1,36 +1,44 @@
|
|||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
import type { DictTypeVO, DictTypePageReqVO, DictTypeExportReqVO } from './types'
|
|
||||||
|
export type DictTypeVO = {
|
||||||
|
id: number | undefined
|
||||||
|
name: string
|
||||||
|
type: string
|
||||||
|
status: number
|
||||||
|
remark: string
|
||||||
|
createTime: Date
|
||||||
|
}
|
||||||
|
|
||||||
// 查询字典(精简)列表
|
// 查询字典(精简)列表
|
||||||
export const listSimpleDictTypeApi = () => {
|
export const listSimpleDictType = () => {
|
||||||
return request.get({ url: '/system/dict-type/list-all-simple' })
|
return request.get({ url: '/system/dict-type/list-all-simple' })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询字典列表
|
// 查询字典列表
|
||||||
export const getDictTypePageApi = (params: DictTypePageReqVO) => {
|
export const getDictTypePage = (params: PageParam) => {
|
||||||
return request.get({ url: '/system/dict-type/page', params })
|
return request.get({ url: '/system/dict-type/page', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询字典详情
|
// 查询字典详情
|
||||||
export const getDictTypeApi = (id: number) => {
|
export const getDictType = (id: number) => {
|
||||||
return request.get({ url: '/system/dict-type/get?id=' + id })
|
return request.get({ url: '/system/dict-type/get?id=' + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增字典
|
// 新增字典
|
||||||
export const createDictTypeApi = (data: DictTypeVO) => {
|
export const createDictType = (data: DictTypeVO) => {
|
||||||
return request.post({ url: '/system/dict-type/create', data })
|
return request.post({ url: '/system/dict-type/create', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改字典
|
// 修改字典
|
||||||
export const updateDictTypeApi = (data: DictTypeVO) => {
|
export const updateDictType = (data: DictTypeVO) => {
|
||||||
return request.put({ url: '/system/dict-type/update', data })
|
return request.put({ url: '/system/dict-type/update', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除字典
|
// 删除字典
|
||||||
export const deleteDictTypeApi = (id: number) => {
|
export const deleteDictType = (id: number) => {
|
||||||
return request.delete({ url: '/system/dict-type/delete?id=' + id })
|
return request.delete({ url: '/system/dict-type/delete?id=' + id })
|
||||||
}
|
}
|
||||||
// 导出字典类型
|
// 导出字典类型
|
||||||
export const exportDictTypeApi = (params: DictTypeExportReqVO) => {
|
export const exportDictType = (params) => {
|
||||||
return request.get({ url: '/system/dict-type/export', params })
|
return request.get({ url: '/system/dict-type/export', params })
|
||||||
}
|
}
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
export type DictTypeVO = {
|
|
||||||
id: number
|
|
||||||
name: string
|
|
||||||
type: string
|
|
||||||
status: number
|
|
||||||
remark: string
|
|
||||||
createTime: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export type DictTypePageReqVO = {
|
|
||||||
name: string
|
|
||||||
type: string
|
|
||||||
status: number
|
|
||||||
createTime: Date[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export type DictTypeExportReqVO = {
|
|
||||||
name: string
|
|
||||||
type: string
|
|
||||||
status: number
|
|
||||||
createTime: Date[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export type DictDataVO = {
|
|
||||||
id: number
|
|
||||||
sort: number
|
|
||||||
label: string
|
|
||||||
value: string
|
|
||||||
dictType: string
|
|
||||||
status: number
|
|
||||||
colorType: string
|
|
||||||
cssClass: string
|
|
||||||
remark: string
|
|
||||||
createTime: Date
|
|
||||||
}
|
|
||||||
export type DictDataPageReqVO = {
|
|
||||||
label: string
|
|
||||||
dictType: string
|
|
||||||
status: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export type DictDataExportReqVO = {
|
|
||||||
label: string
|
|
||||||
dictType: string
|
|
||||||
status: number
|
|
||||||
}
|
|
@ -1,10 +1,10 @@
|
|||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
|
|
||||||
export interface ErrorCodeVO {
|
export interface ErrorCodeVO {
|
||||||
id: number
|
id: number | undefined
|
||||||
type: number
|
type: number
|
||||||
applicationName: string
|
applicationName: string
|
||||||
code: number
|
code: number | undefined
|
||||||
message: string
|
message: string
|
||||||
memo: string
|
memo: string
|
||||||
createTime: Date
|
createTime: Date
|
||||||
|
@ -11,18 +11,12 @@ export interface OAuth2TokenVO {
|
|||||||
expiresTime: Date
|
expiresTime: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OAuth2TokenPageReqVO extends PageParam {
|
|
||||||
userId?: number
|
|
||||||
userType?: number
|
|
||||||
clientId?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询 token列表
|
// 查询 token列表
|
||||||
export const getAccessTokenPageApi = (params: OAuth2TokenPageReqVO) => {
|
export const getAccessTokenPage = (params: PageParam) => {
|
||||||
return request.get({ url: '/system/oauth2-token/page', params })
|
return request.get({ url: '/system/oauth2-token/page', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除 token
|
// 删除 token
|
||||||
export const deleteAccessTokenApi = (accessToken: number) => {
|
export const deleteAccessToken = (accessToken: number) => {
|
||||||
return request.delete({ url: '/system/oauth2-token/delete?accessToken=' + accessToken })
|
return request.delete({ url: '/system/oauth2-token/delete?accessToken=' + accessToken })
|
||||||
}
|
}
|
||||||
|
@ -10,49 +10,37 @@ export interface PostVO {
|
|||||||
createTime?: Date
|
createTime?: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostPageReqVO extends PageParam {
|
|
||||||
code?: string
|
|
||||||
name?: string
|
|
||||||
status?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PostExportReqVO {
|
|
||||||
code?: string
|
|
||||||
name?: string
|
|
||||||
status?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询岗位列表
|
// 查询岗位列表
|
||||||
export const getPostPageApi = async (params: PostPageReqVO) => {
|
export const getPostPage = async (params: PageParam) => {
|
||||||
return await request.get({ url: '/system/post/page', params })
|
return await request.get({ url: '/system/post/page', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取岗位精简信息列表
|
// 获取岗位精简信息列表
|
||||||
export const listSimplePostsApi = async () => {
|
export const getSimplePostList = async () => {
|
||||||
return await request.get({ url: '/system/post/list-all-simple' })
|
return await request.get({ url: '/system/post/list-all-simple' })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询岗位详情
|
// 查询岗位详情
|
||||||
export const getPostApi = async (id: number) => {
|
export const getPost = async (id: number) => {
|
||||||
return await request.get({ url: '/system/post/get?id=' + id })
|
return await request.get({ url: '/system/post/get?id=' + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增岗位
|
// 新增岗位
|
||||||
export const createPostApi = async (data: PostVO) => {
|
export const createPost = async (data: PostVO) => {
|
||||||
return await request.post({ url: '/system/post/create', data })
|
return await request.post({ url: '/system/post/create', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改岗位
|
// 修改岗位
|
||||||
export const updatePostApi = async (data: PostVO) => {
|
export const updatePost = async (data: PostVO) => {
|
||||||
return await request.put({ url: '/system/post/update', data })
|
return await request.put({ url: '/system/post/update', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除岗位
|
// 删除岗位
|
||||||
export const deletePostApi = async (id: number) => {
|
export const deletePost = async (id: number) => {
|
||||||
return await request.delete({ url: '/system/post/delete?id=' + id })
|
return await request.delete({ url: '/system/post/delete?id=' + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出岗位
|
// 导出岗位
|
||||||
export const exportPostApi = async (params: PostExportReqVO) => {
|
export const exportPost = async (params) => {
|
||||||
return await request.download({ url: '/system/post/export', params })
|
return await request.download({ url: '/system/post/export', params })
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,6 @@ export const updateUserStatusApi = (id: number, status: number) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户精简信息列表
|
// 获取用户精简信息列表
|
||||||
export const getListSimpleUsersApi = () => {
|
export const getSimpleUserList = () => {
|
||||||
return request.get({ url: '/system/user/list-all-simple' })
|
return request.get({ url: '/system/user/list-all-simple' })
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,31 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
path: '/dict',
|
||||||
|
component: Layout,
|
||||||
|
name: 'dict',
|
||||||
|
meta: {
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'type/data/:dictType',
|
||||||
|
component: () => import('@/views/system/dict/data.vue'),
|
||||||
|
name: 'data',
|
||||||
|
meta: {
|
||||||
|
title: '字典数据',
|
||||||
|
noCache: true,
|
||||||
|
hidden: true,
|
||||||
|
canTo: true,
|
||||||
|
icon: '',
|
||||||
|
activeMenu: 'system/dict/data'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/codegen',
|
path: '/codegen',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
|
@ -3,7 +3,7 @@ import { store } from '../index'
|
|||||||
import { DictDataVO } from '@/api/system/dict/types'
|
import { DictDataVO } from '@/api/system/dict/types'
|
||||||
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
||||||
const { wsCache } = useCache('sessionStorage')
|
const { wsCache } = useCache('sessionStorage')
|
||||||
import { listSimpleDictDataApi } from '@/api/system/dict/dict.data'
|
import { listSimpleDictData } from '@/api/system/dict/dict.data'
|
||||||
|
|
||||||
export interface DictValueType {
|
export interface DictValueType {
|
||||||
value: any
|
value: any
|
||||||
@ -44,7 +44,7 @@ export const useDictStore = defineStore('dict', {
|
|||||||
this.dictMap = dictMap
|
this.dictMap = dictMap
|
||||||
this.isSetDict = true
|
this.isSetDict = true
|
||||||
} else {
|
} else {
|
||||||
const res = await listSimpleDictDataApi()
|
const res = await listSimpleDictData()
|
||||||
// 设置数据
|
// 设置数据
|
||||||
const dictDataMap = new Map<string, any>()
|
const dictDataMap = new Map<string, any>()
|
||||||
res.forEach((dictData: DictDataVO) => {
|
res.forEach((dictData: DictDataVO) => {
|
||||||
@ -74,7 +74,7 @@ export const useDictStore = defineStore('dict', {
|
|||||||
},
|
},
|
||||||
async resetDict() {
|
async resetDict() {
|
||||||
wsCache.delete(CACHE_KEY.DICT_CACHE)
|
wsCache.delete(CACHE_KEY.DICT_CACHE)
|
||||||
const res = await listSimpleDictDataApi()
|
const res = await listSimpleDictData()
|
||||||
// 设置数据
|
// 设置数据
|
||||||
const dictDataMap = new Map<string, any>()
|
const dictDataMap = new Map<string, any>()
|
||||||
res.forEach((dictData: DictDataVO) => {
|
res.forEach((dictData: DictDataVO) => {
|
||||||
|
1
src/types/auto-components.d.ts
vendored
1
src/types/auto-components.d.ts
vendored
@ -30,6 +30,7 @@ declare module '@vue/runtime-core' {
|
|||||||
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
|
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
|
||||||
ElCard: typeof import('element-plus/es')['ElCard']
|
ElCard: typeof import('element-plus/es')['ElCard']
|
||||||
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
||||||
|
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
|
||||||
ElCol: typeof import('element-plus/es')['ElCol']
|
ElCol: typeof import('element-plus/es')['ElCol']
|
||||||
ElCollapse: typeof import('element-plus/es')['ElCollapse']
|
ElCollapse: typeof import('element-plus/es')['ElCollapse']
|
||||||
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
|
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
|
||||||
|
132
src/views/bpm/group/UserGroupForm.vue
Normal file
132
src/views/bpm/group/UserGroupForm.vue
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog :title="modelTitle" v-model="modelVisible">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="100px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="组名" prop="name">
|
||||||
|
<el-input v-model="formData.name" placeholder="请输入组名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述">
|
||||||
|
<el-input type="textarea" v-model="formData.name" placeholder="请输入描述" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="成员" prop="memberUserIds">
|
||||||
|
<el-select v-model="formData.memberUserIds" multiple placeholder="请选择成员">
|
||||||
|
<el-option
|
||||||
|
v-for="user in userList"
|
||||||
|
:key="user.id"
|
||||||
|
:label="user.nickname"
|
||||||
|
:value="user.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-radio-group v-model="formData.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>
|
||||||
|
{{ dict.label }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="modelVisible = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
|
import { CommonStatusEnum } from '@/utils/constants'
|
||||||
|
import * as UserGroupApi from '@/api/bpm/userGroup'
|
||||||
|
import * as UserApi from '@/api/system/user'
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const modelVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const modelTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
name: undefined,
|
||||||
|
description: undefined,
|
||||||
|
memberUserIds: undefined,
|
||||||
|
status: CommonStatusEnum.ENABLE
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
name: [{ required: true, message: '组名不能为空', trigger: 'blur' }],
|
||||||
|
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||||
|
memberUserIds: [{ required: true, message: '成员不能为空', trigger: 'blur' }],
|
||||||
|
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
const userList = ref([]) // 用户列表
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (type: string, id?: number) => {
|
||||||
|
modelVisible.value = true
|
||||||
|
modelTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await UserGroupApi.getUserGroup(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 加载用户列表
|
||||||
|
userList.value = await UserApi.getSimpleUserList()
|
||||||
|
}
|
||||||
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
if (!formRef) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as unknown as UserGroupApi.UserGroupVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await UserGroupApi.createUserGroup(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await UserGroupApi.updateUserGroup(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
modelVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
name: undefined,
|
||||||
|
description: undefined,
|
||||||
|
memberUserIds: undefined,
|
||||||
|
status: CommonStatusEnum.ENABLE
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
@ -1,64 +0,0 @@
|
|||||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
|
|
||||||
// 表单校验
|
|
||||||
export const rules = reactive({
|
|
||||||
name: [required],
|
|
||||||
description: [required],
|
|
||||||
memberUserIds: [required],
|
|
||||||
status: [required]
|
|
||||||
})
|
|
||||||
|
|
||||||
// CrudSchema
|
|
||||||
const crudSchemas = reactive<VxeCrudSchema>({
|
|
||||||
primaryKey: 'id',
|
|
||||||
primaryType: 'id',
|
|
||||||
primaryTitle: '编号',
|
|
||||||
action: true,
|
|
||||||
searchSpan: 8,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
title: '组名',
|
|
||||||
field: 'name',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '成员',
|
|
||||||
field: 'memberUserIds',
|
|
||||||
table: {
|
|
||||||
slots: {
|
|
||||||
default: 'memberUserIds_default'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '描述',
|
|
||||||
field: 'description'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('common.status'),
|
|
||||||
field: 'status',
|
|
||||||
dictType: DICT_TYPE.COMMON_STATUS,
|
|
||||||
dictClass: 'number',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('common.createTime'),
|
|
||||||
field: 'createTime',
|
|
||||||
formatter: 'formatDate',
|
|
||||||
isForm: false,
|
|
||||||
isSearch: true,
|
|
||||||
search: {
|
|
||||||
show: true,
|
|
||||||
itemRender: {
|
|
||||||
name: 'XDataTimePicker'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
table: {
|
|
||||||
width: 180
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
|
@ -1,182 +1,184 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<!-- 列表 -->
|
<!-- 搜索工作栏 -->
|
||||||
<XTable @register="registerTable">
|
<el-form
|
||||||
<template #toolbar_buttons>
|
class="-mb-15px"
|
||||||
<!-- 操作:新增 -->
|
:model="queryParams"
|
||||||
<XButton
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="组名" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入组名"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" prop="createTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.createTime"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
preIcon="ep:zoom-in"
|
@click="openForm('create')"
|
||||||
:title="t('action.add')"
|
|
||||||
v-hasPermi="['bpm:user-group:create']"
|
v-hasPermi="['bpm:user-group:create']"
|
||||||
@click="handleCreate()"
|
>
|
||||||
/>
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
</template>
|
</el-button>
|
||||||
<template #memberUserIds_default="{ row }">
|
</el-form-item>
|
||||||
<span v-for="userId in row.memberUserIds" :key="userId">
|
</el-form>
|
||||||
{{ getUserNickname(userId) }}
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
<template #actionbtns_default="{ row }">
|
|
||||||
<!-- 操作:修改 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:edit"
|
|
||||||
:title="t('action.edit')"
|
|
||||||
v-hasPermi="['bpm:user-group:update']"
|
|
||||||
@click="handleUpdate(row.id)"
|
|
||||||
/>
|
|
||||||
<!-- 操作:详情 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:view"
|
|
||||||
:title="t('action.detail')"
|
|
||||||
v-hasPermi="['bpm:user-group:query']"
|
|
||||||
@click="handleDetail(row.id)"
|
|
||||||
/>
|
|
||||||
<!-- 操作:删除 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:delete"
|
|
||||||
:title="t('action.del')"
|
|
||||||
v-hasPermi="['bpm:user-group:delete']"
|
|
||||||
@click="deleteData(row.id)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</XTable>
|
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<XModal v-model="dialogVisible" :title="dialogTitle" :mask-closable="false">
|
<!-- 列表 -->
|
||||||
<!-- 对话框(添加 / 修改) -->
|
<ContentWrap>
|
||||||
<Form
|
<el-table v-loading="loading" :data="list">
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
<el-table-column label="编号" align="center" prop="id" />
|
||||||
:schema="allSchemas.formSchema"
|
<el-table-column label="组名" align="center" prop="name" />
|
||||||
:rules="rules"
|
<el-table-column label="描述" align="center" prop="description" />
|
||||||
ref="formRef"
|
<el-table-column label="成员" align="center">
|
||||||
>
|
<template #default="scope">
|
||||||
<template #memberUserIds="form">
|
<span v-for="userId in scope.row.memberUserIds" :key="userId" class="pr-5px">
|
||||||
<el-select v-model="form.memberUserIds" multiple>
|
{{ userList.find((user) => user.id === userId)?.nickname }}
|
||||||
<el-option v-for="item in users" :key="item.id" :label="item.nickname" :value="item.id" />
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</Form>
|
|
||||||
<!-- 对话框(详情) -->
|
|
||||||
<Descriptions
|
|
||||||
v-if="actionType === 'detail'"
|
|
||||||
:schema="allSchemas.detailSchema"
|
|
||||||
:data="detailData"
|
|
||||||
>
|
|
||||||
<template #memberUserIds="{ row }">
|
|
||||||
<span v-for="userId in row.memberUserIds" :key="userId">
|
|
||||||
{{ getUserNickname(userId) }}
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</Descriptions>
|
</el-table-column>
|
||||||
<!-- 操作按钮 -->
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template #footer>
|
<template #default="scope">
|
||||||
<!-- 按钮:保存 -->
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||||
<XButton
|
</template>
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
</el-table-column>
|
||||||
type="primary"
|
<el-table-column
|
||||||
:title="t('action.save')"
|
label="创建时间"
|
||||||
:loading="actionLoading"
|
align="center"
|
||||||
@click="submitForm"
|
prop="createTime"
|
||||||
|
:formatter="dateFormatter"
|
||||||
/>
|
/>
|
||||||
<!-- 按钮:关闭 -->
|
<el-table-column label="操作" align="center">
|
||||||
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
v-hasPermi="['bpm:user-group:update']"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['bpm:user-group:delete']"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</XModal>
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
|
<UserGroupForm ref="formRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts" name="UserGroup">
|
||||||
// 业务相关的 import
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
import * as UserGroupApi from '@/api/bpm/userGroup'
|
import * as UserGroupApi from '@/api/bpm/userGroup'
|
||||||
import { getListSimpleUsersApi, UserVO } from '@/api/system/user'
|
import * as UserApi from '@/api/system/user'
|
||||||
import { allSchemas, rules } from './group.data'
|
import UserGroupForm from './UserGroupForm.vue'
|
||||||
import { FormExpose } from '@/components/Form'
|
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
// 列表相关的变量
|
const { t } = useI18n() // 国际化
|
||||||
const [registerTable, { reload, deleteData }] = useXTable({
|
|
||||||
allSchemas: allSchemas,
|
const loading = ref(true) // 列表的加载中
|
||||||
getListApi: UserGroupApi.getUserGroupPageApi,
|
const total = ref(0) // 列表的总页数
|
||||||
deleteApi: UserGroupApi.deleteUserGroupApi
|
const list = ref([]) // 列表的数据
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null,
|
||||||
|
status: null,
|
||||||
|
createTime: []
|
||||||
})
|
})
|
||||||
// 用户列表
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const users = ref<UserVO[]>([])
|
const userList = ref([]) // 用户列表
|
||||||
|
|
||||||
const getUserNickname = (userId) => {
|
/** 查询参数列表 */
|
||||||
for (const user of users.value) {
|
const getList = async () => {
|
||||||
if (user.id === userId) {
|
loading.value = true
|
||||||
return user.nickname
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return '未知(' + userId + ')'
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== CRUD 相关 ==========
|
|
||||||
const actionLoading = ref(false) // 遮罩层
|
|
||||||
const actionType = ref('') // 操作按钮的类型
|
|
||||||
const dialogVisible = ref(false) // 是否显示弹出层
|
|
||||||
const dialogTitle = ref('edit') // 弹出层标题
|
|
||||||
const formRef = ref<FormExpose>() // 表单 Ref
|
|
||||||
const detailData = ref() // 详情 Ref
|
|
||||||
|
|
||||||
// 设置标题
|
|
||||||
const setDialogTile = (type: string) => {
|
|
||||||
dialogTitle.value = t('action.' + type)
|
|
||||||
actionType.value = type
|
|
||||||
dialogVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增操作
|
|
||||||
const handleCreate = () => {
|
|
||||||
setDialogTile('create')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改操作
|
|
||||||
const handleUpdate = async (rowId: number) => {
|
|
||||||
setDialogTile('update')
|
|
||||||
// 设置数据
|
|
||||||
const res = await UserGroupApi.getUserGroupApi(rowId)
|
|
||||||
unref(formRef)?.setValues(res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 详情操作
|
|
||||||
const handleDetail = async (rowId: number) => {
|
|
||||||
setDialogTile('detail')
|
|
||||||
detailData.value = await UserGroupApi.getUserGroupApi(rowId)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 提交按钮
|
|
||||||
const submitForm = async () => {
|
|
||||||
const elForm = unref(formRef)?.getElFormRef()
|
|
||||||
if (!elForm) return
|
|
||||||
elForm.validate(async (valid) => {
|
|
||||||
if (valid) {
|
|
||||||
actionLoading.value = true
|
|
||||||
// 提交请求
|
|
||||||
try {
|
try {
|
||||||
const data = unref(formRef)?.formModel as UserGroupApi.UserGroupVO
|
const data = await UserGroupApi.getUserGroupPage(queryParams)
|
||||||
if (actionType.value === 'create') {
|
list.value = data.list
|
||||||
await UserGroupApi.createUserGroupApi(data)
|
total.value = data.total
|
||||||
message.success(t('common.createSuccess'))
|
|
||||||
} else {
|
|
||||||
await UserGroupApi.updateUserGroupApi(data)
|
|
||||||
message.success(t('common.updateSuccess'))
|
|
||||||
}
|
|
||||||
dialogVisible.value = false
|
|
||||||
} finally {
|
} finally {
|
||||||
actionLoading.value = false
|
loading.value = false
|
||||||
// 刷新列表
|
|
||||||
await reload()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== 初始化 ==========
|
/** 搜索按钮操作 */
|
||||||
onMounted(() => {
|
const handleQuery = () => {
|
||||||
getListSimpleUsersApi().then((data) => {
|
queryParams.pageNo = 1
|
||||||
users.value = data
|
getList()
|
||||||
})
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const formRef = ref()
|
||||||
|
const openForm = (type: string, id?: number) => {
|
||||||
|
formRef.value.open(type, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await UserGroupApi.deleteUserGroup(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(async () => {
|
||||||
|
await getList()
|
||||||
|
// 加载用户列表
|
||||||
|
userList.value = await UserApi.getSimpleUserList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -378,7 +378,7 @@ onMounted(() => {
|
|||||||
// 加载详情
|
// 加载详情
|
||||||
getDetail()
|
getDetail()
|
||||||
// 加载用户的列表
|
// 加载用户的列表
|
||||||
UserApi.getListSimpleUsersApi().then((data) => {
|
UserApi.getSimpleUserList().then((data) => {
|
||||||
userOptions.value.push(...data)
|
userOptions.value.push(...data)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -139,9 +139,9 @@ import { FormInstance } from 'element-plus'
|
|||||||
// 业务相关的 import
|
// 业务相关的 import
|
||||||
import * as TaskAssignRuleApi from '@/api/bpm/taskAssignRule'
|
import * as TaskAssignRuleApi from '@/api/bpm/taskAssignRule'
|
||||||
import { listSimpleRolesApi } from '@/api/system/role'
|
import { listSimpleRolesApi } from '@/api/system/role'
|
||||||
import { listSimplePostsApi } from '@/api/system/post'
|
import { getSimplePostList } from '@/api/system/post'
|
||||||
import { getListSimpleUsersApi } from '@/api/system/user'
|
import { getSimpleUserList } from '@/api/system/user'
|
||||||
import { listSimpleUserGroupsApi } from '@/api/bpm/userGroup'
|
import { listSimpleUserGroup } from '@/api/bpm/userGroup'
|
||||||
import { listSimpleDeptApi } from '@/api/system/dept'
|
import { listSimpleDeptApi } from '@/api/system/dept'
|
||||||
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||||
import { handleTree, defaultProps } from '@/utils/tree'
|
import { handleTree, defaultProps } from '@/utils/tree'
|
||||||
@ -336,17 +336,17 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
// 获得岗位列表
|
// 获得岗位列表
|
||||||
postOptions.value = []
|
postOptions.value = []
|
||||||
listSimplePostsApi().then((data) => {
|
getSimplePostList().then((data) => {
|
||||||
postOptions.value.push(...data)
|
postOptions.value.push(...data)
|
||||||
})
|
})
|
||||||
// 获得用户列表
|
// 获得用户列表
|
||||||
userOptions.value = []
|
userOptions.value = []
|
||||||
getListSimpleUsersApi().then((data) => {
|
getSimpleUserList().then((data) => {
|
||||||
userOptions.value.push(...data)
|
userOptions.value.push(...data)
|
||||||
})
|
})
|
||||||
// 获得用户组列表
|
// 获得用户组列表
|
||||||
userGroupOptions.value = []
|
userGroupOptions.value = []
|
||||||
listSimpleUserGroupsApi().then((data) => {
|
listSimpleUserGroup().then((data) => {
|
||||||
userGroupOptions.value.push(...data)
|
userGroupOptions.value.push(...data)
|
||||||
})
|
})
|
||||||
if (!isShow) {
|
if (!isShow) {
|
||||||
|
@ -1,76 +0,0 @@
|
|||||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
|
||||||
|
|
||||||
// CrudSchema
|
|
||||||
const crudSchemas = reactive<VxeCrudSchema>({
|
|
||||||
primaryKey: 'id',
|
|
||||||
primaryType: 'id',
|
|
||||||
primaryTitle: '日志编号',
|
|
||||||
action: true,
|
|
||||||
actionWidth: '300',
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
title: '链路追踪',
|
|
||||||
field: 'traceId',
|
|
||||||
isTable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '用户编号',
|
|
||||||
field: 'userId',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '用户类型',
|
|
||||||
field: 'userType',
|
|
||||||
dictType: DICT_TYPE.USER_TYPE,
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '应用名',
|
|
||||||
field: 'applicationName',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '请求方法名',
|
|
||||||
field: 'requestMethod'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '请求地址',
|
|
||||||
field: 'requestUrl',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '异常发生时间',
|
|
||||||
field: 'exceptionTime',
|
|
||||||
formatter: 'formatDate',
|
|
||||||
search: {
|
|
||||||
show: true,
|
|
||||||
itemRender: {
|
|
||||||
name: 'XDataTimePicker'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '异常名',
|
|
||||||
field: 'exceptionName'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '处理状态',
|
|
||||||
field: 'processStatus',
|
|
||||||
dictType: DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS,
|
|
||||||
dictClass: 'number',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '处理人',
|
|
||||||
field: 'processUserId',
|
|
||||||
isTable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '处理时间',
|
|
||||||
field: 'processTime',
|
|
||||||
formatter: 'formatDate',
|
|
||||||
isTable: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
|
76
src/views/infra/apiErrorLog/detail.vue
Normal file
76
src/views/infra/apiErrorLog/detail.vue
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog title="详情" v-model="modelVisible" :scroll="true" :max-height="500" width="800">
|
||||||
|
<el-descriptions border :column="1">
|
||||||
|
<el-descriptions-item label="日志主键" min-width="120">
|
||||||
|
{{ detailData.id }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="链路追踪">
|
||||||
|
{{ detailData.traceId }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="应用名">
|
||||||
|
{{ detailData.applicationName }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="用户信息">
|
||||||
|
{{ detailData.userId }} |
|
||||||
|
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="detailData.userType" />
|
||||||
|
| {{ detailData.userIp }} | {{ detailData.userAgent }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="请求信息">
|
||||||
|
{{ detailData.requestMethod }} | {{ detailData.requestUrl }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="请求参数">
|
||||||
|
{{ detailData.requestParams }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="异常时间">
|
||||||
|
{{ formatDate(detailData.exceptionTime, 'YYYY-MM-DD HH:mm:ss') }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="异常名">
|
||||||
|
{{ detailData.exceptionName }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="异常名" v-if="detailData.exceptionStackTrace">
|
||||||
|
<el-input
|
||||||
|
type="textarea"
|
||||||
|
:readonly="true"
|
||||||
|
:autosize="{ maxRows: 20 }"
|
||||||
|
v-model="detailData.exceptionStackTrace"
|
||||||
|
/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="处理状态">
|
||||||
|
<dict-tag
|
||||||
|
:type="DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS"
|
||||||
|
:value="detailData.processStatus"
|
||||||
|
/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="处理人" v-if="detailData.processUserId">
|
||||||
|
{{ detailData.processUserId }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="处理时间" v-if="detailData.processTime">
|
||||||
|
{{ formatDate(detailData.processTime, 'YYYY-MM-DD HH:mm:ss') }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { formatDate } from '@/utils/formatTime'
|
||||||
|
import * as ApiErrorLog from '@/api/infra/apiErrorLog'
|
||||||
|
|
||||||
|
const modelVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const detailLoading = ref(false) // 表单的加载中
|
||||||
|
const detailData = ref() // 详情数据
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const openModal = async (data: ApiErrorLog.ApiErrorLogVO) => {
|
||||||
|
modelVisible.value = true
|
||||||
|
// 设置数据
|
||||||
|
detailLoading.value = true
|
||||||
|
try {
|
||||||
|
detailData.value = data
|
||||||
|
} finally {
|
||||||
|
detailLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
|
||||||
|
</script>
|
@ -1,99 +1,242 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentWrap>
|
<content-wrap>
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="用户编号" prop="userId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.userId"
|
||||||
|
placeholder="请输入用户编号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户类型" prop="userType">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.userType"
|
||||||
|
placeholder="请选择用户类型"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getDictOptions(DICT_TYPE.USER_TYPE)"
|
||||||
|
:key="parseInt(dict.value)"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="parseInt(dict.value)"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="应用名" prop="applicationName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.applicationName"
|
||||||
|
placeholder="请输入应用名"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="异常时间" prop="exceptionTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.exceptionTime"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="处理状态" prop="processStatus">
|
||||||
|
<el-select v-model="queryParams.processStatus" placeholder="请选择处理状态" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getDictOptions(DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS)"
|
||||||
|
:key="parseInt(dict.value)"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="parseInt(dict.value)"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="handleExport"
|
||||||
|
:loading="exportLoading"
|
||||||
|
v-hasPermi="['infra:api-error-log:export']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</content-wrap>
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<XTable @register="registerTable">
|
<content-wrap>
|
||||||
<!-- 操作:导出 -->
|
<el-table v-loading="loading" :data="list">
|
||||||
<template #toolbar_buttons>
|
<el-table-column label="日志编号" align="center" prop="id" />
|
||||||
<XButton
|
<el-table-column label="用户编号" align="center" prop="userId" />
|
||||||
type="warning"
|
<el-table-column label="用户类型" align="center" prop="userType">
|
||||||
preIcon="ep:download"
|
<template #default="scope">
|
||||||
:title="t('action.export')"
|
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType" />
|
||||||
@click="exportList('错误数据.xls')"
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="应用名" align="center" prop="applicationName" />
|
||||||
|
<el-table-column label="请求方法名" align="center" prop="requestMethod" />
|
||||||
|
<el-table-column label="请求地址" align="center" prop="requestUrl" width="250" />
|
||||||
|
<el-table-column label="异常发生时间" align="center" prop="exceptionTime" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ scope.row.exceptionTime }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="异常名" align="center" prop="exceptionName" width="250" />
|
||||||
|
<el-table-column label="处理状态" align="center" prop="processStatus">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag
|
||||||
|
:type="DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS"
|
||||||
|
:value="scope.row.processStatus"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #duration_default="{ row }">
|
</el-table-column>
|
||||||
<span>{{ row.duration + 'ms' }}</span>
|
<el-table-column label="操作" align="center">
|
||||||
</template>
|
<template #default="scope">
|
||||||
<template #resultCode_default="{ row }">
|
<el-button
|
||||||
<span>{{ row.resultCode === 0 ? '成功' : '失败(' + row.resultMsg + ')' }}</span>
|
link
|
||||||
</template>
|
type="primary"
|
||||||
<template #actionbtns_default="{ row }">
|
@click="openModal(scope.row)"
|
||||||
<!-- 操作:详情 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:view"
|
|
||||||
:title="t('action.detail')"
|
|
||||||
v-hasPermi="['infra:api-access-log:query']"
|
v-hasPermi="['infra:api-access-log:query']"
|
||||||
@click="handleDetail(row)"
|
>
|
||||||
/>
|
详细
|
||||||
<XTextButton
|
</el-button>
|
||||||
preIcon="ep:cpu"
|
<el-button
|
||||||
title="已处理"
|
link
|
||||||
v-if="row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
|
type="primary"
|
||||||
|
v-if="scope.row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
|
||||||
|
@click="
|
||||||
|
handleProcessClick(InfraApiErrorLogProcessStatusEnum.DONE, '已处理', scope.row.id)
|
||||||
|
"
|
||||||
v-hasPermi="['infra:api-error-log:update-status']"
|
v-hasPermi="['infra:api-error-log:update-status']"
|
||||||
@click="handleProcessClick(row, InfraApiErrorLogProcessStatusEnum.DONE, '已处理')"
|
>
|
||||||
/>
|
已处理
|
||||||
<XTextButton
|
</el-button>
|
||||||
preIcon="ep:mute-notification"
|
<el-button
|
||||||
title="已忽略"
|
link
|
||||||
v-if="row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
|
type="primary"
|
||||||
|
icon="el-icon-check"
|
||||||
|
v-if="scope.row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
|
||||||
|
@click="
|
||||||
|
handleProcessClick(InfraApiErrorLogProcessStatusEnum.IGNORE, '已忽略', scope.row.id)
|
||||||
|
"
|
||||||
v-hasPermi="['infra:api-error-log:update-status']"
|
v-hasPermi="['infra:api-error-log:update-status']"
|
||||||
@click="handleProcessClick(row, InfraApiErrorLogProcessStatusEnum.IGNORE, '已忽略')"
|
>
|
||||||
|
已忽略
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
</content-wrap>
|
||||||
|
|
||||||
|
<!-- 表单弹窗:详情 -->
|
||||||
|
<api-error-log-detail ref="modalRef" />
|
||||||
</template>
|
</template>
|
||||||
</XTable>
|
|
||||||
</ContentWrap>
|
|
||||||
<XModal v-model="dialogVisible" :title="dialogTitle">
|
|
||||||
<!-- 对话框(详情) -->
|
|
||||||
<Descriptions :schema="allSchemas.detailSchema" :data="detailData" />
|
|
||||||
<!-- 操作按钮 -->
|
|
||||||
<template #footer>
|
|
||||||
<XButton :title="t('dialog.close')" @click="dialogVisible = false" />
|
|
||||||
</template>
|
|
||||||
</XModal>
|
|
||||||
</template>
|
|
||||||
<script setup lang="ts" name="ApiErrorLog">
|
<script setup lang="ts" name="ApiErrorLog">
|
||||||
import { allSchemas } from './apiErrorLog.data'
|
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||||
|
import download from '@/utils/download'
|
||||||
import * as ApiErrorLogApi from '@/api/infra/apiErrorLog'
|
import * as ApiErrorLogApi from '@/api/infra/apiErrorLog'
|
||||||
|
import ApiErrorLogDetail from './detail.vue'
|
||||||
import { InfraApiErrorLogProcessStatusEnum } from '@/utils/constants'
|
import { InfraApiErrorLogProcessStatusEnum } from '@/utils/constants'
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const loading = ref(true) // 列表的加载中
|
||||||
const message = useMessage()
|
const total = ref(0) // 列表的总页数
|
||||||
|
const list = ref([]) // 列表的数据
|
||||||
// ========== 列表相关 ==========
|
const queryParams = reactive({
|
||||||
const [registerTable, { reload, exportList }] = useXTable({
|
pageNo: 1,
|
||||||
allSchemas: allSchemas,
|
pageSize: 10,
|
||||||
getListApi: ApiErrorLogApi.getApiErrorLogPageApi,
|
userId: null,
|
||||||
exportListApi: ApiErrorLogApi.exportApiErrorLogApi
|
userType: null,
|
||||||
|
applicationName: null,
|
||||||
|
requestUrl: null,
|
||||||
|
processStatus: null,
|
||||||
|
exceptionTime: []
|
||||||
})
|
})
|
||||||
// ========== 详情相关 ==========
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const detailData = ref() // 详情 Ref
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
const dialogVisible = ref(false) // 是否显示弹出层
|
|
||||||
const dialogTitle = ref('') // 弹出层标题
|
|
||||||
|
|
||||||
// 详情操作
|
/** 查询参数列表 */
|
||||||
const handleDetail = (row: ApiErrorLogApi.ApiErrorLogVO) => {
|
const getList = async () => {
|
||||||
// 设置数据
|
loading.value = true
|
||||||
detailData.value = row
|
try {
|
||||||
dialogTitle.value = t('action.detail')
|
const data = await ApiErrorLogApi.getApiErrorLogPageApi(queryParams)
|
||||||
dialogVisible.value = true
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 异常处理操作
|
/** 重置按钮操作 */
|
||||||
const handleProcessClick = (
|
const resetQuery = () => {
|
||||||
row: ApiErrorLogApi.ApiErrorLogVO,
|
queryFormRef.value.resetFields()
|
||||||
processSttatus: number,
|
handleQuery()
|
||||||
type: string
|
}
|
||||||
) => {
|
|
||||||
message
|
/** 详情操作 */
|
||||||
.confirm('确认标记为' + type + '?', t('common.reminder'))
|
const modalRef = ref()
|
||||||
.then(async () => {
|
const openModal = (data: ApiErrorLogApi.ApiErrorLogVO) => {
|
||||||
await ApiErrorLogApi.updateApiErrorLogPageApi(row.id, processSttatus)
|
modalRef.value.openModal(data)
|
||||||
message.success(t('common.updateSuccess'))
|
}
|
||||||
})
|
|
||||||
.finally(async () => {
|
/** 处理已处理 / 已忽略的操作 **/
|
||||||
|
const handleProcessClick = async (processStatus: number, type: string, id: number) => {
|
||||||
|
try {
|
||||||
|
// 操作的二次确认
|
||||||
|
await message.confirm('确认标记为' + type + '?')
|
||||||
|
// 执行操作
|
||||||
|
await ApiErrorLogApi.updateApiErrorLogPageApi(id, processStatus)
|
||||||
|
await message.success(type)
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
await reload()
|
await getList()
|
||||||
})
|
} catch {}
|
||||||
.catch(() => {})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await ApiErrorLogApi.exportApiErrorLogApi(queryParams)
|
||||||
|
download.excel(data, '操作日志.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
import { PropType } from 'vue'
|
import { PropType } from 'vue'
|
||||||
import { DictTypeVO } from '@/api/system/dict/types'
|
import { DictTypeVO } from '@/api/system/dict/types'
|
||||||
import { CodegenColumnVO } from '@/api/infra/codegen/types'
|
import { CodegenColumnVO } from '@/api/infra/codegen/types'
|
||||||
import { listSimpleDictTypeApi } from '@/api/system/dict/dict.type'
|
import { listSimpleDictType } from '@/api/system/dict/dict.type'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
info: {
|
info: {
|
||||||
@ -125,7 +125,7 @@ const props = defineProps({
|
|||||||
/** 查询字典下拉列表 */
|
/** 查询字典下拉列表 */
|
||||||
const dictOptions = ref<DictTypeVO[]>()
|
const dictOptions = ref<DictTypeVO[]>()
|
||||||
const getDictOptions = async () => {
|
const getDictOptions = async () => {
|
||||||
const res = await listSimpleDictTypeApi()
|
const res = await listSimpleDictType()
|
||||||
dictOptions.value = res
|
dictOptions.value = res
|
||||||
}
|
}
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<content-wrap>
|
<content-wrap>
|
||||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true">
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="参数名称" prop="name">
|
<el-form-item label="参数名称" prop="name">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.name"
|
v-model="queryParams.name"
|
||||||
placeholder="请输入参数名称"
|
placeholder="请输入参数名称"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="参数键名" prop="key">
|
<el-form-item label="参数键名" prop="key">
|
||||||
@ -16,10 +23,16 @@
|
|||||||
placeholder="请输入参数键名"
|
placeholder="请输入参数键名"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="系统内置" prop="type">
|
<el-form-item label="系统内置" prop="type">
|
||||||
<el-select v-model="queryParams.type" placeholder="请选择系统内置" clearable>
|
<el-select
|
||||||
|
v-model="queryParams.type"
|
||||||
|
placeholder="请选择系统内置"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in getDictOptions(DICT_TYPE.INFRA_CONFIG_TYPE)"
|
v-for="dict in getDictOptions(DICT_TYPE.INFRA_CONFIG_TYPE)"
|
||||||
:key="parseInt(dict.value)"
|
:key="parseInt(dict.value)"
|
||||||
@ -36,6 +49,7 @@
|
|||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
class="!w-240px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
|
@ -90,10 +90,10 @@
|
|||||||
<script setup lang="ts" name="Dept">
|
<script setup lang="ts" name="Dept">
|
||||||
import { handleTree } from '@/utils/tree'
|
import { handleTree } from '@/utils/tree'
|
||||||
import * as DeptApi from '@/api/system/dept'
|
import * as DeptApi from '@/api/system/dept'
|
||||||
import { getListSimpleUsersApi, UserVO } from '@/api/system/user'
|
|
||||||
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||||
import DeptForm from './form.vue'
|
import DeptForm from './form.vue'
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
import { getSimpleUserList, UserVO } from '@/api/system/user'
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
// 搜索变量
|
// 搜索变量
|
||||||
@ -115,7 +115,7 @@ const loading = ref(true) // 列表的加载中
|
|||||||
|
|
||||||
//获取用户列表
|
//获取用户列表
|
||||||
const getUserList = async () => {
|
const getUserList = async () => {
|
||||||
const res = await getListSimpleUsersApi()
|
const res = await getSimpleUserList()
|
||||||
userOption.value = res
|
userOption.value = res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
177
src/views/system/dict/data.form.vue
Normal file
177
src/views/system/dict/data.form.vue
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog :title="modelTitle" v-model="modelVisible">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="80px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="字典类型" prop="type">
|
||||||
|
<el-input
|
||||||
|
:disabled="typeof formData.id !== 'undefined'"
|
||||||
|
v-model="formData.dictType"
|
||||||
|
placeholder="请输入参数名称"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数据标签" prop="label">
|
||||||
|
<el-input v-model="formData.label" placeholder="请输入数据标签" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数据键值" prop="value">
|
||||||
|
<el-input v-model="formData.value" placeholder="请输入数据键值" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="显示排序" prop="sort">
|
||||||
|
<el-input-number v-model="formData.sort" controls-position="right" :min="0" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-radio-group v-model="formData.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="parseInt(dict.value)"
|
||||||
|
:label="parseInt(dict.value)"
|
||||||
|
>{{ dict.label }}</el-radio
|
||||||
|
>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="颜色类型" prop="colorType">
|
||||||
|
<el-select v-model="formData.colorType">
|
||||||
|
<el-option
|
||||||
|
v-for="item in colorTypeOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label + '(' + item.value + ')'"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="CSS Class" prop="cssClass">
|
||||||
|
<el-input v-model="formData.cssClass" placeholder="请输入 CSS Class" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="formData.remark" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="modelVisible = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||||
|
import * as DictDataApi from '@/api/system/dict/dict.data'
|
||||||
|
import { CommonStatusEnum } from '@/utils/constants'
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const modelVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const modelTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
sort: undefined,
|
||||||
|
label: '',
|
||||||
|
value: '',
|
||||||
|
dictType: '',
|
||||||
|
status: CommonStatusEnum.ENABLE,
|
||||||
|
colorType: '',
|
||||||
|
cssClass: '',
|
||||||
|
remark: ''
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
label: [{ required: true, message: '数据标签不能为空', trigger: 'blur' }],
|
||||||
|
value: [{ required: true, message: '数据键值不能为空', trigger: 'blur' }],
|
||||||
|
sort: [{ required: true, message: '数据顺序不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
// 数据标签回显样式
|
||||||
|
const colorTypeOptions = readonly([
|
||||||
|
{
|
||||||
|
value: 'default',
|
||||||
|
label: '默认'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'primary',
|
||||||
|
label: '主要'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'success',
|
||||||
|
label: '成功'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'info',
|
||||||
|
label: '信息'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'warning',
|
||||||
|
label: '警告'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'danger',
|
||||||
|
label: '危险'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const openModal = async (type: string, id?: number) => {
|
||||||
|
modelVisible.value = true
|
||||||
|
modelTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await DictDataApi.getDictData(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
if (!formRef) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as DictDataApi.DictDataVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await DictDataApi.createDictData(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await DictDataApi.updateDictData(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
modelVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
sort: undefined,
|
||||||
|
label: '',
|
||||||
|
value: '',
|
||||||
|
dictType: '',
|
||||||
|
status: CommonStatusEnum.ENABLE,
|
||||||
|
colorType: '',
|
||||||
|
cssClass: '',
|
||||||
|
remark: ''
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
202
src/views/system/dict/data.vue
Normal file
202
src/views/system/dict/data.vue
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
<template>
|
||||||
|
<content-wrap>
|
||||||
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="字典名称" prop="dictType">
|
||||||
|
<el-select v-model="queryParams.dictType" class="!w-240px">
|
||||||
|
<el-option v-for="item in dicts" :key="item.type" :label="item.name" :value="item.type" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="字典标签" prop="label">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.label"
|
||||||
|
placeholder="请输入字典标签"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="数据状态" clearable class="!w-240px">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
|
<el-button type="primary" @click="openModal('create')" v-hasPermi="['system:dict:create']">
|
||||||
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="handleExport"
|
||||||
|
:loading="exportLoading"
|
||||||
|
v-hasPermi="['system:dict:export']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</content-wrap>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<content-wrap>
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="字典编码" align="center" prop="id" />
|
||||||
|
<el-table-column label="字典标签" align="center" prop="label" />
|
||||||
|
<el-table-column label="字典键值" align="center" prop="value" />
|
||||||
|
<el-table-column label="字典排序" align="center" prop="sort" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="颜色类型" align="center" prop="colorType" />
|
||||||
|
<el-table-column label="CSS Class" align="center" prop="cssClass" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
width="180"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
/>
|
||||||
|
<el-table-column label="操作" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openModal('update', scope.row.id)"
|
||||||
|
v-hasPermi="['system:dict:update']"
|
||||||
|
>
|
||||||
|
修改
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['system:dict:delete']"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</content-wrap>
|
||||||
|
|
||||||
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
|
<data-form ref="modalRef" @success="getList" />
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts" name="Data">
|
||||||
|
import * as DictDataApi from '@/api/system/dict/dict.data'
|
||||||
|
import * as DictTypeApi from '@/api/system/dict/dict.type'
|
||||||
|
import { getDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
|
import download from '@/utils/download'
|
||||||
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
import DataForm from './data.form.vue'
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const route = useRoute() // 路由
|
||||||
|
|
||||||
|
const loading = ref(true) // 列表的加载中
|
||||||
|
const total = ref(0) // 列表的总页数
|
||||||
|
const list = ref([]) // 列表的数据
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
label: '',
|
||||||
|
status: undefined,
|
||||||
|
dictType: route.params.dictType
|
||||||
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
const dicts = ref<DictTypeApi.DictTypeVO[]>() // 字典类型的列表
|
||||||
|
|
||||||
|
/** 查询参数列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await DictDataApi.getDictDataPage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const modalRef = ref()
|
||||||
|
const openModal = (type: string, id?: number) => {
|
||||||
|
modalRef.value.openModal(type, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await DictDataApi.deleteDictData(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await DictDataApi.exportDictDataApi(queryParams)
|
||||||
|
download.excel(data, '字典数据.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询字典(精简)列表 */
|
||||||
|
const getDictList = async () => {
|
||||||
|
dicts.value = await DictTypeApi.listSimpleDictType()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
// 查询字典(精简)列表
|
||||||
|
getDictList()
|
||||||
|
})
|
||||||
|
</script>
|
@ -1,104 +0,0 @@
|
|||||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
|
||||||
// 国际化
|
|
||||||
const { t } = useI18n()
|
|
||||||
// 表单校验
|
|
||||||
export const dictDataRules = reactive({
|
|
||||||
label: [required],
|
|
||||||
value: [required],
|
|
||||||
sort: [required]
|
|
||||||
})
|
|
||||||
// crudSchemas
|
|
||||||
export const crudSchemas = reactive<VxeCrudSchema>({
|
|
||||||
primaryKey: 'id',
|
|
||||||
primaryType: null,
|
|
||||||
action: true,
|
|
||||||
actionWidth: '140px',
|
|
||||||
searchSpan: 12,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
title: '字典类型',
|
|
||||||
field: 'dictType',
|
|
||||||
isTable: false,
|
|
||||||
isForm: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '数据标签',
|
|
||||||
field: 'label',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '数据键值',
|
|
||||||
field: 'value'
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '标签类型',
|
|
||||||
// field: 'colorType',
|
|
||||||
// form: {
|
|
||||||
// component: 'Select',
|
|
||||||
// componentProps: {
|
|
||||||
// options: [
|
|
||||||
// {
|
|
||||||
// label: 'default',
|
|
||||||
// value: ''
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: 'success',
|
|
||||||
// value: 'success'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: 'info',
|
|
||||||
// value: 'info'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: 'warning',
|
|
||||||
// value: 'warning'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: 'danger',
|
|
||||||
// value: 'danger'
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// isTable: false
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
title: '颜色',
|
|
||||||
field: 'cssClass',
|
|
||||||
isTable: false,
|
|
||||||
form: {
|
|
||||||
component: 'ColorPicker',
|
|
||||||
componentProps: {
|
|
||||||
predefine: ['#ffffff', '#409eff', '#67c23a', '#e6a23c', '#f56c6c', '#909399', '#c71585']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '显示排序',
|
|
||||||
field: 'sort',
|
|
||||||
isTable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('common.status'),
|
|
||||||
field: 'status',
|
|
||||||
dictType: DICT_TYPE.COMMON_STATUS,
|
|
||||||
dictClass: 'number'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('form.remark'),
|
|
||||||
field: 'remark',
|
|
||||||
form: {
|
|
||||||
component: 'Input',
|
|
||||||
componentProps: {
|
|
||||||
type: 'textarea',
|
|
||||||
rows: 4
|
|
||||||
},
|
|
||||||
colProps: {
|
|
||||||
span: 24
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isTable: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
|
@ -1,65 +0,0 @@
|
|||||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
|
|
||||||
// 表单校验
|
|
||||||
export const dictTypeRules = reactive({
|
|
||||||
name: [required],
|
|
||||||
type: [required]
|
|
||||||
})
|
|
||||||
// 新增 + 修改
|
|
||||||
const crudSchemas = reactive<VxeCrudSchema>({
|
|
||||||
primaryKey: 'id',
|
|
||||||
primaryType: null,
|
|
||||||
action: true,
|
|
||||||
actionWidth: '140px',
|
|
||||||
searchSpan: 12,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
title: '字典名称',
|
|
||||||
field: 'name',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '字典类型',
|
|
||||||
field: 'type',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('common.status'),
|
|
||||||
field: 'status',
|
|
||||||
dictType: DICT_TYPE.COMMON_STATUS,
|
|
||||||
dictClass: 'number',
|
|
||||||
table: {
|
|
||||||
width: 70
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('common.createTime'),
|
|
||||||
field: 'createTime',
|
|
||||||
formatter: 'formatDate',
|
|
||||||
isForm: false,
|
|
||||||
isTable: false,
|
|
||||||
search: {
|
|
||||||
show: true,
|
|
||||||
itemRender: {
|
|
||||||
name: 'XDataTimePicker'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('form.remark'),
|
|
||||||
field: 'remark',
|
|
||||||
isTable: false,
|
|
||||||
form: {
|
|
||||||
componentProps: {
|
|
||||||
type: 'textarea',
|
|
||||||
rows: 4
|
|
||||||
},
|
|
||||||
colProps: {
|
|
||||||
span: 24
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
|
123
src/views/system/dict/form.vue
Normal file
123
src/views/system/dict/form.vue
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog :title="modelTitle" v-model="modelVisible">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="80px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="字典名称" prop="name">
|
||||||
|
<el-input v-model="formData.name" placeholder="请输入字典名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="字典类型" prop="type">
|
||||||
|
<el-input
|
||||||
|
:disabled="typeof formData.id !== 'undefined'"
|
||||||
|
v-model="formData.type"
|
||||||
|
placeholder="请输入参数名称"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-radio-group v-model="formData.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="parseInt(dict.value)"
|
||||||
|
:label="parseInt(dict.value)"
|
||||||
|
>{{ dict.label }}</el-radio
|
||||||
|
>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="formData.remark" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="modelVisible = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||||
|
import * as DictTypeApi from '@/api/system/dict/dict.type'
|
||||||
|
import { CommonStatusEnum } from '@/utils/constants'
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const modelVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const modelTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
name: '',
|
||||||
|
type: '',
|
||||||
|
status: CommonStatusEnum.ENABLE,
|
||||||
|
remark: ''
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
name: [{ required: true, message: '字典名称不能为空', trigger: 'blur' }],
|
||||||
|
type: [{ required: true, message: '字典类型不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const openModal = async (type: string, id?: number) => {
|
||||||
|
modelVisible.value = true
|
||||||
|
modelTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await DictTypeApi.getDictType(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
if (!formRef) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as DictTypeApi.DictTypeVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await DictTypeApi.createDictType(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await DictTypeApi.updateDictType(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
modelVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
type: '',
|
||||||
|
name: '',
|
||||||
|
status: CommonStatusEnum.ENABLE,
|
||||||
|
remark: ''
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
@ -1,257 +1,211 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex">
|
<!-- 搜索工作栏 -->
|
||||||
<!-- ====== 字典分类 ====== -->
|
<content-wrap>
|
||||||
<el-card class="w-1/2 dict" :gutter="12" shadow="always">
|
<el-form
|
||||||
<template #header>
|
class="-mb-15px"
|
||||||
<div class="card-header">
|
:model="queryParams"
|
||||||
<span>字典分类</span>
|
ref="queryFormRef"
|
||||||
</div>
|
:inline="true"
|
||||||
</template>
|
label-width="68px"
|
||||||
<XTable @register="registerType" @cell-click="cellClickEvent">
|
|
||||||
<!-- 操作:新增类型 -->
|
|
||||||
<template #toolbar_buttons>
|
|
||||||
<XButton
|
|
||||||
type="primary"
|
|
||||||
preIcon="ep:zoom-in"
|
|
||||||
:title="t('action.add')"
|
|
||||||
v-hasPermi="['system:dict:create']"
|
|
||||||
@click="handleTypeCreate()"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #actionbtns_default="{ row }">
|
|
||||||
<!-- 操作:编辑类型 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:edit"
|
|
||||||
:title="t('action.edit')"
|
|
||||||
v-hasPermi="['system:dict:update']"
|
|
||||||
@click="handleTypeUpdate(row.id)"
|
|
||||||
/>
|
|
||||||
<!-- 操作:删除类型 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:delete"
|
|
||||||
:title="t('action.del')"
|
|
||||||
v-hasPermi="['system:dict:delete']"
|
|
||||||
@click="typeDeleteData(row.id)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</XTable>
|
|
||||||
<!-- @星语:分页和列表重叠在一起了 -->
|
|
||||||
</el-card>
|
|
||||||
<!-- ====== 字典数据 ====== -->
|
|
||||||
<el-card class="w-1/2 dict ml-3" :gutter="12" shadow="hover">
|
|
||||||
<template #header>
|
|
||||||
<div class="card-header">
|
|
||||||
<span>字典数据</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<!-- 列表 -->
|
|
||||||
<div v-if="!tableTypeSelect">
|
|
||||||
<span>请从左侧选择</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="tableTypeSelect">
|
|
||||||
<!-- 列表 -->
|
|
||||||
<XTable @register="registerData">
|
|
||||||
<!-- 操作:新增数据 -->
|
|
||||||
<template #toolbar_buttons>
|
|
||||||
<XButton
|
|
||||||
type="primary"
|
|
||||||
preIcon="ep:zoom-in"
|
|
||||||
:title="t('action.add')"
|
|
||||||
v-hasPermi="['system:dict:create']"
|
|
||||||
@click="handleDataCreate()"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #actionbtns_default="{ row }">
|
|
||||||
<!-- 操作:修改数据 -->
|
|
||||||
<XTextButton
|
|
||||||
v-hasPermi="['system:dict:update']"
|
|
||||||
preIcon="ep:edit"
|
|
||||||
:title="t('action.edit')"
|
|
||||||
@click="handleDataUpdate(row.id)"
|
|
||||||
/>
|
|
||||||
<!-- 操作:删除数据 -->
|
|
||||||
<XTextButton
|
|
||||||
v-hasPermi="['system:dict:delete']"
|
|
||||||
preIcon="ep:delete"
|
|
||||||
:title="t('action.del')"
|
|
||||||
@click="dataDeleteData(row.id)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</XTable>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
<XModal id="dictModel" v-model="dialogVisible" :title="dialogTitle">
|
|
||||||
<Form
|
|
||||||
v-if="['typeCreate', 'typeUpdate'].includes(actionType)"
|
|
||||||
:schema="DictTypeSchemas.allSchemas.formSchema"
|
|
||||||
:rules="DictTypeSchemas.dictTypeRules"
|
|
||||||
ref="typeFormRef"
|
|
||||||
>
|
>
|
||||||
<template #type>
|
<el-form-item label="字典名称" prop="name">
|
||||||
<template v-if="actionType == 'typeUpdate'">
|
<el-input
|
||||||
<el-tag>{{ dictTypeValue }}</el-tag>
|
v-model="queryParams.name"
|
||||||
</template>
|
placeholder="请输入字典名称"
|
||||||
<template v-else><el-input v-model="dictTypeValue" /> </template>
|
clearable
|
||||||
</template>
|
@keyup.enter="handleQuery"
|
||||||
</Form>
|
class="!w-240px"
|
||||||
<Form
|
|
||||||
v-if="['dataCreate', 'dataUpdate'].includes(actionType)"
|
|
||||||
:schema="DictDataSchemas.allSchemas.formSchema"
|
|
||||||
:rules="DictDataSchemas.dictDataRules"
|
|
||||||
ref="dataFormRef"
|
|
||||||
/>
|
/>
|
||||||
<!-- 操作按钮 -->
|
</el-form-item>
|
||||||
<template #footer>
|
<el-form-item label="字典类型" prop="type">
|
||||||
<XButton
|
<el-input
|
||||||
v-if="['typeCreate', 'typeUpdate'].includes(actionType)"
|
v-model="queryParams.type"
|
||||||
|
placeholder="请输入字典类型"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="字典状态" clearable class="!w-240px">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="parseInt(dict.value)"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" prop="createTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.createTime"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
|
<el-button type="primary" @click="openModal('create')" v-hasPermi="['system:dict:create']">
|
||||||
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="handleExport"
|
||||||
|
:loading="exportLoading"
|
||||||
|
v-hasPermi="['system:dict:export']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</content-wrap>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<content-wrap>
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="字典编号" align="center" prop="id" />
|
||||||
|
<el-table-column label="字典名称" align="center" prop="name" show-overflow-tooltip />
|
||||||
|
<el-table-column label="字典类型" align="center" prop="type" width="300" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
width="180"
|
||||||
|
/>
|
||||||
|
<el-table-column label="操作" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
:title="t('action.save')"
|
@click="openModal('update', scope.row.id)"
|
||||||
:loading="actionLoading"
|
v-hasPermi="['system:dict:update']"
|
||||||
@click="submitTypeForm"
|
>
|
||||||
/>
|
修改
|
||||||
<XButton
|
</el-button>
|
||||||
v-if="['dataCreate', 'dataUpdate'].includes(actionType)"
|
<router-link :to="'/dict/type/data/' + scope.row.type">
|
||||||
type="primary"
|
<el-button link type="primary">数据</el-button>
|
||||||
:title="t('action.save')"
|
</router-link>
|
||||||
:loading="actionLoading"
|
<el-button
|
||||||
@click="submitDataForm"
|
link
|
||||||
/>
|
type="danger"
|
||||||
<XButton :title="t('dialog.close')" @click="dialogVisible = false" />
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['system:dict:delete']"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</XModal>
|
</el-table-column>
|
||||||
</div>
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</content-wrap>
|
||||||
|
|
||||||
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
|
<dict-type-form ref="modalRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="Dict">
|
<script setup lang="ts" name="Dict">
|
||||||
import { VxeTableEvents } from 'vxe-table'
|
import { getDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import type { FormExpose } from '@/components/Form'
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
import * as DictTypeSchemas from './dict.type'
|
|
||||||
import * as DictDataSchemas from './dict.data'
|
|
||||||
import * as DictTypeApi from '@/api/system/dict/dict.type'
|
import * as DictTypeApi from '@/api/system/dict/dict.type'
|
||||||
import * as DictDataApi from '@/api/system/dict/dict.data'
|
import DictTypeForm from './form.vue'
|
||||||
import { DictDataVO, DictTypeVO } from '@/api/system/dict/types'
|
import download from '@/utils/download'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
const [registerType, { reload: typeGetList, deleteData: typeDeleteData }] = useXTable({
|
const loading = ref(true) // 列表的加载中
|
||||||
allSchemas: DictTypeSchemas.allSchemas,
|
const total = ref(0) // 列表的总页数
|
||||||
getListApi: DictTypeApi.getDictTypePageApi,
|
const list = ref([]) // 字典表格数据
|
||||||
deleteApi: DictTypeApi.deleteDictTypeApi
|
|
||||||
})
|
|
||||||
|
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
dictType: null
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: '',
|
||||||
|
type: '',
|
||||||
|
status: undefined,
|
||||||
|
createTime: []
|
||||||
})
|
})
|
||||||
const [registerData, { reload: dataGetList, deleteData: dataDeleteData }] = useXTable({
|
const queryFormRef = ref() // 搜索的表单
|
||||||
allSchemas: DictDataSchemas.allSchemas,
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
params: queryParams,
|
|
||||||
getListApi: DictDataApi.getDictDataPageApi,
|
|
||||||
deleteApi: DictDataApi.deleteDictDataApi
|
|
||||||
})
|
|
||||||
// ========== 字典分类列表相关 ==========
|
|
||||||
const dictTypeValue = ref('')
|
|
||||||
// 字典分类修改操作
|
|
||||||
const handleTypeCreate = () => {
|
|
||||||
dictTypeValue.value = ''
|
|
||||||
setDialogTile('typeCreate')
|
|
||||||
}
|
|
||||||
const handleTypeUpdate = async (rowId: number) => {
|
|
||||||
setDialogTile('typeUpdate')
|
|
||||||
// 设置数据
|
|
||||||
const res = await DictTypeApi.getDictTypeApi(rowId)
|
|
||||||
dictTypeValue.value = res.type
|
|
||||||
unref(typeFormRef)?.setValues(res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 字典数据修改操作
|
/** 查询字典类型列表 */
|
||||||
const handleDataCreate = () => {
|
const getList = async () => {
|
||||||
setDialogTile('dataCreate')
|
loading.value = true
|
||||||
}
|
|
||||||
const handleDataUpdate = async (rowId: number) => {
|
|
||||||
setDialogTile('dataUpdate')
|
|
||||||
// 设置数据
|
|
||||||
const res = await DictDataApi.getDictDataApi(rowId)
|
|
||||||
unref(dataFormRef)?.setValues(res)
|
|
||||||
}
|
|
||||||
// 字典分类点击行事件
|
|
||||||
const parentType = ref('')
|
|
||||||
const tableTypeSelect = ref(false)
|
|
||||||
const cellClickEvent: VxeTableEvents.CellClick = async ({ row }) => {
|
|
||||||
tableTypeSelect.value = true
|
|
||||||
queryParams.dictType = row['type']
|
|
||||||
await nextTick()
|
|
||||||
await dataGetList()
|
|
||||||
parentType.value = row['type']
|
|
||||||
}
|
|
||||||
// 弹出框
|
|
||||||
const dialogVisible = ref(false) // 是否显示弹出层
|
|
||||||
const dialogTitle = ref('edit') // 弹出层标题
|
|
||||||
const actionLoading = ref(false) // 遮罩层
|
|
||||||
const typeFormRef = ref<FormExpose>() // 分类表单 Ref
|
|
||||||
const dataFormRef = ref<FormExpose>() // 数据表单 Ref
|
|
||||||
const actionType = ref('') // 操作按钮的类型
|
|
||||||
|
|
||||||
// 设置标题
|
|
||||||
const setDialogTile = (type: string) => {
|
|
||||||
dialogTitle.value = t('action.' + type)
|
|
||||||
actionType.value = type
|
|
||||||
dialogVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 同步dictTypeValue到form 否则导致表单验证不通过
|
|
||||||
watch(dictTypeValue, (val) => {
|
|
||||||
unref(typeFormRef)?.setValues({ type: val })
|
|
||||||
})
|
|
||||||
|
|
||||||
// 提交按钮
|
|
||||||
const submitTypeForm = async () => {
|
|
||||||
const elForm = unref(typeFormRef)?.getElFormRef()
|
|
||||||
if (!elForm) return
|
|
||||||
elForm.validate(async (valid) => {
|
|
||||||
if (valid && dictTypeValue.value != '') {
|
|
||||||
actionLoading.value = true
|
|
||||||
// 提交请求
|
|
||||||
try {
|
try {
|
||||||
const data = unref(typeFormRef)?.formModel as DictTypeVO
|
const data = await DictTypeApi.getDictTypePage(queryParams)
|
||||||
if (actionType.value === 'typeCreate') {
|
list.value = data.list
|
||||||
data.type = dictTypeValue.value
|
total.value = data.total
|
||||||
await DictTypeApi.createDictTypeApi(data)
|
|
||||||
message.success(t('common.createSuccess'))
|
|
||||||
} else if (actionType.value === 'typeUpdate') {
|
|
||||||
await DictTypeApi.updateDictTypeApi(data)
|
|
||||||
message.success(t('common.updateSuccess'))
|
|
||||||
}
|
|
||||||
dialogVisible.value = false
|
|
||||||
} finally {
|
} finally {
|
||||||
actionLoading.value = false
|
loading.value = false
|
||||||
typeGetList()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
}
|
}
|
||||||
const submitDataForm = async () => {
|
|
||||||
const elForm = unref(dataFormRef)?.getElFormRef()
|
/** 重置按钮操作 */
|
||||||
if (!elForm) return
|
const resetQuery = () => {
|
||||||
elForm.validate(async (valid) => {
|
queryFormRef.value.resetFields()
|
||||||
if (valid) {
|
handleQuery()
|
||||||
actionLoading.value = true
|
}
|
||||||
// 提交请求
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const modalRef = ref()
|
||||||
|
const openModal = (type: string, id?: number) => {
|
||||||
|
modalRef.value.openModal(type, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
try {
|
try {
|
||||||
const data = unref(dataFormRef)?.formModel as DictDataVO
|
// 删除的二次确认
|
||||||
if (actionType.value === 'dataCreate') {
|
await message.delConfirm()
|
||||||
data.dictType = parentType.value
|
// 发起删除
|
||||||
await DictDataApi.createDictDataApi(data)
|
await DictTypeApi.deleteDictType(id)
|
||||||
message.success(t('common.createSuccess'))
|
message.success(t('common.delSuccess'))
|
||||||
} else if (actionType.value === 'dataUpdate') {
|
// 刷新列表
|
||||||
await DictDataApi.updateDictDataApi(data)
|
await getList()
|
||||||
message.success(t('common.updateSuccess'))
|
} catch {}
|
||||||
}
|
}
|
||||||
dialogVisible.value = false
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await DictTypeApi.exportDictType(queryParams)
|
||||||
|
download.excel(data, '字典类型.xls')
|
||||||
|
} catch {
|
||||||
} finally {
|
} finally {
|
||||||
actionLoading.value = false
|
exportLoading.value = false
|
||||||
dataGetList()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
})
|
})
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
|
|
||||||
// 表单校验
|
|
||||||
export const rules = reactive({
|
|
||||||
applicationName: [required],
|
|
||||||
code: [required],
|
|
||||||
message: [required]
|
|
||||||
})
|
|
||||||
|
|
||||||
// 新增 + 修改
|
|
||||||
const crudSchemas = reactive<VxeCrudSchema>({
|
|
||||||
primaryKey: 'id',
|
|
||||||
primaryType: 'id',
|
|
||||||
primaryTitle: '编号',
|
|
||||||
action: true,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
title: '错误码类型',
|
|
||||||
field: 'type',
|
|
||||||
dictType: DICT_TYPE.SYSTEM_ERROR_CODE_TYPE,
|
|
||||||
dictClass: 'number',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '应用名',
|
|
||||||
field: 'applicationName',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '错误码编码',
|
|
||||||
field: 'code',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '错误码错误提示',
|
|
||||||
field: 'message',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('common.createTime'),
|
|
||||||
field: 'createTime',
|
|
||||||
formatter: 'formatDate',
|
|
||||||
isForm: false,
|
|
||||||
search: {
|
|
||||||
show: true,
|
|
||||||
itemRender: {
|
|
||||||
name: 'XDataTimePicker'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
|
112
src/views/system/errorCode/form.vue
Normal file
112
src/views/system/errorCode/form.vue
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog :title="modelTitle" v-model="modelVisible">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="100px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="应用名" prop="applicationName">
|
||||||
|
<el-input v-model="formData.applicationName" placeholder="请输入应用名" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="错误码编码" prop="code">
|
||||||
|
<el-input v-model="formData.code" placeholder="请输入错误码编码" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="错误码提示" prop="message">
|
||||||
|
<el-input v-model="formData.message" placeholder="请输入错误码提示" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="memo">
|
||||||
|
<el-input v-model="formData.memo" placeholder="请输入备注" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="modelVisible = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import * as ErrorCodeApi from '@/api/system/errorCode'
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const modelVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const modelTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
// 表单参数
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
code: undefined,
|
||||||
|
applicationName: '',
|
||||||
|
message: '',
|
||||||
|
memo: ''
|
||||||
|
})
|
||||||
|
// 表单校验
|
||||||
|
const formRules = reactive({
|
||||||
|
applicationName: [{ required: true, message: '应用名不能为空', trigger: 'blur' }],
|
||||||
|
code: [{ required: true, message: '错误码编码不能为空', trigger: 'blur' }],
|
||||||
|
message: [{ required: true, message: '错误码提示不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const openModal = async (type: string, id?: number) => {
|
||||||
|
modelVisible.value = true
|
||||||
|
modelTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await ErrorCodeApi.getErrorCodeApi(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
if (!formRef) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as ErrorCodeApi.ErrorCodeVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await ErrorCodeApi.createErrorCodeApi(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await ErrorCodeApi.updateErrorCodeApi(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
modelVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 表单重置 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
applicationName: '',
|
||||||
|
code: undefined,
|
||||||
|
message: '',
|
||||||
|
memo: ''
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
@ -1,145 +1,229 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentWrap>
|
<!-- 搜索工作栏 -->
|
||||||
<!-- 列表 -->
|
<content-wrap>
|
||||||
<XTable @register="registerTable">
|
<el-form
|
||||||
<!-- 操作:新增 -->
|
class="-mb-15px"
|
||||||
<template #toolbar_buttons>
|
:model="queryParams"
|
||||||
<XButton
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="90px"
|
||||||
|
>
|
||||||
|
<el-form-item label="错误码类型" prop="type">
|
||||||
|
<el-select v-model="queryParams.type" placeholder="请选择错误码类型" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getDictOptions(DICT_TYPE.SYSTEM_ERROR_CODE_TYPE)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="应用名" prop="applicationName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.applicationName"
|
||||||
|
placeholder="请输入应用名"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="错误码编码" prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.code"
|
||||||
|
placeholder="请输入错误码编码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="错误码提示" prop="message">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.message"
|
||||||
|
placeholder="请输入错误码提示"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" prop="createTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.createTime"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
preIcon="ep:zoom-in"
|
@click="openModal('create')"
|
||||||
:title="t('action.add')"
|
|
||||||
v-hasPermi="['system:error-code:create']"
|
v-hasPermi="['system:error-code:create']"
|
||||||
@click="handleCreate()"
|
>
|
||||||
/>
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="handleExport"
|
||||||
|
:loading="exportLoading"
|
||||||
|
v-hasPermi="['system:error-code:export']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</content-wrap>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<content-wrap>
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="编号" align="center" prop="id" />
|
||||||
|
<el-table-column label="类型" align="center" prop="type" width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.SYSTEM_ERROR_CODE_TYPE" :value="scope.row.type" />
|
||||||
</template>
|
</template>
|
||||||
<template #actionbtns_default="{ row }">
|
</el-table-column>
|
||||||
<!-- 操作:修改 -->
|
<el-table-column label="应用名" align="center" prop="applicationName" width="200" />
|
||||||
<XTextButton
|
<el-table-column label="错误码编码" align="center" prop="code" width="120" />
|
||||||
preIcon="ep:edit"
|
<el-table-column label="错误码提示" align="center" prop="message" width="300" />
|
||||||
:title="t('action.edit')"
|
<el-table-column label="备注" align="center" prop="memo" width="200" />
|
||||||
v-hasPermi="['system:error-code:update']"
|
<el-table-column
|
||||||
@click="handleUpdate(row.id)"
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
width="180"
|
||||||
|
:formatter="dateFormatter"
|
||||||
/>
|
/>
|
||||||
<!-- 操作:详情 -->
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<XTextButton
|
<template #default="scope">
|
||||||
preIcon="ep:view"
|
<el-button
|
||||||
:title="t('action.detail')"
|
link
|
||||||
v-hasPermi="['system:error-code:query']"
|
|
||||||
@click="handleDetail(row.id)"
|
|
||||||
/>
|
|
||||||
<!-- 操作:删除 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:delete"
|
|
||||||
:title="t('action.del')"
|
|
||||||
v-hasPermi="['system:error-code:delete']"
|
|
||||||
@click="deleteData(row.id)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</XTable>
|
|
||||||
</ContentWrap>
|
|
||||||
<!-- 弹窗 -->
|
|
||||||
<XModal id="errorCodeModel" v-model="dialogVisible" :title="dialogTitle">
|
|
||||||
<!-- 对话框(添加 / 修改) -->
|
|
||||||
<Form
|
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
|
||||||
:schema="allSchemas.formSchema"
|
|
||||||
:rules="rules"
|
|
||||||
ref="formRef"
|
|
||||||
/>
|
|
||||||
<!-- 对话框(详情) -->
|
|
||||||
<Descriptions
|
|
||||||
v-if="actionType === 'detail'"
|
|
||||||
:schema="allSchemas.detailSchema"
|
|
||||||
:data="detailData"
|
|
||||||
/>
|
|
||||||
<template #footer>
|
|
||||||
<!-- 按钮:保存 -->
|
|
||||||
<XButton
|
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
|
||||||
type="primary"
|
type="primary"
|
||||||
:title="t('action.save')"
|
@click="openModal('update', scope.row.id)"
|
||||||
:loading="actionLoading"
|
v-hasPermi="['system:error-code:update']"
|
||||||
@click="submitForm()"
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['system:error-code:delete']"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
<!-- 按钮:关闭 -->
|
</content-wrap>
|
||||||
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
|
|
||||||
</template>
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
</XModal>
|
<error-code-form ref="modalRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="ErrorCode">
|
<script setup lang="ts" name="ErrorCode">
|
||||||
import type { FormExpose } from '@/components/Form'
|
|
||||||
// 业务相关的 import
|
|
||||||
import { rules, allSchemas } from './errorCode.data'
|
|
||||||
import * as ErrorCodeApi from '@/api/system/errorCode'
|
import * as ErrorCodeApi from '@/api/system/errorCode'
|
||||||
|
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||||
const { t } = useI18n() // 国际化
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
import ErrorCodeForm from './form.vue'
|
||||||
|
import download from '@/utils/download'
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
// 列表相关的变量
|
const { t } = useI18n() // 国际化
|
||||||
const [registerTable, { reload, deleteData }] = useXTable({
|
|
||||||
allSchemas: allSchemas,
|
// 遮罩层
|
||||||
getListApi: ErrorCodeApi.getErrorCodePageApi,
|
const loading = ref(true)
|
||||||
deleteApi: ErrorCodeApi.deleteErrorCodeApi
|
// 导出遮罩层
|
||||||
|
const exportLoading = ref(false)
|
||||||
|
// 总条数
|
||||||
|
const total = ref(0)
|
||||||
|
// 错误码列表
|
||||||
|
const list = ref([])
|
||||||
|
// 查询参数
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
type: undefined,
|
||||||
|
applicationName: undefined,
|
||||||
|
code: undefined,
|
||||||
|
message: undefined,
|
||||||
|
createTime: []
|
||||||
})
|
})
|
||||||
// 弹窗相关的变量
|
// 搜索的表单
|
||||||
const dialogVisible = ref(false) // 是否显示弹出层
|
const queryFormRef = ref()
|
||||||
const dialogTitle = ref('edit') // 弹出层标题
|
|
||||||
const actionType = ref('') // 操作按钮的类型
|
|
||||||
const actionLoading = ref(false) // 按钮 Loading
|
|
||||||
const formRef = ref<FormExpose>() // 表单 Ref
|
|
||||||
const detailData = ref() // 详情 Ref
|
|
||||||
|
|
||||||
// 设置标题
|
/** 查询列表 */
|
||||||
const setDialogTile = (type: string) => {
|
const getList = async () => {
|
||||||
dialogTitle.value = t('action.' + type)
|
loading.value = true
|
||||||
actionType.value = type
|
// 执行查询
|
||||||
dialogVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增操作
|
|
||||||
const handleCreate = () => {
|
|
||||||
setDialogTile('create')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改操作
|
|
||||||
const handleUpdate = async (rowId: number) => {
|
|
||||||
setDialogTile('update')
|
|
||||||
// 设置数据
|
|
||||||
const res = await ErrorCodeApi.getErrorCodeApi(rowId)
|
|
||||||
unref(formRef)?.setValues(res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 详情操作
|
|
||||||
const handleDetail = async (rowId: number) => {
|
|
||||||
setDialogTile('detail')
|
|
||||||
// 设置数据
|
|
||||||
const res = await ErrorCodeApi.getErrorCodeApi(rowId)
|
|
||||||
detailData.value = res
|
|
||||||
}
|
|
||||||
|
|
||||||
// 提交新增/修改的表单
|
|
||||||
const submitForm = async () => {
|
|
||||||
const elForm = unref(formRef)?.getElFormRef()
|
|
||||||
if (!elForm) return
|
|
||||||
elForm.validate(async (valid) => {
|
|
||||||
if (valid) {
|
|
||||||
actionLoading.value = true
|
|
||||||
// 提交请求
|
|
||||||
try {
|
try {
|
||||||
const data = unref(formRef)?.formModel as ErrorCodeApi.ErrorCodeVO
|
const data = await ErrorCodeApi.getErrorCodePageApi(queryParams)
|
||||||
if (actionType.value === 'create') {
|
list.value = data.list
|
||||||
await ErrorCodeApi.createErrorCodeApi(data)
|
total.value = data.total
|
||||||
message.success(t('common.createSuccess'))
|
|
||||||
} else {
|
|
||||||
await ErrorCodeApi.updateErrorCodeApi(data)
|
|
||||||
message.success(t('common.updateSuccess'))
|
|
||||||
}
|
|
||||||
dialogVisible.value = false
|
|
||||||
} finally {
|
} finally {
|
||||||
actionLoading.value = false
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const modalRef = ref()
|
||||||
|
const openModal = (type: string, id?: number) => {
|
||||||
|
modalRef.value.openModal(type, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
await ErrorCodeApi.deleteErrorCodeApi(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
await reload()
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await ErrorCodeApi.excelErrorCodeApi(queryParams)
|
||||||
|
download.excel(data, '错误码.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
})
|
})
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,17 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<content-wrap>
|
<content-wrap>
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true">
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="公告标题" prop="title">
|
<el-form-item label="公告标题" prop="title">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.title"
|
v-model="queryParams.title"
|
||||||
placeholder="请输入公告标题"
|
placeholder="请输入公告标题"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="公告状态" prop="status">
|
<el-form-item label="公告状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" placeholder="请选择公告状态" clearable>
|
<el-select
|
||||||
|
v-model="queryParams.status"
|
||||||
|
placeholder="请选择公告状态"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
|
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
:key="parseInt(dict.value)"
|
:key="parseInt(dict.value)"
|
||||||
|
@ -119,7 +119,7 @@ import { FormExpose } from '@/components/Form'
|
|||||||
// 业务相关的 import
|
// 业务相关的 import
|
||||||
import { rules, allSchemas } from './template.data'
|
import { rules, allSchemas } from './template.data'
|
||||||
import * as NotifyTemplateApi from '@/api/system/notify/template'
|
import * as NotifyTemplateApi from '@/api/system/notify/template'
|
||||||
import { getListSimpleUsersApi, UserVO } from '@/api/system/user'
|
import { getSimpleUserList, UserVO } from '@/api/system/user'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
@ -244,7 +244,7 @@ const sendTest = async () => {
|
|||||||
|
|
||||||
// ========== 初始化 ==========
|
// ========== 初始化 ==========
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getListSimpleUsersApi().then((data) => {
|
getSimpleUserList().then((data) => {
|
||||||
userOption.value = data
|
userOption.value = data
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1,64 +1,159 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentWrap>
|
<content-wrap>
|
||||||
<!-- 列表 -->
|
<!-- 搜索工作栏 -->
|
||||||
<XTable @register="registerTable">
|
<el-form
|
||||||
<template #actionbtns_default="{ row }">
|
class="-mb-15px"
|
||||||
<!-- 操作:详情 -->
|
:model="queryParams"
|
||||||
<XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
|
ref="queryFormRef"
|
||||||
<!-- 操作:登出 -->
|
:inline="true"
|
||||||
<XTextButton
|
label-width="90px"
|
||||||
preIcon="ep:delete"
|
>
|
||||||
:title="t('action.logout')"
|
<el-form-item label="用户编号" prop="userId">
|
||||||
v-hasPermi="['system:oauth2-token:delete']"
|
<el-input
|
||||||
@click="handleForceLogout(row.id)"
|
v-model="queryParams.userId"
|
||||||
|
placeholder="请输入用户编号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
/>
|
/>
|
||||||
</template>
|
</el-form-item>
|
||||||
</XTable>
|
<el-form-item label="用户类型" prop="userType">
|
||||||
</ContentWrap>
|
<el-select
|
||||||
<XModal v-model="dialogVisible" :title="dialogTitle">
|
v-model="queryParams.userType"
|
||||||
<!-- 对话框(详情) -->
|
placeholder="请选择用户类型"
|
||||||
<Descriptions :schema="allSchemas.detailSchema" :data="detailData" />
|
clearable
|
||||||
<!-- 操作按钮 -->
|
class="!w-240px"
|
||||||
<template #footer>
|
>
|
||||||
<XButton :title="t('dialog.close')" @click="dialogVisible = false" />
|
<el-option
|
||||||
</template>
|
v-for="dict in getIntDictOptions(DICT_TYPE.USER_TYPE)"
|
||||||
</XModal>
|
:key="dict.value"
|
||||||
</template>
|
:label="dict.label"
|
||||||
<script setup lang="ts" name="Token">
|
:value="dict.value"
|
||||||
import { allSchemas } from './token.data'
|
/>
|
||||||
import * as TokenApi from '@/api/system/oauth2/token'
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="客户端编号" prop="clientId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.clientId"
|
||||||
|
placeholder="请输入客户端编号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</content-wrap>
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
<!-- 列表 -->
|
||||||
|
<content-wrap>
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="访问令牌" align="center" prop="accessToken" width="300" />
|
||||||
|
<el-table-column label="刷新令牌" align="center" prop="refreshToken" width="300" />
|
||||||
|
<el-table-column label="用户编号" align="center" prop="userId" />
|
||||||
|
<el-table-column label="用户类型" align="center" prop="userType">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="过期时间"
|
||||||
|
align="center"
|
||||||
|
prop="expiresTime"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
width="180"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
width="180"
|
||||||
|
/>
|
||||||
|
<el-table-column label="操作" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleForceLogout(scope.row.id)"
|
||||||
|
v-hasPermi="['system:oauth2-token:delete']"
|
||||||
|
>
|
||||||
|
强退
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</content-wrap>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="Oauth2AccessToken">
|
||||||
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
import * as OAuth2AccessTokenApi from '@/api/system/oauth2/token'
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
// 列表相关的变量
|
const { t } = useI18n() // 国际化
|
||||||
const [registerTable, { reload }] = useXTable({
|
|
||||||
allSchemas: allSchemas,
|
|
||||||
topActionSlots: false,
|
|
||||||
getListApi: TokenApi.getAccessTokenPageApi
|
|
||||||
})
|
|
||||||
|
|
||||||
// ========== 详情相关 ==========
|
const loading = ref(true) // 列表的加载中
|
||||||
const detailData = ref() // 详情 Ref
|
const total = ref(0) // 列表的总页数
|
||||||
const dialogVisible = ref(false) // 是否显示弹出层
|
const list = ref([]) // 列表的数据
|
||||||
const dialogTitle = ref(t('action.detail')) // 弹出层标题
|
const queryParams = reactive({
|
||||||
// 详情
|
pageNo: 1,
|
||||||
const handleDetail = async (row: TokenApi.OAuth2TokenVO) => {
|
pageSize: 10,
|
||||||
// 设置数据
|
userId: null,
|
||||||
detailData.value = row
|
userType: null,
|
||||||
dialogVisible.value = true
|
clientId: null
|
||||||
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
|
||||||
|
/** 查询参数列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await OAuth2AccessTokenApi.getAccessTokenPage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 强退操作
|
/** 搜索按钮操作 */
|
||||||
const handleForceLogout = (rowId: number) => {
|
const handleQuery = () => {
|
||||||
message
|
queryParams.pageNo = 1
|
||||||
.confirm('是否要强制退出用户')
|
getList()
|
||||||
.then(async () => {
|
}
|
||||||
await TokenApi.deleteAccessTokenApi(rowId)
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 强制退出操作 */
|
||||||
|
const handleForceLogout = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.confirm('是否要强制退出用户')
|
||||||
|
// 发起删除
|
||||||
|
await OAuth2AccessTokenApi.deleteAccessToken(id)
|
||||||
message.success(t('common.success'))
|
message.success(t('common.success'))
|
||||||
})
|
|
||||||
.finally(async () => {
|
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
await reload()
|
await getList()
|
||||||
})
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
// CrudSchema
|
|
||||||
const crudSchemas = reactive<VxeCrudSchema>({
|
|
||||||
primaryKey: 'id',
|
|
||||||
primaryType: null,
|
|
||||||
action: true,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
title: '用户编号',
|
|
||||||
field: 'userId',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '访问令牌',
|
|
||||||
field: 'accessToken'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '刷新令牌',
|
|
||||||
field: 'refreshToken'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '客户端编号',
|
|
||||||
field: 'clientId',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '用户类型',
|
|
||||||
field: 'userType',
|
|
||||||
dictType: DICT_TYPE.USER_TYPE,
|
|
||||||
dictClass: 'number',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('common.createTime'),
|
|
||||||
field: 'createTime',
|
|
||||||
formatter: 'formatDate',
|
|
||||||
isForm: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '过期时间',
|
|
||||||
field: 'expiresTime',
|
|
||||||
formatter: 'formatDate',
|
|
||||||
isForm: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
|
@ -1,13 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<content-wrap>
|
<content-wrap>
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true">
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="系统模块" prop="module">
|
<el-form-item label="系统模块" prop="module">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.module"
|
v-model="queryParams.module"
|
||||||
placeholder="请输入系统模块"
|
placeholder="请输入系统模块"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="操作人员" prop="userNickname">
|
<el-form-item label="操作人员" prop="userNickname">
|
||||||
@ -16,10 +23,16 @@
|
|||||||
placeholder="请输入操作人员"
|
placeholder="请输入操作人员"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="类型" prop="type">
|
<el-form-item label="操作类型" prop="type">
|
||||||
<el-select v-model="queryParams.type" placeholder="操作类型" clearable>
|
<el-select
|
||||||
|
v-model="queryParams.type"
|
||||||
|
placeholder="请选择操作类型"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in getDictOptions(DICT_TYPE.SYSTEM_OPERATE_TYPE)"
|
v-for="dict in getDictOptions(DICT_TYPE.SYSTEM_OPERATE_TYPE)"
|
||||||
:key="parseInt(dict.value)"
|
:key="parseInt(dict.value)"
|
||||||
@ -28,8 +41,13 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="success">
|
<el-form-item label="操作状态" prop="success">
|
||||||
<el-select v-model="queryParams.success" placeholder="操作状态" clearable>
|
<el-select
|
||||||
|
v-model="queryParams.success"
|
||||||
|
placeholder="请选择操作状态"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
<el-option :key="true" label="成功" :value="true" />
|
<el-option :key="true" label="成功" :value="true" />
|
||||||
<el-option :key="false" label="失败" :value="false" />
|
<el-option :key="false" label="失败" :value="false" />
|
||||||
</el-select>
|
</el-select>
|
||||||
@ -42,6 +60,7 @@
|
|||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
class="!w-240px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
|
122
src/views/system/post/PostForm.vue
Normal file
122
src/views/system/post/PostForm.vue
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog :title="modelTitle" v-model="modelVisible" width="800">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="80px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="岗位标题" prop="name">
|
||||||
|
<el-input v-model="formData.name" placeholder="请输入岗位标题" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="岗位编码" prop="code">
|
||||||
|
<el-input :model-value="formData.code" placeholder="请输入岗位编码" height="150px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="formData.status" placeholder="请选择状态" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="parseInt(dict.value)"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="parseInt(dict.value)"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="formData.remark" type="textarea" placeholder="请输备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="modelVisible = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||||
|
import { CommonStatusEnum } from '@/utils/constants'
|
||||||
|
import * as PostApi from '@/api/system/post'
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const modelVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const modelTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
name: '',
|
||||||
|
code: '',
|
||||||
|
sort: undefined,
|
||||||
|
status: CommonStatusEnum.ENABLE,
|
||||||
|
remark: ''
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
name: [{ required: true, message: '岗位标题不能为空', trigger: 'blur' }],
|
||||||
|
code: [{ required: true, message: '岗位编码不能为空', trigger: 'change' }],
|
||||||
|
status: [{ required: true, message: '岗位状态不能为空', trigger: 'change' }],
|
||||||
|
remark: [{ required: false, message: '岗位内容不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const openModal = async (type: string, id?: number) => {
|
||||||
|
modelVisible.value = true
|
||||||
|
modelTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await PostApi.getPost(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
if (!formRef) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as unknown as PostApi.PostVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await PostApi.createPost(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await PostApi.updatePost(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
modelVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
name: '',
|
||||||
|
code: '',
|
||||||
|
sort: undefined,
|
||||||
|
status: CommonStatusEnum.ENABLE,
|
||||||
|
remark: ''
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
@ -1,91 +0,0 @@
|
|||||||
<template>
|
|
||||||
<!-- 弹窗 -->
|
|
||||||
<XModal :title="modelTitle" :loading="modelLoading" v-model="modelVisible">
|
|
||||||
<!-- 表单:添加/修改 -->
|
|
||||||
<Form
|
|
||||||
ref="formRef"
|
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
|
||||||
:schema="allSchemas.formSchema"
|
|
||||||
:rules="rules"
|
|
||||||
/>
|
|
||||||
<!-- 表单:详情 -->
|
|
||||||
<Descriptions
|
|
||||||
v-if="actionType === 'detail'"
|
|
||||||
:schema="allSchemas.detailSchema"
|
|
||||||
:data="detailData"
|
|
||||||
/>
|
|
||||||
<template #footer>
|
|
||||||
<!-- 按钮:保存 -->
|
|
||||||
<XButton
|
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
|
||||||
type="primary"
|
|
||||||
:title="t('action.save')"
|
|
||||||
:loading="actionLoading"
|
|
||||||
@click="submitForm()"
|
|
||||||
/>
|
|
||||||
<!-- 按钮:关闭 -->
|
|
||||||
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" />
|
|
||||||
</template>
|
|
||||||
</XModal>
|
|
||||||
</template>
|
|
||||||
<script setup lang="ts">
|
|
||||||
import type { FormExpose } from '@/components/Form'
|
|
||||||
import * as PostApi from '@/api/system/post'
|
|
||||||
import { rules, allSchemas } from './post.data'
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
const message = useMessage() // 消息弹窗
|
|
||||||
|
|
||||||
// 弹窗相关的变量
|
|
||||||
const modelVisible = ref(false) // 是否显示弹出层
|
|
||||||
const modelTitle = ref('') // 弹出层标题
|
|
||||||
const modelLoading = ref(false) // 弹出层loading
|
|
||||||
const actionType = ref('') // 操作按钮的类型
|
|
||||||
const actionLoading = ref(false) // 按钮 Loading
|
|
||||||
const formRef = ref<FormExpose>() // 表单 Ref
|
|
||||||
const detailData = ref() // 详情 Ref
|
|
||||||
|
|
||||||
// 打开弹窗
|
|
||||||
const openModal = async (type: string, id?: number) => {
|
|
||||||
modelVisible.value = true
|
|
||||||
modelLoading.value = true
|
|
||||||
modelTitle.value = t('action.' + type)
|
|
||||||
actionType.value = type
|
|
||||||
// 设置数据
|
|
||||||
if (id) {
|
|
||||||
const res = await PostApi.getPostApi(id)
|
|
||||||
if (type === 'update') {
|
|
||||||
unref(formRef)?.setValues(res)
|
|
||||||
} else if (type === 'detail') {
|
|
||||||
detailData.value = res
|
|
||||||
}
|
|
||||||
}
|
|
||||||
modelLoading.value = false
|
|
||||||
}
|
|
||||||
defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
|
|
||||||
|
|
||||||
// 提交新增/修改的表单
|
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
||||||
const submitForm = async () => {
|
|
||||||
// 校验表单
|
|
||||||
const elForm = unref(formRef)?.getElFormRef()
|
|
||||||
if (!elForm) return
|
|
||||||
const valid = await elForm.validate()
|
|
||||||
if (!valid) return
|
|
||||||
// 提交请求
|
|
||||||
actionLoading.value = true
|
|
||||||
try {
|
|
||||||
const data = unref(formRef)?.formModel as PostApi.PostVO
|
|
||||||
if (actionType.value === 'create') {
|
|
||||||
await PostApi.createPostApi(data)
|
|
||||||
message.success(t('common.createSuccess'))
|
|
||||||
} else {
|
|
||||||
await PostApi.updatePostApi(data)
|
|
||||||
message.success(t('common.updateSuccess'))
|
|
||||||
}
|
|
||||||
modelVisible.value = false
|
|
||||||
emit('success')
|
|
||||||
} finally {
|
|
||||||
actionLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,71 +1,198 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<!-- 列表 -->
|
<!-- 搜索工作栏 -->
|
||||||
<XTable @register="registerTable">
|
<el-form
|
||||||
<template #toolbar_buttons>
|
class="-mb-15px"
|
||||||
<!-- 操作:新增 -->
|
:model="queryParams"
|
||||||
<XButton
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="岗位名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入岗位名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="岗位编码" prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.code"
|
||||||
|
placeholder="请输入岗位编码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
preIcon="ep:zoom-in"
|
|
||||||
:title="t('action.add')"
|
|
||||||
v-hasPermi="['system:post:create']"
|
|
||||||
@click="openModal('create')"
|
@click="openModal('create')"
|
||||||
/>
|
v-hasPermi="['system:notice:create']"
|
||||||
<!-- 操作:导出 -->
|
>
|
||||||
<XButton
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
type="primary"
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
plain
|
plain
|
||||||
preIcon="ep:download"
|
@click="handleExport"
|
||||||
:title="t('action.export')"
|
:loading="exportLoading"
|
||||||
v-hasPermi="['system:post:export']"
|
v-hasPermi="['infra:config:export']"
|
||||||
@click="exportList('岗位列表.xls')"
|
>
|
||||||
/>
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||||
</template>
|
</el-button>
|
||||||
<template #actionbtns_default="{ row }">
|
</el-form-item>
|
||||||
<!-- 操作:修改 -->
|
</el-form>
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:edit"
|
|
||||||
:title="t('action.edit')"
|
|
||||||
v-hasPermi="['system:post:update']"
|
|
||||||
@click="openModal('update', row?.id)"
|
|
||||||
/>
|
|
||||||
<!-- 操作:详情 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:view"
|
|
||||||
:title="t('action.detail')"
|
|
||||||
v-hasPermi="['system:post:query']"
|
|
||||||
@click="openModal('detail', row?.id)"
|
|
||||||
/>
|
|
||||||
<!-- 操作:删除 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:delete"
|
|
||||||
:title="t('action.delete')"
|
|
||||||
v-hasPermi="['system:post:delete']"
|
|
||||||
@click="deleteData(row?.id)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</XTable>
|
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
<!-- 表单弹窗:添加/修改/详情 -->
|
|
||||||
<PostForm ref="modalRef" @success="reload()" />
|
<!-- 列表 -->
|
||||||
|
<ContentWrap>
|
||||||
|
<el-table v-loading="loading" :data="list" align="center">
|
||||||
|
<el-table-column label="岗位编号" align="center" prop="id" />
|
||||||
|
<el-table-column label="岗位名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="岗位编码" align="center" prop="code" />
|
||||||
|
<el-table-column label="岗位顺序" align="center" prop="sort" />
|
||||||
|
<el-table-column label="岗位备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts" name="Post">
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
width="180"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
/>
|
||||||
|
<el-table-column label="操作" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openModal('update', scope.row.id)"
|
||||||
|
v-hasPermi="['system:post:update']"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['system:post:delete']"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
|
<PostForm ref="formRef" @success="getList" />
|
||||||
|
</template>
|
||||||
|
<script setup lang="tsx">
|
||||||
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
import download from '@/utils/download'
|
||||||
import * as PostApi from '@/api/system/post'
|
import * as PostApi from '@/api/system/post'
|
||||||
import { allSchemas } from './post.data'
|
import PostForm from './PostForm.vue'
|
||||||
import PostForm from './form.vue'
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
// 列表相关的变量
|
const loading = ref(true) // 列表的加载中
|
||||||
const [registerTable, { reload, deleteData, exportList }] = useXTable({
|
const total = ref(0) // 列表的总页数
|
||||||
allSchemas: allSchemas, // 列表配置
|
const list = ref([]) // 列表的数据
|
||||||
getListApi: PostApi.getPostPageApi, // 加载列表的 API
|
const queryParams = reactive({
|
||||||
deleteApi: PostApi.deletePostApi, // 删除数据的 API
|
pageNo: 1,
|
||||||
exportListApi: PostApi.exportPostApi // 导出数据的 API
|
pageSize: 10,
|
||||||
|
code: '',
|
||||||
|
name: '',
|
||||||
|
status: undefined
|
||||||
})
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
|
||||||
// 表单相关的变量
|
/** 查询岗位列表 */
|
||||||
const modalRef = ref()
|
const getList = async () => {
|
||||||
const openModal = (type: string, id?: number) => {
|
loading.value = true
|
||||||
modalRef.value.openModal(type, id)
|
try {
|
||||||
|
const data = await PostApi.getPostPage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const formRef = ref()
|
||||||
|
const openModal = (type: string, id?: number) => {
|
||||||
|
formRef.value.openModal(type, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await PostApi.deletePost(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await PostApi.exportPost(queryParams)
|
||||||
|
download.excel(data, '岗位列表.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
|
|
||||||
// 表单校验
|
|
||||||
export const rules = reactive({
|
|
||||||
name: [required],
|
|
||||||
code: [required],
|
|
||||||
sort: [required]
|
|
||||||
})
|
|
||||||
|
|
||||||
// 增删改查 CrudSchema 配置
|
|
||||||
const crudSchemas = reactive<VxeCrudSchema>({
|
|
||||||
primaryKey: 'id',
|
|
||||||
primaryType: 'id',
|
|
||||||
primaryTitle: '岗位编号',
|
|
||||||
action: true,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
title: '岗位名称',
|
|
||||||
field: 'name',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '岗位编码',
|
|
||||||
field: 'code',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '岗位顺序',
|
|
||||||
field: 'sort',
|
|
||||||
form: {
|
|
||||||
component: 'InputNumber'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('common.status'),
|
|
||||||
field: 'status',
|
|
||||||
dictType: DICT_TYPE.COMMON_STATUS,
|
|
||||||
dictClass: 'number',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '备注',
|
|
||||||
field: 'remark',
|
|
||||||
isTable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('common.createTime'),
|
|
||||||
field: 'createTime',
|
|
||||||
formatter: 'formatDate',
|
|
||||||
isForm: false,
|
|
||||||
table: {
|
|
||||||
width: 180
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
|
130
src/views/system/sensitiveWord/form.vue
Normal file
130
src/views/system/sensitiveWord/form.vue
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog :title="modelTitle" v-model="modelVisible">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="80px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="敏感词" prop="name">
|
||||||
|
<el-input v-model="formData.name" placeholder="请输入敏感词" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-radio-group v-model="formData.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>
|
||||||
|
{{ dict.label }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="description">
|
||||||
|
<el-input v-model="formData.description" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="标签" prop="tags">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.tags"
|
||||||
|
multiple
|
||||||
|
filterable
|
||||||
|
allow-create
|
||||||
|
placeholder="请选择文章标签"
|
||||||
|
style="width: 380px"
|
||||||
|
>
|
||||||
|
<el-option v-for="tag in tags" :key="tag" :label="tag" :value="tag" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="modelVisible = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
|
import * as SensitiveWordApi from '@/api/system/sensitiveWord'
|
||||||
|
import { CommonStatusEnum } from '@/utils/constants'
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const modelVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const modelTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
name: '',
|
||||||
|
status: CommonStatusEnum.ENABLE,
|
||||||
|
description: '',
|
||||||
|
tags: []
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
name: [{ required: true, message: '敏感词不能为空', trigger: 'blur' }],
|
||||||
|
tags: [{ required: true, message: '标签不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
const tags = ref([]) // todo @blue-syd:在 openModal 里加载下
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const openModal = async (type: string, id?: number) => {
|
||||||
|
modelVisible.value = true
|
||||||
|
modelTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await SensitiveWordApi.getSensitiveWordApi(id)
|
||||||
|
console.log(formData.value)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
if (!formRef) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as unknown as SensitiveWordApi.SensitiveWordVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await SensitiveWordApi.createSensitiveWordApi(data) // TODO @blue-syd:去掉 API 后缀
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await SensitiveWordApi.updateSensitiveWordApi(data) // TODO @blue-syd:去掉 API 后缀
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
modelVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
name: '',
|
||||||
|
status: CommonStatusEnum.ENABLE,
|
||||||
|
description: '',
|
||||||
|
tags: []
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
@ -1,191 +1,225 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentWrap>
|
<!-- 搜索 -->
|
||||||
<!-- 列表 -->
|
<content-wrap>
|
||||||
<XTable @register="registerTable">
|
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true">
|
||||||
<template #toolbar_buttons>
|
<el-form-item label="敏感词" prop="name">
|
||||||
<!-- 操作:新增 -->
|
<el-input
|
||||||
<XButton
|
v-model="queryParams.name"
|
||||||
type="primary"
|
placeholder="请输入敏感词"
|
||||||
preIcon="ep:zoom-in"
|
clearable
|
||||||
:title="t('action.add')"
|
@keyup.enter="handleQuery"
|
||||||
v-hasPermi="['system:sensitive-word:create']"
|
|
||||||
@click="handleCreate()"
|
|
||||||
/>
|
/>
|
||||||
<!-- 操作:导出 -->
|
</el-form-item>
|
||||||
<XButton
|
<el-form-item label="标签" prop="tag">
|
||||||
type="warning"
|
<el-select
|
||||||
preIcon="ep:download"
|
v-model="queryParams.tag"
|
||||||
:title="t('action.export')"
|
placeholder="请选择标签"
|
||||||
v-hasPermi="['system:sensitive-word:export']"
|
clearable
|
||||||
@click="exportList('敏感词数据.xls')"
|
@keyup.enter="handleQuery"
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #tags_default="{ row }">
|
|
||||||
<el-tag
|
|
||||||
:disable-transitions="true"
|
|
||||||
:key="index"
|
|
||||||
v-for="(tag, index) in row.tags"
|
|
||||||
:index="index"
|
|
||||||
>
|
>
|
||||||
{{ tag }}
|
<el-option v-for="tag in tags" :key="tag" :label="tag" :value="tag" />
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
<template #actionbtns_default="{ row }">
|
|
||||||
<!-- 操作:修改 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:edit"
|
|
||||||
:title="t('action.edit')"
|
|
||||||
v-hasPermi="['system:sensitive-word:update']"
|
|
||||||
@click="handleUpdate(row.id)"
|
|
||||||
/>
|
|
||||||
<!-- 操作:详情 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:view"
|
|
||||||
:title="t('action.detail')"
|
|
||||||
v-hasPermi="['system:sensitive-word:update']"
|
|
||||||
@click="handleDetail(row.id)"
|
|
||||||
/>
|
|
||||||
<!-- 操作:删除 -->
|
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:delete"
|
|
||||||
:title="t('action.del')"
|
|
||||||
v-hasPermi="['system:sensitive-word:delete']"
|
|
||||||
@click="deleteData(row.id)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</XTable>
|
|
||||||
</ContentWrap>
|
|
||||||
|
|
||||||
<XModal v-model="dialogVisible" :title="dialogTitle">
|
|
||||||
<!-- 对话框(添加 / 修改) -->
|
|
||||||
<Form
|
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
|
||||||
:schema="allSchemas.formSchema"
|
|
||||||
:rules="rules"
|
|
||||||
ref="formRef"
|
|
||||||
>
|
|
||||||
<template #tags="form">
|
|
||||||
<el-select v-model="form['tags']" multiple placeholder="请选择">
|
|
||||||
<el-option v-for="item in tagsOptions" :key="item" :label="item" :value="item" />
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</el-form-item>
|
||||||
</Form>
|
<el-form-item label="状态" prop="status">
|
||||||
<!-- 对话框(详情) -->
|
<el-select v-model="queryParams.status" placeholder="请选择启用状态" clearable>
|
||||||
<Descriptions
|
<el-option
|
||||||
v-if="actionType === 'detail'"
|
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
:schema="allSchemas.detailSchema"
|
:key="parseInt(dict.value)"
|
||||||
:data="detailData"
|
:label="dict.label"
|
||||||
|
:value="parseInt(dict.value)"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" prop="createTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.createTime"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="openModal('create')"
|
||||||
|
v-hasPermi="['system:sensitive-word:create']"
|
||||||
>
|
>
|
||||||
<template #tags="{ row }">
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="handleExport"
|
||||||
|
:loading="exportLoading"
|
||||||
|
v-hasPermi="['system:sensitive-word:export']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</content-wrap>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<content-wrap>
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="编号" align="center" prop="id" />
|
||||||
|
<el-table-column label="敏感词" align="center" prop="name" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="描述" align="center" prop="description" />
|
||||||
|
<el-table-column label="标签" align="center" prop="tags">
|
||||||
|
<template #default="scope">
|
||||||
<el-tag
|
<el-tag
|
||||||
:disable-transitions="true"
|
:disable-transitions="true"
|
||||||
:key="index"
|
:key="index"
|
||||||
v-for="(tag, index) in row.tags"
|
v-for="(tag, index) in scope.row.tags"
|
||||||
:index="index"
|
:index="index"
|
||||||
|
class="mr-5px"
|
||||||
>
|
>
|
||||||
{{ tag }}
|
{{ tag }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</Descriptions>
|
</el-table-column>
|
||||||
<!-- 操作按钮 -->
|
<el-table-column
|
||||||
<template #footer>
|
label="创建时间"
|
||||||
<!-- 按钮:保存 -->
|
align="center"
|
||||||
<XButton
|
prop="createTime"
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
width="180"
|
||||||
type="primary"
|
:formatter="dateFormatter"
|
||||||
:title="t('action.save')"
|
|
||||||
:loading="actionLoading"
|
|
||||||
@click="submitForm()"
|
|
||||||
/>
|
/>
|
||||||
<!-- 按钮:关闭 -->
|
<el-table-column label="操作" align="center">
|
||||||
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openModal('update', scope.row.id)"
|
||||||
|
v-hasPermi="['infra:config:update']"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['infra:config:delete']"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</XModal>
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</content-wrap>
|
||||||
|
|
||||||
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
|
<config-form ref="modalRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts" name="SensitiveWord">
|
<script setup lang="ts" name="SensitiveWord">
|
||||||
import type { FormExpose } from '@/components/Form'
|
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||||
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
import download from '@/utils/download'
|
||||||
import * as SensitiveWordApi from '@/api/system/sensitiveWord'
|
import * as SensitiveWordApi from '@/api/system/sensitiveWord'
|
||||||
import { rules, allSchemas } from './sensitiveWord.data'
|
import ConfigForm from './form.vue' // TODO @blue-syd:组件名不对
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
// 列表相关的变量
|
const { t } = useI18n() // 国际化
|
||||||
const [registerTable, { reload, deleteData, exportList }] = useXTable({
|
|
||||||
allSchemas: allSchemas,
|
const loading = ref(true) // 列表的加载中
|
||||||
getListApi: SensitiveWordApi.getSensitiveWordPageApi,
|
const total = ref(0) // 列表的总页数
|
||||||
deleteApi: SensitiveWordApi.deleteSensitiveWordApi,
|
const list = ref([]) // 列表的数据
|
||||||
exportListApi: SensitiveWordApi.exportSensitiveWordApi
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: undefined,
|
||||||
|
tag: undefined,
|
||||||
|
status: undefined,
|
||||||
|
createTime: []
|
||||||
})
|
})
|
||||||
const actionLoading = ref(false) // 遮罩层
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const actionType = ref('') // 操作按钮的类型
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
const dialogVisible = ref(false) // 是否显示弹出层
|
const tags = ref([])
|
||||||
const dialogTitle = ref('edit') // 弹出层标题
|
|
||||||
const formRef = ref<FormExpose>() // 表单 Ref
|
|
||||||
const detailData = ref() // 详情 Ref
|
|
||||||
|
|
||||||
// 获取标签
|
/** 查询参数列表 */
|
||||||
const tagsOptions = ref()
|
const getList = async () => {
|
||||||
const getTags = async () => {
|
loading.value = true
|
||||||
const res = await SensitiveWordApi.getSensitiveWordTagsApi()
|
|
||||||
tagsOptions.value = res
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置标题
|
|
||||||
const setDialogTile = (type: string) => {
|
|
||||||
dialogTitle.value = t('action.' + type)
|
|
||||||
actionType.value = type
|
|
||||||
dialogVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增操作
|
|
||||||
const handleCreate = () => {
|
|
||||||
setDialogTile('create')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改操作
|
|
||||||
const handleUpdate = async (rowId: number) => {
|
|
||||||
setDialogTile('update')
|
|
||||||
// 设置数据
|
|
||||||
const res = await SensitiveWordApi.getSensitiveWordApi(rowId)
|
|
||||||
unref(formRef)?.setValues(res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 详情操作
|
|
||||||
const handleDetail = async (rowId: number) => {
|
|
||||||
setDialogTile('detail')
|
|
||||||
const res = await SensitiveWordApi.getSensitiveWordApi(rowId)
|
|
||||||
detailData.value = res
|
|
||||||
}
|
|
||||||
|
|
||||||
// 提交按钮
|
|
||||||
const submitForm = async () => {
|
|
||||||
const elForm = unref(formRef)?.getElFormRef()
|
|
||||||
if (!elForm) return
|
|
||||||
elForm.validate(async (valid) => {
|
|
||||||
if (valid) {
|
|
||||||
actionLoading.value = true
|
|
||||||
// 提交请求
|
|
||||||
try {
|
try {
|
||||||
const data = unref(formRef)?.formModel as SensitiveWordApi.SensitiveWordVO
|
const data = await SensitiveWordApi.getSensitiveWordPageApi(queryParams) // TODO @blue-syd:去掉 API 后缀哈
|
||||||
if (actionType.value === 'create') {
|
list.value = data.list
|
||||||
await SensitiveWordApi.createSensitiveWordApi(data)
|
total.value = data.total
|
||||||
message.success(t('common.createSuccess'))
|
|
||||||
} else {
|
|
||||||
await SensitiveWordApi.updateSensitiveWordApi(data)
|
|
||||||
message.success(t('common.updateSuccess'))
|
|
||||||
}
|
|
||||||
dialogVisible.value = false
|
|
||||||
} finally {
|
} finally {
|
||||||
actionLoading.value = false
|
loading.value = false
|
||||||
// 刷新列表
|
|
||||||
await reload()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== 初始化 ==========
|
/** 搜索按钮操作 */
|
||||||
onMounted(async () => {
|
const handleQuery = () => {
|
||||||
await getTags()
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const modalRef = ref()
|
||||||
|
const openModal = (type: string, id?: number) => {
|
||||||
|
modalRef.value.openModal(type, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO @blue-syd:还少一个【测试】按钮的功能,参见 http://dashboard.yudao.iocoder.cn/system/sensitive-word
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await SensitiveWordApi.deleteSensitiveWordApi(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await SensitiveWordApi.exportSensitiveWordApi(queryParams) // TODO @blue-syd:去掉 API 后缀哈
|
||||||
|
download.excel(data, '敏感词.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获得 Tag 标签列表 */
|
||||||
|
const getTags = async () => {
|
||||||
|
tags.value = await SensitiveWordApi.getSensitiveWordTagsApi() // TODO @blue-syd:去掉 API 后缀哈
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getTags()
|
||||||
|
getList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,74 +0,0 @@
|
|||||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
|
|
||||||
// 表单校验
|
|
||||||
export const rules = reactive({
|
|
||||||
name: [required],
|
|
||||||
tags: [required]
|
|
||||||
})
|
|
||||||
|
|
||||||
// CrudSchema
|
|
||||||
const crudSchemas = reactive<VxeCrudSchema>({
|
|
||||||
primaryKey: 'id',
|
|
||||||
primaryType: 'id',
|
|
||||||
primaryTitle: '敏感词编号',
|
|
||||||
action: true,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
title: '敏感词',
|
|
||||||
field: 'name',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '标签',
|
|
||||||
field: 'tag',
|
|
||||||
isTable: false,
|
|
||||||
isForm: false,
|
|
||||||
isDetail: false,
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '标签',
|
|
||||||
field: 'tags',
|
|
||||||
table: {
|
|
||||||
slots: {
|
|
||||||
default: 'tags_default'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('common.status'),
|
|
||||||
field: 'status',
|
|
||||||
dictType: DICT_TYPE.COMMON_STATUS,
|
|
||||||
dictClass: 'number',
|
|
||||||
isSearch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '描述',
|
|
||||||
field: 'description',
|
|
||||||
form: {
|
|
||||||
component: 'Input',
|
|
||||||
componentProps: {
|
|
||||||
type: 'textarea',
|
|
||||||
rows: 4
|
|
||||||
},
|
|
||||||
colProps: {
|
|
||||||
span: 24
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('common.createTime'),
|
|
||||||
field: 'createTime',
|
|
||||||
formatter: 'formatDate',
|
|
||||||
isForm: false,
|
|
||||||
search: {
|
|
||||||
show: true,
|
|
||||||
itemRender: {
|
|
||||||
name: 'XDataTimePicker'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
|
@ -273,7 +273,7 @@ import { rules, allSchemas } from './user.data'
|
|||||||
import * as UserApi from '@/api/system/user'
|
import * as UserApi from '@/api/system/user'
|
||||||
import { listSimpleDeptApi } from '@/api/system/dept'
|
import { listSimpleDeptApi } from '@/api/system/dept'
|
||||||
import { listSimpleRolesApi } from '@/api/system/role'
|
import { listSimpleRolesApi } from '@/api/system/role'
|
||||||
import { listSimplePostsApi, PostVO } from '@/api/system/post'
|
import { getSimplePostList, PostVO } from '@/api/system/post'
|
||||||
import {
|
import {
|
||||||
aassignUserRoleApi,
|
aassignUserRoleApi,
|
||||||
listUserRolesApi,
|
listUserRolesApi,
|
||||||
@ -329,7 +329,7 @@ const postOptions = ref<PostVO[]>([]) //岗位列表
|
|||||||
|
|
||||||
// 获取岗位列表
|
// 获取岗位列表
|
||||||
const getPostOptions = async () => {
|
const getPostOptions = async () => {
|
||||||
const res = await listSimplePostsApi()
|
const res = await getSimplePostList()
|
||||||
postOptions.value.push(...res)
|
postOptions.value.push(...res)
|
||||||
}
|
}
|
||||||
const dataFormater = (val) => {
|
const dataFormater = (val) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user