From d205764a3ebe073b8302e8faf9345b74ae3350df Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 11 十一月 2024 17:12:35 +0800
Subject: [PATCH] 优化初始化进入界面时,默认监测因子选项为PM颗粒物等常用因子

---
 src/assets/mipmap/underway-3.png                  |    0 
 src/constant/radio-options/options-jingan.js      |    3 
 src/views/historymode/HistoryMode.vue             |    4 
 src/components/mission/MissionManage.vue          |    4 
 src/components/scene/SceneSearch.vue              |   50 ++++-
 src/views/realtimemode/RealtimeMode.vue           |    4 
 src/components/map/MapScene.vue                   |   17 +
 src/components/core/CoreMenu.vue                  |    3 
 src/views/LoginPage_Backup.vue                    |  204 ++++++++++++++++++++++
 src/components/monitor/FactorRadio.vue            |    4 
 src/components/search/OptionLocation.vue          |   28 +++
 src/constant/device-type.js                       |    2 
 src/components/search/OptionDevice.vue            |    2 
 src/constant/checkbox-options.js                  |   48 ++++
 src/views/realtimemode/component/DeviceChange.vue |   16 +
 src/constant/checkbox-options/options-jingan.js   |    2 
 src/constant/checkbox-options/options.js          |   29 ++-
 src/constant/radio-options.js                     |  100 +++--------
 src/stores/device.js                              |    4 
 src/constant/radio-options/options.js             |    6 
 20 files changed, 412 insertions(+), 118 deletions(-)

diff --git a/src/assets/mipmap/underway-3.png b/src/assets/mipmap/underway-3.png
new file mode 100644
index 0000000..e070a34
--- /dev/null
+++ b/src/assets/mipmap/underway-3.png
Binary files differ
diff --git a/src/components/core/CoreMenu.vue b/src/components/core/CoreMenu.vue
index b15b6f3..db14d19 100644
--- a/src/components/core/CoreMenu.vue
+++ b/src/components/core/CoreMenu.vue
@@ -93,6 +93,9 @@
       m[index].selected = true;
       this.$router.push(m[index].path);
     }
+  },
+  mounted() {
+    this.navTo(0);
   }
 };
 </script>
diff --git a/src/components/map/MapScene.vue b/src/components/map/MapScene.vue
index 163b5a3..89a665c 100644
--- a/src/components/map/MapScene.vue
+++ b/src/components/map/MapScene.vue
@@ -56,6 +56,14 @@
       sceneMap: new Map()
     };
   },
