|
@@ -1,14 +1,86 @@
|
|
|
<template>
|
|
|
- <div class="hc-task-form-body">
|
|
|
- 暂无
|
|
|
+ <div class="mass-form">
|
|
|
+ <hc-new-card>
|
|
|
+ <template #header>
|
|
|
+ <el-select v-model="pdfUrl" placeholder="选择文件" block @change="changPdf">
|
|
|
+ <template v-for="item in pdfList" :key="item.id">
|
|
|
+ <el-option :label="item.fileName" :value="item.filePdfUrl" />
|
|
|
+ </template>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ <hc-pdfs v-if="pdfList.length > 0" :url="pdfUrl" />
|
|
|
+
|
|
|
+ <hc-empty v-else :src="nullPng" title="暂无表单" />
|
|
|
+ </hc-new-card>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+import { onMounted, ref, watch } from 'vue'
|
|
|
+import nullPng from '~src/assets/view/null.svg'
|
|
|
+import mainApi from '~api/tasks/hc-data'
|
|
|
+import { getArrValue, getObjValue } from 'js-fast-way'
|
|
|
+const props = defineProps({
|
|
|
+ info: {
|
|
|
+ type: Object,
|
|
|
+ default: () => ({}),
|
|
|
+ },
|
|
|
+ table: {
|
|
|
+ type: Object,
|
|
|
+ default: () => ({}),
|
|
|
+ },
|
|
|
+
|
|
|
+})
|
|
|
+const info = ref(props.info)
|
|
|
+const tableInfo = ref(props.table)
|
|
|
+//监听数据
|
|
|
+watch(() => [
|
|
|
+ props.info,
|
|
|
+ props.table,
|
|
|
+], ([ row, table1]) => {
|
|
|
|
|
|
+
|
|
|
+ info.value = row
|
|
|
+ tableInfo.value = table1
|
|
|
+ const dataId = tableInfo.value.id
|
|
|
+ if (dataId) {
|
|
|
+ getDataDetail()
|
|
|
+ }
|
|
|
+
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+const getDataDetail = async () => {
|
|
|
+ const id = info.value.id
|
|
|
+ const dataId = tableInfo.value.id
|
|
|
+
|
|
|
+ const { data } = await mainApi.getDataDetail({ id, dataId })
|
|
|
+ //转换数据
|
|
|
+ const { attachmentFormTask } = getObjValue(data)
|
|
|
+ pdfList.value = getArrValue(attachmentFormTask)
|
|
|
+ if (pdfList.value.length > 0) {
|
|
|
+ pdfUrl.value = pdfList.value[0].filePdfUrl
|
|
|
+ } else {
|
|
|
+ pdfUrl.value = ''
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+//渲染完成
|
|
|
+onMounted(() => {
|
|
|
+
|
|
|
+})
|
|
|
+
|
|
|
+const pdfList = ref([])
|
|
|
+
|
|
|
+const pdfUrl = ref('')
|
|
|
+const changPdf = (url) => {
|
|
|
+ pdfUrl.value = url
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-
|
|
|
+.mass-form{
|
|
|
+ height: calc(100vh - 324px);
|
|
|
+}
|
|
|
</style>
|
|
|
|