ZaiZai 1 سال پیش
والد
کامیت
a97acaf63f
2فایلهای تغییر یافته به همراه15 افزوده شده و 3 حذف شده
  1. 11 2
      src/views/tasks/components/hc-data/task-form.vue
  2. 4 1
      src/views/tasks/components/hc-data/task-review.vue

+ 11 - 2
src/views/tasks/components/hc-data/task-form.vue

@@ -37,6 +37,7 @@
 <script setup>
 import { onMounted, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
+import { getObjValue } from 'js-fast-way'
 import HcMiddlepayForm from './middlepay-form.vue'
 import HcMassForm from './mass-form.vue'
 import HcStartWorkForm from './start-work-form.vue'
@@ -116,11 +117,9 @@ const tableSubmitClick = async () => {
         window.$message.error('请先填写驳回原因')
         return
     }
-    const tableData = htmlFormRef.value?.getTableForm()
     //发起请求
     const { error, code, msg } = await mainApi.taskAudit({
         ...taskForm.value,
-        tableData: tableData,
         dataId: tableInfo.value.id,
         taskId: taskInfo.value.id,
         projectId: projectId.value,
@@ -133,6 +132,16 @@ const tableSubmitClick = async () => {
         window.$message.error(msg ?? '提交失败')
     }
 }
+
+//获取表单数据
+const getTableForm = () => {
+    const res = htmlFormRef.value?.getTableForm()
+    return getObjValue(res)
+}
+
+defineExpose({
+    getTableForm,
+})
 </script>
 
 <style lang="scss" scoped>

+ 4 - 1
src/views/tasks/components/hc-data/task-review.vue

@@ -91,7 +91,7 @@
                 </div>
                 <div :id="`hc_task_form_${uuid}`" class="hc-task-form" :class="`is-tab-${taskTabsKey}`">
                     <hc-body class="hc-task-body-card" padding="10px" scrollbar>
-                        <HcTaskForm :table="tableInfo" :info="rowInfo" :detail="detailInfo" :is-edit="tabsKey === 1" @finish="taskFormFinish" @tab-tap="taskTabsClick" />
+                        <HcTaskForm ref="htmlFormRef" :table="tableInfo" :info="rowInfo" :detail="detailInfo" :is-edit="tabsKey === 1" @finish="taskFormFinish" @tab-tap="taskTabsClick" />
                     </hc-body>
                 </div>
             </div>
@@ -375,9 +375,12 @@ const isCheckSmsCodeTime = () => {
 //短信验证
 const SMSAuthLoading = ref(false)
 const SMSAuthShow = ref(false)
+const htmlFormRef = ref(null)
 const SMSAuthConfirm = async () => {
     confirmLoading.value = true
+    const tableData = htmlFormRef.value?.getTableForm()
     const { error, code, msg } = await mainApi.taskApprove({
+        tableData: tableData,
         taskId: rowInfo.value.id,
         projectId: projectId.value,
         contractId: contractId.value,