2025-05-23 01:48:28 +00:00
|
|
|
|
<!-- component标签可以变换组件 -->
|
|
|
|
|
<template>
|
2025-05-26 07:00:08 +00:00
|
|
|
|
<component :is="asyncComponent" :formData="formData" :history="history" :activeKey="activeKey" v-if="asyncComponent"
|
|
|
|
|
@getStampSuc="getStampSuccess"></component>
|
2025-05-23 01:48:28 +00:00
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
2025-05-26 07:00:08 +00:00
|
|
|
|
import { ref, reactive, onMounted, computed, watch, nextTick } from 'vue';
|
|
|
|
|
const compName = ref('');
|
|
|
|
|
const asyncComponent = ref(null);
|
|
|
|
|
const modules = import.meta.glob('/src/pages-bpm/**/*.vue');
|
|
|
|
|
|
|
|
|
|
|
2025-05-23 01:48:28 +00:00
|
|
|
|
defineOptions({
|
2025-05-26 07:00:08 +00:00
|
|
|
|
name: 'DynamicLink',
|
|
|
|
|
options: {
|
|
|
|
|
styleIsolation: 'shared',
|
|
|
|
|
},
|
2025-05-23 01:48:28 +00:00
|
|
|
|
})
|
|
|
|
|
const props = defineProps({
|
2025-05-26 07:00:08 +00:00
|
|
|
|
path: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ""
|
|
|
|
|
},
|
|
|
|
|
history: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ""
|
|
|
|
|
},
|
|
|
|
|
activeKey: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ""
|
|
|
|
|
},
|
|
|
|
|
formData: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => { },
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 01:48:28 +00:00
|
|
|
|
})
|
|
|
|
|
// 监听 option 变化
|
|
|
|
|
watch(() => props.path, (newVal) => {
|
2025-05-26 07:00:08 +00:00
|
|
|
|
if (newVal) compName.value = newVal;
|
|
|
|
|
//动态加载页面
|
|
|
|
|
const comp = modules[`/src/pages-bpm/${compName.value}.vue`]
|
|
|
|
|
comp().then((myModule) => {
|
|
|
|
|
asyncComponent.value = myModule.default
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
|
|
|
|
})
|
2025-05-23 01:48:28 +00:00
|
|
|
|
}, {
|
2025-05-26 07:00:08 +00:00
|
|
|
|
deep: true,
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
immediate: true
|
|
|
|
|
// #endif
|
2025-05-23 01:48:28 +00:00
|
|
|
|
});
|
2025-05-26 07:00:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getStampSuccess = (val) => {
|
|
|
|
|
// this.$emit('getStampSuc', val)
|
|
|
|
|
// //在<component>标签动态组件使用vuex,没有保存成功。
|
|
|
|
|
// //所以先传出来再试一下
|
|
|
|
|
// this.$store.commit("cache/setEsignTags", {
|
|
|
|
|
// esignTag: val
|
|
|
|
|
// });
|
2025-05-23 01:48:28 +00:00
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2025-05-26 07:00:08 +00:00
|
|
|
|
|
|
|
|
|
</style>
|