| | |
| | | <script> |
| | | // import Cookies from 'js-cookie' |
| | | import '@/assets/icon/iconfont.css' |
| | | import _ from 'lodash' |
| | | // import $ from 'jquery' |
| | | import Map from '@/components/Wind/Map.vue' |
| | | import LineChart from '@/components/Echarts/LineChart' |
| | |
| | | }, |
| | | watch: { |
| | | searchText(newVal, oldVal) { |
| | | // console.log(oldVal) |
| | | console.log(typeof (newVal)) |
| | | // console.log(newVal) |
| | | // defaultData是站点名,包含设备 |
| | | const copyData = _.cloneDeep(this.defaultDataMiddle) |
| | | this.openeds = [] |
| | | const arr = [] |
| | | let ke = 1 |
| | | const jList = [] |
| | | if (newVal === '') { |
| | | this.defaultData = copyData |
| | | this.openeds = [] |
| | | return |
| | | } |
| | | if (newVal !== oldVal) { |
| | | var arr = [] |
| | | for (var i = 0; i < this.defaultData.length; i++) { |
| | | this.openeds.push((ke++).toString()) |
| | | for (var j = 0; j < this.defaultData[i].devices.length; j++) { |
| | | if (this.defaultData[i].devices[j].name.indexOf(newVal) >= 0) { |
| | | let a = [] |
| | | a = this.defaultData[i] |
| | | a.devices = [this.defaultData[i].devices[j]] |
| | | arr.push(a) |
| | | if (this.defaultData[i].devices[j].name.indexOf(newVal.toUpperCase()) >= 0) { |
| | | this.openeds.push((ke++).toString()) |
| | | jList.push(this.defaultData[i].devices[j]) |
| | | } |
| | | } |
| | | |
| | | console.log(arr) |
| | | } |
| | | this.defaultData = arr |
| | | } |
| | | if (newVal === '') { |
| | | this.defaultData = this.defaultDataMiddle |
| | | this.openeds = [] |
| | | this.defaultData = jList |
| | | console.log(this.defaultData) |
| | | } |
| | | }, |
| | | changeCity(newVal, oldVal) { |