+  watch: {
+    // 褰撳垏鎹㈠尯鍘挎椂锛屾竻绌烘墍鏈夐�夐」
+    districtCode(nV, oV) {
+      if (nV != oV) {
+        this.handelCheckAllChange(false);
+      }
+    }
+  },
   methods: {
     fetchScene(sceneType) {
       return sceneInfoApi
@@ -84,13 +92,14 @@
 
       // 鏍规嵁閫夐」锛屽皢鏈墦寮�鐨勫浘灞傚紑鍚�
       types.forEach((t) => {
-        if (!lableMarkMap.has(t)) {
+        const key = this.districtCode + t;
+        if (!lableMarkMap.has(key)) {
           this.fetchScene(t).then((res) => {
             const layer = marks.createLabelMarks(sceneIcon(t), res);
-            lableMarkMap.set(t, { show: true, layer });
+            lableMarkMap.set(key, { show: true, layer });
           });
         } else {
-          const m = lableMarkMap.get(t);
+          const m = lableMarkMap.get(key);
           if (!m.show) {
             MapUtil.addViews(m.layer);
             m.show = true;
@@ -100,7 +109,7 @@
 
       // 鏍规嵁閫夐」锛屽皢寮�鍚腑鐨勬湭閫変腑鍥惧眰鍏抽棴
       for (const [key, value] of lableMarkMap) {
-        if (!types.includes(key)) {
+        if (!types.map((t) => this.districtCode + t).includes(key)) {
           if (value.show) {
             MapUtil.removeViews(value.layer);
             value.show = false;
diff --git a/src/components/mission/MissionManage.vue b/src/components/mission/MissionManage.vue
index 1cf433f..a385a6e 100644
--- a/src/components/mission/MissionManage.vue
+++ b/src/components/mission/MissionManage.vue
@@ -54,14 +54,14 @@
                 @click="deleteMission(row)"
                 >鍒犻櫎</el-button
               >
-              <!-- <el-button
+              <el-button
                 :loading="row.downloadLoading"
                 type="primary"
                 size="small"
                 class="el-button-custom"
                 @click="downloadReport(row)"
                 >鎶ュ憡</el-button
-              > -->
+              >
             </template>
           </el-table-column>
         </el-table>
diff --git a/src/components/monitor/FactorRadio.vue b/src/components/monitor/FactorRadio.vue
index ce67151..262228b 100644
--- a/src/components/monitor/FactorRadio.vue
+++ b/src/components/monitor/FactorRadio.vue
@@ -12,7 +12,7 @@
 
 <script>
 // 鐩戞祴鍥犲瓙鍗曢�夋
-import { radioOptions } from '@/constant/radio-options';
+import { radioOptions, defaultOptions } from '@/constant/radio-options';
 import { TYPE0 } from '@/constant/device-type';
 
 export default {
@@ -26,7 +26,7 @@
   emits: ['change'],
   data() {
     return {
-      radio: radioOptions(TYPE0)[0].value
+      radio: defaultOptions(TYPE0)
     };
   },
   computed: {
diff --git a/src/components/scene/SceneSearch.vue b/src/components/scene/SceneSearch.vue
index 92d4de0..a7644ac 100644
--- a/src/components/scene/SceneSearch.vue
+++ b/src/components/scene/SceneSearch.vue
@@ -21,6 +21,7 @@
           :data="sceneStore.sceneList"
           table-layout="fixed"
           size="small"
+          height="30vh"
           :show-overflow-tooltip="true"
           border
           row-class-name="t-row"
@@ -28,18 +29,25 @@
           header-row-class-name="t-header-row"
           header-cell-class-name="t-header-cell"
           @row-click="handleRowClick"
+          @filter-change="handleFilterChange"
         >
           <el-table-column type="index" label="#" width="25" />
           <el-table-column
             prop="type"
             label="绫诲瀷"
-            width="55"
+            width="56"
+            column-key="type"
             :filters="sceneTypeFilter"
             :filter-method="filterHandler"
           />
           <el-table-column prop="name" label="鍚嶇О" />
           <!-- <el-table-column prop="location" label="鍦板潃" /> -->
-          <!-- <el-table-column prop="districtName" label="鍖哄幙" align="center" /> -->
+          <el-table-column
+            prop="districtName"
+            label="鍖哄幙"
+            align="center"
+            width="54"
+          />
           <!-- <el-table-column label="绠$悊" width="70" align="center">
             <template #default="{ row }">
               <el-button
@@ -94,7 +102,8 @@
   data() {
     return {
       dialogVisible: false,
-      onConfirm: undefined
+      onConfirm: undefined,
+      showSceneTypes: []
     };
   },
   computed: {
@@ -108,6 +117,15 @@
         .map((v) => {
           return { text: v.label, value: v.label };
         });
+    },
+    showSceneList() {
+      if (this.showSceneTypes.length == 0) {
+        return this.sceneStore.sceneList;
+      } else {
+        return this.sceneStore.sceneList.filter((v) => {
+          return this.showSceneTypes.indexOf(v.type) != -1;
+        });
+      }
     }
   },
   watch: {
@@ -120,14 +138,20 @@
         }
       }
     },
-    'sceneStore.sceneList': {
-      handler(nV, oV) {
-        if (nV != oV) {
-          this.dialogVisible = true;
-          this.drawMarks(nV);
-        }
-      },
-      deep: true
+    // 'sceneStore.sceneList': {
+    //   handler(nV, oV) {
+    //     if (nV != oV) {
+    //       this.dialogVisible = true;
+    //       this.drawMarks(nV);
+    //     }
+    //   },
+    //   deep: true
+    // },
+    showSceneList(nV, oV) {
+      if (nV != oV) {
+        this.dialogVisible = true;
+        this.drawMarks(nV);
+      }
     },
     'toolboxStore.sceneSearchStatus': {
       handler(nV) {
@@ -158,6 +182,10 @@
     filterHandler(value, row, column) {
       const property = column['property'];
       return row[property] === value;
+    },
+    handleFilterChange(newFilters) {
+      // console.log(newFilters);
+      this.showSceneTypes = newFilters['type'];
     }
   }
 };
diff --git a/src/components/search/OptionDevice.vue b/src/components/search/OptionDevice.vue
index d5a4d43..a6d3c47 100644
--- a/src/components/search/OptionDevice.vue
+++ b/src/components/search/OptionDevice.vue
@@ -18,7 +18,7 @@
 </template>
 
 <script>
-import { deviceList } from '@/constant/device-type';
+// import { deviceList } from '@/constant/device-type';
 import { mapStores } from 'pinia';
 import { useDeviceStore } from '@/stores/device';
 
diff --git a/src/components/search/OptionLocation.vue b/src/components/search/OptionLocation.vue
index b4ceed8..857fc7a 100644
--- a/src/components/search/OptionLocation.vue
+++ b/src/components/search/OptionLocation.vue
@@ -39,7 +39,35 @@
       {
         label: '闀垮畞鍖�',
         value: '310105'
+      },
+      {
+        label: '闈欏畨鍖�',
+        value: '310106'
+      },
+      {
+        label: '寰愭眹鍖�',
+        value: '310104'
+      },
+      {
+        label: '閲戝北鍖�',
+        value: '310116'
       }
+      // {
+      //   label: '鏅檧鍖�',
+      //   value: '310107'
+      // },
+      // {
+      //   label: '闂佃鍖�',
+      //   value: '310112'
+      // },
+      // {
+      //   label: '瀹濆北鍖�',
+      //   value: '310113'
+      // },
+      // {
+      //   label: '鍢夊畾鍖�',
+      //   value: '310114'
+      // },
     ];
 
     if (import.meta.env.VITE_DATA_MODE == 'jingan') {
diff --git a/src/constant/checkbox-options.js b/src/constant/checkbox-options.js
index f9cc44d..fa3108d 100644
--- a/src/constant/checkbox-options.js
+++ b/src/constant/checkbox-options.js
@@ -1,11 +1,16 @@
 import { TYPE0, TYPE1, TYPE2, TYPE4 } from '@/constant/device-type';
 import {
   option1,
+  default1,
   option2,
   option3,
+  default3,
   option4
 } from '@/constant/checkbox-options/options';
-import { option1 as option1Jingan } from '@/constant/checkbox-options/options-jingan';
+import {
+  option1 as option1Jingan,
+  default1 as default1Jingan
+} from '@/constant/checkbox-options/options-jingan';
 
 // 鐩戞祴鍥犲瓙鍗曢�夋閫夐」
 function checkboxOptions(deviceType) {
@@ -32,6 +37,30 @@
   }
 }
 
+function defaultOptions(deviceType) {
+  if (import.meta.env.VITE_DATA_MODE == 'jingan') {
+    switch (deviceType) {
+      case TYPE0:
+        return default1Jingan;
+      default:
+        return undefined;
+    }
+  } else {
+    switch (deviceType) {
+      case TYPE0:
+        return default1;
+      case TYPE1:
+        return default3;
+      case TYPE2:
+        return undefined;
+      case TYPE4:
+        return undefined;
+      default:
+        return undefined;
+    }
+  }
+}
+
 /**
  * 榛樿閫夐」
  * @param {*} deviceType 璁惧绫诲瀷
@@ -39,11 +68,20 @@
  * @returns
  */
 function defaultFactorTypes(deviceType, count = 3) {
-  const list = checkboxOptions(deviceType);
-  if (list.length > count) {
-    return list.slice(0, count).map((v) => v.value);
+  const defaultOpt = defaultOptions(deviceType);
+  if (defaultOpt) {
+    if (defaultOpt.length > count) {
+      return defaultOpt.slice(0, count);
+    } else {
+      return defaultOpt;
+    }
   } else {
-    return list.map((v) => v.value);
+    const list = checkboxOptions(deviceType);
+    if (list.length > count) {
+      return list.slice(0, count).map((v) => v.value);
+    } else {
+      return list.map((v) => v.value);
+    }
   }
 }
 
diff --git a/src/constant/checkbox-options/options-jingan.js b/src/constant/checkbox-options/options-jingan.js
index f270d4d..f093255 100644
--- a/src/constant/checkbox-options/options-jingan.js
+++ b/src/constant/checkbox-options/options-jingan.js
@@ -49,3 +49,5 @@
     value: '17'
   }
 ];
+
+export const default1 = [option1[3].value, option1[4].value, option1[0].value];
diff --git a/src/constant/checkbox-options/options.js b/src/constant/checkbox-options/options.js
index 3f6b106..f41fac0 100644
--- a/src/constant/checkbox-options/options.js
+++ b/src/constant/checkbox-options/options.js
@@ -58,18 +58,21 @@
     label: '椋庨��',
     name: 'WIND_SPEED',
     value: '16'
-  },
+  }
   // {
   //   label: '椋庡悜',
   //   name: 'WIND_DIRECTION',
   //   value: '17'
   // },
-  {
-    label: '楂樺害',
-    name: 'HEIGHT',
-    value: '18'
-  }
+  // {
+  //   label: '楂樺害',
+  //   name: 'HEIGHT',
+  //   value: '18'
+  // }
 ];
+
+// 榛樿閫夐」
+const default1 = [option1[5].value, option1[6].value, option1[7].value];
 
 const option2 = [
   {
@@ -144,13 +147,21 @@
     label: '椋庨��',
     name: 'WIND_SPEED',
     value: '16'
-  }
+  },
   // {
   //   label: '椋庡悜',
   //   name: 'WIND_DIRECTION',
   //   value: '17'
-  // }
+  // },
+  {
+    label: '楂樺害',
+    name: 'HEIGHT',
+    value: '18'
+  }
 ];
+
+// 榛樿閫夐」
+const default3 = [option3[5].value, option3[6].value, option3[7].value];
 
 const option4 = [
   {
@@ -170,4 +181,4 @@
   }
 ];
 
-export { option1, option2, option3, option4 };
+export { option1, default1, option2, option3, default3, option4 };
diff --git a/src/constant/device-type.js b/src/constant/device-type.js
index 6316134..1768fb0 100644
--- a/src/constant/device-type.js
+++ b/src/constant/device-type.js
@@ -66,7 +66,7 @@
 }
 
 function typeName(type) {
-  return typeList().find((v) => (v.value = type)).label;
+  return typeList().find((v) => v.value == type).label;
 }
 
 export { TYPE0, TYPE1, TYPE2, TYPE3, TYPE4, typeList, typeName, deviceList };
diff --git a/src/constant/radio-options.js b/src/constant/radio-options.js
index c56bd55..3b42021 100644
--- a/src/constant/radio-options.js
+++ b/src/constant/radio-options.js
@@ -1,6 +1,14 @@
 import { TYPE0, TYPE1, TYPE2 } from '@/constant/device-type';
-import { option1, option2 } from '@/constant/radio-options/options';
-import { option1 as option1Jingan } from '@/constant/radio-options/options-jingan';
+import {
+  option1,
+  default1,
+  option2,
+  default2
+} from '@/constant/radio-options/options';
+import {
+  option1 as option1Jingan,
+  default1 as default1Jingan
+} from '@/constant/radio-options/options-jingan';
 
 // 鐩戞祴鍥犲瓙鍗曢�夋閫夐」
 function radioOptions(deviceType) {
@@ -21,74 +29,22 @@
   }
 }
 
-// const option1 = [
-//   {
-//     label: 'NO2',
-//     name: 'NO2',
-//     value: '1'
-//   },
-//   {
-//     label: 'CO',
-//     name: 'CO',
-//     value: '2'
-//   },
-//   {
-//     label: 'H2S',
-//     name: 'H2S',
-//     value: '3'
-//   },
-//   {
-//     label: 'SO2',
-//     name: 'SO2',
-//     value: '4'
-//   },
-//   {
-//     label: 'O3',
-//     name: 'O3',
-//     value: '5'
-//   },
-//   {
-//     label: 'PM2.5',
-//     name: 'PM25',
-//     value: '6'
-//   },
-//   {
-//     label: 'PM10',
-//     name: 'PM10',
-//     value: '7'
-//   },
-//   {
-//     label: 'TVOC',
-//     name: 'VOC',
-//     value: '10'
-//   }
-// ];
+function defaultOptions(deviceType) {
+  if (import.meta.env.VITE_DATA_MODE == 'jingan') {
+    if (TYPE0 == deviceType) {
+      return default1Jingan;
+    } else {
+      return undefined;
+    }
+  } else {
+    if ([TYPE0, TYPE1].includes(deviceType)) {
+      return default1;
+    } else if (deviceType == TYPE2) {
+      return default2;
+    } else {
+      return undefined;
+    }
+  }
+}
 
-// const option2 = [
-//   {
-//     label: '娓╁害',
-//     name: 'TMP',
-//     value: '1'
-//   },
-//   {
-//     label: '鐢靛鐜�',
-//     name: 'spC',
-//     value: '2'
-//   },
-//   {
-//     label: '娴婂害',
-//     name: 'tur',
-//     value: '3'
-//   },
-//   {
-//     label: '婧惰В姘�',
-//     name: 'DO',
-//     value: '4'
-//   },
-//   {
-//     label: 'PH',
-//     name: 'PH',
-//     value: '5'
-//   }
-// ];
-export { radioOptions };
+export { radioOptions, defaultOptions };
diff --git a/src/constant/radio-options/options-jingan.js b/src/constant/radio-options/options-jingan.js
index d82ee85..5e65aa2 100644
--- a/src/constant/radio-options/options-jingan.js
+++ b/src/constant/radio-options/options-jingan.js
@@ -29,3 +29,6 @@
     value: '7'
   }
 ];
+
+// 榛樿閫夐」 PM2.5
+export const default1 = option1[3].value;
diff --git a/src/constant/radio-options/options.js b/src/constant/radio-options/options.js
index 12cb189..c2ab3ef 100644
--- a/src/constant/radio-options/options.js
+++ b/src/constant/radio-options/options.js
@@ -45,6 +45,9 @@
   }
 ];
 
