1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <script setup name="FormDesign">
- import FcDesigner from '@/components/FormCreateDesigner/FcDesigner.vue'
- import useFlowStore from '@/store/modules/flow'
- import { storeToRefs } from 'pinia'
- import process from '@/api/flow/process'
- import { onMounted, computed, ref } from 'vue'
- const flowStore = useFlowStore()
- const { flowProcessId, basicInfo } = storeToRefs(flowStore)
- const designer = ref()
- const exportJsonEv = async json => {
- console.log(json)
- try {
- const _json = JSON.stringify(json)
- const params = {
- processId: flowProcessId.value,
- processForm: JSON.stringify(json),
- ...basicInfo.value
- }
- const res = await process.progressCreateApi(params)
- flowStore.setProcessForm(_json)
- flowProcessId.value = res
- } catch (e) {
- console.log(e)
- }
- }
- // 当前是否是编辑
- const queryObj = computed(() => route.query)
- onMounted(() => {
- if (queryObj.value.id) {
- designer.value.initData(flowStore.processForm.value)
- }
- })
- </script>
- <template>
- <fc-designer ref="designer" @export-json="exportJsonEv" />
- </template>
- <style scoped lang="scss"></style>
|