Răsfoiți Sursa

fix: tab 切换问题 & 提交 校验问题

lanceJiang 1 an în urmă
părinte
comite
033db3ce5c

+ 12 - 8
src/views/flow/create/components/FormDesign.vue

@@ -1,4 +1,4 @@
-<script setup>
+<script setup name="FormDesign">
 import { onBeforeUnmount, onMounted, ref } from 'vue'
 import { erFormEditor } from 'everright-formeditor'
 import 'Everright-formEditor/dist/style.css'
@@ -23,12 +23,14 @@ const validate = () => {
 	// 根据后续的业务需求 调整 validate 的功能
 	exportJsonEv()
 	return new Promise((resolve, reject) => {
-		const bool = true
-		if (bool) {
-			resolve(true)
-		} else {
-			reject(false)
-		}
+		// const finallyFormData = JSON.parse(processForm.value)
+		// const fields = finallyFormData.map(item => item.field)
+		// const bool = fields.length === [...new Set(fields)].length
+		// if (bool) {
+		resolve(true)
+		// } else {
+		//   reject(false)
+		// }
 	})
 }
 
@@ -62,5 +64,7 @@ defineExpose({
 })
 </script>
 <template>
-	<er-form-editor ref="EReditorRef" :is-show-i18n="false" @listener="handleListener" />
+	<div class="form-design-wrap">
+		<er-form-editor ref="EReditorRef" :is-show-i18n="false" @listener="handleListener" />
+	</div>
 </template>

+ 5 - 5
src/views/flow/create/index.vue

@@ -117,6 +117,7 @@ const submitHandler = async () => {
 	}
 	const res = await process.progressCreateApi(params)
 	console.log('---r-e-s----', res)
+	ElMessage.success('操作成功')
 	// 创建完成 删除 当前tab页
 	removeCurTab()
 }
@@ -138,10 +139,10 @@ const validateTabs = async () => {
 			}
 		await _validate().catch(e => {
 			activeTab.value = componentsArr[i].label
-			// 表单设计 额外 弹窗
-			// if (activeTab.value === '表单设计') {
-			// 	ElMessage.error(`表单设计中字段ID不能重复,请确认唯一值`)
-			// }
+			/*// 表单设计 额外 弹窗
+			if (activeTab.value === '表单设计') {
+				ElMessage.error(`表单设计中字段ID不能重复,请确认唯一值`)
+			}*/
 			bool = false
 		})
 		if (!bool) return false
@@ -170,7 +171,6 @@ const activeComponent = index => {
 const queryObj = computed(() => route.query)
 
 const getCurrentProcessDetailEv = () => {
-	// console.error('api 请求')
 	let _id = queryObj.value.id
 	if (_id) {
 		cache_components.value = {}