+// 榛樿閫夐」 PM2.5
+export const default1 = option1[5].value;
+
 export const option2 = [
   {
     label: '娓╁害',
@@ -72,3 +75,6 @@
     value: '5'
   }
 ];
+
+// 榛樿閫夐」 娓╁害
+export const default2 = option2[0].value;
diff --git a/src/stores/device.js b/src/stores/device.js
index f17f37e..82adade 100644
--- a/src/stores/device.js
+++ b/src/stores/device.js
@@ -21,7 +21,9 @@
       return deviceApi
         .fethchDevice({ type: type, page, pageSize })
         .then((res) => {
-          deviceList.value = res.data;
+          deviceList.value = res.data.sort((a, b) => {
+            return a.deviceCode < b.deviceCode ? -1 : 1;
+          });
           return res;
         });
     });
diff --git a/src/views/LoginPage_Backup.vue b/src/views/LoginPage_Backup.vue
new file mode 100644
index 0000000..0ebec65
--- /dev/null
+++ b/src/views/LoginPage_Backup.vue
@@ -0,0 +1,204 @@
+<template>
+  <div class="background">
+    <div class="title-content">
+      椋炵窘澶ф皵鐜璧拌埅鐩戞祴姹℃煋婧簮鎶ュ憡鏅鸿兘鐢熸垚绯荤粺
+    </div>
+
+    <div class="flexbox flex-space-around">
+      <div class="input-box flexbox">
+        <div class="flexbox-col align-items" style="margin: auto">
+          <div class="flexbox-col input-content flex-space-between">
+            <el-form
+              :model="formObj"
+              ref="formRef"
+              :rules="rules"
+              label-position="top"
+            >
+              <el-form-item label="鐢ㄦ埛鍚�" prop="userName">
+                <el-input
+                  size="default"
+                  v-model="formObj.userName"
+                  placeholder="鐢ㄦ埛鍚�"
+                  style="width: 200px"
+                />
+              </el-form-item>
+              <el-form-item label="瀵嗙爜" prop="password">
+                <el-input
+                  size="default"
+                  type="password"
+                  show-password
+                  v-model="formObj.password"
+                  placeholder="瀵嗙爜"
+                  style="width: 200px"
+                />
+              </el-form-item>
+            </el-form>
+          </div>
+          <div class="btn-login" @click="login">鐧诲綍</div>
+        </div>
+      </div>
+
+      <img :src="underwayPng" alt="璧拌埅鐩戞祴" class="img-1" />
+    </div>
+  </div>
+</template>
+
+<script>
+import underwayPng3 from '@/assets/mipmap/underway-3.png';
+import underwayPng2 from '@/assets/mipmap/underway-2.png';
+import underwayPng from '@/assets/mipmap/underway.png';
+import { ElMessage } from 'element-plus';
+
+export default {
+  data() {
+    return {
+      formObj: {},
+      rules: {
+        userName: [
+          {
+            required: true,
+            message: '璇疯緭鍏ョ敤鎴峰悕',
+            trigger: 'blur'
+          }
+        ],
+        password: [
+          {
+            required: true,
+            message: '璇疯緭鍏ュ瘑鐮�',
+            trigger: 'blur'
+          }
+        ]
+      }
+    };
+  },
+  computed: {
+    underwayPng() {
+      if (import.meta.env.VITE_DATA_MODE == 'jingan') {
+        return underwayPng2;
+      } else {
+        return underwayPng3;
+      }
+    }
+  },
+  methods: {
+    login() {
+      this.$refs.formRef.validate((valid) => {
+        if (valid) {
+          if (
+            (this.formObj.userName == 'jingan' &&
+              this.formObj.password == 'jingan123') ||
+            (this.formObj.userName == 'feiyu' &&
+              this.formObj.password == 'fyhb123')
+          ) {
+            this.$router.replace('/index/hmode');
+          } else {
+            ElMessage({
+              message: '鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒',
+              type: 'error'
+            });
+          }
+        }
+      });
+    }
+  }
+};
+</script>
+<style scoped>
+.background {
+  background-color: #002378;
+  position: absolute;
+  left: 0;
+  top: 0;
+  bottom: 0;
+  width: 100%;
+  height: 100%;
+  min-height: 768px;
+  min-width: 1366px;
+}
+
+.title-content {
+  /* position: absolute; */
+  width: 100%;
+  height: 200px;
+  padding: 3vh 0 0 0;
+  /* top: 80px;
+    left: 0;
+    right: 0; */
+  color: white;
+  font-size: 1.4rem;
+  display: flex;
+  justify-content: center;
+  background-image: url('@/assets/mipmap/title_bg.png');
+  background-size: contain;
+  background-repeat: no-repeat;
+}
+
+.img-1 {
+  min-height: 500px;
+  height: 60vh;
+  /* margin-left: 6vw; */
+}
+
+.input-box {
+  width: 400px;
+  height: 420px;
+  /* background-color: aquamarine; */
+  background-image: url('@/assets/mipmap/border.png');
+  background-size: 100% 100%;
+  color: white;
+}
+
+.input-content {
+}
+
+.input-content .text-box {
+  width: 220px;
+  height: 28px;
+  font-size: 12px;
+  border-radius: 6px;
+}
+
+.btn-login {
+  margin-top: 20px;
+  border-radius: 6px;
+  padding: 8px 60px;
+  box-shadow: 10px 10px 10px rgba(39, 39, 39, 0.473);
+  background: -moz-linear-gradient(
+    left,
+    rgb(109, 213, 231),
+    rgb(80, 166, 202),
+    rgb(65, 141, 186),
+    rgb(33, 90, 154),
+    rgb(13, 56, 133),
+    rgb(11, 53, 131)
+  );
+  background: -ms-linear-gradient(
+    left,
+    rgb(109, 213, 231),
+    rgb(80, 166, 202),
+    rgb(65, 141, 186),
+    rgb(33, 90, 154),
+    rgb(13, 56, 133),
+    rgb(11, 53, 131)
+  );
+  background: -o-linear-gradient(
+    left,
+    rgb(109, 213, 231),
+    rgb(80, 166, 202),
+    rgb(65, 141, 186),
+    rgb(33, 90, 154),
+    rgb(13, 56, 133),
+    rgb(11, 53, 131)
+  );
+  background: -webkit-linear-gradient(
+    left,
+    rgb(109, 213, 231),
+    rgb(80, 166, 202),
+    rgb(65, 141, 186),
+    rgb(33, 90, 154),
+    rgb(13, 56, 133),
+    rgb(11, 53, 131)
+  );
+  cursor: pointer;
+}
+</style>
diff --git a/src/views/historymode/HistoryMode.vue b/src/views/historymode/HistoryMode.vue
index 11ba4f6..9f9c573 100644
--- a/src/views/historymode/HistoryMode.vue
+++ b/src/views/historymode/HistoryMode.vue
@@ -56,7 +56,7 @@
 import { useFetchData } from '@/composables/fetchData';
 import moment from 'moment';
 import { TYPE0 } from '@/constant/device-type';
