From 4f55c0255e5e68b3685d1510062dff6e1e3dbc48 Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期三, 16 四月 2025 14:13:07 +0800
Subject: [PATCH] 1

---
 src/views/advice/advice/index.vue |  402 +++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 319 insertions(+), 83 deletions(-)

diff --git a/src/views/advice/advice/index.vue b/src/views/advice/advice/index.vue
index 20c161c..e937115 100644
--- a/src/views/advice/advice/index.vue
+++ b/src/views/advice/advice/index.vue
@@ -7,7 +7,16 @@
       :inline="true"
       v-show="showSearch"
       label-width="68px"
+      @submit.native.prevent
     >
+    <el-form-item label="鏍囬" prop="bt">
+        <el-input
+          v-model="queryParams.bt"
+          placeholder="璇疯緭鍏ユ爣棰�"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
       <el-form-item label="椤圭洰鍚嶇О" prop="proName">
         <el-input
           v-model="queryParams.proName"
@@ -33,7 +42,7 @@
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
-        type="primary"
+          type="primary"
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
@@ -43,7 +52,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
-        type="primary"
+          type="primary"
           icon="el-icon-edit"
           size="mini"
           :disabled="single"
@@ -54,7 +63,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
-        type="primary"
+          type="primary"
           icon="el-icon-delete"
           size="mini"
           :disabled="multiple"
@@ -65,7 +74,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
-        type="primary"
+          type="primary"
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
@@ -73,73 +82,137 @@
           >瀵煎嚭</el-button
         >
       </el-col>
-      <right-toolbar
-        :showSearch.sync="showSearch"
-        @queryTable="getList"
-      ></right-toolbar>
+    </el-row>
+    <el-row :gutter="20">
+      <el-col :span="3" :xs="24">
+        <div class="head-container">
+          <div class="content">
+            <el-tree
+              :data="deptOptions"
+              :props="defaultProps"
+              :expand-on-click-node="false"
+              :filter-node-method="filterNode"
+              ref="tree"
+              node-key="id"
+              default-expand-all
+              :default-expanded-keys="treeId"
+              highlight-current
+              @node-click="handleNodeClick"
+            />
+          </div>
+        </div>
+      </el-col>
+
+      <el-col :span="20" :xs="24">
+        <el-table
+          v-loading="loading"
+          :data="adviceList"
+          @selection-change="handleSelectionChange"
+          border
+        >
+          <el-table-column type="selection" width="55" align="center" fixed />
+          <el-table-column
+            label="搴忓彿"
+            align="center"
+            prop="newID"
+            width="55px"
+          />
+          <el-table-column
+            label="鎵�灞炵瀹�"
+            align="center"
+            prop="deptName"
+            width="120px"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="浣撴椤圭洰"
+            align="center"
+            prop="proName"
+            width="120px"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="鏍囬"
+            align="center"
+            prop="title"
+            width="120px"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="寤鸿"
+            align="center"
+            prop="advice"
+            width="1249px"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="鎿嶄綔"
+            align="center"
+            fixed="right"
+            class-name="small-padding fixed-width"
+            width="80px"
+          >
+            <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-edit"
+                @click="handleUpdate(scope.row)"
+                v-hasPermi="['advice:advice:edit']"
+                title="淇敼"
+              ></el-button>
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-delete"
+                @click="handleDelete(scope.row)"
+                v-hasPermi="['advice:advice:remove']"
+                title="鍒犻櫎"
+              ></el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+        <div class="pag">
+          <div class="pag1">
+            <pagination
+              v-show="total > 0"
+              :total="total"
+              :page.sync="queryParams.page"
+              :limit.sync="queryParams.pageSize"
+              @pagination="getList"
+            />
+          </div>
+        </div>
+      </el-col>
     </el-row>
 
-    <el-table
-      v-loading="loading"
-      :data="adviceList"
-      @selection-change="handleSelectionChange"
-      border
-      
-    >
-      <el-table-column type="selection" width="55" align="center" fixed />
-      <el-table-column label="搴忓彿" align="center" prop="newID" width="55px" fixed  />
-      <el-table-column label="鎵�閫夐」鐩�" align="center" prop="proName" width="120px" :show-overflow-tooltip="true" />
-      <el-table-column label="鏍囬" align="center" prop="title" width="120px" :show-overflow-tooltip="true" />
-      <el-table-column
-        label="寤鸿"
-        align="center"
-        prop="advice"
-        width="1249px"
-        :show-overflow-tooltip="true"
-      />
-      <el-table-column
-        label="鎿嶄綔"
-        align="center"
-        fixed="right"
-        class-name="small-padding fixed-width"
-        width="80px"
-      >
-        <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['advice:advice:edit']"
-            title="淇敼"
-          ></el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['advice:advice:remove']"
-            title="鍒犻櫎"
-          ></el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <div class="pag">
-      <div class="pag1">
-        <pagination
-          v-show="total > 0"
-          :total="total"
-          :page.sync="queryParams.page"
-          :limit.sync="queryParams.pageSize"
-          @pagination="getList"
-        />
-      </div>
-    </div>
-
     <!-- 娣诲姞鎴栦慨鏀筧dvice瀵硅瘽妗� -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+    <el-dialog
