index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <!-- 流量池 -->
  2. <template>
  3. <div class="container">
  4. <!-- 搜索条件区 -->
  5. <div class="search-section">
  6. <a-form :model="searchForm" layout="inline">
  7. <a-form-item field="label" :label="$t('flowPool.label')">
  8. <a-input v-model="searchForm.label" :placeholder="$t('lotCard.please') + $t('flowPool.label')" allow-clear />
  9. </a-form-item>
  10. <a-form-item field="label" :label="$t('flowPool.status')">
  11. <a-select v-model="value" :style="{ width: '240px' }" :placeholder="$t('flowPool.flowPoolStatus')">
  12. <a-option v-for="item of trafficList" :value="item.id" :label="item.label" />
  13. </a-select>
  14. </a-form-item>
  15. <a-form-item field="label" :label="$t('flowPool.operator')">
  16. <a-select v-model="value" :style="{ width: '240px' }" :placeholder="$t('flowPool.operatorName')">
  17. <a-option v-for="item of sourceList" :value="item.id" :label="item.label" />
  18. </a-select>
  19. </a-form-item>
  20. <a-form-item field="label" :label="$t('flowPool.start_time')">
  21. <a-date-picker style="width: 200px;" :placeholder="$t('flowPool.start_timeName')" />
  22. </a-form-item>
  23. <a-form-item>
  24. <a-space>
  25. <a-button type="primary" @click="handleSearch">{{ $t('form.Search') }}</a-button>
  26. <a-button @click="resetSearch">{{ $t('form.Reset') }}</a-button>
  27. </a-space>
  28. </a-form-item>
  29. </a-form>
  30. </div>
  31. <div class="audit-btn">
  32. <a-button @click="dictShowModel(1, null)" type="text" v-if="role == 1">
  33. <template #icon>
  34. <icon-plus-circle />
  35. </template>
  36. <template #default>
  37. {{ $t('form.Add') }}
  38. </template>
  39. </a-button>
  40. </div>
  41. <a-table row-key="id" :data="dataSource" :columns="columns" :pagination="pagination" :scroll="{ x: 'auto' }"
  42. @page-change="evChangePage">
  43. <template #id="{ record }">
  44. <!-- 修改 -->
  45. <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="dictShowModel(2, record)"
  46. v-if="role == 1">{{
  47. $t('form.Edit')
  48. }}</a>
  49. <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="handelForewring(record)"
  50. v-if="role == 1">预警</a>
  51. <!-- 删除 -->
  52. <a-popconfirm :content="$t('form.Delete')" :ok-text="$t('form.Confirm')" :cancel-text="$t('form.Cancel')"
  53. @ok="handleDel(record.id)">
  54. <a class="a-link" href="javascript:;" style="margin-right: 1rem" v-if="role == 1">{{
  55. $t('form.Delete')
  56. }}</a>
  57. </a-popconfirm>
  58. </template>
  59. </a-table>
  60. <add v-model:model-value="showAdd" status="1" :typeCurrent="typeCurrent" :record="record" @submit="intData()"></add>
  61. <Forewarning v-model:modelValue="visibleForewarning" :FormDataList="FormDataList" @submit="intData()" />
  62. <openExport v-model:model-value="ShowOpenExport" />
  63. </div>
  64. </template>
  65. <script setup>
  66. import { onMounted, ref, getCurrentInstance, nextTick, watch, toRefs } from "vue";
  67. import { columns } from "./config";
  68. import { Message } from '@arco-design/web-vue'
  69. import {
  70. deleteTrafficPool,
  71. lotCatdList,
  72. } from "@/api/path/flowPool.api"
  73. import { useSystemStore } from "@/store/modules/systemStore"
  74. import {Getdictionary} from '@/mixins/index.js'
  75. import Forewarning from "./components/forewarning.vue";
  76. import add from './components/add.vue'
  77. import openExport from "./components/openExport.vue"
  78. const systemStore = useSystemStore()
  79. const state = ref({
  80. role: systemStore.getRole,
  81. formRef: null,
  82. searchForm: {
  83. "label": "",
  84. "trafficPoolType": "1"
  85. },
  86. pagination: {
  87. total: 0,
  88. pageSize: 10,
  89. current: 1,
  90. },
  91. sourceList: [],
  92. trafficList: [],
  93. typeList: [],
  94. tariffIdList: [],
  95. ShowOpenExport: false,
  96. visibleForewarning: false,
  97. showAdd: false,
  98. typeCurrent: 1,
  99. record: {},
  100. dataSource: [],
  101. FormDataList: {}
  102. })
  103. const {
  104. role,
  105. searchForm,
  106. pagination,
  107. typeCurrent,
  108. sourceList,
  109. trafficList,
  110. ShowOpenExport,
  111. visibleForewarning,
  112. showAdd,
  113. record,
  114. dataSource,
  115. FormDataList
  116. } = toRefs(state.value)
  117. const { proxy } = getCurrentInstance()
  118. const intData = async () => {
  119. const param = {
  120. current: pagination.value.current,
  121. size: pagination.value.pageSize,
  122. ...searchForm.value,
  123. type: 1
  124. }
  125. const { data } = await lotCatdList(param)
  126. dataSource.value = (data.records || []).map((item, index) => {
  127. // const trafficPoolType = typeList.value.find(val => val.value == item.trafficPoolType)?.label
  128. const trafficPoolStatus = trafficList.value.find(val => val.value == item.status)?.label
  129. const sourceName = sourceList.value.find(val => val.value == item.source)?.label
  130. const Activated = 0 + '/' + item.iccids?.length
  131. const HaveBeenUsed = 0 + '/' + item.size + item.sizeType
  132. return {
  133. ...item,
  134. sourceName,// 运营商名称
  135. trafficPoolStatus,
  136. Activated: Activated,
  137. HaveBeenUsed: HaveBeenUsed,
  138. }
  139. })
  140. pagination.value.total = data.total
  141. }
  142. // 删除
  143. const handleDel = async (id) => {
  144. const { code } = await deleteTrafficPool({ id })
  145. if (code == 200) {
  146. Message.success({
  147. content: "删除成功!",
  148. duration: 2000,
  149. })
  150. intData()
  151. }
  152. };
  153. const evChangePage = (page) => {
  154. pagination.value.current = page
  155. intData()
  156. }
  157. const handleSearch = () => {
  158. intData()
  159. }
  160. const resetSearch = () => {
  161. searchForm.value.label = ''
  162. intData()
  163. }
  164. // 弹框
  165. const dictShowModel = (type, data) => {
  166. typeCurrent.value = type
  167. record.value = data
  168. showAdd.value = true
  169. }
  170. const handelForewring = (item) => {
  171. FormDataList.value = item
  172. visibleForewarning.value = true
  173. }
  174. const handleDictValue = async () => {
  175. sourceList.value = await Getdictionary('source')
  176. trafficList.value = await Getdictionary('trafficPacketStatus')
  177. }
  178. onMounted(async () => {
  179. await handleDictValue()
  180. await intData()
  181. })
  182. </script>
  183. <style scoped lang="less">
  184. .m-r-10 {
  185. margin-right: 10px;
  186. }
  187. .search-section {
  188. margin-top: 20px;
  189. margin-bottom: 20px;
  190. }
  191. .container {
  192. .head-title {
  193. display: flex;
  194. justify-content: space-between;
  195. }
  196. .form-row {
  197. display: flex;
  198. .form-row-col {
  199. width: 25%;
  200. display: flex;
  201. align-items: center;
  202. .form-row-label {
  203. width: 120px;
  204. text-align: right;
  205. }
  206. }
  207. }
  208. }
  209. silent-expire-alarm {
  210. padding: 20px !important;
  211. // background: #fcf;
  212. }
  213. .search-section {
  214. margin-bottom: 20px;
  215. }
  216. .audit-btn {
  217. margin-bottom: 10px;
  218. }
  219. </style>