collector.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. <a-button type="primary">显示新设备</a-button>
  8. <a-form
  9. ref="searchFormRef"
  10. name="advanced_search"
  11. :model="searchFormState"
  12. layout="inline"
  13. class="ant-advanced-search-form"
  14. >
  15. <a-form-item label="冷链编号" name="code">
  16. <a-input v-model:value="searchFormState.code" placeholder="请输入冷链编号" />
  17. </a-form-item>
  18. </a-form>
  19. <a-button type="primary" @click="tableRef.refresh(true)">查询</a-button>
  20. <a-button class="xn-mg08" @click="reset">重置</a-button>
  21. </div>
  22. <div class="head-right">
  23. <a-button>
  24. <template #icon><download-outlined /></template>导出
  25. </a-button>
  26. <a-select ref="select" v-model:value="value1" style="width: 120px" @focus="focus" @change="handleChange">
  27. <a-select-option value="1">搜索模式</a-select-option>
  28. </a-select>
  29. </div>
  30. </div>
  31. </template>
  32. <template #bodyCell="{ column, record }">
  33. <template v-if="column.dataIndex === 'state'">
  34. <span>
  35. <a-tag :color="record.state == '1' ? '#87d068' : record.state == '2' ? '#cd201f' : '#50cd7c'">
  36. {{ record.stateValue }}
  37. </a-tag>
  38. </span>
  39. </template>
  40. <template v-if="column.dataIndex === 'action'">
  41. <a-button type="link" size="small">编辑</a-button>
  42. <a-button type="link" size="small">删除</a-button>
  43. <a-button type="link" size="small">记录</a-button>
  44. </template>
  45. </template>
  46. </s-table>
  47. </div>
  48. </template>
  49. <script setup>
  50. import tool from '@/utils/tool'
  51. import jobApi from '@/api/dev/jobApi'
  52. const searchFormRef = ref()
  53. const searchFormState = ref({})
  54. const tableRef = ref()
  55. const value1 = ref('1')
  56. const columns = [
  57. {
  58. title: '所属部门',
  59. dataIndex: 'ssbm',
  60. align: 'center',
  61. ellipsis: true,
  62. width: 200
  63. },
  64. {
  65. title: '采集器编号',
  66. dataIndex: 'code',
  67. align: 'center',
  68. ellipsis: true
  69. },
  70. {
  71. title: '采集器名称',
  72. dataIndex: 'name',
  73. align: 'center',
  74. ellipsis: true,
  75. width: 200
  76. },
  77. {
  78. title: '型号',
  79. dataIndex: 'xh',
  80. align: 'center',
  81. ellipsis: true
  82. },
  83. {
  84. title: '最后心跳时间',
  85. dataIndex: 'date',
  86. align: 'center',
  87. ellipsis: true,
  88. width: 200
  89. },
  90. {
  91. title: '设备状态',
  92. dataIndex: 'state',
  93. align: 'center',
  94. ellipsis: true
  95. },
  96. {
  97. title: '传感器路数',
  98. dataIndex: 'bjsxx',
  99. align: 'center',
  100. ellipsis: true
  101. },
  102. {
  103. title: '对应监控对象',
  104. dataIndex: 'dyjkdx',
  105. align: 'center',
  106. ellipsis: true
  107. },
  108. {
  109. title: '监控对象位置',
  110. dataIndex: 'jkdxwz',
  111. align: 'center',
  112. ellipsis: true
  113. },
  114. {
  115. title: '操作',
  116. dataIndex: 'action',
  117. align: 'center',
  118. width: 150
  119. }
  120. ]
  121. const loadData = (parameter) => {
  122. return jobApi.jobPage(Object.assign(parameter, searchFormState.value)).then((res) => {
  123. // return res
  124. const obj = {
  125. current: 1,
  126. pages: 1,
  127. records: [
  128. {
  129. ssbm: '广州海关技术中心',
  130. code: 'Y6578945621',
  131. name: 'ABSL-3超低温冰箱123456',
  132. xh: '三代GPRS采集-VH',
  133. date: '2024-09-28 07:03:24',
  134. state: '1',
  135. stateValue: '正常',
  136. bjsxx: '1',
  137. dyjkdx: 'BSL-3超低温冰箱',
  138. jkdxwz: 'ABCLSY冰箱三层',
  139. children: [
  140. {
  141. ssbm: '广州海关技术中心',
  142. code: 'Y-01-6578945621',
  143. name: 'ABSL-3超低温冰箱123456',
  144. xh: '三代GPRS采集-VH',
  145. date: '2024-09-28 07:03:24',
  146. state: '2',
  147. stateValue: '异常',
  148. bjsxx: '1',
  149. dyjkdx: 'BSL-3超低温冰箱',
  150. jkdxwz: 'ABCLSY冰箱三层一格'
  151. }
  152. ]
  153. },
  154. {
  155. ssbm: '广州海关技术中心',
  156. code: 'Y6578945622',
  157. name: 'ABSL-3超低温冰箱123456',
  158. xh: '三代GPRS采集-VH',
  159. date: '2024-11-05 07:12:42',
  160. state: '1',
  161. stateValue: '正常',
  162. bjsxx: '1',
  163. dyjkdx: 'BSL-3超低温冰箱',
  164. jkdxwz: 'ABCLSY冰箱三层',
  165. children: [
  166. {
  167. ssbm: '广州海关技术中心',
  168. code: 'Y-01-6578945622',
  169. name: 'ABSL-3超低温冰箱123456',
  170. xh: '三代GPRS采集-VH',
  171. date: '2024-09-28 07:03:24',
  172. state: '2',
  173. stateValue: '异常',
  174. bjsxx: '1',
  175. dyjkdx: 'BSL-3超低温冰箱',
  176. jkdxwz: 'ABCLSY冰箱三层'
  177. }
  178. ]
  179. },
  180. {
  181. ssbm: '广州海关技术中心',
  182. code: 'Y6578945623',
  183. name: 'ABSL-3超低温冰箱123456',
  184. xh: '三代GPRS采集-VH',
  185. date: '2024-11-05 09:22:45',
  186. state: '1',
  187. stateValue: '正常',
  188. bjsxx: '1',
  189. dyjkdx: 'BSL-3超低温冰箱',
  190. jkdxwz: 'ABCLSY冰箱三层'
  191. },
  192. {
  193. ssbm: '广州海关技术中心',
  194. code: 'Y6578945624',
  195. name: 'ABSL-3超低温冰箱123456',
  196. xh: '三代GPRS采集-VH',
  197. date: '2024-11-05 09:27:55',
  198. state: '1',
  199. stateValue: '正常',
  200. bjsxx: '1',
  201. dyjkdx: 'BSL-3超低温冰箱',
  202. jkdxwz: 'ABCLSY冰箱三层'
  203. },
  204. {
  205. ssbm: '广州海关技术中心',
  206. code: 'Y6578945625',
  207. name: 'ABSL-3超低温冰箱123456',
  208. xh: '三代GPRS采集-VH',
  209. date: '2024-11-05 10:16:11',
  210. state: '2',
  211. stateValue: '异常',
  212. bjsxx: '1',
  213. dyjkdx: 'BSL-3超低温冰箱',
  214. jkdxwz: 'ABCLSY冰箱三层'
  215. },
  216. {
  217. ssbm: '广州海关技术中心',
  218. code: 'Y6578945626',
  219. name: 'ABSL-3超低温冰箱123456',
  220. xh: '三代GPRS采集-VH',
  221. date: '2024-11-05 14:57:31',
  222. state: '2',
  223. stateValue: '异常',
  224. bjsxx: '1',
  225. dyjkdx: 'BSL-3超低温冰箱',
  226. jkdxwz: 'ABCLSY冰箱三层'
  227. }
  228. ],
  229. size: 10,
  230. total: 6
  231. }
  232. return obj
  233. })
  234. }
  235. // 重置
  236. const reset = () => {
  237. searchFormRef.value.resetFields()
  238. tableRef.value.refresh(true)
  239. }
  240. </script>
  241. <style lang="less" scoped>
  242. .table_item {
  243. padding: 15px 20px;
  244. .table-head {
  245. width: 100%;
  246. display: flex;
  247. align-items: center;
  248. justify-content: space-between;
  249. .head-left {
  250. width: 60%;
  251. display: flex;
  252. }
  253. .ant-btn {
  254. margin-right: 10px;
  255. }
  256. }
  257. :deep(.ant-table-pagination-right) {
  258. justify-content: center !important;
  259. }
  260. }
  261. </style>