浏览代码

更新202111090801

fanghuisheng 3 年之前
父节点
当前提交
3462246cfd
共有 2 个文件被更改,包括 39 次插入29 次删除
  1. 33 28
      src/store/index.js
  2. 6 1
      src/views/alarmManage/index.vue

+ 33 - 28
src/store/index.js

@@ -64,34 +64,39 @@ export default createStore({
      * @param {*} state 
      */
     publicDeviceList(state) {
-      api
-        .dataManagementDeviceList({ siteId: state.siteId })
-        .then((requset) => {
-          if (requset.status === 'SUCCESS') {
-            state.deviceList = []
-            requset.data.map((val) => {
-              if (val.children.length > 0) {
-                state.deviceList.push({
-                  deviceCode: val.deviceCode,
-                  deviceName: val.deviceName,
-                  id: val.id,
-                  children:
-                    val.children.length > 0
-                      ? val.children.map((val) => {
-                        return {
-                          deviceCode: val.variableCoding,
-                          deviceName: val.variableName,
-                          id: val.id,
-                        }
-                      })
-                      : val.children,
-                })
-              }
-            })
-          } else {
-            ElMessage.error(requset.msg)
-          }
-        })
+      if (state.siteId != "" && state.siteId != null) {
+        api
+          .dataManagementDeviceList({ siteId: state.siteId })
+          .then((requset) => {
+            if (requset.status === 'SUCCESS') {
+              state.deviceList = []
+              requset.data.map((val) => {
+                if (val.children.length > 0) {
+                  state.deviceList.push({
+                    deviceCode: val.deviceCode,
+                    deviceName: val.deviceName,
+                    id: val.id,
+                    children:
+                      val.children.length > 0
+                        ? val.children.map((val) => {
+                          return {
+                            deviceCode: val.variableCoding,
+                            deviceName: val.variableName,
+                            id: val.id,
+                          }
+                        })
+                        : val.children,
+                  })
+                }
+              })
+            } else {
+              ElMessage.error(requset.msg)
+            }
+          })
+      } else {
+        state.deviceList = []
+      }
+
     },
 
     /**

+ 6 - 1
src/views/alarmManage/index.vue

@@ -32,7 +32,12 @@
               @change="listSelect()"
             ></el-date-picker>
           </div>
-          <el-button class="search-button">重置</el-button>
+          <el-button
+            class="search-button"
+            @click=";(store.state.siteId = ''), (dateValue = ''), listSelect()"
+          >
+            重置
+          </el-button>
           <el-button type="primary" class="search-button" @click="listSelect()">
             搜索
           </el-button>