类型优化

This commit is contained in:
xiangheng
2024-08-06 02:01:09 +08:00
parent 03d9aaea39
commit f0fe3f493f
16 changed files with 240 additions and 78 deletions

View File

@@ -10,6 +10,7 @@
"scss.validate": false,
"cSpell.words": [
"brotli",
"btns",
"datetimerange",
"echarts",
"execa",

View File

@@ -15,28 +15,28 @@
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"@highlightjs/vue-plugin": "^2.1.0",
"@logicflow/core": "^1.2.27",
"@logicflow/extension": "^1.2.27",
"@vue/shared": "^3.4.27",
"@vueuse/core": "^10.10.0",
"@logicflow/core": "^1.2.28",
"@logicflow/extension": "^1.2.28",
"@vue/shared": "^3.4.35",
"@vueuse/core": "^10.11.0",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
"axios": "^1.7.2",
"crypto-js": "^4.2.0",
"css-color-function": "^1.3.3",
"dayjs": "^1.11.11",
"echarts": "^5.5.0",
"element-plus": "^2.7.5",
"highlight.js": "^11.9.0",
"dayjs": "^1.11.12",
"echarts": "^5.5.1",
"element-plus": "^2.7.8",
"highlight.js": "^11.10.0",
"lodash-es": "^4.17.21",
"nprogress": "^0.2.0",
"pinia": "^2.1.7",
"query-string": "^9.0.0",
"pinia": "^2.2.0",
"query-string": "^9.1.0",
"vform3-builds": "^3.0.10",
"vue": "^3.4.27",
"vue": "^3.4.35",
"vue-clipboard3": "^2.0.0",
"vue-echarts": "^6.7.3",
"vue-router": "^4.3.3",
"vue-router": "^4.4.2",
"vue3-video-play": "^1.3.2",
"vuedraggable": "^4.1.0"
},
@@ -45,7 +45,7 @@
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.14.2",
"@types/nprogress": "^0.2.3",
"@vitejs/plugin-vue": "^5.0.5",
"@vitejs/plugin-vue": "^5.1.2",
"@vitejs/plugin-vue-jsx": "^4.0.0",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
@@ -56,17 +56,17 @@
"execa": "^9.2.0",
"fs-extra": "^11.2.0",
"postcss": "^8.4.38",
"prettier": "^3.3.1",
"prettier": "^3.3.3",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.77.4",
"tailwindcss": "^3.4.4",
"typescript": "~5.4.5",
"unplugin-auto-import": "^0.17.6",
"unplugin-vue-components": "^0.27.0",
"vite": "^5.2.13",
"sass": "^1.77.8",
"tailwindcss": "^3.4.7",
"typescript": "~5.5.4",
"unplugin-auto-import": "^0.17.8",
"unplugin-vue-components": "^0.27.3",
"vite": "^5.3.5",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-style-import": "^2.0.0",
"vite-plugin-svg-icons": "^2.0.1",
"vue-tsc": "^2.0.21"
"vue-tsc": "^2.0.29"
}
}

View File

