daily.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <div class="table_item">
  3. <s-table ref="tableRef" :columns="columns" :data="loadData" :row-key="(record) => record.code" bordered>
  4. <template #operator>
  5. <!-- 搜索区域 -->
  6. <div class="table-search">
  7. <div class="table-search-form">
  8. <a-row :gutter="10">
  9. <a-form
  10. ref="searchFormRef"
  11. name="advanced_search"
  12. layout="inline"
  13. :label-col="{ style: { width: '70px', justifyContent: 'end' } }"
  14. :model="searchFormState"
  15. class="ant-advanced-search-form"
  16. >
  17. <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  18. <a-form-item label="生成时间" name="searchKey">
  19. <a-range-picker
  20. v-model:value="searchFormState.searchKey"
  21. value-format="YYYY/MM/DD"
  22. style="width: 100%"
  23. />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="12">
  27. <a-form-item label="采集类型" name="type">
  28. <a-select v-model:value="searchFormState.type" placeholder="请选择采集类型">
  29. <a-select-option value="wd">温度</a-select-option>
  30. <a-select-option value="2">湿度</a-select-option>
  31. <a-select-option value="3">氧气浓度</a-select-option>
  32. <a-select-option value="4">二氧化碳浓度</a-select-option>
  33. <a-select-option value="5">液味</a-select-option>
  34. </a-select>
  35. </a-form-item></a-col
  36. >
  37. </a-form>
  38. </a-row>
  39. </div>
  40. <div class="table-search-buttons">
  41. <a-button type="primary" @click="tableRef.refresh(true)">查询</a-button>
  42. <a-button class="xn-mg08" @click="reset">重置</a-button>
  43. </div>
  44. </div>
  45. <!-- 其他操作区域 -->
  46. <div class="table-head-btn">
  47. <div class="btn-right">
  48. <a-button class="xn-mg08">
  49. <template #icon><download-outlined /></template>导出
  50. </a-button>
  51. <a-button>
  52. <template #icon><printer-outlined /></template>打印
  53. </a-button>
  54. </div>
  55. </div>
  56. </template>
  57. <template #bodyCell="{ column, record, index }">
  58. <!-- 序号 -->
  59. <template v-if="column.dataIndex === 'index'">{{ index + 1 }} </template>
  60. <template v-if="column.dataIndex === 'state'">
  61. <span>
  62. <a-tag :color="record.state == '1' ? '#87d068' : record.state == '2' ? '#cd201f' : '#50cd7c'">
  63. {{ record.stateVlaue }}
  64. </a-tag>
  65. </span>
  66. </template>
  67. </template>
  68. </s-table>
  69. <div class="item-right">
  70. <!-- 单位 -->
  71. <div class="unit">
  72. <unitSearch ref="unitSearchRef" />
  73. </div>
  74. <!-- 监控点 -->
  75. <div class="monitor">
  76. <monitorSearch ref="monitorSearchRef" />
  77. </div>
  78. </div>
  79. </div>
  80. </template>
  81. <script setup>
  82. import jobApi from '@/api/dev/jobApi'
  83. import unitSearch from './unitSearch.vue'
  84. import monitorSearch from './monitorSearch.vue'
  85. const unitSearchRef = ref(null)
  86. const monitorSearchRef = ref(null)
  87. const searchFormState = ref({
  88. type: 'wd'
  89. })
  90. onMounted(() => {
  91. unitSearchRef.value.onOpen() //获取单位数据
  92. monitorSearchRef.value.onOpen() //获取监控点数据
  93. })
  94. const tableRef = ref()
  95. const columns = [
  96. {
  97. title: '序号',
  98. dataIndex: 'index',
  99. align: 'center',
  100. width: 50
  101. },
  102. {
  103. title: '采集时间',
  104. dataIndex: 'time',
  105. align: 'center',
  106. ellipsis: true
  107. },
  108. {
  109. title: '对象名称',
  110. dataIndex: 'dxmc',
  111. align: 'center',
  112. ellipsis: true
  113. },
  114. {
  115. title: '报警最小值',
  116. dataIndex: 'bjzxz',
  117. align: 'center',
  118. ellipsis: true
  119. },
  120. {
  121. title: '报警最大值',
  122. dataIndex: 'bjzdz',
  123. align: 'center',
  124. ellipsis: true
  125. },
  126. {
  127. title: '采集状态',
  128. dataIndex: 'state',
  129. align: 'center',
  130. ellipsis: true
  131. },
  132. {
  133. title: '部门名称',
  134. dataIndex: 'bmmc',
  135. align: 'center',
  136. ellipsis: true
  137. }
  138. ]
  139. const loadData = (parameter) => {
  140. return jobApi.jobPage(Object.assign(parameter, searchFormState.value)).then((res) => {
  141. // return res
  142. const obj = {
  143. current: 1,
  144. pages: 1,
  145. records: [
  146. {
  147. time: '2024-08-28 07:03:24',
  148. dxmc: '-70度超低温冷冻储存箱',
  149. bjzxz: '/',
  150. bjzdz: '/',
  151. state: '2',
  152. stateVlaue: '异常',
  153. bmmc: '上海海关基数中心1'
  154. },
  155. {
  156. time: '2024-08-28 09:21:51',
  157. dxmc: '-71度超低温冷冻储存箱',
  158. bjzxz: '/',
  159. bjzdz: '/',
  160. state: '1',
  161. stateVlaue: '正常',
  162. bmmc: '上海海关基数中心2'
  163. },
  164. {
  165. time: '2024-08-28 11:06:20',
  166. dxmc: '-72度超低温冷冻储存箱',
  167. bjzxz: '/',
  168. bjzdz: '/',
  169. state: '2',
  170. stateVlaue: '异常',
  171. bmmc: '上海海关基数中心2'
  172. },
  173. {
  174. time: '2024-08-28 11:54:19',
  175. dxmc: '-73度超低温冷冻储存箱',
  176. bjzxz: '/',
  177. bjzdz: '/',
  178. state: '2',
  179. stateVlaue: '异常',
  180. bmmc: '上海海关基数中心4'
  181. },
  182. {
  183. time: '2024-08-28 16:17:36',
  184. dxmc: '-74度超低温冷冻储存箱',
  185. bjzxz: '/',
  186. bjzdz: '/',
  187. state: '1',
  188. stateVlaue: '正常',
  189. bmmc: '上海海关基数中心5'
  190. },
  191. {
  192. time: '2024-08-28 19:35:58',
  193. dxmc: '-75度超低温冷冻储存箱',
  194. bjzxz: '/',
  195. bjzdz: '/',
  196. state: '2',
  197. stateVlaue: '异常',
  198. bmmc: '上海海关基数中心6'
  199. }
  200. ],
  201. size: 10,
  202. total: 6
  203. }
  204. return obj
  205. })
  206. }
  207. </script>
  208. <style lang="less" scoped>
  209. .table_item {
  210. width: 100%;
  211. display: flex;
  212. padding: 15px 20px;
  213. // 表格区域
  214. .table-wrapper {
  215. width: 75%;
  216. }
  217. // 右边的搜索区域
  218. .item-right {
  219. width: 25%;
  220. padding: 5px 10px;
  221. .unit,
  222. .monitor {
  223. width: 100%;
  224. height: 350px;
  225. padding: 10px;
  226. margin-bottom: 10px;
  227. border-radius: 5px;
  228. border: 1px solid #eaeaea;
  229. overflow-y: auto;
  230. }
  231. }
  232. }
  233. // 树形结构的样式
  234. :deep(.ant-tree-treenode) {
  235. width: 100%;
  236. margin-bottom: 5px;
  237. border-radius: 5px;
  238. padding: 5px 0 !important;
  239. border: 1px solid #eaeaea;
  240. }
  241. // 分页居中显示
  242. :deep(.ant-table-pagination-right) {
  243. justify-content: center !important;
  244. }
  245. </style>