回退vxe版本

pull/120/MERGE
gexinzhineng/gxzn27 2023-04-03 15:26:56 +08:00
parent 87a5ddfd2c
commit 0e578f8d0a
178 changed files with 12350 additions and 8340 deletions

2
.gitignore vendored
View File

@ -8,4 +8,4 @@ dist-ssr
pnpm-debug pnpm-debug
.idea .idea
.history .history

View File

@ -15,7 +15,7 @@ import vueSetupExtend from 'vite-plugin-vue-setup-extend'
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
export function createVitePlugins() { export function createVitePlugins(VITE_APP_TITLE: string) {
const root = process.cwd() const root = process.cwd()
// 路径查找 // 路径查找
function pathResolve(dir: string) { function pathResolve(dir: string) {
@ -39,14 +39,11 @@ export function createVitePlugins() {
imports: [ imports: [
'vue', 'vue',
'vue-router', 'vue-router',
// 可额外添加需要 autoImport 的组件
{ {
'@/hooks/web/useI18n': ['useI18n'], '@/hooks/web/useI18n': ['useI18n'],
'@/hooks/web/useMessage': ['useMessage'],
'@/hooks/web/useXTable': ['useXTable'], '@/hooks/web/useXTable': ['useXTable'],
'@/hooks/web/useMessage': ['useMessage'],
'@/hooks/web/useVxeCrudSchemas': ['useVxeCrudSchemas'], '@/hooks/web/useVxeCrudSchemas': ['useVxeCrudSchemas'],
'@/hooks/web/useTable': ['useTable'],
'@/hooks/web/useCrudSchemas': ['useCrudSchemas'],
'@/utils/formRules': ['required'], '@/utils/formRules': ['required'],
'@/utils/dict': ['DICT_TYPE'] '@/utils/dict': ['DICT_TYPE']
} }
@ -95,6 +92,8 @@ export function createVitePlugins() {
ext: '.gz', // 生成的压缩包后缀 ext: '.gz', // 生成的压缩包后缀
deleteOriginFile: false //压缩后是否删除源文件 deleteOriginFile: false //压缩后是否删除源文件
}), }),
ViteEjsPlugin() ViteEjsPlugin({
title: VITE_APP_TITLE
})
] ]
} }

View File

@ -13,7 +13,7 @@
name="description" name="description"
content="芋道管理系统 基于 vue3 + CompositionAPI + typescript + vite3 + element plus 的后台开源免费管理系统!" content="芋道管理系统 基于 vue3 + CompositionAPI + typescript + vite3 + element plus 的后台开源免费管理系统!"
/> />
<title>%VITE_APP_TITLE%</title> <title><%= title %></title>
</head> </head>
<body> <body>
<div id="app"> <div id="app">
@ -137,7 +137,7 @@
<div class="app-loading-wrap"> <div class="app-loading-wrap">
<div class="app-loading-title"> <div class="app-loading-title">
<img src="/logo.gif" class="app-loading-logo" alt="Logo" /> <img src="/logo.gif" class="app-loading-logo" alt="Logo" />
<div class="app-loading-title">%VITE_APP_TITLE%</div> <div class="app-loading-title"><%= title %></div>
</div> </div>
<div class="app-loading-item"> <div class="app-loading-item">
<div class="app-loading-outter"></div> <div class="app-loading-outter"></div>

View File

