index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <div class="overflow-alarm">
  3. <!-- 搜索条件区 -->
  4. <div class="search-section">
  5. <a-form :model="searchForm" layout="inline">
  6. <a-form-item field="iccid" label="ICCID">
  7. <a-input v-model="searchForm.iccid" placeholder="请输入ICCID" allow-clear />
  8. </a-form-item>
  9. <a-form-item field="cardNumber" label="卡号">
  10. <a-input v-model="searchForm.cardNumber" placeholder="请输入卡号" allow-clear />
  11. </a-form-item>
  12. <a-form-item field="usageStatus" label="使用状态">
  13. <a-select
  14. v-model="searchForm.usageStatus"
  15. placeholder="请选择使用状态"
  16. allow-clear
  17. style="width: 160px"
  18. >
  19. <a-option v-for="status in usageStatusOptions" :key="status.value" :value="status.value">
  20. {{ status.label }}
  21. </a-option>
  22. </a-select>
  23. </a-form-item>
  24. <a-form-item field="channel" label="通道">
  25. <a-select
  26. v-model="searchForm.channel"
  27. placeholder="请选择通道"
  28. allow-clear
  29. style="width: 160px"
  30. >
  31. <a-option v-for="channel in channelOptions" :key="channel.value" :value="channel.value">
  32. {{ channel.label }}
  33. </a-option>
  34. </a-select>
  35. </a-form-item>
  36. <a-form-item>
  37. <a-space>
  38. <a-button type="primary" @click="handleSearch">搜索</a-button>
  39. <a-button @click="resetSearch">重置</a-button>
  40. </a-space>
  41. </a-form-item>
  42. </a-form>
  43. </div>
  44. <!-- 数据表格 -->
  45. <a-table :columns="columns" :data="tableData" :pagination="pagination" :scroll="{ x: '100%', y: '400px' }">
  46. <template #usageStatus="{ record }">
  47. <a-tag :color="getStatusColor(record.usageStatus)">{{ record.usageStatus }}</a-tag>
  48. </template>
  49. </a-table>
  50. </div>
  51. </template>
  52. <script setup>
  53. import { ref, reactive } from 'vue';
  54. import { Message } from '@arco-design/web-vue';
  55. const searchForm = reactive({
  56. iccid: '',
  57. cardNumber: '',
  58. usageStatus: '',
  59. channel: '',
  60. });
  61. const usageStatusOptions = [
  62. { label: '正常', value: 'normal' },
  63. { label: '停机', value: 'suspended' },
  64. ];
  65. const channelOptions = [
  66. { label: '通道1', value: 'channel1' },
  67. { label: '通道2', value: 'channel2' },
  68. ];
  69. const columns = [
  70. { title: 'ICCID', dataIndex: 'iccid' },
  71. { title: '卡号', dataIndex: 'cardNumber' },
  72. { title: '使用状态', slotName: 'usageStatus' },
  73. { title: '通道', dataIndex: 'channel' },
  74. { title: '到期日期', dataIndex: 'expirationDate' },
  75. { title: '客户名称', dataIndex: 'customerName' },
  76. { title: '套餐已用量', dataIndex: 'usedData' },
  77. { title: '本月月量', dataIndex: 'monthlyData' },
  78. { title: '超套用量', dataIndex: 'overUsage' },
  79. { title: '资费合计', dataIndex: 'totalCost' },
  80. ];
  81. const tableData = ref([]);
  82. const pagination = reactive({
  83. total: 100,
  84. current: 1,
  85. pageSize: 10,
  86. });
  87. const getStatusColor = (status) => {
  88. const colorMap = {
  89. '正常': 'green',
  90. '停机': 'red',
  91. };
  92. return colorMap[status] || 'blue';
  93. };
  94. const handleSearch = () => {
  95. console.log('Search form data:', searchForm);
  96. Message.success('执行搜索操作');
  97. };
  98. const resetSearch = () => {
  99. Object.keys(searchForm).forEach(key => {
  100. searchForm[key] = '';
  101. });
  102. Message.success('搜索条件已重置');
  103. };
  104. </script>
  105. <style scoped>
  106. .overflow-alarm {
  107. padding: 20px;
  108. }
  109. .search-section {
  110. margin-top: 20px;
  111. margin-bottom: 20px;
  112. }
  113. .arco-table-th {
  114. white-space: nowrap;
  115. }
  116. </style>