|
@@ -21,28 +21,31 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="create-approval-header-right">
|
|
|
- <el-button @click="saveHandler" v-if="false">暂存</el-button>
|
|
|
+ <el-button v-if="false" @click="saveHandler">暂存</el-button>
|
|
|
<el-button type="primary" @click="submitHandler">发布</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="create-approval-main">
|
|
|
- <component :is="currentComponent" />
|
|
|
+ <component :is="currentComponent" ref="dyncComponent" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="flow_create">
|
|
|
-import { computed, ref } from 'vue'
|
|
|
+import { computed, nextTick, ref, watch } from 'vue'
|
|
|
import { storeToRefs } from 'pinia'
|
|
|
import useFlowStore from '@/store/modules/flow'
|
|
|
import BasicInfoTab from './components/BasicInfo.vue'
|
|
|
import ExtendSetTab from './components/ExtendSet.vue'
|
|
|
import FlowDesignTab from './components/FlowDesign.vue'
|
|
|
import FormDesignTab from './components/FormDesign.vue'
|
|
|
-import {ElMessage} from "element-plus";
|
|
|
-
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import process from '@/api/flow/process'
|
|
|
+import { useRoute } from 'vue-router'
|
|
|
+const route = useRoute()
|
|
|
const flowStore = useFlowStore()
|
|
|
const { flowName, flowProcessId } = storeToRefs(flowStore)
|
|
|
+const dyncComponent = ref() // 实例化子组件
|
|
|
const componentsArr = [
|
|
|
{
|
|
|
component: BasicInfoTab,
|
|
@@ -81,7 +84,7 @@ const saveHandler = () => {
|
|
|
}
|
|
|
|
|
|
const activeComponent = item => {
|
|
|
- if (!flowProcessId.value) {
|
|
|
+ if (!flowProcessId.value && JSON.stringify(queryObj.value) === '{}') {
|
|
|
return ElMessage({
|
|
|
message: '请先保存基础信息',
|
|
|
type: 'error'
|
|
@@ -93,6 +96,26 @@ const activeComponent = item => {
|
|
|
const currentComponent = computed(() => {
|
|
|
return componentsArr.find(item => item.label === activeName.value)?.component
|
|
|
})
|
|
|
+const queryObj = computed(() => route.query)
|
|
|
+const getCurrentProcessDetailEv = () => {
|
|
|
+ process.processDetailApi(queryObj.value.id).then(res => {
|
|
|
+ const { processForm, ...rest } = res
|
|
|
+ dyncComponent.value.setBaseicInfo(rest)
|
|
|
+ flowStore.setProcessForm(processForm)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+watch(
|
|
|
+ () => queryObj.value,
|
|
|
+ (newPath, oldPath) => {
|
|
|
+ if (JSON.stringify(newPath) !== '{}') {
|
|
|
+ nextTick(() => {
|
|
|
+ getCurrentProcessDetailEv()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { immediate: true }
|
|
|
+)
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|