From 2736806c9fbccb6e3fdf981a6f48a9343e21fa4a Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期三, 19 八月 2026 15:33:10 +0800
Subject: [PATCH] 提交

---
 src/views/followvisit/record/detailpage/components/AdviceList.vue |  362 +++++++++++++++++++++++++-------------------------
 1 files changed, 181 insertions(+), 181 deletions(-)

diff --git a/src/views/followvisit/record/detailpage/components/AdviceList.vue b/src/views/followvisit/record/detailpage/components/AdviceList.vue
index 5139560..2cefec9 100644
--- a/src/views/followvisit/record/detailpage/components/AdviceList.vue
+++ b/src/views/followvisit/record/detailpage/components/AdviceList.vue
@@ -1,89 +1,71 @@
 <template>
-  <div class="advice-list">
-    <!-- 鎼滅储鏍� -->
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="70px">
-      <el-form-item label="寤鸿绫诲瀷" prop="adviceType">
-        <el-select v-model="queryParams.adviceType" placeholder="鍏ㄩ儴绫诲瀷" clearable style="width: 140px">
-          <el-option label="鎶曡瘔" value="1" />
-          <el-option label="寤鸿" value="2" />
-          <el-option label="琛ㄦ壃" value="3" />
-        </el-select>
-      </el-form-item>
-      <el-form-item label="鍐呭" prop="content">
-        <el-input v-model="queryParams.content" placeholder="璇疯緭鍏ュ唴瀹瑰叧閿瓧" clearable style="width: 180px" />
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
-      </el-form-item>
-    </el-form>
+  <div class="advice-blocks">
+    <!-- 绫诲瀷 Tab 灞曠ず -->
+    <el-tabs v-model="activeType">
+      <el-tab-pane
+        v-for="type in adviceTypes"
+        :key="type.value"
+        :name="type.value"
+      >
+        <span slot="label">
+          <span class="tab-icon">{{ type.icon }}</span> {{ type.label }}
+        </span>
 
-    <!-- 鎿嶄綔鏍� -->
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">鏂板</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">鍒犻櫎</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">瀵煎嚭</el-button>
-      </el-col>
-    </el-row>
+        <!-- 鏈夎褰� -->
+        <div v-if="getAdviceByType(type.value)" class="advice-content" :class="type.className">
+          <div class="advice-head">
+            <span class="advice-label">{{ type.label }}鍐呭</span>
+            <el-button size="mini" type="primary" plain icon="el-icon-edit" @click="handleEdit(type.value)">淇敼</el-button>
+          </div>
+          <div class="advice-text">{{ getAdviceByType(type.value).content }}</div>
+          <div class="advice-meta" v-if="getAdviceByType(type.value).deptCodes || getAdviceByType(type.value).wardCodes">
+            <span v-if="getAdviceByType(type.value).deptCodes" class="meta-item">
+              <i class="el-icon-office-building"></i>{{ getDeptNames(getAdviceByType(type.value).deptCodes) }}
+            </span>
+            <span v-if="getAdviceByType(type.value).wardCodes" class="meta-item">
+              <i class="el-icon-s-home"></i>{{ getWardNames(getAdviceByType(type.value).wardCodes) }}
+            </span>
+          </div>
+          <div class="advice-meta" v-if="getAdviceByType(type.value).involvedUsers">
+            <span class="meta-item"><i class="el-icon-user"></i>娑夊強浜哄憳锛歿{ getAdviceByType(type.value).involvedUsers }}</span>
+          </div>
+          <div class="advice-meta" v-if="getAdviceByType(type.value).remark">
+            <span class="meta-item">澶囨敞锛歿{ getAdviceByType(type.value).remark }}</span>
+          </div>
+          <div class="advice-foot">
+            <span>{{ getAdviceByType(type.value).createBy || "-" }}</span>
+            <span>{{ getAdviceByType(type.value).createTime || "-" }}</span>
+          </div>
+        </div>
 
