Przeglądaj źródła

Merge branch 'master' of http://git.xt.wenhq.top:8083/wenhongquan/khyznh-ui

liwei19941102 1 rok temu
rodzic
commit
fc7909a835
1 zmienionych plików z 15 dodań i 7 usunięć
  1. 15 7
      src/views/statics/index.vue

+ 15 - 7
src/views/statics/index.vue

@@ -167,28 +167,36 @@ const initData = async () => {
 
 
     var keyp = [100];
     var keyp = [100];
     var index = 0;
     var index = 0;
-    deptOptions.value[0]["title"] = deptOptions.value[0]["label"];
+    var all = 0;
+    var zx = 0;
+
     deptOptions.value[0].children.forEach((p) => {
     deptOptions.value[0].children.forEach((p) => {
-      p["title"] = p.label;
       p["children"] = (p.children ?? []).concat(
       p["children"] = (p.children ?? []).concat(
         carlist.value
         carlist.value
           .filter((i) => JSON.parse(i.ext1).deptId == p.id)
           .filter((i) => JSON.parse(i.ext1).deptId == p.id)
           .map((i) => {
           .map((i) => {
             keyp.push(p.id);
             keyp.push(p.id);
+            let ll = i.lastCountTime == null
+              ? "离线"
+              : moment().unix() - moment(i.lastCountTime).unix() > 60 * 5
+                ? "离线"
+                : "在线";
+            if (ll == "在线") {
+              zx++;
+            }
+            all++;
             return {
             return {
               id: `car_${++index}`,
               id: `car_${++index}`,
               title: i.carNum,
               title: i.carNum,
               deviceInfos: i.deviceInfos,
               deviceInfos: i.deviceInfos,
               time:
               time:
-                i.lastCountTime == null
-                  ? "离线"
-                  : moment().unix() - moment(i.lastCountTime).unix() > 60 * 5
-                  ? "离线"
-                  : "在线",
+                ll,
             };
             };
           })
           })
       );
       );
+      p["title"] = p.label+` [ ${p["children"].filter(i=>i.time.indexOf("在线")!=-1).length}/${p["children"].length}]`;
     });
     });
+    deptOptions.value[0]["title"] = deptOptions.value[0]["label"] +` [ ${zx}/${all}]`;
     data.value = deptOptions.value;
     data.value = deptOptions.value;
     keys.value = keyp;
     keys.value = keyp;
     setTimeout(() => {
     setTimeout(() => {