realtime.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div class="table_item">
  3. <s-table ref="tableRef" :columns="columns" :data="loadData" :row-key="(record) => record.code">
  4. <template #operator>
  5. <div class="table-head">
  6. <div class="head-left">
  7. 剩余刷新时间:<text style="color: #1c8fff">{{ 33 }}</text>
  8. </div>
  9. <div class="head-right">
  10. <a-button>
  11. <template #icon><search-outlined /></template>搜索
  12. </a-button>
  13. <a-button>
  14. <template #icon><download-outlined /></template>导出
  15. </a-button>
  16. <a-button>
  17. <template #icon><printer-outlined /></template>打印
  18. </a-button>
  19. </div>
  20. </div>
  21. </template>
  22. <template #bodyCell="{ column, record }">
  23. <template v-if="column.dataIndex === 'state'">
  24. <span>
  25. <a-tag :color="record.state == '1' ? '#2db7f5' : record.state == '2' ? '#cd201f' : '#87d068'">
  26. {{ record.stateVlaue }}
  27. </a-tag>
  28. </span>
  29. </template>
  30. </template>
  31. </s-table>
  32. </div>
  33. </template>
  34. <script setup>
  35. import tool from '@/utils/tool'
  36. import jobApi from '@/api/dev/jobApi'
  37. const searchFormState = ref({})
  38. const tableRef = ref()
  39. const columns = [
  40. {
  41. title: '采集时间',
  42. dataIndex: 'time',
  43. align: 'center',
  44. ellipsis: true,
  45. sorter: true
  46. },
  47. {
  48. title: '所属部门',
  49. dataIndex: 'bm',
  50. align: 'center',
  51. ellipsis: true,
  52. sorter: true
  53. },
  54. {
  55. title: '对象名称',
  56. dataIndex: 'dxmc',
  57. align: 'center',
  58. ellipsis: true,
  59. sorter: true
  60. },
  61. {
  62. title: '设备状态',
  63. dataIndex: 'state',
  64. align: 'center',
  65. ellipsis: true
  66. },
  67. {
  68. title: '监控点',
  69. dataIndex: 'jkd',
  70. align: 'center',
  71. ellipsis: true,
  72. sorter: true
  73. },
  74. {
  75. title: '上下限',
  76. dataIndex: 'up',
  77. align: 'center',
  78. ellipsis: true
  79. },
  80. {
  81. title: '传感器类型',
  82. dataIndex: 'type',
  83. align: 'center',
  84. ellipsis: true
  85. },
  86. {
  87. title: '采集值1',
  88. dataIndex: 'cjz1',
  89. align: 'center',
  90. ellipsis: true
  91. },
  92. {
  93. title: '采集值2',
  94. dataIndex: 'cjz2',
  95. align: 'center',
  96. ellipsis: true
  97. },
  98. {
  99. title: '对象类型',
  100. dataIndex: 'dxtype',
  101. align: 'center',
  102. ellipsis: true,
  103. sorter: true
  104. },
  105. {
  106. title: '冷链编号',
  107. dataIndex: 'code',
  108. align: 'center',
  109. ellipsis: true,
  110. sorter: true
  111. }
  112. ]
  113. const loadData = (parameter) => {
  114. return jobApi.jobPage(Object.assign(parameter, searchFormState.value)).then((res) => {
  115. // return res
  116. const obj = {
  117. current: 1,
  118. pages: 1,
  119. records: [
  120. {
  121. time: '2024-09-28 07:03:24',
  122. bm: '广州海关基数中心1',
  123. dxmc: '-80度超低温冷冻储存箱',
  124. state: '1',
  125. stateVlaue: '正常',
  126. jkd: '监控点1',
  127. up: '-30~-10℃',
  128. type: '温度',
  129. cjz1: '-18.9℃',
  130. cjz2: '/',
  131. dxtype: '冰箱',
  132. code: '6578945621'
  133. },
  134. {
  135. time: '2024-09-28 09:21:51',
  136. bm: '广州海关基数中心2',
  137. dxmc: '-81度超低温冷冻储存箱',
  138. state: '1',
  139. stateVlaue: '正常',
  140. jkd: '监控点2',
  141. up: '-30~-10℃',
  142. type: '温度',
  143. cjz1: '-18.9℃',
  144. cjz2: '/',
  145. dxtype: '冰箱',
  146. code: '6578945622'
  147. },
  148. {
  149. time: '2024-09-28 11:06:20',
  150. bm: '广州海关基数中心3',
  151. dxmc: '-82度超低温冷冻储存箱',
  152. state: '1',
  153. stateVlaue: '正常',
  154. jkd: '监控点3',
  155. up: '-30~-10℃',
  156. type: '温度',
  157. cjz1: '-18.9℃',
  158. cjz2: '/',
  159. dxtype: '冰箱',
  160. code: '6578945623'
  161. },
  162. {
  163. time: '2024-09-28 11:54:19',
  164. bm: '广州海关基数中心4',
  165. dxmc: '-83度超低温冷冻储存箱',
  166. state: '1',
  167. stateVlaue: '正常',
  168. jkd: '监控点4',
  169. up: '-30~-10℃',
  170. type: '温度',
  171. cjz1: '-18.9℃',
  172. cjz2: '/',
  173. dxtype: '冰箱',
  174. code: '6578945624'
  175. },
  176. {
  177. time: '2024-09-28 16:17:36',
  178. bm: '广州海关基数中心5',
  179. dxmc: '-84度超低温冷冻储存箱',
  180. state: '1',
  181. stateVlaue: '正常',
  182. jkd: '监控点5',
  183. up: '-30~-10℃',
  184. type: '温度',
  185. cjz1: '-18.9℃',
  186. cjz2: '/',
  187. dxtype: '冰箱',
  188. code: '6578945625'
  189. },
  190. {
  191. time: '2024-09-28 19:35:58',
  192. bm: '广州海关基数中心6',
  193. dxmc: '-85度超低温冷冻储存箱',
  194. state: '1',
  195. stateVlaue: '正常',
  196. jkd: '监控点6',
  197. up: '-30~-10℃',
  198. type: '温度',
  199. cjz1: '-18.9℃',
  200. cjz2: '/',
  201. dxtype: '冰箱',
  202. code: '6578945626'
  203. }
  204. ],
  205. size: 10,
  206. total: 6
  207. }
  208. return obj
  209. })
  210. }
  211. </script>
  212. <style lang="less" scoped>
  213. .table_item {
  214. padding: 15px 20px;
  215. .table-head {
  216. display: flex;
  217. align-items: center;
  218. justify-content: space-between;
  219. .ant-btn {
  220. margin-left: 10px;
  221. }
  222. }
  223. :deep(.ant-table-pagination-right) {
  224. justify-content: center !important;
  225. }
  226. }
  227. </style>