From ad39d810145671b568c3c694aa5d98901092d4fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=9C=E8=B4=A4=E9=87=91?= <1960116313@qq.com>
Date: Thu, 14 Jul 2022 17:01:57 +0800
Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E5=8D=A1=E5=87=BA?=
 =?UTF-8?q?=E5=87=BA=E5=BA=93=E5=AD=97=E6=AE=B5=20=20=20=20=E4=BF=AE?=
 =?UTF-8?q?=E6=94=B9sim=E5=AD=97=E6=AE=B5=20feat:=20sim=E5=8D=A1=E6=96=B0?=
 =?UTF-8?q?=E5=A2=9E=20=20=20=E5=90=8C=E6=AD=A5=E6=B5=81=E9=87=8F=E6=8C=89?=
 =?UTF-8?q?=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/api/informationmanage/sim.js              | 11 +++++-
 .../communicationmanage/outbound/outbound.vue | 13 +++++--
 src/views/informationmanage/sim/index.vue     | 38 +++++++++++++++++--
 3 files changed, 53 insertions(+), 9 deletions(-)

diff --git a/src/api/informationmanage/sim.js b/src/api/informationmanage/sim.js
index 6233e68..3b8b581 100644
--- a/src/api/informationmanage/sim.js
+++ b/src/api/informationmanage/sim.js
@@ -21,7 +21,16 @@ export const getDetail = (id) => {
     }
   })
 }
-
+//同步流量
+export const syncUsage = (id) => {
+  return request({
+    url: '/api/iot-sim/sim/syncUsage',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
 
 //导出类型
 export const exporttype = () => {
diff --git a/src/views/communicationmanage/outbound/outbound.vue b/src/views/communicationmanage/outbound/outbound.vue
index cbc970d..94b8084 100644
--- a/src/views/communicationmanage/outbound/outbound.vue
+++ b/src/views/communicationmanage/outbound/outbound.vue
@@ -582,9 +582,11 @@ export default {
           },
           {
             label: "剩余流量(M)",
-            prop: "surplus",
+            prop: "surplusM",
             span: 12,
             type: "number",
+            addDisplay: false,
+            editDisplay: false,
             labelWidth: 130,
             hide: true,
             rules: [
@@ -598,11 +600,12 @@ export default {
           },
           {
             label: "使用量(M)",
-            prop: "usage",
+            prop: "usageM",
             span: 12,
             labelWidth: 130,
             type: "number",
-            hide: true,
+            addDisplay: false,
+            editDisplay: false,
             rules: [
               { required: true, message: "请输入使用量", trigger: "blur" },
               {
@@ -614,10 +617,12 @@ export default {
           },
           {
             label: "总量(M)",
-            prop: "total",
+            prop: "totalM",
             span: 12,
             labelWidth: 130,
             type: "number",
+            addDisplay: false,
+            editDisplay: false,
             hide: true,
             rules: [
               { required: true, message: "请输入总量", trigger: "blur" },
diff --git a/src/views/informationmanage/sim/index.vue b/src/views/informationmanage/sim/index.vue
index 398f4b8..51137c7 100644
--- a/src/views/informationmanage/sim/index.vue
+++ b/src/views/informationmanage/sim/index.vue
@@ -79,6 +79,20 @@
             </div>
           </el-popconfirm>
         </el-dropdown-item>
+        <el-dropdown-item>
+          <el-popconfirm
+            confirm-button-text="确定"
+            cancel-button-text="取消"
+            @confirm="handleFlow(scope.row.id)"
+            icon-color="red"
+            title="您确认要同步流量吗?"
+            placement="top-start"
+          >
+            <div class="el-icon-refresh-right" slot="reference">
+              &nbsp;同步流量
+            </div>
+          </el-popconfirm>
+        </el-dropdown-item>
       </template>
     </avue-crud>
 
@@ -149,7 +163,12 @@
 </template>
 
 <script>
-import { getList, getDetail, exporttype } from "@/api/informationmanage/sim.js";
+import {
+  getList,
+  getDetail,
+  exporttype,
+  syncUsage,
+} from "@/api/informationmanage/sim.js";
 import {
   syncRealNameStatus,
   updateSimStatus,
@@ -441,7 +460,7 @@ export default {
           },
           {
             label: "总量(M)",
-            prop: "total",
+            prop: "totalM",
             span: 12,
             labelWidth: 130,
             type: "number",
@@ -457,7 +476,7 @@ export default {
           },
           {
             label: "剩余流量(M)",
-            prop: "surplus",
+            prop: "surplusM",
             span: 12,
             type: "number",
             labelWidth: 130,
@@ -473,7 +492,7 @@ export default {
           },
           {
             label: "使用量(M)",
-            prop: "usage",
+            prop: "usageM",
             span: 12,
             labelWidth: 130,
             type: "number",
@@ -708,6 +727,17 @@ export default {
         });
       }
     },
+    //同步流量
+    handleFlow(id) {
+      syncUsage(id).then((res) => {
+        if (res.data.code == 200) {
+          this.$message.success("同步成功");
+          this.onLoad(this.page, this.query);
+        } else {
+          this.$message.error("同步失败");
+        }
+      });
+    },
     onLoad(page, params = {}) {
       this.loading = true;
       getList(