<!--
 * @Author: SunTao 328867980@qq.com
 * @Date: 2025-03-25 11:10:16
 * @LastEditors: SunTao 328867980@qq.com
 * @LastEditTime: 2025-03-25 16:25:50
 * @FilePath: \znxjxt-ui\src\views\xj\inspection\map-diease\index.vue
 * @Description: 地图展示病害-首页
-->
<template>
  <div class="map-diease-content">
    <div class="diease-form">
      <el-form :model="queryParams" :rules="rules" ref="queryForm" size="small" :inline="true" label-width="100px">
        <el-form-item label="道路名称" prop="segmentId">
          <el-select v-model="queryParams.segmentId" placeholder="请选择路段" filterable clearable>
            <el-option v-for="item in segmentList" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
        </el-form-item>
        <el-form-item label="距离" prop="maxLength">
          <el-input placeholder="请输入内容" v-model="queryParams.maxLength">
            <template slot="prepend">大于:</template>
          </el-input>
        </el-form-item>
        <el-form-item label="">
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">筛选</el-button>
        </el-form-item>
      </el-form>
    </div>
    <fssm-map class="map-diease-map"></fssm-map>
  </div>
</template>

<script>
import { getSegment } from '@/api/xj/mapDisease'
import fssmMap from '@/components/map/fssm-map.vue'
export default {
  components: { fssmMap },
  name: 'MapDiease',
  data() {
    return {
      // 搜索表单
      queryParams: {
        // 道路名称
        segmentId: "",
        // 距离小于
        maxLength: "",
      },
      // 表单规则
      rules: {
        maxLength: [
          { required: false, message: '请选择路段', trigger: 'blur' },
          {
            pattern: /^\d+$/,
            message: "请输入非负整数",
          }
        ]
      },
      // 道路名称下拉数据
      segmentList: []
    }
  },
  created() {
    this.getSegmentList()
  },
  methods: {
    /**
   * @description: 获取路段下拉数据
   * @param {*} val
   * @return {*}
   */
    getSegmentList() {
      getSegment().then(({ code, data }) => {
        if (code === 200) {
          this.segmentList = data;
        }
      });
    },

    /**
   * @description: 筛选事件
   * @param {*}
   * @return {*}
   */
    handleQuery() {
      this.$refs.queryForm.validate(valid => {
        if (valid) {
          this.drawMapPoint();
        }
      });
    },

    /**
   * @description: 绘制点位
   * @param {*}
   * @return {*}
   */
    drawMapPoint() {

    }
  }
}
</script>

<style lang="scss" scoped>
.map-diease-content {
  width: 100%;
  height: calc(100vh - 5.3rem);
  padding: 0.5rem;
  box-sizing: border-box;

  .diease-form {
    width: 100%;
    height: 6%;
  }

  .map-diease-map {
    width: 100%;
    height: 94%;
  }
}
</style>
