Browse Source

中间计量查看报表修改

duy 1 year ago
parent
commit
07dd10f985
2 changed files with 29 additions and 21 deletions
  1. 14 19
      src/components/view-report/view-report.vue
  2. 15 2
      src/views/debit-pay/admin/certificate.vue

+ 14 - 19
src/components/view-report/view-report.vue

@@ -3,21 +3,9 @@
         <div class="relative h-full flex">
             <div :id="`hc_tree_card_${uuid}`">
                 <hc-new-card scrollbar>
-                    <div class="hc-pdf-view-report-item">
+                    <div v-for="(item, index1) in pdfData" :key="index1" class="hc-pdf-view-report-item" :class="pdfIndex === index1 ? 'cur' : ''" @click="changePdf(item, index1)">
                         <hc-icon name="printer" />
-                        <span class="name">中间支付报表封面</span>
-                    </div>
-                    <div class="hc-pdf-view-report-item cur">
-                        <hc-icon name="printer" />
-                        <span class="name">工程进度款审核表</span>
-                    </div>
-                    <div class="hc-pdf-view-report-item">
-                        <hc-icon name="printer" />
-                        <span class="name">中间计量支付证书</span>
-                    </div>
-                    <div class="hc-pdf-view-report-item">
-                        <hc-icon name="printer" />
-                        <span class="name">中间计量支付申请表</span>
+                        <span class="name">{{ item.title }}</span>
                     </div>
                 </hc-new-card>
             </div>
@@ -29,7 +17,7 @@
                     <template #extra>
                         <el-button hc-btn type="warning" @click="backClick">返回</el-button>
                     </template>
-                    <hc-pdfs url="http://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20230504/911982ba85e66cfa58fb02d5a738bb2b.pdf" />
+                    <hc-pdfs :url="pdfUrl" />
                 </hc-new-card>
             </div>
         </div>
@@ -69,6 +57,7 @@ const isShow = defineModel('modelValue', {
 watch(isShow, (val) => {
     if (val) {
         setSplitRef()
+        pdfIndex.value = 0
     }
 })
 
@@ -88,19 +77,25 @@ const setSplitRef = () => {
 const pdfData = ref(props.datas)
 watch(() => props.datas, (data) => {
     pdfData.value = getArrValue(data)
+    console.log( pdfData.value, ' pdfData.value')
+    pdfUrl.value = pdfData.value[0].url
 }, { deep: true })
 
 
 //深度监听索引
-const pdfIndex = ref(props.index)
-watch(() => props.index, (val) => {
-    pdfIndex.value = val ?? 0
-}, { deep: true })
+const pdfIndex = ref(0)
+
 
 
 //返回
 const backClick = () => {
     isShow.value = false
+    pdfIndex.value = 0
+}
+const pdfUrl = ref('')
+const changePdf = (item, index)=>{
+    pdfIndex.value = index
+    pdfUrl.value = item.url
 }
 </script>
 

+ 15 - 2
src/views/debit-pay/admin/certificate.vue

@@ -9,7 +9,7 @@
             </template>
             <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }">
                 <template #action="{ row }">
-                    <el-link type="primary" @click="isReportDrawer = true">查看报表</el-link>
+                    <el-link type="primary" @click="rowViewPdf(row)">查看报表</el-link>
                     <el-link type="success" @click="rowEditClick(row)">修改</el-link>
                     <el-link type="danger" @click="rowDelClick(row)">删除</el-link>
                     <el-link v-loading="row?.recalculateLoading" @click="rowRecalculateClick(row)">重新计算</el-link>
@@ -28,7 +28,7 @@
         <HcEditModal v-model="editModalShow" :ids="editModalIds" @finish="editModalFinish" />
 
         <!-- 查看报表 -->
-        <hc-view-report v-model="isReportDrawer" />
+        <hc-view-report v-model="isReportDrawer" :datas="pdfList" />
     </div>
 </template>
 
@@ -157,6 +157,19 @@ const rowRecalculateClick = async (row) => {
         window.$message.error(msg ?? '操作失败')
     }
 }
+
+//查看报表
+const pdfList = ref([])
+const rowViewPdf = (row)=>{
+    if (row.urlListData.length > 0) {
+        pdfList.value = row.urlListData
+        console.log(pdfList.value, 'pdfList.value')
+        isReportDrawer.value = true
+    } else {
+        window.$message.warning('暂无报表数据')
+    }
+ 
+}
 </script>
 
 <style scoped lang="scss">