-    <!-- 琛ㄦ牸 -->
-    <el-table v-loading="loading" :data="adviceList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="50" align="center" />
-      <el-table-column label="寤鸿绫诲瀷" align="center" prop="adviceType" width="100">
-        <template slot-scope="scope">
-          <el-tag :type="adviceTypeTag(scope.row.adviceType)" size="small">
-            {{ adviceTypeText(scope.row.adviceType) }}
-          </el-tag>
-        </template>
-      </el-table-column>
-      <el-table-column label="鍐呭" align="center" prop="content" min-width="200" :show-overflow-tooltip="true" />
-      <el-table-column label="娑夊強绉戝" align="center" prop="deptCodes" width="140" :show-overflow-tooltip="true">
-        <template slot-scope="scope">{{ getDeptNames(scope.row.deptCodes) }}</template>
-      </el-table-column>
-      <el-table-column label="娑夊強鐥呭尯" align="center" prop="wardCodes" width="140" :show-overflow-tooltip="true">
-        <template slot-scope="scope">{{ getWardNames(scope.row.wardCodes) }}</template>
-      </el-table-column>
-      <el-table-column label="澶囨敞" align="center" prop="remark" min-width="150" :show-overflow-tooltip="true" />
-      <el-table-column label="鍒涘缓鑰�" align="center" prop="createBy" width="100" />
-      <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="160" />
-      <el-table-column label="鎿嶄綔" align="center" width="120" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">淇敼</el-button>
-          <el-button size="mini" type="text" icon="el-icon-delete" style="color: #f56c6c" @click="handleDelete(scope.row)">鍒犻櫎</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <pagination
-      v-show="total > 0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
+        <!-- 绌烘�� -->
+        <div v-else class="advice-empty">
+          <span class="empty-icon">{{ type.icon }}</span>
+          <p>鏆傛棤{{ type.label }}璁板綍</p>
+          <el-button size="small" type="primary" plain icon="el-icon-plus" @click="handleAdd(type.value)">鏂板{{ type.label }}</el-button>
+        </div>
+      </el-tab-pane>
+    </el-tabs>
 
     <!-- 鏂板/缂栬緫寮圭獥 -->
-    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body :close-on-click-modal="false">
-      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
-        <el-form-item label="寤鸿绫诲瀷" prop="adviceType">
-          <el-radio-group v-model="form.adviceType">
-            <el-radio label="1">鎶曡瘔</el-radio>
-            <el-radio label="2">寤鸿</el-radio>
-            <el-radio label="3">琛ㄦ壃</el-radio>
-          </el-radio-group>
+    <el-dialog
+      :title="dialogTitle"
+      :visible.sync="open"
+      width="560px"
+      append-to-body
+      :close-on-click-modal="false"
+    >
+      <el-form ref="form" :model="form" :rules="rules" label-width="90px">
+        <el-form-item label="绫诲瀷">
+          <el-tag :type="currentTypeTag" size="small">{{ currentTypeText }}</el-tag>
         </el-form-item>
         <el-form-item label="娑夊強绉戝" prop="deptCodes">
-          <el-select v-model="form.deptCodes" multiple filterable clearable placeholder="璇烽�夋嫨娑夊強绉戝" style="width: 100%">
+          <el-select v-model="form.deptCodes" multiple filterable clearable placeholder="璇烽�夋嫨娑夊強绉戝锛堝彲澶氶�夛級" style="width: 100%">
             <el-option v-for="d in deptOptions" :key="d.value" :label="d.label" :value="d.value" />
           </el-select>
         </el-form-item>
         <el-form-item label="娑夊強鐥呭尯" prop="wardCodes">
-          <el-select v-model="form.wardCodes" multiple filterable clearable placeholder="璇烽�夋嫨娑夊強鐥呭尯" style="width: 100%">
+          <el-select v-model="form.wardCodes" multiple filterable clearable placeholder="璇烽�夋嫨娑夊強鐥呭尯锛堝彲澶氶�夛級" style="width: 100%">
             <el-option v-for="w in wardOptions" :key="w.value" :label="w.label" :value="w.value" />
           </el-select>
         </el-form-item>
@@ -91,7 +73,7 @@
           <el-input v-model="form.involvedUsers" placeholder="娑夊強浜哄憳浠g爜锛屽涓敤閫楀彿鍒嗛殧" />
         </el-form-item>
         <el-form-item label="鍐呭" prop="content">
-          <el-input type="textarea" :rows="3" v-model="form.content" placeholder="璇疯緭鍏ユ姇璇�/寤鸿/琛ㄦ壃鍐呭" />
+          <el-input type="textarea" :rows="4" v-model="form.content" :placeholder="'璇疯緭鍏�' + currentTypeText + '鍐呭'" />
         </el-form-item>
         <el-form-item label="澶囨敞" prop="remark">
           <el-input type="textarea" :rows="2" v-model="form.remark" placeholder="璇疯緭鍏ュ娉�" />
@@ -106,7 +88,7 @@
 </template>
 
 <script>
