index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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 soure = soureName.find(val => val.value == item.source)?.label
  90. // const accountStatus = accountStatusName.find(val => val.value == item.Info.accountStatus)?.label
  91. const iccidStatus = accountStatusName.find(val => val.value == item.iccidStatus)?.label
  92. return {
  93. ...item,
  94. ...item.Info,
  95. payType: payType,
  96. sourceName: soure,
  97. iccidStatus,
  98. forewarningStatus:'正常',
  99. HistoricalUsage:'10/G',
  100. SilenceEndtime:'一个月',
  101. usedBg:'0',
  102. usableBg:'0',
  103. ...item.dataPackage[0]
  104. }
  105. })
  106. pagination.value.total = data.total
  107. }
  108. // 详情
  109. const handletrafficUseDialog = (data) => {
  110. trafficUseDialogRef.value.open(data)
  111. }
  112. const evChangePage = (page) => {
  113. pagination.value.current = page
  114. intData()
  115. }
  116. const handleSearch = () => {
  117. formRef.value.validate((errors) => {
  118. if (!errors) {
  119. intData()
  120. }
  121. });
  122. }
  123. // 获取字典
  124. const handleDictValue = async () => {
  125. sourceList.value = await Getdictionary('source')
  126. statusList.value = await Getdictionary('mainCardStatus')
  127. serviceList.value = await Getdictionary('activationPackageMethod')
  128. }
  129. const resetSearch = () => {
  130. proxy.$refs.formRef.resetFields()
  131. intData()
  132. }
  133. onMounted(() => {
  134. handleDictValue()
  135. intData()
  136. })
  137. </script>
  138. <style scoped lang="less">
  139. .head-title-right {
  140. .m-r-10 {
  141. margin-right: 10px;
  142. }
  143. }
  144. .search-section {
  145. margin-top: 20px;
  146. margin-bottom: 20px;
  147. }
  148. .container {
  149. .head-title {
  150. display: flex;
  151. justify-content: space-between;
  152. }
  153. .form-row {
  154. display: flex;
  155. .form-row-col {
  156. width: 25%;
  157. display: flex;
  158. align-items: center;
  159. .form-row-label {
  160. width: 120px;
  161. text-align: right;
  162. }
  163. }
  164. }
  165. }
  166. </style>