From f9fe4cd6ae79fbac1a9fd535487bc40539c3f00e Mon Sep 17 00:00:00 2001
From: su1124 <1583764726@qq.com>
Date: 星期四, 25 四月 2024 15:58:56 +0800
Subject: [PATCH] su

---
 src/views/system/biapqianzidian/index.vue |  429 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/api/system/biaoqianzidian.js          |   45 +++++
 2 files changed, 474 insertions(+), 0 deletions(-)

diff --git a/src/api/system/biaoqianzidian.js b/src/api/system/biaoqianzidian.js
new file mode 100644
index 0000000..06dd9a7
--- /dev/null
+++ b/src/api/system/biaoqianzidian.js
@@ -0,0 +1,45 @@
+import request from '@/utils/request'
+
+// 鏍规嵁鏍囩鍒嗙被鏌ヨ浣撴寤鸿蹇嵎鏍囩鎺ュ彛
+export function getTjAdviceKjbqByFl(query) {
+  return request({
+    url: '/advice/advice/getTjAdviceKjbqByFl',
+    method: 'get',
+    params: query
+  })
+}
+
+// 鑾峰彇鐢ㄦ埛璇︾粏淇℃伅
+export function getInfo() {
+    return request({
+      url: '/getInfo',
+      method: 'get'
+    })
+  }
+
+  // 鏂板浣撴寤鸿蹇嵎鏍囩鎺ュ彛
+export function addTjAdviceKjbq(data) {
+    return request({
+      url: '/advice/advice/addTjAdviceKjbq',
+      method: 'post',
+      data: data
+    })
+  }
+
+  // 淇敼浣撴寤鸿蹇嵎鏍囩鎺ュ彛
+export function updateTjAdviceKjbq(data) {
+    return request({
+      url: '/advice/advice/updateTjAdviceKjbq',
+      method: 'put',
+      data: data
+    })
+  }
+
+    // 淇敼浣撴寤鸿蹇嵎鏍囩鍚敤鐘舵�佹帴鍙�
+export function updateQybzTjAdviceKjbqById(data) {
+    return request({
+      url: '/advice/advice/updateQybzTjAdviceKjbqById',
+      method: 'post',
+      data: data
+    })
+  }
diff --git a/src/views/system/biapqianzidian/index.vue b/src/views/system/biapqianzidian/index.vue
new file mode 100644
index 0000000..bfeda84
--- /dev/null
+++ b/src/views/system/biapqianzidian/index.vue
@@ -0,0 +1,429 @@
+<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="qyzt">
+        <el-select
+          v-model="queryParams.qyzt"
+          placeholder="璇烽�夋嫨鍚敤鐘舵��"
+          clearable
+        >
+          <el-option
+            v-for="dict in dict.type.dict_status"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </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-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['hosp:sendTemplate:add']"
+          >鏂板
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['hosp:sendTemplate:edit']"
+          >淇敼
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['hosp:sendTemplate:remove']"
+          >鍒犻櫎
+        </el-button>
+      </el-col>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
+    </el-row>
+
+    <el-table
+      v-loading="loading"
+      :data="biaoqianList"
+      @selection-change="handleSelectionChange"
+      border
+    >
+      <el-table-column type="selection" width="45" align="center" />
+      <el-table-column
+        label="搴忓彿"
+        align="center"
+        prop="newID"
+        width="60"
+        :show-overflow-tooltip="true"
+      />
+      <el-table-column
+        label="缂栫爜"
+        align="center"
+        prop="id"
+        width="100"
+        :show-overflow-tooltip="true"
+      />
+      <el-table-column
+        label="鍚嶇О"
+        align="center"
+        prop="kjbq"
+        :show-overflow-tooltip="true"
+      />
+      <el-table-column
+        label="鐢ㄦ埛鍚嶇О"
+        align="center"
+        prop="userName"
+        :show-overflow-tooltip="true"
+      />
+      <el-table-column
+        label="鍚敤鐘舵��"
+        align="center"
+        prop="qyzt"
+        :show-overflow-tooltip="true"
+      >
+        <template slot-scope="scope">
+          <el-switch
+            v-model="scope.row.qyzt"
+            active-value="0"
+            inactive-value="1"
+            @change="changeSwitch(scope.row)"
+          ></el-switch>
+        </template>
+      </el-table-column>
+      <el-table-column
+        label="鍒涘缓浜�"
+        align="center"
+        prop="createBy"
+        :show-overflow-tooltip="true"
+      />
+      <el-table-column
+        label="鍒涘缓鏃堕棿"
+        align="center"
+        prop="createTime"
+        :show-overflow-tooltip="true"
+      />
+      <el-table-column
+        label="鎿嶄綔"
+        align="center"
+        class-name="small-padding fixed-width"
+        width="120"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['hosp:sendTemplate:edit']"
+            title="淇敼"
+          >
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['hosp:sendTemplate: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.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="getList"
+        />
+      </div>
+    </div>
+
+    <!-- 娣诲姞鎴栦慨鏀逛綋妫�寤鸿蹇嵎鏍囩瀵硅瘽妗� -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="鍚嶇О" prop="kjbq">
+          <el-input v-model="form.kjbq" placeholder="璇疯緭鍏ュ悕绉�" />
+        </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 {
+  getTjAdviceKjbqByFl,
+  getInfo,
+  addTjAdviceKjbq,
+  updateTjAdviceKjbq,
+  updateQybzTjAdviceKjbqById
+} from "@/api/system/biaoqianzidian";
+
+export default {
+  name: "SendTemplate",
+  dicts: ["dict_status", "sys_normal_disable"],
+  data() {
+    let checkPhoneNum = (rule, value, callback) => {
+      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 {
+      userId: "",
+      // 閬僵灞�
+      loading: true,
+      // 閫変腑鏁扮粍
+      ids: [],
+      // 闈炲崟涓鐢�
+      single: true,
+      // 闈炲涓鐢�
+      multiple: true,
+      // 鏄剧ず鎼滅储鏉′欢
+      showSearch: true,
+      // 鎬绘潯鏁�
+      total: 0,
+      // 閭欢鐭俊妯℃澘琛ㄦ牸鏁版嵁
+      biaoqianList: [],
+      // 寮瑰嚭灞傛爣棰�
+      title: "",
+      // 鏄惁鏄剧ず寮瑰嚭灞�
+      open: false,
+      // 鏌ヨ鍙傛暟
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        userId: null,
+        qyzt: null,
+      },
+      // 琛ㄥ崟鍙傛暟
+      form: {},
+      // 琛ㄥ崟鏍¢獙
+      rules: {
+        tempTitle: [
+          {
+            required: true,
+            validator: checkPhoneNum,
+            trigger: "blur",
+          },
+        ],
+        tempContent: [
+          {
+            required: true,
+            validator: checkPhoneNum,
+            trigger: "blur",
+          },
+        ],
+        tempType: [
+          {
+            required: true,
+            validator: checkPhoneNum,
+            trigger: "change",
+          },
+        ],
+      },
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 鏌ヨ閭欢鐭俊妯℃澘鍒楄〃 */
+    getList() {
+      getInfo().then((res) => {
+        this.userId = res.user.userId;
+      });
+      this.loading = true;
+      if (this.userId == "1") {
+        this.queryParams.userId = null;
+      } else {
+        this.queryParams.userId = this.userId;
+      }
+      getTjAdviceKjbqByFl(this.queryParams).then((response) => {
+        response.data.records.forEach((item, index) => {
+          item.newID =
+            (this.queryParams.pageNum - 1) * this.queryParams.pageSize +
+            index +
+            1;
+        });
+        this.biaoqianList = response.data.records;
+        this.total = response.data.total;
+        this.loading = false;
+      });
+    },
+    // 寮�鍏充簨浠�
+    changeSwitch(row) {
+      this.rows = row;
+      let text = row.qyzt === "0" ? "鍚敤" : "鍋滅敤";
+      this.$modal
+        .confirm('纭瑕�"' + text + '""' + row.kjbq + '"妯℃澘鍚楋紵')
+        .then(function () {
+          return updateQybzTjAdviceKjbqById(row.id, row.qyzt);
+        })
+        .then(() => {
+          this.$modal.msgSuccess(text + "鎴愬姛");
+          this.getList();
+        })
+        .catch(function () {
+          row.qyzt = row.qyzt === "0" ? "1" : "0";
+        });
+    },
+    // 鍙栨秷鎸夐挳
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 琛ㄥ崟閲嶇疆
+    reset() {
+      this.form = {
+        id: null,
+        tempTitle: null,
+        tempContent: null,
+        tempType: null,
+        deleted: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        flag: null,
+      };
+      this.resetForm("form");
+    },
+    /** 鎼滅储鎸夐挳鎿嶄綔 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      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;
+    },
+    /** 鏂板鎸夐挳鎿嶄綔 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "娣诲姞蹇嵎鏍囩";
+    },
+    /** 淇敼鎸夐挳鎿嶄綔 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids;
+      this.form = row;
+      this.open = true;
+      //     this.title = "淇敼蹇嵎鏍囩";
+      //   getSendTemplate(id).then((response) => {
+      //
+      //
+      //   });
+    },
+
+    // 鍒犻櫎妯℃澘
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal
+        .confirm('鏄惁纭鍒犻櫎浣撴娴佹按缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�')
+        .then(function () {
+          return delSendTemplate(ids);
+        })
+        .then(() => {
+          this.getList();
+          this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+        })
+        .catch(() => {});
+    },
+
+    // 瀵煎嚭妯℃澘
+    handleExport() {
+      this.download(
+        "hosp/sendTemplate/export",
+        {
+          ...this.queryParams,
+        },
+        `order_${new Date().getTime()}.xlsx`
+      );
+    },
+    // 妯℃澘鏂板鎴栦慨鏀�
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateTjAdviceKjbq(this.form).then((response) => {
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addTjAdviceKjbq(this.form).then((response) => {
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style>
+.pag {
+  width: 100%;
+  display: flex;
+  justify-content: center;
+}
+.pag1 {
+  width: 30%;
+}
+</style>

--
Gitblit v1.8.0