From c3a1b74679f3bb9796611e431b18e420bba9de58 Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期四, 06 三月 2025 17:59:10 +0800
Subject: [PATCH] kuaijie&changyog

---
 src/views/hosp/commonAdvice/index.vue |  281 ++++++++++++++++++++++++++++
 src/views/hosp/quickAdvice/index.vue  |  267 ++++++++++++++++++++++++++
 2 files changed, 548 insertions(+), 0 deletions(-)

diff --git a/src/views/hosp/commonAdvice/index.vue b/src/views/hosp/commonAdvice/index.vue
new file mode 100644
index 0000000..76f673f
--- /dev/null
+++ b/src/views/hosp/commonAdvice/index.vue
@@ -0,0 +1,281 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="68px"
+    >
+      <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="nr">
+        <el-input
+          v-model="queryParams.nr"
+          placeholder="璇疯緭鍏ユ鏌ラ」鐩�"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </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>
+
+    <el-table
+      :data="dataList"
+      ref="elTable"
+      v-loading="loading"
+      @selection-change="handleSelectionChange"
+      border
+      height="580px"
+    >
+      <el-table-column type="selection" width="40" align="center" />
+      <el-table-column label="搴忓彿" width="70" align="center" prop="newID" />
+      <el-table-column label="鏍囬" width="120" align="center" prop="title" />
+      <el-table-column label="寤鸿鍐呭" align="left" prop="advice" />
+      <el-table-column
+        label="鎿嶄綔"
+        align="center"
+        fixed="right"
+        class-name="small-padding fixed-width"
+        width="100px"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleEdit(scope.row)"
+            title="淇敼"
+          ></el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            title="鍒犻櫎"
+          ></el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.page"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 淇敼蹇�熷缓璁爣棰樺拰鍐呭 -->
+    <el-dialog
+      :title="title"
+      :visible.sync="open"
+      width="1000px"
+      append-to-body
+      :close-on-click-modal="false"
+    >
+      <el-form ref="form" :model="form" label-width="80px" :inline="true">
+        <el-form-item label="鏍囬" prop="title">
+          <el-input
+            v-model="form.title"
+            placeholder="璇疯緭鍏ユ爣棰�"
+            style="width: 200px"
+          />
+        </el-form-item>
+        <el-form-item label="鍐呭" prop="advice">
+          <el-input
+            v-model="form.advice"
+            type="textarea"
+            placeholder="璇疯緭鍏ヤ富瑕佸唴瀹�"
+            style="width: 780px"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+    
+    <script>
+import {
+  updateAdvice,
+  addAdvice,
+  getAdvice,
+  delAdvice
+} from "@/api/advice/advice";
+import {
+  getKjTjAdviceKjbqBySex,
+  getCyTjAdviceKjbqBySex,
+} from "@/api/hosp/project";
+import { getInfo } from "@/api/login";
+
+export default {
+  data() {
+    return {
+      // 閬僵灞�
+      loading: true,
+      // 閫変腑鏁扮粍
+      ids: [],
+      // 闈炲崟涓鐢�
+      single: true,
+      // 闈炲涓鐢�
+      // 鎬绘潯鏁�
+      total: 0,
+      // 浣撴椤圭洰寤鸿瑙勫垯鏂拌〃琛ㄦ牸鏁版嵁
+      dataList: [],
+      // 寮瑰嚭灞傛爣棰�
+      title: "",
+      // 鏄惁鏄剧ず寮瑰嚭灞�
+      open: false,
+      showSearch: true,
+      // 鏌ヨ鍙傛暟
+      queryParams: {
+        page: 1,
+        pageSize: 10,
+        bt: "",
+        nr: "",
+        isZj: "",
+        userId: "",
+      },
+      // 琛ㄥ崟鍙傛暟
+      form: {},
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 鏌ヨ浣撴椤圭洰寤鸿瑙勫垯鏂拌〃鍒楄〃 */
+    getList() {
+      this.loading = true;
+      getInfo().then((res) => {
+        this.queryParams.userId = res.user.userId;
+        this.queryParams.isZj = null;
+        getCyTjAdviceKjbqBySex(this.queryParams).then((res) => {
+          if (res.data) {
+            this.dataList = res.data.records.map((item, index) => ({
+              ...item,
+              newID:
+                (this.queryParams.page - 1) * this.queryParams.pageSize +
+                index +
+                1,
+            }));
+            this.total = res.data.total;
+          } else {
+            this.dataList = [];
+            this.total = 0;
+            this.$modal.msgError(res.msg);
+          }
+          this.loading = false;
+        });
+      });
+    },
+
+    // 鍙栨秷鎸夐挳
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 琛ㄥ崟閲嶇疆
+    reset() {
+      this.form = {
+        id: null,
+        title: null,
+        advice: null,
+      };
+      this.resetForm("form");
+    },
+    /** 鎼滅储鎸夐挳鎿嶄綔 */
+    handleQuery() {
+      this.queryParams.page = 1;
+      this.$forceUpdate();
+      this.getList();
+    },
+
+    /** 閲嶇疆鎸夐挳鎿嶄綔 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+
+    // 澶氶�夋閫変腑鏁版嵁
+    handleSelectionChange(selection) {
+      this.ids = selection.map((item) => item.id);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
+    },
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateAdvice(this.form).then((response) => {
+              console.log(response, 1111333);
+
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addAdvice(this.form).then((response) => {
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    handleEdit(row) {
+      this.reset();
+      const id = row.id || this.ids;
+      this.kjbq = [];
+      getAdvice(id).then((response) => {
+        console.log(response, 55566);
+        this.form = response.data;
+        this.open = true;
+        // this.form.deptId = this.queryParams.deptId;
+        this.title = "浣撴寤鸿淇℃伅缁存姢";
+      });
+    },
+    handleDelete(row) {
+      const ids = row.id || this.ids; // 鑾峰彇涓婚敭鍊硷紝濡傛灉row涓病鏈変富閿�硷紝鍒欎娇鐢╰his.ids
+      this.$modal
+        .confirm(`鏄惁纭鍒犻櫎"${ids}"鐨勬暟鎹」锛焋)
+        .then(() => {
+          return delAdvice(ids); // 璋冪敤鍒犻櫎鎺ュ彛锛屼紶鍏ヤ富閿��
+        })
+        .then(() => {
+          this.getList(); // 鍒犻櫎鎴愬姛鍚庡埛鏂板垪琛�
+          this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); // 鏄剧ず鍒犻櫎鎴愬姛鐨勬彁绀�
+        })
+        .catch(() => {
+          // 寮傚父澶勭悊
+        });
+    },
+  },
+};
+</script>
+    
+    
\ No newline at end of file
diff --git a/src/views/hosp/quickAdvice/index.vue b/src/views/hosp/quickAdvice/index.vue
new file mode 100644
index 0000000..14e5c97
--- /dev/null
+++ b/src/views/hosp/quickAdvice/index.vue
@@ -0,0 +1,267 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="68px"
+    >
+      <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="nr">
+        <el-input
+          v-model="queryParams.nr"
+          placeholder="璇疯緭鍏ユ鏌ラ」鐩�"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </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>
+
+    <el-table
+      :data="dataList"
+      ref="elTable"
+      v-loading="loading"
+      @selection-change="handleSelectionChange"
+      border
+      height="580px"
+    >
+      <el-table-column type="selection" width="40" align="center" />
+      <el-table-column label="搴忓彿" width="70" align="center" prop="newID" />
+      <el-table-column label="鏍囬" width="120" align="center" prop="title" />
+      <el-table-column label="寤鸿鍐呭" align="left" prop="advice" />
+      <el-table-column
+        label="鎿嶄綔"
+        align="center"
+        fixed="right"
+        class-name="small-padding fixed-width"
+        width="100px"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleEdit(scope.row)"
+            title="淇敼"
+          ></el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            title="鍒犻櫎"
+          ></el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.page"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 淇敼蹇�熷缓璁爣棰樺拰鍐呭 -->
+    <el-dialog
+      :title="title"
+      :visible.sync="open"
+      width="1000px"
+      append-to-body
+      :close-on-click-modal="false"
+    >
+      <el-form
+        ref="form"
+        :model="form"
+        label-width="80px"
+        :inline="true"
+      >
+        <el-form-item label="鏍囬" prop="title">
+          <el-input
+            v-model="form.title"
+            placeholder="璇疯緭鍏ユ爣棰�"
+            style="width: 200px"
+          />
+        </el-form-item>
+        <el-form-item label="鍐呭" prop="advice">
+          <el-input
+            v-model="form.advice"
+            type="textarea"
+            placeholder="璇疯緭鍏ヤ富瑕佸唴瀹�"
+            style="width: 780px"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+  
+  <script>
+import { listAdvice, updateAdvice, addAdvice,getAdvice,delAdvice } from "@/api/advice/advice";
+
+export default {
+  name: "Advicerules",
+  data() {
+    return {
+      // 閬僵灞�
+      loading: true,
+      // 閫変腑鏁扮粍
+      ids: [],
+      // 闈炲崟涓鐢�
+      single: true,
+      // 闈炲涓鐢�
+      // 鎬绘潯鏁�
+      total: 0,
+      // 浣撴椤圭洰寤鸿瑙勫垯鏂拌〃琛ㄦ牸鏁版嵁
+      dataList: [],
+      // 寮瑰嚭灞傛爣棰�
+      title: "",
+      // 鏄惁鏄剧ず寮瑰嚭灞�
+      open: false,
+      showSearch: true,
+      // 鏌ヨ鍙傛暟
+      queryParams: {
+        page: 1,
+        pageSize: 10,
+        bt: "",
+        nr: "",
+      },
+      querycharge: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+      // 琛ㄥ崟鍙傛暟
+      form: {},
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 鏌ヨ浣撴椤圭洰寤鸿瑙勫垯鏂拌〃鍒楄〃 */
+    getList() {
+      this.loading = true;
+      listAdvice(this.queryParams).then((response) => {
+        response.data.list.forEach((item, index) => {
+          item.newID =
+            (this.queryParams.page - 1) * this.queryParams.pageSize + index + 1;
+        });
+        this.dataList = response.data.list;
+        this.total = response.data.total;
+        this.loading = false;
+      });
+    },
+
+    // 鍙栨秷鎸夐挳
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 琛ㄥ崟閲嶇疆
+    reset() {
+      this.form = {
+        id: null,
+        title: null,
+        advice: null,
+      };
+      this.resetForm("form");
+    },
+    /** 鎼滅储鎸夐挳鎿嶄綔 */
+    handleQuery() {
+      this.queryParams.page = 1;
+      this.$forceUpdate();
+      this.getList();
+    },
+
+    /** 閲嶇疆鎸夐挳鎿嶄綔 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+
+    // 澶氶�夋閫変腑鏁版嵁
+    handleSelectionChange(selection) {
+      this.ids = selection.map((item) => item.id);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
+    },
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateAdvice(this.form).then((response) => {
+              console.log(response, 1111333);
+
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addAdvice(this.form).then((response) => {
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    handleEdit(row) {
+      this.reset();
+      const id = row.id || this.ids;
+      this.kjbq = [];
+      getAdvice(id).then((response) => {
+        console.log(response,55566);
+        this.form = response.data;
+        this.open = true;
+        // this.form.deptId = this.queryParams.deptId;
+        this.title = "浣撴寤鸿淇℃伅缁存姢";
+      });
+    },
+    handleDelete(row) {
+      const id = row.id || this.ids; // 鑾峰彇涓婚敭鍊硷紝濡傛灉row涓病鏈変富閿�硷紝鍒欎娇鐢╰his.ids
+      this.$modal
+        .confirm(`鏄惁纭鍒犻櫎"${id}"鐨勬暟鎹」锛焋)
+        .then(() => {
+          return delAdvice(id); // 璋冪敤鍒犻櫎鎺ュ彛锛屼紶鍏ヤ富閿��
+        })
+        .then(() => {
+          this.getList(); // 鍒犻櫎鎴愬姛鍚庡埛鏂板垪琛�
+          this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); // 鏄剧ず鍒犻櫎鎴愬姛鐨勬彁绀�
+        })
+        .catch(() => {
+          // 寮傚父澶勭悊
+        });
+    },
+  },
+};
+</script>
+  
+  
\ No newline at end of file

--
Gitblit v1.8.0