-import { radioOptions } from '@/constant/radio-options';
+import { defaultOptions } from '@/constant/radio-options';
 import { FactorDatas } from '@/model/FactorDatas';
 import TrendAnalysis from './component/TrendAnalysis.vue';
 import DataSheet from './component/DataSheet.vue';
@@ -79,7 +79,7 @@
       // 鐩戞祴璁惧缂栧彿
       deviceCode: '',
       // 鐩戞祴鍥犲瓙鐨勭被鍨嬬紪鍙�
-      factorType: radioOptions(TYPE0)[0].value,
+      factorType: defaultOptions(TYPE0),
       // 鐩戞祴鏁版嵁
       factorDatas: new FactorDatas(),
       // 鍐冲畾缁樺埗3D鍥惧舰鏃舵槸鍚︿笌鍘熷浘鍍忓悎骞�
diff --git a/src/views/realtimemode/RealtimeMode.vue b/src/views/realtimemode/RealtimeMode.vue
index e01a9aa..da8a10b 100644
--- a/src/views/realtimemode/RealtimeMode.vue
+++ b/src/views/realtimemode/RealtimeMode.vue
@@ -28,7 +28,7 @@
 import moment from 'moment';
 import { useFetchData } from '@/composables/fetchData';
 import { TYPE0 } from '@/constant/device-type';
