index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <!-- 卡清单管理 -->
  3. <div class="container">
  4. <!-- 搜索条件区 -->
  5. <div class="search-section">
  6. <a-form :model="searchForm" ref="formRef" layout="inline">
  7. <a-form-item field="iccid" :label="$t('lotCard.iccid')">
  8. <a-input v-model="searchForm.iccid" :placeholder="$t('lotCard.please') + $t('lotCard.iccid')" allow-clear />
  9. </a-form-item>
  10. <!-- 主卡状态-->
  11. <a-form-item field="iccid" :label="$t('lotCard.iccidType')">
  12. <a-select v-model="value" :style="{ width: '240px' }" :placeholder="$t('lotCard.iccidTypeName')">
  13. <a-option v-for="item of statusList" :value="item.id" :label="item.label" />
  14. </a-select>
  15. </a-form-item>
  16. <!-- 来源-->
  17. <a-form-item field="iccid" :label="$t('lotCard.sourceCard')">
  18. <a-select v-model="value" :style="{ width: '240px' }" :placeholder="$t('lotCard.sourceCardType')">
  19. <a-option v-for="item of sourceList" :value="item.id" :label="item.label" />
  20. </a-select>
  21. </a-form-item>
  22. <!-- 创建时间-->
  23. <a-form-item field="iccid" :label="$t('lotCard.statrt_time')">
  24. <a-date-picker style="width: 200px;" ::placeholder="$t('lotCard.statrt_timeType')" />
  25. </a-form-item>
  26. <!-- 更新时间-->
  27. <a-form-item field="iccid" :label="$t('lotCard.Renewal_time')">
  28. <a-date-picker style="width: 200px;" ::placeholder="$t('lotCard.Renewal_timeType')" />
  29. </a-form-item>
  30. <a-form-item>
  31. <a-space>
  32. <a-button type="primary" @click="handleSearch">{{ $t('form.Search') }}</a-button>
  33. <a-button @click="resetSearch">{{ $t('form.Reset') }}</a-button>
  34. </a-space>
  35. </a-form-item>
  36. </a-form>
  37. </div>
  38. <a-table row-key="iccid" :data="dataSource" :columns="columns" :pagination="pagination" :scroll="{ x: 'auto' }"
  39. @page-change="evChangePage">
  40. <template #poolNum="{ record }">
  41. <span>{{ record.poolName }}</span>
  42. <br/>
  43. <span>{{ record.poolId }}</span>
  44. </template>
  45. <template #dataUsageTotal="{ record }">
  46. <span>{{ record.dataUsageTotal }}MB</span>
  47. </template>
  48. <template #id="{ record }">
  49. <!-- 查看流量消耗 -->
  50. <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="handletrafficUseDialog(record)">详情</a>
  51. </template>
  52. </a-table>
  53. <!-- 查看流量消耗 -->
  54. <trafficUseDialog ref="trafficUseDialogRef" @submit="intData()" />
  55. </div>
  56. </template>
  57. <script setup>
  58. import { onMounted, ref, getCurrentInstance, h } from "vue";
  59. import { columns } from "./config";
  60. import { cardInfoList } from "@/api/path/lotCard.api"
  61. import trafficUseDialog from "./trafficUseDialog.vue";
  62. import { Getdictionary } from '@/mixins/index.js'
  63. const { proxy } = getCurrentInstance()
  64. const formRef = ref()
  65. const searchForm = ref({
  66. "iccid": "",
  67. });
  68. const statusList = ref([]);
  69. const sourceList = ref([]);
  70. const serviceList = ref([]);
  71. const dataSource = ref([]);
  72. const pagination = ref({
  73. total: 0,
  74. pageSize: 10,
  75. current: 1,
  76. })
  77. const trafficUseDialogRef = ref()
  78. const intData = async () => {
  79. const param = {
  80. current: pagination.value.current,
  81. size: pagination.value.pageSize,
  82. ...searchForm.value,
  83. }
  84. const soureName = await Getdictionary('source')
  85. const accountStatusName = await Getdictionary('account')
  86. const { data } = await cardInfoList(param)
  87. dataSource.value = (data.records || []).map((item,index) => {
  88. const payType = item.payType == 0 ? 'Prepay' : 'Postpay';
  89. // const dataPackage = item.Info.dataPackage.map(res => res.productName).join(',');
  90. const soure = soureName.find(val => val.value == item.source)?.label
  91. const accountStatus = accountStatusName.find(val => val.value == item.Info.accountStatus)?.label
  92. return {
  93. ...item,
  94. ...item.Info,
  95. payType: payType,
  96. // dataPackageName: dataPackage,
  97. sourceName: soure,
  98. accountStatus,
  99. forewarningStatus:'正常',
  100. HistoricalUsage:'10/G',
  101. poolNum:"-",
  102. SilenceEndtime:'2025-2-3',
  103. usedFlowrate:'14G',
  104. usableFlowrate:'3G',
  105. usedBg:'50MB',
  106. usableBg:'140MB',
  107. }
  108. })
  109. pagination.value.total = data.total
  110. }
  111. // 详情
  112. const handletrafficUseDialog = (data) => {
  113. trafficUseDialogRef.value.open(data)
  114. }
  115. const evChangePage = (page) => {
  116. pagination.value.current = page
  117. intData()
  118. }
  119. const handleSearch = () => {
  120. formRef.value.validate((errors) => {
  121. if (!errors) {
  122. intData()
  123. }
  124. });
  125. }
  126. // 获取字典
  127. const handleDictValue = async () => {
  128. sourceList.value = await Getdictionary('source')
  129. statusList.value = await Getdictionary('mainCardStatus')
  130. serviceList.value = await Getdictionary('activationPackageMethod')
  131. }
  132. const resetSearch = () => {
  133. proxy.$refs.formRef.resetFields()
  134. intData()
  135. }
  136. onMounted(() => {
  137. handleDictValue()
  138. intData()
  139. })
  140. </script>
  141. <style scoped lang="less">
  142. .head-title-right {
  143. .m-r-10 {
  144. margin-right: 10px;
  145. }
  146. }
  147. .search-section {
  148. margin-top: 20px;
  149. margin-bottom: 20px;
  150. }
  151. .container {
  152. .head-title {
  153. display: flex;
  154. justify-content: space-between;
  155. }
  156. .form-row {
  157. display: flex;
  158. .form-row-col {
  159. width: 25%;
  160. display: flex;
  161. align-items: center;
  162. .form-row-label {
  163. width: 120px;
  164. text-align: right;
  165. }
  166. }
  167. }
  168. }
  169. </style>