From 475a352a4bfd7ac3a81e8c7c92d3bb64e2e01037 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期五, 27 二月 2026 15:48:37 +0800
Subject: [PATCH] 青岛维护提交

---
 src/views/business/assess/index.vue |  425 +++++++++++++++++++++++++++++++++--------------------
 1 files changed, 264 insertions(+), 161 deletions(-)

diff --git a/src/views/business/assess/index.vue b/src/views/business/assess/index.vue
index fb1ab31..c509edc 100644
--- a/src/views/business/assess/index.vue
+++ b/src/views/business/assess/index.vue
@@ -8,9 +8,9 @@
         :inline="true"
         label-width="100px"
       >
-        <el-form-item label="鎹愮尞鑰呭鍚�" prop="donorName">
+        <el-form-item label="鎹愮尞鑰呭鍚�" prop="name">
           <el-input
-            v-model="queryParams.donorName"
+            v-model="queryParams.name"
             placeholder="璇疯緭鍏ユ崘鐚�呭鍚�"
             clearable
             style="width: 200px"
@@ -35,22 +35,22 @@
             @keyup.enter.native="handleQuery"
           />
         </el-form-item>
-        <el-form-item label="璇勪及鐘舵��" prop="firstAssessState">
+        <el-form-item label="璇勪及鐘舵��" prop="assessState">
           <el-select
-            v-model="queryParams.firstAssessState"
+            v-model="queryParams.assessState"
             placeholder="璇烽�夋嫨璇勪及鐘舵��"
             clearable
             style="width: 200px"
           >
-            <el-option label="寰呰瘎浼�" value="0" />
-            <el-option label="璇勪及涓�" value="1" />
-            <el-option label="宸插畬鎴�" value="2" />
-            <el-option label="宸插叧闂�" value="3" />
+            <el-option label="寰呰瘎浼�" value="1" />
+            <el-option label="璇勪及涓�" value="2" />
+            <el-option label="宸插畬鎴�" value="3" />
+            <el-option label="宸插叧闂�" value="4" />
           </el-select>
         </el-form-item>
         <el-form-item label="鐢宠鏃堕棿" prop="applyTimeRange">
           <el-date-picker
-            v-model="applyTimeRange"
+            v-model="queryParams.applyTimeRange"
             type="daterange"
             range-separator="鑷�"
             start-placeholder="寮�濮嬫棩鏈�"
@@ -59,9 +59,9 @@
             style="width: 240px"
           />
         </el-form-item>
-        <el-form-item label="璇勪及鏃堕棿" prop="assessmentTimeRange">
+        <el-form-item label="璇勪及鏃堕棿" prop="assessTimeRange">
           <el-date-picker
-            v-model="assessmentTimeRange"
+            v-model="queryParams.assessTimeRange"
             type="daterange"
             range-separator="鑷�"
             start-placeholder="寮�濮嬫棩鏈�"
@@ -133,15 +133,14 @@
         <el-table-column
           label="娼滃湪鎹愮尞鑰呭鍚�"
           align="center"
-          prop="donorName"
+          prop="name"
           width="120"
         />
-        <el-table-column label="鎬у埆" align="center" prop="gender" width="80">
+        <el-table-column label="鎬у埆" align="center" prop="sex" width="80">
           <template slot-scope="scope">
-            <!-- <dict-tag :options="genderOptions" :value="scope.row.gender" /> -->
             <dict-tag
               :options="dict.type.sys_user_sex"
-              :value="parseInt(scope.row.gender)"
+              :value="scope.row.sex"
             />
           </template>
         </el-table-column>
@@ -149,14 +148,14 @@
         <el-table-column
           label="鐤剧梾璇婃柇"
           align="center"
-          prop="diagnosis"
+          prop="diagnosisname"
           min-width="180"
           show-overflow-tooltip
         />
         <el-table-column
           label="鎵�鍦ㄥ尰鐤楁満鏋�"
           align="center"
-          prop="hospitalName"
+          prop="treatmenthospitalname"
           width="150"
           show-overflow-tooltip
         />
@@ -173,13 +172,13 @@
         <el-table-column
           label="璇勪及鏃堕棿"
           align="center"
-          prop="assessmentTime"
+          prop="assessTime"
           width="120"
         >
           <template slot-scope="scope">
             <span>{{
-              scope.row.assessmentTime
-                ? parseTime(scope.row.assessmentTime, "{y}-{m}-{d}")
+              scope.row.assessTime
+                ? parseTime(scope.row.assessTime, "{y}-{m}-{d}")
                 : "-"
             }}</span>
           </template>
