daily.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. <!-- 搜索区域 -->
  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 }">
  58. <template v-if="column.dataIndex === 'state'">
  59. <span>
  60. <a-tag :color="record.state == '1' ? '#87d068' : record.state == '2' ? '#cd201f' : '#50cd7c'">
  61. {{ record.stateVlaue }}
  62. </a-tag>
  63. </span>
  64. </template>
  65. </template>
  66. </s-table>
  67. <div class="item-right">
  68. <!-- 单位 -->
  69. <div class="unit">
  70. <unitSearch ref="unitSearchRef" />
  71. </div>
  72. <!-- 监控点 -->
  73. <div class="monitor">
  74. <monitorSearch ref="monitorSearchRef" />
  75. </div>
  76. </div>
  77. </div>
  78. </template>
  79. <script setup>
  80. import jobApi from '@/api/dev/jobApi'
  81. import unitSearch from './unitSearch.vue'
  82. import monitorSearch from './monitorSearch.vue'
  83. const unitSearchRef = ref(null)
  84. const monitorSearchRef = ref(null)
  85. const searchFormState = ref({
  86. type: 'wd'
  87. })
  88. onMounted(() => {
  89. unitSearchRef.value.onOpen() //获取单位数据
  90. monitorSearchRef.value.onOpen() //获取监控点数据
  91. })
  92. const tableRef = ref()
  93. const columns = [
  94. {
  95. title: '采集时间',
  96. dataIndex: 'time',
  97. align: 'center',
  98. ellipsis: true
  99. },
  100. {
  101. title: '对象名称',
  102. dataIndex: 'dxmc',
  103. align: 'center',
  104. ellipsis: true
  105. },
  106. {
  107. title: '报警最小值',
  108. dataIndex: 'bjzxz',
  109. align: 'center',
  110. ellipsis: true
  111. },
  112. {
  113. title: '采集状态',
  114. dataIndex: 'state',
  115. align: 'center',
  116. ellipsis: true
  117. },
  118. {
  119. title: '部门名称',
  120. dataIndex: 'bmmc',
  121. align: 'center',
  122. ellipsis: true
  123. }
  124. ]
  125. const loadData = (parameter) => {
  126. return jobApi.jobPage(Object.assign(parameter, searchFormState.value)).then((res) => {
  127. // return res
  128. const obj = {
  129. current: 1,
  130. pages: 1,
  131. records: [
  132. {
  133. time: '2024-08-28 07:03:24',
  134. dxmc: '-70度超低温冷冻储存箱',
  135. bjzxz: '/',
  136. state: '2',
  137. stateVlaue: '异常',
  138. bmmc: '上海海关基数中心1'
  139. },
  140. {
  141. time: '2024-08-28 09:21:51',
  142. dxmc: '-71度超低温冷冻储存箱',
  143. bjzxz: '/',
  144. state: '1',
  145. stateVlaue: '正常',
  146. bmmc: '上海海关基数中心2'
  147. },
  148. {
  149. time: '2024-08-28 11:06:20',
  150. dxmc: '-72度超低温冷冻储存箱',
  151. bjzxz: '/',
  152. state: '2',
  153. stateVlaue: '异常',
  154. bmmc: '上海海关基数中心2'
  155. },
  156. {
  157. time: '2024-08-28 11:54:19',
  158. dxmc: '-73度超低温冷冻储存箱',
  159. bjzxz: '/',
  160. state: '2',
  161. stateVlaue: '异常',
  162. bmmc: '上海海关基数中心4'
  163. },
  164. {
  165. time: '2024-08-28 16:17:36',
  166. dxmc: '-74度超低温冷冻储存箱',
  167. bjzxz: '/',
  168. state: '1',
  169. stateVlaue: '正常',
  170. bmmc: '上海海关基数中心5'
  171. },
  172. {
  173. time: '2024-08-28 19:35:58',
  174. dxmc: '-75度超低温冷冻储存箱',
  175. bjzxz: '/',
  176. state: '2',
  177. stateVlaue: '异常',
  178. bmmc: '上海海关基数中心6'
  179. }
  180. ],
  181. size: 10,
  182. total: 6
  183. }
  184. return obj
  185. })
  186. }
  187. </script>
  188. <style lang="less" scoped>
  189. .table_item {
  190. width: 100%;
  191. display: flex;
  192. padding: 15px 20px;
  193. // 表格区域
  194. .table-wrapper {
  195. width: 75%;
  196. }
  197. // 右边的搜索区域
  198. .item-right {
  199. width: 25%;
  200. padding: 5px 10px;
  201. .unit,
  202. .monitor {
  203. width: 100%;
  204. height: 350px;
  205. padding: 10px;
  206. margin-bottom: 10px;
  207. border-radius: 5px;
  208. border: 1px solid #eaeaea;
  209. overflow-y: auto;
  210. }
  211. }
  212. }
  213. // 树形结构的样式
  214. :deep(.ant-tree-treenode) {
  215. width: 100%;
  216. margin-bottom: 5px;
  217. border-radius: 5px;
  218. padding: 5px 0 !important;
  219. border: 1px solid #eaeaea;
  220. }
  221. // 分页居中显示
  222. :deep(.ant-table-pagination-right) {
  223. justify-content: center !important;
  224. }
  225. </style>