林火综合应急信息管理系统前端
guoshilong
2023-03-07 79c5d6a424c52ec50e856cdab5d98474cfd02be8
src/views/fire/fireSupplement.vue
@@ -8,7 +8,17 @@
        </div>
        <el-row>
          <el-col :span="12">
            <avue-form ref="form" v-model="form" :option="option"></avue-form>
            <avue-form ref="form" v-model="form" :option="option">
              <template slot="no">
                <el-autocomplete class="inline-input"
                  v-model="form.no"
                  :fetch-suggestions="querySearch"
                  placeholder="请输入火灾编号"
                  :trigger-on-focus="false"
                  @select="handleSelect"
                ></el-autocomplete>
              </template>
            </avue-form>
          </el-col>
          <el-col :span="12">
            <OpenLayersMap ref="olMap" :mapLocation="mapLocation"></OpenLayersMap>
@@ -54,6 +64,7 @@
<script>
import {add} from "@/api/fireSupplement/fireSupplement";
import OpenLayersMap from "@/components/OpenLayersMap/index";
import {getAll} from "@/api/fire/fire";
export default {
  name: "fireSupplieMent",
@@ -72,10 +83,11 @@
            prop: 'no',
            span: 24,
            type: 'input',
            disabled: true,
            slot:true
          },
          {
            label: "行政区域",
            disabled:true,
            prop: "location",
            span: 24,
            type: "cascader",
@@ -83,49 +95,19 @@
              label: 'title',
              value: 'key'
            },
            separator: '',
            lazy: true,
            lazyLoad(node, resolve) {
              let stop_level = 2;
              let level = node.level;
              let data = node.data || {}
              let code = data.key;
              let list = [];
              let callback = () => {
                resolve((list || []).map(ele => {
                  return Object.assign(ele, {
                    leaf: level >= stop_level
                  })
                }));
              }
              if (level == 0) {
                axios.get(`${baseUrl}00`).then(res => {
                  list = res.data.data;
                  callback()
                })
              } else if (level == 1) {
                axios.get(`${baseUrl}${code}`).then(res => {
                  list = res.data.data;
                  callback()
                })
              } else if (level == 2) {
                axios.get(`${baseUrl}${code}`).then(res => {
                  list = res.data.data;
                  callback()
                })
              } else {
                callback()
              }
            }
            dicUrl: 'api/blade-system/region/lazy-tree',
            slot: true
          },
          {
            label: '具体地址',
            disabled:true,
            prop: 'address',
            span: 24,
            type: 'input'
          },
          {
            label: "发现方式",
            disabled:true,
            prop: "findWay",
            type: "select",
            row: true,
@@ -142,6 +124,7 @@
          },
          {
            label: "火灾等级",
            disabled:true,
            prop: "level",
            type: "select",
            row: true,
@@ -158,23 +141,27 @@
          },
          {
            label: "发现时间",
            disabled:true,
            prop: "alarmTime",
            type: "datetime",
          },
          {
            label: '报警人',
            disabled:true,
            prop: 'caller',
            span: 24,
            type: 'input'
          },
          {
            label: '火灾描述',
            disabled:true,
            prop: 'description',
            span: 24,
            type: 'textarea'
          },
          {
            label: '现场图片',
            disabled:true,
            prop: 'images',
            listType: 'picture-card',
            type: 'upload',
@@ -253,7 +240,7 @@
          },
          {
            label: '重伤人数',
            prop: 'seriousInjuredPerson',
            prop: 'seriousInjuryPerson',
            span: 8,
            type: 'input',
            append: '人'
@@ -612,7 +599,7 @@
      policeResourcesForm: {},
      isDetail: false,
      mapLocation:{
        isDetail:false
        isDetail:true
      },
    }
  },
@@ -620,12 +607,16 @@
    if (this.info) {
      this.initDetail()
    } else {
      this.form = this.$route.params
      this.initSupplement()
    }
  },
  methods: {
    submit(form, done) {
      form.fireId = this.form.id
      if (!form.fireId){
        this.$message.warning("请填写需要补录的火灾编号");
        return
      }
      form.economicLoss = this.economicData
      form.damageArea = this.damageAreaData
      form.policeResources = this.policeResourcesData
@@ -760,10 +751,48 @@
        location:[this.form.lon,this.form.lat]
      }
    },
    //补录
    initSupplement(){
      this.form = this.$route.params
      if (this.form.id){
        this.option.detail = true
        this.mapLocation = {
          isDetail: true,
          location:[this.form.lon,this.form.lat]
        }
      }
    },
    //返回列表页
    goToList() {
      this.isDetail = false
      this.$emit('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
          })
          cb(data)
        }
      })
    },
    //选择事件
    handleSelect(item){
      Object.assign(this.form,item)
      this.mapLocation = {
        isDetail:true,
        location:[this.form.lon,this.form.lat]
      }
      this.$refs.olMap.addPoint(this.mapLocation.location)
    }
  },
  destroyed() {
    //点击其他菜单时会关闭当前页,防止出现多个相同tab
    this.$router.$avueRouter.closeTag("/fire/fireSupplement")
  }
}
</script>