|
@@ -40,7 +40,7 @@
|
|
<div v-show="tabName === 'ApprovalInfo'" class="scroll-wrap">
|
|
<div v-show="tabName === 'ApprovalInfo'" class="scroll-wrap">
|
|
<!-- 系统表单-->
|
|
<!-- 系统表单-->
|
|
<template v-if="currentTaskRow.processType === 'business' && currentObj?.formTemplate.type === 1">
|
|
<template v-if="currentTaskRow.processType === 'business' && currentObj?.formTemplate.type === 1">
|
|
- <component :is="dyVueComponent" ref="dyVueComponentRef"></component>
|
|
|
|
|
|
+ <component :is="dyVueComponent" ref="dyVueComponentRef" @form-valid="openComment('consentOrRefuseVisible', 'agree')"></component>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<!-- 表单设计 -->
|
|
<!-- 表单设计 -->
|
|
@@ -135,7 +135,7 @@
|
|
v-if="currentTaskType === 'pendingApproval'"
|
|
v-if="currentTaskType === 'pendingApproval'"
|
|
:icon="Check"
|
|
:icon="Check"
|
|
type="primary"
|
|
type="primary"
|
|
- @click="openComment('consentOrRefuseVisible', 'agree')"
|
|
|
|
|
|
+ @click="handleFormValid"
|
|
>同意</el-button
|
|
>同意</el-button
|
|
>
|
|
>
|
|
<el-button
|
|
<el-button
|
|
@@ -324,6 +324,31 @@ const dyVueForm = ref({})
|
|
const currentObj = ref()
|
|
const currentObj = ref()
|
|
provide('dyVueForm', dyVueForm) // 这里主要是存放动态的form的属性值
|
|
provide('dyVueForm', dyVueForm) // 这里主要是存放动态的form的属性值
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * 1、校验表单
|
|
|
|
+ * 1.1 type=1 校验系统表单
|
|
|
|
+ * 1.2 type=0 校验表单设计
|
|
|
|
+ * 2、提交API
|
|
|
|
+ */
|
|
|
|
+const handleFormValid = () => {
|
|
|
|
+ const { processType } = currentTaskRow.value
|
|
|
|
+ const flag = processType === 'business' && currentObj.value.formTemplate.type === 1 // 系统表单
|
|
|
|
+ if (flag) {
|
|
|
|
+ dyVueComponentRef.value.validateForm()
|
|
|
|
+ } else {
|
|
|
|
+ validateDesignForm()
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 校验表单设计
|
|
|
|
+const validateDesignForm = () => {
|
|
|
|
+ const form = EReditorRef.value.getSelfFormRef()
|
|
|
|
+ form.validate(valid => {
|
|
|
|
+ if (!valid) return false
|
|
|
|
+ openComment('consentOrRefuseVisible', 'agree')
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 详情按钮各个操作弹窗
|
|
* 详情按钮各个操作弹窗
|
|
* @param visibleType 评论 拒绝 同意等
|
|
* @param visibleType 评论 拒绝 同意等
|
|
@@ -339,34 +364,25 @@ const openComment = async (visibleType, item) => {
|
|
break
|
|
break
|
|
case 'consentOrRefuseVisible':
|
|
case 'consentOrRefuseVisible':
|
|
currentFormData.value = {}
|
|
currentFormData.value = {}
|
|
- // 点击同意
|
|
|
|
- let bool = true
|
|
|
|
if (item === 'agree') {
|
|
if (item === 'agree') {
|
|
const { processType } = currentTaskRow.value
|
|
const { processType } = currentTaskRow.value
|
|
const flag = processType === 'business' && currentObj.value.formTemplate.type === 1 // 系统表单
|
|
const flag = processType === 'business' && currentObj.value.formTemplate.type === 1 // 系统表单
|
|
if (flag) {
|
|
if (flag) {
|
|
- //todo 这里的系统表单还未做必填校验,根据自己的业务做校验
|
|
|
|
const formData = dyVueComponentRef.value.getComponentData()
|
|
const formData = dyVueComponentRef.value.getComponentData()
|
|
const saveData = {
|
|
const saveData = {
|
|
|
|
+ // 这里要调整真实的URL
|
|
|
|
+ // formStructure: currentObj.value.formTemplate.pcUrl,
|
|
formStructure: '@/views/flow/test/test1.vue',
|
|
formStructure: '@/views/flow/test/test1.vue',
|
|
- formData: formData
|
|
|
|
|
|
+ formData
|
|
}
|
|
}
|
|
currentFormData.value = { processForm: JSON.stringify(saveData) }
|
|
currentFormData.value = { processForm: JSON.stringify(saveData) }
|
|
} else {
|
|
} else {
|
|
- const form = EReditorRef.value.getSelfFormRef()
|
|
|
|
- bool = await form.validate(valid => {
|
|
|
|
- if (valid) {
|
|
|
|
- // 表单验证通过 进行保存
|
|
|
|
- const formData = EReditorRef.value.getData()
|
|
|
|
- let processForm = JSON.parse(cur_processForm_str)
|
|
|
|
- processForm = { ...processForm, formData }
|
|
|
|
- currentFormData.value = { processForm: JSON.stringify(processForm) }
|
|
|
|
- console.log('验证通过')
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ const formData = EReditorRef.value.getData()
|
|
|
|
+ let processForm = JSON.parse(cur_processForm_str)
|
|
|
|
+ processForm = { ...processForm, formData }
|
|
|
|
+ currentFormData.value = { processForm: JSON.stringify(processForm) }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (!bool) return
|
|
|
|
currentType.value = item
|
|
currentType.value = item
|
|
consentOrRefuseVisible.value = !consentOrRefuseVisible.value
|
|
consentOrRefuseVisible.value = !consentOrRefuseVisible.value
|
|
break
|
|
break
|
|
@@ -445,6 +461,7 @@ const getTaskDetail = () => {
|
|
desc: '啦啦啦'
|
|
desc: '啦啦啦'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // dyVueComponent.value = markRaw(defineAsyncComponent(() => import('@/views/flow/test/test1.vue')))
|
|
dyVueComponent.value = defineAsyncComponent(async () => await /* @vite-ignore */ modules[data.formTemplate.pcUrl]())
|
|
dyVueComponent.value = defineAsyncComponent(async () => await /* @vite-ignore */ modules[data.formTemplate.pcUrl]())
|
|
return
|
|
return
|
|
} else {
|
|
} else {
|