@@ -1,26 +1,83 @@
import request from '@/utils/request'
import type { Pages } from '@/utils/request'
export type type_flow_apply = {
id?: number
templateId?: number
applyUserId?: number
applyUserNickname?: string
flowName?: string
flowGroup?: number
flowRemark?: string
flowFormData?: string
flowProcessData?: string
flowProcessDataList?: string
formValue?: string
status?: number
isDelete?: number
createTime?: string
updateTime?: string
deleteTime?: string
}
// 查询
export type type_flow_apply_query = {
templateId?: number
applyUserId?: number
applyUserNickname?: string
flowName?: string
flowGroup?: number
flowRemark?: string
flowFormData?: string
flowProcessData?: string
flowProcessDataList?: string
formValue?: string
status?: number
createTimeStart?: string
createTimeEnd?: string
updateTimeStart?: string
updateTimeEnd?: string
}
// 添加编辑
export type type_flow_apply_edit = {
id?: number
templateId?: number
applyUserId?: number
applyUserNickname?: string
flowName?: string
flowGroup?: number
flowRemark?: string
flowFormData?: string
flowProcessData?: string
flowProcessDataList?: string
formValue?: string
status?: number
}
// 申请流程列表
export function flow_apply_lists(params?: Record<string, any>) {
return request.get({ url: '/flow/flow_apply/list', params })
export function flow_apply_lists(params?: type_flow_apply_query) {
return request.get<Pages<type_flow_apply>>({ url: '/flow/flow_apply/list', params })
}
// 申请流程列表-所有
export function flow_apply_list_all(params?: type_flow_apply_query) {
return request.get<Pages<type_flow_apply>>({ url: '/flow/flow_apply/listAll', params })
}
// 申请流程详情
export function flow_apply_detail(params: Record<string, any>) {
return request.get({ url: '/flow/flow_apply/detail', params })
return request.get<type_flow_apply>({ url: '/flow/flow_apply/detail', params: params })
}
// 申请流程新增
export function flow_apply_add(data: Record<string, any>) {
return request.post({ url: '/flow/flow_apply/add', data })
export function flow_apply_add(data: type_flow_apply_edit) {
return request.post<null>({ url: '/flow/flow_apply/add', data })
}
// 申请流程编辑
export function flow_apply_edit(data: Record<string, any>) {
return request.post({ url: '/flow/flow_apply/edit', data })
export function flow_apply_edit(data: type_flow_apply_edit) {
return request.post<null>({ url: '/flow/flow_apply/edit', data })
}
// 申请流程删除
export function flow_apply_delete(data: Record<string, any>) {
return request.post({ url: '/flow/flow_apply/del', data })
export function flow_apply_delete(id: number | string) {
return request.post<null>({ url: '/flow/flow_apply/del', data: { id } })
}

View File

@@ -1,32 +1,87 @@
import request from '@/utils/request/index'
import type { Pages } from '@/utils/request'
export type type_flow_history = {
id?: number
applyId?: number
templateId?: number
applyUserId?: number
applyUserNickname?: string
approverId?: number
approverNickname?: string
nodeId?: string
nodeType?: string
nodeLabel?: string
formValue?: string
passStatus?: number
passRemark?: string
createTime?: string
updateTime?: string
deleteTime?: string
}
// 查询
export type type_flow_history_query = {
applyId?: number
templateId?: number
applyUserId?: number
applyUserNickname?: string
approverId?: number
approverNickname?: string
nodeId?: string
nodeType?: string
nodeLabel?: string
formValue?: string
passStatus?: number
passRemark?: string
createTimeStart?: string
createTimeEnd?: string
updateTimeStart?: string
updateTimeEnd?: string
}
// 添加编辑
export type type_flow_history_edit = {
id?: number
applyId?: number
templateId?: number
applyUserId?: number
applyUserNickname?: string
approverId?: number
approverNickname?: string
nodeId?: string
nodeType?: string
nodeLabel?: string
formValue?: string
passStatus?: number
passRemark?: string
}
// 流程历史列表
export function flow_history_list(params?: Record<string, any>) {
return request.get({ url: '/flow/flow_history/list', params })
export function flow_history_list(params?: type_flow_history_query) {
return request.get<Pages<type_flow_history>>({ url: '/flow/flow_history/list', params })
}
// 流程历史列表-所有
export function flow_history_list_all(params?: Record<string, any>) {
return request.get({ url: '/flow/flow_history/listAll', params })
export function flow_history_list_all(params?: type_flow_history_query) {
return request.get<Pages<type_flow_history>>({ url: '/flow/flow_history/listAll', params })
}
// 流程历史详情
export function flow_history_detail(params: Record<string, any>) {
return request.get({ url: '/flow/flow_history/detail', params })
export function flow_history_detail(id: number | string) {
return request.get<type_flow_history>({ url: '/flow/flow_history/detail', params: { id } })
}
// 流程历史新增
export function flow_history_add(data: Record<string, any>) {
return request.post({ url: '/flow/flow_history/add', data })
export function flow_history_add(data: type_flow_history_edit) {
return request.post<null>({ url: '/flow/flow_history/add', data })
}
// 流程历史编辑
export function flow_history_edit(data: Record<string, any>) {
return request.post({ url: '/flow/flow_history/edit', data })
export function flow_history_edit(data: type_flow_history_edit) {
return request.post<null>({ url: '/flow/flow_history/edit', data })
}
// 流程历史删除
export function flow_history_delete(data: Record<string, any>) {
return request.post({ url: '/flow/flow_history/del', data })
export function flow_history_delete(id: number | string) {
return request.post<null>({ url: '/flow/flow_history/del', data: { id } })
}
// 获取下一个审批节点,中间可能有系统任务和结束节点被跳过

View File

@@ -1,31 +1,68 @@
import request from '@/utils/request'
import type { Pages } from '@/utils/request'
// 流程模板列表
export function flow_template_lists(params?: Record<string, any>) {
return request.get({ url: '/flow/flow_template/list', params })
export type type_flow_template = {
id?: number
flowName?: string
flowGroup?: number
flowRemark?: string
flowFormData?: string
flowProcessData?: string
flowProcessDataList?: string
isDelete?: number
createTime?: string
updateTime?: string
deleteTime?: string
}
// 查询
export type type_flow_template_query = {
flowName?: string
flowGroup?: number
flowRemark?: string
flowFormData?: string
flowProcessData?: string
flowProcessDataList?: string
createTimeStart?: string
createTimeEnd?: string
updateTimeStart?: string
updateTimeEnd?: string
}
// 添加编辑
export type type_flow_template_edit = {
id?: number
flowName?: string
flowGroup?: number
flowRemark?: string
flowFormData?: string
flowProcessData?: string
flowProcessDataList?: string
}
// 流程模板列表
export function flow_template_lists(params?: type_flow_template_query) {
return request.get<Pages<type_flow_template>>({ url: '/flow/flow_template/list', params })
}
// 流程模板列表-所有
export function flow_template_lists_all(params?: Record<string, any>) {
return request.get({ url: '/flow/flow_template/listAll', params })
export function flow_template_lists_all(params?: type_flow_template_query) {
return request.get<type_flow_template[]>({ url: '/flow/flow_template/listAll', params })
}
// 流程模板详情
export function flow_template_detail(params: Record<string, any>) {
return request.get({ url: '/flow/flow_template/detail', params })
export function flow_template_detail(id: number | string) {
return request.get<type_flow_template>({ url: '/flow/flow_template/detail', params: { id } })
}
// 流程模板新增
export function flow_template_add(data: Record<string, any>) {
return request.post({ url: '/flow/flow_template/add', data })
export function flow_template_add(data: type_flow_template_edit) {
return request.post<null>({ url: '/flow/flow_template/add', data })
}
// 流程模板编辑
export function flow_template_edit(data: Record<string, any>) {
return request.post({ url: '/flow/flow_template/edit', data })
export function flow_template_edit(data: type_flow_template_edit) {
return request.post<null>({ url: '/flow/flow_template/edit', data })
}
// 流程模板删除
export function flow_template_delete(data: Record<string, any>) {
return request.post({ url: '/flow/flow_template/del', data })
export function flow_template_delete(id: number | string) {
return request.post<null>({ url: '/flow/flow_template/del', data: { id } })
}

View File

@@ -38,6 +38,7 @@
import type { FormInstance } from 'element-plus'
import { flow_apply_edit, flow_apply_add, flow_apply_detail } from '@/api/flow/flow_apply'
import { flow_template_lists_all } from '@/api/flow/flow_template'
import type { type_flow_template } from '@/api/flow/flow_template'
import Popup from '@/components/popup/index.vue'
import feedback from '@/utils/feedback'
@@ -143,7 +144,7 @@ const formRules = {
}
]
}
const flow_template = ref([])
const flow_template = ref<type_flow_template[]>([])
const get_flow_template = async () => {
flow_template.value = await flow_template_lists_all()
}

View File

@@ -107,6 +107,7 @@ import {
flow_apply_edit,
flow_apply_detail
} from '@/api/flow/flow_apply'
import type { type_flow_apply } from '@/api/flow/flow_apply'
import { useDictData } from '@/hooks/useDictOptions'
import { usePaging } from '@/hooks/usePaging'
@@ -131,7 +132,7 @@ const queryParams = reactive({
status: '3'
})
const { pager, getLists, resetPage, resetParams } = usePaging({
const { pager, getLists, resetPage, resetParams } = usePaging<type_flow_apply>({
fetchFun: flow_apply_lists,
params: queryParams
})
@@ -142,7 +143,7 @@ const { dictData } = useDictData<{
const handleDelete = async (id: number) => {
await feedback.confirm('确定要删除?')
await flow_apply_delete({ id })
await flow_apply_delete(id)
feedback.msgSuccess('删除成功')
getLists()
}

View File

@@ -143,7 +143,10 @@ import {
flow_apply_detail
} from '@/api/flow/flow_apply'
import type { type_flow_apply } from '@/api/flow/flow_apply'
import { useDictData } from '@/hooks/useDictOptions'
import type { type_dict } from '@/hooks/useDictOptions'
import { usePaging } from '@/hooks/usePaging'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
@@ -174,13 +177,13 @@ const queryParams = reactive({
status: ''
})
const { pager, getLists, resetPage, resetParams } = usePaging<any>({
const { pager, getLists, resetPage, resetParams } = usePaging<type_flow_apply>({
fetchFun: flow_apply_lists,
params: queryParams
})
const { dictData } = useDictData<{
flow_apply_status: any[]
flow_group: any[]
flow_apply_status: type_dict[]
flow_group: type_dict[]
}>(['flow_apply_status', 'flow_group'])
const handleAdd = async () => {
@@ -198,7 +201,7 @@ const handleAdd = async () => {
const handleDelete = async (id: number) => {
await feedback.confirm('确定要删除?')
await flow_apply_delete({ id })
await flow_apply_delete(id)
feedback.msgSuccess('删除成功')
getLists()
}

View File

@@ -73,6 +73,8 @@
<script lang="ts" setup>
import { flow_apply_detail } from '@/api/flow/flow_apply'
import { flow_history_list } from '@/api/flow/flow_history'
import type { type_flow_apply } from '@/api/flow/flow_apply'
import { useDictData } from '@/hooks/useDictOptions'
import { usePaging } from '@/hooks/usePaging'
import useUserStore from '@/stores/modules/user'
@@ -82,7 +84,7 @@ import ViewForm from './components/ViewForm.vue'
const userStore = useUserStore()
defineOptions({
name: 'todo'
name: 'done'
})
const ApproveRef = shallowRef<InstanceType<typeof ApproveRef>>()
const viewFormRef = shallowRef<InstanceType<typeof ViewForm>>()
@@ -95,7 +97,7 @@ const queryParams = reactive({
passStatus: 2
})
const { pager, getLists, resetPage, resetParams } = usePaging({
const { pager, getLists, resetPage, resetParams } = usePaging<type_flow_apply>({
fetchFun: flow_history_list,
params: queryParams
})

View File

@@ -71,6 +71,7 @@
<script lang="ts" setup>
import { flow_apply_detail } from '@/api/flow/flow_apply'
import { flow_history_list, flow_history_edit } from '@/api/flow/flow_history'
import type { type_flow_history } from '@/api/flow/flow_history'
import { useDictData } from '@/hooks/useDictOptions'
import { usePaging } from '@/hooks/usePaging'
import feedback from '@/utils/feedback'
@@ -94,7 +95,7 @@ const queryParams = reactive({
passStatus: 1
})
const { pager, getLists, resetPage, resetParams } = usePaging({
const { pager, getLists, resetPage, resetParams } = usePaging<type_flow_history>({
fetchFun: flow_history_list,
params: queryParams
})

View File

@@ -134,9 +134,7 @@ const setFormData = async (data: Record<string, any>) => {
}
const getDetail = async (row: Record<string, any>) => {
const data = await flow_template_detail({
id: row.id
})
const data = await flow_template_detail(row.id)
setFormData(data)
}

View File

@@ -137,7 +137,7 @@ const handleAdd = async () => {
const handleDelete = async (id: number) => {
await feedback.confirm('确定要删除?')
await flow_template_delete({ id })
await flow_template_delete(id)
feedback.msgSuccess('删除成功')
getLists()
}

View File

@@ -123,9 +123,7 @@ const route = useRoute()
defineOptions({
name: 'monitor_web'
})
// const { dictData } = useDictData<{
// project_type: any[]
// }>(['project_type'])
const { optionsData: listAllData } = useDictOptions<{
monitor_project_list_all: any[]
}>({
@@ -133,8 +131,6 @@ const { optionsData: listAllData } = useDictOptions<{
api: monitor_project_list_all
}
})
console.log('listAllData', listAllData)
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const showEdit = ref(false)
const queryParams = reactive({

View File

@@ -20,6 +20,17 @@
}
],
"settings": {
"liveServer.settings.multiRootWorkspaceName": "admin"
"liveServer.settings.multiRootWorkspaceName": "admin",
"editor.gotoLocation.alternativeDeclarationCommand": "editor.action.revealDefinition",
"editor.gotoLocation.alternativeDefinitionCommand": "editor.action.revealDefinition",
"editor.gotoLocation.alternativeTypeDefinitionCommand": "editor.action.revealDefinition",
"editor.selectionHighlight": false,
"files.autoSave": "onFocusChange",
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.quickSuggestions": {
"other": "on",
"comments": "off",
"strings": "on"
}
}
}

View File

@@ -38,7 +38,7 @@ export function {{{.ModuleName}}}_list(params?: type_{{{.ModuleName}}}_query) {
}
// {{{.FunctionName}}}列表-所有
export function {{{.ModuleName}}}_list_all(params?: type_{{{.ModuleName}}}_query) {
return request.get<Pages<type_{{{.ModuleName}}}>>({ url: '/{{{.ModuleName}}}/listAll', params })
return request.get<type_{{{.ModuleName}}}[]>({ url: '/{{{.ModuleName}}}/listAll', params })
}
// {{{.FunctionName}}}详情

View File

@@ -94,8 +94,7 @@ func (service systemAuthPermService) BatchSaveByMenuIds(roleId uint, menuIds str
perms = append(perms, system_model.SystemAuthPerm{ID: util.ToolsUtil.MakeUuid(), RoleId: roleId, MenuId: uint(menuId)})
}
txErr := tx.Create(&perms).Error
var te error
te = response.CheckErr(txErr, "BatchSaveByMenuIds Create in tx err")
var te = response.CheckErr(txErr, "BatchSaveByMenuIds Create in tx err")
return te
})
e = response.CheckErr(err, "BatchSaveByMenuIds Transaction err")