daily.vue 5.1 KB

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