gaspatrolTable.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <div class="gaspatrolTable">
  3. <div class="search-area">
  4. <a-row>
  5. <a-col :span="5">
  6. <div class="area-item">
  7. <div class="item-text">巡检地点:</div>
  8. <a-input style="width: 240px" v-model:value="searchData.address" placeholder="请输入巡检地点" />
  9. </div>
  10. </a-col>
  11. <a-col :span="5">
  12. <div class="area-item">
  13. <div class="item-text">巡检员:</div>
  14. <a-input style="width: 240px" v-model:value="searchData.userName" placeholder="请输入巡检员" />
  15. </div>
  16. </a-col>
  17. <a-col :span="5">
  18. <div class="area-item">
  19. <div class="item-text">巡检类型:</div>
  20. <a-select ref="select" v-model:value="searchData.insType" style="width: 240px" placeholder="请输入巡检类型"
  21. @change="insTypeChange">
  22. <a-select-option v-for="(item, index) in insTypeList" :key="item.value" :value="item.value">{{ item.label
  23. }}</a-select-option>
  24. </a-select>
  25. </div>
  26. </a-col>
  27. <a-col :span="5">
  28. <div class="area-item">
  29. <div class="item-text">巡检班次:</div>
  30. <a-select ref="select" v-model:value="searchData.class" style="width: 240px" placeholder="请输入巡检班次">
  31. <a-select-option v-for="(item, index) in classList" :key="item.value" :value="item.value">{{ item.label
  32. }}</a-select-option>
  33. </a-select>
  34. </div>
  35. </a-col>
  36. <a-col :span="4">
  37. <a-button type="primary" preIcon="ant-design:search-outlined" style="margin-left: 10px"
  38. @click="getSearch">查询</a-button>
  39. <a-button preIcon="ant-design:sync-outlined" style="margin: 0px 15px" @click="getReset">重置</a-button>
  40. </a-col>
  41. </a-row>
  42. </div>
  43. <div class="content-area">
  44. <a-table :columns="Columns" size="small" :data-source="gaspatrolTableData" class="tableW" :pagination="false"
  45. :scroll="{ y: 620 }">
  46. <!-- <template #bodyCell="{ column, record }">
  47. <a v-if="column.dataIndex === 'operation'" class="table-action-link" @click="handlerLocation(record)">定位</a>
  48. </template> -->
  49. <template #action="{ record }">
  50. <a class="table-action-link" @click="handlerLocation(record)">定位</a>
  51. </template>
  52. </a-table>
  53. </div>
  54. </div>
  55. </template>
  56. <script setup lang="ts">
  57. import { ref, reactive, onMounted, watch, defineExpose } from 'vue';
  58. import { gaspatrolColumnsOne, gaspatrolColumnsTwo } from './comment.data';
  59. import { queryNowGasInsInfo } from '../deviceMonitor/components/device/device.api';
  60. let searchData = reactive({
  61. address: '',
  62. userName: '',
  63. insType: '2',
  64. class: 'night',
  65. });
  66. let insTypeList = reactive<any[]>([
  67. { label: '一次', value: '1' },
  68. { label: '两次', value: '2' },
  69. ]);
  70. let classList = reactive<any[]>([
  71. { label: '夜班', value: 'night' },
  72. { label: '早班', value: 'early' },
  73. { label: '中班', value: 'noon' },
  74. ]);
  75. let Columns = ref<any[]>(gaspatrolColumnsOne);
  76. let gaspatrolTableData = ref<any[]>([]);
  77. let $emit = defineEmits(['locate','getSearch']);
  78. //巡检类型选项切换
  79. let insTypeChange = (val) => {
  80. searchData.insType = val;
  81. if (val == '1') {
  82. Columns.value = gaspatrolColumnsOne;
  83. } else {
  84. Columns.value = gaspatrolColumnsTwo;
  85. }
  86. };
  87. //定位
  88. function handlerLocation(record) {
  89. $emit('locate', record);
  90. }
  91. //查询
  92. let getSearch = () => {
  93. queryNowGasInsInfoList()
  94. $emit('getSearch', searchData);
  95. };
  96. //重置
  97. let getReset = () => {
  98. searchData.address = '';
  99. searchData.class = '';
  100. searchData.insType = '';
  101. searchData.userName = '';
  102. queryNowGasInsInfoList()
  103. };
  104. //查询当前各班瓦斯巡检信息
  105. async function queryNowGasInsInfoList() {
  106. let res = await queryNowGasInsInfo(searchData);
  107. console.log(res, '查询当前各班瓦斯巡检信息');
  108. if (res.length) {
  109. if (searchData.insType == '1' && searchData.class == 'early') {
  110. gaspatrolTableData.value = res.map((el: any) => {
  111. return {
  112. strInstallPos: el.strInstallPos,
  113. ch4One: el.ch4Early1,
  114. co2One: el.co2Early1,
  115. coOne: el.coEarly1,
  116. o2One: el.o2Early1,
  117. tOne: el.tearly1,
  118. timeOne: el.timeEarly1,
  119. checkPerson: el.checkPersonEarly,
  120. };
  121. });
  122. } else if (searchData.insType == '2' && searchData.class == 'early') {
  123. gaspatrolTableData.value = res.map((el: any) => {
  124. return {
  125. strInstallPos: el.strInstallPos,
  126. ch4One: el.ch4Early1,
  127. co2One: el.co2Early1,
  128. coOne: el.coEarly1,
  129. o2One: el.o2Early1,
  130. tOne: el.tearly1,
  131. timeOne: el.timeEarly1,
  132. ch4Two: el.ch4Early2,
  133. co2Two: el.co2Early2,
  134. coTwo: el.coEarly2,
  135. o2Two: el.o2Early2,
  136. tTwo: el.tearly2,
  137. timeTwo: el.timeEarly2,
  138. checkPerson: el.checkPersonEarly,
  139. };
  140. });
  141. } else if (searchData.insType == '1' && searchData.class == 'noon') {
  142. gaspatrolTableData.value = res.map((el: any) => {
  143. return {
  144. strInstallPos: el.strInstallPos,
  145. ch4One: el.ch4Noon1,
  146. co2One: el.co2Noon1,
  147. coOne: el.coNoon1,
  148. o2One: el.o2Noon1,
  149. tOne: el.tnoon1,
  150. timeOne: el.timeNoon1,
  151. checkPerson: el.checkPersonNoon,
  152. };
  153. });
  154. } else if (searchData.insType == '2' && searchData.class == 'noon') {
  155. gaspatrolTableData.value = res.map((el: any) => {
  156. return {
  157. strInstallPos: el.strInstallPos,
  158. ch4One: el.ch4Noon1,
  159. co2One: el.co2Noon1,
  160. coOne: el.coNoon1,
  161. o2One: el.o2Noon1,
  162. tOne: el.tnoon1,
  163. timeOne: el.timeNoon1,
  164. ch4Two: el.ch4Noon2,
  165. co2Two: el.co2Noon2,
  166. coTwo: el.coNoon2,
  167. o2Two: el.o2Noon2,
  168. tTwo: el.tnoon2,
  169. timeTwo: el.timeNoon2,
  170. checkPerson: el.checkPersonNoon,
  171. };
  172. });
  173. } else if (searchData.insType == '1' && searchData.class == 'night') {
  174. gaspatrolTableData.value = res.map((el: any) => {
  175. return {
  176. strInstallPos: el.strInstallPos,
  177. ch4One: el.ch4Night1,
  178. co2One: el.co2Night1,
  179. coOne: el.coNight1,
  180. o2One: el.o2Night1,
  181. tOne: el.tnight1,
  182. timeOne: el.timeNight1,
  183. checkPerson: el.checkPersonNight,
  184. };
  185. });
  186. } else if (searchData.insType == '2' && searchData.class == 'night') {
  187. gaspatrolTableData.value = res.map((el: any) => {
  188. return {
  189. strInstallPos: el.strInstallPos,
  190. ch4One: el.ch4Night1,
  191. co2One: el.co2Night1,
  192. coOne: el.coNight1,
  193. o2One: el.o2Night1,
  194. tOne: el.tnight1,
  195. timeOne: el.timeNight1,
  196. ch4Two: el.ch4Night2,
  197. co2Two: el.co2Night2,
  198. coTwo: el.coNight2,
  199. o2Two: el.o2Night2,
  200. tTwo: el.tnight2,
  201. timeTwo: el.timeNight2,
  202. checkPerson: el.checkPersonNoon,
  203. };
  204. });
  205. } else {
  206. gaspatrolTableData.value = res.map((el: any) => {
  207. return {
  208. strInstallPos: el.strInstallPos,
  209. ch4One: el.ch4Night1,
  210. co2One: el.co2Night1,
  211. coOne: el.coNight1,
  212. o2One: el.o2Night1,
  213. tOne: el.tnight1,
  214. timeOne: el.timeNight1,
  215. checkPerson: el.checkPersonNight,
  216. };
  217. });
  218. }
  219. } else {
  220. gaspatrolTableData.value = [];
  221. }
  222. }
  223. defineExpose({ queryNowGasInsInfoList })
  224. onMounted(() => { });
  225. </script>
  226. <style lang="less" scoped>
  227. @ventSpace: zxm;
  228. .gaspatrolTable {
  229. .search-area {
  230. margin: 15px;
  231. .area-item {
  232. display: flex;
  233. align-items: center;
  234. .item-text {
  235. color: #fff;
  236. }
  237. }
  238. }
  239. .zxm-picker,
  240. .zxm-input {
  241. border: 1px solid #3ad8ff77;
  242. background-color: #ffffff00;
  243. color: #fff;
  244. }
  245. }
  246. :deep(.@{ventSpace}-table-body) {
  247. height: auto !important;
  248. tr>td {
  249. background: #ffffff00 !important;
  250. }
  251. tr.@{ventSpace}-table-row-selected {
  252. td {
  253. background: #007cc415 !important;
  254. }
  255. }
  256. }
  257. :deep(.jeecg-basic-table .@{ventSpace}-table-wrapper .@{ventSpace}-table-title) {
  258. min-height: 0;
  259. }
  260. :deep(.@{ventSpace}-pagination) {
  261. margin-right: 20px !important;
  262. }
  263. :deep(.zxm-table-thead > tr > th:last-child) {
  264. border-right: 1px solid #91e9fe55 !important;
  265. }
  266. </style>