+      :title="title"
+      :visible.sync="open"
+      width="1000px"
+      append-to-body
+    >
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="褰掑睘绉戝" prop="deptId">
+          <!-- <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="璇烽�夋嫨褰掑睘绉戝"
+              style="width: 200px" /> -->
+          <el-select
+            v-if="DepartmentList.length > 0"
+            v-model="form.deptId"
+            placeholder="璇烽�夋嫨褰掑睘绉戝"
+            clearable
+            style="width: 200px"
+            filterable
+          >
+            <el-option
+              v-for="dict in DepartmentList"
+              :key="dict.deptId"
+              :label="dict.deptName || ''"
+              :value="dict.deptId"
+            />
+          </el-select>
+        </el-form-item>
         <el-form-item label="妫�鏌ラ」鐩�" prop="proName">
           <el-select
             v-model="form.proId"
@@ -149,17 +222,34 @@
             clearable
           >
             <el-option
-              v-for="dict in projectList"
-              :key="dict.proName"
+              v-for="(dict, index) in projectList"
+              :key="index"
               :label="dict.proName"
               :value="dict.proId"
             />
           </el-select>
         </el-form-item>
+
         <el-form-item label="寤鸿鏍囬" prop="title">
           <el-input v-model="form.title" placeholder="璇疯緭鍏ュ悕绉版爣棰�" />
         </el-form-item>
-        
+        <el-form-item label="蹇嵎鏍囩" prop="kjbq">
+          <span
+            slot="label"
+            style="display: inline-block; border-bottom: 2px solid blue"
+            @click="handlekjbq"
+          >
+            蹇嵎鏍囩
+          </span>
+          <el-checkbox-group v-model="kjbq" @change="handleCheckedCitiesChange">
+            <el-checkbox
+              v-for="(item, index) in dataList"
+              :key="index"
+              :label="item.id"
+              >{{ item.kjbq }}</el-checkbox
+            >
+          </el-checkbox-group>
+        </el-form-item>
         <el-form-item label="寤鸿鍐呭" prop="advice">
           <el-input
             type="textarea"
@@ -174,10 +264,27 @@
         <el-button @click="cancel">鍙� 娑�</el-button>
       </div>
     </el-dialog>
+    <el-dialog
+      title="娣诲姞蹇嵎鏍囩"
+      :visible.sync="kjbqopen"
+      width="500px"
+      append-to-body
+    >
+      <el-form ref="form" :model="form" label-width="80px">
+        <el-form-item label="鍚嶇О" prop="kjbq">
+          <el-input v-model="formss.kjbq" placeholder="璇疯緭鍏ュ悕绉�" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFormbgq">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
+import { deptTreeSelect, getDeptListByDictHospId } from "@/api/system/user";
 import {
   listAdvice,
   getAdvice,
@@ -186,11 +293,30 @@
   updateAdvice,
 } from "@/api/advice/advice";
 import { listProject } from "@/api/hosp/project";
