Browse Source

Merge branch 'yunxing_record' of shuzhihua/pms-iot-vue into master

yanghao 2 weeks ago
parent
commit
10fe229971

+ 8 - 1
src/views/report-statistics/fault_report/index.vue

@@ -25,7 +25,12 @@
               <div class="card-value pt-5">
                 <CountTo
                   class="text-3xl"
-                  :end-val="statusCount.finished + statusCount.trans + statusCount.reporting || 0"
+                  :end-val="
+                    statusCount.finished +
+                      statusCount.trans +
+                      statusCount.reporting +
+                      statusCount.close || 0
+                  "
                   :decimals="0"
                 />
               </div>
@@ -200,6 +205,8 @@
             </template>
           </el-table-column>
 
+          <el-table-column label="故障系统" align="center" prop="failureSystem" min-width="200" />
+
           <el-table-column label="故障频次" align="center" prop="failureNum" min-width="200" />
           <el-table-column
             :label="t('fault.approvalStatus')"

+ 56 - 95
src/views/report-statistics/inspection_order/index.vue

@@ -171,7 +171,13 @@
           </el-table-column>
 
           <el-table-column label="设备编码" align="center" prop="deviceCode" />
-          <el-table-column :label="t('monitor.deviceName')" align="center" prop="deviceName" />
+          <el-table-column :label="t('monitor.deviceName')" align="center">
+            <template #default="{ row }">
+              <el-link type="primary" :underline="false" @click="goDetail(row.deviceCode)">{{
+                row.deviceName
+              }}</el-link>
+            </template>
+          </el-table-column>
           <el-table-column label="工单数量" align="center" prop="orderCount" />
         </el-table>
 
@@ -285,6 +291,36 @@
       </ContentWrap>
     </el-col>
   </el-row>
+
+  <el-drawer v-model="drawerVisible" title="异常点数量" direction="rtl" size="50%">
+    <el-table v-loading="loading" :data="deviceDetail" :stripe="true" :show-overflow-tooltip="true">
+      <el-table-column :label="t('iotDevice.serial')" width="70" align="center">
+        <template #default="scope">
+          {{ scope.$index + 1 }}
+        </template>
+      </el-table-column>
+      <el-table-column :label="t('bomList.name')" align="center" prop="orderName" />
+      <el-table-column :label="t('iotDevice.code')" align="center" prop="deviceCode" />
+      <el-table-column :label="t('monitor.deviceName')" align="center" prop="deviceName" />
+      <el-table-column :label="t('operationFill.duty')" align="center" prop="charge" />
+      <el-table-column :label="t('inspect.InspectionItems')" align="center" prop="item" />
+      <el-table-column :label="t('inspect.isException')" align="center" prop="ifNormal">
+        <template #default="scope">
+          <span v-if="scope.row.ifNormal" style="color: dodgerblue">正常</span>
+          <span v-else-if="scope.row.ifNormal === null" style="color: #101010">待填写</span>
+          <span v-else-if="!scope.row.ifNormal" style="color: orangered">异常</span>
+        </template>
+      </el-table-column>
+      <el-table-column :label="t('inspect.exceptionDes')" align="center" prop="description" />
+    </el-table>
+
+    <Pagination
+      :total="detailTotal"
+      v-model:page="detailQueryParams.pageNo"
+      v-model:limit="detailQueryParams.pageSize"
+      @pagination="goDetail(detailQueryParams.deviceCode)"
+    />
+  </el-drawer>
 </template>
 
 <script setup lang="ts">
@@ -432,43 +468,6 @@ const getExceptionList = async () => {
     loading.value = false
   }
 }
