流程业务key回显

This commit is contained in:
weiwei committed 2025-03-13 16:40:28 +08:00
1 parent 707c2e094f
commit 42dfbe30f5
2 files changed
+173 -164

No files matched your search

+98 -97
View File
@@ -6,19 +6,19 @@
<div class="f2"> <div class="f2">
<span class="center_t" effect="dark" :activeStep="activeStep == 0" @click="activeStep = 0"> <span class="center_t" effect="dark" :activeStep="activeStep == 0" @click="activeStep = 0">
<span :activeStep="activeStep == 0">1</span> <span :activeStep="activeStep == 0">1</span>
<span>{{ $t('flow.basicInformation') }}</span> <span>{{ $t("flow.basicInformation") }}</span>
</span> </span>
<span class="center_t" effect="dark" :activeStep="activeStep == 1" @click="activeStep = 1"> <span class="center_t" effect="dark" :activeStep="activeStep == 1" @click="activeStep = 1">
<span :activeStep="activeStep == 1">2</span> <span :activeStep="activeStep == 1">2</span>
<span>{{ $t('flow.formDesign') }}</span> <span>{{ $t("flow.formDesign") }}</span>
</span> </span>
<span class="center_t" effect="dark" :activeStep="activeStep == 2" @click="activeStep = 2"> <span class="center_t" effect="dark" :activeStep="activeStep == 2" @click="activeStep = 2">
<span :activeStep="activeStep == 2">3</span> <span :activeStep="activeStep == 2">3</span>
<span>{{ $t('flow.processDesign') }}</span> <span>{{ $t("flow.processDesign") }}</span>
</span> </span>
</div> </div>
<div class="f3"> <div class="f3">
<el-button type="primary" @click="publish">{{ $t('flow.publish') }}</el-button> <el-button type="primary" @click="publish">{{ $t("flow.publish") }}</el-button>
</div> </div>
</div> </div>
<el-scrollbar height="calc(100vh - 250px)"> <el-scrollbar height="calc(100vh - 250px)">
@@ -37,7 +37,7 @@
<div style="text-align: center"> <div style="text-align: center">
<el-result v-if="validateFlowStep == 3" icon="success" :title="$t('flow.checkSuccess')" :sub-title="$t('flow.checkSubSuccess')"> <el-result v-if="validateFlowStep == 3" icon="success" :title="$t('flow.checkSuccess')" :sub-title="$t('flow.checkSubSuccess')">
<template #extra> <template #extra>
<el-button type="primary" @click="submitFlow">{{ $t('flow.submit') }}</el-button> <el-button type="primary" @click="submitFlow">{{ $t("flow.submit") }}</el-button>
</template> </template>
</el-result> </el-result>
@@ -63,7 +63,7 @@
</div> </div>
</template> </template>
<template #extra> <template #extra>
<el-button type="primary" @click="gotoEdit">{{ $t('common.editBtn') }}</el-button> <el-button type="primary" @click="gotoEdit">{{ $t("common.editBtn") }}</el-button>
</template> </template>
</el-result> </el-result>
</div> </div>
@@ -73,160 +73,161 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { WarnTriangleFilled } from '@element-plus/icons-vue'; import { WarnTriangleFilled } from "@element-plus/icons-vue"
import { addFlow } from '/@/api/flow/flow'; import { addFlow } from "/@/api/flow/flow"
import Step1 from './step1.vue'; import Step1 from "./step1.vue"
import Step2 from './step2.vue'; import Step2 from "./step2.vue"
import Step3 from './step3.vue'; import Step3 from "./step3.vue"
import { useFlowStore } from '../workflow/stores/flow'; import { useFlowStore } from "../workflow/stores/flow"
import { LocationQuery, LocationQueryValue, useRouter } from 'vue-router'; import { LocationQuery, LocationQueryValue, useRouter } from "vue-router"
let store = useFlowStore(); let store = useFlowStore()
const step1Ref = ref(); const step1Ref = ref()
const step2Ref = ref(); const step2Ref = ref()
const step3Ref = ref(); const step3Ref = ref()
const validateErrMsg = ref([]); const validateErrMsg = ref([])
const activeStep = ref(0); const activeStep = ref(0)
const validateFlowStep = ref(0); const validateFlowStep = ref(0)
const validateDialogShow = ref(false); const validateDialogShow = ref(false)
const validatingShow = ref(false); const validatingShow = ref(false)
const gotoEdit = () => { const gotoEdit = () => {
activeStep.value = validateFlowStep.value; activeStep.value = validateFlowStep.value
validateDialogShow.value = false; validateDialogShow.value = false
}; }
const publish = (t) => { const publish = (t) => {
validateErrMsg.value = []; validateErrMsg.value = []
validateFlowStep.value = 0; validateFlowStep.value = 0
validateDialogShow.value = true; validateDialogShow.value = true
validatingShow.value = true; validatingShow.value = true
setTimeout(function () { setTimeout(function () {
//1 //1
checkStep1(); checkStep1()
}, 500); }, 500)
}; }
import { useRoute } from 'vue-router'; import { useRoute } from "vue-router"
import { getFlowDetail } from '/@/api/flow/flow'; import { getFlowDetail } from "/@/api/flow/flow"
import { useUserInfo } from '/@/stores/userInfo'; import { useUserInfo } from "/@/stores/userInfo"
import other from '/@/utils/other'; import other from "/@/utils/other"
const route = useRoute(); const route = useRoute()
onMounted(() => { onMounted(() => {
const query: LocationQuery = route.query; const query: LocationQuery = route.query
const groupId = (query.groupId as LocationQueryValue) ?? ''; const groupId = (query.groupId as LocationQueryValue) ?? ""
const flowId = (query.flowId as LocationQueryValue) ?? ''; const flowId = (query.flowId as LocationQueryValue) ?? ""
const cp = (query.cp as LocationQueryValue) ?? ''; const cp = (query.cp as LocationQueryValue) ?? ""
if (groupId) { if (groupId) {
paramGroupId.value = groupId; paramGroupId.value = groupId
} }
if (flowId) { if (flowId) {
getFlowDetail(flowId).then((res) => { getFlowDetail(flowId).then((res) => {
var { data } = res; var { data } = res
store.step1.adminList = JSON.parse(data.adminList); store.step1.adminList = JSON.parse(data.adminList)
store.step1.name = data.name; store.step1.name = data.name
store.step1.logo = data.logo; store.step1.logo = data.logo
if (!cp || !(parseInt(cp) === 1)) { if (!cp || !(parseInt(cp) === 1)) {
//复制 //复制
store.step1.flowId = flowId; store.step1.flowId = flowId
} }
store.step1.remark = data.remark; store.step1.remark = data.remark
store.step1.groupId = data.groupId; store.step1.groupId = data.groupId
store.step1.businessKey = data.businessKey
store.setStep2(JSON.parse(data.formItems)); store.setStep2(JSON.parse(data.formItems))
step3NodeConfig = JSON.parse(data.process); step3NodeConfig = JSON.parse(data.process)
}); })
} else { } else {
//新增 //新增
let userId = useUserInfo().userInfos.user.userId; let userId = useUserInfo().userInfos.user.userId
let name = useUserInfo().userInfos.user.username; let name = useUserInfo().userInfos.user.username
let avatar = useUserInfo().userInfos.user.avatar; let avatar = useUserInfo().userInfos.user.avatar
//清空 store 属性 //清空 store 属性
store.clearStep1(); store.clearStep1()
store.clearStep2(); store.clearStep2()
store.step1.adminList = [ store.step1.adminList = [
{ {
id: userId, id: userId,
name: name, name: name,
avatar: avatar, avatar: avatar,
type: 'user', type: "user",
}, },
]; ]
} }
}); })
let step3NodeConfig = reactive({}); let step3NodeConfig = reactive({})
var paramGroupId = ref(); var paramGroupId = ref()
const checkStep1 = () => { const checkStep1 = () => {
step1Ref.value.validate(function (valid, arr) { step1Ref.value.validate(function (valid, arr) {
if (valid) { if (valid) {
validateFlowStep.value = 1; validateFlowStep.value = 1
setTimeout(function () { setTimeout(function () {
checkStep2(); checkStep2()
}, 500); }, 500)
} else { } else {
validatingShow.value = false; validatingShow.value = false
//错误信息 //错误信息
validateErrMsg.value = arr; validateErrMsg.value = arr
} }
}); })
}; }
const checkStep2 = () => { const checkStep2 = () => {
step2Ref.value.validate(function (valid, arr) { step2Ref.value.validate(function (valid, arr) {
if (valid) { if (valid) {
setTimeout(function () { setTimeout(function () {
validateFlowStep.value = 2; validateFlowStep.value = 2
checkStep3(); checkStep3()
}); })
} else { } else {
validatingShow.value = false; validatingShow.value = false
//错误信息 //错误信息
validateErrMsg.value = arr; validateErrMsg.value = arr
} }
}); })
}; }
const checkStep3 = () => { const checkStep3 = () => {
setTimeout(function () { setTimeout(function () {
step3Ref.value.validate(function (valid, arr) { step3Ref.value.validate(function (valid, arr) {
if (valid) { if (valid) {
validateFlowStep.value = 3; validateFlowStep.value = 3
} else { } else {
validatingShow.value = false; validatingShow.value = false
//错误信息 //错误信息
validateErrMsg.value = arr; validateErrMsg.value = arr
} }
}); })
}); })
}; }
const router = useRouter(); const router = useRouter()
const submitFlow = () => { const submitFlow = () => {
step3Ref.value.getProcessData().then((res) => { step3Ref.value.getProcessData().then((res) => {
let step1 = store.step1; let step1 = store.step1
let step2 = store.step2; let step2 = store.step2
let flow = other.deepClone(step1); let flow = other.deepClone(step1)
flow.formItems = JSON.stringify(step2); flow.formItems = JSON.stringify(step2)
flow.process = JSON.stringify(res); flow.process = JSON.stringify(res)
flow.adminList = JSON.stringify(step1.adminList); flow.adminList = JSON.stringify(step1.adminList)
addFlow(flow).then((res) => { addFlow(flow).then((res) => {
validateDialogShow.value = false; validateDialogShow.value = false
store.$reset(); store.$reset()
router.push('/flow/list/index'); router.push("/flow/list/index")
}); })
}); })
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.f2-width { .f2-width {
@@ -278,7 +279,7 @@ const submitFlow = () => {
display: inline-block; display: inline-block;
} }
.center_t span:first-child[activeStep='true'] { .center_t span:first-child[activeStep="true"] {
color: white; color: white;
background-color: var(--el-color-primary); background-color: var(--el-color-primary);
} }
@@ -288,7 +289,7 @@ const submitFlow = () => {
font-size: 18px; font-size: 18px;
} }
.center_t[activeStep='true'] { .center_t[activeStep="true"] {
border-bottom: 2px solid var(--el-color-primary); border-bottom: 2px solid var(--el-color-primary);
color: var(--el-color-primary); color: var(--el-color-primary);
} }
+75 -67
View File
@@ -4,8 +4,12 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form label-position="top"> <el-form label-position="top">
<form-render @addLayoutOneItem="addLayoutOneItem" ref="formRenderRef" <form-render
@deleteLayoutOneItem="deleteLayoutOneItem" :form-list="currentOpenFlowForm"></form-render> @addLayoutOneItem="addLayoutOneItem"
ref="formRenderRef"
@deleteLayoutOneItem="deleteLayoutOneItem"
:form-list="currentOpenFlowForm"
></form-render>
</el-form> </el-form>
<div class="flex justify-center mt-4"> <div class="flex justify-center mt-4">
@@ -14,53 +18,57 @@
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<flow-node-format :formData="formValue" :selectUserNodeId="selectUserNodeId" <flow-node-format
:flow-id="currentOpenFlow.flowId" ref="flowNodeFormatRef"></flow-node-format> :formData="formValue"
:selectUserNodeId="selectUserNodeId"
:flow-id="currentOpenFlow.flowId"
ref="flowNodeFormatRef"
></flow-node-format>
</el-col> </el-col>
</el-row> </el-row>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import FormRender from '/@/views/flow/form/render/FormRender.vue'; import FormRender from "/@/views/flow/form/render/FormRender.vue"
import FlowNodeFormat from '/@/views/flow/form/tools/FlowNodeFormatData.vue'; import FlowNodeFormat from "/@/views/flow/form/tools/FlowNodeFormatData.vue"
import { FormVO } from '/@/api/flow/form/types'; import { FormVO } from "/@/api/flow/form/types"
import { getFlowDetail, startFlow } from '/@/api/flow/flow'; import { getFlowDetail, startFlow } from "/@/api/flow/flow"
import other from '/@/utils/other'; import other from "/@/utils/other"
import { ElMessage } from 'element-plus'; import { ElMessage } from "element-plus"
const dialogTableVisible = ref<Boolean>(false); const dialogTableVisible = ref<Boolean>(false)
const currentOpenFlowForm = ref<FormVO[]>([]); const currentOpenFlowForm = ref<FormVO[]>([])
const currentOpenFlow = ref<FormVO[]>([]); const currentOpenFlow = ref<FormVO[]>([])
const formRenderRef = ref(); const formRenderRef = ref()
const submitProcess = () => { const submitProcess = () => {
let validate = flowNodeFormatRef.value.validate(); let validate = flowNodeFormatRef.value.validate()
if (!validate) { if (!validate) {
ElMessage.warning('请选择节点执行人'); ElMessage.warning("请选择节点执行人")
return; return
} }
let param = flowNodeFormatRef.value.formatSelectNodeUser(); let param = flowNodeFormatRef.value.formatSelectNodeUser()
currentOpenFlowForm.value.forEach((res) => (param[res.id] = res.props.value)); currentOpenFlowForm.value.forEach((res) => (param[res.id] = res.props.value))
{ {
for (var item of currentOpenFlowForm.value) { for (var item of currentOpenFlowForm.value) {
param[item.id] = item.props.value; param[item.id] = item.props.value
if (item.type === 'Layout') { if (item.type === "Layout") {
let subList = item.props.value; let subList = item.props.value
var d = []; var d = []
for (var array of subList) { for (var array of subList) {
var v = {}; var v = {}
for (var subItem of array) { for (var subItem of array) {
let value = subItem.props.value; let value = subItem.props.value
v[subItem.id] = value; v[subItem.id] = value
} }
d.push(v); d.push(v)
} }
param[item.id] = d; param[item.id] = d
} }
} }
} }
@@ -68,83 +76,83 @@ const submitProcess = () => {
var data = { var data = {
flowId: currentOpenFlow.value.flowId, flowId: currentOpenFlow.value.flowId,
paramMap: param, paramMap: param,
}; }
formRenderRef.value.validate(function (valid) { formRenderRef.value.validate(function (valid) {
if (valid) { if (valid) {
startFlow(data).then((res) => { startFlow(data).then((res) => {
ElMessage.success('提交成功'); ElMessage.success("提交成功")
dialogTableVisible.value = false; dialogTableVisible.value = false
}); })
} }
}); })
}; }
const handle = (row) => { const handle = (row) => {
currentOpenFlow.value = row; currentOpenFlow.value = row
startProcess(row); startProcess(row)
}; }
defineExpose({ handle }); defineExpose({ handle })
const selectUserNodeId = ref<String[]>([]); const selectUserNodeId = ref<String[]>([])
const startProcess = (f) => { const startProcess = (f) => {
getFlowDetail(f.flowId).then((res) => { getFlowDetail(f.flowId).then((res) => {
const { data } = res; const { data } = res
const { formItems } = data; const { formItems } = data
let formIteamJsonArray = JSON.parse(formItems); let formIteamJsonArray = JSON.parse(formItems)
for (var fi of formIteamJsonArray) { for (var fi of formIteamJsonArray) {
if (fi.type === 'Layout') { if (fi.type === "Layout") {
var arr = []; var arr = []
let value = fi.props.value; let value = fi.props.value
arr.push(value); arr.push(value)
fi.props.value = arr; fi.props.value = arr
fi.props.oriForm = other.deepClone(value); fi.props.oriForm = other.deepClone(value)
} }
} }
currentOpenFlowForm.value = formIteamJsonArray; currentOpenFlowForm.value = formIteamJsonArray
selectUserNodeId.value = data.selectUserNodeId; selectUserNodeId.value = data.selectUserNodeId
dialogTableVisible.value = true; dialogTableVisible.value = true
}); })
}; }
const formValue = computed(() => { const formValue = computed(() => {
var obj = {}; var obj = {}
for (var item of currentOpenFlowForm.value) { for (var item of currentOpenFlowForm.value) {
obj[item.id] = item.props.value; obj[item.id] = item.props.value
} }
return obj; return obj
}); })
//明细的添加一个 //明细的添加一个
const addLayoutOneItem = (id) => { const addLayoutOneItem = (id) => {
for (var item of currentOpenFlowForm.value) { for (var item of currentOpenFlowForm.value) {
if (item.id !== id) { if (item.id !== id) {
continue; continue
} }
let value = item.props.value; let value = item.props.value
let oriForm = item.props.oriForm; let oriForm = item.props.oriForm
value.push(other.deepClone(oriForm)); value.push(other.deepClone(oriForm))
item.props.value = value; item.props.value = value
} }
}; }
const deleteLayoutOneItem = (id, index) => { const deleteLayoutOneItem = (id, index) => {
for (var item of currentOpenFlowForm.value) { for (var item of currentOpenFlowForm.value) {
if (item.id !== id) { if (item.id !== id) {
continue; continue
} }
item.props.value.splice(index, 1); item.props.value.splice(index, 1)
} }
}; }
const flowNodeFormatRef = ref(); const flowNodeFormatRef = ref()
</script> </script>