Jelajahi Sumber

任务的html

ZaiZai 1 tahun lalu
induk
melakukan
cf08b9cac4

+ 30 - 31
src/views/tasks/components/hc-data/html-form.vue

@@ -1,53 +1,47 @@
 <template>
     <div class="hc-task-html-form-body">
-        <hc-table-form ref="htmlRef" :form="htmlForm" :html="tableHtml" :loading="htmlLoading" @render="htmlRender" />
+        <hc-table-form v-if="detailInfo.opinionType === 1 && tableHtml" ref="htmlRef" :form="htmlForm" :html="tableHtml" :loading="htmlLoading" @render="htmlRender" />
+        <hc-pdf v-else-if="detailInfo.opinionType === 2 && HtmlPdfUrl" :src="HtmlPdfUrl" />
+        <hc-empty v-else-if="detailInfo.opinionType === 3" :src="nullPng" title="当前暂无审计咨询意见" />
+        <hc-empty v-else :src="noDataPng" />
     </div>
 </template>
 
 <script setup>
 import { onMounted, ref, watch } from 'vue'
-import tableHtml from '../html-form/html'
+import { getObjValue } from 'js-fast-way'
+import nullPng from '~src/assets/view/null.svg'
+import noDataPng from '~src/assets/view/no-data.svg'
 
 const props = defineProps({
-    isEdit: {
-        type: Boolean,
-        default: true,
-    },
-    info: {
-        type: Object,
-        default: () => ({}),
-    },
-    table: {
-        type: Object,
-        default: () => ({}),
-    },
     detail: {
         type: Object,
         default: () => ({}),
     },
 })
 
-//监听可否编辑
-const isEdits = ref(props.isEdit)
-watch(() => props.isEdit, (val) => {
-    isEdits.value = val
-}, { immediate: true, deep: true })
-
 //监听数据
-watch(() => [props.table, props.info, props.detail], ([table, row, detail]) => {
-    setTaskInfo(table, row, detail)
+const detailInfo = ref(props.detail)
+watch(() => props.detail, (detail) => {
+    setTaskInfo(detail)
 }, { deep: true })
 
 //渲染完成
+const opinionType = ref(0)
 onMounted(() => {
-    setTaskInfo(props.table, props.info, props.detail)
+    setTaskInfo(props.detail)
 })
 
 //设置任务信息
-const detailInfo = ref(props.detail)
-const setTaskInfo = (table, row, info) => {
-    console.log(info)
+const tableHtml = ref('')
+const HtmlPdfUrl = ref('')
+const setTaskInfo = (info) => {
+    htmlLoading.value = true
     detailInfo.value = info
+    opinionType.value = info.opinionType
+    tableHtml.value = info.tableHtml
+    htmlForm.value = getObjValue(info.tableData)
+    HtmlPdfUrl.value = info.pdfUrl
 }
 
 //填写的表单
@@ -56,12 +50,17 @@ const htmlForm = ref({})
 const htmlLoading = ref(false)
 const htmlRender = (form) => {
     htmlForm.value = form
+    htmlLoading.value = false
 }
-</script>
-
-<style lang="scss" scoped>
-.hc-task-html-form-body {
 
+//获取表单数据
+const getTableForm = () => {
+    const res = htmlRef.value?.getFormData()
+    return getObjValue(res)
 }
-</style>
+
+defineExpose({
+    getTableForm,
+})
+</script>
 

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

@@ -8,7 +8,7 @@
                 <HcMassForm :table="tableInfo" :info="taskInfo" :is-edit="isEdits" />
             </el-tab-pane>
             <el-tab-pane name="key3" label="审计咨询意见">
-                <HcHtmlForm :table="tableInfo" :info="taskInfo" :detail="detailInfo" :is-edit="isEdits" />
+                <HcHtmlForm ref="htmlFormRef" :detail="detailInfo" />
             </el-tab-pane>
         </el-tabs>
         <HcMaterialForm v-if="taskInfo.meterType === 2" :table="tableInfo" :info="taskInfo" :is-edit="isEdits" />
@@ -105,6 +105,7 @@ onMounted(() => {
 const taskForm = ref({ auditStatus: 0, repealDesc: '' })
 
 //单条提交
+const htmlFormRef = ref(null)
 const tableSubmitClick = async () => {
     const { auditStatus, repealDesc } = taskForm.value
     if (auditStatus === 0) {
@@ -115,9 +116,11 @@ 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,

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

@@ -114,7 +114,6 @@
 <script setup>
 import { nextTick, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
-import HcHtmlForm from '~src/views/tasks/components/hc-data/html-form.vue'
 import HcTaskForm from './task-form.vue'
 import HcTaskNotes from './task-notes.vue'
 import HcRepealForm from './repeal-form.vue'