|
@@ -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 = []
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
|
|
|
/**
|