index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. <!-- <div class="top-actions">
  39. <a-space>
  40. <a-button type="primary" @click="showAdd=true">{{ $t('form.Add') }}</a-button>
  41. </a-space>
  42. </div> -->
  43. <a-table row-key="iccid" :data="dataSource" :columns="columns" :pagination="pagination" :scroll="{ x: 'auto' }"
  44. @page-change="evChangePage">
  45. <template #poolNum="{ record }">
  46. <span>{{ record.poolName }}</span>
  47. <br />
  48. <span>{{ record.poolId }}</span>
  49. </template>
  50. <template #dataUsageTotal="{ record }">
  51. <span>{{ record.dataUsageTotal }}MB</span>
  52. </template>
  53. <template #id="{ record }">
  54. <!-- 查看流量消耗 -->
  55. <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="handletrafficUseDialog(record)">详情</a>
  56. </template>
  57. </a-table>
  58. <!-- 查看流量消耗 -->
  59. <trafficUseDialog ref="trafficUseDialogRef" @submit="intData()" />
  60. <Add v-model="showAdd"></Add>
  61. </div>
  62. </template>
  63. <script setup>
  64. import { onMounted, ref, getCurrentInstance, h } from "vue";
  65. import { columns } from "./config";
  66. import { cardInfoList } from "@/api/path/lotCard.api"
  67. import trafficUseDialog from "./trafficUseDialog.vue";
  68. import { Getdictionary } from '@/mixins/index.js'
  69. import Add from './add.vue'
  70. const { proxy } = getCurrentInstance()
  71. import {useI18n} from 'vue-i18n'
  72. const {t} = useI18n();
  73. const formRef = ref()
  74. const searchForm = ref({
  75. "iccid": "",
  76. });
  77. const statusList = ref([]);
  78. const sourceList = ref([]);
  79. const serviceList = ref([]);
  80. const dataSource = ref([]);
  81. const pagination = ref({
  82. total: 0,
  83. pageSize: 10,
  84. current: 1,
  85. })
  86. const showAdd = ref(false)
  87. const trafficUseDialogRef = ref()
  88. const intData = async () => {
  89. const param = {
  90. current: pagination.value.current,
  91. size: pagination.value.pageSize,
  92. ...searchForm.value,
  93. }
  94. const soureName = await Getdictionary('source')
  95. const accountStatusName = await Getdictionary('account')
  96. const { data } = await cardInfoList(param)
  97. dataSource.value = (data.records || []).map((item, index) => {
  98. const payType = item.payType == 0 ? 'Prepay' : 'Postpay';
  99. const soure = soureName.find(val => val.value == item.source)?.label
  100. const iccidStatus = accountStatusName.find(val => val.value == item.iccidStatus)?.label
  101. return {
  102. ...item,
  103. ...item.Info,
  104. payType: payType,
  105. sourceName: soure,
  106. iccidStatus,
  107. forewarningStatus: '正常',
  108. SilenceEndtime: '一个月',
  109. usedBg: '0',
  110. usableBg: '0',
  111. dataUsage: item.dataPackage[0]?.dataUsage + '/MB',
  112. dataTotal: item.dataPackage[0]?.dataTotal + '/MB',
  113. }
  114. })
  115. pagination.value.total = data.total
  116. }
  117. // 详情
  118. const handletrafficUseDialog = (data) => {
  119. trafficUseDialogRef.value.open(data)
  120. }
  121. const evChangePage = (page) => {
  122. pagination.value.current = page
  123. intData()
  124. }
  125. const handleSearch = () => {
  126. formRef.value.validate((errors) => {
  127. if (!errors) {
  128. intData()
  129. }
  130. });
  131. }
  132. // 获取字典
  133. const handleDictValue = async () => {
  134. sourceList.value = await Getdictionary('source')
  135. statusList.value = await Getdictionary('mainCardStatus')
  136. serviceList.value = await Getdictionary('activationPackageMethod')
  137. }
  138. const resetSearch = () => {
  139. proxy.$refs.formRef.resetFields()
  140. intData()
  141. }
  142. onMounted(() => {
  143. handleDictValue()
  144. intData()
  145. })
  146. </script>
  147. <style scoped lang="less">
  148. .head-title-right {
  149. .m-r-10 {
  150. margin-right: 10px;
  151. }
  152. }
  153. .search-section {
  154. margin-top: 20px;
  155. margin-bottom: 20px;
  156. }
  157. .top-actions {
  158. margin-bottom: 20px;
  159. }
  160. .container {
  161. .head-title {
  162. display: flex;
  163. justify-content: space-between;
  164. }
  165. .form-row {
  166. display: flex;
  167. .form-row-col {
  168. width: 25%;
  169. display: flex;
  170. align-items: center;
  171. .form-row-label {
  172. width: 120px;
  173. text-align: right;
  174. }
  175. }
  176. }
  177. }
  178. </style>