Bladeren bron

卡清单加上同步上级数据操作

吴sir 3 maanden geleden
bovenliggende
commit
612c1f73ab
2 gewijzigde bestanden met toevoegingen van 39 en 5 verwijderingen
  1. 7 1
      src/api/path/lotCard.api.js
  2. 32 4
      src/views/lotCard/cardList/index.vue

+ 7 - 1
src/api/path/lotCard.api.js

@@ -97,4 +97,10 @@ export function getOrderCard(data){
 // 查询使用量
 export function getFlowData(data) {
     return service.post("/admin/sim/simCDR", data);
-}
+}
+
+// 同步卡清单流量数据
+
+export function syncFlowData(data) {
+    return service.post("/admin/sim/syncSimCDR", data);
+}

+ 32 - 4
src/views/lotCard/cardList/index.vue

@@ -6,7 +6,13 @@
       <Search :SearchForm="SearchForm" @query="intData" @reset="reset" />
     </div>
 
-    <a-table row-key="iccid" :data="dataSource" :columns="columnsData" :pagination="false" :scroll="{ x: 'auto' }">
+    <div class="SynchronousData">
+      <!-- 同步数据 -->
+      <a-button type="primary" @click="syncData">同步数据</a-button>
+    </div>
+
+    <a-table row-key="iccid" :data="dataSource" :columns="columnsData" :pagination="false" :scroll="{ x: 'auto' }"
+      :loading="loading">
       <template #iccidStatus="{ record }">
         <a-tag color="#7bc616" v-if="record.iccidStatus == '正常'">{{ record.iccidStatus }}</a-tag>
         <a-tag v-else>{{ record.iccidStatus }}</a-tag>
@@ -36,12 +42,13 @@
 <script setup>
 import { onMounted, ref, getCurrentInstance, h } from "vue";
 import { columns, SearchForm } from "./config";
-import { cardInfoList } from "@/api/path/lotCard.api"
+import { cardInfoList, syncFlowData } from "@/api/path/lotCard.api"
 import trafficUseDialog from "./trafficUseDialog.vue";
 import { Getdictionary } from '@/mixins/index.js'
 import { sanitizeObject } from '@/utils/utils'
 import Add from './add.vue'
 import Search from '@/components/Search/index.vue'
+import { Message } from "@arco-design/web-vue";
 const { proxy } = getCurrentInstance()
 import { useI18n } from 'vue-i18n'
 const { t } = useI18n();
@@ -57,7 +64,7 @@ const pagination = ref({
 const columnsData = ref([])
 const userType = ref(JSON.parse(localStorage.getItem('user_login_information'))?.userType)
 const showAdd = ref(false)
-
+const loading = ref(false)
 const trafficUseDialogRef = ref()
 
 
@@ -85,7 +92,7 @@ const intData = async (item) => {
       dataUsage: item.dataPackage[0]?.dataUsage ? item.dataPackage[0]?.dataUsage + '/MB' : '0' + '/MB',
       dataTotal: item.dataPackage[0]?.dataTotal ? item.dataPackage[0]?.dataTotal + '/MB' : '0' + '/MB',
       dataUsageTotal: item.dataUsageTotal ? item.dataUsageTotal + '/MB' : '---',
-      productName:item.dataPackage[0]?.productName
+      productName: item.dataPackage[0]?.productName
     }
   })
   pagination.value.total = data.total
@@ -119,6 +126,21 @@ const handleDictValue = async () => {
   serviceList.value = await Getdictionary('activationPackageMethod')
 }
 
+// 同步数据
+const syncData = async () => {
+  let list = []
+  dataSource.value.forEach(item => {
+    list.push(item.iccid,)
+  })
+  loading.value = true
+  let res = await syncFlowData({iccid:list})
+  if(res.code===200){
+    Message.success('同步成功')
+    loading.value = false
+    intData()
+  }
+}
+
 
 onMounted(async () => {
   await handleDictValue()
@@ -144,6 +166,12 @@ onMounted(async () => {
   margin-bottom: 20px;
 }
 
+.SynchronousData{
+  display: flex;
+  justify-content: flex-end;
+  margin-bottom: 20px;
+}
+
 .top-actions {
   margin-bottom: 20px;
 }