mirror of
https://gitee.com/JavaLionLi/plus-ui.git
synced 2026-11-02 13:31:50 +08:00
升级warm-flow到2.1.0
This commit is contained in:
parent
045fc00672
commit
fd961b705e
@ -7,6 +7,8 @@ export interface LeaveVO {
|
|||||||
leaveDays: number;
|
leaveDays: number;
|
||||||
remark: string;
|
remark: string;
|
||||||
status?: string;
|
status?: string;
|
||||||
|
/** 已有流程实例时回显的流程定义编码 */
|
||||||
|
flowCode?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LeaveForm extends BaseEntity {
|
export interface LeaveForm extends BaseEntity {
|
||||||
|
|||||||
@ -23,8 +23,8 @@
|
|||||||
:rules="rules"
|
:rules="rules"
|
||||||
label-width="80px"
|
label-width="80px"
|
||||||
>
|
>
|
||||||
<el-form-item label="流程定义" v-if="routeParams.type === 'add'">
|
<el-form-item label="流程定义" v-if="routeParams.type === 'add' || routeParams.type === 'update'">
|
||||||
<el-select v-model="flowCode" placeholder="选择流程定义" style="width: 100%">
|
<el-select v-model="flowCode" :disabled="flowCodeLocked" placeholder="选择流程定义" style="width: 100%">
|
||||||
<el-option v-for="item in flowCodeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
<el-option v-for="item in flowCodeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -62,6 +62,7 @@
|
|||||||
|
|
||||||
<script setup name="Leave" lang="ts">
|
<script setup name="Leave" lang="ts">
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { listDefinition } from '@/api/workflow/definition';
|
||||||
import { addLeave, getLeave, submitAndFlowStart, updateLeave } from '@/api/workflow/leave';
|
import { addLeave, getLeave, submitAndFlowStart, updateLeave } from '@/api/workflow/leave';
|
||||||
import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types';
|
import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types';
|
||||||
import { startWorkFlow } from '@/api/workflow/task';
|
import { startWorkFlow } from '@/api/workflow/task';
|
||||||
@ -98,34 +99,21 @@ const options = [
|
|||||||
label: '婚假'
|
label: '婚假'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const flowCodeOptions = [
|
/** 可选流程定义:拉取真实已发布定义,避免写死早已不存在的流程编码 */
|
||||||
{
|
const flowCodeOptions = ref<Array<{ value: string; label: string }>>([]);
|
||||||
value: 'leave1',
|
const loadFlowCodeOptions = async () => {
|
||||||
label: '请假申请-普通'
|
const resp = await listDefinition({ pageNum: 1, pageSize: 200, category: undefined });
|
||||||
},
|
flowCodeOptions.value = (resp.data?.rows ?? [])
|
||||||
{
|
.filter(item => item.isPublish === 1)
|
||||||
value: 'leave2',
|
.map(item => ({ value: item.flowCode, label: `${item.flowName}(${item.flowCode})` }));
|
||||||
label: '请假申请-排他网关'
|
if (!flowCodeOptions.value.some(item => item.value === flowCode.value)) {
|
||||||
},
|
flowCode.value = flowCodeOptions.value[0]?.value ?? '';
|
||||||
{
|
|
||||||
value: 'leave3',
|
|
||||||
label: '请假申请-并行网关'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'leave4',
|
|
||||||
label: '请假申请-会签'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'leave5',
|
|
||||||
label: '请假申请-并行会签网关'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'leave6',
|
|
||||||
label: '请假申请-排他并行会签'
|
|
||||||
}
|
}
|
||||||
];
|
};
|
||||||
// 自定义流程可不选择 直接填写flowCode 例如 'leave1'
|
// 下拉项来自已发布的流程定义
|
||||||
const flowCode = ref<string>('leave1');
|
const flowCode = ref<string>('');
|
||||||
|
// 已有流程实例时沿用原流程,不允许在修改页切换
|
||||||
|
const flowCodeLocked = ref(false);
|
||||||
|
|
||||||
//提交组件
|
//提交组件
|
||||||
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
|
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
|
||||||
@ -193,6 +181,14 @@ const getInfo = () => {
|
|||||||
leaveTime.value = [];
|
leaveTime.value = [];
|
||||||
leaveTime.value.push(form.value.startDate);
|
leaveTime.value.push(form.value.startDate);
|
||||||
leaveTime.value.push(form.value.endDate);
|
leaveTime.value.push(form.value.endDate);
|
||||||
|
if (routeParams.value.type === 'update') {
|
||||||
|
await loadFlowCodeOptions();
|
||||||
|
// 已有实例(撤销 / 退回 / 草稿已发起)沿用原流程定义;没有实例的草稿由用户自行选择
|
||||||
|
if (res.data.flowCode) {
|
||||||
|
flowCode.value = res.data.flowCode;
|
||||||
|
flowCodeLocked.value = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
buttonLoading.value = false;
|
buttonLoading.value = false;
|
||||||
});
|
});
|
||||||
@ -244,15 +240,18 @@ const submitForm = (status: string, mode: boolean) => {
|
|||||||
|
|
||||||
//提交申请
|
//提交申请
|
||||||
const handleStartWorkFlow = async (data: LeaveForm) => {
|
const handleStartWorkFlow = async (data: LeaveForm) => {
|
||||||
|
if (!flowCode.value) {
|
||||||
|
buttonLoading.value = false;
|
||||||
|
modal.msgError('请选择流程定义');
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
submitFormData.value.flowCode = flowCode.value;
|
submitFormData.value.flowCode = flowCode.value;
|
||||||
submitFormData.value.businessId = data.id;
|
submitFormData.value.businessId = data.id;
|
||||||
//流程变量
|
//流程变量
|
||||||
taskVariables.value = {
|
taskVariables.value = {
|
||||||
// leave2/6 使用的流程变量
|
// 网关示例的分支条件是 gt@@day|3 / lt@@day|3,变量名必须叫 day
|
||||||
leaveDays: data.leaveDays,
|
day: data.leaveDays
|
||||||
// leave4/5 使用的流程变量
|
|
||||||
userList: ['1', '3', '4']
|
|
||||||
};
|
};
|
||||||
//流程实例业务扩展字段
|
//流程实例业务扩展字段
|
||||||
bizExt.value = {
|
bizExt.value = {
|
||||||
@ -289,6 +288,9 @@ onMounted(() => {
|
|||||||
routeParams.value = route.query;
|
routeParams.value = route.query;
|
||||||
reset();
|
reset();
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
if (routeParams.value.type === 'add') {
|
||||||
|
loadFlowCodeOptions();
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
routeParams.value.type === 'update' ||
|
routeParams.value.type === 'update' ||
|
||||||
routeParams.value.type === 'view' ||
|
routeParams.value.type === 'view' ||
|
||||||
|
|||||||
@ -22,7 +22,7 @@ const onDesignerMessage = (event: MessageEvent) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const open = async (definitionId, disabled) => {
|
const open = async (definitionId, disabled) => {
|
||||||
const url = baseUrl + `/warm-flow-ui/index.html?id=${definitionId}&onlyDesignShow=true`;
|
const url = baseUrl + `/warm-flow-ui/index.html?id=${definitionId}`;
|
||||||
iframeUrl.value = url + '&Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID;
|
iframeUrl.value = url + '&Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID;
|
||||||
};
|
};
|
||||||
/** 关闭按钮 */
|
/** 关闭按钮 */
|
||||||
|
|||||||
@ -59,15 +59,6 @@
|
|||||||
<el-button v-hasPermi="['workflow:definition:add']" type="primary" icon="Plus" @click="handleAdd()">
|
<el-button v-hasPermi="['workflow:definition:add']" type="primary" icon="Plus" @click="handleAdd()">
|
||||||
添加
|
添加
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
|
||||||
v-hasPermi="['workflow:definition:edit']"
|
|
||||||
type="success"
|
|
||||||
icon="Edit"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate()"
|
|
||||||
>
|
|
||||||
修改
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPermi="['workflow:definition:remove']"
|
v-hasPermi="['workflow:definition:remove']"
|
||||||
type="danger"
|
type="danger"
|
||||||
@ -300,9 +291,6 @@
|
|||||||
<el-radio value="MIMIC" size="large" border>仿钉钉模式</el-radio>
|
<el-radio value="MIMIC" size="large" border>仿钉钉模式</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="流程配置">
|
|
||||||
<el-checkbox v-model="autoPass" label="下一节点执行人是当前任务处理人自动审批" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否动态表单" prop="formCustom">
|
<el-form-item label="是否动态表单" prop="formCustom">
|
||||||
<el-radio-group v-model="form.formCustom" class="definition-radio-group">
|
<el-radio-group v-model="form.formCustom" class="definition-radio-group">
|
||||||
<el-radio value="Y" size="large" border disabled>是</el-radio>
|
<el-radio value="Y" size="large" border disabled>是</el-radio>
|
||||||
@ -336,8 +324,6 @@ import {
|
|||||||
unPublishList,
|
unPublishList,
|
||||||
publish,
|
publish,
|
||||||
add,
|
add,
|
||||||
edit,
|
|
||||||
getInfo,
|
|
||||||
copy
|
copy
|
||||||
} from '@/api/workflow/definition';
|
} from '@/api/workflow/definition';
|
||||||
import { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types';
|
import { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types';
|
||||||
@ -365,7 +351,6 @@ const processDefinitionList = ref<FlowDefinitionVo[]>([]);
|
|||||||
const categoryOptions = ref<CategoryTreeVO[]>([]);
|
const categoryOptions = ref<CategoryTreeVO[]>([]);
|
||||||
const { treeCollapsed } = useTreeCollapsed();
|
const { treeCollapsed } = useTreeCollapsed();
|
||||||
const { showSearch } = useSearchToggle();
|
const { showSearch } = useSearchToggle();
|
||||||
const autoPass = ref(false);
|
|
||||||
/** 部署文件分类选择 */
|
/** 部署文件分类选择 */
|
||||||
const selectCategory = ref();
|
const selectCategory = ref();
|
||||||
const defFormRef = ref<ElFormInstance>();
|
const defFormRef = ref<ElFormInstance>();
|
||||||
@ -620,36 +605,13 @@ const handleAdd = async () => {
|
|||||||
form.value.formCustom = 'N';
|
form.value.formCustom = 'N';
|
||||||
showModelDialog('新增流程');
|
showModelDialog('新增流程');
|
||||||
};
|
};
|
||||||
/** 修改按钮操作 */
|
|
||||||
const handleUpdate = async (row?: Partial<FlowDefinitionVo>) => {
|
|
||||||
reset();
|
|
||||||
const id = row?.id || ids.value[0];
|
|
||||||
const res = await getInfo(id);
|
|
||||||
Object.assign(form.value, res.data);
|
|
||||||
autoPass.value = false;
|
|
||||||
if (form.value.ext != null && form.value.ext != '') {
|
|
||||||
const extJson = JSON.parse(form.value.ext);
|
|
||||||
if (extJson.autoPass != null && extJson.autoPass != '') {
|
|
||||||
autoPass.value = extJson.autoPass;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
showModelDialog('修改流程');
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
defFormRef.value.validate(async (valid: boolean) => {
|
defFormRef.value.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const ext: { autoPass: boolean } = {
|
await add(form.value).finally(() => setLoading(false));
|
||||||
autoPass: autoPass.value
|
activeName.value = '1';
|
||||||
};
|
|
||||||
form.value.ext = JSON.stringify(ext);
|
|
||||||
if (form.value.id) {
|
|
||||||
await edit(form.value).finally(() => setLoading(false));
|
|
||||||
} else {
|
|
||||||
await add(form.value).finally(() => setLoading(false));
|
|
||||||
activeName.value = '1';
|
|
||||||
}
|
|
||||||
modal.msgSuccess('操作成功');
|
modal.msgSuccess('操作成功');
|
||||||
closeModelDialog();
|
closeModelDialog();
|
||||||
handleQuery();
|
handleQuery();
|
||||||
|
|||||||
@ -30,7 +30,7 @@ export default defineConfig(({ mode, command }) => {
|
|||||||
open: true,
|
open: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
[env.VITE_APP_BASE_API]: {
|
[env.VITE_APP_BASE_API]: {
|
||||||
target: 'http://localhost:8080',
|
target: 'http://localhost:17083',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
ws: true,
|
ws: true,
|
||||||
rewrite: path => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
|
rewrite: path => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user