-import { radioOptions } from '@/constant/radio-options';
+import { defaultOptions } from '@/constant/radio-options';
 import { FactorDatas } from '@/model/FactorDatas';
 import DashBoard from './component/DashBoard.vue';
 import RealTimeTrend from './component/RealTimeTrend.vue';
@@ -55,7 +55,7 @@
       deviceType: TYPE0,
       deviceCode: '',
       // 鐩戞祴鍥犲瓙鐨勭被鍨嬬紪鍙�
-      factorType: radioOptions(TYPE0)[0].value,
+      factorType: defaultOptions(TYPE0),
       // 鏂拌幏鍙栫殑鐩戞祴鏁版嵁
       factorDatas: new FactorDatas(),
       // 鍏ㄩ儴鐩戞祴鏁版嵁
diff --git a/src/views/realtimemode/component/DeviceChange.vue b/src/views/realtimemode/component/DeviceChange.vue
index 4b78b7e..345b996 100644
--- a/src/views/realtimemode/component/DeviceChange.vue
+++ b/src/views/realtimemode/component/DeviceChange.vue
@@ -33,14 +33,18 @@
     }
   },
   watch: {
-    // formSearch(nV, oV) {
-    //   if (nV != oV) {
-    //     this.handleChange(nV[0].value);
-    //   }
-    // }
+    // 褰撹澶囩紪鍙烽娆′粠鍚庣鑾峰彇鏃讹紝瑙﹀彂閫氱煡浜嬩欢
+    ['formSearch.deviceCode'](nV, oV) {
+      if (oV == undefined && nV != oV) {
+        this.handleClick();
+      }
+    }
   },
   mounted() {
-    this.$emit('change', this.formSearch);
+    // 褰撹澶囩紪鍙峰凡缁忎粠鍚庣鑾峰彇瀹屾垚鏃讹紝鐩存帴瑙﹀彂閫氱煡浜嬩欢
+    if (this.formSearch.deviceCode) {
+      this.handleClick();
+    }
   }
 };
 </script>

--
Gitblit v1.9.3