-import { listAdvice, getAdvice, addAdvice, updateAdvice, delAdvice } from "@/api/followvisit/advice";
+import { listAdvice, getAdvice, addAdvice, updateAdvice } from "@/api/followvisit/advice";
 import store from "@/store";
 
 export default {
@@ -123,23 +105,19 @@
     return {
       loading: false,
       adviceList: [],
-      total: 0,
-      ids: [],
-      single: true,
-      multiple: true,
-      title: "",
+      activeType: "1",
       open: false,
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        adviceType: undefined,
-        content: undefined
-      },
+      dialogTitle: "",
+      currentType: "1",
       form: {},
       rules: {
-        adviceType: [{ required: true, message: "璇烽�夋嫨寤鸿绫诲瀷", trigger: "change" }],
         content: [{ required: true, message: "璇疯緭鍏ュ唴瀹�", trigger: "blur" }]
-      }
+      },
+      adviceTypes: [
+        { value: "1", label: "鎶曡瘔", icon: "鈿狅笍", className: "type-complaint", tagType: "danger" },
+        { value: "2", label: "寤鸿", icon: "馃挕", className: "type-suggest", tagType: "primary" },
+        { value: "3", label: "琛ㄦ壃", icon: "馃憤", className: "type-praise", tagType: "success" }
+      ]
     };
   },
   computed: {
@@ -148,77 +126,56 @@
     },
     wardOptions() {
       return (store.getters.belongWards || []).map(w => ({ label: w.districtName, value: w.districtCode }));
+    },
+    currentTypeText() {
+      const t = this.adviceTypes.find(x => x.value === this.currentType);
+      return t ? t.label : "";
+    },
+    currentTypeTag() {
+      const t = this.adviceTypes.find(x => x.value === this.currentType);
+      return t ? t.tagType : "info";
     }
   },
   created() {
     this.getList();
   },
   methods: {
-    adviceTypeText(t) {
-      const map = { "1": "鎶曡瘔", "2": "寤鸿", "3": "琛ㄦ壃" };
-      return map[t] || "鏈煡";
-    },
-    adviceTypeTag(t) {
-      const map = { "1": "danger", "2": "primary", "3": "success" };
-      return map[t] || "info";
+    getAdviceByType(type) {
+      return this.adviceList.find(item => String(item.adviceType) === String(type));
     },
     getDeptNames(codes) {
-      if (!codes) return "-";
-      const arr = codes.split(",").filter(Boolean);
-      const names = arr.map(c => {
+      if (!codes) return "";
+      return codes.split(",").filter(Boolean).map(c => {
         const found = this.deptOptions.find(d => d.value == c);
         return found ? found.label : c;
-      });
-      return names.join("銆�") || "-";
+      }).join("銆�");
     },
     getWardNames(codes) {
-      if (!codes) return "-";
-      const arr = codes.split(",").filter(Boolean);
-      const names = arr.map(c => {
+      if (!codes) return "";
+      return codes.split(",").filter(Boolean).map(c => {
         const found = this.wardOptions.find(w => w.value == c);
         return found ? found.label : c;
-      });
-      return names.join("銆�") || "-";
+      }).join("銆�");
     },
 
     getList() {
       this.loading = true;
-      // 鍒嗛〉鍙傛暟璧� query锛岃繃婊ゆ潯浠惰蛋 body
       const body = {
         subid: this.subid || undefined,
         taskid: this.taskid || undefined,
-        patid: this.patid || undefined,
-        adviceType: this.queryParams.adviceType || undefined,
-        content: this.queryParams.content || undefined
+        patid: this.patid || undefined
       };
-      const query = {
-        pageNum: this.queryParams.pageNum,
-        pageSize: this.queryParams.pageSize
-      };
+      const query = { pageNum: 1, pageSize: 100 };
       listAdvice(body, query).then(res => {
         this.adviceList = res.rows || [];
-        this.total = res.total || 0;
         this.loading = false;
       }).catch(() => { this.loading = false; });
     },
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
-    },
-    resetQuery() {
-      this.queryParams.adviceType = undefined;
-      this.queryParams.content = undefined;
-      this.handleQuery();
-    },
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id);
-      this.single = selection.length !== 1;
-      this.multiple = !selection.length;
-    },
-    reset() {
+
+    resetForm() {
       this.form = {
         id: undefined,
-        adviceType: "1",
+        adviceType: this.currentType,
         deptCodes: [],
         wardCodes: [],
         involvedUsers: "",
@@ -226,28 +183,35 @@
         remark: ""
       };
     },
-    handleAdd() {
-      this.reset();
-      this.title = "鏂板鎶曡瘔寤鸿";
+
+    handleAdd(type) {
+      this.currentType = type;
+      this.resetForm();
+      this.dialogTitle = "鏂板" + this.currentTypeText;
       this.open = true;
     },
-    handleUpdate(row) {
-      this.reset();
-      this.title = "淇敼鎶曡瘔寤鸿";
-      getAdvice(row.id).then(res => {
-        const data = res.data || {};
-        this.form = {
-          id: data.id,
-          adviceType: data.adviceType || "1",
-          deptCodes: data.deptCodes ? data.deptCodes.split(",").filter(Boolean) : [],
-          wardCodes: data.wardCodes ? data.wardCodes.split(",").filter(Boolean) : [],
-          involvedUsers: data.involvedUsers || "",
-          content: data.content || "",
-          remark: data.remark || ""
-        };
-        this.open = true;
-      });
+
+    handleEdit(type) {
+      this.currentType = type;
+      const existing = this.getAdviceByType(type);
+      if (existing) {
+        getAdvice(existing.id).then(res => {
+          const data = res.data || existing;
+          this.form = {
+            id: data.id,
+            adviceType: data.adviceType || type,
+            deptCodes: data.deptCodes ? data.deptCodes.split(",").filter(Boolean) : [],
+            wardCodes: data.wardCodes ? data.wardCodes.split(",").filter(Boolean) : [],
+            involvedUsers: data.involvedUsers || "",
+            content: data.content || "",
+            remark: data.remark || ""
+          };
+          this.dialogTitle = "淇敼" + this.currentTypeText;
+          this.open = true;
+        });
+      }
     },
+
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (!valid) return;
@@ -275,41 +239,77 @@
           }
         });
       });
