| | |
| | | 1代表需要默认值 ,0代表不需要默认值 |
| | | --> |
| | | |
| | | |
| | | |
| | | <script> |
| | | import exceptionApi from '@/api/exceptionApi.js'; |
| | | import exceptionApi from '@/api/exceptionApi.js' |
| | | export default { |
| | | props: { |
| | | // 0代表不需要默认值,1代表需要默认值 |
| | |
| | | }, |
| | | watch:{ |
| | | beginTime(val,oldVal){ |
| | | |
| | | if(this.isNeedRealTimeAdvice =='1' && oldVal != ''){ |
| | | exceptionApi.getExceptionName(this.exceptionType,this.beginTime,this.endTime).then( res=>{ |
| | | exceptionApi |
| | | .getExceptionName(this.exceptionType, this.beginTime, this.endTime) |
| | | .then((res) => { |
| | | this.siteNames = [] |
| | | const sites = res.data.data |
| | | sites.filter((item) => { |
| | |
| | | }, |
| | | exceptionType(){ |
| | | if(this.isNeedRealTimeAdvice =='1' ){ |
| | | exceptionApi.getExceptionName(this.exceptionType,this.beginTime,this.endTime).then( res=>{ |
| | | exceptionApi |
| | | .getExceptionName(this.exceptionType, this.beginTime, this.endTime) |
| | | .then((res) => { |
| | | this.siteNames = [] |
| | | const sites = res.data.data |
| | | sites.filter((item) => { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | obscureMatch(a, b) { |
| | | const pattern = new RegExp(a, 'i') |
| | | // 'i' 表示不区分大小写 |
| | | return pattern.test(b) |
| | | }, |
| | | |
| | | querySearch(queryString, cb) { |
| | | const results = queryString |
| | | ? this.siteNames.filter(this.createFilter(queryString)) |
| | | : this.siteNames |
| | | cb(results) |
| | | }, |
| | | |
| | | createFilter(queryString) { |
| | | return (restaurant) => { |
| | | return ( |
| | | // toLowerCase() 方法用于把字符串转换为小写。 |
| | | restaurant.toLowerCase().indexOf(queryString.toLowerCase()) === 0 |
| | | this.obscureMatch(queryString,restaurant) |
| | | ) |
| | | } |
| | | }, |
| | | // 初始化加载所有的站点名字 |
| | | loadAll() { |
| | | if(this.isNeedRealTimeAdvice == '1'){ |
| | | exceptionApi.getExceptionName(this.exceptionType,this.beginTime,this.endTime).then( res=>{ |
| | | exceptionApi |
| | | .getExceptionName(this.exceptionType, this.beginTime, this.endTime) |
| | | .then((res) => { |
| | | this.siteNames = [] |
| | | const sites = res.data.data |
| | | sites.filter((item) => { |
| | |
| | | this.siteNamesAndMnCode.push(temp) |
| | | }) |
| | | }) |
| | | |
| | | }else if(this.isNeedRealTimeAdvice == '0'){ |
| | | exceptionApi.getSitesNum().then((response) => { |
| | | const sites = response.data.data |
| | |
| | | }, |
| | | // 根据选中的站点查询设备编号 |
| | | onSiteNameSelected(siteName) { |
| | | const selectedSite = this.siteNamesAndMnCode.find((site) => site.name == siteName); |
| | | const selectedSite = this.siteNamesAndMnCode.find((site) => site.name == siteName) |
| | | if (selectedSite) { |
| | | this.$emit('submitMncode',selectedSite.mnCode) |
| | | }else{ |
| | |
| | | .el-autocomplete { |
| | | width: 200px; |
| | | } |
| | | |
| | | </style> |