Selaa lähdekoodia

填报管理下发按钮优化

lizhouming 6 kuukautta sitten
vanhempi
commit
9e8361cb06
2 muutettua tiedostoa jossa 23 lisäystä ja 12 poistoa
  1. 8 0
      src/api/dataFilling/fillingManage.ts
  2. 15 12
      src/views/dataFilling/fillingManage.vue

+ 8 - 0
src/api/dataFilling/fillingManage.ts

@@ -35,3 +35,11 @@ export const fillingChange = (reportId, payload) => {
     data: payload
   });
 };
+
+// 下发发布
+export const fillingRelease = (reportId) => {
+  return request({
+    url: `/api/dataFilling/report/${reportId}/update_status`,
+    method: 'put'
+  });
+};

+ 15 - 12
src/views/dataFilling/fillingManage.vue

@@ -97,7 +97,7 @@ import { onMounted, reactive, ref, toRefs } from 'vue';
 import FillingAdd from './fillingAdd.vue';
 import TableDetails from './tableDetails.vue';
 import { ElButton, ElCol } from 'element-plus';
-import { fillingSelect } from '@/api/dataFilling/fillingManage';
+import { fillingSelect, fillingRelease } from '@/api/dataFilling/fillingManage';
 import * as XLSX from 'xlsx';
 
 const loading = ref(true);
@@ -214,17 +214,20 @@ const handlePagination = ({ page, limit }) => {
 };
 
 const handleIssue = (row) => {
-  const index = tableData.value.findIndex((item) => item.id === row.id);
-  if (index !== -1) {
-    // 更新前端表格状态
-    tableData.value[index].issued_status = 2;
-    someApiToUpdateStatus(row.id)
-      .then(() => {
-        console.log('状态更新成功');
-      })
-      .catch((error) => {
-        console.error('状态更新失败', error);
-      });
+  // 检查是否有report_id
+  if (!row.report_id) {
+    console.error('报告ID不存在,无法下发');
+    return;
   }
+  // 构造下发请求的URL
+  const releaseUrl = `${row.report_id}`;
+  // 发起下发请求
+  fillingRelease(releaseUrl)
+    .then(() => {
+      fetchFillList();
+    })
+    .catch((error) => {
+      console.error('下发操作失败:', error);
+    });
 };
 </script>