index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <!-- 后流量池 -->
  2. <template>
  3. <div class="container">
  4. <!-- 搜索条件区 -->
  5. <div class="search-section">
  6. <Search :SearchForm="SearchFormList" @query="intData" @reset="reset"></Search>
  7. </div>
  8. <div class="audit-btn">
  9. <a-button @click="dictShowModel(1, null)" type="text" v-if="role == 1">
  10. <template #icon>
  11. <icon-plus-circle />
  12. </template>
  13. <template #default>
  14. {{ $t("form.Add") }}
  15. </template>
  16. </a-button>
  17. </div>
  18. <a-table row-key="id" :data="dataSource" :columns="columnsAfter" :pagination="pagination" :scroll="{ x: 'auto' }"
  19. @page-change="evChangePage">
  20. <template #id="{ record }">
  21. <!-- 修改 -->
  22. <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="dictShowModel(2, record)"
  23. v-if="role == 1">{{ $t("form.Edit") }}</a>
  24. <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="handelForewring(record)"
  25. v-if="role == 1">{{ $t('flowPool.Waring') }}</a>
  26. <!-- <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="handelgetCard(record)">导卡</a> -->
  27. <!-- 删除 -->
  28. <a-popconfirm :content="$t('form.Delete')" :ok-text="$t('form.Confirm')" :cancel-text="$t('form.Cancel')"
  29. @ok="handleDel(record.id)" v-if="role == 1">
  30. <a class="a-link" href="javascript:;" style="margin-right: 1rem">{{
  31. $t("form.Delete")
  32. }}</a>
  33. </a-popconfirm>
  34. </template>
  35. <template #status="{ record }">
  36. <a-tag :color="record.status == 1 ? '#00b42a' : '#f53f3f'">{{ trafficList.find(val => val.value ==
  37. record.status)?.label }}</a-tag>
  38. </template>
  39. </a-table>
  40. <add v-model:modelValue="showAdd" status="2" :typeCurrent="typeCurrent" :record="record" @submit="intData()"></add>
  41. <Forewarning v-model:modelValue="visibleForewarning" ref="forewarning" @submit="intData()" />
  42. <GuideCard v-model:model-value="ShowOpenExport" />
  43. </div>
  44. </template>
  45. <script setup>
  46. import { onMounted, reactive, toRefs } from "vue";
  47. import { columnsAfter, SearchFormList } from "../config";
  48. import { Message } from "@arco-design/web-vue";
  49. import { deleteTrafficPool, lotCatdList } from "@/api/path/flowPool.api";
  50. import { useSystemStore } from "@/store/modules/systemStore";
  51. import add from "../components/add.vue";
  52. import Forewarning from "../components/forewarning.vue";
  53. import { Getdictionary } from "@/mixins/index.js";
  54. import { useI18n } from 'vue-i18n'
  55. import Search from '@/components/Search/index.vue'
  56. import GuideCard from '../components/GuideCard.vue'
  57. const { t } = useI18n();
  58. const systemStore = useSystemStore();
  59. const state = reactive({
  60. dataSource: [],
  61. pagination: {
  62. total: 0,
  63. pageSize: 10,
  64. current: 1,
  65. },
  66. searchForm: {},
  67. role: systemStore.getRole,
  68. typeCurrent: 1,
  69. visibleForewarning: false,
  70. record: {},
  71. sourceList: [],
  72. trafficList: [],
  73. showAdd: false,
  74. forewarning: null,
  75. ShowOpenExport: false
  76. });
  77. const {
  78. dataSource,
  79. pagination,
  80. searchForm,
  81. role,
  82. typeCurrent,
  83. visibleForewarning,
  84. record,
  85. sourceList,
  86. trafficList,
  87. showAdd,
  88. forewarning,
  89. ShowOpenExport
  90. } = toRefs(state);
  91. const intData = async (item) => {
  92. if (item) {
  93. searchForm.value = item
  94. }
  95. const param = {
  96. current: pagination.value.current,
  97. size: pagination.value.pageSize,
  98. ...searchForm.value,
  99. trafficPoolType: "2",
  100. };
  101. const { data } = await lotCatdList(param);
  102. dataSource.value = (data.records || []).map((item, index) => {
  103. const trafficPoolStatus = trafficList.value.find(
  104. (val) => val.value == item.status
  105. )?.label;
  106. const sourceName = sourceList.value.find(
  107. (val) => val.value == item.source
  108. )?.label;
  109. const Activated = item.cardAct + "/" + item.iccids?.length;
  110. const HaveBeenUsed = item.size + item.sizeType;
  111. // 换算Gb
  112. const afterFirstConversion = item.dataUsage / 1024
  113. const afterSecondConversion = afterFirstConversion / 1024;
  114. const result = Math.ceil(afterSecondConversion * 100) / 100;
  115. const dataUsage = result.toFixed(2);
  116. return {
  117. ...item,
  118. sourceName, // 运营商名称
  119. Activated: Activated,
  120. HaveBeenUsed: HaveBeenUsed,
  121. trafficPoolStatus,
  122. size: item.size + '/' + item.sizeType,
  123. dataUsage
  124. };
  125. });
  126. pagination.value.total = data.total;
  127. };
  128. // 删除
  129. const handleDel = async (id) => {
  130. const { code } = await deleteTrafficPool({ id });
  131. if (code == 200) {
  132. Message.success({
  133. content: t('setting.deleteSuccess'),
  134. duration: 2000,
  135. });
  136. intData();
  137. }
  138. };
  139. const evChangePage = (page) => {
  140. pagination.value.current = page;
  141. intData();
  142. };
  143. const reset = (item) => {
  144. searchForm.value = item
  145. pagination.value.current = 1
  146. intData()
  147. }
  148. // 弹框
  149. const dictShowModel = (type, data) => {
  150. typeCurrent.value = type;
  151. record.value = data;
  152. showAdd.value = true;
  153. };
  154. const handelForewring = (item) => {
  155. forewarning.value.detaile(item)
  156. visibleForewarning.value = true;
  157. };
  158. const handleDictValue = async () => {
  159. sourceList.value = await Getdictionary("source");
  160. trafficList.value = await Getdictionary("trafficPacketStatus");
  161. };
  162. const handelgetCard = (item) => {
  163. ShowOpenExport.value = true;
  164. }
  165. onMounted(async () => {
  166. await handleDictValue();
  167. await intData();
  168. });
  169. </script>
  170. <style scoped lang="less">
  171. .search-section {
  172. margin-top: 20px;
  173. margin-bottom: 20px;
  174. }
  175. .container {
  176. .head-title {
  177. display: flex;
  178. justify-content: space-between;
  179. }
  180. .form-row {
  181. display: flex;
  182. .form-row-col {
  183. width: 25%;
  184. display: flex;
  185. align-items: center;
  186. .form-row-label {
  187. width: 120px;
  188. text-align: right;
  189. }
  190. }
  191. }
  192. }
  193. silent-expire-alarm {
  194. padding: 20px !important;
  195. // background: #fcf;
  196. }
  197. .search-section {
  198. margin-bottom: 20px;
  199. }
  200. .audit-btn {
  201. margin-bottom: 10px;
  202. }
  203. .echarts-box {
  204. // width: 100%;
  205. display: flex;
  206. justify-content: center;
  207. overflow: hidden;
  208. .chart-dom {
  209. width: 700px !important;
  210. height: 400px !important;
  211. }
  212. }
  213. .form-item-space-item {
  214. background-color: #f2f3f5;
  215. display: flex;
  216. align-items: center;
  217. font-size: 14px;
  218. }
  219. .form-pool-tit {
  220. display: flex;
  221. align-items: center;
  222. margin-bottom: 10px;
  223. .pool-icon {
  224. margin-right: 10px;
  225. width: 4px;
  226. height: 16px;
  227. background: #1b5df8;
  228. font-size: 14px;
  229. color: #6c6e70;
  230. font-family: PingFang SC;
  231. }
  232. }
  233. .export-box {
  234. .export-box-item {
  235. .box-item-title {
  236. display: flex;
  237. align-items: center;
  238. font-family: PingFang SC;
  239. font-size: 16px;
  240. font-weight: 600;
  241. line-height: 24px;
  242. color: rgba(0, 0, 0, 0.85);
  243. margin-bottom: 10px;
  244. .title-icon {
  245. margin-right: 10px;
  246. width: 4px;
  247. height: 16px;
  248. background: #1b5df8;
  249. }
  250. }
  251. .box-item-content {
  252. .item-txt {
  253. display: flex;
  254. align-items: center;
  255. margin-bottom: 10px;
  256. .item-txt-title {
  257. width: 300px;
  258. text-align: right;
  259. margin-right: 10px;
  260. }
  261. .item-txt-text {
  262. font-family: PingFang SC;
  263. font-size: 14px;
  264. font-weight: 400;
  265. line-height: 22px;
  266. text-align: left;
  267. color: #1b5df8;
  268. }
  269. }
  270. .export-status {
  271. font-family: PingFang SC;
  272. font-size: 14px;
  273. font-weight: 400;
  274. line-height: 22px;
  275. text-align: left;
  276. color: rgba(51, 51, 51, 1);
  277. display: flex;
  278. align-items: center;
  279. .status-icon {
  280. width: 6px;
  281. height: 6px;
  282. border-radius: 50%;
  283. margin-right: 10px;
  284. }
  285. }
  286. }
  287. }
  288. }
  289. </style>