dev01 1 year ago
parent
commit
8dfe8243c4

+ 5 - 5
src/client/reports.client.ts

@@ -6,7 +6,7 @@ import type { CompanyAgg } from "@/types/company.types";
 import type { ReportsResponse } from "@/types/report.types";
 import type { Response } from "@/types/response.types";
 
-const _url = withPrefix("/api")
+const _url = withPrefix("/api/srUserReport")
 
 export async function query(page: number, companyIds?: number[], field?: string, keyword?: string, status?: number): Promise<ReportsResponse> {
   //const params: any = { page, companyIds, field, keyword }
@@ -25,11 +25,11 @@ export async function query(page: number, companyIds?: number[], field?: string,
     param += `&status=${status}`
   }
 
-  const resp = await httpClient.get<Response<ReportsResponse>>(_url(`/srUserReport/all/?page=${page}&${param}`))
+  const resp = await httpClient.get<Response<ReportsResponse>>(_url(`/all/?page=${page}&${param}`))
   return resp.data.data
 }
 
-export async function upper(id: number) {
-  const resp = await httpClient.get<Response<number>>(_url(`/srUserReport/seveText?id=${id}`))
-  return resp.data.data;
+export async function upper(id: number): Promise<Blob> {
+  const resp = await httpClient.get<File>(_url("/seveText"), { params: { id } })
+  return resp.data;
 }

+ 5 - 6
src/views/report/ReportListView.vue

@@ -101,8 +101,8 @@ function onReportUpper(id: number) {
   spinning.value = true;
   reportsService
     .upper(id)
-    .then((ok) => {
-      if (ok) {
+    .then((res) => {
+      if (res.data) {
         spinning.value = false;
         message.success("上链成功");
         currentPage.value =
@@ -115,12 +115,12 @@ function onReportUpper(id: number) {
         );
       } else {
         spinning.value = false;
-        message.error("操作失败");
+        message.error(res.msg);
       }
     })
-    .catch(() => {
+    .catch((err) => {
       spinning.value = false;
-      message.error("操作失败");
+      message.error(res.msg);
     });
 }
 
@@ -133,7 +133,6 @@ function serialNumber(index: number) {
 onMounted(() => {
   fetchReports();
 });
-
 </script>
 
 <template>

+ 41 - 31
src/views/report/components/report-list/ReportItem.vue

@@ -33,43 +33,50 @@ function onUpper(id: number) {
 <template>
   <a-card hoverable size="small">
     <template #title>
-      <div class="title-link">
-        <span class="text-black"> {{ serialNumber }}. </span>
-        <span v-if="data.companyName" class="text-black"> {{ data.companyName }}</span>
-        <span v-else class="text-red">无关联企业</span>
-        <span class="text-black"> - </span>
-        <span v-if="data.name" class="text-black">{{ data.name }}</span>
-        <span v-else class="text-red">无报告类型</span>
-        <span v-if="data.status == 1" class="text-black">&nbsp;&nbsp; 已完成</span>
-        <span v-else class="text-black">&nbsp;&nbsp; 编写中</span>
-      </div>
+      <a :href="data.tianheCloudUrl">
+        <div class="title-link">
+          <span class="text-black"> {{ serialNumber }}. </span>
+          <span v-if="data.companyName" class="text-black"> {{ data.companyName }}</span>
+          <span v-else class="text-red">无关联企业</span>
+          <span class="text-black"> - </span>
+          <span v-if="data.name" class="text-black">{{ data.name }}</span>
+          <span v-else class="text-red">无报告类型</span>
+          <span v-if="data.status == 1" class="text-black">&nbsp;&nbsp; 已完成</span>
+          <span v-else class="text-black">&nbsp;&nbsp; 编写中</span>
+        </div>
+      </a>
     </template>
 
     <template #extra>
-      <a-button
-        v-if="!data.tianheCloudId"
-        type="link"
-        target="_blank"
-        @click="onUpper(data.id)"
-        >上链</a-button
+      <a :href="data.tianheCloudUrl">
+        <a-button
+          v-if="!data.tianheCloudId"
+          type="primary"
+          target="_blank"
+          @click="onUpper(data.id)"
+          >上链</a-button
+        >
+        <span v-else>已上链</span></a
       >
     </template>
 
-    <div class="report-metadata-wrap">
-      <p>
-        <span>企业名称:</span><span>{{ data.companyName }}</span>
-      </p>
-      <p>
-        <span>项目名称:</span><span>{{ data.reportName }}</span>
-      </p>
-      <p>
-        <span>项目负责人:</span><span>{{ data.supervisor }}</span>
-      </p>
-      <p v-for="(item, index) in data.metadata" :key="index">
-        <span>{{ item.name }}:</span>
-        <span>{{ item.value }}</span>
-      </p>
-    </div>
+    <a :href="data.tianheCloudUrl">
+      <div class="report-metadata-wrap">
+        <p>
+          <span>企业名称:</span><span>{{ data.companyName }}</span>
+        </p>
+        <p>
+          <span>项目名称:</span><span>{{ data.reportName }}</span>
+        </p>
+        <p>
+          <span>项目负责人:</span><span>{{ data.supervisor }}</span>
+        </p>
+        <p v-for="(item, index) in data.metadata" :key="index">
+          <span>{{ item.name }}:</span>
+          <span>{{ item.value }}</span>
+        </p>
+      </div>
+    </a>
   </a-card>
 </template>
 
@@ -85,4 +92,7 @@ function onUpper(id: number) {
     margin-bottom: 0.3em;
   }
 }
+a {
+  color: #000;
+}
 </style>