Ver código fonte

历史验收报告切换修改

duy 1 ano atrás
pai
commit
525c4023f1

+ 14 - 20
src/views/transfer/components/table-classify.vue

@@ -56,8 +56,8 @@
         >
             <template #header>
                 <div class="hc-select-view w-52">
-                    <el-select v-model="pdfDate" placeholder="选择日期" @change="changePdfDate">
-                        <el-option v-for="item in timeData " :label="item" :value="item" />
+                    <el-select v-model="pdfDateId" placeholder="选择日期" @change="changePdfDate">
+                        <el-option v-for="item in reportData" :key="item.id" :label="item.approveDate" :value="item.id" />
                     </el-select>
                 </div>
                 <div class="hc-title-view">{{ tableTitle }})</div>
@@ -256,27 +256,21 @@ const isSubmitReportDrawer = ref(false)
 const reportData = ref([])
 const timeData = ref([])
 const onSubmitReportClick = async () => {
-    const { error, code, data } = await initialgApi.getHistoryTable({
+    const { data } = await initialgApi.getHistoryTable({
         projectId: projectId.value,
     })
-    if (!error && code === 200) {
-        reportData.value = getArrValue(data)
-        const dataString = arrToKey( reportData.value, 'approveDate', ',')
-        timeData.value = dataString.split(',')
-      if (timeData.value.length > 0) {
-        pdfDate.value = timeData.value[0]
-        curPdf.value = reportData.value[0].tableUrl
-        tableTitle.value = reportData.value[0].tableTitle
+    const res = getArrValue(data)
+    reportData.value = res
+    if (res.length >= 0) {
+        pdfDateId.value = res[0].id
+        curPdf.value = res[0].tableUrl
+        tableTitle.value = res[0].tableTitle
         isSubmitReportDrawer.value = true
-      }
-       
     } else {
-        reportData.value = []
-     
+        window.$message?.warning('暂无历史报告')
     }
-   
 }
-const pdfDate = ref(null)
+const pdfDateId = ref(null)
 const curPdf = ref('')
 const tableTitle = ref('')
 //历史报告
@@ -284,10 +278,10 @@ const onSubmitReportDrawerClose = () => {
     isSubmitReportDrawer.value = false
     curPdf.value = ''
 }
-const changePdfDate = (val)=>{
+const changePdfDate = (val) => {
     reportData.value.forEach((ele)=>{
-        if (ele.approveDate === val) {
-            curPdf.value = ele.
+        if (ele.id === val) {
+            curPdf.value = ele.tableUrl
             tableTitle.value = ele.tableTitle
         }
     })

+ 13 - 19
src/views/transfer/components/table-collect.vue

@@ -69,8 +69,8 @@
         >
             <template #header>
                 <div class="hc-select-view w-52">
-                    <el-select v-model="pdfDate" placeholder="选择日期" @change="changePdfDate">
-                        <el-option v-for="item in timeData " :label="item" :value="item" />
+                    <el-select v-model="pdfDateId" placeholder="选择日期" @change="changePdfDate">
+                        <el-option v-for="item in reportData" :key="item.id" :label="item.approveDate" :value="item.id" />
                     </el-select>
                 </div>
                 <div class="hc-title-view">{{ tableTitle }}</div>
@@ -295,27 +295,21 @@ const isSubmitReportDrawer = ref(false)
 const reportData = ref([])
 const timeData = ref([])
 const onSubmitReportClick = async () => {
-    const { error, code, data } = await initialgApi.getHistoryTable({
+    const { data } = await initialgApi.getHistoryTable({
         projectId: projectId.value,
     })
-    if (!error && code === 200) {
-        reportData.value = getArrValue(data)
-        const dataString = arrToKey( reportData.value, 'approveDate', ',')
-        timeData.value = dataString.split(',')
-      if (timeData.value.length > 0) {
-        pdfDate.value = timeData.value[0]
-        curPdf.value = reportData.value[0].tableUrl
-        tableTitle.value = reportData.value[0].tableTitle
+    const res = getArrValue(data)
+    reportData.value = res
+    if (res.length >= 0) {
+        pdfDateId.value = res[0].id
+        curPdf.value = res[0].tableUrl
+        tableTitle.value = res[0].tableTitle
         isSubmitReportDrawer.value = true
-      }
-       
     } else {
-        reportData.value = []
-     
+        window.$message?.warning('暂无历史报告')
     }
-   
 }
-const pdfDate = ref(null)
+const pdfDateId = ref(null)
 const curPdf = ref('')
 const tableTitle = ref('')
 //历史报告
@@ -323,9 +317,9 @@ const onSubmitReportDrawerClose = () => {
     isSubmitReportDrawer.value = false
     curPdf.value = ''
 }
-const changePdfDate = (val)=>{
+const changePdfDate = (val) => {
     reportData.value.forEach((ele)=>{
-        if (ele.approveDate === val) {
+        if (ele.id === val) {
             curPdf.value = ele.tableUrl
             tableTitle.value = ele.tableTitle
         }

+ 13 - 19
src/views/transfer/write-report.vue

@@ -40,8 +40,8 @@
         >
             <template #header>
                 <div class="hc-select-view w-52">
-                    <el-select v-model="pdfDate" placeholder="选择日期" @change="changePdfDate">
-                        <el-option v-for="item in timeData " :label="item" :value="item" />
+                    <el-select v-model="pdfDateId" placeholder="选择日期" @change="changePdfDate">
+                        <el-option v-for="item in timeData " :key="item.id" :label="item.approveDate" :value="item.id" />
                     </el-select>
                 </div>
                 <div class="hc-title-view">{{ tableTitle }}</div>
@@ -166,27 +166,21 @@ const isSubmitReportDrawer = ref(false)
 const reportData = ref([])
 const timeData = ref([])
 const onSubmitReportClick = async () => {
-    const { error, code, data } = await initialgApi.getHistoryTable({
+    const { data } = await initialgApi.getHistoryTable({
         projectId: projectId.value,
     })
-    if (!error && code === 200) {
-        reportData.value = getArrValue(data)
-        const dataString = arrToKey( reportData.value, 'approveDate', ',')
-        timeData.value = dataString.split(',')
-      if (timeData.value.length > 0) {
-        pdfDate.value = timeData.value[0]
-        curPdf.value = reportData.value[0].tableUrl
-        tableTitle.value = reportData.value[0].tableTitle
+    const res = getArrValue(data)
+    reportData.value = res
+    if (res.length >= 0) {
+        pdfDateId.value = res[0].id
+        curPdf.value = res[0].tableUrl
+        tableTitle.value = res[0].tableTitle
         isSubmitReportDrawer.value = true
-      }
-       
     } else {
-        reportData.value = []
-     
+        window.$message?.warning('暂无历史报告')
     }
-   
 }
-const pdfDate = ref(null)
+const pdfDateId = ref(null)
 const curPdf = ref('')
 const tableTitle = ref('')
 //历史报告
@@ -194,9 +188,9 @@ const onSubmitReportDrawerClose = () => {
     isSubmitReportDrawer.value = false
     curPdf.value = ''
 }
-const changePdfDate = (val)=>{
+const changePdfDate = (val) => {
     reportData.value.forEach((ele)=>{
-        if (ele.approveDate === val) {
+        if (ele.id === val) {
             curPdf.value = ele.tableUrl
             tableTitle.value = ele.tableTitle
         }