washInfo_company.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <script setup lang="ts">
  2. import configs from "@/core/config/Index"
  3. import moment from "moment"
  4. import { ref } from "vue"
  5. const cols = ref([
  6. {
  7. name: "序号",
  8. width: 60,
  9. field: configs.TABLE_INDEX_FIELD,
  10. },
  11. {
  12. name: "净化器名称",
  13. field: "monitor_name",
  14. },
  15. {
  16. name: "天数",
  17. field: "day_condition",
  18. },
  19. {
  20. name: "开机小时",
  21. field: "hour_condition",
  22. },
  23. {
  24. name: "最后清洗时间",
  25. field: "last_clean_time",
  26. },
  27. {
  28. name: "经过天数",
  29. field: "run_day",
  30. },
  31. {
  32. name: "开机小时数",
  33. field: "run_hour",
  34. },
  35. {
  36. name: "剩余天数",
  37. field: "surplus_day",
  38. },
  39. {
  40. name: "剩余小时数",
  41. field: "surplus_hour",
  42. },
  43. {
  44. name: "清洗记录",
  45. field: "action",
  46. },
  47. ])
  48. const queryParams = ref({})
  49. const modal = ref()
  50. const modalTable = ref()
  51. const dateRange = ref<any>("")
  52. const col2s = ref<Array<any>>([
  53. {
  54. name: "设备名称",
  55. field: "device_name",
  56. },
  57. {
  58. name: "清洗时间",
  59. field: "clean_start",
  60. },
  61. {
  62. name: "清洗照片",
  63. field: "pictures",
  64. },
  65. ])
  66. const queryParam2s = ref<any>({
  67. device_id: "0",
  68. })
  69. const deviceId = ref("")
  70. function cleanList(row: any) {
  71. deviceId.value = row.device_id
  72. query()
  73. modal.value.show()
  74. }
  75. function query() {
  76. const params: any = {
  77. device_id: deviceId.value + "",
  78. }
  79. if (dateRange.value[0]) {
  80. params.clean_start = moment(dateRange.value[0]).format("YYYYMMDD")
  81. params.clean_end = moment(dateRange.value[1]).format("YYYYMMDD")
  82. }
  83. //[moment(new Date()).add(-1, "M").toDate(), new Date()]
  84. queryParam2s.value = params
  85. }
  86. function reset() {
  87. dateRange.value = ""
  88. query()
  89. }
  90. </script>
  91. <template>
  92. <VbDataTable
  93. url="sys/purifierCondition/getCompanyCleanList"
  94. :header="cols"
  95. :query-params="queryParams"
  96. method="post"
  97. :has-checkbox="false"
  98. :pagination="false"
  99. >
  100. <template #tableHeader>
  101. <thead>
  102. <tr class="text-center">
  103. <th class="bg-light-primary" rowspan="2" style="vertical-align: middle">序号</th>
  104. <th class="bg-light-primary" rowspan="2" style="vertical-align: middle">净化器名称</th>
  105. <th class="bg-light-primary" colspan="2">清洗周期</th>
  106. <th class="bg-light-primary" rowspan="2" style="vertical-align: middle">最后清洗时间</th>
  107. <th class="bg-light-primary" colspan="2">上次清洗至今</th>
  108. <th class="bg-light-primary" colspan="2">距下次清洗</th>
  109. <th class="bg-light-primary" rowspan="2" style="vertical-align: middle">清洗记录</th>
  110. </tr>
  111. <tr class="text-center">
  112. <th class="bg-light-primary">天数</th>
  113. <th class="bg-light-primary">开机小时</th>
  114. <th class="bg-light-primary">经过天数</th>
  115. <th class="bg-light-primary">开机小时数</th>
  116. <th class="bg-light-primary">剩余天数</th>
  117. <th class="bg-light-primary">剩余小时数</th>
  118. </tr>
  119. </thead>
  120. </template>
  121. <template #last_clean_time="{ row }">
  122. {{ moment(row.last_clean_time, "YYYYMMDDHHmmss").format("YYYY-MM-DD") }}
  123. </template>
  124. <template #action="{ row }">
  125. <div class="text-danger text-center">
  126. <span class="table-action" @click="cleanList(row)">清洗记录</span>
  127. </div>
  128. </template>
  129. </VbDataTable>
  130. <VbModal
  131. v-model:modal="modal"
  132. title="清洗记录"
  133. close-btn-class="btn btn-primary"
  134. :confirm-btn="false"
  135. modal-dialog-style="max-width: 1100px;width: 1100px;"
  136. >
  137. <template #body>
  138. <VbDataTable
  139. ref="modalTable"
  140. :header="col2s"
  141. url="sys/purifierCondition/getEnterpriseCleanLog"
  142. method="post"
  143. :auto-search="false"
  144. :query-params="queryParam2s"
  145. :has-checkbox="false"
  146. >
  147. <template v-slot:table-tool>
  148. <el-form class="align-items-center" :inline="true">
  149. <el-form-item class="mb-0 me-0 align-items-center" label="日期">
  150. <el-date-picker
  151. v-model="dateRange"
  152. type="daterange"
  153. range-separator="~"
  154. start-placeholder="开始时间"
  155. end-placeholder="结束时间"
  156. size="default"
  157. />
  158. </el-form-item>
  159. <el-form-item class="mb-0 me-0 align-items-center">
  160. <el-button class="ms-3 mt-0 btn btn-sm btn-primary" @click="query">查询</el-button>
  161. <el-button class="ms-3 mt-0 btn btn-sm btn-light-primary btn-outline" @click="reset">重置</el-button>
  162. </el-form-item>
  163. </el-form>
  164. </template>
  165. <template #pictures="{ row }">
  166. <div class="d-flex h-100 justify-content-center align-items-center p-3">
  167. <el-image
  168. :src="`/api/file/upload/res/${row.pictures}`"
  169. :preview-src-list="[`/api/file/upload/res/${row.pictures}`]"
  170. :hide-on-click-modal="true"
  171. fit="cover"
  172. style="height: 50px; width: 75px; max-width: none; border-radius: 0.475rem"
  173. alt=""
  174. />
  175. </div>
  176. </template>
  177. </VbDataTable>
  178. </template>
  179. </VbModal>
  180. </template>