+import {
+  getTjAdviceKjbqByFl,
+  addTjAdviceKjbq,
+} from "@/api/system/biaoqianzidian";
+import { getInfo } from "@/api/login";
 
 export default {
   name: "Advice",
   data() {
+    let checkPhoneNum = (rule, value, callback) => {
+      console.log(value);
+      let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/);
+      if (value == "" && value == undefined && !value) {
+        return callback("");
+      } else if (value != undefined && value != "") {
+        return callback();
+      } else if (!patter.test(value)) {
+        return callback("");
+      }
+    };
     return {
+      DepartmentList: [],
+
+      deptOptions: undefined,
       projectList: [],
       // 閬僵灞�
       loading: true,
@@ -206,54 +332,118 @@
       total: 0,
       // advice琛ㄦ牸鏁版嵁
       adviceList: [],
+      dataList: [],
+      kjbq: [],
       // 寮瑰嚭灞傛爣棰�
       title: "",
       // 鏄惁鏄剧ず寮瑰嚭灞�
       open: false,
+      kjbqopen: false,
       // 鏌ヨ鍙傛暟
       queryParams: {
         page: 1,
         pageSize: 10,
         proName: null,
+        bt: null,
       },
       // 琛ㄥ崟鍙傛暟
       form: {},
+      formss: {},
+      defaultProps: {
+        children: "children",
+        label: "label",
+      },
+      treeId: [],
+
       // 琛ㄥ崟鏍¢獙
       rules: {
-        proId: [{ required: true, message: "椤圭洰id涓嶈兘涓虹┖", trigger: "blur" }],
+        proId: [{ required: true, validator: checkPhoneNum, trigger: "blur" }],
       },
     };
   },
   created() {
-    this.getList();
-    this.getlistProject();
+    this.sendhospName();
+    this.getDeptTree();
+  },
+  watch: {
+    // 鏍规嵁鍚嶇О绛涢�夐儴闂ㄦ爲
+
+    treeId(newVal, oldVal) {
+      if (newVal) {
+        this.$nextTick(() => {
+          document
+            .querySelector(".el-tree-node__children .el-tree-node__content")
+            .click();
+        });
+      }
+    },
   },
   methods: {
+    sendhospName() {
+      getDeptListByDictHospId({
+        id: 2000,
+      }).then((res) => {
+        this.DepartmentList = res.data;
+        this.form.deptId = String(this.form.deptId);
+      });
+    },
+    // 鑺傜偣鍗曞嚮浜嬩欢
+    handleNodeClick(data) {
+      this.queryParams.deptId = data.id;
+      // this.queryParams.deptId = null;
+      this.handleQuery();
+    },
+
+    // 绛涢�夎妭鐐�
+    filterNode(value, data) {
+      if (!value) return true;
+      return data.label.indexOf(value) !== -1;
+    },
+    getDeptTree() {
+      deptTreeSelect().then((response) => {
+        this.deptOptions = response.data;
+        this.treeId.push(this.deptOptions[0].id);
+        this.queryParams.deptId = this.deptOptions[0].id;
+      });
+    },
     /** 鏌ヨadvice鍒楄〃 */
     getList() {
       this.loading = true;
-      // let data ={
-      //   proName:this.queryParams.proName,
-      //   page:this.queryParams.page,
-      //   pageSize:this.queryParams.pageSize,
-      // }
       listAdvice(this.queryParams).then((response) => {
-        response.data.list.forEach((item, index) => {item.newID =(this.queryParams.page - 1) * this.queryParams.pageSize +index +1;
+        response.data.list.forEach((item, index) => {
+          item.newID =
+            (this.queryParams.page - 1) * this.queryParams.pageSize + index + 1;
         });
         this.adviceList = response.data.list;
         this.total = response.data.total;
         this.loading = false;
       });
-      
     },
-    getlistProject(){
+    getlistProject() {
       listProject(this.queryParams).then((response) => {
-        this.projectList = response.data;
+        if (response.data) {
+          this.projectList = response.data;
+        }
+      });
+      getInfo().then((res) => {
+        this.formss.userId = res.user.userId;
+        let data = {
+          pageNum: 1,
+          pageSize: 10,
+          userId: res.user.userId,
+          qyzt: 0,
+        };
+        getTjAdviceKjbqByFl(data).then((res) => {
+          if (res.data) {
+            this.dataList = res.data.records;
+          }
+        });
       });
     },
     // 鍙栨秷鎸夐挳
     cancel() {
       this.open = false;
+      this.kjbqopen = false;
       this.reset();
     },
     // 琛ㄥ崟閲嶇疆
@@ -290,30 +480,60 @@
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
       this.reset();
-      this.open = true;
       this.title = "浣撴寤鸿淇℃伅缁存姢";
+      this.getlistProject();
+      this.form.deptId = this.queryParams.deptId;
+      this.open = true;
     },
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleUpdate(row) {
       this.reset();
       const id = row.id || this.ids;
+      this.kjbq = [];
       getAdvice(id).then((response) => {
         this.form = response.data;
+        if (response.data.kjbqz != null) {
+          this.kjbq = response.data.kjbqz.map(Number);
+        }
+        this.getlistProject();
         this.open = true;
+        this.form.deptId = this.queryParams.deptId;
         this.title = "浣撴寤鸿淇℃伅缁存姢";
       });
     },
+    submitFormbgq() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateTjAdviceKjbq(this.formss).then((response) => {
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.kjbqopen = false;
+              this.getlistProject();
+            });
+          } else {
+            addTjAdviceKjbq(this.formss).then((response) => {
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.kjbqopen = false;
+              this.getlistProject();
+            });
+          }
+        }
+      });
+    },
+    handleCheckedCitiesChange(val) {},
     /** 鎻愪氦鎸夐挳 */
     submitForm() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.id != null) {
+            this.form.kjbq = this.kjbq.toString();
             updateAdvice(this.form).then((response) => {
               this.$modal.msgSuccess("淇敼鎴愬姛");
               this.open = false;
               this.getList();
             });
           } else {
+            this.form.kjbq = this.kjbq.toString();
             addAdvice(this.form).then((response) => {
               this.$modal.msgSuccess("鏂板鎴愬姛");
               this.open = false;
@@ -323,6 +543,10 @@
         }
       });
     },
+    handlekjbq() {
+      this.kjbqopen = true;
+    },
+
     /** 鍒犻櫎鎸夐挳鎿嶄綔 */
     handleDelete(row) {
       const ids = row.id || this.ids;
@@ -359,4 +583,16 @@
 .pag1 {
   width: 30%;
 }
+.content {
+  width: 1000px;
+  height: 1000px;
+}
+.head-container {
+  width: 200px;
+  height: 629px;
+  overflow: auto;
+  border: 1px solid #ccc;
+  position: relative;
+}
+
 </style>

--
Gitblit v1.8.0