ZaiZai 1 жил өмнө
parent
commit
9e8a5c9f75

+ 14 - 4
src/views/project/gist/create.vue

@@ -46,7 +46,7 @@
 
 <script setup>
 import { onMounted, ref, watch } from 'vue'
-import { deepClone, getArrValue, getRandom } from 'js-fast-way'
+import { deepClone, formValidate, getArrValue, getRandom } from 'js-fast-way'
 import { getDictionaryData } from '~src/utils/tools'
 import mainApi from '~api/project/gist'
 
@@ -150,9 +150,19 @@ const cancelClick = () => {
 
 //创建 保存
 const saveClick = async () => {
-    const form = baseForm.value
-    console.log(form)
-    console.log('保存')
+    //验证基础表单
+    const isForm = await formValidate(baseFormRef.value)
+    //验证列表表单
+    let isGistForm = true
+    const refs = getArrValue(gistRefs.value)
+    for (let i = 0; i < refs.length; i++) {
+        const form = await formValidate(refs[i])
+        if (!form) isGistForm = false
+    }
+    if (!isForm || !isGistForm) return
+    //处理表单数据
+    const form = baseForm.value, gist = workFocusEntityList.value
+    console.log(form, gist)
 }
 </script>