From 0940edf5adb07cd9f850f1e882443ecae1015268 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=9C=E8=B4=A4=E9=87=91?= <1960116313@qq.com>
Date: Fri, 15 Apr 2022 11:35:31 +0800
Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E8=AE=BE=E5=A4=87?=
 =?UTF-8?q?=E7=AE=A1=E7=90=86=20=20=E4=B8=8E=20=20=E6=B5=81=E9=87=8F?=
 =?UTF-8?q?=E6=B1=A0=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/api/communication/device.js               |  49 +++
 src/api/communication/flowpool.js             |  49 +++
 src/api/communication/outbound.js             |   6 +-
 .../communicationmanage/device/device.vue     | 299 ++++++++++++++
 .../communicationmanage/flowpool/flowpool.vue | 373 ++++++++++++++++++
 .../communicationmanage/outbound/outbound.vue | 109 +++--
 6 files changed, 818 insertions(+), 67 deletions(-)
 create mode 100644 src/api/communication/device.js
 create mode 100644 src/api/communication/flowpool.js
 create mode 100644 src/views/communicationmanage/device/device.vue
 create mode 100644 src/views/communicationmanage/flowpool/flowpool.vue

diff --git a/src/api/communication/device.js b/src/api/communication/device.js
new file mode 100644
index 0000000..32f5e73
--- /dev/null
+++ b/src/api/communication/device.js
@@ -0,0 +1,49 @@
+import request from '@/router/axios';
+//列表
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/iot-sim/device/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+export const getDetail = (id) => {
+  return request({
+    url: '/api/iot-sim/device/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+//新增
+export const add = (row) => {
+  return request({
+    url: '/api/iot-sim/device/save',
+    method: 'post',
+    data: row
+  })
+}
+//删除
+export const remove = (ids) => {
+  return request({
+    url: '/api/iot-sim/device/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+//修改
+export const update = (row) => {
+  return request({
+    url: '/api/iot-sim/device/update',
+    method: 'post',
+    data: row
+  })
+}
+
diff --git a/src/api/communication/flowpool.js b/src/api/communication/flowpool.js
new file mode 100644
index 0000000..736d7ae
--- /dev/null
+++ b/src/api/communication/flowpool.js
@@ -0,0 +1,49 @@
+import request from '@/router/axios';
+//列表
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/iot-sim/flowpool/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+export const getDetail = (id) => {
+  return request({
+    url: '/api/iot-sim/flowpool/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+//新增
+export const add = (row) => {
+  return request({
+    url: '/api/iot-sim/flowpool/save',
+    method: 'post',
+    data: row
+  })
+}
+//删除
+export const remove = (ids) => {
+  return request({
+    url: '/api/iot-sim/flowpool/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+//修改
+export const update = (row) => {
+  return request({
+    url: '/api/iot-sim/flowpool/update',
+    method: 'post',
+    data: row
+  })
+}
+
diff --git a/src/api/communication/outbound.js b/src/api/communication/outbound.js
index 69309d7..af8760b 100644
--- a/src/api/communication/outbound.js
+++ b/src/api/communication/outbound.js
@@ -2,7 +2,7 @@ import request from '@/router/axios';
 //列表
 export const getList = (current, size, params) => {
   return request({
-    url: '/api/iot-sim/channel/page',
+    url: '/api/iot-sim/simcarddeliver/page',
     method: 'get',
     params: {
       ...params,
@@ -29,12 +29,12 @@ export const add = (row) => {
   })
 }
 //删除
-export const remove = (id) => {
+export const remove = (ids) => {
   return request({
     url: '/api/iot-sim/simcarddeliver/remove',
     method: 'post',
     params: {
-      id,
+      ids,
     }
   })
 }
diff --git a/src/views/communicationmanage/device/device.vue b/src/views/communicationmanage/device/device.vue
new file mode 100644
index 0000000..67afea5
--- /dev/null
+++ b/src/views/communicationmanage/device/device.vue
@@ -0,0 +1,299 @@
+<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"
+      @current-change="currentChange"
+      @size-change="sizeChange"
+      @refresh-change="refreshChange"
+      @on-load="onLoad"
+    >
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+import {
+  getDetail,
+  getList,
+  add,
+  remove,
+  update,
+} from "@/api/communication/device";
+import { mapGetters } from "vuex";
+
+export default {
+  data() {
+    return {
+      form: {},
+      query: {},
+      loading: false,
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0,
+      },
+      option: {
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: true,
+        index: true,
+        addBtn: true,
+        viewBtn: true,
+        delBtn: true,
+        columnBtn: false,
+        selection: false,
+        dialogClickModal: false,
+        dialogWidth: "60%",
+        column: [
+          {
+            label: "设备序列号",
+            prop: "deviceSn",
+            span: 12,
+            labelWidth: 130,
+            search: false,
+            rules: [
+              {
+                required: true,
+                message: "请输入设备序列号",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "设备名称",
+            prop: "name",
+            span: 12,
+            labelWidth: 130,
+            search: true,
+            rules: [
+              {
+                required: true,
+                message: "请输入设备名称",
+                trigger: "blur",
+              },
+            ],
+          },
+
+          {
+            label: "贴片卡iccid",
+            prop: "simChipIccid",
+            span: 12,
+            labelWidth: 130,
+            search: false,
+            hide: true,
+            rules: [
+              {
+                required: false,
+                message: "请输入贴片卡id",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "插拔卡iccid",
+            prop: "simExtraIccid",
+            span: 12,
+            labelWidth: 130,
+            search: false,
+            hide: true,
+            rules: [
+              {
+                required: false,
+                message: "请输入插拔卡id",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "sn码",
+            prop: "sn",
+            span: 12,
+            labelWidth: 130,
+            search: false,
+            rules: [
+              {
+                required: true,
+                message: "请输入sn码",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "是否出库",
+            prop: "isDeliver",
+            type: "select",
+            dicUrl: "/api/iot-system/dict/dictionary?code=yes_no",
+            props: {
+              label: "dictValue",
+              value: "dictKey",
+            },
+            dataType: "number",
+            span: 12,
+            labelWidth: 130,
+            search: true,
+            rules: [
+              { required: true, message: "请选择是否出库", trigger: "change" },
+            ],
+          },
+          {
+            label: "设备读卡类型",
+            type: "select",
+            span: 12,
+            dicUrl: "/api/iot-system/dict/dictionary?code=device_type",
+            props: {
+              label: "dictValue",
+              value: "dictKey",
+            },
+            dataType: "number",
+            prop: "type",
+            labelWidth: 130,
+            searchLabelWidth: 140,
+            search: true,
+            rules: [
+              {
+                required: true,
+                message: "请选择设备读卡类型",
+                trigger: "change",
+              },
+            ],
+          },
+          {
+            label: "管理员账号",
+            prop: "account",
+            span: 12,
+            labelWidth: 130,
+            search: false,
+            rules: [
+              {
+                required: true,
+                message: "请输入管理员账号",
+                trigger: "blur",
+              },
+            ],
+          },
+        ],
+      },
+      data: [],
+    };
+  },
+  computed: {
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        // viewBtn: this.vaildData(this.permission.sourceApi_view, false),
+        // editBtn: this.vaildData(this.permission.sourceApi_edit, false),
+        // delBtn: this.vaildData(this.permission.sourceApi_delete, false),
+      };
+    },
+  },
+  methods: {
+    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();
+    },
+    //新增
+    rowSave(row, done, loading) {
+      add(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    //修改
+    rowUpdate(row, index, done, loading) {
+      update(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    //删除
+    rowDel(row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+        });
+    },
+    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;
+      getList(
+        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;
+      });
+    },
+  },
+};
+</script>
+
+<style></style>
diff --git a/src/views/communicationmanage/flowpool/flowpool.vue b/src/views/communicationmanage/flowpool/flowpool.vue
new file mode 100644
index 0000000..1030ac8
--- /dev/null
+++ b/src/views/communicationmanage/flowpool/flowpool.vue
@@ -0,0 +1,373 @@
+<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"
+      @current-change="currentChange"
+      @size-change="sizeChange"
+      @refresh-change="refreshChange"
+      @on-load="onLoad"
+    >
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+import {
+  getDetail,
+  getList,
+  add,
+  remove,
+  update,
+} from "@/api/communication/flowpool";
+import { mapGetters } from "vuex";
+
+export default {
+  data() {
+    return {
+      form: {},
+      query: {},
+      loading: false,
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0,
+      },
+      option: {
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: true,
+        index: true,
+        addBtn: true,
+        viewBtn: true,
+        delBtn: true,
+        columnBtn: false,
+        selection: false,
+        dialogClickModal: false,
+        dialogWidth: "60%",
+        column: [
+          {
+            label: "通道名称",
+            prop: "channelId",
+            span: 12,
+            labelWidth: 130,
+            search: true,
+            type: "select",
+            dicUrl: "/api/iot-sim/simcard/getChannel",
+            props: {
+              label: "name",
+              value: "id",
+            },
+            rules: [
+              {
+                required: true,
+                message: "请选择通道名称",
+                trigger: "change",
+              },
+            ],
+          },
+          {
+            label: "流量池编号",
+            prop: "code",
+            span: 12,
+            labelWidth: 130,
+            searchLabelWidth: 90,
+            search: true,
+            rules: [
+              {
+                required: true,
+                message: "请输入设备序列号",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "流量池名称",
+            prop: "name",
+            span: 12,
+            labelWidth: 130,
+            searchLabelWidth: 90,
+            search: true,
+            rules: [
+              {
+                required: true,
+                message: "请输入流量池名称",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "流量池总量",
+            prop: "total",
+            span: 12,
+            labelWidth: 130,
+            searchLabelWidth: 90,
+            search: false,
+            hide: false,
+
+            rules: [
+              {
+                required: true,
+                message: "请输入流量池总量",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "提醒阈值",
+            prop: "remindRatio",
+            span: 12,
+            labelWidth: 130,
+            searchLabelWidth: 90,
+            search: false,
+            hide: false,
+            rules: [
+              {
+                required: true,
+                message: "请输入提醒阈值",
+                trigger: "blur",
+              },
+            ],
+          },
+
+          {
+            label: "是否立即生效",
+            prop: "isNowActivate",
+            type: "select",
+            dicUrl: "/api/iot-system/dict/dictionary?code=now_activate",
+            props: {
+              label: "dictValue",
+              value: "dictKey",
+            },
+            dataType: "number",
+            span: 12,
+            labelWidth: 130,
+            search: false,
+            hide: true,
+            rules: [
+              {
+                required: true,
+                message: "请选择是否立即生效",
+                trigger: "change",
+              },
+            ],
+          },
+          {
+            label: "流量池类型",
+            type: "select",
+            span: 12,
+            dicUrl: "/api/iot-system/dict/dictionary?code=flow_pool_type",
+            props: {
+              label: "dictValue",
+              value: "dictKey",
+            },
+            dataType: "number",
+            prop: "type",
+            labelWidth: 130,
+            searchLabelWidth: 140,
+            search: true,
+            rules: [
+              {
+                required: true,
+                message: "请选择流量池类型",
+                trigger: "change",
+              },
+            ],
+          },
+          {
+            label: "源/目标流量池",
+            type: "select",
+            span: 12,
+            dicUrl: "/api/iot-system/dict/dictionary?code=is_source",
+            props: {
+              label: "dictValue",
+              value: "dictKey",
+            },
+            dataType: "number",
+            prop: "isSource",
+            labelWidth: 130,
+            searchLabelWidth: 110,
+            search: true,
+            rules: [
+              {
+                required: true,
+                message: "请选择源/目标流量池",
+                trigger: "change",
+              },
+            ],
+          },
+
+          {
+            label: "单卡最大使用量(单位M)",
+            prop: "maxUsage",
+            span: 12,
+            labelWidth: 130,
+            search: false,
+            hide: true,
+            rules: [
+              {
+                required: true,
+                message: "请输入管理员账号",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "已激活数量",
+            prop: "activationNum",
+            span: 12,
+            labelWidth: 130,
+            search: false,
+            hide: true,
+            addDisplay: false,
+            editDisplay: false,
+            rules: [
+              {
+                required: true,
+                message: "请输入管理员账号",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "管理员名称",
+            prop: "account",
+            span: 12,
+            labelWidth: 130,
+            search: false,
+            addDisplay: false,
+            editDisplay: false,
+            hide: true,
+            rules: [
+              {
+                required: true,
+                message: "请输入管理员账号",
+                trigger: "blur",
+              },
+            ],
+          },
+        ],
+      },
+      data: [],
+    };
+  },
+  computed: {
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        // viewBtn: this.vaildData(this.permission.sourceApi_view, false),
+        // editBtn: this.vaildData(this.permission.sourceApi_edit, false),
+        // delBtn: this.vaildData(this.permission.sourceApi_delete, false),
+      };
+    },
+  },
+  methods: {
+    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();
+    },
+    //新增
+    rowSave(row, done, loading) {
+      add(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    //修改
+    rowUpdate(row, index, done, loading) {
+      update(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    //删除
+    rowDel(row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+        });
+    },
+    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;
+      getList(
+        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;
+      });
+    },
+  },
+};
+</script>
+
+<style></style>
diff --git a/src/views/communicationmanage/outbound/outbound.vue b/src/views/communicationmanage/outbound/outbound.vue
index c26c32b..8848298 100644
--- a/src/views/communicationmanage/outbound/outbound.vue
+++ b/src/views/communicationmanage/outbound/outbound.vue
@@ -24,7 +24,13 @@
 </template>
 
 <script>
-import { getList,add,getDetail,remove,update } from "@/api/communication/basiccard";
+import {
+  getList,
+  add,
+  getDetail,
+  remove,
+  update,
+} from "@/api/communication/outbound";
 import { mapGetters } from "vuex";
 
 export default {
@@ -44,7 +50,7 @@ export default {
         searchMenuSpan: 6,
         border: true,
         index: true,
-        addBtn: true,
+        addBtn: false,
         viewBtn: true,
         delBtn: true,
         columnBtn: false,
@@ -66,31 +72,32 @@ export default {
               },
             ],
           },
-          {
-            label: "卡类型",
-            prop: "cardType",
-            type: "select",
-            span: 12,
-            dicUrl: "/api/iot-sim/channel/fillData",
-            props: {
-              label: "dictValue",
-              value: "dictKey",
-            },
-            // dataType: "number",
-            labelWidth: 130,
-            searchLabelWidth: 120,
-            search: true,
-            rules: [
-              {
-                required: true,
-                message: "请选择所属运营商类型",
-                trigger: "change",
-              },
-            ],
-          },
+          // {
+          //   label: "卡类型",
+          //   prop: "cardType",
+          //   type: "select",
+          //   span: 12,
+          //   dicUrl: "/api/iot-system/dict/dictionary?code=card_type",
+          //   props: {
+          //     label: "dictValue",
+          //     value: "dictKey",
+          //   },
+          //   dataType: "number",
+          //   labelWidth: 130,
+          //   searchLabelWidth: 120,
+          //   search: true,
+          //   rules: [
+          //     {
+          //       required: true,
+          //       message: "请选择所属运营商类型",
+          //       trigger: "change",
+          //     },
+          //   ],
+          // },
           {
             label: "iccid",
             prop: "iccid",
+            width: 150,
             span: 12,
             labelWidth: 130,
             search: true,
@@ -106,6 +113,7 @@ export default {
             label: "imsi",
             prop: "imsi",
             span: 12,
+            width: 150,
             labelWidth: 130,
             search: true,
             rules: [
@@ -116,43 +124,16 @@ export default {
               },
             ],
           },
+          // {
+          //   label: "业务状态",
+          //   prop: "status",
+          //   span: 12,
+          //   labelWidth: 130,
+          //   rules: [
+          //     { required: true, message: "请输入apiUrl", trigger: "blur" },
+          //   ],
+          // },
           {
-            label: "是否出库",
-            prop: "isDeliver",
-            type: "select",
-            dicData: [
-              {
-                label: "否",
-                value: 0,
-              },
-              {
-                label: "是",
-                value: 1,
-              },
-            ],
-            span: 12,
-            props: {
-              label: "label",
-              value: "value",
-            },
-            labelWidth: 130,
-            search: true,
-            // slot: true,
-            // editDisplay: false,
-            rules: [
-              { required: true, message: "请选择接口类型", trigger: "change" },
-            ],
-          },
-          {
-            label: "业务状态",
-            prop: "status",
-            span: 12,
-            labelWidth: 130,
-            rules: [
-              { required: true, message: "请输入apiUrl", trigger: "blur" },
-            ],
-          },
-            {
             label: "剩余流量(单位M)",
             prop: "surplus",
             span: 12,
@@ -161,7 +142,7 @@ export default {
               { required: true, message: "请输入apiUrl", trigger: "blur" },
             ],
           },
-           {
+          {
             label: "使用量(单位M)",
             prop: "usage",
             span: 12,
@@ -179,9 +160,9 @@ export default {
     ...mapGetters(["permission"]),
     permissionList() {
       return {
-        viewBtn: this.vaildData(this.permission.sourceApi_view, false),
-        editBtn: this.vaildData(this.permission.sourceApi_edit, false),
-        delBtn: this.vaildData(this.permission.sourceApi_delete, false),
+        // viewBtn: this.vaildData(this.permission.sourceApi_view, false),
+        // editBtn: this.vaildData(this.permission.sourceApi_edit, false),
+        // delBtn: this.vaildData(this.permission.sourceApi_delete, false),
       };
     },
   },