Bläddra i källkod

fix:监测管理-设备状态

liu.haichuan 8 månader sedan
förälder
incheckning
e459484e99

+ 13 - 0
src/utils/index.js

@@ -460,3 +460,16 @@ export const checkEmpty = (str) => {
   res = res.replace(/<br>/g, '');
   return res.trim() == '';
 };
+
+// 秒转时分秒
+export function secondsToTime(seconds) {
+  const hours = Math.floor(seconds / 3600);
+  const minutes = Math.floor((seconds % 3600) / 60);
+  const secs = seconds % 60;
+  let result = [];
+  if (hours > 0) result.push(`${hours}小时`);
+  if (minutes > 0) result.push(`${minutes}分钟`);
+  if (secs > 0 || result.length === 0) result.push(`${secs}秒`)
+
+  return result.join(' ');
+}

+ 14 - 1
src/views/monitoringMamage/components/IrrigationRecord.vue

@@ -41,6 +41,13 @@
           {{ changeDict(scope.row.cardusercdBillingtype) }}
         </span>
       </template>
+      <template #cardusercdDuration="scope">
+        <span
+          style="display: flex; align-items: center; justify-content: center"
+        >
+          {{ scope.row.cardusercdDuration | fomatSeconds }}
+        </span>
+      </template>
     </b-table>
   </el-dialog>
 </template>
@@ -50,6 +57,7 @@ import { getCardusercdList } from '@/api/card/index.js';
 import { assign, omit } from 'lodash-es';
 import LeftImg from '../assets/img.svg';
 import BTable from '@/components/Table';
+import { secondsToTime } from '@/utils/index.js';
 export default {
   name: 'IrrigationRecord',
   props: {
@@ -106,7 +114,7 @@ export default {
         {
           label: '使用时长',
           prop: 'cardusercdDuration',
-          customRender: '',
+          customRender: 'cardusercdDuration',
           align: 'center'
         },
         // {
@@ -149,6 +157,11 @@ export default {
       deep: true
     }
   },
+  filters: {
+    fomatSeconds(value) {
+      return secondsToTime(value);
+    }
+  },
   methods: {
     changeDict(flag) {
       switch (flag) {

+ 11 - 11
src/views/monitoringMamage/index.vue

@@ -171,7 +171,7 @@
             </template>
 
             <template #operate="scope">
-              <el-link
+              <!-- <el-link
                 size="small"
                 :underline="false"
                 type="primary"
@@ -179,7 +179,7 @@
                 @click="realTime(scope.row)"
                 v-hasPermi="['wpr:monitor:realtime']"
                 >实时监测</el-link
-              >
+              > -->
               <el-link
                 size="small"
                 :underline="false"
@@ -265,17 +265,17 @@ export default {
           value: ''
         },
         {
-          label: '空闲中',
+          label: '在线',
           value: 'I'
         },
-        {
-          label: '工作中',
-          value: 'W'
-        },
-        {
-          label: '故障',
-          value: 'E'
-        },
+        // {
+        //   label: '工作中',
+        //   value: 'W'
+        // },
+        // {
+        //   label: '故障',
+        //   value: 'E'
+        // },
         {
           label: '离线',
           value: 'O'