wenhongquan 2 лет назад
Родитель
Сommit
277207e869
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      src/views/statics/index.vue

+ 3 - 1
src/views/statics/index.vue

@@ -23,6 +23,7 @@
             :filter-method="filterNode" @node-click="treeclick">
             <template v-slot:default="{ node }">
               <element-tree-line :node="node" :treeData="data" :showLabelLine="false" :indent="treeIndent">
+                 <div ><span>{{node.label}}</span> <el-tag style="margin-left: 20px;" :type="node.data.time=='在线'?'success':'danger'" > {{ node.data.time }}</el-tag></div>
               </element-tree-line>
             </template>
           </el-tree-v2>
@@ -61,6 +62,7 @@
 
 <script setup>
 import { listCarInfo } from '@/api/carInfo';
+import moment from 'moment';
 
 
 const carlist = ref([]);
@@ -135,7 +137,7 @@ const treeclick = (data, node) => {
 
 const data = computed(() => {
   let index = 0;
-  return carlist.value.map(i => { return { id: ++index, label: i.carNum,deviceInfos:i.deviceInfos } })
+  return carlist.value.map(i => { return { id: ++index, label: i.carNum,deviceInfos:i.deviceInfos,time:  i.lastCountTime==null?"离线": ((moment().unix()- moment(i.lastCountTime).unix())>1000*60*5?"离线":"在线") } })
 });
 var jessibuca = null;
 onMounted(() => {