index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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')"
  9. allow-clear/>
  10. </a-form-item>
  11. <a-form-item field="label" :label="$t('flowPool.status')">
  12. <a-select v-model="value" :style="{width:'240px'}" :placeholder="$t('flowPool.flowPoolStatus')">
  13. <a-option v-for="item of trafficList" :value="item.id" :label="item.label"/>
  14. </a-select>
  15. </a-form-item>
  16. <a-form-item field="label" :label="$t('flowPool.operator')">
  17. <a-select v-model="value" :style="{width:'240px'}" :placeholder="$t('flowPool.operatorName')">
  18. <a-option v-for="item of sourceList" :value="item.id" :label="item.label"/>
  19. </a-select>
  20. </a-form-item>
  21. <a-form-item field="label" :label="$t('flowPool.start_time')">
  22. <a-date-picker style="width: 200px;" :placeholder="$t('flowPool.start_timeName')"/>
  23. </a-form-item>
  24. <a-form-item>
  25. <a-space>
  26. <a-button type="primary" @click="handleSearch">{{ $t('form.Search') }}</a-button>
  27. <a-button @click="resetSearch">{{ $t('form.Reset') }}</a-button>
  28. </a-space>
  29. </a-form-item>
  30. </a-form>
  31. </div>
  32. <div class="audit-btn">
  33. <a-button @click="dictShowModel(1, null)" type="text" v-if="role == 1">
  34. <template #icon>
  35. <icon-plus-circle/>
  36. </template>
  37. <template #default>
  38. {{ $t('form.Add') }}
  39. </template>
  40. </a-button>
  41. </div>
  42. <a-table row-key="id" :data="dataSource" :columns="columns" :pagination="pagination" :scroll="{ x: 'auto' }"
  43. @page-change="evChangePage">
  44. <template #id="{ record }">
  45. <!-- 修改 -->
  46. <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="dictShowModel(2, record)"
  47. v-if="role == 1">{{
  48. $t('form.Edit')
  49. }}</a>
  50. <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="handelForewring(record)"
  51. v-if="role == 1">预警</a>
  52. <!-- 删除 -->
  53. <a-popconfirm :content="$t('form.Delete')" :ok-text="$t('form.Confirm')"
  54. :cancel-text="$t('form.Cancel')" @ok="handleDel(record.id)">
  55. <a class="a-link" href="javascript:;" style="margin-right: 1rem" v-if="role == 1">{{
  56. $t('form.Delete')
  57. }}</a>
  58. </a-popconfirm>
  59. </template>
  60. </a-table>
  61. <add v-model:model-value="showAdd" status="1" :typeCurrent="typeCurrent" :record="record" @submit="intData()"></add>
  62. <Forewarning v-model:modelValue="visibleForewarning" :FormDataList="FormDataList" @submit="intData()"/>
  63. <a-modal v-model:visible="openExport" @ok="handleOk" @cancel="handleCancel" width="1000px">
  64. <template #title>
  65. 批量导入
  66. </template>
  67. <div class="export-box">
  68. <div class="export-box-item">
  69. <div class="box-item-title">
  70. <div class="title-icon"></div>
  71. 批量导入
  72. </div>
  73. <div class="box-item-content">
  74. <a-form :model="searchForm">
  75. <a-form-item field="label" :label="$t('flowPool.label')">
  76. <a-input v-model="searchForm.label" :placeholder="$t('lotCard.please') + $t('flowPool.label')"
  77. allow-clear/>
  78. </a-form-item>
  79. <a-form-item field="label" :label="$t('flowPool.status')">
  80. <a-select v-model="value" :style="{width:'240px'}" :placeholder="$t('flowPool.flowPoolStatus')">
  81. <a-option v-for="item of trafficList" :value="item.id" :label="item.label"/>
  82. </a-select>
  83. </a-form-item>
  84. <a-form-item field="label" :label="$t('flowPool.operator')">
  85. <a-select v-model="value" :style="{width:'240px'}" :placeholder="$t('flowPool.operatorName')">
  86. <a-option v-for="item of sourceList" :value="item.id" :label="item.label"/>
  87. </a-select>
  88. </a-form-item>
  89. <a-form-item field="label" :label="$t('flowPool.start_time')">
  90. <a-date-picker style="width: 200px;" :placeholder="$t('flowPool.start_timeName')"/>
  91. </a-form-item>
  92. </a-form>
  93. </div>
  94. </div>
  95. <div class="export-box-item" style="margin-top:20px;">
  96. <div class="box-item-title">
  97. <div class="title-icon"></div>
  98. 导入结果
  99. </div>
  100. <div class="box-item-content">
  101. <a-table :columns="columnsExport" :data="dataExport" :pagination="paginationCard" :scroll="{ x: 'auto' }"
  102. @page-change="evChangePageCard">
  103. <template #operate="{ record }">
  104. <a-button @click="openContract(record)" type="text">下载</a-button>
  105. </template>
  106. <template #status="{ record }">
  107. <div class="export-status" v-if="record.status == 1">
  108. <div class="status-icon" style="background: rgba(82, 196, 27, 1);"></div>
  109. 导入成功
  110. </div>
  111. <div class="export-status" v-if="record.status == 2">
  112. <div class="status-icon" style="background: rgba(250, 173, 20, 1);"></div>
  113. 部分成功
  114. </div>
  115. <div class="export-status" v-if="record.status == 3">
  116. <div class="status-icon" style="background: rgba(247, 66, 75, 1);"></div>
  117. 校验失败
  118. </div>
  119. </template>
  120. </a-table>
  121. </div>
  122. </div>
  123. </div>
  124. </a-modal>
  125. </div>
  126. </template>
  127. <script setup>
  128. import {onMounted, ref, reactive, getCurrentInstance, nextTick, watch, toRefs} from "vue";
  129. import {columns} from "./config";
  130. import {Message, Notification} from '@arco-design/web-vue'
  131. import {
  132. deleteTrafficPool,
  133. lotCatdList,
  134. } from "@/api/path/flowPool.api"
  135. import {useSystemStore} from "@/store/modules/systemStore"
  136. import Forewarning from "./forewarning.vue";
  137. import add from './add.vue'
  138. const systemStore = useSystemStore()
  139. const state = ref({
  140. role: systemStore.getRole,
  141. formRef: null,
  142. searchForm: {
  143. "label": "",
  144. "trafficPoolType": "1"
  145. },
  146. pagination: {
  147. total: 0,
  148. pageSize: 10,
  149. current: 1,
  150. },
  151. paginationCard: {
  152. total: 0,
  153. pageSize: 10,
  154. current: 1,
  155. },
  156. sourceList: [],
  157. trafficList: [],
  158. typeList: [],
  159. tariffIdList: [],
  160. openExport: false,
  161. dataExport: [],
  162. visibleForewarning:false,
  163. showAdd:false,
  164. typeCurrent:1,
  165. record:{},
  166. dataSource:[],
  167. FormDataList:{}
  168. })
  169. const {
  170. role,
  171. searchForm,
  172. pagination,
  173. paginationCard,
  174. typeCurrent,
  175. sourceList,
  176. trafficList,
  177. openExport,
  178. dataExport,
  179. visibleForewarning,
  180. showAdd,
  181. record,
  182. dataSource,
  183. FormDataList
  184. } = toRefs(state.value)
  185. const {proxy} = getCurrentInstance()
  186. const columnsExport = [
  187. {title: '序号', dataIndex: 'index', align: 'center', render: ({rowIndex}) => rowIndex + 1},
  188. {
  189. title: '操作人',
  190. dataIndex: 'name',
  191. },
  192. {
  193. title: '导入时间',
  194. dataIndex: 'exportTime',
  195. },
  196. {
  197. title: '完成时间',
  198. dataIndex: 'successTime',
  199. },
  200. {
  201. title: '状态',
  202. slotName: 'status',
  203. align: 'center'
  204. },
  205. {title: '操作', slotName: 'operate', align: 'center'},
  206. ];
  207. const intData = async () => {
  208. const param = {
  209. current: pagination.value.current,
  210. size: pagination.value.pageSize,
  211. ...searchForm.value,
  212. type: 1
  213. }
  214. const {data} = await lotCatdList(param)
  215. dataSource.value = (data.records || []).map((item, index) => {
  216. // const trafficPoolType = typeList.value.find(val => val.value == item.trafficPoolType)?.label
  217. const trafficPoolStatus = trafficList.value.find(val => val.value == item.status)?.label
  218. const sourceName = sourceList.value.find(val => val.value == item.source)?.label
  219. const Activated = 0 + '/' + item.iccids?.length
  220. const HaveBeenUsed = 0 + '/' + item.size + item.sizeType
  221. return {
  222. ...item,
  223. sourceName,// 运营商名称
  224. trafficPoolStatus,
  225. Activated: Activated,
  226. HaveBeenUsed: HaveBeenUsed,
  227. }
  228. })
  229. pagination.value.total = data.total
  230. }
  231. // 删除
  232. const handleDel = async (id) => {
  233. const {code} = await deleteTrafficPool({id})
  234. if (code == 200) {
  235. Message.success({
  236. content: "删除成功!",
  237. duration: 2000,
  238. })
  239. intData()
  240. }
  241. };
  242. const evChangePage = (page) => {
  243. pagination.value.current = page
  244. intData()
  245. }
  246. // 卡信息
  247. const evChangePageCard = (page) => {
  248. paginationCard.value.current = page
  249. intData()
  250. }
  251. const handleSearch = () => {
  252. intData()
  253. }
  254. const resetSearch = () => {
  255. searchForm.value.label = ''
  256. intData()
  257. }
  258. // 弹框
  259. const dictShowModel = (type, data) => {
  260. typeCurrent.value = type
  261. record.value = data
  262. showAdd.value = true
  263. }
  264. const handelForewring = (item)=>{
  265. FormDataList.value = item
  266. visibleForewarning.value = true
  267. }
  268. onMounted(async () => {
  269. await intData()
  270. })
  271. </script>
  272. <style scoped lang="less">
  273. .m-r-10 {
  274. margin-right: 10px;
  275. }
  276. .head-title-right {
  277. }
  278. .search-section {
  279. margin-top: 20px;
  280. margin-bottom: 20px;
  281. }
  282. .container {
  283. .head-title {
  284. display: flex;
  285. justify-content: space-between;
  286. }
  287. .form-row {
  288. display: flex;
  289. .form-row-col {
  290. width: 25%;
  291. display: flex;
  292. align-items: center;
  293. .form-row-label {
  294. width: 120px;
  295. text-align: right;
  296. }
  297. }
  298. }
  299. }
  300. silent-expire-alarm {
  301. padding: 20px !important;
  302. // background: #fcf;
  303. }
  304. .search-section {
  305. margin-bottom: 20px;
  306. }
  307. .audit-btn {
  308. margin-bottom: 10px;
  309. }
  310. .echarts-box {
  311. // width: 100%;
  312. display: flex;
  313. justify-content: center;
  314. overflow: hidden;
  315. .chart-dom {
  316. width: 700px !important;
  317. height: 400px !important;
  318. }
  319. }
  320. .form-item-space-item {
  321. background-color: #f2f3f5;
  322. display: flex;
  323. align-items: center;
  324. font-size: 14px;
  325. }
  326. .export-box {
  327. .export-box-item {
  328. .box-item-title {
  329. display: flex;
  330. align-items: center;
  331. font-family: PingFang SC;
  332. font-size: 16px;
  333. font-weight: 600;
  334. line-height: 24px;
  335. color: rgba(0, 0, 0, 0.85);
  336. margin-bottom: 10px;
  337. .title-icon {
  338. margin-right: 10px;
  339. width: 4px;
  340. height: 16px;
  341. background: #1B5DF8;
  342. }
  343. }
  344. .box-item-content {
  345. .item-txt {
  346. display: flex;
  347. align-items: center;
  348. margin-bottom: 10px;
  349. .item-txt-title {
  350. width: 300px;
  351. text-align: right;
  352. margin-right: 10px;
  353. }
  354. .item-txt-text {
  355. font-family: PingFang SC;
  356. font-size: 14px;
  357. font-weight: 400;
  358. line-height: 22px;
  359. text-align: left;
  360. color: #1B5DF8;
  361. }
  362. }
  363. .export-status {
  364. font-family: PingFang SC;
  365. font-size: 14px;
  366. font-weight: 400;
  367. line-height: 22px;
  368. text-align: left;
  369. color: rgba(51, 51, 51, 1);
  370. display: flex;
  371. align-items: center;
  372. .status-icon {
  373. width: 6px;
  374. height: 6px;
  375. border-radius: 50%;
  376. margin-right: 10px;
  377. }
  378. }
  379. }
  380. }
  381. }
  382. </style>