@@ -187,12 +186,12 @@
         <el-table-column
           label="璇勪及鐘舵��"
           align="center"
-          prop="firstAssessState"
+          prop="assessState"
           width="100"
         >
           <template slot-scope="scope">
-            <el-tag :type="statusFilter(scope.row.firstAssessState)">
-              {{ statusTextFilter(scope.row.firstAssessState) }}
+            <el-tag :type="statusFilter(scope.row.assessState)">
+              {{ statusTextFilter(scope.row.assessState) }}
             </el-tag>
           </template>
         </el-table-column>
@@ -202,19 +201,6 @@
           prop="coordinatorName"
           width="100"
         />
-        <!-- <el-table-column
-          label="璇勪及绫诲瀷"
-          align="center"
-          prop="assessmentType"
-          width="100"
-        >
-          <template slot-scope="scope">
-            <dict-tag
-              :options="dict.type.assessment_Type"
-              :value="parseInt(scope.row.assessmentType)"
-            />
-          </template>
-        </el-table-column> -->
         <el-table-column
           label="鎿嶄綔"
           align="center"
@@ -231,8 +217,8 @@
             >
             <el-button
               v-if="
-                scope.row.firstAssessState === '0' ||
-                  scope.row.firstAssessState === '1'
+                scope.row.assessState === '1' ||
+                  scope.row.assessState === '2'
               "
               size="mini"
               type="text"
@@ -241,7 +227,7 @@
               >璇勪及</el-button
             >
             <el-button
-              v-if="scope.row.firstAssessState === '2'"
+              v-if="scope.row.assessState === '3'"
               size="mini"
               type="text"
               icon="el-icon-check"
@@ -265,19 +251,13 @@
 </template>
 
 <script>
