index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div class="home_count">
  3. <div class="warning-title">
  4. <div>报警管理</div>
  5. <a-button type="link" @click="leaveFor('/motoring/report')">更多</a-button>
  6. </div>
  7. <a-table :columns="columns" :data-source="dataSource" size="small" :pagination="false" :scroll="{ y: 260 }">
  8. <template #bodyCell="{ column, record }">
  9. <template v-if="column.dataIndex === 'state'">
  10. <span>
  11. <a-tag :color="record.state == '1' ? '#cd201f' : record.state == '2' ? '#2db7f5' : '#87d068'">
  12. {{ record.stateVlaue }}
  13. </a-tag>
  14. </span>
  15. </template>
  16. <template v-if="column.dataIndex === 'action'">
  17. <a-button type="link" size="small">编辑</a-button>
  18. <a-divider type="vertical" />
  19. <a-popconfirm title="删除此数据?" @confirm="deleteData(record)">
  20. <a-button type="link" danger size="small">删除</a-button>
  21. </a-popconfirm>
  22. <a-divider type="vertical" />
  23. <a-button type="link" size="small">记录</a-button>
  24. </template>
  25. </template>
  26. </a-table>
  27. </div>
  28. </template>
  29. <script setup name="SysWarningCard">
  30. import bizIndexApi from '@/api/biz/bizIndexApi'
  31. import router from '@/router'
  32. const columns = [
  33. {
  34. title: '时间',
  35. dataIndex: 'createTime',
  36. ellipsis: true
  37. },
  38. {
  39. title: '名称',
  40. dataIndex: 'title',
  41. ellipsis: true
  42. },
  43. {
  44. title: '报警原因',
  45. dataIndex: 'reason',
  46. ellipsis: true
  47. },
  48. {
  49. title: '状态',
  50. dataIndex: 'state',
  51. ellipsis: true
  52. },
  53. {
  54. title: '操作',
  55. dataIndex: 'action',
  56. align: 'center',
  57. width: '200px'
  58. }
  59. ]
  60. const dataSource = ref([
  61. {
  62. createTime: '2024-09-28 07:03:24',
  63. title: 'ABSL-1超低温冰箱',
  64. reason: '温度异常',
  65. state: '1',
  66. stateVlaue: '异常'
  67. },
  68. {
  69. createTime: '2024-09-28 09:21:51',
  70. title: 'ABSL-2超低温冰箱',
  71. reason: '温度异常',
  72. state: '1',
  73. stateVlaue: '异常'
  74. },
  75. {
  76. createTime: '2024-09-28 11:06:20',
  77. title: 'ABSL-3超低温冰箱',
  78. reason: '温度异常',
  79. state: '1',
  80. stateVlaue: '异常'
  81. },
  82. {
  83. createTime: '2024-09-28 11:54:19',
  84. title: 'ABSL-4超低温冰箱',
  85. reason: '温度异常',
  86. state: '1',
  87. stateVlaue: '异常'
  88. },
  89. {
  90. createTime: '2024-09-28 16:17:36',
  91. title: 'ABSL-5超低温冰箱',
  92. reason: '温度异常',
  93. state: '1',
  94. stateVlaue: '异常'
  95. },
  96. {
  97. createTime: '2024-09-28 19:35:58',
  98. title: 'ABSL-6超低温冰箱',
  99. reason: '温度异常',
  100. state: '1',
  101. stateVlaue: '异常'
  102. }
  103. ])
  104. const apiLoading = ref(false)
  105. onMounted(() => {})
  106. const leaveFor = (url = '/') => {
  107. router.replace({
  108. path: url
  109. })
  110. }
  111. // 删除
  112. const deleteData = (record) => {
  113. console.log(record.title, 'params')
  114. }
  115. </script>
  116. <style lang="less" scoped>
  117. .home_count {
  118. width: 100%;
  119. padding: 15px 25px;
  120. background-color: #ffffff;
  121. .warning-title {
  122. display: flex;
  123. align-items: center;
  124. justify-content: space-between;
  125. margin-bottom: 10px;
  126. }
  127. }
  128. </style>