@ -1,6 +1,6 @@
{ {
"name": "yudao-ui-admin-vue3", "name": "yudao-ui-admin-vue3",
"version": "1.7.1-snapshot.1961", "version": "1.7.1-snapshot.1941",
"description": "基于vue3、vite4、element-plus、typesScript", "description": "基于vue3、vite4、element-plus、typesScript",
"author": "xingyu", "author": "xingyu",
"private": false, "private": false,
@ -29,14 +29,12 @@
"@form-create/designer": "^3.1.0", "@form-create/designer": "^3.1.0",
"@form-create/element-ui": "^3.1.17", "@form-create/element-ui": "^3.1.17",
"@iconify/iconify": "^3.1.0", "@iconify/iconify": "^3.1.0",
"@videojs-player/vue": "^1.0.0",
"@vueuse/core": "^9.13.0", "@vueuse/core": "^9.13.0",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.10", "@wangeditor/editor-for-vue": "^5.1.10",
"@zxcvbn-ts/core": "^2.2.1", "@zxcvbn-ts/core": "^2.2.1",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"axios": "^1.3.4", "axios": "^1.3.4",
"benz-amr-recorder": "^1.1.5",
"bpmn-js-token-simulation": "^0.10.0", "bpmn-js-token-simulation": "^0.10.0",
"camunda-bpmn-moddle": "^7.0.1", "camunda-bpmn-moddle": "^7.0.1",
"cropperjs": "^1.5.13", "cropperjs": "^1.5.13",
@ -45,7 +43,7 @@
"diagram-js": "^11.6.0", "diagram-js": "^11.6.0",
"echarts": "^5.4.1", "echarts": "^5.4.1",
"echarts-wordcloud": "^2.1.0", "echarts-wordcloud": "^2.1.0",
"element-plus": "2.3.1", "element-plus": "2.2.34",
"fast-xml-parser": "^4.1.3", "fast-xml-parser": "^4.1.3",
"highlight.js": "^11.7.0", "highlight.js": "^11.7.0",
"intro.js": "^6.0.0", "intro.js": "^6.0.0",
@ -59,63 +57,62 @@
"qs": "^6.11.1", "qs": "^6.11.1",
"steady-xml": "^0.1.0", "steady-xml": "^0.1.0",
"url": "^0.11.0", "url": "^0.11.0",
"video.js": "^8.0.4",
"vue": "3.2.47", "vue": "3.2.47",
"vue-i18n": "9.2.2", "vue-i18n": "9.2.2",
"vue-router": "^4.1.6", "vue-router": "^4.1.6",
"vue-types": "^5.0.2", "vue-types": "^5.0.2",
"vuedraggable": "^4.1.0", "vuedraggable": "^4.1.0",
"vxe-table": "^4.3.11", "vxe-table": "^4.3.10",
"web-storage-cache": "^1.1.1", "web-storage-cache": "^1.1.1",
"xe-utils": "^3.5.7", "xe-utils": "^3.5.7",
"xml-js": "^1.6.11" "xml-js": "^1.6.11"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^17.5.0", "@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4", "@commitlint/config-conventional": "^17.4.4",
"@iconify/json": "^2.2.38", "@iconify/json": "^2.2.31",
"@intlify/unplugin-vue-i18n": "^0.10.0", "@intlify/unplugin-vue-i18n": "^0.8.2",
"@purge-icons/generated": "^0.9.0", "@purge-icons/generated": "^0.9.0",
"@types/intro.js": "^5.1.1", "@types/intro.js": "^5.1.1",
"@types/lodash-es": "^4.17.7", "@types/lodash-es": "^4.17.6",
"@types/node": "^18.15.5", "@types/node": "^18.14.6",
"@types/nprogress": "^0.2.0", "@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.5.0", "@types/qrcode": "^1.5.0",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.56.0", "@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.56.0", "@typescript-eslint/parser": "^5.54.1",
"@vitejs/plugin-legacy": "^4.0.2", "@vitejs/plugin-legacy": "^4.0.1",
"@vitejs/plugin-vue": "^4.1.0", "@vitejs/plugin-vue": "^4.0.0",
"@vitejs/plugin-vue-jsx": "^3.0.1", "@vitejs/plugin-vue-jsx": "^3.0.0",
"autoprefixer": "^10.4.14", "autoprefixer": "^10.4.13",
"bpmn-js": "^8.9.0", "bpmn-js": "^8.9.0",
"bpmn-js-properties-panel": "^0.46.0", "bpmn-js-properties-panel": "^0.46.0",
"consola": "^2.15.3", "consola": "^2.15.3",
"eslint": "^8.36.0", "eslint": "^8.35.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.7.0",
"eslint-define-config": "^1.17.0", "eslint-define-config": "^1.15.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.9.0", "eslint-plugin-vue": "^9.9.0",
"lint-staged": "^13.2.0", "lint-staged": "^13.1.2",
"postcss": "^8.4.21", "postcss": "^8.4.21",
"postcss-html": "^1.5.0", "postcss-html": "^1.5.0",
"postcss-scss": "^4.0.6", "postcss-scss": "^4.0.6",
"prettier": "^2.8.6", "prettier": "^2.8.4",
"rimraf": "^4.4.1", "rimraf": "^4.3.1",
"rollup": "^3.20.0", "rollup": "^3.18.0",
"sass": "^1.59.3", "sass": "^1.58.3",
"stylelint": "^15.3.0", "stylelint": "^15.2.0",
"stylelint-config-html": "^1.1.0", "stylelint-config-html": "^1.1.0",
"stylelint-config-prettier": "^9.0.5", "stylelint-config-prettier": "^9.0.5",
"stylelint-config-recommended": "^11.0.0", "stylelint-config-recommended": "^10.0.1",
"stylelint-config-standard": "^31.0.0", "stylelint-config-standard": "^30.0.1",
"stylelint-order": "^6.0.3", "stylelint-order": "^6.0.2",
"terser": "^5.16.6", "terser": "^5.16.5",
"typescript": "5.0.2", "typescript": "4.9.5",
"unplugin-auto-import": "^0.15.1", "unplugin-auto-import": "^0.15.1",
"unplugin-element-plus": "^0.7.0", "unplugin-element-plus": "^0.7.0",
"unplugin-vue-components": "^0.24.1", "unplugin-vue-components": "^0.24.1",
"vite": "4.2.1", "vite": "4.1.4",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-ejs": "^1.6.4", "vite-plugin-ejs": "^1.6.4",
"vite-plugin-eslint": "^1.8.1", "vite-plugin-eslint": "^1.8.1",
@ -128,7 +125,7 @@
"windicss": "^3.5.6" "windicss": "^3.5.6"
}, },
"engines": { "engines": {
"node": ">=16.18.0" "node": ">=16.0.0"
}, },
"license": "MIT", "license": "MIT",
"repository": { "repository": {

View File

@ -1,19 +1,19 @@
import request from '@/config/axios' import request from '@/config/axios'
export const getProcessDefinitionBpmnXML = async (id: number) => { export const getProcessDefinitionBpmnXMLApi = async (id: number) => {
return await request.get({ return await request.get({
url: '/bpm/process-definition/get-bpmn-xml?id=' + id url: '/bpm/process-definition/get-bpmn-xml?id=' + id
}) })
} }
export const getProcessDefinitionPage = async (params) => { export const getProcessDefinitionPageApi = async (params) => {
return await request.get({ return await request.get({
url: '/bpm/process-definition/page', url: '/bpm/process-definition/page',
params params
}) })
} }
export const getProcessDefinitionList = async (params) => { export const getProcessDefinitionListApi = async (params) => {
return await request.get({ return await request.get({
url: '/bpm/process-definition/list', url: '/bpm/process-definition/list',
params params

View File

@ -11,7 +11,7 @@ export type FormVO = {
} }
// 创建工作流的表单定义 // 创建工作流的表单定义
export const createForm = async (data: FormVO) => { export const createFormApi = async (data: FormVO) => {
return await request.post({ return await request.post({
url: '/bpm/form/create', url: '/bpm/form/create',
data: data data: data
@ -19,7 +19,7 @@ export const createForm = async (data: FormVO) => {
} }
// 更新工作流的表单定义 // 更新工作流的表单定义
export const updateForm = async (data: FormVO) => { export const updateFormApi = async (data: FormVO) => {
return await request.put({ return await request.put({
url: '/bpm/form/update', url: '/bpm/form/update',
data: data data: data
@ -27,21 +27,21 @@ export const updateForm = async (data: FormVO) => {
} }
// 删除工作流的表单定义 // 删除工作流的表单定义
export const deleteForm = async (id: number) => { export const deleteFormApi = async (id: number) => {
return await request.delete({ return await request.delete({
url: '/bpm/form/delete?id=' + id url: '/bpm/form/delete?id=' + id
}) })
} }
// 获得工作流的表单定义 // 获得工作流的表单定义
export const getForm = async (id: number) => { export const getFormApi = async (id: number) => {
return await request.get({ return await request.get({
url: '/bpm/form/get?id=' + id url: '/bpm/form/get?id=' + id
}) })
} }
// 获得工作流的表单定义分页 // 获得工作流的表单定义分页
export const getFormPage = async (params) => { export const getFormPageApi = async (params) => {
return await request.get({ return await request.get({
url: '/bpm/form/page', url: '/bpm/form/page',
params params
@ -49,7 +49,7 @@ export const getFormPage = async (params) => {
} }
// 获得动态表单的精简列表 // 获得动态表单的精简列表
export const getSimpleFormList = async () => { export const getSimpleFormsApi = async () => {
return await request.get({ return await request.get({
url: '/bpm/form/list-all-simple' url: '/bpm/form/list-all-simple'
}) })

View File

@ -25,20 +25,20 @@ export type ModelVO = {
bpmnXml: string bpmnXml: string
} }
export const getModelPage = async (params) => { export const getModelPageApi = async (params) => {
return await request.get({ url: '/bpm/model/page', params }) return await request.get({ url: '/bpm/model/page', params })
} }
export const getModel = async (id: number) => { export const getModelApi = async (id: number) => {
return await request.get({ url: '/bpm/model/get?id=' + id }) return await request.get({ url: '/bpm/model/get?id=' + id })
} }
export const updateModel = async (data: ModelVO) => { export const updateModelApi = async (data: ModelVO) => {
return await request.put({ url: '/bpm/model/update', data: data }) return await request.put({ url: '/bpm/model/update', data: data })
} }
// 任务状态修改 // 任务状态修改
export const updateModelState = async (id: number, state: number) => { export const updateModelStateApi = async (id: number, state: number) => {
const data = { const data = {
id: id, id: id,
state: state state: state
@ -46,14 +46,14 @@ export const updateModelState = async (id: number, state: number) => {
return await request.put({ url: '/bpm/model/update-state', data: data }) return await request.put({ url: '/bpm/model/update-state', data: data })
} }
export const createModel = async (data: ModelVO) => { export const createModelApi = async (data: ModelVO) => {
return await request.post({ url: '/bpm/model/create', data: data }) return await request.post({ url: '/bpm/model/create', data: data })
} }
export const deleteModel = async (id: number) => { export const deleteModelApi = async (id: number) => {
return await request.delete({ url: '/bpm/model/delete?id=' + id }) return await request.delete({ url: '/bpm/model/delete?id=' + id })
} }
export const deployModel = async (id: number) => { export const deployModelApi = async (id: number) => {
return await request.post({ url: '/bpm/model/deploy?id=' + id }) return await request.post({ url: '/bpm/model/deploy?id=' + id })
} }

View File

@ -4,7 +4,6 @@ export type Task = {
id: string id: string
name: string name: string
} }
export type ProcessInstanceVO = { export type ProcessInstanceVO = {
id: number id: number
name: string name: string

View File

@ -11,7 +11,7 @@ export type UserGroupVO = {
} }
// 创建用户组 // 创建用户组
export const createUserGroup = async (data: UserGroupVO) => { export const createUserGroupApi = 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 createUserGroup = async (data: UserGroupVO) => {
} }
// 更新用户组 // 更新用户组
export const updateUserGroup = async (data: UserGroupVO) => { export const updateUserGroupApi = 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 updateUserGroup = async (data: UserGroupVO) => {
} }
// 删除用户组 // 删除用户组
export const deleteUserGroup = async (id: number) => { export const deleteUserGroupApi = 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 getUserGroup = async (id: number) => { export const getUserGroupApi = 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 getUserGroupPage = async (params) => { export const getUserGroupPageApi = async (params) => {
return await request.get({ url: '/bpm/user-group/page', params }) return await request.get({ url: '/bpm/user-group/page', params })
} }
// 获取用户组精简信息列表 // 获取用户组精简信息列表
export const getSimpleUserGroupList = async (): Promise<UserGroupVO[]> => { export const listSimpleUserGroupsApi = async () => {
return await request.get({ url: '/bpm/user-group/list-all-simple' }) return await request.get({ url: '/bpm/user-group/list-all-simple' })
} }

View File

@ -19,12 +19,32 @@ export interface ApiAccessLogVO {
createTime: Date createTime: Date
} }
export interface ApiAccessLogPageReqVO extends PageParam {
userId?: number
userType?: number
applicationName?: string
requestUrl?: string
beginTime?: Date[]
duration?: number
resultCode?: number
}
export interface ApiAccessLogExportReqVO {
userId?: number
userType?: number
applicationName?: string
requestUrl?: string
beginTime?: Date[]
duration?: number
resultCode?: number
}
// 查询列表API 访问日志 // 查询列表API 访问日志
export const getApiAccessLogPage = (params: PageParam) => { export const getApiAccessLogPageApi = (params: ApiAccessLogPageReqVO) => {
return request.get({ url: '/infra/api-access-log/page', params }) return request.get({ url: '/infra/api-access-log/page', params })
} }
// 导出API 访问日志 // 导出API 访问日志
export const exportApiAccessLog = (params) => { export const exportApiAccessLogApi = (params: ApiAccessLogExportReqVO) => {
return request.download({ url: '/infra/api-access-log/export-excel', params }) return request.download({ url: '/infra/api-access-log/export-excel', params })
} }

View File

@ -27,20 +27,38 @@ export interface ApiErrorLogVO {
createTime: Date createTime: Date
} }
export interface ApiErrorLogPageReqVO extends PageParam {
userId?: number
userType?: number
applicationName?: string
requestUrl?: string
exceptionTime?: Date[]
processStatus: number
}
export interface ApiErrorLogExportReqVO {
userId?: number
userType?: number
applicationName?: string
requestUrl?: string
exceptionTime?: Date[]
processStatus: number
}
// 查询列表API 访问日志 // 查询列表API 访问日志
export const getApiErrorLogPage = (params: PageParam) => { export const getApiErrorLogPageApi = (params: ApiErrorLogPageReqVO) => {
return request.get({ url: '/infra/api-error-log/page', params }) return request.get({ url: '/infra/api-error-log/page', params })
} }
// 更新 API 错误日志的处理状态 // 更新 API 错误日志的处理状态
export const updateApiErrorLogPage = (id: number, processStatus: number) => { export const updateApiErrorLogPageApi = (id: number, processStatus: number) => {
return request.put({ return request.put({
url: '/infra/api-error-log/update-status?id=' + id + '&processStatus=' + processStatus url: '/infra/api-error-log/update-status?id=' + id + '&processStatus=' + processStatus
}) })
} }
// 导出API 访问日志 // 导出API 访问日志
export const exportApiErrorLog = (params) => { export const exportApiErrorLogApi = (params: ApiErrorLogExportReqVO) => {
return request.download({ return request.download({
url: '/infra/api-error-log/export-excel', url: '/infra/api-error-log/export-excel',
params params

View File

@ -1,123 +1,57 @@
import request from '@/config/axios' import request from '@/config/axios'
import type { CodegenUpdateReqVO, CodegenCreateListReqVO } from './types'
export type CodegenTableVO = {
id: number
tableId: number
isParentMenuIdValid: boolean
dataSourceConfigId: number
scene: number
tableName: string
tableComment: string
remark: string
moduleName: string
businessName: string
className: string
classComment: string
author: string
createTime: Date
updateTime: Date
templateType: number
parentMenuId: number
}
export type CodegenColumnVO = {
id: number
tableId: number
columnName: string
dataType: string
columnComment: string
nullable: number
primaryKey: number
autoIncrement: string
ordinalPosition: number
javaType: string
javaField: string
dictType: string
example: string
createOperation: number
updateOperation: number
listOperation: number
listOperationCondition: string
listOperationResult: number
htmlType: string
}
export type DatabaseTableVO = {
name: string
comment: string
}
export type CodegenDetailVO = {
table: CodegenTableVO
columns: CodegenColumnVO[]
}
export type CodegenPreviewVO = {
filePath: string
code: string
}
export type CodegenUpdateReqVO = {
table: CodegenTableVO | any
columns: CodegenColumnVO[]
}
export type CodegenCreateListReqVO = {
dataSourceConfigId: number
tableNames: string[]
}
// 查询列表代码生成表定义 // 查询列表代码生成表定义
export const getCodegenTablePage = (params: PageParam) => { export const getCodegenTablePageApi = (params) => {
return request.get({ url: '/infra/codegen/table/page', params }) return request.get({ url: '/infra/codegen/table/page', params })
} }
// 查询详情代码生成表定义 // 查询详情代码生成表定义
export const getCodegenTable = (id: number) => { export const getCodegenTableApi = (id: number) => {
return request.get({ url: '/infra/codegen/detail?tableId=' + id }) return request.get({ url: '/infra/codegen/detail?tableId=' + id })
} }
// 新增代码生成表定义 // 新增代码生成表定义
export const createCodegenTable = (data: CodegenCreateListReqVO) => { export const createCodegenTableApi = (data: CodegenCreateListReqVO) => {
return request.post({ url: '/infra/codegen/create', data }) return request.post({ url: '/infra/codegen/create', data })
} }
// 修改代码生成表定义 // 修改代码生成表定义
export const updateCodegenTable = (data: CodegenUpdateReqVO) => { export const updateCodegenTableApi = (data: CodegenUpdateReqVO) => {
return request.put({ url: '/infra/codegen/update', data }) return request.put({ url: '/infra/codegen/update', data })
} }
// 基于数据库的表结构,同步数据库的表和字段定义 // 基于数据库的表结构,同步数据库的表和字段定义
export const syncCodegenFromDB = (id: number) => { export const syncCodegenFromDBApi = (id: number) => {
return request.put({ url: '/infra/codegen/sync-from-db?tableId=' + id }) return request.put({ url: '/infra/codegen/sync-from-db?tableId=' + id })
} }
// 基于 SQL 建表语句,同步数据库的表和字段定义 // 基于 SQL 建表语句,同步数据库的表和字段定义
export const syncCodegenFromSQL = (id: number, sql: string) => { export const syncCodegenFromSQLApi = (id: number, sql: string) => {
return request.put({ url: '/infra/codegen/sync-from-sql?tableId=' + id + '&sql=' + sql }) return request.put({ url: '/infra/codegen/sync-from-sql?tableId=' + id + '&sql=' + sql })
} }
// 预览生成代码 // 预览生成代码
export const previewCodegen = (id: number) => { export const previewCodegenApi = (id: number) => {
return request.get({ url: '/infra/codegen/preview?tableId=' + id }) return request.get({ url: '/infra/codegen/preview?tableId=' + id })
} }
// 下载生成代码 // 下载生成代码
export const downloadCodegen = (id: number) => { export const downloadCodegenApi = (id: number) => {
return request.download({ url: '/infra/codegen/download?tableId=' + id }) return request.download({ url: '/infra/codegen/download?tableId=' + id })
} }
// 获得表定义 // 获得表定义
export const getSchemaTableList = (params) => { export const getSchemaTableListApi = (params) => {
return request.get({ url: '/infra/codegen/db/table/list', params }) return request.get({ url: '/infra/codegen/db/table/list', params })
} }
// 基于数据库的表结构,创建代码生成器的表定义 // 基于数据库的表结构,创建代码生成器的表定义
export const createCodegenList = (data) => { export const createCodegenListApi = (data) => {
return request.post({ url: '/infra/codegen/create-list', data }) return request.post({ url: '/infra/codegen/create-list', data })
} }
// 删除代码生成表定义 // 删除代码生成表定义
export const deleteCodegenTable = (id: number) => { export const deleteCodegenTableApi = (id: number) => {
return request.delete({ url: '/infra/codegen/delete?tableId=' + id }) return request.delete({ url: '/infra/codegen/delete?tableId=' + id })
} }

View File

@ -0,0 +1,61 @@
export type CodegenTableVO = {
id: number
tableId: number
isParentMenuIdValid: boolean
dataSourceConfigId: number
scene: number
tableName: string
tableComment: string
remark: string
moduleName: string
businessName: string
className: string
classComment: string
author: string
createTime: Date
updateTime: Date
templateType: number
parentMenuId: number
}
export type CodegenColumnVO = {
id: number
tableId: number
columnName: string
dataType: string
columnComment: string
nullable: number
primaryKey: number
autoIncrement: string
ordinalPosition: number
javaType: string
javaField: string
dictType: string
example: string
createOperation: number
updateOperation: number
listOperation: number
listOperationCondition: string
listOperationResult: number
htmlType: string
}
export type DatabaseTableVO = {
name: string
comment: string
}
export type CodegenDetailVO = {
table: CodegenTableVO
columns: CodegenColumnVO[]
}
export type CodegenPreviewVO = {
filePath: string
code: string
}
export type CodegenUpdateReqVO = {
table: CodegenTableVO
columns: CodegenColumnVO[]
}
export type CodegenCreateListReqVO = {
dataSourceConfigId: number
tableNames: string[]
}

View File

@ -12,6 +12,13 @@ export interface ConfigVO {
createTime: Date createTime: Date
} }
export interface ConfigExportReqVO {
name?: string
key?: string
type?: number
createTime?: Date[]
}
// 查询参数列表 // 查询参数列表
export const getConfigPage = (params: PageParam) => { export const getConfigPage = (params: PageParam) => {
return request.get({ url: '/infra/config/page', params }) return request.get({ url: '/infra/config/page', params })
@ -43,6 +50,6 @@ export const deleteConfig = (id: number) => {
} }
// 导出参数 // 导出参数
export const exportConfigApi = (params) => { export const exportConfigApi = (params: ConfigExportReqVO) => {
return request.download({ url: '/infra/config/export', params }) return request.download({ url: '/infra/config/export', params })
} }

View File

@ -1,35 +1,35 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface DataSourceConfigVO { export interface DataSourceConfigVO {
id: number | undefined id: number
name: string name: string
url: string url: string
username: string username: string
password: string password: string
createTime?: Date createTime: Date
}
// 查询数据源配置列表
export const getDataSourceConfigListApi = () => {
return request.get({ url: '/infra/data-source-config/list' })
}
// 查询数据源配置详情
export const getDataSourceConfigApi = (id: number) => {
return request.get({ url: '/infra/data-source-config/get?id=' + id })
} }
// 新增数据源配置 // 新增数据源配置
export const createDataSourceConfig = (data: DataSourceConfigVO) => { export const createDataSourceConfigApi = (data: DataSourceConfigVO) => {
return request.post({ url: '/infra/data-source-config/create', data }) return request.post({ url: '/infra/data-source-config/create', data })
} }
// 修改数据源配置 // 修改数据源配置
export const updateDataSourceConfig = (data: DataSourceConfigVO) => { export const updateDataSourceConfigApi = (data: DataSourceConfigVO) => {
return request.put({ url: '/infra/data-source-config/update', data }) return request.put({ url: '/infra/data-source-config/update', data })
} }
// 删除数据源配置 // 删除数据源配置
export const deleteDataSourceConfig = (id: number) => { export const deleteDataSourceConfigApi = (id: number) => {
return request.delete({ url: '/infra/data-source-config/delete?id=' + id }) return request.delete({ url: '/infra/data-source-config/delete?id=' + id })
} }
// 查询数据源配置详情
export const getDataSourceConfig = (id: number) => {
return request.get({ url: '/infra/data-source-config/get?id=' + id })
}
// 查询数据源配置列表
export const getDataSourceConfigList = () => {
return request.get({ url: '/infra/data-source-config/list' })
}

View File

@ -13,7 +13,6 @@ export interface FileClientConfig {
accessSecret?: string accessSecret?: string
domain: string domain: string
} }
export interface FileConfigVO { export interface FileConfigVO {
id: number id: number
name: string name: string
@ -25,37 +24,43 @@ export interface FileConfigVO {
createTime: Date createTime: Date
} }
export interface FileConfigPageReqVO extends PageParam {
name?: string
storage?: number
createTime?: Date[]
}
// 查询文件配置列表 // 查询文件配置列表
export const getFileConfigPage = (params: PageParam) => { export const getFileConfigPageApi = (params: FileConfigPageReqVO) => {
return request.get({ url: '/infra/file-config/page', params }) return request.get({ url: '/infra/file-config/page', params })
} }
// 查询文件配置详情 // 查询文件配置详情
export const getFileConfig = (id: number) => { export const getFileConfigApi = (id: number) => {
return request.get({ url: '/infra/file-config/get?id=' + id }) return request.get({ url: '/infra/file-config/get?id=' + id })
} }
// 更新文件配置为主配置 // 更新文件配置为主配置
export const updateFileConfigMaster = (id: number) => { export const updateFileConfigMasterApi = (id: number) => {
return request.put({ url: '/infra/file-config/update-master?id=' + id }) return request.put({ url: '/infra/file-config/update-master?id=' + id })
} }
// 新增文件配置 // 新增文件配置
export const createFileConfig = (data: FileConfigVO) => { export const createFileConfigApi = (data: FileConfigVO) => {
return request.post({ url: '/infra/file-config/create', data }) return request.post({ url: '/infra/file-config/create', data })
} }
// 修改文件配置 // 修改文件配置
export const updateFileConfig = (data: FileConfigVO) => { export const updateFileConfigApi = (data: FileConfigVO) => {
return request.put({ url: '/infra/file-config/update', data }) return request.put({ url: '/infra/file-config/update', data })
} }
// 删除文件配置 // 删除文件配置
export const deleteFileConfig = (id: number) => { export const deleteFileConfigApi = (id: number) => {
return request.delete({ url: '/infra/file-config/delete?id=' + id }) return request.delete({ url: '/infra/file-config/delete?id=' + id })
} }
// 测试文件配置 // 测试文件配置
export const testFileConfig = (id: number) => { export const testFileConfigApi = (id: number) => {
return request.get({ url: '/infra/file-config/test?id=' + id }) return request.get({ url: '/infra/file-config/test?id=' + id })
} }

View File

@ -0,0 +1,28 @@
import request from '@/config/axios'
export interface FileVO {
id: number
configId: number
path: string
name: string
url: string
size: string
type: string
createTime: Date
}
export interface FilePageReqVO extends PageParam {
path?: string
type?: string
createTime?: Date[]
}
// 查询文件列表
export const getFilePageApi = (params: FilePageReqVO) => {
return request.get({ url: '/infra/file/page', params })
}
// 删除文件
export const deleteFileApi = (id: number) => {
return request.delete({ url: '/infra/file/delete?id=' + id })
}

View File

@ -13,38 +13,50 @@ export interface JobVO {
createTime: Date createTime: Date
} }
export interface JobPageReqVO extends PageParam {
name?: string
status?: number
handlerName?: string
}
export interface JobExportReqVO {
name?: string
status?: number
handlerName?: string
}
// 任务列表 // 任务列表
export const getJobPage = (params: PageParam) => { export const getJobPageApi = (params: JobPageReqVO) => {
return request.get({ url: '/infra/job/page', params }) return request.get({ url: '/infra/job/page', params })
} }
// 任务详情 // 任务详情
export const getJob = (id: number) => { export const getJobApi = (id: number) => {
return request.get({ url: '/infra/job/get?id=' + id }) return request.get({ url: '/infra/job/get?id=' + id })
} }
// 新增任务 // 新增任务
export const createJob = (data: JobVO) => { export const createJobApi = (data: JobVO) => {
return request.post({ url: '/infra/job/create', data }) return request.post({ url: '/infra/job/create', data })
} }
// 修改定时任务调度 // 修改定时任务调度
export const updateJob = (data: JobVO) => { export const updateJobApi = (data: JobVO) => {
return request.put({ url: '/infra/job/update', data }) return request.put({ url: '/infra/job/update', data })
} }
// 删除定时任务调度 // 删除定时任务调度
export const deleteJob = (id: number) => { export const deleteJobApi = (id: number) => {
return request.delete({ url: '/infra/job/delete?id=' + id }) return request.delete({ url: '/infra/job/delete?id=' + id })
} }
// 导出定时任务调度 // 导出定时任务调度
export const exportJob = (params) => { export const exportJobApi = (params: JobExportReqVO) => {
return request.download({ url: '/infra/job/export-excel', params }) return request.download({ url: '/infra/job/export-excel', params })
} }
// 任务状态修改 // 任务状态修改
export const updateJobStatus = (id: number, status: number) => { export const updateJobStatusApi = (id: number, status: number) => {
const params = { const params = {
id, id,
status status
@ -58,6 +70,6 @@ export const runJobApi = (id: number) => {
} }
// 获得定时任务的下 n 次执行时间 // 获得定时任务的下 n 次执行时间
export const getJobNextTimes = (id: number) => { export const getJobNextTimesApi = (id: number) => {
return request.get({ url: '/infra/job/get_next_times?id=' + id }) return request.get({ url: '/infra/job/get_next_times?id=' + id })
} }

View File

@ -14,18 +14,34 @@ export interface JobLogVO {
createTime: string createTime: string
} }
export interface JobLogPageReqVO extends PageParam {
jobId?: number
handlerName?: string
beginTime?: string
endTime?: string
status?: number
}
export interface JobLogExportReqVO {
jobId?: number
handlerName?: string
beginTime?: string
endTime?: string
status?: number
}
// 任务日志列表 // 任务日志列表
export const getJobLogPage = (params: PageParam) => { export const getJobLogPageApi = (params: JobLogPageReqVO) => {
return request.get({ url: '/infra/job-log/page', params }) return request.get({ url: '/infra/job-log/page', params })
} }
// 任务日志详情 // 任务日志详情
export const getJobLog = (id: number) => { export const getJobLogApi = (id: number) => {
return request.get({ url: '/infra/job-log/get?id=' + id }) return request.get({ url: '/infra/job-log/get?id=' + id })
} }
// 导出定时任务日志 // 导出定时任务日志
export const exportJobLog = (params) => { export const exportJobLogApi = (params: JobLogExportReqVO) => {
return request.download({ return request.download({
url: '/infra/job-log/export-excel', url: '/infra/job-log/export-excel',
params params

View File

@ -1,10 +1,5 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface AccountVO {
id?: number
name: string
}
// 创建公众号账号 // 创建公众号账号
export const createAccount = async (data) => { export const createAccount = async (data) => {
return await request.post({ url: '/mp/account/create', data }) return await request.post({ url: '/mp/account/create', data })
@ -31,7 +26,7 @@ export const getAccountPage = async (query) => {
} }
// 获取公众号账号精简信息列表 // 获取公众号账号精简信息列表
export const getSimpleAccountList = async () => { export const getSimpleAccounts = async () => {
return request.get({ url: '/mp/account/list-all-simple' }) return request.get({ url: '/mp/account/list-all-simple' })
} }

View File

@ -1,7 +1,7 @@
import request from '@/config/axios' import request from '@/config/axios'
// 获得公众号消息分页 // 获得公众号消息分页
export const getMessagePage = (query: PageParam) => { export const getMessagePage = (query) => {
return request.get({ return request.get({
url: '/mp/message/page', url: '/mp/message/page',
params: query params: query

View File

@ -1,14 +1,7 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface TagVO {
id?: number
name: string
accountId: number
createTime: Date
}
// 创建公众号标签 // 创建公众号标签
export const createTag = (data: TagVO) => { export const createTag = (data) => {
return request.post({ return request.post({
url: '/mp/tag/create', url: '/mp/tag/create',
data: data data: data
@ -16,7 +9,7 @@ export const createTag = (data: TagVO) => {
} }
// 更新公众号标签 // 更新公众号标签
export const updateTag = (data: TagVO) => { export const updateTag = (data) => {
return request.put({ return request.put({
url: '/mp/tag/update', url: '/mp/tag/update',
data: data data: data
@ -24,21 +17,21 @@ export const updateTag = (data: TagVO) => {
} }
// 删除公众号标签 // 删除公众号标签
export const deleteTag = (id: number) => { export const deleteTag = (id) => {
return request.delete({ return request.delete({
url: '/mp/tag/delete?id=' + id url: '/mp/tag/delete?id=' + id
}) })
} }
// 获得公众号标签 // 获得公众号标签
export const getTag = (id: number) => { export const getTag = (id) => {
return request.get({ return request.get({
url: '/mp/tag/get?id=' + id url: '/mp/tag/get?id=' + id
}) })
} }
// 获得公众号标签分页 // 获得公众号标签分页
export const getTagPage = (query: PageParam) => { export const getTagPage = (query) => {
return request.get({ return request.get({
url: '/mp/tag/page', url: '/mp/tag/page',
params: query params: query
@ -46,14 +39,14 @@ export const getTagPage = (query: PageParam) => {
} }
// 获取公众号标签精简信息列表 // 获取公众号标签精简信息列表
export const getSimpleTagList = () => { export const getSimpleTags = () => {
return request.get({ return request.get({
url: '/mp/tag/list-all-simple' url: '/mp/tag/list-all-simple'
}) })
} }
// 同步公众号标签 // 同步公众号标签
export const syncTag = (accountId: number) => { export const syncTag = (accountId) => {
return request.post({ return request.post({
url: '/mp/tag/sync?accountId=' + accountId url: '/mp/tag/sync?accountId=' + accountId
}) })

View File

@ -29,17 +29,17 @@ export interface MerchantExportReqVO {
} }
// 查询列表支付商户 // 查询列表支付商户
export const getMerchantPage = (params: MerchantPageReqVO) => { export const getMerchantPageApi = (params: MerchantPageReqVO) => {
return request.get({ url: '/pay/merchant/page', params }) return request.get({ url: '/pay/merchant/page', params })
} }
// 查询详情支付商户 // 查询详情支付商户
export const getMerchant = (id: number) => { export const getMerchantApi = (id: number) => {
return request.get({ url: '/pay/merchant/get?id=' + id }) return request.get({ url: '/pay/merchant/get?id=' + id })
} }
// 根据商户名称搜索商户列表 // 根据商户名称搜索商户列表
export const getMerchantListByName = (name: string) => { export const getMerchantListByNameApi = (name: string) => {
return request.get({ return request.get({
url: '/pay/merchant/list-by-name?id=', url: '/pay/merchant/list-by-name?id=',
params: { params: {
@ -49,27 +49,26 @@ export const getMerchantListByName = (name: string) => {
} }
// 新增支付商户 // 新增支付商户
export const createMerchant = (data: MerchantVO) => { export const createMerchantApi = (data: MerchantVO) => {
return request.post({ url: '/pay/merchant/create', data }) return request.post({ url: '/pay/merchant/create', data })
} }
// 修改支付商户 // 修改支付商户
export const updateMerchant = (data: MerchantVO) => { export const updateMerchantApi = (data: MerchantVO) => {
return request.put({ url: '/pay/merchant/update', data }) return request.put({ url: '/pay/merchant/update', data })
} }
// 删除支付商户 // 删除支付商户
export const deleteMerchant = (id: number) => { export const deleteMerchantApi = (id: number) => {
return request.delete({ url: '/pay/merchant/delete?id=' + id }) return request.delete({ url: '/pay/merchant/delete?id=' + id })
} }
// 导出支付商户 // 导出支付商户
export const exportMerchant = (params: MerchantExportReqVO) => { export const exportMerchantApi = (params: MerchantExportReqVO) => {
return request.download({ url: '/pay/merchant/export-excel', params }) return request.download({ url: '/pay/merchant/export-excel', params })
} }
// 支付商户状态修改 // 支付商户状态修改
export const updateMerchantStatus = (id: number, status: number) => { export const changeMerchantStatusApi = (id: number, status: number) => {
const data = { const data = {
id, id,
status status

View File

@ -1,11 +1,15 @@
import request from '@/config/axios' import request from '@/config/axios/request'
// 获得地区树 // 获得地区树
export const getAreaTree = async () => { export const getAreaTree = async (content?: any) => {
return await request.get({ url: '/system/area/tree' }) return await request.get({
url: '/system/area/tree',
params: content
})
} }
// 获得 IP 对应的地区名 // 获得 IP 对应的地区名
export const getAreaByIp = async (ip: string) => { export const getAreaByIp = async (ip) => {
return await request.get({ url: '/system/area/get-by-ip?ip=' + ip }) return await request.get({
url: '/system/area/get-by-ip?ip=' + ip
})
} }

View File

@ -18,7 +18,7 @@ export interface DeptPageReqVO {
} }
// 查询部门(精简)列表 // 查询部门(精简)列表
export const getSimpleDeptList = async (): Promise<DeptVO[]> => { export const listSimpleDeptApi = async () => {
return await request.get({ url: '/system/dept/list-all-simple' }) return await request.get({ url: '/system/dept/list-all-simple' })
} }

View File

@ -1,49 +1,36 @@
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 listSimpleDictData = () => { export const listSimpleDictDataApi = () => {
return request.get({ url: '/system/dict-data/list-all-simple' }) return request.get({ url: '/system/dict-data/list-all-simple' })
} }
// 查询字典数据列表 // 查询字典数据列表
export const getDictDataPage = (params: PageParam) => { export const getDictDataPageApi = (params: DictDataPageReqVO) => {
return request.get({ url: '/system/dict-data/page', params }) return request.get({ url: '/system/dict-data/page', params })
} }
// 查询字典数据详情 // 查询字典数据详情
export const getDictData = (id: number) => { export const getDictDataApi = (id: number) => {
return request.get({ url: '/system/dict-data/get?id=' + id }) return request.get({ url: '/system/dict-data/get?id=' + id })
} }
// 新增字典数据 // 新增字典数据
export const createDictData = (data: DictDataVO) => { export const createDictDataApi = (data: DictDataVO) => {
return request.post({ url: '/system/dict-data/create', data }) return request.post({ url: '/system/dict-data/create', data })
} }
// 修改字典数据 // 修改字典数据
export const updateDictData = (data: DictDataVO) => { export const updateDictDataApi = (data: DictDataVO) => {
return request.put({ url: '/system/dict-data/update', data }) return request.put({ url: '/system/dict-data/update', data })
} }
// 删除字典数据 // 删除字典数据
export const deleteDictData = (id: number) => { export const deleteDictDataApi = (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) => { export const exportDictDataApi = (params: DictDataExportReqVO) => {
return request.get({ url: '/system/dict-data/export', params }) return request.get({ url: '/system/dict-data/export', params })
} }

View File

@ -1,44 +1,36 @@
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 getSimpleDictTypeList = () => { export const listSimpleDictTypeApi = () => {
return request.get({ url: '/system/dict-type/list-all-simple' }) return request.get({ url: '/system/dict-type/list-all-simple' })
} }
// 查询字典列表 // 查询字典列表
export const getDictTypePage = (params: PageParam) => { export const getDictTypePageApi = (params: DictTypePageReqVO) => {
return request.get({ url: '/system/dict-type/page', params }) return request.get({ url: '/system/dict-type/page', params })
} }
// 查询字典详情 // 查询字典详情
export const getDictType = (id: number) => { export const getDictTypeApi = (id: number) => {
return request.get({ url: '/system/dict-type/get?id=' + id }) return request.get({ url: '/system/dict-type/get?id=' + id })
} }
// 新增字典 // 新增字典
export const createDictType = (data: DictTypeVO) => { export const createDictTypeApi = (data: DictTypeVO) => {
return request.post({ url: '/system/dict-type/create', data }) return request.post({ url: '/system/dict-type/create', data })
} }
// 修改字典 // 修改字典
export const updateDictType = (data: DictTypeVO) => { export const updateDictTypeApi = (data: DictTypeVO) => {
return request.put({ url: '/system/dict-type/update', data }) return request.put({ url: '/system/dict-type/update', data })
} }
// 删除字典 // 删除字典
export const deleteDictType = (id: number) => { export const deleteDictTypeApi = (id: number) => {
return request.delete({ url: '/system/dict-type/delete?id=' + id }) return request.delete({ url: '/system/dict-type/delete?id=' + id })
} }
// 导出字典类型 // 导出字典类型
export const exportDictType = (params) => { export const exportDictTypeApi = (params: DictTypeExportReqVO) => {
return request.get({ url: '/system/dict-type/export', params }) return request.get({ url: '/system/dict-type/export', params })
} }

View File

@ -0,0 +1,46 @@
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
}

View File

@ -1,10 +1,10 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface ErrorCodeVO { export interface ErrorCodeVO {
id: number | undefined id: number
type: number type: number
applicationName: string applicationName: string
code: number | undefined code: number
message: string message: string
memo: string memo: string
createTime: Date createTime: Date

View File

@ -13,12 +13,18 @@ export interface LoginLogVO {
createTime: Date createTime: Date
} }
// 查询登录日志列表 export interface LoginLogReqVO extends PageParam {
export const getLoginLogPage = (params: PageParam) => { userIp?: string
return request.get({ url: '/system/login-log/page', params }) username?: string
status?: boolean
createTime?: Date[]
} }
// 查询登录日志列表
export const getLoginLogPageApi = (params: LoginLogReqVO) => {
return request.get({ url: '/system/login-log/page', params })
}
// 导出登录日志 // 导出登录日志
export const exportLoginLog = (params) => { export const exportLoginLogApi = (params: LoginLogReqVO) => {
return request.download({ url: '/system/login-log/export', params }) return request.download({ url: '/system/login-log/export', params })
} }

View File

@ -10,32 +10,37 @@ export interface MailAccountVO {
sslEnable: boolean sslEnable: boolean
} }
export interface MailAccountPageReqVO extends PageParam {
mail?: string
username?: string
}
// 查询邮箱账号列表 // 查询邮箱账号列表
export const getMailAccountPage = async (params: PageParam) => { export const getMailAccountPageApi = async (params: MailAccountPageReqVO) => {
return await request.get({ url: '/system/mail-account/page', params }) return await request.get({ url: '/system/mail-account/page', params })
} }
// 查询邮箱账号详情 // 查询邮箱账号详情
export const getMailAccount = async (id: number) => { export const getMailAccountApi = async (id: number) => {
return await request.get({ url: '/system/mail-account/get?id=' + id }) return await request.get({ url: '/system/mail-account/get?id=' + id })
} }
// 新增邮箱账号 // 新增邮箱账号
export const createMailAccount = async (data: MailAccountVO) => { export const createMailAccountApi = async (data: MailAccountVO) => {
return await request.post({ url: '/system/mail-account/create', data }) return await request.post({ url: '/system/mail-account/create', data })
} }
// 修改邮箱账号 // 修改邮箱账号
export const updateMailAccount = async (data: MailAccountVO) => { export const updateMailAccountApi = async (data: MailAccountVO) => {
return await request.put({ url: '/system/mail-account/update', data }) return await request.put({ url: '/system/mail-account/update', data })
} }
// 删除邮箱账号 // 删除邮箱账号
export const deleteMailAccount = async (id: number) => { export const deleteMailAccountApi = async (id: number) => {
return await request.delete({ url: '/system/mail-account/delete?id=' + id }) return await request.delete({ url: '/system/mail-account/delete?id=' + id })
} }
// 获得邮箱账号精简列表 // 获得邮箱账号精简列表
export const getSimpleMailAccountList = async () => { export const getSimpleMailAccounts = async () => {
return request.get({ url: '/system/mail-account/list-all-simple' }) return request.get({ url: '/system/mail-account/list-all-simple' })
} }

View File

@ -19,12 +19,22 @@ export interface MailLogVO {
sendException: string sendException: string
} }
export interface MailLogPageReqVO extends PageParam {
userId?: number
userType?: number
toMail?: string
accountId?: number
templateId?: number
sendStatus?: number
sendTime?: Date[]
}
// 查询邮件日志列表 // 查询邮件日志列表
export const getMailLogPage = async (params: PageParam) => { export const getMailLogPageApi = async (params: MailLogPageReqVO) => {
return await request.get({ url: '/system/mail-log/page', params }) return await request.get({ url: '/system/mail-log/page', params })
} }
// 查询邮件日志详情 // 查询邮件日志详情
export const getMailLog = async (id: number) => { export const getMailLogApi = async (id: number) => {
return await request.get({ url: '/system/mail-log/get?id=' + id }) return await request.get({ url: '/system/mail-log/get?id=' + id })
} }

View File

@ -13,6 +13,14 @@ export interface MailTemplateVO {
remark: string remark: string
} }
export interface MailTemplatePageReqVO extends PageParam {
name?: string
code?: string
accountId?: number
status?: number
createTime?: Date[]
}
export interface MailSendReqVO { export interface MailSendReqVO {
mail: string mail: string
templateCode: string templateCode: string
@ -20,31 +28,31 @@ export interface MailSendReqVO {
} }
// 查询邮件模版列表 // 查询邮件模版列表
export const getMailTemplatePage = async (params: PageParam) => { export const getMailTemplatePageApi = async (params: MailTemplatePageReqVO) => {
return await request.get({ url: '/system/mail-template/page', params }) return await request.get({ url: '/system/mail-template/page', params })
} }
// 查询邮件模版详情 // 查询邮件模版详情
export const getMailTemplate = async (id: number) => { export const getMailTemplateApi = async (id: number) => {
return await request.get({ url: '/system/mail-template/get?id=' + id }) return await request.get({ url: '/system/mail-template/get?id=' + id })
} }
// 新增邮件模版 // 新增邮件模版
export const createMailTemplate = async (data: MailTemplateVO) => { export const createMailTemplateApi = async (data: MailTemplateVO) => {
return await request.post({ url: '/system/mail-template/create', data }) return await request.post({ url: '/system/mail-template/create', data })
} }
// 修改邮件模版 // 修改邮件模版
export const updateMailTemplate = async (data: MailTemplateVO) => { export const updateMailTemplateApi = async (data: MailTemplateVO) => {
return await request.put({ url: '/system/mail-template/update', data }) return await request.put({ url: '/system/mail-template/update', data })
} }
// 删除邮件模版 // 删除邮件模版
export const deleteMailTemplate = async (id: number) => { export const deleteMailTemplateApi = async (id: number) => {
return await request.delete({ url: '/system/mail-template/delete?id=' + id }) return await request.delete({ url: '/system/mail-template/delete?id=' + id })
} }
// 发送邮件 // 发送邮件
export const sendMail = (data: MailSendReqVO) => { export const sendMailApi = (data: MailSendReqVO) => {
return request.post({ url: '/system/mail-template/send-mail', data }) return request.post({ url: '/system/mail-template/send-mail', data })
} }

View File

@ -18,13 +18,18 @@ export interface MenuVO {
createTime: Date createTime: Date
} }
export interface MenuPageReqVO {
name?: string
status?: number
}
// 查询菜单(精简)列表 // 查询菜单(精简)列表
export const getSimpleMenusList = () => { export const listSimpleMenusApi = () => {
return request.get({ url: '/system/menu/list-all-simple' }) return request.get({ url: '/system/menu/list-all-simple' })
} }
// 查询菜单列表 // 查询菜单列表
export const getMenuList = (params) => { export const getMenuListApi = (params: MenuPageReqVO) => {
return request.get({ url: '/system/menu/list', params }) return request.get({ url: '/system/menu/list', params })
} }
@ -34,16 +39,16 @@ export const getMenuApi = (id: number) => {
} }
// 新增菜单 // 新增菜单
export const createMenu = (data: MenuVO) => { export const createMenuApi = (data: MenuVO) => {
return request.post({ url: '/system/menu/create', data }) return request.post({ url: '/system/menu/create', data })
} }
// 修改菜单 // 修改菜单
export const updateMenu = (data: MenuVO) => { export const updateMenuApi = (data: MenuVO) => {
return request.put({ url: '/system/menu/update', data }) return request.put({ url: '/system/menu/update', data })
} }
// 删除菜单 // 删除菜单
export const deleteMenu = (id: number) => { export const deleteMenuApi = (id: number) => {
return request.delete({ url: '/system/menu/delete?id=' + id }) return request.delete({ url: '/system/menu/delete?id=' + id })
} }

View File

@ -15,13 +15,31 @@ export interface NotifyMessageVO {
readTime: Date readTime: Date
} }
export interface NotifyMessagePageReqVO extends PageParam {
userId?: number
userType?: number
templateCode?: string
templateType?: number
createTime?: Date[]
}
export interface NotifyMessageMyPageReqVO extends PageParam {
readStatus?: boolean
createTime?: Date[]
}
// 查询站内信消息列表 // 查询站内信消息列表
export const getNotifyMessagePage = async (params: PageParam) => { export const getNotifyMessagePageApi = async (params: NotifyMessagePageReqVO) => {
return await request.get({ url: '/system/notify-message/page', params }) return await request.get({ url: '/system/notify-message/page', params })
} }
// 查询站内信消息详情
export const getNotifyMessageApi = async (id: number) => {
return await request.get({ url: '/system/notify-message/get?id=' + id })
}
// 获得我的站内信分页 // 获得我的站内信分页
export const getMyNotifyMessagePage = async (params: PageParam) => { export const getMyNotifyMessagePage = async (params: NotifyMessageMyPageReqVO) => {
return await request.get({ url: '/system/notify-message/my-page', params }) return await request.get({ url: '/system/notify-message/my-page', params })
} }

View File

@ -21,27 +21,31 @@ export interface OAuth2ClientVO {
createTime: Date createTime: Date
} }
// 查询 OAuth2 客户端的列表 export interface OAuth2ClientPageReqVO extends PageParam {
export const getOAuth2ClientPage = (params: PageParam) => { name?: string
status?: number
}
// 查询 OAuth2列表
export const getOAuth2ClientPageApi = (params: OAuth2ClientPageReqVO) => {
return request.get({ url: '/system/oauth2-client/page', params }) return request.get({ url: '/system/oauth2-client/page', params })
} }
// 查询 OAuth2 客户端的详情 // 查询 OAuth2详情
export const getOAuth2Client = (id: number) => { export const getOAuth2ClientApi = (id: number) => {
return request.get({ url: '/system/oauth2-client/get?id=' + id }) return request.get({ url: '/system/oauth2-client/get?id=' + id })
} }
// 新增 OAuth2 客户端 // 新增 OAuth2
export const createOAuth2Client = (data: OAuth2ClientVO) => { export const createOAuth2ClientApi = (data: OAuth2ClientVO) => {
return request.post({ url: '/system/oauth2-client/create', data }) return request.post({ url: '/system/oauth2-client/create', data })
} }
// 修改 OAuth2 客户端 // 修改 OAuth2
export const updateOAuth2Client = (data: OAuth2ClientVO) => { export const updateOAuth2ClientApi = (data: OAuth2ClientVO) => {
return request.put({ url: '/system/oauth2-client/update', data }) return request.put({ url: '/system/oauth2-client/update', data })
} }
// 删除 OAuth2 // 删除 OAuth2
export const deleteOAuth2Client = (id: number) => { export const deleteOAuth2ClientApi = (id: number) => {
return request.delete({ url: '/system/oauth2-client/delete?id=' + id }) return request.delete({ url: '/system/oauth2-client/delete?id=' + id })
} }

View File

@ -11,12 +11,18 @@ export interface OAuth2TokenVO {
expiresTime: Date expiresTime: Date
} }
export interface OAuth2TokenPageReqVO extends PageParam {
userId?: number
userType?: number
clientId?: string
}
// 查询 token列表 // 查询 token列表
export const getAccessTokenPage = (params: PageParam) => { export const getAccessTokenPageApi = (params: OAuth2TokenPageReqVO) => {
return request.get({ url: '/system/oauth2-token/page', params }) return request.get({ url: '/system/oauth2-token/page', params })
} }
// 删除 token // 删除 token
export const deleteAccessToken = (accessToken: number) => { export const deleteAccessTokenApi = (accessToken: number) => {
return request.delete({ url: '/system/oauth2-token/delete?accessToken=' + accessToken }) return request.delete({ url: '/system/oauth2-token/delete?accessToken=' + accessToken })
} }

View File

@ -23,11 +23,19 @@ export type OperateLogVO = {
resultData: string resultData: string
} }
export interface OperateLogPageReqVO extends PageParam {
module?: string
userNickname?: string
type?: number
success?: boolean
startTime?: Date[]
}
// 查询操作日志列表 // 查询操作日志列表
export const getOperateLogPage = (params: PageParam) => { export const getOperateLogPageApi = (params: OperateLogPageReqVO) => {
return request.get({ url: '/system/operate-log/page', params }) return request.get({ url: '/system/operate-log/page', params })
} }
// 导出操作日志 // 导出操作日志
export const exportOperateLog = (params) => { export const exportOperateLogApi = (params: OperateLogPageReqVO) => {
return request.download({ url: '/system/operate-log/export', params }) return request.download({ url: '/system/operate-log/export', params })
} }

View File

@ -17,26 +17,26 @@ export interface PermissionAssignRoleDataScopeReqVO {
} }
// 查询角色拥有的菜单权限 // 查询角色拥有的菜单权限
export const getRoleMenuList = async (roleId: number) => { export const listRoleMenusApi = async (roleId: number) => {
return await request.get({ url: '/system/permission/list-role-resources?roleId=' + roleId }) return await request.get({ url: '/system/permission/list-role-resources?roleId=' + roleId })
} }
// 赋予角色菜单权限 // 赋予角色菜单权限
export const assignRoleMenu = async (data: PermissionAssignRoleMenuReqVO) => { export const assignRoleMenuApi = async (data: PermissionAssignRoleMenuReqVO) => {
return await request.post({ url: '/system/permission/assign-role-menu', data }) return await request.post({ url: '/system/permission/assign-role-menu', data })
} }
// 赋予角色数据权限 // 赋予角色数据权限
export const assignRoleDataScope = async (data: PermissionAssignRoleDataScopeReqVO) => { export const assignRoleDataScopeApi = async (data: PermissionAssignRoleDataScopeReqVO) => {
return await request.post({ url: '/system/permission/assign-role-data-scope', data }) return await request.post({ url: '/system/permission/assign-role-data-scope', data })
} }
// 查询用户拥有的角色数组 // 查询用户拥有的角色数组
export const getUserRoleList = async (userId: number) => { export const listUserRolesApi = async (userId: number) => {
return await request.get({ url: '/system/permission/list-user-roles?userId=' + userId }) return await request.get({ url: '/system/permission/list-user-roles?userId=' + userId })
} }
// 赋予用户角色 // 赋予用户角色
export const assignUserRole = async (data: PermissionAssignUserRoleReqVO) => { export const aassignUserRoleApi = async (data: PermissionAssignUserRoleReqVO) => {
return await request.post({ url: '/system/permission/assign-user-role', data }) return await request.post({ url: '/system/permission/assign-user-role', data })
} }

View File

@ -10,37 +10,49 @@ 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 getPostPage = async (params: PageParam) => { export const getPostPageApi = async (params: PostPageReqVO) => {
return await request.get({ url: '/system/post/page', params }) return await request.get({ url: '/system/post/page', params })
} }
// 获取岗位精简信息列表 // 获取岗位精简信息列表
export const getSimplePostList = async (): Promise<PostVO[]> => { export const listSimplePostsApi = async () => {
return await request.get({ url: '/system/post/list-all-simple' }) return await request.get({ url: '/system/post/list-all-simple' })
} }
// 查询岗位详情 // 查询岗位详情
export const getPost = async (id: number) => { export const getPostApi = 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 createPost = async (data: PostVO) => { export const createPostApi = async (data: PostVO) => {
return await request.post({ url: '/system/post/create', data }) return await request.post({ url: '/system/post/create', data })
} }
// 修改岗位 // 修改岗位
export const updatePost = async (data: PostVO) => { export const updatePostApi = async (data: PostVO) => {
return await request.put({ url: '/system/post/update', data }) return await request.put({ url: '/system/post/update', data })
} }
// 删除岗位 // 删除岗位
export const deletePost = async (id: number) => { export const deletePostApi = 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 exportPost = async (params) => { export const exportPostApi = async (params: PostExportReqVO) => {
return await request.download({ url: '/system/post/export', params }) return await request.download({ url: '/system/post/export', params })
} }

View File

@ -7,55 +7,52 @@ export interface RoleVO {
sort: number sort: number
status: number status: number
type: number type: number
dataScope: number
dataScopeDeptIds: number[]
createTime: Date createTime: Date
} }
export interface RolePageReqVO extends PageParam {
name?: string
code?: string
status?: number
createTime?: Date[]
}
export interface UpdateStatusReqVO { export interface UpdateStatusReqVO {
id: number id: number
status: number status: number
} }
// 查询角色列表 // 查询角色列表
export const getRolePage = async (params: PageParam) => { export const getRolePageApi = async (params: RolePageReqVO) => {
return await request.get({ url: '/system/role/page', params }) return await request.get({ url: '/system/role/page', params })
} }
// 查询角色(精简)列表 // 查询角色(精简)列表
export const getSimpleRoleList = async (): Promise<RoleVO[]> => { export const listSimpleRolesApi = async () => {
return await request.get({ url: '/system/role/list-all-simple' }) return await request.get({ url: '/system/role/list-all-simple' })
} }
// 查询角色详情 // 查询角色详情
export const getRole = async (id: number) => { export const getRoleApi = async (id: number) => {
return await request.get({ url: '/system/role/get?id=' + id }) return await request.get({ url: '/system/role/get?id=' + id })
} }
// 新增角色 // 新增角色
export const createRole = async (data: RoleVO) => { export const createRoleApi = async (data: RoleVO) => {
return await request.post({ url: '/system/role/create', data }) return await request.post({ url: '/system/role/create', data })
} }
// 修改角色 // 修改角色
export const updateRole = async (data: RoleVO) => { export const updateRoleApi = async (data: RoleVO) => {
return await request.put({ url: '/system/role/update', data }) return await request.put({ url: '/system/role/update', data })
} }
// 修改角色状态 // 修改角色状态
export const updateRoleStatus = async (data: UpdateStatusReqVO) => { export const updateRoleStatusApi = async (data: UpdateStatusReqVO) => {
return await request.put({ url: '/system/role/update-status', data }) return await request.put({ url: '/system/role/update-status', data })
} }
// 删除角色 // 删除角色
export const deleteRole = async (id: number) => { export const deleteRoleApi = async (id: number) => {
return await request.delete({ url: '/system/role/delete?id=' + id }) return await request.delete({ url: '/system/role/delete?id=' + id })
} }
// 导出角色
export const exportRole = (params) => {
return request.download({
url: '/system/role/export-excel',
params
})
}

View File

@ -1,5 +1,4 @@
import request from '@/config/axios' import request from '@/config/axios'
import qs from 'qs'
export interface SensitiveWordVO { export interface SensitiveWordVO {
id: number id: number
@ -10,49 +9,56 @@ export interface SensitiveWordVO {
createTime: Date createTime: Date
} }
export interface SensitiveWordTestReqVO { export interface SensitiveWordPageReqVO extends PageParam {
text: string name?: string
tag: string[] tag?: string
status?: number
createTime?: Date[]
}
export interface SensitiveWordExportReqVO {
name?: string
tag?: string
status?: number
createTime?: Date[]
} }
// 查询敏感词列表 // 查询敏感词列表
export const getSensitiveWordPage = (params: PageParam) => { export const getSensitiveWordPageApi = (params: SensitiveWordPageReqVO) => {
return request.get({ url: '/system/sensitive-word/page', params }) return request.get({ url: '/system/sensitive-word/page', params })
} }
// 查询敏感词详情 // 查询敏感词详情
export const getSensitiveWord = (id: number) => { export const getSensitiveWordApi = (id: number) => {
return request.get({ url: '/system/sensitive-word/get?id=' + id }) return request.get({ url: '/system/sensitive-word/get?id=' + id })
} }
// 新增敏感词 // 新增敏感词
export const createSensitiveWord = (data: SensitiveWordVO) => { export const createSensitiveWordApi = (data: SensitiveWordVO) => {
return request.post({ url: '/system/sensitive-word/create', data }) return request.post({ url: '/system/sensitive-word/create', data })
} }
// 修改敏感词 // 修改敏感词
export const updateSensitiveWord = (data: SensitiveWordVO) => { export const updateSensitiveWordApi = (data: SensitiveWordVO) => {
return request.put({ url: '/system/sensitive-word/update', data }) return request.put({ url: '/system/sensitive-word/update', data })
} }
// 删除敏感词 // 删除敏感词
export const deleteSensitiveWord = (id: number) => { export const deleteSensitiveWordApi = (id: number) => {
return request.delete({ url: '/system/sensitive-word/delete?id=' + id }) return request.delete({ url: '/system/sensitive-word/delete?id=' + id })
} }
// 导出敏感词 // 导出敏感词
export const exportSensitiveWord = (params) => { export const exportSensitiveWordApi = (params: SensitiveWordExportReqVO) => {
return request.download({ url: '/system/sensitive-word/export-excel', params }) return request.download({ url: '/system/sensitive-word/export-excel', params })
} }
// 获取所有敏感词的标签数组 // 获取所有敏感词的标签数组
export const getSensitiveWordTagList = () => { export const getSensitiveWordTagsApi = () => {
return request.get({ url: '/system/sensitive-word/get-tags' }) return request.get({ url: '/system/sensitive-word/get-tags' })
} }
// 获得文本所包含的不合法的敏感词数组 // 获得文本所包含的不合法的敏感词数组
export const validateText = (query: SensitiveWordTestReqVO) => { export const validateTextApi = (id: number) => {
return request.get({ return request.get({ url: '/system/sensitive-word/validate-text?' + id })
url: '/system/sensitive-word/validate-text?' + qs.stringify(query, { arrayFormat: 'repeat' })
})
} }

View File

@ -12,32 +12,39 @@ export interface SmsChannelVO {
createTime: Date createTime: Date
} }
export interface SmsChannelPageReqVO extends PageParam {
signature?: string
code?: string
status?: number
createTime?: Date[]
}
// 查询短信渠道列表 // 查询短信渠道列表
export const getSmsChannelPage = (params: PageParam) => { export const getSmsChannelPageApi = (params: SmsChannelPageReqVO) => {
return request.get({ url: '/system/sms-channel/page', params }) return request.get({ url: '/system/sms-channel/page', params })
} }
// 获得短信渠道精简列表 // 获得短信渠道精简列表
export function getSimpleSmsChannelList() { export function getSimpleSmsChannels() {
return request.get({ url: '/system/sms-channel/list-all-simple' }) return request.get({ url: '/system/sms-channel/list-all-simple' })
} }
// 查询短信渠道详情 // 查询短信渠道详情
export const getSmsChannel = (id: number) => { export const getSmsChannelApi = (id: number) => {
return request.get({ url: '/system/sms-channel/get?id=' + id }) return request.get({ url: '/system/sms-channel/get?id=' + id })
} }
// 新增短信渠道 // 新增短信渠道
export const createSmsChannel = (data: SmsChannelVO) => { export const createSmsChannelApi = (data: SmsChannelVO) => {
return request.post({ url: '/system/sms-channel/create', data }) return request.post({ url: '/system/sms-channel/create', data })
} }
// 修改短信渠道 // 修改短信渠道
export const updateSmsChannel = (data: SmsChannelVO) => { export const updateSmsChannelApi = (data: SmsChannelVO) => {
return request.put({ url: '/system/sms-channel/update', data }) return request.put({ url: '/system/sms-channel/update', data })
} }
// 删除短信渠道 // 删除短信渠道
export const deleteSmsChannel = (id: number) => { export const deleteSmsChannelApi = (id: number) => {
return request.delete({ url: '/system/sms-channel/delete?id=' + id }) return request.delete({ url: '/system/sms-channel/delete?id=' + id })
} }

View File

@ -1,39 +1,57 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface SmsLogVO { export interface SmsLogVO {
id: number | null id: number
channelId: number | null channelId: number
channelCode: string channelCode: string
templateId: number | null templateId: number
templateCode: string templateCode: string
templateType: number | null templateType: number
templateContent: string templateContent: string
templateParams: Map<string, object> | null templateParams: Map<string, object>
apiTemplateId: string
mobile: string mobile: string
userId: number | null userId: number
userType: number | null userType: number
sendStatus: number | null sendStatus: number
sendTime: Date | null sendTime: Date
sendCode: number | null sendCode: number
sendMsg: string sendMsg: string
apiSendCode: string apiSendCode: string
apiSendMsg: string apiSendMsg: string
apiRequestId: string apiRequestId: string
apiSerialNo: string apiSerialNo: string
receiveStatus: number | null receiveStatus: number
receiveTime: Date | null receiveTime: Date
apiReceiveCode: string apiReceiveCode: string
apiReceiveMsg: string apiReceiveMsg: string
createTime: Date | null createTime: Date
}
export interface SmsLogPageReqVO extends PageParam {
channelId?: number
templateId?: number
mobile?: string
sendStatus?: number
sendTime?: Date[]
receiveStatus?: number
receiveTime?: Date[]
}
export interface SmsLogExportReqVO {
channelId?: number
templateId?: number
mobile?: string
sendStatus?: number
sendTime?: Date[]
receiveStatus?: number
receiveTime?: Date[]
} }
// 查询短信日志列表 // 查询短信日志列表
export const getSmsLogPage = (params: PageParam) => { export const getSmsLogPageApi = (params: SmsLogPageReqVO) => {
return request.get({ url: '/system/sms-log/page', params }) return request.get({ url: '/system/sms-log/page', params })
} }
// 导出短信日志 // 导出短信日志
export const exportSmsLog = (params) => { export const exportSmsLogApi = (params: SmsLogExportReqVO) => {
return request.download({ url: '/system/sms-log/export-excel', params }) return request.download({ url: '/system/sms-log/export-excel', params })
} }

View File

@ -1,18 +1,18 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface SmsTemplateVO { export interface SmsTemplateVO {
id: number | null id: number
type: number | null type: number
status: number status: number
code: string code: string
name: string name: string
content: string content: string
remark: string remark: string
apiTemplateId: string apiTemplateId: string
channelId: number | null channelId: number
channelCode?: string channelCode: string
params?: string[] params: string[]
createTime?: Date createTime: Date
} }
export interface SendSmsReqVO { export interface SendSmsReqVO {
@ -21,40 +21,60 @@ export interface SendSmsReqVO {
templateParams: Map<String, Object> templateParams: Map<String, Object>
} }
export interface SmsTemplatePageReqVO {
type?: number
status?: number
code?: string
content?: string
apiTemplateId?: string
channelId?: number
createTime?: Date[]
}
export interface SmsTemplateExportReqVO {
type?: number
status?: number
code?: string
content?: string
apiTemplateId?: string
channelId?: number
createTime?: Date[]
}
// 查询短信模板列表 // 查询短信模板列表
export const getSmsTemplatePage = (params: PageParam) => { export const getSmsTemplatePageApi = (params: SmsTemplatePageReqVO) => {
return request.get({ url: '/system/sms-template/page', params }) return request.get({ url: '/system/sms-template/page', params })
} }
// 查询短信模板详情 // 查询短信模板详情
export const getSmsTemplate = (id: number) => { export const getSmsTemplateApi = (id: number) => {
return request.get({ url: '/system/sms-template/get?id=' + id }) return request.get({ url: '/system/sms-template/get?id=' + id })
} }
// 新增短信模板 // 新增短信模板
export const createSmsTemplate = (data: SmsTemplateVO) => { export const createSmsTemplateApi = (data: SmsTemplateVO) => {
return request.post({ url: '/system/sms-template/create', data }) return request.post({ url: '/system/sms-template/create', data })
} }
// 修改短信模板 // 修改短信模板
export const updateSmsTemplate = (data: SmsTemplateVO) => { export const updateSmsTemplateApi = (data: SmsTemplateVO) => {
return request.put({ url: '/system/sms-template/update', data }) return request.put({ url: '/system/sms-template/update', data })
} }
// 删除短信模板 // 删除短信模板
export const deleteSmsTemplate = (id: number) => { export const deleteSmsTemplateApi = (id: number) => {
return request.delete({ url: '/system/sms-template/delete?id=' + id }) return request.delete({ url: '/system/sms-template/delete?id=' + id })
} }
// 发送短信
export const sendSmsApi = (data: SendSmsReqVO) => {
return request.post({ url: '/system/sms-template/send-sms', data })
}
// 导出短信模板 // 导出短信模板
export const exportSmsTemplate = (params) => { export const exportPostApi = (params: SmsTemplateExportReqVO) => {
return request.download({ return request.download({
url: '/system/sms-template/export-excel', url: '/system/sms-template/export-excel',
params params
}) })
} }
// 发送短信
export const sendSms = (data: SendSmsReqVO) => {
return request.post({ url: '/system/sms-template/send-sms', data })
}

View File

@ -32,31 +32,31 @@ export interface TenantExportReqVO {
} }
// 查询租户列表 // 查询租户列表
export const getTenantPage = (params: TenantPageReqVO) => { export const getTenantPageApi = (params: TenantPageReqVO) => {
return request.get({ url: '/system/tenant/page', params }) return request.get({ url: '/system/tenant/page', params })
} }
// 查询租户详情 // 查询租户详情
export const getTenant = (id: number) => { export const getTenantApi = (id: number) => {
return request.get({ url: '/system/tenant/get?id=' + id }) return request.get({ url: '/system/tenant/get?id=' + id })
} }
// 新增租户 // 新增租户
export const createTenant = (data: TenantVO) => { export const createTenantApi = (data: TenantVO) => {
return request.post({ url: '/system/tenant/create', data }) return request.post({ url: '/system/tenant/create', data })
} }
// 修改租户 // 修改租户
export const updateTenant = (data: TenantVO) => { export const updateTenantApi = (data: TenantVO) => {
return request.put({ url: '/system/tenant/update', data }) return request.put({ url: '/system/tenant/update', data })
} }
// 删除租户 // 删除租户
export const deleteTenant = (id: number) => { export const deleteTenantApi = (id: number) => {
return request.delete({ url: '/system/tenant/delete?id=' + id }) return request.delete({ url: '/system/tenant/delete?id=' + id })
} }
// 导出租户 // 导出租户
export const exportTenant = (params: TenantExportReqVO) => { export const exportTenantApi = (params: TenantExportReqVO) => {
return request.download({ url: '/system/tenant/export-excel', params }) return request.download({ url: '/system/tenant/export-excel', params })
} }

View File

@ -12,28 +12,35 @@ export interface TenantPackageVO {
createTime: Date createTime: Date
} }
export interface TenantPackagePageReqVO extends PageParam {
name?: string
status?: number
remark?: string
createTime?: Date[]
}
// 查询租户套餐列表 // 查询租户套餐列表
export const getTenantPackagePage = (params: PageParam) => { export const getTenantPackageTypePageApi = (params: TenantPackagePageReqVO) => {
return request.get({ url: '/system/tenant-package/page', params }) return request.get({ url: '/system/tenant-package/page', params })
} }
// 获得租户 // 获得租户
export const getTenantPackage = (id: number) => { export const getTenantPackageApi = (id: number) => {
return request.get({ url: '/system/tenant-package/get?id=' + id }) return request.get({ url: '/system/tenant-package/get?id=' + id })
} }
// 新增租户套餐 // 新增租户套餐
export const createTenantPackage = (data: TenantPackageVO) => { export const createTenantPackageTypeApi = (data: TenantPackageVO) => {
return request.post({ url: '/system/tenant-package/create', data }) return request.post({ url: '/system/tenant-package/create', data })
} }
// 修改租户套餐 // 修改租户套餐
export const updateTenantPackage = (data: TenantPackageVO) => { export const updateTenantPackageTypeApi = (data: TenantPackageVO) => {
return request.put({ url: '/system/tenant-package/update', data }) return request.put({ url: '/system/tenant-package/update', data })
} }
// 删除租户套餐 // 删除租户套餐
export const deleteTenantPackage = (id: number) => { export const deleteTenantPackageTypeApi = (id: number) => {
return request.delete({ url: '/system/tenant-package/delete?id=' + id }) return request.delete({ url: '/system/tenant-package/delete?id=' + id })
} }
// 获取租户套餐精简信息列表 // 获取租户套餐精简信息列表

View File

@ -17,43 +17,58 @@ export interface UserVO {
createTime: Date createTime: Date
} }
export interface UserPageReqVO extends PageParam {
deptId?: number
username?: string
mobile?: string
status?: number
createTime?: Date[]
}
export interface UserExportReqVO {
code?: string
name?: string
status?: number
createTime?: Date[]
}
// 查询用户管理列表 // 查询用户管理列表
export const getUserPage = (params: PageParam) => { export const getUserPageApi = (params: UserPageReqVO) => {
return request.get({ url: '/system/user/page', params }) return request.get({ url: '/system/user/page', params })
} }
// 查询用户详情 // 查询用户详情
export const getUser = (id: number) => { export const getUserApi = (id: number) => {
return request.get({ url: '/system/user/get?id=' + id }) return request.get({ url: '/system/user/get?id=' + id })
} }
// 新增用户 // 新增用户
export const createUser = (data: UserVO) => { export const createUserApi = (data: UserVO) => {
return request.post({ url: '/system/user/create', data }) return request.post({ url: '/system/user/create', data })
} }
// 修改用户 // 修改用户
export const updateUser = (data: UserVO) => { export const updateUserApi = (data: UserVO) => {
return request.put({ url: '/system/user/update', data }) return request.put({ url: '/system/user/update', data })
} }
// 删除用户 // 删除用户
export const deleteUser = (id: number) => { export const deleteUserApi = (id: number) => {
return request.delete({ url: '/system/user/delete?id=' + id }) return request.delete({ url: '/system/user/delete?id=' + id })
} }
// 导出用户 // 导出用户
export const exportUser = (params) => { export const exportUserApi = (params: UserExportReqVO) => {
return request.download({ url: '/system/user/export', params }) return request.download({ url: '/system/user/export', params })
} }
// 下载用户导入模板 // 下载用户导入模板
export const importUserTemplate = () => { export const importUserTemplateApi = () => {
return request.download({ url: '/system/user/get-import-template' }) return request.download({ url: '/system/user/get-import-template' })
} }
// 用户密码重置 // 用户密码重置
export const resetUserPwd = (id: number, password: string) => { export const resetUserPwdApi = (id: number, password: string) => {
const data = { const data = {
id, id,
password password
@ -62,7 +77,7 @@ export const resetUserPwd = (id: number, password: string) => {
} }
// 用户状态修改 // 用户状态修改
export const updateUserStatus = (id: number, status: number) => { export const updateUserStatusApi = (id: number, status: number) => {
const data = { const data = {
id, id,
status status
@ -71,6 +86,6 @@ export const updateUserStatus = (id: number, status: number) => {
} }
// 获取用户精简信息列表 // 获取用户精简信息列表
export const getSimpleUserList = (): Promise<UserVO[]> => { export const getListSimpleUsersApi = () => {
return request.get({ url: '/system/user/list-all-simple' }) return request.get({ url: '/system/user/list-all-simple' })
} }

View File

@ -13,7 +13,7 @@ defineProps({
</script> </script>
<template> <template>
<ElCard :class="[prefixCls, 'mb-15px']" shadow="never"> <ElCard :class="[prefixCls, 'mb-20px']" shadow="never">
<template v-if="title" #header> <template v-if="title" #header>
<div class="flex items-center"> <div class="flex items-center">
<span class="text-16px font-700">{{ title }}</span> <span class="text-16px font-700">{{ title }}</span>

View File

@ -6,10 +6,7 @@ interface shortcutsType {
value: string value: string
} }
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: { type: String, default: '* * * * * ?' },
type: String,
default: '* * * * * ?'
},
shortcuts: { type: Array as PropType<shortcutsType[]>, default: () => [] } shortcuts: { type: Array as PropType<shortcutsType[]>, default: () => [] }
}) })
const defaultValue = ref('') const defaultValue = ref('')

View File

@ -76,7 +76,7 @@ const toggleClick = () => {
v-if="title" v-if="title"
:class="[ :class="[
`${prefixCls}-header`, `${prefixCls}-header`,
'h-50px flex justify-between items-center border-bottom-1 border-solid border-[var(--tags-view-border-color)] px-10px cursor-pointer dark:border-[var(--el-border-color)]' 'h-50px flex justify-between items-center mb-10px border-bottom-1 border-solid border-[var(--tags-view-border-color)] px-10px cursor-pointer dark:border-[var(--el-border-color)]'
]" ]"
@click="toggleClick" @click="toggleClick"
> >

View File

@ -34,7 +34,7 @@ export default defineComponent({
return null return null
} }
// //
if (props.value === undefined || props.value === null) { if (props.value === undefined) {
return null return null
} }
getDictObj(props.type, props.value.toString()) getDictObj(props.type, props.value.toString())

View File

@ -178,7 +178,7 @@ defineExpose({
</script> </script>
<template> <template>
<div class="border-1 border-solid border-[var(--tags-view-border-color)] z-99"> <div class="border-1 border-solid border-[var(--tags-view-border-color)] z-3000">
<!-- 工具栏 --> <!-- 工具栏 -->
<Toolbar <Toolbar
:editor="editorRef" :editor="editorRef"

View File

@ -35,8 +35,7 @@ export default defineComponent({
default: () => [] default: () => []
}, },
// //
// update by true false isCol: propTypes.bool.def(true),
isCol: propTypes.bool.def(false),
// //
model: { model: {
type: Object as PropType<Recordable>, type: Object as PropType<Recordable>,
@ -47,9 +46,7 @@ export default defineComponent({
// //
isCustom: propTypes.bool.def(false), isCustom: propTypes.bool.def(false),
// label // label
labelWidth: propTypes.oneOfType([String, Number]).def('auto'), labelWidth: propTypes.oneOfType([String, Number]).def('auto')
// loading add by
vLoading: propTypes.bool.def(false)
}, },
emits: ['register'], emits: ['register'],
setup(props, { slots, expose, emit }) { setup(props, { slots, expose, emit }) {
@ -283,7 +280,6 @@ export default defineComponent({
{...getFormBindValue()} {...getFormBindValue()}
model={props.isCustom ? props.model : formModel} model={props.isCustom ? props.model : formModel}
class={prefixCls} class={prefixCls}
v-loading={props.vLoading}
> >
{{ {{
// //

View File

@ -5,7 +5,7 @@
class="float-right mt-15px mb-15px" class="float-right mt-15px mb-15px"
:background="true" :background="true"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:page-sizes="[10, 20, 30, 50, 100]" :page-sizes="[10, 20, 30, 50]"
v-model:current-page="currentPage" v-model:current-page="currentPage"
v-model:page-size="pageSize" v-model:page-size="pageSize"
:pager-count="pagerCount" :pager-count="pagerCount"

View File

@ -98,7 +98,6 @@ const setVisible = () => {
</script> </script>
<template> <template>
<!-- update by 芋艿class="-mb-15px" 用于降低和 ContentWrap 组件的底部距离避免空隙过大 -->
<Form <Form
:is-custom="false" :is-custom="false"
:label-width="labelWidth" :label-width="labelWidth"
@ -107,26 +106,21 @@ const setVisible = () => {
:is-col="isCol" :is-col="isCol"
:schema="newSchema" :schema="newSchema"
@register="register" @register="register"
class="-mb-15px"
> >
<template #action> <template #action>
<div v-if="layout === 'inline'"> <div v-if="layout === 'inline'">
<!-- update by 芋艿去除搜索的 type="primary"颜色变淡一点 --> <ElButton v-if="showSearch" type="primary" @click="search">
<ElButton v-if="showSearch" @click="search">
<Icon icon="ep:search" class="mr-5px" /> <Icon icon="ep:search" class="mr-5px" />
{{ t('common.query') }} {{ t('common.query') }}
</ElButton> </ElButton>
<!-- update by 芋艿 icon="ep:refresh-right" 修改成 icon="ep:refresh" ruoyi-vue 搜索保持一致 -->
<ElButton v-if="showReset" @click="reset"> <ElButton v-if="showReset" @click="reset">
<Icon icon="ep:refresh" class="mr-5px" /> <Icon icon="ep:refresh-right" class="mr-5px" />
{{ t('common.reset') }} {{ t('common.reset') }}
</ElButton> </ElButton>
<ElButton v-if="expand" text @click="setVisible"> <ElButton v-if="expand" text @click="setVisible">
{{ t(visible ? 'common.shrink' : 'common.expand') }} {{ t(visible ? 'common.shrink' : 'common.expand') }}
<Icon :icon="visible ? 'ep:arrow-up' : 'ep:arrow-down'" /> <Icon :icon="visible ? 'ep:arrow-up' : 'ep:arrow-down'" />
</ElButton> </ElButton>
<!-- add by 芋艿补充在搜索后的按钮 -->
<slot name="actionMore"></slot>
</div> </div>
</template> </template>
<template #[name] v-for="name in Object.keys($slots)" :key="name" <template #[name] v-for="name in Object.keys($slots)" :key="name"
@ -148,8 +142,6 @@ const setVisible = () => {
{{ t(visible ? 'common.shrink' : 'common.expand') }} {{ t(visible ? 'common.shrink' : 'common.expand') }}
<Icon :icon="visible ? 'ep:arrow-up' : 'ep:arrow-down'" /> <Icon :icon="visible ? 'ep:arrow-up' : 'ep:arrow-down'" />
</ElButton> </ElButton>
<!-- add by 芋艿补充在搜索后的按钮 -->
<slot name="actionMore"></slot>
</div> </div>
</template> </template>
</template> </template>

View File

@ -104,12 +104,11 @@ export default defineComponent({
}) })
const pagination = computed(() => { const pagination = computed(() => {
// update by Pagination
return Object.assign( return Object.assign(
{ {
small: false, small: false,
background: true, background: true,
pagerCount: document.body.clientWidth < 992 ? 5 : 7, pagerCount: 5,
layout: 'total, sizes, prev, pager, next, jumper', layout: 'total, sizes, prev, pager, next, jumper',
pageSizes: [10, 20, 30, 50, 100], pageSizes: [10, 20, 30, 50, 100],
disabled: false, disabled: false,
@ -284,11 +283,10 @@ export default defineComponent({
}} }}
</ElTable> </ElTable>
{unref(getProps).pagination ? ( {unref(getProps).pagination ? (
// update by Pagination
<ElPagination <ElPagination
v-model:pageSize={pageSizeRef.value} v-model:pageSize={pageSizeRef.value}
v-model:currentPage={currentPageRef.value} v-model:currentPage={currentPageRef.value}
class="float-right mt-15px mb-15px" class="mt-10px"
{...unref(pagination)} {...unref(pagination)}
></ElPagination> ></ElPagination>
) : undefined} ) : undefined}

View File

@ -0,0 +1,50 @@
import { service } from './service'
import { config } from './config'
const { default_headers } = config
const request = (option: any) => {
const { url, method, params, data, headersType, responseType } = option
return service({
url: url,
method,
params,
data,
responseType: responseType,
headers: {
'Content-Type': headersType || default_headers
}
})
}
export default {
get: async <T = any>(option: any) => {
const res = await request({ method: 'GET', ...option })
return res as unknown as T
},
post: async <T = any>(option: any) => {
const res = await request({ method: 'POST', ...option })
return res as unknown as T
},
delete: async <T = any>(option: any) => {
const res = await request({ method: 'DELETE', ...option })
return res as unknown as T
},
put: async <T = any>(option: any) => {
const res = await request({ method: 'PUT', ...option })
return res as unknown as T
},
patch: async <T = any>(option: any) => {
const res = await request({ method: 'PATCH', ...option })
return res as unknown as T
},
download: async <T = any>(option: any) => {
const res = await request({ method: 'GET', responseType: 'blob', ...option })
return res as unknown as Promise<T>
},
upload: async <T = any>(option: any) => {
option.headersType = 'multipart/form-data'
const res = await request({ method: 'POST', ...option })
return res as unknown as Promise<T>
}
}

View File

@ -8,7 +8,6 @@ import { FormSchema } from '@/types/form'
import { TableColumn } from '@/types/table' import { TableColumn } from '@/types/table'
import { DescriptionsSchema } from '@/types/descriptions' import { DescriptionsSchema } from '@/types/descriptions'
import { ComponentOptions, ComponentProps } from '@/types/components' import { ComponentOptions, ComponentProps } from '@/types/components'
import { DictTag } from '@/components/DictTag'
export type CrudSchema = Omit<TableColumn, 'children'> & { export type CrudSchema = Omit<TableColumn, 'children'> & {
isSearch?: boolean // 是否在查询显示 isSearch?: boolean // 是否在查询显示
@ -152,15 +151,6 @@ const filterTableSchema = (crudSchema: CrudSchema[]): TableColumn[] => {
const tableColumns = treeMap<CrudSchema>(crudSchema, { const tableColumns = treeMap<CrudSchema>(crudSchema, {
conversion: (schema: CrudSchema) => { conversion: (schema: CrudSchema) => {
if (schema?.isTable !== false && schema?.table?.show !== false) { if (schema?.isTable !== false && schema?.table?.show !== false) {
// add by 芋艿:增加对 dict 字典数据的支持
if (!schema.formatter && schema.dictType) {
schema.formatter = (_: Recordable, __: TableColumn, cellValue: any) => {
return h(DictTag, {
type: schema.dictType!, // ! 表示一定不为空
value: cellValue
})
}
}
return { return {
...schema.table, ...schema.table,
...schema ...schema

View File

@ -218,8 +218,6 @@ export const useTable = <T = any>(config?: UseTableConfig<T>) => {
register, register,
elTableRef, elTableRef,
tableObject, tableObject,
methods, methods
// add by 芋艿:返回 tableMethods 属性,和 tableObject 更统一
tableMethods: methods
} }
} }

View File

@ -37,7 +37,7 @@ export default defineComponent({
}) })
const getBreadcrumb = () => { const getBreadcrumb = () => {
const currentPath = currentRoute.value.matched.slice(-1)[0].path const currentPath = currentRoute.value.path
levelList.value = filter<AppRouteRecordRaw>(unref(menuRouters), (node: AppRouteRecordRaw) => { levelList.value = filter<AppRouteRecordRaw>(unref(menuRouters), (node: AppRouteRecordRaw) => {
return node.path === currentPath return node.path === currentPath
@ -47,7 +47,7 @@ export default defineComponent({
const renderBreadcrumb = () => { const renderBreadcrumb = () => {
const breadcrumbList = treeToList<AppRouteRecordRaw[]>(unref(levelList)) const breadcrumbList = treeToList<AppRouteRecordRaw[]>(unref(levelList))
return breadcrumbList.map((v) => { return breadcrumbList.map((v) => {
const disabled = !v.redirect || v.redirect === 'noredirect' const disabled = v.redirect === 'noredirect'
const meta = v.meta as RouteMeta const meta = v.meta as RouteMeta
return ( return (
<ElBreadcrumbItem to={{ path: disabled ? '' : v.path }} key={v.name}> <ElBreadcrumbItem to={{ path: disabled ? '' : v.path }} key={v.name}>

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { parseTime } from '@/utils/formatTime' import dayjs from 'dayjs'
import * as NotifyMessageApi from '@/api/system/notify/message' import * as NotifyMessageApi from '@/api/system/notify/message'
const { push } = useRouter() const { push } = useRouter()
@ -57,7 +57,7 @@ onMounted(() => {
{{ item.templateNickname }}{{ item.templateContent }} {{ item.templateNickname }}{{ item.templateContent }}
</span> </span>
<span class="message-date"> <span class="message-date">
{{ parseTime(item.createTime) }} {{ dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') }}
</span> </span>
</div> </div>
</div> </div>

View File

@ -297,8 +297,7 @@ export default {
typeCreate: 'Dict Type Create', typeCreate: 'Dict Type Create',
typeUpdate: 'Dict Type Eidt', typeUpdate: 'Dict Type Eidt',
dataCreate: 'Dict Data Create', dataCreate: 'Dict Data Create',
dataUpdate: 'Dict Data Eidt', dataUpdate: 'Dict Data Eidt'
fileUpload: 'File Upload'
}, },
dialog: { dialog: {
dialog: 'Dialog', dialog: 'Dialog',

View File

@ -297,8 +297,7 @@ export default {
typeCreate: '字典类型新增', typeCreate: '字典类型新增',
typeUpdate: '字典类型编辑', typeUpdate: '字典类型编辑',
dataCreate: '字典数据新增', dataCreate: '字典数据新增',
dataUpdate: '字典数据编辑', dataUpdate: '字典数据编辑'
fileUpload: '上传文件'
}, },
dialog: { dialog: {
dialog: '弹窗', dialog: '弹窗',

View File

@ -104,31 +104,6 @@ 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,
@ -162,7 +137,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
children: [ children: [
{ {
path: 'job-log', path: 'job-log',
component: () => import('@/views/infra/job/logger/index.vue'), component: () => import('@/views/infra/job/JobLog.vue'),
name: 'JobLog', name: 'JobLog',
meta: { meta: {
noCache: true, noCache: true,
@ -225,26 +200,26 @@ const remainingRouter: AppRouteRecordRaw[] = [
children: [ children: [
{ {
path: '/manager/form/edit', path: '/manager/form/edit',
component: () => import('@/views/bpm/form/editor/index.vue'), component: () => import('@/views/bpm/form/formEditor.vue'),
name: 'bpmFormEditor', name: 'bpmFormEditor',
meta: { meta: {
noCache: true, noCache: true,
hidden: true, hidden: true,
canTo: true, canTo: true,
title: '设计流程表单', title: '设计流程表单',
activeMenu: '/bpm/manager/form' activeMenu: 'bpm/manager/form/formEditor'
} }
}, },
{ {
path: '/manager/model/edit', path: '/manager/model/edit',
component: () => import('@/views/bpm/model/editor/index.vue'), component: () => import('@/views/bpm/model/modelEditor.vue'),
name: 'modelEditor', name: 'modelEditor',
meta: { meta: {
noCache: true, noCache: true,
hidden: true, hidden: true,
canTo: true, canTo: true,
title: '设计流程', title: '设计流程',
activeMenu: '/bpm/manager/model' activeMenu: 'bpm/manager/model/design'
} }
}, },
{ {
@ -256,7 +231,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
hidden: true, hidden: true,
canTo: true, canTo: true,
title: '流程定义', title: '流程定义',
activeMenu: '/bpm/manager/model' activeMenu: 'bpm/definition/index'
} }
}, },
{ {
@ -272,7 +247,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
}, },
{ {
path: '/process-instance/create', path: '/process-instance/create',
component: () => import('@/views/bpm/processInstance/create/index.vue'), component: () => import('@/views/bpm/processInstance/create.vue'),
name: 'BpmProcessInstanceCreate', name: 'BpmProcessInstanceCreate',
meta: { meta: {
noCache: true, noCache: true,
@ -284,7 +259,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
}, },
{ {
path: '/process-instance/detail', path: '/process-instance/detail',
component: () => import('@/views/bpm/processInstance/detail/index.vue'), component: () => import('@/views/bpm/processInstance/detail.vue'),
name: 'BpmProcessInstanceDetail', name: 'BpmProcessInstanceDetail',
meta: { meta: {
noCache: true, noCache: true,
@ -319,22 +294,6 @@ const remainingRouter: AppRouteRecordRaw[] = [
} }
} }
] ]
},
{
path: '/property',
component: Layout,
name: 'property',
meta: {
hidden: true
},
children: [
{
path: 'value/:propertyId(\\d+)',
component: () => import('@/views/mall/product/property/value/index.vue'),
name: 'PropertyValue',
meta: { title: '商品属性值', icon: '', activeMenu: '/product/property' }
}
]
} }
] ]

View File

@ -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 { listSimpleDictData } from '@/api/system/dict/dict.data' import { listSimpleDictDataApi } 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 listSimpleDictData() const res = await listSimpleDictDataApi()
// 设置数据 // 设置数据
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 listSimpleDictData() const res = await listSimpleDictDataApi()
// 设置数据 // 设置数据
const dictDataMap = new Map<string, any>() const dictDataMap = new Map<string, any>()
res.forEach((dictData: DictDataVO) => { res.forEach((dictData: DictDataVO) => {

View File

@ -24,6 +24,7 @@ declare module '@vue/runtime-core' {
Echart: typeof import('./../components/Echart/src/Echart.vue')['default'] Echart: typeof import('./../components/Echart/src/Echart.vue')['default']
Editor: typeof import('./../components/Editor/src/Editor.vue')['default'] Editor: typeof import('./../components/Editor/src/Editor.vue')['default']
ElAutoResizer: typeof import('element-plus/es')['ElAutoResizer'] ElAutoResizer: typeof import('element-plus/es')['ElAutoResizer']
ElAvatar: typeof import('element-plus/es')['ElAvatar']
ElBadge: typeof import('element-plus/es')['ElBadge'] ElBadge: typeof import('element-plus/es')['ElBadge']
ElButton: typeof import('element-plus/es')['ElButton'] ElButton: typeof import('element-plus/es')['ElButton']
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup'] ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
@ -68,10 +69,10 @@ declare module '@vue/runtime-core' {
ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect'] ElSelect: typeof import('element-plus/es')['ElSelect']
ElSkeleton: typeof import('element-plus/es')['ElSkeleton'] ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
ElSpace: typeof import('element-plus/es')['ElSpace']
ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable'] ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTableV2: typeof import('element-plus/es')['ElTableV2']
ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs'] ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag'] ElTag: typeof import('element-plus/es')['ElTag']

View File

@ -52,7 +52,6 @@ declare global {
const triggerRef: typeof import('vue')['triggerRef'] const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref'] const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs'] const useAttrs: typeof import('vue')['useAttrs']
const useCrudSchemas: typeof import('@/hooks/web/useCrudSchemas')['useCrudSchemas']
const useCssModule: typeof import('vue')['useCssModule'] const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars'] const useCssVars: typeof import('vue')['useCssVars']
const useI18n: typeof import('@/hooks/web/useI18n')['useI18n'] const useI18n: typeof import('@/hooks/web/useI18n')['useI18n']
@ -61,7 +60,6 @@ declare global {
const useRoute: typeof import('vue-router')['useRoute'] const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter'] const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots'] const useSlots: typeof import('vue')['useSlots']
const useTable: typeof import('@/hooks/web/useTable')['useTable']
const useVxeCrudSchemas: typeof import('@/hooks/web/useVxeCrudSchemas')['useVxeCrudSchemas'] const useVxeCrudSchemas: typeof import('@/hooks/web/useVxeCrudSchemas')['useVxeCrudSchemas']
const useXTable: typeof import('@/hooks/web/useXTable')['useXTable'] const useXTable: typeof import('@/hooks/web/useXTable')['useXTable']
const watch: typeof import('vue')['watch'] const watch: typeof import('vue')['watch']

View File

@ -8,6 +8,6 @@ export interface DescriptionsSchema {
labelAlign?: 'left' | 'center' | 'right' labelAlign?: 'left' | 'center' | 'right'
className?: string className?: string
labelClassName?: string labelClassName?: string
dateFormat?: string // add by 星语:支持时间的格式化 dateFormat?: string
dictType?: string // add by 星语:支持 dict 字典数据 dictType?: string
} }

View File

@ -70,23 +70,6 @@ export const getDictObj = (dictType: string, value: any) => {
}) })
} }
/**
*
*
* @param dictType
* @param value
*/
export const getDictLabel = (dictType: string, value: any) => {
const dictOptions: DictDataType[] = getDictOptions(dictType)
const dictLabel = ref('')
dictOptions.forEach((dict: DictDataType) => {
if (dict.value === value) {
dictLabel.value = dict.label
}
})
return dictLabel.value
}
export enum DICT_TYPE { export enum DICT_TYPE {
USER_TYPE = 'user_type', USER_TYPE = 'user_type',
COMMON_STATUS = 'common_status', COMMON_STATUS = 'common_status',
@ -140,9 +123,5 @@ export enum DICT_TYPE {
PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态 PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态
PAY_ORDER_REFUND_STATUS = 'pay_order_refund_status', // 商户支付订单退款状态 PAY_ORDER_REFUND_STATUS = 'pay_order_refund_status', // 商户支付订单退款状态
PAY_REFUND_ORDER_STATUS = 'pay_refund_order_status', // 退款订单状态 PAY_REFUND_ORDER_STATUS = 'pay_refund_order_status', // 退款订单状态
PAY_REFUND_ORDER_TYPE = 'pay_refund_order_type', // 退款订单类别 PAY_REFUND_ORDER_TYPE = 'pay_refund_order_type' // 退款订单类别
// ========== MP 模块 ==========
MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型
MP_MESSAGE_TYPE = 'mp_message_type' // 消息类型
} }

View File

@ -11,63 +11,58 @@ import dayjs from 'dayjs'
* @description format + + "YYYY-mm-dd HH:MM:SS WWW QQQQ ZZZ" * @description format + + "YYYY-mm-dd HH:MM:SS WWW QQQQ ZZZ"
* @returns * @returns
*/ */
export function formatDate(date: Date, format?: string): string { export function formatDate(date: Date, format: string): string {
// 日期不存在,则返回空 const we = date.getDay() // 星期
if (!date) { const z = getWeek(date) // 周
return '' const qut = Math.floor((date.getMonth() + 3) / 3).toString() // 季度
const opt: { [key: string]: string } = {
'Y+': date.getFullYear().toString(), // 年
'm+': (date.getMonth() + 1).toString(), // 月(月份从0开始要+1)
'd+': date.getDate().toString(), // 日
'H+': date.getHours().toString(), // 时
'M+': date.getMinutes().toString(), // 分
'S+': date.getSeconds().toString(), // 秒
'q+': qut // 季度
} }
// 日期存在,则进行格式化 // 中文数字 (星期)
if (format === undefined) { const week: { [key: string]: string } = {
format = 'YYYY-MM-DD HH:mm:ss' '0': '日',
'1': '一',
'2': '二',
'3': '三',
'4': '四',
'5': '五',
'6': '六'
} }
return dayjs(date).format(format) // 中文数字(季度)
} const quarter: { [key: string]: string } = {
'1': '一',
// TODO 芋艿:稍后去掉 '2': '二',
// 日期格式化 '3': '三',
export function parseTime(time: any, pattern?: string) { '4': '四'
if (arguments.length === 0 || !time) {
return null
} }
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' if (/(W+)/.test(format))
let date format = format.replace(
if (typeof time === 'object') { RegExp.$1,
date = time RegExp.$1.length > 1 ? (RegExp.$1.length > 2 ? '星期' + week[we] : '周' + week[we]) : week[we]
} else { )
if (typeof time === 'string' && /^[0-9]+$/.test(time)) { if (/(Q+)/.test(format))
time = parseInt(time) format = format.replace(
} else if (typeof time === 'string') { RegExp.$1,
time = time RegExp.$1.length == 4 ? '第' + quarter[qut] + '季度' : quarter[qut]
.replace(new RegExp(/-/gm), '/') )
.replace('T', ' ') if (/(Z+)/.test(format))
.replace(new RegExp(/\.\d{3}/gm), '') format = format.replace(RegExp.$1, RegExp.$1.length == 3 ? '第' + z + '周' : z + '')
} for (const k in opt) {
if (typeof time === 'number' && time.toString().length === 10) { const r = new RegExp('(' + k + ')').exec(format)
time = time * 1000 // 若输入的长度不为1则前面补零
} if (r)
date = new Date(time) format = format.replace(
r[1],
RegExp.$1.length == 1 ? opt[k] : opt[k].padStart(RegExp.$1.length, '0')
)
} }
const formatObj = { return format
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
} }
/** /**
@ -194,56 +189,5 @@ export const dateFormatter = (row, column, cellValue) => {
if (!cellValue) { if (!cellValue) {
return return
} }
return formatDate(cellValue) return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss')
}
/**
* 00:00:00
* @param param
* @returns 00:00:00
*/
export function beginOfDay(param: Date) {
return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 0, 0, 0, 0)
}
/**
* 23:59:59
* @param param
* @returns 23:59:59
*/
export function endOfDay(param: Date) {
return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 23, 59, 59, 999)
}
/**
*
* @param param1 1
* @param param2 2
*/
export function betweenDay(param1: Date, param2: Date) {
param1 = convertDate(param1)
param2 = convertDate(param2)
// 计算差值
return Math.floor((param2.getTime() - param1.getTime()) / (24 * 3600 * 1000))
}
/**
*
* @param param1
* @param param2
*/
export function addTime(param1: Date, param2: number) {
param1 = convertDate(param1)
return new Date(param1.getTime() + param2)
}
/**
*
* @param param
*/
export function convertDate(param: Date | string) {
if (typeof param === 'string') {
return new Date(param)
}
return param
} }

View File

@ -137,21 +137,3 @@ export const generateUUID = () => {
return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16) return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
}) })
} }
/**
* element plus Formatter
*
* @param row
* @param column
* @param cellValue
*/
// @ts-ignore
export const fileSizeFormatter = (row, column, cellValue) => {
const fileSize = cellValue
const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
const srcSize = parseFloat(fileSize)
const index = Math.floor(Math.log(srcSize) / Math.log(1024))
const size = srcSize / Math.pow(1024, index)
const sizeStr = size.toFixed(2) //保留的小数位数
return sizeStr + ' ' + unitArr[index]
}

View File

@ -276,7 +276,7 @@ export const handleTree = (data: any[], id?: string, parentId?: string, children
export const handleTree2 = (data, id, parentId, children, rootId) => { export const handleTree2 = (data, id, parentId, children, rootId) => {
id = id || 'id' id = id || 'id'
parentId = parentId || 'parentId' parentId = parentId || 'parentId'
// children = children || 'children' children = children || 'children'
rootId = rootId =
rootId || rootId ||
Math.min( Math.min(
@ -285,16 +285,16 @@ export const handleTree2 = (data, id, parentId, children, rootId) => {
}) })
) || ) ||
0 0
// 对源数据深度克隆 //对源数据深度克隆
const cloneData = JSON.parse(JSON.stringify(data)) const cloneData = JSON.parse(JSON.stringify(data))
// 循环所有项 //循环所有项
const treeData = cloneData.filter((father) => { const treeData = cloneData.filter((father) => {
const branchArr = cloneData.filter((child) => { const branchArr = cloneData.filter((child) => {
// 返回每一项的子级数组 //返回每一项的子级数组
return father[id] === child[parentId] return father[id] === child[parentId]
}) })
branchArr.length > 0 ? (father.children = branchArr) : '' branchArr.length > 0 ? (father.children = branchArr) : ''
// 返回第一层 //返回第一层
return father[parentId] === rootId return father[parentId] === rootId
}) })
return treeData !== '' ? treeData : data return treeData !== '' ? treeData : data

View File

@ -34,13 +34,13 @@
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
<Icon icon="ep:calendar" class="mr-5px" />{{ t('profile.user.createTime') }} <Icon icon="ep:calendar" class="mr-5px" />{{ t('profile.user.createTime') }}
<div class="pull-right">{{ parseTime(userInfo?.createTime) }}</div> <div class="pull-right">{{ dayjs(userInfo?.createTime).format('YYYY-MM-DD') }}</div>
</li> </li>
</ul> </ul>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { parseTime } from '@/utils/formatTime' import dayjs from 'dayjs'
import UserAvatar from './UserAvatar.vue' import UserAvatar from './UserAvatar.vue'
import { getUserProfileApi, ProfileVO } from '@/api/system/user/profile' import { getUserProfileApi, ProfileVO } from '@/api/system/user/profile'

View File

@ -0,0 +1,79 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
// CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: null,
action: true,
columns: [
{
title: '定义编号',
field: 'id',
table: {
width: 360
}
},
{
title: '定义名称',
field: 'name',
table: {
// width: 120,
slots: {
default: 'name_default'
}
}
},
{
title: '定义分类',
field: 'category',
// dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
// dictClass: 'number',
table: {
// width: 120,
slots: {
default: 'category_default'
}
}
},
{
title: '表单信息',
field: 'formId',
table: {
// width: 200,
slots: {
default: 'formId_default'
}
}
},
{
title: '流程版本',
field: 'version',
table: {
// width: 80,
slots: {
default: 'version_default'
}
}
},
{
title: '激活状态',
field: 'suspensionState',
table: {
// width: 80,
slots: {
default: 'suspensionState_default'
}
}
},
{
title: '部署时间',
field: 'deploymentTime',
isForm: false,
formatter: 'formatDate'
// table: {
// width: 180
// }
}
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -1,138 +1,92 @@
<template> <template>
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <!-- 列表 -->
<el-table-column label="定义编号" align="center" prop="id" width="400" /> <XTable @register="registerTable">
<el-table-column label="流程名称" align="center" prop="name" width="200"> <!-- 流程名称 -->
<template #default="scope"> <template #name_default="{ row }">
<el-button type="text" @click="handleBpmnDetail(scope.row)"> <XTextButton :title="row.name" @click="handleBpmnDetail(row.id)" />
<span>{{ scope.row.name }}</span> </template>
</el-button> <!-- 流程分类 -->
</template> <template #category_default="{ row }">
</el-table-column> <DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
<el-table-column label="定义分类" align="center" prop="category" width="100"> </template>
<template #default="scope"> <!-- 表单信息 -->
<dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" /> <template #formId_default="{ row }">
</template> <XTextButton
</el-table-column> v-if="row.formType === 10"
<el-table-column label="表单信息" align="center" prop="formType" width="200"> :title="row.formName"
<template #default="scope"> @click="handleFormDetail(row)"
<el-button />
v-if="scope.row.formType === 10" <XTextButton v-else :title="row.formCustomCreatePath" @click="handleFormDetail(row)" />
type="text" </template>
@click="handleFormDetail(scope.row)" <!-- 流程版本 -->
> <template #version_default="{ row }">
<span>{{ scope.row.formName }}</span> <el-tag>v{{ row.version }}</el-tag>
</el-button> </template>
<el-button v-else type="text" @click="handleFormDetail(scope.row)"> <!-- 激活状态 -->
<span>{{ scope.row.formCustomCreatePath }}</span> <template #suspensionState_default="{ row }">
</el-button> <el-tag type="success" v-if="row.suspensionState === 1"></el-tag>
</template> <el-tag type="warning" v-if="row.suspensionState === 2"></el-tag>
</el-table-column> </template>
<el-table-column label="流程版本" align="center" prop="processDefinition.version" width="80"> <!-- 操作 -->
<template #default="scope"> <template #actionbtns_default="{ row }">
<el-tag v-if="scope.row">v{{ scope.row.version }}</el-tag> <XTextButton
<el-tag type="warning" v-else></el-tag> preIcon="ep:user"
</template> title="分配规则"
</el-table-column> v-hasPermi="['bpm:task-assign-rule:query']"
<el-table-column label="状态" align="center" prop="version" width="80"> @click="handleAssignRule(row)"
<template #default="scope"> />
<el-tag type="success" v-if="scope.row.suspensionState === 1"></el-tag> </template>
<el-tag type="warning" v-if="scope.row.suspensionState === 2"></el-tag> </XTable>
</template>
</el-table-column> <!-- 表单详情的弹窗 -->
<el-table-column <XModal v-model="formDetailVisible" width="800" title="表单详情" :show-footer="false">
label="部署时间" <form-create
align="center" :rule="formDetailPreview.rule"
prop="deploymentTime" :option="formDetailPreview.option"
width="180" v-if="formDetailVisible"
:formatter="dateFormatter"
/> />
<el-table-column </XModal>
label="定义描述" <!-- 流程模型图的预览 -->
align="center" <XModal title="流程图" v-model="showBpmnOpen" width="80%" height="90%">
prop="description" <my-process-viewer
width="300" key="designer"
show-overflow-tooltip v-model="bpmnXML"
:value="bpmnXML"
v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
/> />
<el-table-column label="操作" align="center" width="150" fixed="right"> </XModal>
<template #default="scope">
<el-button
link
type="primary"
@click="handleAssignRule(scope.row)"
v-hasPermi="['bpm:task-assign-rule:query']"
>
分配规则
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap> </ContentWrap>
<!-- 弹窗表单详情 -->
<Dialog title="表单详情" v-model="formDetailVisible" width="800">
<form-create :rule="formDetailPreview.rule" :option="formDetailPreview.option" />
</Dialog>
<!-- 弹窗流程模型图的预览 -->
<Dialog title="流程图" v-model="bpmnDetailVisible" width="800">
<my-process-viewer
key="designer"
v-model="bpmnXML"
:value="bpmnXML"
v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
/>
</Dialog>
</template> </template>
<script setup lang="ts">
<script setup lang="ts" name="Form"> // import
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import * as DefinitionApi from '@/api/bpm/definition' import * as DefinitionApi from '@/api/bpm/definition'
// import * as ModelApi from '@/api/bpm/model'
import { allSchemas } from './definition.data'
import { setConfAndFields2 } from '@/utils/formCreate' import { setConfAndFields2 } from '@/utils/formCreate'
const { push } = useRouter() // import { DICT_TYPE } from '@/utils/dict'
const bpmnXML = ref(null)
const showBpmnOpen = ref(false)
const bpmnControlForm = ref({
prefix: 'flowable'
})
// const message = useMessage() //
const router = useRouter() //
const { query } = useRoute() // const { query } = useRoute() //
const loading = ref(true) // // ========== ==========
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1,
pageSize: 10,
key: query.key key: query.key
}) })
const [registerTable] = useXTable({
allSchemas: allSchemas,
getListApi: DefinitionApi.getProcessDefinitionPageApi,
params: queryParams
})
/** 查询列表 */ //
const getList = async () => {
loading.value = true
try {
const data = await DefinitionApi.getProcessDefinitionPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 点击任务分配按钮 */
const handleAssignRule = (row) => {
push({
name: 'BpmTaskAssignRuleList',
query: {
modelId: row.id
}
})
}
/** 流程表单的详情按钮操作 */
const formDetailVisible = ref(false) const formDetailVisible = ref(false)
const formDetailPreview = ref({ const formDetailPreview = ref({
rule: [], rule: [],
@ -145,25 +99,32 @@ const handleFormDetail = async (row) => {
// //
formDetailVisible.value = true formDetailVisible.value = true
} else { } else {
await push({ await router.push({
path: row.formCustomCreatePath path: row.formCustomCreatePath
}) })
} }
} }
/** 流程图的详情按钮操作 */ //
const bpmnDetailVisible = ref(false) const handleBpmnDetail = (row) => {
const bpmnXML = ref(null) // TODO
const bpmnControlForm = ref({ console.log(row)
prefix: 'flowable' DefinitionApi.getProcessDefinitionBpmnXMLApi(row).then((response) => {
}) console.log(response, 'response')
const handleBpmnDetail = async (row) => { bpmnXML.value = response
bpmnXML.value = await DefinitionApi.getProcessDefinitionBpmnXML(row.id) //
bpmnDetailVisible.value = true showBpmnOpen.value = true
})
// message.success(' 2 ')
} }
/** 初始化 **/ //
onMounted(() => { const handleAssignRule = (row) => {
getList() router.push({
}) name: 'BpmTaskAssignRuleList',
query: {
processDefinitionId: row.id
}
})
}
</script> </script>

View File

@ -0,0 +1,43 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
const { t } = useI18n() // 国际化
// 表单校验
export const rules = reactive({
name: [required]
})
// CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'id',
primaryTitle: '表单编号',
action: true,
columns: [
{
title: '表单名',
field: 'name',
isSearch: true
},
{
title: t('common.status'),
field: 'status',
dictType: DICT_TYPE.COMMON_STATUS,
dictClass: 'number'
},
{
title: '备注',
field: 'remark'
},
{
title: t('common.createTime'),
field: 'createTime',
formatter: 'formatDate',
isForm: false,
table: {
width: 180
}
}
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -0,0 +1,168 @@
<template>
<ContentWrap>
<!-- 表单设计器 -->
<fc-designer ref="designer" height="780px">
<template #handle>
<XButton type="primary" title="生成JSON" @click="showJson" />
<XButton type="primary" title="生成Options" @click="showOption" />
<XButton type="primary" :title="t('action.save')" @click="handleSave" />
</template>
</fc-designer>
<Dialog :title="dialogTitle" v-model="dialogVisible1" maxHeight="600">
<div ref="editor" v-if="dialogVisible1">
<XTextButton style="float: right" :title="t('common.copy')" @click="copy(formValue)" />
<el-scrollbar height="580">
<div v-highlight>
<code class="hljs">
{{ formValue }}
</code>
</div>
</el-scrollbar>
</div>
</Dialog>
<!-- 表单保存的弹窗 -->
<XModal v-model="dialogVisible" title="保存表单">
<el-form ref="formRef" :model="formValues" :rules="formRules" label-width="80px">
<el-form-item label="表单名" prop="name">
<el-input v-model="formValues.name" placeholder="请输入表单名" />
</el-form-item>
<el-form-item label="开启状态" prop="status">
<el-radio-group v-model="formValues.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="remark">
<el-input v-model="formValues.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-form>
<!-- 操作按钮 -->
<template #footer>
<!-- 按钮保存 -->
<XButton
type="primary"
:title="t('action.save')"
:loading="dialogLoading"
@click="submitForm"
/>
<!-- 按钮关闭 -->
<XButton :title="t('dialog.close')" @click="dialogVisible = false" />
</template>
</XModal>
</ContentWrap>
</template>
<script setup lang="ts" name="BpmFormEditor">
import { FormInstance } from 'element-plus'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { CommonStatusEnum } from '@/utils/constants'
import * as FormApi from '@/api/bpm/form'
import { encodeConf, encodeFields, setConfAndFields } from '@/utils/formCreate'
import { useClipboard } from '@vueuse/core'
const { t } = useI18n() //
const message = useMessage() //
const { query } = useRoute() //
const designer = ref() //
const type = ref(-1)
const formValue = ref('')
const dialogTitle = ref('')
const dialogVisible = ref(false) //
const dialogVisible1 = ref(false) //
const dialogLoading = ref(false) //
const formRef = ref<FormInstance>()
const formRules = reactive({
name: [{ required: true, message: '表单名不能为空', trigger: 'blur' }],
status: [{ required: true, message: '开启状态不能为空', trigger: 'blur' }]
})
const formValues = ref({
name: '',
status: CommonStatusEnum.ENABLE,
remark: ''
})
//
const handleSave = () => {
dialogVisible.value = true
}
//
const submitForm = async () => {
//
const elForm = unref(formRef)
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
//
dialogLoading.value = true
try {
const data = formValues.value as FormApi.FormVO
data.conf = encodeConf(designer) //
data.fields = encodeFields(designer) //
if (!data.id) {
await FormApi.createFormApi(data)
message.success(t('common.createSuccess'))
} else {
await FormApi.updateFormApi(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
} finally {
dialogLoading.value = false
}
}
const showJson = () => {
openModel('生成JSON')
type.value = 0
formValue.value = designer.value.getRule()
}
const showOption = () => {
openModel('生成Options')
type.value = 1
formValue.value = designer.value.getOption()
}
const openModel = (title: string) => {
dialogVisible1.value = true
dialogTitle.value = title
}
/** 复制 **/
const copy = async (text: string) => {
// const { copy, copied, isSupported } = useClipboard({ source: JSON.stringify(text) })
// if (!isSupported.value) {
// message.error(t('common.copyError'))
// } else {
// await copy()
// if (unref(copied.value)) {
// message.success(t('common.copySuccess'))
// }
// }
let url = JSON.stringify(text)
let oInput = document.createElement('textarea')
oInput.value = url
document.body.appendChild(oInput)
oInput.select() // ;
// console.log(oInput.value)
document.execCommand('Copy') //
message.success(t('common.copySuccess'))
oInput.remove()
}
// ========== ==========
onMounted(() => {
//
const id = query.id as unknown as number
if (!id) {
return
}
//
FormApi.getFormApi(id).then((data) => {
formValues.value = data
setConfAndFields(designer, data.conf, data.fields)
})
})
</script>

View File

@ -1,171 +1,93 @@
<template> <template>
<content-wrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 列表 -->
<el-form <XTable @register="registerTable">
class="-mb-15px" <!-- 操作新增 -->
:model="queryParams" <template #toolbar_buttons>
ref="queryFormRef" <XButton
:inline="true" type="primary"
label-width="68px" preIcon="ep:zoom-in"
> :title="t('action.add')"
<el-form-item label="表单名" prop="name"> v-hasPermi="['system:post:create']"
<el-input @click="handleCreate()"
v-model="queryParams.name"
placeholder="请输入表单名"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/> />
</el-form-item> </template>
<el-form-item> <template #actionbtns_default="{ row }">
<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> <XTextButton
<el-button type="primary" @click="openForm()" v-hasPermi="['bpm:form:create']"> preIcon="ep:edit"
<Icon icon="ep:plus" class="mr-5px" /> 新增 :title="t('action.edit')"
</el-button> v-hasPermi="['bpm:form:update']"
</el-form-item> @click="handleUpdate(row.id)"
</el-form> />
</content-wrap> <!-- 操作详情 -->
<XTextButton
<!-- 列表 --> preIcon="ep:view"
<content-wrap> :title="t('action.detail')"
<el-table v-loading="loading" :data="list"> v-hasPermi="['bpm:form:query']"
<el-table-column label="编号" align="center" prop="id" /> @click="handleDetail(row.id)"
<el-table-column label="表单名" align="center" prop="name" /> />
<el-table-column label="状态" align="center" prop="status"> <!-- 操作删除 -->
<template #default="scope"> <XTextButton
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" /> preIcon="ep:delete"
</template> :title="t('action.del')"
</el-table-column> v-hasPermi="['bpm:form:delete']"
<el-table-column label="备注" align="center" prop="remark" /> @click="deleteData(row.id)"
<el-table-column />
label="创建时间" </template>
align="center" </XTable>
prop="createTime" <!-- 表单详情的弹窗 -->
:formatter="dateFormatter" <XModal v-model="detailOpen" width="800" title="表单详情">
/> <form-create :rule="detailPreview.rule" :option="detailPreview.option" v-if="detailOpen" />
<el-table-column label="操作" align="center"> </XModal>
<template #default="scope"> </ContentWrap>
<el-button
link
type="primary"
@click="openForm(scope.row.id)"
v-hasPermi="['bpm:form:update']"
>
编辑
</el-button>
<el-button link @click="openDetail(scope.row.id)" v-hasPermi="['bpm:form:query']">
详情
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['bpm:form: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>
<!-- 表单详情的弹窗 -->
<Dialog title="表单详情" v-model="detailVisible" width="800">
<form-create :rule="detailData.rule" :option="detailData.option" />
</Dialog>
</template> </template>
<script setup lang="ts" name="Form"> <script setup lang="ts" name="BpmForm">
import { DICT_TYPE } from '@/utils/dict' // import
import { dateFormatter } from '@/utils/formatTime'
import * as FormApi from '@/api/bpm/form' import * as FormApi from '@/api/bpm/form'
import { allSchemas } from './form.data'
// import
import { setConfAndFields2 } from '@/utils/formCreate' import { setConfAndFields2 } from '@/utils/formCreate'
const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const { push } = useRouter() // const { push } = useRouter() //
const loading = ref(true) // //
const total = ref(0) // const [registerTable, { deleteData }] = useXTable({
const list = ref([]) // allSchemas: allSchemas,
const queryParams = reactive({ getListApi: FormApi.getFormPageApi,
pageNo: 1, deleteApi: FormApi.deleteFormApi
pageSize: 10,
name: null
}) })
const queryFormRef = ref() //
/** 查询列表 */ //
const getList = async () => { const handleCreate = () => {
loading.value = true
try {
const data = await FormApi.getFormPage(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 openForm = (id?: number) => {
push({ push({
name: 'bpmFormEditor'
})
}
//
const handleUpdate = async (rowId: number) => {
await push({
name: 'bpmFormEditor', name: 'bpmFormEditor',
query: { query: {
id id: rowId
} }
}) })
} }
/** 删除按钮操作 */ //
const handleDelete = async (id: number) => { const detailOpen = ref(false)
try { const detailPreview = ref({
//
await message.delConfirm()
//
await FormApi.deleteForm(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 详情操作 */
const detailVisible = ref(false)
const detailData = ref({
rule: [], rule: [],
option: {} option: {}
}) })
const openDetail = async (rowId: number) => { const handleDetail = async (rowId: number) => {
// //
const data = await FormApi.getForm(rowId) const data = await FormApi.getFormApi(rowId)
setConfAndFields2(detailData, data.conf, data.fields) setConfAndFields2(detailPreview, data.conf, data.fields)
// //
detailVisible.value = true detailOpen.value = true
} }
/** 初始化 **/
onMounted(() => {
getList()
})
</script> </script>

View File

@ -0,0 +1,64 @@
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)

View File

@ -1,184 +1,182 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 列表 -->
<el-form <XTable @register="registerTable">
class="-mb-15px" <template #toolbar_buttons>
:model="queryParams" <!-- 操作新增 -->
ref="queryFormRef" <XButton
: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"
@click="openForm('create')" preIcon="ep:zoom-in"
: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" /> 新增 />
</el-button> </template>
</el-form-item> <template #memberUserIds_default="{ row }">
</el-form> <span v-for="userId in row.memberUserIds" :key="userId">
{{ getUserNickname(userId) }} &nbsp;
</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> <!-- 对话框(添加 / 修改) -->
<el-table v-loading="loading" :data="list"> <Form
<el-table-column label="编号" align="center" prop="id" /> v-if="['create', 'update'].includes(actionType)"
<el-table-column label="组名" align="center" prop="name" /> :schema="allSchemas.formSchema"
<el-table-column label="描述" align="center" prop="description" /> :rules="rules"
<el-table-column label="成员" align="center"> ref="formRef"
<template #default="scope"> >
<span v-for="userId in scope.row.memberUserIds" :key="userId" class="pr-5px"> <template #memberUserIds="form">
{{ userList.find((user) => user.id === userId)?.nickname }} <el-select v-model="form.memberUserIds" multiple>
</span> <el-option v-for="item in users" :key="item.id" :label="item.nickname" :value="item.id" />
</template> </el-select>
</el-table-column> </template>
<el-table-column label="状态" align="center" prop="status"> </Form>
<template #default="scope"> <!-- 对话框(详情) -->
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" /> <Descriptions
</template> v-if="actionType === 'detail'"
</el-table-column> :schema="allSchemas.detailSchema"
<el-table-column :data="detailData"
label="创建时间" >
align="center" <template #memberUserIds="{ row }">
prop="createTime" <span v-for="userId in row.memberUserIds" :key="userId">
:formatter="dateFormatter" {{ getUserNickname(userId) }} &nbsp;
</span>
</template>
</Descriptions>
<!-- 操作按钮 -->
<template #footer>
<!-- 按钮保存 -->
<XButton
v-if="['create', 'update'].includes(actionType)"
type="primary"
:title="t('action.save')"
:loading="actionLoading"
@click="submitForm"
/> />
<el-table-column label="操作" align="center"> <!-- 按钮关闭 -->
<template #default="scope"> <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
<el-button </template>
link </XModal>
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>
</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" name="UserGroup"> <script setup lang="ts">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' // import
import { dateFormatter } from '@/utils/formatTime'
import * as UserGroupApi from '@/api/bpm/userGroup' import * as UserGroupApi from '@/api/bpm/userGroup'
import * as UserApi from '@/api/system/user' import { getListSimpleUsersApi, UserVO } from '@/api/system/user'
import UserGroupForm from './UserGroupForm.vue' import { allSchemas, rules } from './group.data'
const message = useMessage() // import { FormExpose } from '@/components/Form'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() //
const loading = ref(true) // //
const total = ref(0) // const [registerTable, { reload, deleteData }] = useXTable({
const list = ref([]) // allSchemas: allSchemas,
const queryParams = reactive({ getListApi: UserGroupApi.getUserGroupPageApi,
pageNo: 1, deleteApi: UserGroupApi.deleteUserGroupApi
pageSize: 10,
name: null,
status: null,
createTime: []
}) })
const queryFormRef = ref() // //
const userList = ref([]) // const users = ref<UserVO[]>([])
/** 查询列表 */ const getUserNickname = (userId) => {
const getList = async () => { for (const user of users.value) {
loading.value = true if (user.id === userId) {
try { return user.nickname
const data = await UserGroupApi.getUserGroupPage(queryParams) }
list.value = data.list
total.value = data.total
} finally {
loading.value = false
} }
return '未知(' + userId + ')'
} }
/** 搜索按钮操作 */ // ========== CRUD ==========
const handleQuery = () => { const actionLoading = ref(false) //
queryParams.pageNo = 1 const actionType = ref('') //
getList() 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 resetQuery = () => { const handleCreate = () => {
queryFormRef.value.resetFields() setDialogTile('create')
handleQuery()
} }
/** 添加/修改操作 */ //
const formRef = ref() const handleUpdate = async (rowId: number) => {
const openForm = (type: string, id?: number) => { setDialogTile('update')
formRef.value.open(type, id) //
const res = await UserGroupApi.getUserGroupApi(rowId)
unref(formRef)?.setValues(res)
} }
/** 删除按钮操作 */ //
const handleDelete = async (id: number) => { const handleDetail = async (rowId: number) => {
try { setDialogTile('detail')
// detailData.value = await UserGroupApi.getUserGroupApi(rowId)
await message.delConfirm()
//
await UserGroupApi.deleteUserGroup(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
} }
/** 初始化 **/ //
onMounted(async () => { const submitForm = async () => {
await getList() const elForm = unref(formRef)?.getElFormRef()
// if (!elForm) return
userList.value = await UserApi.getSimpleUserList() elForm.validate(async (valid) => {
if (valid) {
actionLoading.value = true
//
try {
const data = unref(formRef)?.formModel as UserGroupApi.UserGroupVO
if (actionType.value === 'create') {
await UserGroupApi.createUserGroupApi(data)
message.success(t('common.createSuccess'))
} else {
await UserGroupApi.updateUserGroupApi(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
} finally {
actionLoading.value = false
//
await reload()
}
}
})
}
// ========== ==========
onMounted(() => {
getListSimpleUsersApi().then((data) => {
users.value = data
})
}) })
</script> </script>

View File

@ -1,324 +1,353 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 列表 -->
<el-form <XTable @register="registerTable">
class="-mb-15px" <template #toolbar_buttons>
:model="queryParams" <!-- 操作新增 -->
ref="queryFormRef" <XButton
:inline="true"
label-width="68px"
>
<el-form-item label="流程标识" prop="key">
<el-input
v-model="queryParams.key"
placeholder="请输入流程标识"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<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="category">
<el-select
v-model="queryParams.category"
placeholder="请选择流程分类"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.BPM_MODEL_CATEGORY)"
: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"
plain preIcon="ep:zoom-in"
@click="openForm('create')" title="新建流程"
v-hasPermi="['bpm:model:create']" v-hasPermi="['bpm:model:create']"
> @click="handleCreate"
<Icon icon="ep:plus" class="mr-5px" /> 新建流程 />
</el-button> <!-- 操作导入 -->
<el-button type="success" plain @click="openImportForm" v-hasPermi="['bpm:model:import']"> <XButton
<Icon icon="ep:upload" class="mr-5px" /> 导入流程 type="warning"
</el-button> preIcon="ep:upload"
</el-form-item> :title="'导入流程'"
</el-form> @click="handleImport"
</ContentWrap> style="margin-left: 10px"
/>
</template>
<!-- 流程名称 -->
<template #name_default="{ row }">
<XTextButton :title="row.name" @click="handleBpmnDetail(row.id)" />
</template>
<!-- 流程分类 -->
<template #category_default="{ row }">
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
</template>
<!-- 表单信息 -->
<template #formId_default="{ row }">
<XTextButton
v-if="row.formType === 10"
:title="forms.find((form) => form.id === row.formId)?.name || row.formId"
@click="handleFormDetail(row)"
/>
<XTextButton v-else :title="row.formCustomCreatePath" @click="handleFormDetail(row)" />
</template>
<!-- 流程版本 -->
<template #version_default="{ row }">
<el-tag v-if="row.processDefinition">v{{ row.processDefinition.version }}</el-tag>
<el-tag type="warning" v-else></el-tag>
</template>
<!-- 激活状态 -->
<template #status_default="{ row }">
<el-switch
v-if="row.processDefinition"
v-model="row.processDefinition.suspensionState"
:active-value="1"
:inactive-value="2"
@change="handleChangeState(row)"
/>
</template>
<!-- 操作 -->
<template #actionbtns_default="{ row }">
<XTextButton
preIcon="ep:edit"
title="修改流程"
v-hasPermi="['bpm:model:update']"
@click="handleUpdate(row.id)"
/>
<XTextButton
preIcon="ep:setting"
title="设计流程"
v-hasPermi="['bpm:model:update']"
@click="handleDesign(row)"
/>
<XTextButton
preIcon="ep:user"
title="分配规则"
v-hasPermi="['bpm:task-assign-rule:query']"
@click="handleAssignRule(row)"
/>
<XTextButton
preIcon="ep:position"
title="发布流程"
v-hasPermi="['bpm:model:deploy']"
@click="handleDeploy(row)"
/>
<XTextButton
preIcon="ep:aim"
title="流程定义"
v-hasPermi="['bpm:process-definition:query']"
@click="handleDefinitionList(row)"
/>
<!-- 操作删除 -->
<XTextButton
preIcon="ep:delete"
:title="t('action.del')"
v-hasPermi="['bpm:model:delete']"
@click="handleDelete(row.id)"
/>
</template>
</XTable>
<!-- 列表 --> <!-- 对话框(添加 / 修改流程) -->
<ContentWrap> <XModal v-model="dialogVisible" :title="dialogTitle" width="600">
<el-table v-loading="loading" :data="list"> <el-form
<el-table-column label="流程标识" align="center" prop="key" width="200" /> :loading="dialogLoading"
<el-table-column label="流程名称" align="center" prop="name" width="200"> el-form
<template #default="scope"> ref="saveFormRef"
<el-button type="text" @click="handleBpmnDetail(scope.row)"> :model="saveForm"
<span>{{ scope.row.name }}</span> :rules="rules"
</el-button> label-width="110px"
</template> >
</el-table-column> <el-form-item label="流程标识" prop="key">
<el-table-column label="流程分类" align="center" prop="category" width="100"> <el-input
<template #default="scope"> v-model="saveForm.key"
<dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" /> placeholder="请输入流标标识"
</template> style="width: 330px"
</el-table-column> :disabled="!!saveForm.id"
<el-table-column label="表单信息" align="center" prop="formType" width="200"> />
<template #default="scope"> <el-tooltip
<el-button v-if="!saveForm.id"
v-if="scope.row.formType === 10" class="item"
type="text" effect="light"
@click="handleFormDetail(scope.row)" content="新建后,流程标识不可修改!"
placement="top"
> >
<span>{{ scope.row.formName }}</span> <i style="padding-left: 5px" class="el-icon-question"></i>
</el-button> </el-tooltip>
<el-button <el-tooltip
v-else-if="scope.row.formType === 20" v-else
type="text" class="item"
@click="handleFormDetail(scope.row)" effect="light"
content="流程标识不可修改!"
placement="top"
> >
<span>{{ scope.row.formCustomCreatePath }}</span> <i style="padding-left: 5px" class="el-icon-question"></i>
</el-button> </el-tooltip>
<label v-else></label> </el-form-item>
</template> <el-form-item label="流程名称" prop="name">
</el-table-column> <el-input
<el-table-column v-model="saveForm.name"
label="创建时间" placeholder="请输入流程名称"
align="center" :disabled="!!saveForm.id"
prop="createTime" clearable
width="180" />
:formatter="dateFormatter" </el-form-item>
/> <el-form-item v-if="saveForm.id" label="流程分类" prop="category">
<el-table-column label="最新部署的流程定义" align="center"> <el-select
<el-table-column v-model="saveForm.category"
label="流程版本" placeholder="请选择流程分类"
align="center" clearable
prop="processDefinition.version" style="width: 100%"
width="100" >
> <el-option
<template #default="scope"> v-for="(dict, index) in getDictOptions(DICT_TYPE.BPM_MODEL_CATEGORY)"
<el-tag v-if="scope.row.processDefinition"> :key="index"
v{{ scope.row.processDefinition.version }} :label="dict.label"
</el-tag> :value="dict.value"
<el-tag v-else type="warning">未部署</el-tag>
</template>
</el-table-column>
<el-table-column
label="激活状态"
align="center"
prop="processDefinition.version"
width="85"
>
<template #default="scope">
<el-switch
v-if="scope.row.processDefinition"
v-model="scope.row.processDefinition.suspensionState"
:active-value="1"
:inactive-value="2"
@change="handleChangeState(scope.row)"
/> />
</el-select>
</el-form-item>
<el-form-item label="流程描述" prop="description">
<el-input type="textarea" v-model="saveForm.description" clearable />
</el-form-item>
<div v-if="saveForm.id">
<el-form-item label="表单类型" prop="formType">
<el-radio-group v-model="saveForm.formType">
<el-radio
v-for="dict in getDictOptions(DICT_TYPE.BPM_MODEL_FORM_TYPE)"
:key="parseInt(dict.value)"
:label="parseInt(dict.value)"
>
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="saveForm.formType === 10" label="流程表单" prop="formId">
<el-select v-model="saveForm.formId" clearable style="width: 100%">
<el-option v-for="form in forms" :key="form.id" :label="form.name" :value="form.id" />
</el-select>
</el-form-item>
<el-form-item
v-if="saveForm.formType === 20"
label="表单提交路由"
prop="formCustomCreatePath"
>
<el-input
v-model="saveForm.formCustomCreatePath"
placeholder="请输入表单提交路由"
style="width: 330px"
/>
<el-tooltip
class="item"
effect="light"
content="自定义表单的提交路径,使用 Vue 的路由地址例如说bpm/oa/leave/create"
placement="top"
>
<i style="padding-left: 5px" class="el-icon-question"></i>
</el-tooltip>
</el-form-item>
<el-form-item
v-if="saveForm.formType === 20"
label="表单查看路由"
prop="formCustomViewPath"
>
<el-input
v-model="saveForm.formCustomViewPath"
placeholder="请输入表单查看路由"
style="width: 330px"
/>
<el-tooltip
class="item"
effect="light"
content="自定义表单的查看路径,使用 Vue 的路由地址例如说bpm/oa/leave/view"
placement="top"
>
<i style="padding-left: 5px" class="el-icon-question"></i>
</el-tooltip>
</el-form-item>
</div>
</el-form>
<template #footer>
<!-- 按钮保存 -->
<XButton
type="primary"
:loading="dialogLoading"
@click="submitForm"
:title="t('action.save')"
/>
<!-- 按钮关闭 -->
<XButton
:loading="dialogLoading"
@click="dialogVisible = false"
:title="t('dialog.close')"
/>
</template>
</XModal>
<!-- 导入流程 -->
<XModal v-model="importDialogVisible" width="400" title="导入流程">
<div>
<el-upload
ref="uploadRef"
:action="importUrl"
:headers="uploadHeaders"
:drag="true"
:limit="1"
:multiple="true"
:show-file-list="true"
:disabled="uploadDisabled"
:on-exceed="handleExceed"
:on-success="handleFileSuccess"
:on-error="excelUploadError"
:auto-upload="false"
accept=".bpmn, .xml"
name="bpmnFile"
:data="importForm"
>
<Icon class="el-icon--upload" icon="ep:upload-filled" />
<div class="el-upload__text"> 将文件拖到此处 <em>点击上传</em> </div>
<template #tip>
<div class="el-upload__tip" style="color: red">
提示仅允许导入bpmxml格式文件
</div>
<div>
<el-form
ref="importFormRef"
:model="importForm"
:rules="rules"
label-width="120px"
status-icon
>
<el-form-item label="流程标识" prop="key">
<el-input
v-model="importForm.key"
placeholder="请输入流标标识"
style="width: 250px"
/>
</el-form-item>
<el-form-item label="流程名称" prop="name">
<el-input v-model="importForm.name" placeholder="请输入流程名称" clearable />
</el-form-item>
<el-form-item label="流程描述" prop="description">
<el-input type="textarea" v-model="importForm.description" clearable />
</el-form-item>
</el-form>
</div>
</template> </template>
</el-table-column> </el-upload>
<el-table-column label="部署时间" align="center" prop="deploymentTime" width="180"> </div>
<template #default="scope"> <template #footer>
<span v-if="scope.row.processDefinition"> <!-- 按钮保存 -->
{{ formatDate(scope.row.processDefinition.deploymentTime) }} <XButton
</span> type="warning"
</template> preIcon="ep:upload-filled"
</el-table-column> :title="t('action.save')"
</el-table-column> @click="submitFileForm"
<el-table-column label="操作" align="center" width="240" fixed="right"> />
<template #default="scope"> <XButton title="取 消" @click="uploadClose" />
<el-button </template>
link </XModal>
type="primary"
@click="openForm('update', scope.row.id)" <!-- 表单详情的弹窗 -->
v-hasPermi="['bpm:model:update']" <XModal v-model="formDetailVisible" width="800" title="表单详情" :show-footer="false">
> <form-create
修改流程 :rule="formDetailPreview.rule"
</el-button> :option="formDetailPreview.option"
<el-button v-if="formDetailVisible"
link />
type="primary" </XModal>
@click="handleDesign(scope.row)"
v-hasPermi="['bpm:model:update']" <!-- 流程模型图的预览 -->
> <XModal title="流程图" v-model="showBpmnOpen" width="80%" height="90%">
设计流程 <my-process-viewer
</el-button> key="designer"
<el-button v-model="bpmnXML"
link :value="bpmnXML"
type="primary" v-bind="bpmnControlForm"
@click="handleAssignRule(scope.row)" :prefix="bpmnControlForm.prefix"
v-hasPermi="['bpm:task-assign-rule:query']" />
> </XModal>
分配规则
</el-button>
<el-button
link
type="primary"
@click="handleDeploy(scope.row)"
v-hasPermi="['bpm:model:deploy']"
>
发布流程
</el-button>
<el-button
link
type="primary"
v-hasPermi="['bpm:process-definition:query']"
@click="handleDefinitionList(scope.row)"
>
流程定义
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['bpm:model: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> </ContentWrap>
<!-- 表单弹窗添加/修改流程 -->
<ModelForm ref="formRef" @success="getList" />
<!-- 表单弹窗导入流程 -->
<ModelImportForm ref="importFormRef" @success="getList" />
<!-- 弹窗表单详情 -->
<Dialog title="表单详情" v-model="formDetailVisible" width="800">
<form-create :rule="formDetailPreview.rule" :option="formDetailPreview.option" />
</Dialog>
<!-- 弹窗流程模型图的预览 -->
<Dialog title="流程图" v-model="bpmnDetailVisible" width="800">
<my-process-viewer
key="designer"
v-model="bpmnXML"
:value="bpmnXML"
v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
/>
</Dialog>
</template> </template>
<script setup lang="ts" name="Form"> <script setup lang="ts">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' // import
import { dateFormatter, formatDate } from '@/utils/formatTime' import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import * as ModelApi from '@/api/bpm/model' import { FormInstance, UploadInstance } from 'element-plus'
// import
import { getAccessToken, getTenantId } from '@/utils/auth'
import * as FormApi from '@/api/bpm/form' import * as FormApi from '@/api/bpm/form'
import ModelForm from './ModelForm.vue' import * as ModelApi from '@/api/bpm/model'
import ModelImportForm from '@/views/bpm/model/ModelImportForm.vue' import { allSchemas, rules } from './model.data'
import { setConfAndFields2 } from '@/utils/formCreate' import { setConfAndFields2 } from '@/utils/formCreate'
const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const { push } = useRouter() // const message = useMessage() //
const router = useRouter() //
const loading = ref(true) // const showBpmnOpen = ref(false)
const total = ref(0) // const bpmnXML = ref(null)
const list = ref([]) // const bpmnControlForm = ref({
const queryParams = reactive({ prefix: 'flowable'
pageNo: 1,
pageSize: 10,
key: undefined,
name: undefined,
category: undefined
}) })
const queryFormRef = ref() // // ========== ==========
const [registerTable, { reload }] = useXTable({
allSchemas: allSchemas,
getListApi: ModelApi.getModelPageApi
})
const forms = ref() //
/** 查询列表 */ //
const getList = async () => {
loading.value = true
try {
const data = await ModelApi.getModelPage(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 openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 添加/修改操作 */
const importFormRef = ref()
const openImportForm = () => {
importFormRef.value.open()
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ModelApi.deleteModel(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 更新状态操作 */
const handleChangeState = async (row) => {
const state = row.processDefinition.suspensionState
try {
//
const id = row.id
const statusState = state === 1 ? '激活' : '挂起'
const content = '是否确认' + statusState + '流程名字为"' + row.name + '"的数据项?'
await message.confirm(content)
//
await ModelApi.updateModelState(id, state)
//
await getList()
} catch {
//
row.processDefinition.suspensionState = state === 1 ? 2 : 1
}
}
/** 设计流程 */
const handleDesign = (row) => { const handleDesign = (row) => {
push({ console.log(row, '设计流程')
router.push({
name: 'modelEditor', name: 'modelEditor',
query: { query: {
modelId: row.id modelId: row.id
@ -326,32 +355,9 @@ const handleDesign = (row) => {
}) })
} }
/** 发布流程 */ //
const handleDeploy = async (row) => {
try {
//
await message.confirm('是否部署该流程!!')
//
await ModelApi.deployModel(row.id)
message.success(t('部署成功'))
//
await getList()
} catch {}
}
/** 点击任务分配按钮 */
const handleAssignRule = (row) => {
push({
name: 'BpmTaskAssignRuleList',
query: {
modelId: row.id
}
})
}
/** 跳转到指定流程定义列表 */
const handleDefinitionList = (row) => { const handleDefinitionList = (row) => {
push({ router.push({
name: 'BpmProcessDefinitionList', name: 'BpmProcessDefinitionList',
query: { query: {
key: row.key key: row.key
@ -359,7 +365,7 @@ const handleDefinitionList = (row) => {
}) })
} }
/** 流程表单的详情按钮操作 */ //
const formDetailVisible = ref(false) const formDetailVisible = ref(false)
const formDetailPreview = ref({ const formDetailPreview = ref({
rule: [], rule: [],
@ -368,31 +374,222 @@ const formDetailPreview = ref({
const handleFormDetail = async (row) => { const handleFormDetail = async (row) => {
if (row.formType == 10) { if (row.formType == 10) {
// //
const data = await FormApi.getForm(row.formId) const data = await FormApi.getFormApi(row.formId)
setConfAndFields2(formDetailPreview, data.conf, data.fields) setConfAndFields2(formDetailPreview, data.conf, data.fields)
// //
formDetailVisible.value = true formDetailVisible.value = true
} else { } else {
await push({ await router.push({
path: row.formCustomCreatePath path: row.formCustomCreatePath
}) })
} }
} }
/** 流程图的详情按钮操作 */ //
const bpmnDetailVisible = ref(false) const handleBpmnDetail = (row) => {
const bpmnXML = ref(null) // TODO
const bpmnControlForm = ref({ console.log(row)
prefix: 'flowable' ModelApi.getModelApi(row).then((response) => {
}) console.log(response, 'response')
const handleBpmnDetail = async (row) => { bpmnXML.value = response.bpmnXml
const data = await ModelApi.getModel(row.id) //
bpmnXML.value = data.bpmnXml || '' showBpmnOpen.value = true
bpmnDetailVisible.value = true })
// message.success(' 2 ')
} }
/** 初始化 **/ //
const handleAssignRule = (row) => {
router.push({
name: 'BpmTaskAssignRuleList',
query: {
modelId: row.id
}
})
}
// ========== / ==========
const dialogVisible = ref(false)
const dialogTitle = ref('新建模型')
const dialogLoading = ref(false)
const saveForm = ref()
const saveFormRef = ref<FormInstance>()
//
const setDialogTile = async (type: string) => {
dialogTitle.value = t('action.' + type)
dialogVisible.value = true
}
//
const handleCreate = async () => {
resetForm()
await setDialogTile('create')
}
//
const handleUpdate = async (rowId: number) => {
resetForm()
await setDialogTile('edit')
//
saveForm.value = await ModelApi.getModelApi(rowId)
if (saveForm.value.category == null) {
saveForm.value.category = '1'
} else {
saveForm.value.category = saveForm.value.category
}
}
//
const submitForm = async () => {
//
const elForm = unref(saveFormRef)
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
//
dialogLoading.value = true
try {
const data = saveForm.value as ModelApi.ModelVO
if (!data.id) {
await ModelApi.createModelApi(data)
message.success(t('common.createSuccess'))
} else {
await ModelApi.updateModelApi(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
} finally {
//
await reload()
dialogLoading.value = false
}
}
//
const resetForm = () => {
saveForm.value = {
formType: 10,
name: '',
courseSort: '',
description: '',
formId: '',
formCustomCreatePath: '',
formCustomViewPath: ''
}
saveFormRef.value?.resetFields()
}
// ========== / / ==========
//
const handleDelete = (rowId) => {
message.delConfirm('是否删除该流程!!').then(async () => {
await ModelApi.deleteModelApi(rowId)
message.success(t('common.delSuccess'))
//
reload()
})
}
//
const handleChangeState = (row) => {
const id = row.id
const state = row.processDefinition.suspensionState
const statusState = state === 1 ? '激活' : '挂起'
const content = '是否确认' + statusState + '流程名字为"' + row.name + '"的数据项?'
message
.confirm(content)
.then(async () => {
await ModelApi.updateModelStateApi(id, state)
message.success(t('部署成功'))
//
reload()
})
.catch(() => {
//
row.processDefinition.suspensionState = state === 1 ? 2 : 1
})
}
//
const handleDeploy = (row) => {
message.confirm('是否部署该流程!!').then(async () => {
await ModelApi.deployModelApi(row.id)
message.success(t('部署成功'))
//
reload()
})
}
// ========== ==========
const uploadRef = ref<UploadInstance>()
let importUrl = import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/bpm/model/import'
const uploadHeaders = ref()
const importDialogVisible = ref(false)
const uploadDisabled = ref(false)
const importFormRef = ref<FormInstance>()
const importForm = ref({
key: '',
name: '',
description: ''
})
//
const handleImport = () => {
importDialogVisible.value = true
}
//
const handleExceed = (): void => {
message.error('最多只能上传一个文件!')
}
//
const excelUploadError = (): void => {
message.error('导入流程失败,请您重新上传!')
}
//
const submitFileForm = () => {
uploadHeaders.value = {
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
}
uploadDisabled.value = true
uploadRef.value!.submit()
}
//
const handleFileSuccess = async (response: any): Promise<void> => {
if (response.code !== 0) {
message.error(response.msg)
return
}
//
uploadClose()
//
message.success('导入流程成功!请点击【设计流程】按钮,进行编辑保存后,才可以进行【发布流程】')
await reload()
}
//
const uploadClose = () => {
//
importDialogVisible.value = false
//
uploadDisabled.value = false
uploadRef.value!.clearFiles()
//
importForm.value = {
key: '',
name: '',
description: ''
}
importFormRef.value?.resetFields()
}
// ========== ==========
onMounted(() => { onMounted(() => {
getList() //
FormApi.getSimpleFormsApi().then((data) => {
forms.value = data
})
}) })
</script> </script>

View File

@ -0,0 +1,106 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
const { t } = useI18n() // 国际化
// 表单校验
export const rules = reactive({
key: [required],
name: [required],
category: [required],
formType: [required],
formId: [required],
formCustomCreatePath: [required],
formCustomViewPath: [required]
})
// CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'key',
primaryType: null,
action: true,
actionWidth: '540px',
columns: [
{
title: '流程标识',
field: 'key',
isSearch: true,
table: {
width: 120
}
},
{
title: '流程名称',
field: 'name',
isSearch: true,
table: {
width: 120,
slots: {
default: 'name_default'
}
}
},
{
title: '流程分类',
field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
dictClass: 'number',
isSearch: true,
table: {
slots: {
default: 'category_default'
}
}
},
{
title: '表单信息',
field: 'formId',
table: {
width: 180,
slots: {
default: 'formId_default'
}
}
},
{
title: '最新部署的流程定义',
field: 'processDefinition',
isForm: false,
table: {
children: [
{
title: '流程版本',
field: 'version',
slots: {
default: 'version_default'
},
width: 80
},
{
title: '激活状态',
field: 'status',
slots: {
default: 'status_default'
},
width: 80
},
{
title: '部署时间',
field: 'processDefinition.deploymentTime',
formatter: 'formatDate',
width: 180
}
]
}
},
{
title: t('common.createTime'),
field: 'createTime',
isForm: false,
formatter: 'formatDate',
table: {
width: 180
}
}
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -0,0 +1,204 @@
<template>
<div class="app-container">
<!-- 流程设计器负责绘制流程等 -->
<!-- <myProcessDesigner -->
<my-process-designer
:key="`designer-${reloadIndex}`"
v-if="xmlString !== undefined"
v-model="xmlString"
:value="xmlString"
v-bind="controlForm"
keyboard
ref="processDesigner"
@init-finished="initModeler"
:additionalModel="controlForm.additionalModel"
@save="save"
/>
<!-- 流程属性器负责编辑每个流程节点的属性 -->
<!-- <MyProcessPalette -->
<my-properties-panel
:key="`penal-${reloadIndex}`"
:bpmnModeler="modeler"
:prefix="controlForm.prefix"
class="process-panel"
:model="model"
/>
</div>
</template>
<script setup lang="ts">
// import { translations } from '@/components/bpmnProcessDesigner/src/translations'
//
import CustomContentPadProvider from '@/components/bpmnProcessDesigner/package/designer/plugins/content-pad'
//
import CustomPaletteProvider from '@/components/bpmnProcessDesigner/package/designer/plugins/palette'
// import xmlObj2json from "./utils/xml2json";
// import myProcessDesigner from '@/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue'
// import MyProcessPalette from '@/components/bpmnProcessDesigner/package/palette/ProcessPalette.vue'
import { createModelApi, getModelApi, updateModelApi, ModelVO } from '@/api/bpm/model'
const router = useRouter()
const message = useMessage()
//
// import MyProcessPanel from "../package/process-panel/ProcessPanel";
const xmlString = ref(undefined) // BPMN XML
const modeler = ref(null)
const reloadIndex = ref(0)
// const controlDrawerVisible = ref(false)
// const translationsSelf = translations
const controlForm = ref({
simulation: true,
labelEditing: false,
labelVisible: false,
prefix: 'flowable',
headerButtonSize: 'mini',
additionalModel: [CustomContentPadProvider, CustomPaletteProvider]
})
// const addis = ref({
// CustomContentPadProvider,
// CustomPaletteProvider
// })
//
const model = ref<ModelVO>()
onMounted(() => {
// modelId
const modelId = router.currentRoute.value.query && router.currentRoute.value.query.modelId
console.log(modelId, 'modelId')
if (modelId) {
// let data = '4b4909d8-97e7-11ec-8e20-862bc1a4a054'
getModelApi(modelId as unknown as number).then((data) => {
console.log(data, 'response')
xmlString.value = data.bpmnXml
model.value = {
...data,
bpmnXml: undefined // bpmnXml
}
// this.controlForm.processId = data.key
// xmlString.value =
// '<?xml version="1.0" encoding="UTF-8"?>\n<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="diagram_Process_1645980650311" targetNamespace="http://activiti.org/bpmn"><bpmn2:process id="flowable_01" name="flowable" isExecutable="true"><bpmn2:startEvent id="Event_1iruxim"><bpmn2:outgoing>Flow_0804gmo</bpmn2:outgoing></bpmn2:startEvent><bpmn2:userTask id="task01" name="task01"><bpmn2:incoming>Flow_0804gmo</bpmn2:incoming><bpmn2:outgoing>Flow_0cx479x</bpmn2:outgoing></bpmn2:userTask><bpmn2:sequenceFlow id="Flow_0804gmo" sourceRef="Event_1iruxim" targetRef="task01" /><bpmn2:endEvent id="Event_1mdsccz"><bpmn2:incoming>Flow_0cx479x</bpmn2:incoming></bpmn2:endEvent><bpmn2:sequenceFlow id="Flow_0cx479x" sourceRef="task01" targetRef="Event_1mdsccz" /></bpmn2:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="flowable_01_di" bpmnElement="flowable_01"><bpmndi:BPMNEdge id="Flow_0cx479x_di" bpmnElement="Flow_0cx479x"><di:waypoint x="440" y="350" /><di:waypoint x="492" y="350" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id="Flow_0804gmo_di" bpmnElement="Flow_0804gmo"><di:waypoint x="288" y="350" /><di:waypoint x="340" y="350" /></bpmndi:BPMNEdge><bpmndi:BPMNShape id="Event_1iruxim_di" bpmnElement="Event_1iruxim"><dc:Bounds x="252" y="332" width="36" height="36" /></bpmndi:BPMNShape><bpmndi:BPMNShape id="task01_di" bpmnElement="task01"><dc:Bounds x="340" y="310" width="100" height="80" /></bpmndi:BPMNShape><bpmndi:BPMNShape id="Event_1mdsccz_di" bpmnElement="Event_1mdsccz"><dc:Bounds x="492" y="332" width="36" height="36" /></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn2:definitions>'
// model.value = {
// key: 'flowable_01',
// name: 'flowable',
// description: 'ooxx',
// category: '1',
// formType: 10,
// formId: 11,
// formCustomCreatePath: null,
// formCustomViewPath: null,
// id: '4b4909d8-97e7-11ec-8e20-862bc1a4a054',
// createTime: 1645978019795,
// bpmnXml: undefined // bpmnXml
// }
// console.log(modeler.value, 'modeler11111111')
})
}
})
const initModeler = (item) => {
setTimeout(() => {
modeler.value = item
console.log(item, 'initModeler方法modeler')
console.log(modeler.value, 'initModeler方法modeler')
// controlForm.value.prefix = '2222'
}, 10)
}
const save = (bpmnXml) => {
const data: ModelVO = {
...(model.value ?? ({} as ModelVO)),
bpmnXml: bpmnXml // bpmnXml
}
console.log(data, 'data')
//
if (data.id) {
updateModelApi(data).then((response) => {
console.log(response, 'response')
message.success('修改成功')
//
close()
})
return
}
//
createModelApi(data).then((response) => {
console.log(response, 'response1')
message.success('保存成功')
//
close()
})
}
/** 关闭按钮 */
const close = () => {
router.push({ path: '/bpm/manager/model' })
}
</script>
<style lang="scss">
//body {
// overflow: hidden;
// margin: 0;
// box-sizing: border-box;
//}
//.app {
// width: 100%;
// height: 100%;
// box-sizing: border-box;
// display: inline-grid;
// grid-template-columns: 100px auto max-content;
//}
.demo-control-bar {
position: fixed;
right: 8px;
bottom: 8px;
z-index: 1;
.open-control-dialog {
width: 48px;
height: 48px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
font-size: 32px;
background: rgba(64, 158, 255, 1);
color: #ffffff;
cursor: pointer;
}
}
// TODO faq
//.info-tip {
// position: fixed;
// top: 40px;
// right: 500px;
// z-index: 10;
// color: #999999;
//}
.control-form {
.el-radio {
width: 100%;
line-height: 32px;
}
}
.element-overlays {
box-sizing: border-box;
padding: 8px;
background: rgba(0, 0, 0, 0.6);
border-radius: 4px;
color: #fafafa;
}
.my-process-designer {
height: calc(100vh - 84px);
}
.process-panel__container {
position: absolute;
right: 0;
top: 55px;
height: calc(100vh - 84px);
}
</style>

View File

@ -0,0 +1,154 @@
<template>
<ContentWrap>
<!-- 第一步通过流程定义的列表选择对应的流程 -->
<div v-if="!selectProcessInstance">
<XTable @register="registerTable">
<!-- 流程分类 -->
<template #category_default="{ row }">
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
</template>
<template #version_default="{ row }">
<el-tag v-if="row">v{{ row.version }}</el-tag>
</template>
<template #actionbtns_default="{ row }">
<XTextButton preIcon="ep:plus" title="选择" @click="handleSelect(row)" />
</template>
</XTable>
</div>
<!-- 第二步填写表单进行流程的提交 -->
<div v-else>
<el-card class="box-card">
<div class="clearfix">
<span class="el-icon-document">申请信息{{ selectProcessInstance.name }}</span>
<XButton
style="float: right"
type="primary"
preIcon="ep:delete"
title="选择其它流程"
@click="selectProcessInstance = undefined"
/>
</div>
<el-col :span="16" :offset="6" style="margin-top: 20px">
<form-create
:rule="detailForm.rule"
v-model:api="fApi"
:option="detailForm.option"
@submit="submitForm"
/>
</el-col>
</el-card>
<el-card class="box-card">
<div class="clearfix">
<span class="el-icon-picture-outline">流程图</span>
</div>
<!-- TODO 芋艿待完成 -->
<my-process-viewer
key="designer"
v-model="bpmnXML"
:value="bpmnXML"
v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
/>
</el-card>
</div>
</ContentWrap>
</template>
<script setup lang="ts">
// import
import { allSchemas } from './process.create'
import * as DefinitionApi from '@/api/bpm/definition'
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import { setConfAndFields2 } from '@/utils/formCreate'
import type { ApiAttrs } from '@form-create/element-ui/types/config'
import { DICT_TYPE } from '@/utils/dict'
const router = useRouter() //
const message = useMessage() //
// ========== ==========
const [registerTable] = useXTable({
allSchemas: allSchemas,
params: {
suspensionState: 1
},
getListApi: DefinitionApi.getProcessDefinitionListApi,
isList: true
})
// ========== ==========
const fApi = ref<ApiAttrs>()
//
const detailForm = ref({
rule: [],
option: {}
})
//
const selectProcessInstance = ref() //
/** 处理选择流程的按钮操作 **/
const handleSelect = async (row) => {
//
selectProcessInstance.value = row
//
if (row.formType == 10) {
//
setConfAndFields2(detailForm, row.formConf, row.formFields)
//
DefinitionApi.getProcessDefinitionBpmnXMLApi(row.id).then((response) => {
bpmnXML.value = response
})
//
} else if (row.formCustomCreatePath) {
await router.push({
path: row.formCustomCreatePath
})
// Tab
}
}
/** 提交按钮 */
const submitForm = async (formData) => {
if (!fApi.value || !selectProcessInstance.value) {
return
}
//
fApi.value.btn.loading(true)
try {
await ProcessInstanceApi.createProcessInstanceApi({
processDefinitionId: selectProcessInstance.value.id,
variables: formData
})
//
message.success('发起流程成功')
// this.$tab.closeOpenPage();
router.go(-1)
} finally {
fApi.value.btn.loading(false)
}
}
// ========== ==========
// // BPMN
const bpmnXML = ref(null)
const bpmnControlForm = ref({
prefix: 'flowable'
})
</script>
<style lang="scss">
.my-process-designer {
height: calc(100vh - 200px);
}
.box-card {
width: 100%;
margin-bottom: 20px;
}
</style>

View File

@ -0,0 +1,490 @@
<template>
<ContentWrap>
<!-- 审批信息 -->
<el-card
class="box-card"
v-loading="processInstanceLoading"
v-for="(item, index) in runningTasks"
:key="index"
>
<template #header>
<span class="el-icon-picture-outline">审批任务{{ item.name }}</span>
</template>
<el-col :span="16" :offset="6">
<el-form
:ref="'form' + index"
:model="auditForms[index]"
:rules="auditRule"
label-width="100px"
>
<el-form-item label="流程名" v-if="processInstance && processInstance.name">
{{ processInstance.name }}
</el-form-item>
<el-form-item label="流程发起人" v-if="processInstance && processInstance.startUser">
{{ processInstance.startUser.nickname }}
<el-tag type="info" size="small">{{ processInstance.startUser.deptName }}</el-tag>
</el-form-item>
<el-form-item label="审批建议" prop="reason">
<el-input
type="textarea"
v-model="auditForms[index].reason"
placeholder="请输入审批建议"
/>
</el-form-item>
</el-form>
<div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
<XButton
pre-icon="ep:select"
type="success"
title="通过"
@click="handleAudit(item, true)"
/>
<XButton
pre-icon="ep:close"
type="danger"
title="不通过"
@click="handleAudit(item, false)"
/>
<XButton
pre-icon="ep:edit"
type="primary"
title="转办"
@click="handleUpdateAssignee(item)"
/>
<XButton
pre-icon="ep:position"
type="primary"
title="委派"
@click="handleDelegate(item)"
/>
<XButton pre-icon="ep:back" type="warning" title="委派" @click="handleBack(item)" />
</div>
</el-col>
</el-card>
<!-- 申请信息 -->
<el-card class="box-card" v-loading="processInstanceLoading">
<template #header>
<span class="el-icon-document">申请信息{{ processInstance.name }}</span>
</template>
<!-- 情况一流程表单 -->
<el-col v-if="processInstance?.processDefinition?.formType === 10" :span="16" :offset="6">
<form-create
ref="fApi"
:rule="detailForm.rule"
:option="detailForm.option"
v-model="detailForm.value"
/>
</el-col>
<!-- 情况二流程表单 -->
<div v-if="processInstance?.processDefinition?.formType === 20">
<router-link
:to="
processInstance.processDefinition.formCustomViewPath +
'?id=' +
processInstance.businessKey
"
>
<XButton type="primary" preIcon="ep:view" title="点击查看" />
</router-link>
</div>
</el-card>
<!-- 审批记录 -->
<el-card class="box-card" v-loading="tasksLoad">
<template #header>
<span class="el-icon-picture-outline">审批记录</span>
</template>
<el-col :span="16" :offset="4">
<div class="block">
<el-timeline>
<el-timeline-item
v-for="(item, index) in tasks"
:key="index"
:icon="getTimelineItemIcon(item)"
:type="getTimelineItemType(item)"
>
<p style="font-weight: 700">任务{{ item.name }}</p>
<el-card :body-style="{ padding: '10px' }">
<label v-if="item.assigneeUser" style="font-weight: normal; margin-right: 30px">
审批人{{ item.assigneeUser.nickname }}
<el-tag type="info" size="small">{{ item.assigneeUser.deptName }}</el-tag>
</label>
<label style="font-weight: normal" v-if="item.createTime"></label>
<label style="color: #8a909c; font-weight: normal">
{{ dayjs(item?.createTime).format('YYYY-MM-DD HH:mm:ss') }}
</label>
<label v-if="item.endTime" style="margin-left: 30px; font-weight: normal">
审批时间
</label>
<label v-if="item.endTime" style="color: #8a909c; font-weight: normal">
{{ dayjs(item?.endTime).format('YYYY-MM-DD HH:mm:ss') }}
</label>
<label v-if="item.durationInMillis" style="margin-left: 30px; font-weight: normal">
耗时
</label>
<label v-if="item.durationInMillis" style="color: #8a909c; font-weight: normal">
{{ formatPast2(item?.durationInMillis) }}
</label>
<p v-if="item.reason">
<el-tag :type="getTimelineItemType(item)">{{ item.reason }}</el-tag>
</p>
</el-card>
</el-timeline-item>
</el-timeline>
</div>
</el-col>
</el-card>
<!-- 高亮流程图 -->
<el-card class="box-card" v-loading="processInstanceLoading">
<template #header>
<span class="el-icon-picture-outline">流程图</span>
</template>
<my-process-viewer
key="designer"
v-model="bpmnXML"
:value="bpmnXML"
v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
:activityData="activityList"
:processInstanceData="processInstance"
:taskData="tasks"
/>
</el-card>
<!-- 对话框(转派审批人) -->
<XModal v-model="updateAssigneeVisible" title="转派审批人" width="500">
<el-form
ref="updateAssigneeFormRef"
:model="updateAssigneeForm"
:rules="updateAssigneeRules"
label-width="110px"
>
<el-form-item label="新审批人" prop="assigneeUserId">
<el-select v-model="updateAssigneeForm.assigneeUserId" clearable style="width: 100%">
<el-option
v-for="item in userOptions"
:key="parseInt(item.id)"
:label="item.nickname"
:value="parseInt(item.id)"
/>
</el-select>
</el-form-item>
</el-form>
<!-- 操作按钮 -->
<template #footer>
<!-- 按钮保存 -->
<XButton
type="primary"
:title="t('action.save')"
:loading="updateAssigneeLoading"
@click="submitUpdateAssigneeForm"
/>
<!-- 按钮关闭 -->
<XButton
:loading="updateAssigneeLoading"
:title="t('dialog.close')"
@click="updateAssigneeLoading = false"
/>
</template>
</XModal>
</ContentWrap>
</template>
<script setup lang="ts">
import dayjs from 'dayjs'
import * as UserApi from '@/api/system/user'
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import * as DefinitionApi from '@/api/bpm/definition'
import * as TaskApi from '@/api/bpm/task'
import * as ActivityApi from '@/api/bpm/activity'
import { formatPast2 } from '@/utils/formatTime'
import { setConfAndFields2 } from '@/utils/formCreate'
// import { OptionAttrs } from '@form-create/element-ui/types/config'
import type { ApiAttrs } from '@form-create/element-ui/types/config'
import { useUserStore } from '@/store/modules/user'
const { query } = useRoute() //
const message = useMessage() //
const { t } = useI18n() //
const { proxy } = getCurrentInstance() as any
// ========== ==========
const id = query.id as unknown as number
const processInstanceLoading = ref(false) //
const processInstance = ref<any>({}) //
const runningTasks = ref<any[]>([]) //
const auditForms = ref<any[]>([]) //
const auditRule = reactive({
reason: [{ required: true, message: '审批建议不能为空', trigger: 'blur' }]
})
//
const handleAudit = async (task, pass) => {
// 1.1
const index = runningTasks.value.indexOf(task)
const auditFormRef = proxy.$refs['form' + index][0]
// alert(auditFormRef)
// 1.2
const elForm = unref(auditFormRef)
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
// 2.1
const data = {
id: task.id,
reason: auditForms.value[index].reason
}
if (pass) {
await TaskApi.approveTask(data)
message.success('审批通过成功')
} else {
await TaskApi.rejectTask(data)
message.success('审批不通过成功')
}
// 2.2
getDetail()
}
// ========== ==========
const fApi = ref<ApiAttrs>()
const userId = useUserStore().getUser.id //
//
const detailForm = ref({
rule: [],
option: {},
value: {}
})
// ========== ==========
const tasksLoad = ref(true)
const tasks = ref<any[]>([])
const getTimelineItemIcon = (item) => {
if (item.result === 1) {
return 'el-icon-time'
}
if (item.result === 2) {
return 'el-icon-check'
}
if (item.result === 3) {
return 'el-icon-close'
}
if (item.result === 4) {
return 'el-icon-remove-outline'
}
return ''
}
const getTimelineItemType = (item) => {
if (item.result === 1) {
return 'primary'
}
if (item.result === 2) {
return 'success'
}
if (item.result === 3) {
return 'danger'
}
if (item.result === 4) {
return 'info'
}
return ''
}
// ========== ==========
const updateAssigneeVisible = ref(false)
const updateAssigneeLoading = ref(false)
const updateAssigneeForm = ref({
id: undefined,
assigneeUserId: undefined
})
const updateAssigneeRules = ref({
assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }]
})
const updateAssigneeFormRef = ref()
const userOptions = ref<any[]>([])
//
const handleUpdateAssignee = (task) => {
//
resetUpdateAssigneeForm()
updateAssigneeForm.value.id = task.id
//
updateAssigneeVisible.value = true
}
//
const submitUpdateAssigneeForm = async () => {
// 1.
const elForm = unref(updateAssigneeFormRef)
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
// 2.1
updateAssigneeLoading.value = true
try {
await TaskApi.updateTaskAssignee(updateAssigneeForm.value)
// 2.2
updateAssigneeVisible.value = false
//
getDetail()
} finally {
updateAssigneeLoading.value = false
}
}
//
const resetUpdateAssigneeForm = () => {
updateAssigneeForm.value = {
id: undefined,
assigneeUserId: undefined
}
updateAssigneeFormRef.value?.resetFields()
}
/** 处理审批退回的操作 */
const handleDelegate = async (task) => {
message.error('暂不支持【委派】功能,可以使用【转派】替代!')
console.log(task)
}
/** 处理审批退回的操作 */
const handleBack = async (task) => {
message.error('暂不支持【退回】功能!')
// http://blog.wya1.com/article/636697030/details/7296
// const data = {
// id: task.id,
// assigneeUserId: 1
// }
// backTask(data).then(response => {
// this.$modal.msgSuccess("退");
// this.getDetail(); //
// });
console.log(task)
}
// ========== ==========
const bpmnXML = ref(null)
const bpmnControlForm = ref({
prefix: 'flowable'
})
const activityList = ref([])
// ========== ==========
onMounted(() => {
//
getDetail()
//
UserApi.getListSimpleUsersApi().then((data) => {
userOptions.value.push(...data)
})
})
const getDetail = () => {
// 1.
processInstanceLoading.value = true
ProcessInstanceApi.getProcessInstanceApi(id)
.then((data) => {
if (!data) {
message.error('查询不到流程信息!')
return
}
processInstance.value = data
//
const processDefinition = data.processDefinition
if (processDefinition.formType === 10) {
setConfAndFields2(
detailForm,
processDefinition.formConf,
processDefinition.formFields,
data.formVariables
)
nextTick().then(() => {
fApi.value?.fapi?.btn.show(false)
fApi.value?.fapi?.resetBtn.show(false)
fApi.value?.fapi?.disabled(true)
})
}
//
DefinitionApi.getProcessDefinitionBpmnXMLApi(processDefinition.id).then((data) => {
bpmnXML.value = data
})
//
ActivityApi.getActivityList({
processInstanceId: data.id
}).then((data) => {
activityList.value = data
})
})
.finally(() => {
processInstanceLoading.value = false
})
// 2.
tasksLoad.value = true
runningTasks.value = []
auditForms.value = []
TaskApi.getTaskListByProcessInstanceId(id)
.then((data) => {
//
tasks.value = []
//
data.forEach((task) => {
if (task.result !== 4) {
tasks.value.push(task)
}
})
//
tasks.value.sort((a, b) => {
//
if (a.endTime && b.endTime) {
return b.endTime - a.endTime
} else if (a.endTime) {
return 1
} else if (b.endTime) {
return -1
//
} else {
return b.createTime - a.createTime
}
})
//
tasks.value.forEach((task) => {
// 1.1
if (task.result !== 1) {
return
}
// 1.2
if (!task.assigneeUser || task.assigneeUser.id !== userId) {
return
}
// 2.
runningTasks.value.push({ ...task })
auditForms.value.push({
reason: ''
})
})
})
.finally(() => {
tasksLoad.value = false
})
}
</script>
<style lang="scss">
.my-process-designer {
height: calc(100vh - 200px);
}
.box-card {
width: 100%;
margin-bottom: 20px;
}
</style>

View File

@ -0,0 +1,39 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
// crudSchemas
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: null,
action: true,
columns: [
{
title: '流程名称',
field: 'name'
},
{
title: '流程分类',
field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
dictClass: 'number',
table: {
slots: {
default: 'category_default'
}
}
},
{
title: '流程版本',
field: 'version',
table: {
slots: {
default: 'version_default'
}
}
},
{
title: '流程描述',
field: 'description'
}
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -1,73 +1,186 @@
<template> <template>
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <!-- 列表 -->
<el-table-column label="任务名" align="center" prop="taskDefinitionName" /> <XTable @register="registerTable" ref="xGrid">
<el-table-column label="任务标识" align="center" prop="taskDefinitionKey" /> <template #options_default="{ row }">
<el-table-column label="规则类型" align="center" prop="type"> <span :key="option" v-for="option in row.options">
<template #default="scope"> <el-tag>
<dict-tag :type="DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE" :value="scope.row.type" /> {{ getAssignRuleOptionName(row.type, option) }}
</template>
</el-table-column>
<el-table-column label="规则范围" align="center" prop="options">
<template #default="scope">
<el-tag class="mr-5px" :key="option" v-for="option in scope.row.options">
{{ getAssignRuleOptionName(scope.row.type, option) }}
</el-tag> </el-tag>
</template> &nbsp;
</el-table-column> </span>
<el-table-column v-if="queryParams.modelId" label="操作" align="center"> </template>
<template #default="scope"> <!-- 操作 -->
<el-button <template #actionbtns_default="{ row }" v-if="modelId">
link <!-- 操作修改 -->
type="primary" <XTextButton
@click="openForm(scope.row)" preIcon="ep:edit"
v-hasPermi="['bpm:task-assign-rule:update']" :title="t('action.edit')"
> v-hasPermi="['bpm:task-assign-rule:update']"
修改 @click="handleUpdate(row)"
</el-button> />
</template> </template>
</el-table-column> </XTable>
</el-table>
<!-- 添加/修改弹窗 -->
<XModal v-model="dialogVisible" title="修改任务规则" width="800" height="35%">
<el-form ref="formRef" :model="formData" :rules="rules" label-width="80px">
<el-form-item label="任务名称" prop="taskDefinitionName">
<el-input v-model="formData.taskDefinitionName" placeholder="请输入流标标识" disabled />
</el-form-item>
<el-form-item label="任务标识" prop="taskDefinitionKey">
<el-input v-model="formData.taskDefinitionKey" placeholder="请输入任务标识" disabled />
</el-form-item>
<el-form-item label="规则类型" prop="type">
<el-select v-model="formData.type" clearable style="width: 100%">
<el-option
v-for="dict in getDictOptions(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE)"
:key="parseInt(dict.value)"
:label="dict.label"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
<el-form-item v-if="formData.type === 10" label="指定角色" prop="roleIds">
<el-select v-model="formData.roleIds" multiple clearable style="width: 100%">
<el-option
v-for="item in roleOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item
label="指定部门"
prop="deptIds"
span="24"
v-if="formData.type === 20 || formData.type === 21"
>
<el-tree-select
ref="treeRef"
v-model="formData.deptIds"
node-key="id"
show-checkbox
:props="defaultProps"
:data="deptTreeOptions"
empty-text="加载中,请稍后"
multiple
/>
</el-form-item>
<el-form-item label="指定岗位" prop="postIds" span="24" v-if="formData.type === 22">
<el-select v-model="formData.postIds" multiple clearable style="width: 100%">
<el-option
v-for="item in postOptions"
:key="parseInt(item.id)"
:label="item.name"
:value="parseInt(item.id)"
/>
</el-select>
</el-form-item>
<el-form-item
label="指定用户"
prop="userIds"
span="24"
v-if="formData.type === 30 || formData.type === 31 || formData.type === 32"
>
<el-select v-model="formData.userIds" multiple clearable style="width: 100%">
<el-option
v-for="item in userOptions"
:key="parseInt(item.id)"
:label="item.nickname"
:value="parseInt(item.id)"
/>
</el-select>
</el-form-item>
<el-form-item label="指定用户组" prop="userGroupIds" v-if="formData.type === 40">
<el-select v-model="formData.userGroupIds" multiple clearable style="width: 100%">
<el-option
v-for="item in userGroupOptions"
:key="parseInt(item.id)"
:label="item.name"
:value="parseInt(item.id)"
/>
</el-select>
</el-form-item>
<el-form-item label="指定脚本" prop="scripts" v-if="formData.type === 50">
<el-select v-model="formData.scripts" multiple clearable style="width: 100%">
<el-option
v-for="dict in taskAssignScriptDictDatas"
:key="parseInt(dict.value)"
:label="dict.label"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
</el-form>
<!-- 操作按钮 -->
<template #footer>
<!-- 按钮保存 -->
<XButton
type="primary"
:title="t('action.save')"
:loading="actionLoading"
@click="submitForm"
/>
<!-- 按钮关闭 -->
<XButton
:loading="actionLoading"
:title="t('dialog.close')"
@click="dialogVisible = false"
/>
</template>
</XModal>
</ContentWrap> </ContentWrap>
<!-- 添加/修改弹窗 -->
<TaskAssignRuleForm ref="formRef" @success="getList" />
</template> </template>
<script setup lang="ts" name="TaskAssignRule"> <script setup lang="ts" name="TaskAssignRule">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' // import
import { FormInstance } from 'element-plus'
// import
import * as TaskAssignRuleApi from '@/api/bpm/taskAssignRule' import * as TaskAssignRuleApi from '@/api/bpm/taskAssignRule'
import * as RoleApi from '@/api/system/role' import { listSimpleRolesApi } from '@/api/system/role'
import * as DeptApi from '@/api/system/dept' import { listSimplePostsApi } from '@/api/system/post'
import * as PostApi from '@/api/system/post' import { getListSimpleUsersApi } from '@/api/system/user'
import * as UserApi from '@/api/system/user' import { listSimpleUserGroupsApi } from '@/api/bpm/userGroup'
import * as UserGroupApi from '@/api/bpm/userGroup' import { listSimpleDeptApi } from '@/api/system/dept'
import TaskAssignRuleForm from './TaskAssignRuleForm.vue' import { DICT_TYPE, getDictOptions } from '@/utils/dict'
const { query } = useRoute() // import { handleTree, defaultProps } from '@/utils/tree'
import { allSchemas, rules, idShowActionClick } from './taskAssignRule.data'
const loading = ref(true) // const { t } = useI18n() //
const list = ref([]) // const message = useMessage() //
const { query } = useRoute()
const xGrid = ref()
// ========== ==========
const roleOptions = ref() //
const deptOptions = ref() //
const deptTreeOptions = ref()
const postOptions = ref() //
const userOptions = ref() //
const userGroupOptions = ref() //
const taskAssignScriptDictDatas = getDictOptions(DICT_TYPE.BPM_TASK_ASSIGN_SCRIPT)
// modelId
const modelId = query.modelId
// processDefinitionId
const processDefinitionId = query.processDefinitionId
let isShow = idShowActionClick(modelId)
//
const queryParams = reactive({ const queryParams = reactive({
modelId: query.modelId, // modelId modelId: modelId,
processDefinitionId: query.processDefinitionId // processDefinitionId processDefinitionId: processDefinitionId
})
const [registerTable, { reload }] = useXTable({
allSchemas: allSchemas,
params: queryParams,
getListApi: TaskAssignRuleApi.getTaskAssignRuleList,
isList: true
}) })
const roleOptions = ref<RoleApi.RoleVO[]>([]) //
const deptOptions = ref<DeptApi.DeptVO[]>([]) //
const postOptions = ref<PostApi.PostVO[]>([]) //
const userOptions = ref<UserApi.UserVO[]>([]) //
const userGroupOptions = ref<UserGroupApi.UserGroupVO[]>([]) //
const taskAssignScriptDictDatas = getIntDictOptions(DICT_TYPE.BPM_TASK_ASSIGN_SCRIPT)
/** 查询列表 */ //
const getList = async () => {
loading.value = true
try {
list.value = await TaskAssignRuleApi.getTaskAssignRuleList(queryParams)
} finally {
loading.value = false
}
}
/** 翻译规则范围 */
// TODO ts
const getAssignRuleOptionName = (type, option) => { const getAssignRuleOptionName = (type, option) => {
if (type === 10) { if (type === 10) {
for (const roleOption of roleOptions.value) { for (const roleOption of roleOptions.value) {
@ -110,24 +223,136 @@ const getAssignRuleOptionName = (type, option) => {
return '未知(' + option + ')' return '未知(' + option + ')'
} }
/** 添加/修改操作 */ // ========== ==========
const formRef = ref()
const openForm = (row: TaskAssignRuleApi.TaskAssignVO) => { //
formRef.value.open(queryParams.modelId, row) const actionLoading = ref(false) //
const dialogVisible = ref(false) //
const formRef = ref<FormInstance>()
const formData = ref() //
//
const submitForm = async () => {
//
const elForm = unref(formRef)
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
//
let form = {
...formData.value,
taskDefinitionName: undefined
}
// roleIds options
if (form.type === 10) {
form.options = form.roleIds
} else if (form.type === 20 || form.type === 21) {
form.options = form.deptIds
} else if (form.type === 22) {
form.options = form.postIds
} else if (form.type === 30 || form.type === 31 || form.type === 32) {
form.options = form.userIds
} else if (form.type === 40) {
form.options = form.userGroupIds
} else if (form.type === 50) {
form.options = form.scripts
}
form.roleIds = undefined
form.deptIds = undefined
form.postIds = undefined
form.userIds = undefined
form.userGroupIds = undefined
form.scripts = undefined
//
actionLoading.value = true
//
try {
const data = form as TaskAssignRuleApi.TaskAssignVO
//
if (!data.id) {
await TaskAssignRuleApi.createTaskAssignRule(data)
message.success(t('common.createSuccess'))
//
} else {
await TaskAssignRuleApi.updateTaskAssignRule(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
} finally {
actionLoading.value = false
//
await reload()
}
} }
/** 初始化 */ //
onMounted(async () => { const handleUpdate = (row) => {
await getList() // 1.
formData.value = {}
// 2.
formData.value = {
...row,
modelId: modelId,
options: [],
roleIds: [],
deptIds: [],
postIds: [],
userIds: [],
userGroupIds: [],
scripts: []
}
// options roleIds
if (row.type === 10) {
formData.value.roleIds.push(...row.options)
} else if (row.type === 20 || row.type === 21) {
formData.value.deptIds.push(...row.options)
} else if (row.type === 22) {
formData.value.postIds.push(...row.options)
} else if (row.type === 30 || row.type === 31 || row.type === 32) {
formData.value.userIds.push(...row.options)
} else if (row.type === 40) {
formData.value.userGroupIds.push(...row.options)
} else if (row.type === 50) {
formData.value.scripts.push(...row.options)
}
//
dialogVisible.value = true
actionLoading.value = false
}
// ========== ==========
onMounted(() => {
// //
roleOptions.value = await RoleApi.getSimpleRoleList() roleOptions.value = []
listSimpleRolesApi().then((data) => {
roleOptions.value.push(...data)
})
// //
deptOptions.value = await DeptApi.getSimpleDeptList() deptOptions.value = []
deptTreeOptions.value = []
listSimpleDeptApi().then((data) => {
deptOptions.value.push(...data)
deptTreeOptions.value.push(...handleTree(data, 'id'))
})
// //
postOptions.value = await PostApi.getSimplePostList() postOptions.value = []
listSimplePostsApi().then((data) => {
postOptions.value.push(...data)
})
// //
userOptions.value = await UserApi.getSimpleUserList() userOptions.value = []
getListSimpleUsersApi().then((data) => {
userOptions.value.push(...data)
})
// //
userGroupOptions.value = await UserGroupApi.getSimpleUserGroupList() userGroupOptions.value = []
listSimpleUserGroupsApi().then((data) => {
userGroupOptions.value.push(...data)
})
if (!isShow) {
setTimeout(() => {
xGrid.value.Ref.hideColumn('actionbtns')
}, 100)
}
}) })
</script> </script>

View File

@ -0,0 +1,54 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
// 表单校验
export const rules = reactive({
type: [{ required: true, message: '规则类型不能为空', trigger: 'change' }],
roleIds: [{ required: true, message: '指定角色不能为空', trigger: 'change' }],
deptIds: [{ required: true, message: '指定部门不能为空', trigger: 'change' }],
postIds: [{ required: true, message: '指定岗位不能为空', trigger: 'change' }],
userIds: [{ required: true, message: '指定用户不能为空', trigger: 'change' }],
userGroupIds: [{ required: true, message: '指定用户组不能为空', trigger: 'change' }],
scripts: [{ required: true, message: '指定脚本不能为空', trigger: 'change' }]
})
// CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: null,
action: true,
actionWidth: '200px',
columns: [
{
title: '任务名',
field: 'taskDefinitionName'
},
{
title: '任务标识',
field: 'taskDefinitionKey'
},
{
title: '规则类型',
field: 'type',
dictType: DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE,
dictClass: 'number'
},
{
title: '规则范围',
field: 'options',
table: {
slots: {
default: 'options_default'
}
}
}
]
})
export const idShowActionClick = (modelId?: any) => {
if (modelId) {
return true
} else {
return false
}
}
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -0,0 +1,74 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
// CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'id',
primaryTitle: '日志编号',
action: true,
actionWidth: '80px',
columns: [
{
title: '链路追踪',
field: 'traceId',
isTable: false
},
{
title: '用户编号',
field: 'userId',
isSearch: true
},
{
title: '用户类型',
field: 'userType',
dictType: DICT_TYPE.USER_TYPE,
dictClass: 'number',
isSearch: true
},
{
title: '应用名',
field: 'applicationName',
isSearch: true
},
{
title: '请求方法名',
field: 'requestMethod'
},
{
title: '请求地址',
field: 'requestUrl',
isSearch: true
},
{
title: '请求时间',
field: 'beginTime',
formatter: 'formatDate',
search: {
show: true,
itemRender: {
name: 'XDataTimePicker'
}
}
},
{
title: '执行时长',
field: 'duration',
table: {
slots: {
default: 'duration_default'
}
}
},
{
title: '操作结果',
field: 'resultCode',
isSearch: true,
table: {
slots: {
default: 'resultCode_default'
}
}
}
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -1,220 +1,62 @@
<template> <template>
<content-wrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 列表 -->
<el-form <XTable @register="registerTable">
class="-mb-15px" <template #duration_default="{ row }">
:model="queryParams" <span>{{ row.duration + 'ms' }}</span>
ref="queryFormRef" </template>
:inline="true" <template #resultCode_default="{ row }">
label-width="68px" <span>{{ row.resultCode === 0 ? '成功' : '失败(' + row.resultMsg + ')' }}</span>
> </template>
<el-form-item label="用户编号" prop="userId"> <template #actionbtns_default="{ row }">
<el-input <!-- 操作详情 -->
v-model="queryParams.userId" <XTextButton
placeholder="请输入用户编号" preIcon="ep:view"
clearable :title="t('action.detail')"
@keyup.enter="handleQuery" v-hasPermi="['infra:api-access-log:query']"
class="!w-240px" @click="handleDetail(row)"
/> />
</el-form-item> </template>
<el-form-item label="用户类型" prop="userType"> </XTable>
<el-select </ContentWrap>
v-model="queryParams.userType" <XModal v-model="dialogVisible" :title="dialogTitle">
placeholder="请选择用户类型" <!-- 对话框(详情) -->
clearable <Descriptions :schema="allSchemas.detailSchema" :data="detailData">
class="!w-240px" <template #duration="{ row }">
> <span>{{ row.duration + 'ms' }}</span>
<el-option </template>
v-for="dict in getDictOptions(DICT_TYPE.USER_TYPE)" <template #resultCode="{ row }">
:key="parseInt(dict.value)" <span>{{ row.resultCode === 0 ? '成功' : '失败(' + row.resultMsg + ')' }}</span>
:label="dict.label" </template>
:value="parseInt(dict.value)" </Descriptions>
/> <!-- 操作按钮 -->
</el-select> <template #footer>
</el-form-item> <XButton :title="t('dialog.close')" @click="dialogVisible = false" />
<el-form-item label="应用名" prop="applicationName"> </template>
<el-input </XModal>
v-model="queryParams.applicationName"
placeholder="请输入应用名"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="请求时间" prop="beginTime">
<el-date-picker
v-model="queryParams.beginTime"
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="duration">
<el-input
v-model="queryParams.duration"
placeholder="请输入执行时长"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="结果码" prop="resultCode">
<el-input
v-model="queryParams.resultCode"
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-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>
<!-- 列表 -->
<content-wrap>
<el-table v-loading="loading" :data="list">
<el-table-column label="日志编号" align="center" prop="id" />
<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="applicationName" />
<el-table-column label="请求方法" align="center" prop="requestMethod" width="80" />
<el-table-column label="请求地址" align="center" prop="requestUrl" width="250" />
<el-table-column label="请求时间" align="center" prop="beginTime" width="180">
<template #default="scope">
<span>{{ formatDate(scope.row.beginTime) }}</span>
</template>
</el-table-column>
<el-table-column label="执行时长" align="center" prop="duration" width="180">
<template #default="scope">
<span>{{ scope.row.duration }} ms</span>
</template>
</el-table-column>
<el-table-column label="操作结果" align="center" prop="status">
<template #default="scope">
<span>{{
scope.row.resultCode === 0 ? '成功' : '失败(' + scope.row.resultMsg + ')'
}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openDetail(scope.row)"
v-hasPermi="['infra:api-access-log:query']"
>
详细
</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>
<!-- 表单弹窗详情 -->
<ApiAccessLogDetail ref="detailRef" />
</template> </template>
<script setup lang="ts" name="ApiAccessLog"> <script setup lang="ts" name="ApiAccessLog">
import { DICT_TYPE, getDictOptions } from '@/utils/dict' import { allSchemas } from './apiAccessLog.data'
import download from '@/utils/download'
import { formatDate } from '@/utils/formatTime'
import * as ApiAccessLogApi from '@/api/infra/apiAccessLog' import * as ApiAccessLogApi from '@/api/infra/apiAccessLog'
import ApiAccessLogDetail from './ApiAccessLogDetail.vue'
const message = useMessage() // const { t } = useI18n() //
const loading = ref(true) // //
const total = ref(0) // const [registerTable] = useXTable({
const list = ref([]) // allSchemas: allSchemas,
const queryParams = reactive({ topActionSlots: false,
pageNo: 1, getListApi: ApiAccessLogApi.getApiAccessLogPageApi
pageSize: 10,
userId: null,
userType: null,
applicationName: null,
requestUrl: null,
duration: null,
resultCode: null,
beginTime: []
}) })
const queryFormRef = ref() // // ========== ==========
const exportLoading = ref(false) // const detailData = ref() // Ref
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
/** 查询列表 */ //
const getList = async () => { const handleDetail = (row: ApiAccessLogApi.ApiAccessLogVO) => {
loading.value = true //
try { detailData.value = row
const data = await ApiAccessLogApi.getApiAccessLogPage(queryParams) dialogTitle.value = t('action.detail')
list.value = data.list dialogVisible.value = true
total.value = data.total
} finally {
loading.value = false
}
} }
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (data: ApiAccessLogApi.ApiAccessLogVO) => {
detailRef.value.open(data)
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ApiAccessLogApi.exportApiAccessLog(queryParams)
download.excel(data, 'API 访问日志.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script> </script>

View File

@ -0,0 +1,76 @@
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)

View File

@ -1,248 +1,99 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 列表 -->
<el-form <XTable @register="registerTable">
class="-mb-15px" <!-- 操作导出 -->
:model="queryParams" <template #toolbar_buttons>
ref="queryFormRef" <XButton
:inline="true" type="warning"
label-width="68px" preIcon="ep:download"
> :title="t('action.export')"
<el-form-item label="用户编号" prop="userId"> @click="exportList('错误数据.xls')"
<el-input
v-model="queryParams.userId"
placeholder="请输入用户编号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/> />
</el-form-item> </template>
<el-form-item label="用户类型" prop="userType"> <template #duration_default="{ row }">
<el-select <span>{{ row.duration + 'ms' }}</span>
v-model="queryParams.userType" </template>
placeholder="请选择用户类型" <template #resultCode_default="{ row }">
clearable <span>{{ row.resultCode === 0 ? '成功' : '失败(' + row.resultMsg + ')' }}</span>
class="!w-240px" </template>
> <template #actionbtns_default="{ row }">
<el-option <!-- 操作详情 -->
v-for="dict in getIntDictOptions(DICT_TYPE.USER_TYPE)" <XTextButton
:key="dict.value" preIcon="ep:view"
:label="dict.label" :title="t('action.detail')"
:value="dict.value" v-hasPermi="['infra:api-access-log:query']"
/> @click="handleDetail(row)"
</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> <XTextButton
<el-form-item label="异常时间" prop="exceptionTime"> preIcon="ep:cpu"
<el-date-picker title="已处理"
v-model="queryParams.exceptionTime" v-if="row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
value-format="yyyy-MM-dd HH:mm:ss" v-hasPermi="['infra:api-error-log:update-status']"
type="daterange" @click="handleProcessClick(row, InfraApiErrorLogProcessStatusEnum.DONE, '已处理')"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/> />
</el-form-item> <XTextButton
<el-form-item label="处理状态" prop="processStatus"> preIcon="ep:mute-notification"
<el-select title="已忽略"
v-model="queryParams.processStatus" v-if="row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
placeholder="请选择处理状态" v-hasPermi="['infra:api-error-log:update-status']"
clearable @click="handleProcessClick(row, InfraApiErrorLogProcessStatusEnum.IGNORE, '已忽略')"
class="!w-240px" />
> </template>
<el-option </XTable>
v-for="dict in getIntDictOptions(DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_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="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>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 列表 --> <!-- 对话框(详情) -->
<ContentWrap> <Descriptions :schema="allSchemas.detailSchema" :data="detailData" />
<el-table v-loading="loading" :data="list"> <!-- 操作按钮 -->
<el-table-column label="日志编号" align="center" prop="id" /> <template #footer>
<el-table-column label="用户编号" align="center" prop="userId" /> <XButton :title="t('dialog.close')" @click="dialogVisible = false" />
<el-table-column label="用户类型" align="center" prop="userType"> </template>
<template #default="scope"> </XModal>
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType" />
</template>
</el-table-column>
<el-table-column label="应用名" align="center" prop="applicationName" width="200" />
<el-table-column label="请求方法" align="center" prop="requestMethod" width="80" />
<el-table-column label="请求地址" align="center" prop="requestUrl" width="180" />
<el-table-column
label="异常发生时间"
align="center"
prop="exceptionTime"
width="180"
:formatter="dateFormatter"
/>
<el-table-column label="异常名" align="center" prop="exceptionName" width="180" />
<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>
</el-table-column>
<el-table-column label="操作" align="center" width="200">
<template #default="scope">
<el-button
link
type="primary"
@click="openDetail(scope.row)"
v-hasPermi="['infra:api-error-log:query']"
>
详细
</el-button>
<el-button
link
type="primary"
v-if="scope.row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
@click="handleProcess(scope.row.id, InfraApiErrorLogProcessStatusEnum.DONE)"
v-hasPermi="['infra:api-error-log:update-status']"
>
已处理
</el-button>
<el-button
link
type="primary"
v-if="scope.row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
@click="handleProcess(scope.row.id, InfraApiErrorLogProcessStatusEnum.IGNORE)"
v-hasPermi="['infra:api-error-log:update-status']"
>
已忽略
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗详情 -->
<ApiErrorLogDetail ref="detailRef" />
</template> </template>
<script setup lang="ts" name="ApiErrorLog"> <script setup lang="ts" name="ApiErrorLog">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { allSchemas } from './apiErrorLog.data'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as ApiErrorLogApi from '@/api/infra/apiErrorLog' import * as ApiErrorLogApi from '@/api/infra/apiErrorLog'
import ApiErrorLogDetail from './ApiErrorLogDetail.vue'
import { InfraApiErrorLogProcessStatusEnum } from '@/utils/constants' import { InfraApiErrorLogProcessStatusEnum } from '@/utils/constants'
const message = useMessage() // const { t } = useI18n() //
const message = useMessage()
const loading = ref(true) // // ========== ==========
const total = ref(0) // const [registerTable, { reload, exportList }] = useXTable({
const list = ref([]) // allSchemas: allSchemas,
const queryParams = reactive({ getListApi: ApiErrorLogApi.getApiErrorLogPageApi,
pageNo: 1, exportListApi: ApiErrorLogApi.exportApiErrorLogApi
pageSize: 10,
userId: null,
userType: null,
applicationName: null,
requestUrl: null,
processStatus: null,
exceptionTime: []
}) })
const queryFormRef = ref() // // ========== ==========
const exportLoading = ref(false) // const detailData = ref() // Ref
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
/** 查询列表 */ //
const getList = async () => { const handleDetail = (row: ApiErrorLogApi.ApiErrorLogVO) => {
loading.value = true //
try { detailData.value = row
const data = await ApiErrorLogApi.getApiErrorLogPage(queryParams) dialogTitle.value = t('action.detail')
list.value = data.list dialogVisible.value = true
total.value = data.total
} finally {
loading.value = false
}
} }
/** 搜索按钮操作 */ //
const handleQuery = () => { const handleProcessClick = (
queryParams.pageNo = 1 row: ApiErrorLogApi.ApiErrorLogVO,
getList() processSttatus: number,
type: string
) => {
message
.confirm('确认标记为' + type + '?', t('common.reminder'))
.then(async () => {
await ApiErrorLogApi.updateApiErrorLogPageApi(row.id, processSttatus)
message.success(t('common.updateSuccess'))
})
.finally(async () => {
//
await reload()
})
.catch(() => {})
} }
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (data: ApiErrorLogApi.ApiErrorLogVO) => {
detailRef.value.open(data)
}
/** 处理已处理 / 已忽略的操作 **/
const handleProcess = async (id: number, processStatus: number) => {
try {
//
const type = processStatus === InfraApiErrorLogProcessStatusEnum.DONE ? '已处理' : '已忽略'
await message.confirm('确认标记为' + type + '?')
//
await ApiErrorLogApi.updateApiErrorLogPage(id, processStatus)
await message.success(type)
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ApiErrorLogApi.exportApiErrorLog(queryParams)
download.excel(data, '异常日志.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script> </script>

View File

@ -3,110 +3,124 @@
<el-row> <el-row>
<el-col> <el-col>
<div class="mb-2 float-right"> <div class="mb-2 float-right">
<el-button size="small" type="primary" @click="showJson"> JSON</el-button> <el-button size="small" @click="setJson"> JSON</el-button>
<el-button size="small" type="success" @click="showOption">O ptions</el-button> <el-button size="small" @click="setOption"> Options</el-button>
<el-button size="small" type="primary" @click="showJson">JSON</el-button>
<el-button size="small" type="success" @click="showOption">Options</el-button>
<el-button size="small" type="danger" @click="showTemplate"></el-button> <el-button size="small" type="danger" @click="showTemplate"></el-button>
<!-- <el-button size="small" @click="changeLocale"></el-button> -->
</div> </div>
</el-col> </el-col>
<!-- 表单设计器 -->
<el-col> <el-col>
<fc-designer ref="designer" height="780px" /> <fc-designer ref="designer" height="780px" />
</el-col> </el-col>
</el-row> </el-row>
<Dialog :title="dialogTitle" v-model="dialogVisible" maxHeight="600">
<div ref="editor" v-if="dialogVisible">
<XTextButton style="float: right" :title="t('common.copy')" @click="copy(formValue)" />
<el-scrollbar height="580">
<div v-highlight>
<code class="hljs">
{{ formValue }}
</code>
</div>
</el-scrollbar>
</div>
<span style="color: red" v-if="err">!</span>
</Dialog>
</ContentWrap> </ContentWrap>
<!-- 弹窗表单预览 -->
<Dialog :title="dialogTitle" v-model="dialogVisible" max-height="600">
<div ref="editor" v-if="dialogVisible">
<el-button style="float: right" @click="copy(formData)">
{{ t('common.copy') }}
</el-button>
<el-scrollbar height="580">
<div v-highlight>
<code class="hljs">
{{ formData }}
</code>
</div>
</el-scrollbar>
</div>
</Dialog>
</template> </template>
<script setup lang="ts" name="Build"> <script setup lang="ts" name="Build">
import formCreate from '@form-create/element-ui' import formCreate from '@form-create/element-ui'
import { useClipboard } from '@vueuse/core' import { useClipboard } from '@vueuse/core'
const { t } = useI18n() //
const message = useMessage() //
const designer = ref() // const { t } = useI18n()
const dialogVisible = ref(false) // const message = useMessage()
const dialogTitle = ref('') //
const formType = ref(-1) // 0 - JSON1 - Options2 - const designer = ref()
const formData = ref('') //
const dialogVisible = ref(false)
const dialogTitle = ref('')
const err = ref(false)
const type = ref(-1)
const formValue = ref('')
/** 打开弹窗 */
const openModel = (title: string) => { const openModel = (title: string) => {
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = title dialogTitle.value = title
} }
/** 生成 JSON */ const setJson = () => {
openModel('导入JSON--未实现')
}
const setOption = () => {
openModel('导入Options--未实现')
}
const showJson = () => { const showJson = () => {
openModel('生成 JSON') openModel('生成JSON')
formType.value = 0 type.value = 0
formData.value = designer.value.getRule() formValue.value = designer.value.getRule()
} }
/** 生成 Options */
const showOption = () => { const showOption = () => {
openModel('生成 Options') openModel('生成Options')
formType.value = 1 type.value = 1
formData.value = designer.value.getOption() formValue.value = designer.value.getOption()
} }
/** 生成组件 */
const showTemplate = () => { const showTemplate = () => {
openModel('生成组件') openModel('生成组件')
formType.value = 2 type.value = 2
formData.value = makeTemplate() formValue.value = makeTemplate()
}
// const changeLocale = () => {
// console.info('changeLocale')
// }
/** 复制 **/
const copy = async (text: string) => {
// const { copy, copied, isSupported } = useClipboard({ source: JSON.stringify(text) })
// if (!isSupported.value) {
// message.error(t('common.copyError'))
// } else {
// await copy()
// if (unref(copied.value)) {
// message.success(t('common.copySuccess'))
// }
// }
let url = JSON.stringify(text)
let oInput = document.createElement('textarea')
oInput.value = url
document.body.appendChild(oInput)
oInput.select() // ;
// console.log(oInput.value)
document.execCommand('Copy') //
message.success(t('common.copySuccess'))
oInput.remove()
} }
const makeTemplate = () => { const makeTemplate = () => {
const rule = designer.value.getRule() const rule = designer.value.getRule()
const opt = designer.value.getOption() const opt = designer.value.getOption()
return `<template> return `<template>
<form-create <form-create
v-model="fapi" v-model="fapi"
:rule="rule" :rule="rule"
:option="option" :option="option"
@submit="onSubmit" @submit="onSubmit"
></form-create> ></form-create>
</template> </template>
<script setup lang=ts> <script setup lang=ts>
import formCreate from "@form-create/element-ui"; import formCreate from "@form-create/element-ui";
const faps = ref(null) const faps = ref(null)
const rule = ref('') const rule = ref('')
const option = ref('') const option = ref('')
const init = () => { const init = () => {
rule.value = formCreate.parseJson('${formCreate.toJson(rule).replaceAll('\\', '\\\\')}') rule.value = formCreate.parseJson('${formCreate.toJson(rule).replaceAll('\\', '\\\\')}')
option.value = formCreate.parseJson('${JSON.stringify(opt)}') option.value = formCreate.parseJson('${JSON.stringify(opt)}')
}
const onSubmit = (formData) => {
//todo
}
init()
<\/script>`
}
/** 复制 **/
const copy = async (text: string) => {
const { copy, copied, isSupported } = useClipboard({ source: text })
if (!isSupported) {
message.error(t('common.copyError'))
} else {
await copy()
if (unref(copied)) {
message.success(t('common.copySuccess'))
}
} }
const onSubmit = (formData) => {
//todo
}
init()
<\/script>`
} }
</script> </script>

View File

@ -1,80 +1,67 @@
<template> <template>
<content-wrap v-loading="formLoading"> <ContentWrap>
<el-tabs v-model="activeName"> <ContentDetailWrap :title="title" @back="push('/infra/codegen')">
<el-tab-pane label="基本信息" name="basicInfo"> <el-tabs v-model="activeName">
<basic-info-form ref="basicInfoRef" :table="formData.table" /> <el-tab-pane label="基本信息" name="basicInfo">
</el-tab-pane> <BasicInfoForm ref="basicInfoRef" :basicInfo="tableCurrentRow" />
<el-tab-pane label="字段信息" name="colum"> </el-tab-pane>
<colum-info-form ref="columInfoRef" :columns="formData.columns" /> <el-tab-pane label="字段信息" name="cloum">
</el-tab-pane> <CloumInfoForm ref="cloumInfoRef" :info="cloumCurrentRow" />
<el-tab-pane label="生成信息" name="generateInfo"> </el-tab-pane>
<generate-info-form ref="generateInfoRef" :table="formData.table" /> </el-tabs>
</el-tab-pane> <template #right>
</el-tabs> <XButton
<el-form> type="primary"
<el-form-item style="float: right"> :title="t('action.save')"
<el-button type="primary" @click="submitForm" :loading="formLoading">保存</el-button> :loading="loading"
<el-button @click="close"></el-button> @click="submitForm()"
</el-form-item> />
</el-form> </template>
</content-wrap> </ContentDetailWrap>
</ContentWrap>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useTagsViewStore } from '@/store/modules/tagsView' import { BasicInfoForm, CloumInfoForm } from './components'
import { BasicInfoForm, ColumInfoForm, GenerateInfoForm } from './components' import { getCodegenTableApi, updateCodegenTableApi } from '@/api/infra/codegen'
import * as CodegenApi from '@/api/infra/codegen' import { CodegenTableVO, CodegenColumnVO, CodegenUpdateReqVO } from '@/api/infra/codegen/types'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const { push, currentRoute } = useRouter() // const { push } = useRouter()
const { query } = useRoute() // const { query } = useRoute()
const { delView } = useTagsViewStore() // const loading = ref(false)
const title = ref('代码生成')
const formLoading = ref(false) // 12 const activeName = ref('basicInfo')
const activeName = ref('basicInfo') // Tag const cloumInfoRef = ref(null)
const tableCurrentRow = ref<CodegenTableVO>()
const cloumCurrentRow = ref<CodegenColumnVO[]>([])
const basicInfoRef = ref<ComponentRef<typeof BasicInfoForm>>() const basicInfoRef = ref<ComponentRef<typeof BasicInfoForm>>()
const columInfoRef = ref<ComponentRef<typeof ColumInfoForm>>()
const generateInfoRef = ref<ComponentRef<typeof GenerateInfoForm>>()
const formData = ref<CodegenApi.CodegenUpdateReqVO>({
table: {},
columns: []
})
/** 获得详情 */ const getList = async () => {
const getDetail = async () => {
const id = query.id as unknown as number const id = query.id as unknown as number
if (!id) { if (id) {
return //
} const res = await getCodegenTableApi(id)
formLoading.value = true title.value = '修改[ ' + res.table.tableName + ' ]生成配置'
try { tableCurrentRow.value = res.table
formData.value = await CodegenApi.getCodegenTable(id) cloumCurrentRow.value = res.columns
} finally {
formLoading.value = false
} }
} }
/** 提交按钮 */
const submitForm = async () => { const submitForm = async () => {
// const basicInfo = unref(basicInfoRef)
if (!unref(formData)) return const basicForm = await basicInfo?.elFormRef?.validate()?.catch(() => {})
await unref(basicInfoRef)?.validate() if (basicForm) {
await unref(generateInfoRef)?.validate() const basicInfoData = (await basicInfo?.getFormData()) as CodegenTableVO
try { const genTable: CodegenUpdateReqVO = {
// table: basicInfoData,
await CodegenApi.updateCodegenTable(formData.value) columns: cloumCurrentRow.value
}
await updateCodegenTableApi(genTable)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
close() push('/infra/codegen')
} catch {} }
} }
/** 关闭按钮 */
const close = () => {
delView(unref(currentRoute))
push('/infra/codegen')
}
/** 初始化 */
onMounted(() => { onMounted(() => {
getDetail() getList()
}) })
</script> </script>

View File

@ -0,0 +1,53 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
const { t } = useI18n() // 国际化
// 表单校验
export const rules = reactive({
title: [required],
type: [required],
status: [required]
})
// CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
action: true,
actionWidth: '400px',
columns: [
{
title: '表名称',
field: 'tableName',
isSearch: true
},
{
title: '表描述',
field: 'tableComment',
isSearch: true
},
{
title: '实体',
field: 'className',
isSearch: true
},
{
title: t('common.createTime'),
field: 'createTime',
formatter: 'formatDate',
isForm: false,
search: {
show: true,
itemRender: {
name: 'XDataTimePicker'
}
}
},
{
title: t('common.updateTime'),
field: 'updateTime',
formatter: 'formatDate',
isForm: false
}
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -1,85 +1,183 @@
<template> <template>
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px"> <Form :rules="rules" @register="register" />
<el-row>
<el-col :span="12">
<el-form-item label="表名称" prop="tableName">
<el-input placeholder="请输入仓库名称" v-model="formData.tableName" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="表描述" prop="tableComment">
<el-input placeholder="请输入" v-model="formData.tableComment" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="className">
<template #label>
<span>
实体类名称
<el-tooltip
content="默认去除表名的前缀。如果存在重复,则需要手动添加前缀,避免 MyBatis 报 Alias 重复的问题。"
placement="top"
>
<Icon icon="ep:question-filled" class="" />
</el-tooltip>
</span>
</template>
<el-input placeholder="请输入" v-model="formData.className" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="作者" prop="author">
<el-input placeholder="请输入" v-model="formData.author" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input type="textarea" :rows="3" v-model="formData.remark" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import * as CodegenApi from '@/api/infra/codegen' import { useForm } from '@/hooks/web/useForm'
import { FormSchema } from '@/types/form'
import { CodegenTableVO } from '@/api/infra/codegen/types'
import { getIntDictOptions } from '@/utils/dict'
import { listSimpleMenusApi } from '@/api/system/menu'
import { handleTree, defaultProps } from '@/utils/tree'
import { PropType } from 'vue' import { PropType } from 'vue'
const props = defineProps({ const props = defineProps({
table: { basicInfo: {
type: Object as PropType<Nullable<CodegenApi.CodegenTableVO>>, type: Object as PropType<Nullable<CodegenTableVO>>,
default: () => null default: () => null
} }
}) })
const formRef = ref() const templateTypeOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)
const formData = ref({ const sceneOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)
tableName: '', const menuOptions = ref<any>([]) //
tableComment: '', const getTree = async () => {
className: '', const res = await listSimpleMenusApi()
author: '', menuOptions.value = handleTree(res)
remark: '' }
})
const rules = reactive({ const rules = reactive({
tableName: [required], tableName: [required],
tableComment: [required], tableComment: [required],
className: [required], className: [required],
author: [required] author: [required],
templateType: [required],
scene: [required],
moduleName: [required],
businessName: [required],
businessPackage: [required],
classComment: [required]
})
const schema = reactive<FormSchema[]>([
{
label: '上级菜单',
field: 'parentMenuId',
component: 'TreeSelect',
componentProps: {
data: menuOptions,
props: defaultProps,
checkStrictly: true,
nodeKey: 'id'
},
labelMessage: '分配到指定菜单下,例如 系统管理',
colProps: {
span: 24
}
},
{
label: '表名称',
field: 'tableName',
component: 'Input',
colProps: {
span: 12
}
},
{
label: '表描述',
field: 'tableComment',
component: 'Input',
colProps: {
span: 12
}
},
{
label: '实体类名称',
field: 'className',
component: 'Input',
colProps: {
span: 12
}
},
{
label: '类名称',
field: 'className',
component: 'Input',
labelMessage: '类名称首字母大写例如SysUser、SysMenu、SysDictData 等等',
colProps: {
span: 12
}
},
{
label: '生成模板',
field: 'templateType',
component: 'Select',
componentProps: {
options: templateTypeOptions
},
colProps: {
span: 12
}
},
{
label: '生成场景',
field: 'scene',
component: 'Select',
componentProps: {
options: sceneOptions
},
colProps: {
span: 12
}
},
{
label: '模块名',
field: 'moduleName',
component: 'Input',
labelMessage: '模块名,即一级目录,例如 system、infra、tool 等等',
colProps: {
span: 12
}
},
{
label: '业务名',
field: 'businessName',
component: 'Input',
labelMessage: '业务名,即二级目录,例如 user、permission、dict 等等',
colProps: {
span: 12
}
},
{
label: '类描述',
field: 'classComment',
component: 'Input',
labelMessage: '用作类描述,例如 用户',
colProps: {
span: 12
}
},
{
label: '作者',
field: 'author',
component: 'Input',
colProps: {
span: 12
}
},
{
label: '备注',
field: 'remark',
component: 'Input',
componentProps: {
type: 'textarea',
rows: 4
},
colProps: {
span: 24
}
}
])
const { register, methods, elFormRef } = useForm({
schema
}) })
/** 监听 table 属性,复制给 formData 属性 */
watch( watch(
() => props.table, () => props.basicInfo,
(table) => { (basicInfo) => {
if (!table) return if (!basicInfo) return
formData.value = table const { setValues } = methods
setValues(basicInfo)
}, },
{ {
deep: true, deep: true,
immediate: true immediate: true
} }
) )
// ========== ==========
onMounted(async () => {
await getTree()
})
defineExpose({ defineExpose({
validate: async () => unref(formRef)?.validate() elFormRef,
getFormData: methods.getFormData
}) })
</script> </script>

View File

@ -0,0 +1,137 @@
<template>
<vxe-table
ref="dragTable"
border
:data="info"
max-height="600"
stripe
class="xtable-scrollbar"
:column-config="{ resizable: true }"
>
<vxe-column title="字段列名" field="columnName" fixed="left" width="10%" />
<vxe-colgroup title="基础属性">
<vxe-column title="字段描述" field="columnComment" width="10%">
<template #default="{ row }">
<vxe-input v-model="row.columnComment" placeholder="请输入字段描述" />
</template>
</vxe-column>
<vxe-column title="物理类型" field="dataType" width="10%" />
<vxe-column title="Java类型" width="10%" field="javaType">
<template #default="{ row }">
<vxe-select v-model="row.javaType" placeholder="请选择Java类型">
<vxe-option label="Long" value="Long" />
<vxe-option label="String" value="String" />
<vxe-option label="Integer" value="Integer" />
<vxe-option label="Double" value="Double" />
<vxe-option label="BigDecimal" value="BigDecimal" />
<vxe-option label="LocalDateTime" value="LocalDateTime" />
<vxe-option label="Boolean" value="Boolean" />
</vxe-select>
</template>
</vxe-column>
<vxe-column title="java属性" width="8%" field="javaField">
<template #default="{ row }">
<vxe-input v-model="row.javaField" placeholder="请输入java属性" />
</template>
</vxe-column>
</vxe-colgroup>
<vxe-colgroup title="增删改查">
<vxe-column title="插入" width="40px" field="createOperation">
<template #default="{ row }">
<vxe-checkbox true-label="true" false-label="false" v-model="row.createOperation" />
</template>
</vxe-column>
<vxe-column title="编辑" width="40px" field="updateOperation">
<template #default="{ row }">
<vxe-checkbox true-label="true" false-label="false" v-model="row.updateOperation" />
</template>
</vxe-column>
<vxe-column title="列表" width="40px" field="listOperationResult">
<template #default="{ row }">
<vxe-checkbox true-label="true" false-label="false" v-model="row.listOperationResult" />
</template>
</vxe-column>
<vxe-column title="查询" width="40px" field="listOperation">
<template #default="{ row }">
<vxe-checkbox true-label="true" false-label="false" v-model="row.listOperation" />
</template>
</vxe-column>
<vxe-column title="允许空" width="40px" field="nullable">
<template #default="{ row }">
<vxe-checkbox true-label="true" false-label="false" v-model="row.nullable" />
</template>
</vxe-column>
<vxe-column title="查询方式" width="60px" field="listOperationCondition">
<template #default="{ row }">
<vxe-select v-model="row.listOperationCondition" placeholder="请选择查询方式">
<vxe-option label="=" value="=" />
<vxe-option label="!=" value="!=" />
<vxe-option label=">" value=">" />
<vxe-option label=">=" value=">=" />
<vxe-option label="<" value="<>" />
<vxe-option label="<=" value="<=" />
<vxe-option label="LIKE" value="LIKE" />
<vxe-option label="BETWEEN" value="BETWEEN" />
</vxe-select>
</template>
</vxe-column>
</vxe-colgroup>
<vxe-column title="显示类型" width="10%" field="htmlType">
<template #default="{ row }">
<vxe-select v-model="row.htmlType" placeholder="请选择显示类型">
<vxe-option label="文本框" value="input" />
<vxe-option label="文本域" value="textarea" />
<vxe-option label="下拉框" value="select" />
<vxe-option label="单选框" value="radio" />
<vxe-option label="复选框" value="checkbox" />
<vxe-option label="日期控件" value="datetime" />
<vxe-option label="图片上传" value="imageUpload" />
<vxe-option label="文件上传" value="fileUpload" />
<vxe-option label="富文本控件" value="editor" />
</vxe-select>
</template>
</vxe-column>
<vxe-column title="字典类型" width="10%" field="dictType">
<template #default="{ row }">
<vxe-select v-model="row.dictType" clearable filterable placeholder="请选择字典类型">
<vxe-option
v-for="dict in dictOptions"
:key="dict.id"
:label="dict.name"
:value="dict.type"
/>
</vxe-select>
</template>
</vxe-column>
<vxe-column title="示例" field="example">
<template #default="{ row }">
<vxe-input v-model="row.example" placeholder="请输入示例" />
</template>
</vxe-column>
</vxe-table>
</template>
<script setup lang="ts">
import { PropType } from 'vue'
import { DictTypeVO } from '@/api/system/dict/types'
import { CodegenColumnVO } from '@/api/infra/codegen/types'
import { listSimpleDictTypeApi } from '@/api/system/dict/dict.type'
const props = defineProps({
info: {
type: Array as unknown as PropType<CodegenColumnVO[]>,
default: () => null
}
})
/** 查询字典下拉列表 */
const dictOptions = ref<DictTypeVO[]>()
const getDictOptions = async () => {
const res = await listSimpleDictTypeApi()
dictOptions.value = res
}
onMounted(async () => {
await getDictOptions()
})
defineExpose({
info: props.info
})
</script>

View File

@ -0,0 +1,125 @@
<template>
<!-- 导入表 -->
<XModal title="导入表" v-model="visible">
<el-form :model="queryParams" ref="queryRef" :inline="true">
<el-form-item label="数据源" prop="dataSourceConfigId">
<el-select v-model="queryParams.dataSourceConfigId" placeholder="请选择数据源" clearable>
<el-option
v-for="config in dataSourceConfigs"
:key="config.id"
:label="config.name"
:value="config.id"
/>
</el-select>
</el-form-item>
<el-form-item label="表名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入表名称" clearable />
</el-form-item>
<el-form-item label="表描述" prop="comment">
<el-input v-model="queryParams.comment" placeholder="请输入表描述" clearable />
</el-form-item>
<el-form-item>
<XButton
type="primary"
preIcon="ep:search"
:title="t('common.query')"
@click="handleQuery()"
/>
<XButton preIcon="ep:refresh-right" :title="t('common.reset')" @click="resetQuery()" />
</el-form-item>
</el-form>
<vxe-table
ref="xTable"
:data="dbTableList"
v-loading="dbLoading"
:checkbox-config="{ highlight: true, range: true }"
height="260px"
class="xtable-scrollbar"
>
<vxe-column type="checkbox" width="60" />
<vxe-column field="name" title="表名称" />
<vxe-column field="comment" title="表描述" />
</vxe-table>
<template #footer>
<div class="dialog-footer">
<XButton type="primary" :title="t('action.import')" @click="handleImportTable()" />
<XButton :title="t('dialog.close')" @click="handleClose()" />
</div>
</template>
</XModal>
</template>
<script setup lang="ts">
import { VxeTableInstance } from 'vxe-table'
import type { DatabaseTableVO } from '@/api/infra/codegen/types'
import { getSchemaTableListApi, createCodegenListApi } from '@/api/infra/codegen'
import { getDataSourceConfigListApi, DataSourceConfigVO } from '@/api/infra/dataSourceConfig'
const { t } = useI18n() //
const message = useMessage() //
const emit = defineEmits(['ok'])
// ======== ========
const visible = ref(false)
const dbLoading = ref(true)
const queryParams = reactive({
name: undefined,
comment: undefined,
dataSourceConfigId: 0
})
const dataSourceConfigs = ref<DataSourceConfigVO[]>([])
const show = async () => {
const res = await getDataSourceConfigListApi()
dataSourceConfigs.value = res
queryParams.dataSourceConfigId = dataSourceConfigs.value[0].id
visible.value = true
await getList()
}
/** 查询表数据 */
const dbTableList = ref<DatabaseTableVO[]>([])
/** 查询表数据 */
const getList = async () => {
dbLoading.value = true
const res = await getSchemaTableListApi(queryParams)
dbTableList.value = res
dbLoading.value = false
}
//
const handleQuery = async () => {
await getList()
}
//
const resetQuery = async () => {
queryParams.name = undefined
queryParams.comment = undefined
queryParams.dataSourceConfigId = 0
await getList()
}
const xTable = ref<VxeTableInstance>()
/** 多选框选中数据 */
const tables = ref<string[]>([])
/** 导入按钮操作 */
const handleImportTable = async () => {
if (xTable.value?.getCheckboxRecords().length === 0) {
message.error('请选择要导入的表')
return
}
xTable.value?.getCheckboxRecords().forEach((item) => {
tables.value.push(item.name)
})
await createCodegenListApi({
dataSourceConfigId: queryParams.dataSourceConfigId,
tableNames: tables.value
})
message.success('导入成功')
emit('ok')
handleClose()
}
const handleClose = () => {
visible.value = false
tables.value = []
}
defineExpose({
show
})
</script>

View File

@ -0,0 +1,145 @@
<template>
<XModal title="预览" v-model="preview.open">
<div class="flex">
<el-card class="w-1/4" :gutter="12" shadow="hover">
<el-scrollbar height="calc(100vh - 88px - 40px - 50px)">
<el-tree
ref="treeRef"
node-key="id"
:data="preview.fileTree"
:expand-on-click-node="false"
highlight-current
@node-click="handleNodeClick"
/>
</el-scrollbar>
</el-card>
<el-card class="w-3/4 ml-3" :gutter="12" shadow="hover">
<el-tabs v-model="preview.activeName">
<el-tab-pane
v-for="item in previewCodegen"
:label="item.filePath.substring(item.filePath.lastIndexOf('/') + 1)"
:name="item.filePath"
:key="item.filePath"
>
<XTextButton style="float: right" :title="t('common.copy')" @click="copy(item.code)" />
<pre>{{ item.code }}</pre>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</XModal>
</template>
<script setup lang="ts">
import { useClipboard } from '@vueuse/core'
import { handleTree2 } from '@/utils/tree'
import { previewCodegenApi } from '@/api/infra/codegen'
import { CodegenTableVO, CodegenPreviewVO } from '@/api/infra/codegen/types'
const { t } = useI18n() //
const message = useMessage() //
// ======== ========
const preview = reactive({
open: false,
titel: '代码预览',
fileTree: [],
activeName: ''
})
const previewCodegen = ref<CodegenPreviewVO[]>()
const show = async (row: CodegenTableVO) => {
const res = await previewCodegenApi(row.id)
let file = handleFiles(res)
previewCodegen.value = res
preview.fileTree = handleTree2(file, 'id', 'parentId', 'children', '/')
preview.activeName = res[0].filePath
preview.open = true
}
const handleNodeClick = async (data, node) => {
if (node && !node.isLeaf) {
return false
}
preview.activeName = data.id
}
/** 生成 files 目录 **/
interface filesType {
id: string
label: string
parentId: string
}
const handleFiles = (datas: CodegenPreviewVO[]) => {
let exists = {} // keyfile idvaluetrue
let files: filesType[] = []
//
for (const data of datas) {
let paths = data.filePath.split('/')
let fullPath = '' // id
// java
if (paths[paths.length - 1].indexOf('.java') >= 0) {
let newPaths: string[] = []
for (let i = 0; i < paths.length; i++) {
let path = paths[i]
if (path !== 'java') {
newPaths.push(path)
continue
}
newPaths.push(path)
// package
let tmp = ''
while (i < paths.length) {
path = paths[i + 1]
if (
path === 'controller' ||
path === 'convert' ||
path === 'dal' ||
path === 'enums' ||
path === 'service' ||
path === 'vo' || //
path === 'mysql' ||
path === 'dataobject'
) {
break
}
tmp = tmp ? tmp + '.' + path : path
i++
}
if (tmp) {
newPaths.push(tmp)
}
}
paths = newPaths
}
// path
for (let i = 0; i < paths.length; i++) {
// files
let oldFullPath = fullPath
// replaceAll tabs replaceAll
fullPath = fullPath.length === 0 ? paths[i] : fullPath.replaceAll('.', '/') + '/' + paths[i]
if (exists[fullPath]) {
continue
}
// files
exists[fullPath] = true
files.push({
id: fullPath,
label: paths[i],
parentId: oldFullPath || '/' // "/" 为根节点
})
}
}
return files
}
/** 复制 **/
const copy = async (text: string) => {
const { copy, copied, isSupported } = useClipboard({ source: text })
if (!isSupported.value) {
message.error(t('common.copyError'))
} else {
await copy()
if (unref(copied.value)) {
message.success(t('common.copySuccess'))
}
}
}
defineExpose({
show
})
</script>

Some files were not shown because too many files have changed in this diff Show More