火灾补录,修复当选择对应火灾编号时,再次输入不存在的火灾编号时产生的问题
| | |
| | | placeholder="请输入火灾编号" |
| | | :trigger-on-focus="false" |
| | | @select="handleSelect" |
| | | @blur="inputBlur" |
| | | ></el-autocomplete> |
| | | </template> |
| | | </avue-form> |
| | |
| | | mapLocation:{ |
| | | isDetail:true |
| | | }, |
| | | fireList:[], |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | isDetail: true, |
| | | location:[this.form.lon,this.form.lat] |
| | | } |
| | | }else { |
| | | getAll().then(res=>{ |
| | | if (res.data.code == 200){ |
| | | let data = res.data.data |
| | | data.forEach(e=>{ |
| | | e.value = e.no |
| | | }) |
| | | this.fireList = data |
| | | } |
| | | |
| | | }) |
| | | } |
| | | }, |
| | | //返回列表页 |
| | | goToList() { |
| | |
| | | }, |
| | | //自动补全 |
| | | querySearch(queryString, cb){ |
| | | getAll({no:queryString}).then(res=>{ |
| | | if (res.data.code == 200){ |
| | | let data = res.data.data |
| | | data.forEach(e=>{ |
| | | e.value = e.no |
| | | this.$nextTick(()=>{ |
| | | let filterArray = this.fireList.filter(e => { |
| | | return e.no.indexOf(queryString) != -1 |
| | | }) |
| | | cb(data) |
| | | } |
| | | cb(filterArray) |
| | | }) |
| | | }, |
| | | //选择事件 |
| | |
| | | location:[this.form.lon,this.form.lat] |
| | | } |
| | | this.$refs.olMap.addPoint(this.mapLocation.location) |
| | | }, |
| | | inputBlur(e){ |
| | | let value = e.target.value |
| | | let filterArray = this.fireList.filter(e => { |
| | | return e.no.indexOf(value) != -1 |
| | | }) |
| | | if (filterArray.length>0){ |
| | | this.handleSelect(filterArray[0]) |
| | | }else { |
| | | this.$refs.form.resetForm() |
| | | this.$refs.olMap.clearDraw() |
| | | } |
| | | } |
| | | }, |
| | | destroyed() { |