!235 vue3:新增部分BPM页面 重构代码生成

Merge pull request !235 from xingyu/master
pull/2/head
芋道源码 2022-07-28 15:19:14 +00:00 committed by Gitee
commit afeca650aa
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
28 changed files with 1157 additions and 645 deletions

View File

@ -2,20 +2,20 @@ import { useAxios } from '@/hooks/web/useAxios'
import { ModelVO } from './types'
const request = useAxios()
export const getModelPage = async (params) => {
export const getModelPageApi = async (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 })
}
export const updateModel = async (data: ModelVO) => {
export const updateModelApi = async (data: ModelVO) => {
return await request.put({ url: '/bpm/model/update', data: data })
}
// 任务状态修改
export const updateModelState = async (id: number, state: string) => {
export const updateModelStateApi = async (id: number, state: number) => {
const data = {
id: id,
state: state
@ -23,14 +23,14 @@ export const updateModelState = async (id: number, state: string) => {
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 })
}
export const deleteModel = async (id: number) => {
export const deleteModelApi = async (id: number) => {
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 })
}

View File

@ -1,3 +1,10 @@
export type ProcessDefinitionVO = {
id: string
version: number
deploymentTIme: string
suspensionState: number
}
export type ModelVO = {
id: number
formName: string
@ -9,6 +16,7 @@ export type ModelVO = {
formId: number
formCustomCreatePath: string
formCustomViewPath: string
processDefinition: ProcessDefinitionVO
status: number
remark: string
createTime: string

View File

@ -2,15 +2,15 @@ import { useAxios } from '@/hooks/web/useAxios'
import { ProcessInstanceVO } from './types'
const request = useAxios()
export const getMyProcessInstancePage = async (params) => {
export const getMyProcessInstancePageApi = async (params) => {
return await request.get({ url: '/bpm/process-instance/my-page', params })
}
export const createProcessInstance = async (data: ProcessInstanceVO) => {
export const createProcessInstanceApi = async (data: ProcessInstanceVO) => {
return await request.post({ url: '/bpm/process-instance/create', data: data })
}
export const cancelProcessInstance = async (id: number, reason: string) => {
export const cancelProcessInstanceApi = async (id: number, reason: string) => {
const data = {
id: id,
reason: reason
@ -18,6 +18,6 @@ export const cancelProcessInstance = async (id: number, reason: string) => {
return await request.delete({ url: '/bpm/process-instance/cancel', data: data })
}
export const getProcessInstance = async (id: number) => {
export const getProcessInstanceApi = async (id: number) => {
return await request.get({ url: '/bpm/process-instance/get?id=' + id })
}

View File

@ -1,5 +1,5 @@
import { useAxios } from '@/hooks/web/useAxios'
import type { CodegenTableVO } from './types'
import type { CodegenUpdateReqVO, CodegenCreateListReqVO } from './types'
const request = useAxios()
@ -14,12 +14,12 @@ export const getCodegenTableApi = (id: number) => {
}
// 新增代码生成表定义
export const createCodegenTableApi = (data: CodegenTableVO) => {
export const createCodegenTableApi = (data: CodegenCreateListReqVO) => {
return request.post({ url: '/infra/codegen/create', data })
}
// 修改代码生成表定义
export const updateCodegenTableApi = (data: CodegenTableVO) => {
export const updateCodegenTableApi = (data: CodegenUpdateReqVO) => {
return request.put({ url: '/infra/codegen/update', data })
}

View File

@ -1,5 +1,6 @@
export type CodegenTableVO = {
id: number
tableId: number
isParentMenuIdValid: boolean
dataSourceConfigId: number
scene: number
tableName: string
@ -49,3 +50,11 @@ export type CodegenPreviewVO = {
filePath: string
code: string
}
export type CodegenUpdateReqVO = {
table: CodegenTableVO
columns: CodegenColumnVO[]
}
export type CodegenCreateListReqVO = {
dataSourceConfigId: number
tableNames: string[]
}

View File

@ -0,0 +1,3 @@
import Crontab from './src/index.vue'
export { Crontab }

View File

@ -1,60 +1,6 @@
<template>
<el-form size="small">
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * ? / L W] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2"> </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
周期从
<el-input-number v-model="cycle01" :min="1" :max="30" /> -
<el-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 2" :max="31" />
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
<el-input-number v-model="average01" :min="1" :max="30" /> 号开始
<el-input-number v-model="average02" :min="1" :max="31 - average01 || 1" /> 日执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="5">
每月
<el-input-number v-model="workday" :min="1" :max="31" /> 号最近的那个工作日
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="6"> </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="7">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option v-for="item in 31" :key="item" :value="item">{{ item }}</el-option>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { ElForm, ElFormItem, ElRadio, ElSelect, ElOption, ElInputNumber } from 'element-plus'
const props = defineProps({
check: {
type: Function,
@ -172,3 +118,56 @@ watch(checkboxString, () => {
}
})
</script>
<template>
<el-form>
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * ? / L W] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2"> </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
周期从
<el-input-number v-model="cycle01" :min="1" :max="30" /> -
<el-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 2" :max="31" />
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
<el-input-number v-model="average01" :min="1" :max="30" /> 号开始
<el-input-number v-model="average02" :min="1" :max="31 - average01 || 1" /> 日执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="5">
每月
<el-input-number v-model="workday" :min="1" :max="31" /> 号最近的那个工作日
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="6"> </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="7">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option v-for="item in 31" :key="item" :value="item">{{ item }}</el-option>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>

View File

@ -1,45 +1,6 @@
<template>
<el-form size="small">
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * /] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2">
周期从
<el-input-number v-model="cycle01" :min="0" :max="22" /> -
<el-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 1" :max="23" /> 小时
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
<el-input-number v-model="average01" :min="0" :max="22" /> 小时开始
<el-input-number v-model="average02" :min="1" :max="23 - average01 || 0" /> 小时执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option v-for="item in 24" :key="item" :value="item - 1">{{ item - 1 }}</el-option>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { ElForm, ElFormItem, ElRadio, ElSelect, ElOption, ElInputNumber } from 'element-plus'
const props = defineProps({
check: {
type: Function,
@ -119,3 +80,41 @@ watch(radioValue, () => {
}
})
</script>
<template>
<el-form>
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * /] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2">
周期从
<el-input-number v-model="cycle01" :min="0" :max="22" /> -
<el-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 1" :max="23" /> 小时
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
<el-input-number v-model="average01" :min="0" :max="22" /> 小时开始
<el-input-number v-model="average02" :min="1" :max="23 - average01 || 0" /> 小时执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option v-for="item in 24" :key="item" :value="item - 1">{{ item - 1 }}</el-option>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>

View File

@ -0,0 +1,19 @@
import CrontabSecond from './second.vue'
import CrontabMin from './min.vue'
import CrontabHour from './hour.vue'
import CrontabDay from './day.vue'
import CrontabMonth from './month.vue'
import CrontabWeek from './week.vue'
import CrontabYear from './year.vue'
import CrontabResult from './result.vue'
export {
CrontabSecond,
CrontabMin,
CrontabHour,
CrontabDay,
CrontabMonth,
CrontabWeek,
CrontabYear,
CrontabResult
}

View File

@ -1,45 +1,6 @@
<template>
<el-form size="small">
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * /] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2">
周期从
<el-input-number v-model="cycle01" :min="0" :max="58" /> -
<el-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 1" :max="59" /> 分钟
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
<el-input-number v-model="average01" :min="0" :max="58" /> 分钟开始
<el-input-number v-model="average02" :min="1" :max="59 - average01 || 0" /> 分钟执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option v-for="item in 60" :key="item" :value="item - 1">{{ item - 1 }}</el-option>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { ElForm, ElFormItem, ElRadio, ElSelect, ElOption, ElInputNumber } from 'element-plus'
const props = defineProps({
check: {
type: Function,
@ -119,3 +80,41 @@ watch(radioValue, () => {
}
})
</script>
<template>
<el-form>
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * /] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2">
周期从
<el-input-number v-model="cycle01" :min="0" :max="58" /> -
<el-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 1" :max="59" /> 分钟
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
<el-input-number v-model="average01" :min="0" :max="58" /> 分钟开始
<el-input-number v-model="average02" :min="1" :max="59 - average01 || 0" /> 分钟执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option v-for="item in 60" :key="item" :value="item - 1">{{ item - 1 }}</el-option>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>

View File

@ -1,45 +1,6 @@
<template>
<el-form size="small">
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * /] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2">
周期从
<el-input-number v-model="cycle01" :min="1" :max="11" /> -
<el-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 2" :max="12" />
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
<el-input-number v-model="average01" :min="1" :max="11" /> 月开始
<el-input-number v-model="average02" :min="1" :max="12 - average01 || 0" /> 月月执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option v-for="item in 12" :key="item" :value="item">{{ item }}</el-option>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { ElForm, ElFormItem, ElRadio, ElSelect, ElOption, ElInputNumber } from 'element-plus'
const props = defineProps({
check: {
type: Function,
@ -119,3 +80,41 @@ watch(radioValue, () => {
}
})
</script>
<template>
<el-form>
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * /] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2">
周期从
<el-input-number v-model="cycle01" :min="1" :max="11" /> -
<el-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 2" :max="12" />
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
<el-input-number v-model="average01" :min="1" :max="11" /> 月开始
<el-input-number v-model="average02" :min="1" :max="12 - average01 || 0" /> 月月执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option v-for="item in 12" :key="item" :value="item">{{ item }}</el-option>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>

View File

@ -1,16 +1,4 @@
<template>
<div class="popup-result">
<p class="title">最近5次运行时间</p>
<ul class="popup-result-scroll">
<template v-if="isShow">
<li v-for="item in resultList" :key="item">{{ item }}</li>
</template>
<li v-else>...</li>
</ul>
</div>
</template>
<script lang="ts" setup>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
const props = defineProps({
@ -572,3 +560,14 @@ function checkDate(value) {
return value === format
}
</script>
<template>
<div class="popup-result">
<p class="title">最近5次运行时间</p>
<ul class="popup-result-scroll">
<template v-if="isShow">
<li v-for="item in resultList" :key="item">{{ item }}</li>
</template>
<li v-else>...</li>
</ul>
</div>
</template>

View File

@ -1,45 +1,6 @@
<template>
<el-form size="small">
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * /] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2">
周期从
<el-input-number v-model="cycle01" :min="0" :max="58" /> -
<el-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 1" :max="59" />
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
<el-input-number v-model="average01" :min="0" :max="58" /> 秒开始
<el-input-number v-model="average02" :min="1" :max="59 - average01 || 0" /> 秒执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option v-for="item in 60" :key="item" :value="item - 1">{{ item - 1 }}</el-option>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { ElForm, ElFormItem, ElRadio, ElSelect, ElOption, ElInputNumber } from 'element-plus'
const props = defineProps({
check: {
type: Function,
@ -119,3 +80,41 @@ watch(radioValue, () => {
}
})
</script>
<template>
<el-form>
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * /] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2">
周期从
<el-input-number v-model="cycle01" :min="0" :max="58" /> -
<el-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 1" :max="59" />
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
<el-input-number v-model="average01" :min="0" :max="58" /> 秒开始
<el-input-number v-model="average02" :min="1" :max="59 - average01 || 0" /> 秒执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option v-for="item in 60" :key="item" :value="item - 1">{{ item - 1 }}</el-option>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>

View File

@ -1,97 +1,6 @@
<template>
<el-form size="small">
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * ? / L #] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2"> </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
周期从星期
<el-select clearable v-model="cycle01">
<el-option
v-for="(item, index) of weekList"
:key="index"
:label="item.value"
:value="item.key"
:disabled="item.key === 1"
>{{ item.value }}</el-option
>
</el-select>
-
<el-select clearable v-model="cycle02">
<el-option
v-for="(item, index) of weekList"
:key="index"
:label="item.value"
:value="item.key"
:disabled="item.key < cycle01 && item.key !== 1"
>{{ item.value }}</el-option
>
</el-select>
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
<el-input-number v-model="average01" :min="1" :max="4" /> 周的星期
<el-select clearable v-model="average02">
<el-option
v-for="(item, index) of weekList"
:key="index"
:label="item.value"
:value="item.key"
>{{ item.value }}</el-option
>
</el-select>
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="5">
本月最后一个星期
<el-select clearable v-model="weekday">
<el-option
v-for="(item, index) of weekList"
:key="index"
:label="item.value"
:value="item.key"
>{{ item.value }}</el-option
>
</el-select>
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="6">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option
v-for="(item, index) of weekList"
:key="index"
:label="item.value"
:value="String(item.key)"
>{{ item.value }}</el-option
>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { ElForm, ElFormItem, ElRadio, ElSelect, ElOption, ElInputNumber } from 'element-plus'
const props = defineProps({
check: {
type: Function,
@ -222,3 +131,93 @@ watch(radioValue, () => {
}
})
</script>
<template>
<el-form>
<el-form-item>
<el-radio v-model="radioValue" :label="1"> [, - * ? / L #] </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="2"> </el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="3">
周期从星期
<el-select clearable v-model="cycle01">
<el-option
v-for="(item, index) of weekList"
:key="index"
:label="item.value"
:value="item.key"
:disabled="item.key === 1"
>{{ item.value }}</el-option
>
</el-select>
-
<el-select clearable v-model="cycle02">
<el-option
v-for="(item, index) of weekList"
:key="index"
:label="item.value"
:value="item.key"
:disabled="item.key < cycle01 && item.key !== 1"
>{{ item.value }}</el-option
>
</el-select>
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="4">
<el-input-number v-model="average01" :min="1" :max="4" /> 周的星期
<el-select clearable v-model="average02">
<el-option
v-for="(item, index) of weekList"
:key="index"
:label="item.value"
:value="item.key"
>{{ item.value }}</el-option
>
</el-select>
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="5">
本月最后一个星期
<el-select clearable v-model="weekday">
<el-option
v-for="(item, index) of weekList"
:key="index"
:label="item.value"
:value="item.key"
>{{ item.value }}</el-option
>
</el-select>
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model="radioValue" :label="6">
指定
<el-select
clearable
v-model="checkboxList"
placeholder="可多选"
multiple
style="width: 100%"
>
<el-option
v-for="(item, index) of weekList"
:key="index"
:label="item.value"
:value="String(item.key)"
>{{ item.value }}</el-option
>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>

View File

@ -1,53 +1,6 @@
<template>
<el-form size="small">
<el-form-item>
<el-radio label="1" v-model="radioValue"> [, - * /] </el-radio>
</el-form-item>
<el-form-item>
<el-radio label="2" v-model="radioValue"> </el-radio>
</el-form-item>
<el-form-item>
<el-radio label="3" v-model="radioValue">
周期从
<el-input-number v-model="cycle01" :min="fullYear" :max="2098" /> -
<el-input-number
v-model="cycle02"
:min="cycle01 ? cycle01 + 1 : fullYear + 1"
:max="2099"
/>
</el-radio>
</el-form-item>
<el-form-item>
<el-radio label="4" v-model="radioValue">
<el-input-number v-model="average01" :min="fullYear" :max="2098" /> 年开始
<el-input-number v-model="average02" :min="1" :max="2099 - average01 || fullYear" />
年执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio label="5" v-model="radioValue">
指定
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple>
<el-option
v-for="item in 9"
:key="item"
:value="item - 1 + fullYear"
:label="item - 1 + fullYear"
/>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue'
import { ElForm, ElFormItem, ElRadio, ElSelect, ElOption, ElInputNumber } from 'element-plus'
const props = defineProps({
check: {
type: Function,
@ -138,3 +91,49 @@ onMounted(() => {
average01.value = fullYear.value
})
</script>
<template>
<el-form>
<el-form-item>
<el-radio label="1" v-model="radioValue"> [, - * /] </el-radio>
</el-form-item>
<el-form-item>
<el-radio label="2" v-model="radioValue"> </el-radio>
</el-form-item>
<el-form-item>
<el-radio label="3" v-model="radioValue">
周期从
<el-input-number v-model="cycle01" :min="fullYear" :max="2098" /> -
<el-input-number
v-model="cycle02"
:min="cycle01 ? cycle01 + 1 : fullYear + 1"
:max="2099"
/>
</el-radio>
</el-form-item>
<el-form-item>
<el-radio label="4" v-model="radioValue">
<el-input-number v-model="average01" :min="fullYear" :max="2098" /> 年开始
<el-input-number v-model="average02" :min="1" :max="2099 - average01 || fullYear" />
年执行一次
</el-radio>
</el-form-item>
<el-form-item>
<el-radio label="5" v-model="radioValue">
指定
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple>
<el-option
v-for="item in 9"
:key="item"
:value="item - 1 + fullYear"
:label="item - 1 + fullYear"
/>
</el-select>
</el-radio>
</el-form-item>
</el-form>
</template>

View File

@ -1,126 +1,15 @@
<template>
<div>
<el-tabs type="border-card">
<el-tab-pane label="秒" v-if="shouldHide('second')">
<CrontabSecond
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronsecond"
/>
</el-tab-pane>
<el-tab-pane label="分钟" v-if="shouldHide('min')">
<CrontabMin
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronmin"
/>
</el-tab-pane>
<el-tab-pane label="小时" v-if="shouldHide('hour')">
<CrontabHour
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronhour"
/>
</el-tab-pane>
<el-tab-pane label="日" v-if="shouldHide('day')">
<CrontabDay
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronday"
/>
</el-tab-pane>
<el-tab-pane label="月" v-if="shouldHide('month')">
<CrontabMonth
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronmonth"
/>
</el-tab-pane>
<el-tab-pane label="周" v-if="shouldHide('week')">
<CrontabWeek
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronweek"
/>
</el-tab-pane>
<el-tab-pane label="年" v-if="shouldHide('year')">
<CrontabYear
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronyear"
/>
</el-tab-pane>
</el-tabs>
<div class="popup-main">
<div class="popup-result">
<p class="title">时间表达式</p>
<table>
<thead>
<th v-for="item of tabTitles" width="40" :key="item">{{ item }}</th>
<th>Cron 表达式</th>
</thead>
<tbody>
<td>
<span>{{ crontabValueObj.second }}</span>
</td>
<td>
<span>{{ crontabValueObj.min }}</span>
</td>
<td>
<span>{{ crontabValueObj.hour }}</span>
</td>
<td>
<span>{{ crontabValueObj.day }}</span>
</td>
<td>
<span>{{ crontabValueObj.month }}</span>
</td>
<td>
<span>{{ crontabValueObj.week }}</span>
</td>
<td>
<span>{{ crontabValueObj.year }}</span>
</td>
<td>
<span>{{ crontabValueString }}</span>
</td>
</tbody>
</table>
</div>
<CrontabResult :ex="crontabValueString" />
<div class="pop_btn">
<el-button size="small" type="primary" @click="submitFill"></el-button>
<el-button size="small" type="warning" @click="clearCron"></el-button>
<el-button size="small" @click="hidePopup"></el-button>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import CrontabSecond from './second.vue'
import CrontabMin from './min.vue'
import CrontabHour from './hour.vue'
import CrontabDay from './day.vue'
import CrontabMonth from './month.vue'
import CrontabWeek from './week.vue'
import CrontabYear from './year.vue'
import CrontabResult from './result.vue'
<script setup lang="ts">
import {
CrontabSecond,
CrontabMin,
CrontabHour,
CrontabDay,
CrontabMonth,
CrontabWeek,
CrontabYear,
CrontabResult
} from './components'
import { ElTabs, ElTabPane } from 'element-plus'
import { computed, defineEmits, defineProps, onMounted, Ref, ref, watch } from 'vue'
const cronsecond = ref(null)
@ -208,7 +97,7 @@ function updateCrontabValue(name, value, from) {
changeRadio(name, value)
}
}
//
function changeRadio(name, value) {
let arr = ['second', 'min', 'hour', 'month'],
refName = 'cron' + name,
@ -373,7 +262,119 @@ function clearCron() {
watch(() => props.expression, resolveExp)
</script>
<template>
<div>
<el-tabs type="border-card">
<el-tab-pane label="秒" v-if="shouldHide('second')">
<CrontabSecond
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronsecond"
/>
</el-tab-pane>
<el-tab-pane label="分钟" v-if="shouldHide('min')">
<CrontabMin
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronmin"
/>
</el-tab-pane>
<el-tab-pane label="小时" v-if="shouldHide('hour')">
<CrontabHour
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronhour"
/>
</el-tab-pane>
<el-tab-pane label="日" v-if="shouldHide('day')">
<CrontabDay
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronday"
/>
</el-tab-pane>
<el-tab-pane label="月" v-if="shouldHide('month')">
<CrontabMonth
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronmonth"
/>
</el-tab-pane>
<el-tab-pane label="周" v-if="shouldHide('week')">
<CrontabWeek
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronweek"
/>
</el-tab-pane>
<el-tab-pane label="年" v-if="shouldHide('year')">
<CrontabYear
@update="updateCrontabValue"
:check="checkNumber"
:cron="crontabValueObj"
ref="cronyear"
/>
</el-tab-pane>
</el-tabs>
<div class="popup-main">
<div class="popup-result">
<p class="title">时间表达式</p>
<table>
<thead>
<th v-for="item of tabTitles" width="40" :key="item">{{ item }}</th>
<th>Cron 表达式</th>
</thead>
<tbody>
<td>
<span>{{ crontabValueObj.second }}</span>
</td>
<td>
<span>{{ crontabValueObj.min }}</span>
</td>
<td>
<span>{{ crontabValueObj.hour }}</span>
</td>
<td>
<span>{{ crontabValueObj.day }}</span>
</td>
<td>
<span>{{ crontabValueObj.month }}</span>
</td>
<td>
<span>{{ crontabValueObj.week }}</span>
</td>
<td>
<span>{{ crontabValueObj.year }}</span>
</td>
<td>
<span>{{ crontabValueString }}</span>
</td>
</tbody>
</table>
</div>
<CrontabResult :ex="crontabValueString" />
<div class="pop_btn">
<el-button type="primary" @click="submitFill"></el-button>
<el-button type="warning" @click="clearCron"></el-button>
<el-button @click="hidePopup"></el-button>
</div>
</div>
</div>
</template>
<style scoped>
.pop_btn {
text-align: center;

View File

@ -1,47 +1,34 @@
<script lang="ts">
import { defineComponent, onMounted, onUpdated, PropType, ref } from 'vue'
<script setup lang="ts">
import { onMounted, onUpdated, PropType, ref } from 'vue'
import { getDictOptions, DictDataType } from '@/utils/dict'
import { ElTag } from 'element-plus'
export default defineComponent({
name: 'DictTag',
components: {
ElTag
const props = defineProps({
type: {
type: String as PropType<string>,
required: true
},
props: {
type: {
type: String as PropType<string>,
required: true
},
value: {
type: [String, Number] as PropType<string | number>,
required: true
}
},
setup(props) {
const dictData = ref<DictDataType>()
function getDictObj(dictType: string, value: string) {
const dictOptions = getDictOptions(dictType)
dictOptions.forEach((dict: DictDataType) => {
if (dict.value === value) {
dictData.value = dict
}
})
}
onMounted(() => {
return getDictObj(props.type, props.value?.toString())
})
onUpdated(() => {
getDictObj(props.type, props.value?.toString())
})
return {
props,
dictData
}
value: {
type: [String, Number] as PropType<string | number>,
required: true
}
})
const dictData = ref<DictDataType>()
const getDictObj = (dictType: string, value: string) => {
const dictOptions = getDictOptions(dictType)
dictOptions.forEach((dict: DictDataType) => {
if (dict.value === value) {
dictData.value = dict
}
})
}
onMounted(() => {
return getDictObj(props.type, props.value?.toString())
})
onUpdated(() => {
getDictObj(props.type, props.value?.toString())
})
</script>
<template>
<!-- 默认样式 -->

View File

@ -72,7 +72,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
children: [
{
path: 'edit',
component: () => import('@/views/infra/codegen/components/EditTable.vue'),
component: () => import('@/views/infra/codegen/EditTable.vue'),
name: 'EditTable',
meta: {
noCache: true,

View File

@ -1,7 +1,216 @@
<script setup lang="ts"></script>
<script setup lang="ts">
import { ref, unref } from 'vue'
import dayjs from 'dayjs'
import { ElTableColumn, ElTag, ElSwitch } from 'element-plus'
import { DICT_TYPE } from '@/utils/dict'
import { useTable } from '@/hooks/web/useTable'
import { useI18n } from '@/hooks/web/useI18n'
import { FormExpose } from '@/components/Form'
import type { ModelVO } from '@/api/bpm/model/types'
import { rules, allSchemas } from './model.data'
import * as ModelApi from '@/api/bpm/model'
import { useMessage } from '@/hooks/web/useMessage'
const message = useMessage()
const { t } = useI18n() //
// ========== ==========
const { register, tableObject, methods } = useTable<ModelVO>({
getListApi: ModelApi.getModelPageApi,
delListApi: ModelApi.deleteModelApi
})
const { getList, setSearchParams, delList } = methods
// ========== CRUD ==========
const actionLoading = ref(false) //
const actionType = ref('') //
const dialogVisible = ref(false) //
const dialogTitle = ref('edit') //
const formRef = ref<FormExpose>() // Ref
//
const setDialogTile = (type: string) => {
dialogTitle.value = t('action.' + type)
actionType.value = type
dialogVisible.value = true
}
//
const handleCreate = () => {
setDialogTile('create')
//
unref(formRef)?.getElFormRef()?.resetFields()
}
//
const handleUpdate = async (row: ModelVO) => {
setDialogTile('update')
//
const res = await ModelApi.getModelApi(row.id)
unref(formRef)?.setValues(res)
}
//
const submitForm = async () => {
actionLoading.value = true
//
try {
const data = unref(formRef)?.formModel as ModelVO
if (actionType.value === 'create') {
await ModelApi.createModelApi(data)
message.success(t('common.createSuccess'))
} else {
await ModelApi.updateModelApi(data)
message.success(t('common.updateSuccess'))
}
//
dialogVisible.value = false
await getList()
} finally {
actionLoading.value = false
}
}
/** 流程表单的详情按钮操作 */
const handleChangeState = async (row: ModelVO) => {
const state = row.processDefinition.suspensionState
const statusState = state === 1 ? '激活' : '挂起'
message
.confirm(
'是否确认' + statusState + '流程名字为"' + row.name + '"的数据项?',
t('common.reminder')
)
.then(async () => {
ModelApi.updateModelStateApi(row.id, state).then(() => {
message.success(t('common.updateSuccess'))
getList()
})
})
.catch(() => {})
}
// ========== ==========
const detailRef = ref() // Ref
//
const handleDetail = async (row: ModelVO) => {
//
detailRef.value = row
setDialogTile('detail')
}
// ========== ==========
getList()
</script>
<template>
<div>index</div>
</template>
<!-- 搜索工作区 -->
<ContentWrap>
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<ContentWrap>
<!-- 操作工具栏 -->
<div class="mb-10px">
<el-button type="primary" v-hasPermi="['bpm:model:create']" @click="handleCreate">
<Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }}
</el-button>
</div>
<!-- 列表 -->
<Table
:columns="allSchemas.tableColumns"
:selection="false"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
@register="register"
>
<template #category="{ row }">
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="row.category" />
</template>
<template #formId="{ row }">
<span>{{ row.formName }}</span>
</template>
<template #processDefinition>
<el-table-column label="流程版本" prop="processDefinition.version">
<template #default="{ row }">
<el-tag v-if="row.processDefinition">
{{ 'v' + row.processDefinition.version }}
</el-tag>
<el-tag type="warning" v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="激活状态" prop="processDefinition.suspensionState">
<template #default="{ row }">
<el-switch
v-if="row.processDefinition"
v-model="row.processDefinition.suspensionState"
:active-value="1"
:inactive-value="2"
@change="handleChangeState(row)"
/>
</template>
</el-table-column>
<el-table-column label="部署时间" prop="processDefinition.deploymentTime">
<template #default="{ row }">
<span>
{{ dayjs(row.processDefinition.deploymentTime).format('YYYY-MM-DD HH:mm:ss') }}
</span>
</template>
</el-table-column>
</template>
<template #createTime="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
<template #action="{ row }">
<el-button link type="primary" v-hasPermi="['bpm:model:update']" @click="handleUpdate(row)">
<Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }}
</el-button>
<el-button link type="primary" v-hasPermi="['bpm:model:update']" @click="handleDetail(row)">
<Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
</el-button>
<el-button
link
type="primary"
v-hasPermi="['bpm:model:delete']"
@click="delList(row.id, false)"
>
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button>
</template>
</Table>
</ContentWrap>
<style scoped></style>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
:schema="allSchemas.formSchema"
:rules="rules"
ref="formRef"
/>
<!-- 对话框(详情) -->
<Descriptions
v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema"
:data="detailRef"
>
<template #createTime="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
</Descriptions>
<!-- 操作按钮 -->
<template #footer>
<el-button
v-if="['create', 'update'].includes(actionType)"
type="primary"
:loading="actionLoading"
@click="submitForm"
>
{{ t('action.save') }}
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</template>

View File

@ -0,0 +1,81 @@
import { reactive } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { required } from '@/utils/formRules'
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
import { DICT_TYPE } from '@/utils/dict'
const { t } = useI18n() // 国际化
// 表单校验
export const rules = reactive({
name: [required]
})
// CrudSchema
const crudSchemas = reactive<CrudSchema[]>([
{
label: t('common.index'),
field: 'id',
type: 'index',
form: {
show: false
},
detail: {
show: false
}
},
{
label: '流程标识',
field: 'key',
search: {
show: true
}
},
{
label: '流程名称',
field: 'name',
search: {
show: true
}
},
{
label: '流程分类',
field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
search: {
show: true
}
},
{
label: '表单信息',
field: 'formId'
},
{
label: '最新部署的流程定义',
field: 'processDefinition',
form: {
show: false
},
detail: {
show: false
}
},
{
label: t('common.createTime'),
field: 'createTime',
form: {
show: false
}
},
{
label: t('table.action'),
field: 'action',
width: '240px',
form: {
show: false
},
detail: {
show: false
}
}
])
export const { allSchemas } = useCrudSchemas(crudSchemas)

View File

@ -1,7 +1,121 @@
<script setup lang="ts"></script>
<script setup lang="ts">
import { ref } from 'vue'
import dayjs from 'dayjs'
import { DICT_TYPE } from '@/utils/dict'
import { useTable } from '@/hooks/web/useTable'
import { useI18n } from '@/hooks/web/useI18n'
import type { ProcessInstanceVO } from '@/api/bpm/processInstance/types'
import { allSchemas } from './process.data'
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import { ElMessage, ElMessageBox } from 'element-plus'
const { t } = useI18n() //
// ========== ==========
const { register, tableObject, methods } = useTable<ProcessInstanceVO>({
getListApi: ProcessInstanceApi.getMyProcessInstancePageApi
})
const { getList, setSearchParams } = methods
// ========== CRUD ==========
const dialogVisible = ref(false) //
//
const handleAdd = () => {
console.info('add')
}
//
const handleCancel = (row: ProcessInstanceVO) => {
ElMessageBox.prompt('请输入取消原因?', '取消流程', {
confirmButtonText: t('common.ok'),
cancelButtonText: t('common.cancel'),
type: 'warning',
inputPattern: /^[\s\S]*.*[^\s][\s\S]*$/, //
inputErrorMessage: '取消原因不能为空'
}).then(async ({ value }) => {
await ProcessInstanceApi.cancelProcessInstanceApi(row.id, value)
ElMessage.success('取消成功')
getList()
})
}
// ========== ==========
const detailRef = ref() // Ref
//
const handleDetail = async (row: ProcessInstanceVO) => {
//
detailRef.value = row
dialogVisible.value = true
}
// ========== ==========
getList()
</script>
<template>
<div>index</div>
</template>
<!-- 搜索工作区 -->
<ContentWrap>
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<ContentWrap>
<!-- 操作工具栏 -->
<div class="mb-10px">
<el-button type="primary" v-hasPermi="['bpm:process-instance:query']" @click="handleAdd">
<Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }}
</el-button>
</div>
<!-- 列表 -->
<Table
:columns="allSchemas.tableColumns"
:selection="false"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
@register="register"
>
<template #status="{ row }">
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
</template>
<template #createTime="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
<template #action="{ row }">
<el-button
link
type="primary"
v-hasPermi="['bpm:process-instance:query']"
@click="handleDetail(row)"
>
<Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
</el-button>
<el-button
link
type="primary"
v-hasPermi="['bpm:process-instance:cancel']"
@click="handleCancel(row)"
>
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button>
</template>
</Table>
</ContentWrap>
<style scoped></style>
<Dialog v-model="dialogVisible" :title="t('action.detail')">
<!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
<template #status="{ row }">
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
</template>
<template #createTime="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
</Descriptions>
<!-- 操作按钮 -->
<template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</template>

View File

@ -0,0 +1,84 @@
import { reactive } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
import { DICT_TYPE } from '@/utils/dict'
const { t } = useI18n() // 国际化
// CrudSchema
const crudSchemas = reactive<CrudSchema[]>([
{
label: t('common.index'),
field: 'id',
type: 'index',
form: {
show: false
},
detail: {
show: false
}
},
{
label: '流程名',
field: 'name',
search: {
show: true
}
},
{
label: '流程分类',
field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
search: {
show: true
}
},
{
label: '当前审批任务',
field: 'tasks'
},
{
label: t('common.status'),
field: 'status',
dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS,
search: {
show: true
}
},
{
label: '结果',
field: 'result',
dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
search: {
show: true
}
},
{
label: '提交时间',
field: 'createTime',
form: {
show: false
},
search: {
show: true
}
},
{
label: '结束时间',
field: 'endTime',
form: {
show: false
}
},
{
label: t('table.action'),
field: 'action',
width: '240px',
form: {
show: false
},
detail: {
show: false
}
}
])
export const { allSchemas } = useCrudSchemas(crudSchemas)

View File

@ -1,18 +1,16 @@
<script setup lang="ts">
import { ref, unref, onMounted } from 'vue'
import { ContentDetailWrap } from '@/components/ContentDetailWrap'
import BasicInfoForm from './BasicInfoForm.vue'
import CloumInfoFormVue from './CloumInfoForm.vue'
import GenInfoFormVue from './GenInfoForm.vue'
import { ElTabs, ElTabPane, ElButton } from 'element-plus'
import { getCodegenTableApi } from '@/api/infra/codegen'
import { BasicInfoForm, CloumInfoForm, GenInfoForm } from './components'
import { ElTabs, ElTabPane, ElButton, ElMessage } from 'element-plus'
import { getCodegenTableApi, updateCodegenTableApi } from '@/api/infra/codegen'
import { useRouter, useRoute } from 'vue-router'
import { useI18n } from '@/hooks/web/useI18n'
import { CodegenColumnVO, CodegenTableVO } from '@/api/infra/codegen/types'
import { CodegenTableVO, CodegenColumnVO, CodegenUpdateReqVO } from '@/api/infra/codegen/types'
const { t } = useI18n()
const { push } = useRouter()
const { query } = useRoute()
const tableCurrentRow = ref<Nullable<CodegenTableVO>>(null)
const tableCurrentRow = ref<CodegenTableVO>()
const cloumCurrentRow = ref<CodegenColumnVO[]>()
const getList = async () => {
const id = query.id as unknown as number
@ -26,17 +24,23 @@ const getList = async () => {
const loading = ref(false)
const activeName = ref('cloum')
const basicInfoRef = ref<ComponentRef<typeof BasicInfoForm>>()
const genInfoRef = ref<ComponentRef<typeof GenInfoFormVue>>()
const genInfoRef = ref<ComponentRef<typeof GenInfoForm>>()
const cloumInfoRef = ref(null)
const submitForm = async () => {
const basicInfo = unref(basicInfoRef)
const genInfo = unref(genInfoRef)
const basicValidate = await basicInfo?.elFormRef?.validate()?.catch(() => {})
const genValidate = await genInfo?.elFormRef?.validate()?.catch(() => {})
if (basicValidate && genValidate) {
const basicForm = await basicInfo?.elFormRef?.validate()?.catch(() => {})
const genForm = await genInfo?.elFormRef?.validate()?.catch(() => {})
if (basicForm && genForm) {
const basicInfoData = (await basicInfo?.getFormData()) as CodegenTableVO
const genInfoData = (await genInfo?.getFormData()) as CodegenTableVO
console.info(basicInfoData)
console.info(genInfoData)
const genTable: CodegenUpdateReqVO = {
table: Object.assign({}, basicInfoData, genInfoData),
columns: cloumCurrentRow.value
}
await updateCodegenTableApi(genTable)
ElMessage.success(t('common.updateSuccess'))
push('/infra/codegen')
}
}
onMounted(() => {
@ -46,14 +50,14 @@ onMounted(() => {
<template>
<ContentDetailWrap title="代码生成" @back="push('/infra/codegen')">
<el-tabs v-model="activeName">
<el-tab-pane label="基本信息" name="basic">
<BasicInfoForm ref="basicInfoRef" :current-row="tableCurrentRow" />
<el-tab-pane label="基本信息" name="basicInfo">
<BasicInfoForm ref="basicInfoRef" :basicInfo="tableCurrentRow" />
</el-tab-pane>
<el-tab-pane label="字段信息" name="cloum">
<CloumInfoFormVue ref="cloumInfoRef" :current-row="cloumCurrentRow" />
<CloumInfoForm ref="cloumInfoRef" :info="cloumCurrentRow" />
</el-tab-pane>
<el-tab-pane label="生成信息" name="genInfo">
<GenInfoFormVue ref="basicInfoRef" :current-row="tableCurrentRow" />
<GenInfoForm ref="genInfoRef" :genInfo="tableCurrentRow" />
</el-tab-pane>
</el-tabs>
<template #right>

View File

@ -5,7 +5,7 @@ import { CodegenTableVO } from '@/api/infra/codegen/types'
import { Form } from '@/components/Form'
import { useForm } from '@/hooks/web/useForm'
const props = defineProps({
currentRow: {
basicInfo: {
type: Object as PropType<Nullable<CodegenTableVO>>,
default: () => null
}
@ -66,11 +66,11 @@ const { register, methods, elFormRef } = useForm({
schema
})
watch(
() => props.currentRow,
(currentRow) => {
if (!currentRow) return
() => props.basicInfo,
(basicInfo) => {
if (!basicInfo) return
const { setValues } = methods
setValues(currentRow)
setValues(basicInfo)
},
{
deep: true,

View File

@ -4,8 +4,8 @@ import { onMounted, PropType, ref } from 'vue'
import { CodegenColumnVO } from '@/api/infra/codegen/types'
import { listSimpleDictTypeApi } from '@/api/system/dict/dict.type'
import { DictTypeVO } from '@/api/system/dict/types'
defineProps({
currentRow: {
const props = defineProps({
info: {
type: Array as unknown as PropType<CodegenColumnVO[]>,
default: () => null
}
@ -20,18 +20,21 @@ const tableHeight = document.documentElement.scrollHeight - 245 + 'px'
onMounted(async () => {
await getDictOptions()
})
defineExpose({
info: props.info
})
</script>
<template>
<el-table ref="dragTable" :data="currentRow" row-key="columnId" :max-height="tableHeight">
<el-table ref="dragTable" :data="info" row-key="columnId" :max-height="tableHeight">
<el-table-column
label="字段列名"
prop="columnName"
min-width="10%"
:show-overflow-tooltip="true"
/>
<el-table-column label="字段描述" min-width="10%">
<template #default="scope">
<el-input v-model="scope.row.columnComment" />
<el-table-column label="字段描述" min-width="10%" prop="columnComment">
<template #default="{ row }">
<el-input v-model="row.columnComment" />
</template>
</el-table-column>
<el-table-column
@ -40,9 +43,9 @@ onMounted(async () => {
min-width="10%"
:show-overflow-tooltip="true"
/>
<el-table-column label="Java类型" min-width="11%">
<template #default="scope">
<el-select v-model="scope.row.javaType">
<el-table-column label="Java类型" min-width="11%" prop="javaType">
<template #default="{ row }">
<el-select v-model="row.javaType">
<el-option label="Long" value="Long" />
<el-option label="String" value="String" />
<el-option label="Integer" value="Integer" />
@ -53,38 +56,34 @@ onMounted(async () => {
</el-select>
</template>
</el-table-column>
<el-table-column label="java属性" min-width="10%">
<template #default="scope">
<el-input v-model="scope.row.javaField" />
<el-table-column label="java属性" min-width="10%" prop="javaField">
<template #default="{ row }">
<el-input v-model="row.javaField" />
</template>
</el-table-column>
<el-table-column label="插入" min-width="4%">
<template #default="scope">
<el-checkbox true-label="true" false-label="false" v-model="scope.row.createOperation" />
<el-table-column label="插入" min-width="4%" prop="createOperation">
<template #default="{ row }">
<el-checkbox true-label="true" false-label="false" v-model="row.createOperation" />
</template>
</el-table-column>
<el-table-column label="编辑" min-width="4%">
<template #default="scope">
<el-checkbox true-label="true" false-label="false" v-model="scope.row.updateOperation" />
<el-table-column label="编辑" min-width="4%" prop="updateOperation">
<template #default="{ row }">
<el-checkbox true-label="true" false-label="false" v-model="row.updateOperation" />
</template>
</el-table-column>
<el-table-column label="列表" min-width="4%">
<template #default="scope">
<el-checkbox
true-label="true"
false-label="false"
v-model="scope.row.listOperationResult"
/>
<el-table-column label="列表" min-width="4%" prop="listOperationResult">
<template #default="{ row }">
<el-checkbox true-label="true" false-label="false" v-model="row.listOperationResult" />
</template>
</el-table-column>
<el-table-column label="查询" min-width="4%">
<template #default="scope">
<el-checkbox true-label="true" false-label="false" v-model="scope.row.listOperation" />
<el-table-column label="查询" min-width="4%" prop="listOperation">
<template #default="{ row }">
<el-checkbox true-label="true" false-label="false" v-model="row.listOperation" />
</template>
</el-table-column>
<el-table-column label="查询方式" min-width="10%">
<template #default="scope">
<el-select v-model="scope.row.listOperationCondition">
<el-table-column label="查询方式" min-width="10%" prop="listOperationCondition">
<template #default="{ row }">
<el-select v-model="row.listOperationCondition">
<el-option label="=" value="=" />
<el-option label="!=" value="!=" />
<el-option label=">" value=">" />
@ -96,14 +95,14 @@ onMounted(async () => {
</el-select>
</template>
</el-table-column>
<el-table-column label="允许空" min-width="5%">
<template #default="scope">
<el-checkbox true-label="true" false-label="false" v-model="scope.row.nullable" />
<el-table-column label="允许空" min-width="5%" prop="nullable">
<template #default="{ row }">
<el-checkbox true-label="true" false-label="false" v-model="row.nullable" />
</template>
</el-table-column>
<el-table-column label="显示类型" min-width="12%">
<template #default="scope">
<el-select v-model="scope.row.htmlType">
<el-table-column label="显示类型" min-width="12%" prop="htmlType">
<template #default="{ row }">
<el-select v-model="row.htmlType">
<el-option label="文本框" value="input" />
<el-option label="文本域" value="textarea" />
<el-option label="下拉框" value="select" />
@ -116,9 +115,9 @@ onMounted(async () => {
</el-select>
</template>
</el-table-column>
<el-table-column label="字典类型" min-width="12%">
<template #default="scope">
<el-select v-model="scope.row.dictType" clearable filterable placeholder="请选择">
<el-table-column label="字典类型" min-width="12%" prop="dictType">
<template #default="{ row }">
<el-select v-model="row.dictType" clearable filterable placeholder="请选择">
<el-option
v-for="dict in dictOptions"
:key="dict.id"
@ -128,9 +127,9 @@ onMounted(async () => {
</el-select>
</template>
</el-table-column>
<el-table-column label="示例" min-width="10%">
<template #default="scope">
<el-input v-model="scope.row.example" />
<el-table-column label="示例" min-width="10%" prop="example">
<template #default="{ row }">
<el-input v-model="row.example" />
</template>
</el-table-column>
</el-table>

View File

@ -4,9 +4,9 @@ import { required } from '@/utils/formRules'
import { CodegenTableVO } from '@/api/infra/codegen/types'
import { Form } from '@/components/Form'
import { useForm } from '@/hooks/web/useForm'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
const props = defineProps({
currentRow: {
genInfo: {
type: Object as PropType<Nullable<CodegenTableVO>>,
default: () => null
}
@ -20,13 +20,15 @@ const rules = reactive({
className: [required],
classComment: [required]
})
const templateTypeOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)
const sceneOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)
const schema = reactive<FormSchema[]>([
{
label: '生成模板',
field: 'templateType',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)
options: templateTypeOptions
},
colProps: {
span: 12
@ -37,7 +39,7 @@ const schema = reactive<FormSchema[]>([
field: 'scene',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)
options: sceneOptions
},
colProps: {
span: 12
@ -93,11 +95,11 @@ const { register, methods, elFormRef } = useForm({
schema
})
watch(
() => props.currentRow,
(currentRow) => {
if (!currentRow) return
() => props.genInfo,
(genInfo) => {
if (!genInfo) return
const { setValues } = methods
setValues(currentRow)
setValues(genInfo)
},
{
deep: true,

View File

@ -21,8 +21,8 @@ const emit = defineEmits(['ok'])
const visible = ref(false)
const dbLoading = ref(true)
const queryParams = reactive({
tableName: undefined,
tableComment: undefined,
name: undefined,
comment: undefined,
dataSourceConfigId: 0
})
const dataSourceConfigs = ref<DataSourceConfigVO[]>([])
@ -49,8 +49,9 @@ const handleQuery = async () => {
}
//
const resetQuery = async () => {
queryParams.tableName = undefined
queryParams.tableComment = undefined
queryParams.name = undefined
queryParams.comment = undefined
queryParams.dataSourceConfigId = 0
await getList()
}
/** 多选框选中数据 */
@ -90,11 +91,11 @@ defineExpose({
/>
</el-select>
</el-form-item>
<el-form-item label="表名称" prop="tableName">
<el-input v-model="queryParams.tableName" placeholder="请输入表名称" clearable />
<el-form-item label="表名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入表名称" clearable />
</el-form-item>
<el-form-item label="表描述" prop="tableComment">
<el-input v-model="queryParams.tableComment" placeholder="请输入表描述" clearable />
<el-form-item label="表描述" prop="comment">
<el-input v-model="queryParams.comment" placeholder="请输入表描述" clearable />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">

View File

@ -1,7 +1,6 @@
import BasicInfoForm from './BasicInfoForm.vue'
import CloumInfoForm from './CloumInfoForm.vue'
import EditTable from './EditTable.vue'
import GenInfoForm from './GenInfoForm.vue'
import ImportTable from './ImportTable.vue'
import Preview from './Preview.vue'
export { BasicInfoForm, CloumInfoForm, EditTable, GenInfoForm, ImportTable, Preview }
export { BasicInfoForm, CloumInfoForm, GenInfoForm, ImportTable, Preview }