-/** 查询列表 */
-// const getList = async (status: string = '') => {
-//   isExceptionPoint.value = false
-//   isException.value = false
-
-//   Object.keys(statusList.value).forEach((key) => {
-//     statusList.value[key] = false
-//   })
-//   statusList.value[status] = true
-//   loading.value = true
-//   try {
-//     if (status === 'all') {
-//       queryParams.status = undefined
-//     } else if (status === 'todo') {
-//       queryParams.status = 'todo'
-//     } else if (status === 'finished') {
-//       queryParams.status = 'finished'
-//     } else if (status === 'ignore') {
-//       queryParams.status = 'ignore'
-//     }
-//     const data = await IotInspectOrderApi.getIotInspectOrderList(queryParams)
-//     list.value = data.list
-//     total.value = data.total
-//   } finally {
-//     loading.value = false
-//   }
-// }
-
-// const getAllList = async () => {
-//   if (isExceptionPoint.value) {
-//     await getPointList()
-//   } else if (isException.value) {
-//     await getExceptionList()
-//   } else {
-//     await getList()
-//   }
-// }
 
 const getList = async (status: string = '', shouldResetStatus = true) => {
   isExceptionPoint.value = false
@@ -513,63 +512,6 @@ const getAllList = async () => {
   }
 }
 
-// watch(
-//   dateType,
-//   () => {
-//     const now = new Date()
-//     let startTime: Date
-//     let endTime: Date
-
-//     switch (dateType.value) {
-//       case 'year':
-//         // 当年:1月1日 00:00:00 到 12月31日 23:59:59
-//         startTime = new Date(now.getFullYear(), 0, 1, 0, 0, 0, 0)
-//         endTime = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999)
-//         break
-
-//       case 'month':
-//         // 当月:月初 00:00:00 到 月末 23:59:59
-//         startTime = new Date(now.getFullYear(), now.getMonth(), 1, 0, 0, 0, 0)
-//         // 下个月的第0天就是当月的最后一天
-//         endTime = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999)
-//         break
-
-//       case 'day':
-//         // 当日:当天 00:00:00 到 23:59:59
-//         const year = now.getFullYear()
-//         const month = now.getMonth()
-//         const date = now.getDate()
-//         startTime = new Date(year, month, date, 0, 0, 0, 0)
-//         endTime = new Date(year, month, date, 23, 59, 59, 999)
-//         break
-
-//       default:
-//         startTime = new Date(now.getFullYear(), 0, 1, 0, 0, 0, 0)
-//         endTime = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999)
-//     }
-
-//     // 使用本地时间格式化函数,避免时区转换问题
-//     const formatLocalDateTime = (date: Date): string => {
-//       const year = date.getFullYear()
-//       const month = String(date.getMonth() + 1).padStart(2, '0')
-//       const day = String(date.getDate()).padStart(2, '0')
-//       const hours = String(date.getHours()).padStart(2, '0')
-//       const minutes = String(date.getMinutes()).padStart(2, '0')
-//       const seconds = String(date.getSeconds()).padStart(2, '0')
-
-//       return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
-//     }
-//     // 设置查询参数 - 使用本地时间格式化
-//     queryParams.createTime = [formatLocalDateTime(startTime), formatLocalDateTime(endTime)]
-
-//     // 重新获取数据
-//     getList()
-//     getCounts()
-//   },
-//   {
-//     immediate: true
-//   }
-// )
 watch(
   dateType,
   () => {
@@ -644,6 +586,25 @@ const openForm = (id?: number) => {
   push({ name: 'InspectOrderDetail', params: { id } })
 }
 
+let drawerVisible = ref(false)
+const deviceDetail = ref([])
+let detailTotal = ref(0)
+const detailQueryParams = ref({
+  pageNo: 1,
+  pageSize: 20,
+  status: '异常',
+  deviceCode: ''
+})
+const goDetail = async (code: string) => {
+  // 抽屉打开设备详情
+  drawerVisible.value = true
+  detailQueryParams.value.deviceCode = code
+
+  const data = await IotInspectOrderDetailApi.getIotInspectItemStatusPage(detailQueryParams.value)
+  deviceDetail.value = data.list
+  detailTotal.value = data.total
+}
+
 async function getCounts() {
   exceptions.value = await IotInspectOrderApi.getIotInspectOrderExceptionDeviceCount({
     deptId: queryParams.deptId,