流程业务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">
<span class="center_t" effect="dark" :activeStep="activeStep == 0" @click="activeStep = 0">
<span :activeStep="activeStep == 0">1</span>
<span>{{ $t('flow.basicInformation') }}</span>
<span>{{ $t("flow.basicInformation") }}</span>
</span>
<span class="center_t" effect="dark" :activeStep="activeStep == 1" @click="activeStep = 1">
<span :activeStep="activeStep == 1">2</span>
<span>{{ $t('flow.formDesign') }}</span>
<span>{{ $t("flow.formDesign") }}</span>
</span>
<span class="center_t" effect="dark" :activeStep="activeStep == 2" @click="activeStep = 2">
<span :activeStep="activeStep == 2">3</span>
<span>{{ $t('flow.processDesign') }}</span>
<span>{{ $t("flow.processDesign") }}</span>
</span>
</div>
<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>
<el-scrollbar height="calc(100vh - 250px)">
@@ -37,7 +37,7 @@
<div style="text-align: center">
<el-result v-if="validateFlowStep == 3" icon="success" :title="$t('flow.checkSuccess')" :sub-title="$t('flow.checkSubSuccess')">
<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>
</el-result>
@@ -63,7 +63,7 @@
</div>
</template>
<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>
</el-result>
</div>
@@ -73,160 +73,161 @@
</template>
<script lang="ts" setup>
import { WarnTriangleFilled } from '@element-plus/icons-vue';
import { addFlow } from '/@/api/flow/flow';
import Step1 from './step1.vue';
import Step2 from './step2.vue';
import Step3 from './step3.vue';
import { useFlowStore } from '../workflow/stores/flow';
import { LocationQuery, LocationQueryValue, useRouter } from 'vue-router';
import { WarnTriangleFilled } from "@element-plus/icons-vue"
import { addFlow } from "/@/api/flow/flow"
import Step1 from "./step1.vue"
import Step2 from "./step2.vue"
import Step3 from "./step3.vue"
import { useFlowStore } from "../workflow/stores/flow"
import { LocationQuery, LocationQueryValue, useRouter } from "vue-router"
let store = useFlowStore();
const step1Ref = ref();
const step2Ref = ref();
const step3Ref = ref();
let store = useFlowStore()
const step1Ref = ref()
const step2Ref = ref()
const step3Ref = ref()
const validateErrMsg = ref([]);
const validateErrMsg = ref([])
const activeStep = ref(0);
const validateFlowStep = ref(0);
const validateDialogShow = ref(false);
const validatingShow = ref(false);
const activeStep = ref(0)
const validateFlowStep = ref(0)
const validateDialogShow = ref(false)
const validatingShow = ref(false)
const gotoEdit = () => {
activeStep.value = validateFlowStep.value;
validateDialogShow.value = false;
};
activeStep.value = validateFlowStep.value
validateDialogShow.value = false
}
const publish = (t) => {
validateErrMsg.value = [];
validateErrMsg.value = []
validateFlowStep.value = 0;
validateDialogShow.value = true;
validatingShow.value = true;
validateFlowStep.value = 0
validateDialogShow.value = true
validatingShow.value = true
setTimeout(function () {
//1
checkStep1();
}, 500);
};
import { useRoute } from 'vue-router';
import { getFlowDetail } from '/@/api/flow/flow';
import { useUserInfo } from '/@/stores/userInfo';
import other from '/@/utils/other';
checkStep1()
}, 500)
}
import { useRoute } from "vue-router"
import { getFlowDetail } from "/@/api/flow/flow"
import { useUserInfo } from "/@/stores/userInfo"
import other from "/@/utils/other"
const route = useRoute();
const route = useRoute()
onMounted(() => {
const query: LocationQuery = route.query;
const query: LocationQuery = route.query
const groupId = (query.groupId as LocationQueryValue) ?? '';
const flowId = (query.flowId as LocationQueryValue) ?? '';
const cp = (query.cp as LocationQueryValue) ?? '';
const groupId = (query.groupId as LocationQueryValue) ?? ""
const flowId = (query.flowId as LocationQueryValue) ?? ""
const cp = (query.cp as LocationQueryValue) ?? ""
if (groupId) {
paramGroupId.value = groupId;
paramGroupId.value = groupId
}
if (flowId) {
getFlowDetail(flowId).then((res) => {
var { data } = res;
var { data } = res
store.step1.adminList = JSON.parse(data.adminList);
store.step1.name = data.name;
store.step1.logo = data.logo;
store.step1.adminList = JSON.parse(data.adminList)
store.step1.name = data.name
store.step1.logo = data.logo
if (!cp || !(parseInt(cp) === 1)) {
//复制
store.step1.flowId = flowId;
store.step1.flowId = flowId
}
store.step1.remark = data.remark;
store.step1.groupId = data.groupId;
store.step1.remark = data.remark
store.step1.groupId = data.groupId
store.step1.businessKey = data.businessKey
store.setStep2(JSON.parse(data.formItems));
step3NodeConfig = JSON.parse(data.process);
});
store.setStep2(JSON.parse(data.formItems))
step3NodeConfig = JSON.parse(data.process)
})
} else {
//新增
let userId = useUserInfo().userInfos.user.userId;
let name = useUserInfo().userInfos.user.username;
let avatar = useUserInfo().userInfos.user.avatar;
let userId = useUserInfo().userInfos.user.userId
let name = useUserInfo().userInfos.user.username
let avatar = useUserInfo().userInfos.user.avatar
//清空 store 属性
store.clearStep1();
store.clearStep2();
store.clearStep1()
store.clearStep2()
store.step1.adminList = [
{
id: userId,
name: name,
avatar: avatar,
type: 'user',
type: "user",
},
];
]
}
});
})
let step3NodeConfig = reactive({});
let step3NodeConfig = reactive({})
var paramGroupId = ref();
var paramGroupId = ref()
const checkStep1 = () => {
step1Ref.value.validate(function (valid, arr) {
if (valid) {
validateFlowStep.value = 1;
validateFlowStep.value = 1
setTimeout(function () {
checkStep2();
}, 500);
checkStep2()
}, 500)
} else {
validatingShow.value = false;
validatingShow.value = false
//错误信息
validateErrMsg.value = arr;
validateErrMsg.value = arr
}
});
};
})
}
const checkStep2 = () => {
step2Ref.value.validate(function (valid, arr) {
if (valid) {
setTimeout(function () {
validateFlowStep.value = 2;
checkStep3();
});
validateFlowStep.value = 2
checkStep3()
})
} else {
validatingShow.value = false;
validatingShow.value = false
//错误信息
validateErrMsg.value = arr;
validateErrMsg.value = arr
}
});
};
})
}
const checkStep3 = () => {
setTimeout(function () {
step3Ref.value.validate(function (valid, arr) {
if (valid) {
validateFlowStep.value = 3;
validateFlowStep.value = 3
} else {
validatingShow.value = false;
validatingShow.value = false
//错误信息
validateErrMsg.value = arr;
validateErrMsg.value = arr
}
});
});
};
const router = useRouter();
})
})
}
const router = useRouter()
const submitFlow = () => {
step3Ref.value.getProcessData().then((res) => {
let step1 = store.step1;
let step2 = store.step2;
let step1 = store.step1
let step2 = store.step2
let flow = other.deepClone(step1);
flow.formItems = JSON.stringify(step2);
flow.process = JSON.stringify(res);
flow.adminList = JSON.stringify(step1.adminList);
let flow = other.deepClone(step1)
flow.formItems = JSON.stringify(step2)
flow.process = JSON.stringify(res)
flow.adminList = JSON.stringify(step1.adminList)
addFlow(flow).then((res) => {
validateDialogShow.value = false;
store.$reset();
router.push('/flow/list/index');
});
});
};
validateDialogShow.value = false
store.$reset()
router.push("/flow/list/index")
})
})
}
</script>
<style scoped lang="scss">
.f2-width {
@@ -278,7 +279,7 @@ const submitFlow = () => {
display: inline-block;
}
.center_t span:first-child[activeStep='true'] {
.center_t span:first-child[activeStep="true"] {
color: white;
background-color: var(--el-color-primary);
}
@@ -288,7 +289,7 @@ const submitFlow = () => {
font-size: 18px;
}
.center_t[activeStep='true'] {
.center_t[activeStep="true"] {
border-bottom: 2px solid var(--el-color-primary);
color: var(--el-color-primary);
}