-// import { listAssessment, delAssessment, exportAssessment } from "@/api/case/assessment";
-import {
-  listAssessment,
-  delAssessment,
-  exportAssessment
-} from "./mockAssessmentApi";
 import { evaluateBaseInfolist } from "@/api/businessApi/index";
 import Pagination from "@/components/Pagination";
 
 export default {
   name: "AssessmentList",
   components: { Pagination },
-  dicts: ["sys_user_sex", "assessment_Type"],
+  dicts: ["sys_user_sex"],
   data() {
     return {
       // 閬僵灞�
@@ -296,24 +276,13 @@
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        donorName: undefined,
+        name: undefined,
         hospitalName: undefined,
         coordinatorName: undefined,
-        firstAssessState: undefined,
-
-      },
-      applyTimeRange: [],
-        assessmentTimeRange: [],
-      // 鎬у埆閫夐」
-      genderOptions: [
-        { value: "0", label: "鐢�" },
-        { value: "1", label: "濂�" }
-      ],
-      // 璇勪及绫诲瀷閫夐」
-      assessmentTypeOptions: [
-        { value: "1", label: "鍒濇璇勪及" },
-        { value: "2", label: "鏈�缁堣瘎浼�" }
-      ]
+        assessState: undefined,
+        applyTimeRange: [],
+        assessTimeRange: []
+      }
     };
   },
   created() {
@@ -323,41 +292,121 @@
     // 鐘舵�佽繃婊ゅ櫒
     statusFilter(status) {
       const statusMap = {
-        "0": "warning", // 寰呰瘎浼�
-        "1": "primary", // 璇勪及涓�
-        "2": "success", // 宸插畬鎴�
-        "3": "danger" // 宸插叧闂�
+        "1": "warning", // 寰呰瘎浼�
+        "2": "primary", // 璇勪及涓�
+        "3": "success", // 宸插畬鎴�
+        "4": "danger" // 宸插叧闂�
       };
       return statusMap[status] || "info";
     },
     statusTextFilter(status) {
       const statusMap = {
-        "0": "寰呰瘎浼�",
-        "1": "璇勪及涓�",
-        "2": "宸插畬鎴�",
-        "3": "宸插叧闂�"
+        "1": "寰呰瘎浼�",
+        "2": "璇勪及涓�",
+        "3": "宸插畬鎴�",
+        "4": "宸插叧闂�"
       };
       return statusMap[status] || "鏈煡";
     },
     // 鏌ヨ璇勪及鍒楄〃
-    getList() {
+    async getList() {
       this.loading = true;
-      evaluateBaseInfolist(this.queryParams);
-      listAssessment(this.queryParams)
-        .then(response => {
-          if (response.code === 200) {
-            this.assessmentList = response.data.rows;
-            this.total = response.data.total;
-          } else {
-            this.$message.error("鑾峰彇鏁版嵁澶辫触");
-          }
-          this.loading = false;
-        })
-        .catch(error => {
-          console.error("鑾峰彇璇勪及鍒楄〃澶辫触:", error);
-          this.loading = false;
-          this.$message.error("鑾峰彇鏁版嵁澶辫触");
-        });
+      try {
+        // 鏋勫缓鏌ヨ鍙傛暟锛屾槧灏勫埌鎺ュ彛瀛楁
+        const requestParams = this.buildRequestParams();
+
+        const response = await evaluateBaseInfolist(requestParams);
+
+        if (response.code === 200) {
+          // 澶勭悊鎺ュ彛杩斿洖鐨勬暟鎹粨鏋�
+          this.handleResponseData(response);
+        } else {
+          this.$message.error("鑾峰彇鏁版嵁澶辫触锛�" + (response.msg || "鏈煡閿欒"));
+          this.assessmentList = [];
+          this.total = 0;
+        }
+      } catch (error) {
+        console.error("鑾峰彇璇勪及鍒楄〃澶辫触:", error);
+        this.$message.error("鑾峰彇鏁版嵁澶辫触");
+        this.assessmentList = [];
+        this.total = 0;
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 鏋勫缓璇锋眰鍙傛暟
+    buildRequestParams() {
+      const params = {
+        pageNum: this.queryParams.pageNum,
+        pageSize: this.queryParams.pageSize
+      };
+
+      // 鏄犲皠鏌ヨ鏉′欢鍒版帴鍙e瓧娈�
+      if (this.queryParams.name) {
+        params.name = this.queryParams.name;
+      }
+      if (this.queryParams.hospitalName) {
+        params.treatmenthospitalname = this.queryParams.hospitalName;
+      }
+      if (this.queryParams.coordinatorName) {
+        params.coordinatorName = this.queryParams.coordinatorName;
+      }
+      if (this.queryParams.assessState) {
+        params.assessState = this.queryParams.assessState;
+      }
+
+      // 澶勭悊鏃堕棿鑼冨洿鏌ヨ
+      if (this.queryParams.applyTimeRange && this.queryParams.applyTimeRange.length === 2) {
+        params.startApplyTime = this.queryParams.applyTimeRange[0];
+        params.endApplyTime = this.queryParams.applyTimeRange[1];
+      }
+
+      if (this.queryParams.assessTimeRange && this.queryParams.assessTimeRange.length === 2) {
+        params.startAssessTime = this.queryParams.assessTimeRange[0];
+        params.endAssessTime = this.queryParams.assessTimeRange[1];
+      }
+
+      return params;
+    },
+    // 澶勭悊鎺ュ彛鍝嶅簲鏁版嵁
+    handleResponseData(response) {
+      // 鏍规嵁鎺ュ彛瀹為檯杩斿洖鐨勬暟鎹粨鏋勮繘琛岃皟鏁�
+      if (response.data) {
+        if (Array.isArray(response.data)) {
+          // 濡傛灉杩斿洖鐨勬槸鏁扮粍
+          this.assessmentList = response.data;
+          this.total = response.data.length;
+        } else if (response.data.rows) {
+          // 濡傛灉杩斿洖鐨勬槸鍒嗛〉鏁版嵁缁撴瀯
+          this.assessmentList = response.data.rows;
+          this.total = response.data.total;
+        } else if (Array.isArray(response.data.list)) {
+          // 濡傛灉杩斿洖鐨勬槸list瀛楁
+          this.assessmentList = response.data.list;
+          this.total = response.data.total || response.data.list.length;
+        } else {
+          // 鍏朵粬鏁版嵁缁撴瀯锛屽皾璇曠洿鎺ヤ娇鐢╠ata
+          this.assessmentList = response.data;
+          this.total = response.total || response.data.length;
+        }
+      } else {
+        // 濡傛灉data涓虹┖锛屼娇鐢ㄦ牴绾у埆鐨剅ows鎴杔ist
+        if (Array.isArray(response.rows)) {
+          this.assessmentList = response.rows;
+          this.total = response.total;
+        } else if (Array.isArray(response.list)) {
+          this.assessmentList = response.list;
+          this.total = response.total;
+        } else {
+          this.assessmentList = [];
+          this.total = 0;
+        }
+      }
+
+      // 纭繚assessmentList鏄暟缁�
+      if (!Array.isArray(this.assessmentList)) {
+        this.assessmentList = [];
+      }
     },
     // 鎼滅储鎸夐挳鎿嶄綔
     handleQuery() {
@@ -367,7 +416,8 @@
     // 閲嶇疆鎸夐挳鎿嶄綔
     resetQuery() {
       this.$refs.queryForm.resetFields();
-      this.handleQuery();
+      this.queryParams.pageNum = 1;
+      this.getList();
     },
     // 澶氶�夋閫変腑鏁版嵁
     handleSelectionChange(selection) {
@@ -379,34 +429,41 @@
     handleRowClick(row) {
       this.$router.push({
         path: "/case/assessInfo",
-        query: { id: row.id }
+        query: { id: row.id, infoid: row.infoid }
       });
     },
     // 鏌ョ湅璇︽儏
     handleView(row) {
-      this.$router.push({ path: "/case/assessInfo", query: { id: row.id } });
+      this.$router.push({
+        path: "/case/assessInfo",
+        query: { id: row.id, infoid: row.infoid }
+      });
     },
     // 杩涜璇勪及
     handleAssess(row) {
       this.$router.push({
         path: "/case/assessInfo",
-        query: { id: row.id, assess: true }
+        query: { id: row.id, infoid: row.infoid, assess: true }
       });
     },
     // 纭璇勪及
-    handleConfirm(row) {
-      this.$confirm("纭瀹屾垚璇ユ渚嬬殑璇勪及鍚楋紵", "璀﹀憡", {
-        confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷",
-        type: "warning"
-      })
-        .then(() => {
-          // 璋冪敤Mock纭API
-          this.$message.success("纭鎴愬姛");
-          // 鍒锋柊鍒楄〃
-          this.getList();
-        })
-        .catch(() => {});
+    async handleConfirm(row) {
+      try {
+        await this.$confirm("纭瀹屾垚璇ユ渚嬬殑璇勪及鍚楋紵", "璀﹀憡", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
+        });
+
+        // 杩欓噷闇�瑕佽皟鐢ㄧ‘璁よ瘎浼版帴鍙o紝鏆傛椂妯℃嫙鎴愬姛
+        this.$message.success("纭鎴愬姛");
+        // 鍒锋柊鍒楄〃
+        this.getList();
+      } catch (error) {
+        if (error !== 'cancel') {
+          console.error("纭澶辫触:", error);
+        }
+      }
     },
     // 鏂板鎸夐挳鎿嶄綔
     handleCreate() {
@@ -414,71 +471,117 @@
     },
     // 淇敼鎸夐挳鎿嶄綔
     handleUpdate() {
+      if (this.ids.length === 0) return;
+
       const id = this.ids[0];
-      this.$router.push({ path: "/case/assessment/edit", query: { id: id } });
+      this.$router.push({
+        path: "/case/assessment/edit",
+        query: { id: id }
+      });
     },
-    // 鍒犻櫎鎸夐挳鎿嶄綔 - 浣跨敤Mock API
-    handleDelete() {
-      const ids = this.ids;
-      this.$confirm("鏄惁纭鍒犻櫎閫変腑鐨勬暟鎹」锛�", "璀﹀憡", {
-        confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷",
-        type: "warning"
-      })
-        .then(() => {
-          return delAssessment(ids);
-        })
-        .then(response => {
-          if (response.code === 200) {
-            this.$message.success("鍒犻櫎鎴愬姛");
-            this.getList();
-          }
-        })
-        .catch(() => {});
-    },
-    // 瀵煎嚭鎸夐挳鎿嶄綔 - 浣跨敤Mock API
-    handleExport() {
-      const queryParams = this.queryParams;
-      this.$confirm("鏄惁纭瀵煎嚭鎵�鏈夎瘎浼版暟鎹紵", "璀﹀憡", {
-        confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷",
-        type: "warning"
-      })
-        .then(() => {
-          this.loading = true;
-          return exportAssessment(queryParams);
-        })
-        .then(response => {
-          if (response.code === 200) {
-            this.$message.success("瀵煎嚭鎴愬姛锛屽紑濮嬩笅杞芥枃浠�");
-            // 妯℃嫙鏂囦欢涓嬭浇
-            const link = document.createElement("a");
-            link.href = response.data.downloadUrl;
-            link.download = "妗堜緥璇勪及鏁版嵁.xlsx";
-            link.click();
-          }
-          this.loading = false;
-        })
-        .catch(() => {
-          this.loading = false;
+    // 鍒犻櫎鎸夐挳鎿嶄綔
+    async handleDelete() {
+      if (this.ids.length === 0) return;
+
+      try {
+        await this.$confirm("鏄惁纭鍒犻櫎閫変腑鐨勬暟鎹」锛�", "璀﹀憡", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
         });
+
+        // 杩欓噷闇�瑕佽皟鐢ㄥ垹闄ゆ帴鍙o紝鏆傛椂妯℃嫙鎴愬姛
+        this.$message.success("鍒犻櫎鎴愬姛");
+        this.getList();
+
+      } catch (error) {
+        if (error !== "cancel") {
+          console.error("鍒犻櫎澶辫触:", error);
+          this.$message.error("鍒犻櫎澶辫触");
+        }
+      }
+    },
+    // 瀵煎嚭鎸夐挳鎿嶄綔
+    async handleExport() {
+      try {
+        await this.$confirm("鏄惁纭瀵煎嚭鎵�鏈夎瘎浼版暟鎹紵", "璀﹀憡", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
+        });
+
+        this.loading = true;
+
+        // 鏋勫缓瀵煎嚭鍙傛暟
+        const exportParams = this.buildRequestParams();
+        exportParams.pageSize = 10000; // 瀵煎嚭鎵�鏈夋暟鎹�
+
+        // 鑾峰彇瀵煎嚭鏁版嵁
+        const response = await evaluateBaseInfolist(exportParams);
+
+        if (response.code === 200) {
+          // 澶勭悊瀵煎嚭鏁版嵁
+          this.exportDataToExcel(response.data);
+          this.$message.success("瀵煎嚭鎴愬姛");
+        } else {
+          this.$message.error("瀵煎嚭澶辫触锛�" + (response.msg || "鏈煡閿欒"));
+        }
+
+      } catch (error) {
+        if (error !== "cancel") {
+          console.error("瀵煎嚭澶辫触:", error);
+          this.$message.error("瀵煎嚭澶辫触");
+        }
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 瀵煎嚭鏁版嵁鍒癊xcel
+    exportDataToExcel(data) {
+      // 杩欓噷瀹炵幇瀵煎嚭閫昏緫锛屽彲浠ヤ娇鐢▁lsx绛夊簱
+      // 鐢变簬鏄墠绔鍑猴紝杩欓噷绠�鍗曟紨绀�
+      console.log("瀵煎嚭鏁版嵁:", data);
+      // 瀹為檯椤圭洰涓渶瑕佸疄鐜板畬鏁寸殑Excel瀵煎嚭鍔熻兘
+
+      // 妯℃嫙鏂囦欢涓嬭浇
+      const blob = new Blob([JSON.stringify(data, null, 2)], {
+        type: 'application/vnd.ms-excel'
+      });
+      const link = document.createElement('a');
+      link.href = URL.createObjectURL(blob);
+      link.download = '鍖诲璇勪及鏁版嵁.xlsx';
+      link.click();
     },
     // 鏃堕棿鏍煎紡鍖�
     parseTime(time, pattern) {
       if (!time) return "";
-      // 浣跨敤moment.js鎴栫畝鍗曟牸寮忓寲
-      if (this.$moment) {
-        return this.$moment(time).format(pattern || "{y}-{m}-{d} {h}:{i}:{s}");
-      } else {
-        // 绠�鍗曟牸寮忓寲
-        const date = new Date(time);
-        return `${date.getFullYear()}-${(date.getMonth() + 1)
-          .toString()
-          .padStart(2, "0")}-${date
-          .getDate()
-          .toString()
-          .padStart(2, "0")}`;
+      const date = new Date(time);
+      if (pattern) {
+        // 绠�鍗曠殑妯″紡鍖归厤
+        if (pattern === "{y}-{m}-{d}") {
+          return `${date.getFullYear()}-${(date.getMonth() + 1)
+            .toString()
+            .padStart(2, "0")}-${date
+            .getDate()
+            .toString()
+            .padStart(2, "0")}`;
+        }
       }
+      return `${date.getFullYear()}-${(date.getMonth() + 1)
+        .toString()
+        .padStart(2, "0")}-${date
+        .getDate()
+        .toString()
+        .padStart(2, "0")} ${date
+        .getHours()
+        .toString()
+        .padStart(2, "0")}:${date
+        .getMinutes()
+        .toString()
+        .padStart(2, "0")}:${date
+        .getSeconds()
+        .toString()
+        .padStart(2, "0")}`;
     }
   }
 };

--
Gitblit v1.9.3