-    },
-    handleDelete(row) {
-      const ids = row.id ? [row.id] : this.ids;
-      if (!ids.length) {
-        this.$modal.msgWarning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
-        return;
-      }
-      this.$modal.confirm("鏄惁纭鍒犻櫎鎵�閫夋姇璇夊缓璁紵").then(() => {
-        return delAdvice(ids.join(","));
-      }).then(res => {
-        if (res.code === 200) {
-          this.getList();
-          this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-        }
-      }).catch(() => {});
-    },
-    handleExport() {
-      this.download(
-        "/system/serviceSubtaskAdvice/export",
-        {
-          subid: this.subid,
-          taskid: this.taskid,
-          patid: this.patid,
-          adviceType: this.queryParams.adviceType,
-          content: this.queryParams.content
-        },
-        `闅忚寤鸿鏁版嵁_${new Date().getTime()}.xlsx`
-      );
     }
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.advice-list {
-  padding: 10px 0;
+.advice-blocks {
+  padding: 0;
+
+  ::v-deep .el-tabs__item {
+    .tab-icon {
+      margin-right: 4px;
+    }
+  }
+}
+
+.advice-content {
+  padding: 16px 20px;
+  border-radius: 6px;
+  border-left: 4px solid transparent;
+  background: #fafafa;
+
+  &.type-complaint { border-left-color: #f56c6c; }
+  &.type-suggest { border-left-color: #409eff; }
+  &.type-praise { border-left-color: #67c23a; }
+
+  .advice-head {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 10px;
+    .advice-label {
+      font-size: 14px;
+      font-weight: 600;
+      color: #303133;
+    }
+  }
+
+  .advice-text {
+    font-size: 14px;
+    color: #303133;
+    line-height: 1.7;
+    margin-bottom: 10px;
+    word-break: break-all;
+  }
+
+  .advice-meta {
+    font-size: 13px;
+    color: #909399;
+    margin-bottom: 6px;
+    .meta-item {
+      display: inline-block;
+      margin-right: 16px;
+      i { margin-right: 4px; color: #606266; }
+    }
+  }
+
+  .advice-foot {
+    display: flex;
+    justify-content: space-between;
+    font-size: 12px;
+    color: #c0c4cc;
+    padding-top: 10px;
+    border-top: 1px solid #ebeef5;
+  }
+}
+
+.advice-empty {
+  padding: 50px 0;
+  text-align: center;
+  .empty-icon { font-size: 36px; display: block; margin-bottom: 12px; }
+  p { color: #c0c4cc; font-size: 14px; margin-bottom: 16px; }
 }
 </style>

--
Gitblit v1.9.3