From d852b992bf21ffeb91a5c2f4984f0cbecc042bc4 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Mon, 04 Dec 2023 14:22:23 +0800
Subject: [PATCH] 热线电话

---
 src/option/convenienceHotline/convenienceHotline.js |   40 ++++++++
 src/views/convenienceHotline/index.vue              |  186 +++++++++++++++++++++++++++++++++++++
 src/api/convenienceHotline/convenienceHotline.js    |   62 ++++++++++++
 3 files changed, 288 insertions(+), 0 deletions(-)

diff --git a/src/api/convenienceHotline/convenienceHotline.js b/src/api/convenienceHotline/convenienceHotline.js
new file mode 100644
index 0000000..fc0856b
--- /dev/null
+++ b/src/api/convenienceHotline/convenienceHotline.js
@@ -0,0 +1,62 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/blade-convenienceHotline/convenienceHotline/list',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const getPage = (current, size, params) => {
+  return request({
+    url: '/api/blade-convenienceHotline/convenienceHotline/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const getDetail = (id) => {
+  return request({
+    url: '/api/blade-convenienceHotline/convenienceHotline/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/blade-convenienceHotline/convenienceHotline/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/blade-convenienceHotline/convenienceHotline/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/blade-convenienceHotline/convenienceHotline/submit',
+    method: 'post',
+    data: row
+  })
+}
+
diff --git a/src/option/convenienceHotline/convenienceHotline.js b/src/option/convenienceHotline/convenienceHotline.js
new file mode 100644
index 0000000..9e16bb7
--- /dev/null
+++ b/src/option/convenienceHotline/convenienceHotline.js
@@ -0,0 +1,40 @@
+export default {
+  height: "auto",
+  calcHeight: 54,
+  dialogWidth: 950,
+  tip: false,
+  searchShow: true,
+  searchMenuSpan: 3,
+  menuWidth: 450,
+  border: false,
+  viewBtn: true,
+  selection: true,
+  excelBtn: true,
+  dialogClickModal: false,
+  column: [{
+      label: 'ID',
+      prop: 'id',
+      searchSpan: 4,
+      // search: true,
+      display: false,
+    },
+    {
+      label: '名称',
+      prop: 'name',
+      searchSpan: 4,
+      search: true,
+    },
+    {
+      label: '电话',
+      prop: 'telephone',
+      searchSpan: 4,
+      search: true,
+    },
+    {
+      label: '描述',
+      prop: 'remark',
+      searchSpan: 4,
+      // search: true,
+    },
+  ]
+}
diff --git a/src/views/convenienceHotline/index.vue b/src/views/convenienceHotline/index.vue
new file mode 100644
index 0000000..286e2f2
--- /dev/null
+++ b/src/views/convenienceHotline/index.vue
@@ -0,0 +1,186 @@
+<template>
+  <basic-container>
+  <avue-crud :option="option"
+               :table-loading="loading"
+               :data="data"
+               :page.sync="page"
+               :permission="permissionList"
+               :before-open="beforeOpen"
+               v-model="form"
+               ref="crud"
+               @row-update="rowUpdate"
+               @row-save="rowSave"
+               @row-del="rowDel"
+               @search-change="searchChange"
+               @search-reset="searchReset"
+               @selection-change="selectionChange"
+               @current-change="currentChange"
+               @size-change="sizeChange"
+               @refresh-change="refreshChange" @on-load="onLoad"></avue-crud>
+  </basic-container>
+</template>
+
+<script>
+  import {
+    getPage,
+    getList,
+    getDetail,
+    add,
+    update,
+    remove
+  } from "@/api/convenienceHotline/convenienceHotline";
+  import option from "@/option/convenienceHotline/convenienceHotline";
+  import {
+    mapGetters
+  } from "vuex";
+
+  export default {
+    data() {
+      return {
+        form: {},
+        query: {},
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        selectionList: [],
+        option: option,
+        data: []
+      };
+    },
+    computed: {
+      ...mapGetters(["permission"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.convenienceHotline_add, true),
+          viewBtn: this.vaildData(this.permission.convenienceHotline_view, true),
+          delBtn: this.vaildData(this.permission.convenienceHotline_delete, true),
+          editBtn: this.vaildData(this.permission.convenienceHotline_edit, true)
+        };
+      },
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    methods: {
+      rowSave(row, done, loading) {
+        add(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          window.console.log(error);
+        });
+      },
+      rowUpdate(row, index, done, loading) {
+        update(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          });
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      beforeOpen(done, type) {
+        if (["edit", "view"].includes(type)) {
+          getDetail(this.form.id).then(res => {
+            this.form = res.data.data;
+          });
+        }
+        done();
+      },
+      searchReset() {
+        this.query = {};
+        this.onLoad(this.page);
+      },
+      searchChange(params, done) {
+        this.query = params;
+        this.page.currentPage = 1;
+        this.onLoad(this.page, params);
+        done();
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      selectionClear() {
+        this.selectionList = [];
+        this.$refs.crud.toggleSelection();
+      },
+      currentChange(currentPage) {
+        this.page.currentPage = currentPage;
+      },
+      sizeChange(pageSize) {
+        this.page.pageSize = pageSize;
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query);
+      },
+      onLoad(page, params = {}) {
+        this.loading = true;
+        getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.data = data.records;
+          this.loading = false;
+          this.selectionClear();
+        });
+      }
+    }
+  };
+</script>
+
+<style>
+</style>

--
Gitblit v1.9.3