Newer
Older
dcms_front / src / views / callCase / callCase.vue
<template>
  <app-container>
    <div class="main-form">
      <el-form ref="dataForm" :model="caseForm" :label-position="labelPosition" :rules="rules" label-width="80px" size="small">
        <div class="top-block">
          <div class="form-row">
            <div class="form-item">
              <el-form-item label="举报人" prop="reporterName">
                <el-input v-model.trim="caseForm.reporterName" type="text" placeholder="必填" clearable />
              </el-form-item>
            </div>
            <div class="form-item">
              <el-form-item label="联系电话" prop="reporterPhone">
                <el-input v-model.trim="caseForm.reporterPhone" type="text" placeholder="必填" clearable />
              </el-form-item>
            </div>
            <div class="form-item">
              <el-form-item label="信息来源" prop="source">
                <el-select v-model="caseForm.source" placeholder="选择信息来源" clearable value="">
                  <el-option
                    v-for="item in caseSourceOpts"
                    :key="item.value"
                    :label="item.name"
                    :value="item.value"/>
                </el-select>
              </el-form-item>
            </div>
            <div class="form-item">
              <el-form-item label="案卷等级" prop="caseLevel">
                <el-select v-model="caseForm.caseLevel" placeholder="选择案卷等级" value="">
                  <el-option
                    v-for="item in caseLevelOpts"
                    :key="item.value"
                    :label="item.name"
                    :value="item.value"/>
                </el-select>
              </el-form-item>
            </div>
            <div class="form-item form-item-button" style="">
              <el-button type="primary" size="small" icon="el-icon-document" @click="showHistoryList">历史记录</el-button>
              <el-button type="primary" size="small" icon="el-icon-search" @click="openMapQueryDialog">地图查询</el-button>
            </div>
          </div>
          <div class="form-row">
            <div class="form-item">
              <el-form-item label="所在区县" prop="areaCode">
                <el-select v-model="caseForm.areaCode" placeholder="选择所在区县" value="">
                  <el-option key="361024" label="崇仁县" value="361024"/>
                </el-select>
              </el-form-item>
            </div>
            <div class="form-item">
              <el-form-item label="所在乡镇" prop="streetCode">
                <el-select v-model="caseForm.streetCode" placeholder="选择所在街镇" value="">
                  <el-option key="361024100" label="巴山镇" value="361024100"/>
                </el-select>
              </el-form-item>
            </div>
            <div class="form-item">
              <el-form-item label="所在社区" prop="communityName">
                <el-input v-model="caseForm.communityName" class="el-input--suffix" type="text" placeholder="必填" readonly />
              </el-form-item>
            </div>
            <div v-if="caseForm.componentId !== ''" class="form-item">
              <el-form-item label="部件编码">
                <el-input v-model="caseForm.componentId" type="text" placeholder="必填" readonly />
              </el-form-item>
            </div>
            <div v-if="showVerifyPerson" class="form-item">
              <el-form-item label="监督员" prop="verifyPersonId">
                <el-select v-model="caseForm.verifyPersonId" type="text" placeholder="选择监督员" filterable clearable value="">
                  <el-option
                    v-for="item in verifyPersonOpts"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id">
                    <span style="float: left">{{ item.name }}</span>
                    <span style="float: right; color: #999999; font-size: 13px">{{ item.phone }}</span>
                  </el-option>
                </el-select>
              </el-form-item>
            </div>
          </div>
          <div class="form-row">
            <div class="form-item">
              <el-form-item label="案卷类别" prop="eorc">
                <el-select v-model="caseForm.eorc" placeholder="选择案卷类别" value="">
                  <el-option
                    v-for="item in caseEorCOpts"
                    :key="item.value"
                    :label="item.name"
                    :value="item.value"/>
                </el-select>
              </el-form-item>
            </div>
            <div class="form-item">
              <el-form-item label="案卷大类" prop="casetypeCode">
                <el-select v-model="caseForm.casetypeCode" placeholder="选择案卷大类" clearable value="">
                  <el-option
                    v-for="item in caseTypeOpts"
                    :key="item.id"
                    :label="item.typeName"
                    :value="item.typeCode"/>
                </el-select>
              </el-form-item>
            </div>
            <div class="form-item">
              <el-form-item label="案卷小类" prop="casetypeDetailCode">
                <el-select v-model="caseForm.casetypeDetailCode" placeholder="选择案卷小类" clearable value="">
                  <el-option
                    v-for="item in caseDetailTypeOpts"
                    :key="item.id"
                    :label="item.typeDetailName"
                    :value="item.typeDetailCode"/>
                </el-select>
              </el-form-item>
            </div>
            <div class="form-item">
              <el-form-item label="是否核实">
                <el-radio-group v-model="caseForm.isNeedVerify" size="small" @change="changeNeedVerify()">
                  <el-radio-button label="1">需要</el-radio-button>
                  <el-radio-button label="0">不需要</el-radio-button>
                </el-radio-group>
              </el-form-item>
            </div>
            <div class="form-item">
              <el-form-item label="是否回访">
                <el-radio-group v-model="caseForm.isNeedRevisit" size="small">
                  <el-radio-button label="1">需要</el-radio-button>
                  <el-radio-button label="0">不需要</el-radio-button>
                </el-radio-group>
              </el-form-item>
            </div>
          </div>
          <div v-if="showCaseTypesTime" class="form-row">
            <div class="form-item" style="width: 40%;display: block;padding-right: 19px;">
              <el-form-item label="立案标准" prop="casetypesTimeId">
                <el-select v-model="caseForm.casetypesTimeId" placeholder="选择立案标准" clearable value="" style="width: 100%">
                  <el-option
                    v-for="item in caseTypeTimeOpts"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"/>
                </el-select>
              </el-form-item>
            </div>
            <div class="form-item" style="width: 40%;display: block;padding-right: 19px;">
              <el-form-item label="处理时限" prop="bzhours">
                <el-input-number v-model="caseForm.bzhours" :min="0" style="width:100px;margin-right: 5px" />小时
                <el-input-number v-model="caseForm.bzminis" :min="0" :max="59" style="width:100px;margin-left: 20px; margin-right: 5px" />分钟
              </el-form-item>
            </div>
            <div class="form-item">
              <el-form-item label="选择部门" prop="deptId">
                <el-select v-model="caseForm.dispatchDeptId" filterable placeholder="请选择">
                  <el-option v-for="item in deptOpts" :key="item.id" :label="item.simplename" :value="item.id"/>
                </el-select>
              </el-form-item>
            </div>
          </div>
        </div>

        <div class="sub-block">
          <div class="form-row" style="display: block;width: 93%;">
            <el-form-item label="案卷描述" prop="description">
              <el-input v-model.trim="caseForm.description" type="textarea" placeholder="必填" maxlength="50" show-word-limit clearable />
            </el-form-item>
          </div>
          <div class="form-row" style="display: block;width: 93%;">
            <el-form-item label="发生地点" prop="fieldintro">
              <el-input v-model.trim="caseForm.fieldintro" type="text" placeholder="必填" maxlength="50" show-word-limit clearable />
            </el-form-item>
          </div>
        </div>

        <div class="sub-block">
          <el-form-item label="附件类型">
            <el-radio-group v-model="fileType" size="small" class="file-radio">
              <el-radio-button label="img">图片</el-radio-button>
              <el-radio-button label="audio">音频</el-radio-button>
              <el-radio-button label="video">视频</el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-form-item v-show="fileType==='img'" label="上传图片" prop="images">
            <el-upload
              ref="upload"
              :before-upload="handleBeforeUpload"
              :on-preview="handlePictureCardPreview"
              :on-remove="handleRemove"
              :on-exceed="handleExceed"
              :on-success="handleSuccess"
              :limit="2"
              :http-request="uploadFile"
              action="string"
              multiple
              accept=".jpg,.jpeg,.png "
              list-type="picture-card">
              <i class="el-icon-plus"/>
            </el-upload>
          </el-form-item>
          <el-form-item v-show="fileType==='video'" label="上传视频" prop="video">
            <video-upload
              :action="uploadPath"
              :token="token"
              @submitVideo="submitVideo"
              @beforeUpload="beforeUpload"
              @finishUpload="finishUpload"/>
          </el-form-item>
          <el-form-item v-show="fileType==='audio'" label="上传音频" prop="aduio">
            <audio-upload
              :action="uploadPath"
              :token="token"
              @submitAudio="submitAudio"
              @beforeUpload="beforeUpload"
              @finishUpload="finishUpload"/>
          </el-form-item>
          <el-row :gutter="20">
            <el-col :span="24" style="margin-bottom: 40px; text-align: center;">
              <el-button :disabled="submitDisable" type="primary" size="medium" icon="el-icon-check" style="width: 200px;" @click="saveData"> 提交 </el-button>
            </el-col>
          </el-row>
        </div>
      </el-form>

      <el-dialog :visible.sync="dialogVisible" title="图片预览" append-to-body>
        <div class="imgBox">
          <img :src="dialogImageUrl" max-height="400px;" alt="" style="margin: 0 auto;">
        </div>
      </el-dialog>

      <el-dialog
        :visible.sync="mapDialogVisible"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        title="地图查询"
        width="80%"
        append-to-body>

        <!--<tian-di-tu-map ref="map" @closeMapQueryDialogByEvent="closeMapQueryDialogByEvent" />-->
        <!--<arcgis-map-comp-->
        <!--ref="mapComp"-->
        <!--@closeMapQueryDialogByEvent="closeMapQueryDialogByEvent"-->
        <!--@closeMapQueryDialogByComp="closeMapQueryDialogByComp"/>-->
        <leaflet-map
          ref="mapComp"
          @closeMapQueryDialogByEvent="closeMapQueryDialogByEvent"
          @closeMapQueryDialogByComp="closeMapQueryDialogByComp"/>

      </el-dialog>

    </div>
  </app-container>
</template>

<script>
import { getCaseSource, getCaseLevel, getCaseEorC, getCaseType, getCaseDetailType, getCaseTypesTime, getVerifyPerson, addCase } from '@/api/callCase/callCase'
import { getDeptList } from '@/api/coorBusiness/case'
import { Uploadimg } from '@/api/common'
import LeafletMap from '@/components/Map/leafletMap'
import VideoUpload from './components/videoUpload'
import AudioUpload from './components/audioUpload'

export default {
  name: 'CallCase',
  components: {// 注册组件
    VideoUpload: VideoUpload,
    AudioUpload: AudioUpload,
    LeafletMap: LeafletMap
  },
  data() {
    const phoneValidator = (rule, value, callback) => {
      if (value !== '') {
        if ((/^[1][3,5,6,7,8,9][0-9]{9}$/).test(value) === false) {
          callback(new Error('举报人电话格式不正确'))
        } else {
          callback()
        }
      } else {
        callback(new Error('举报人电话不能为空'))
      }
    }
    const verifyPersonValidator = (rule, value, callback) => {
      if (value <= 0 && this.caseForm.isNeedVerify === '1') {
        callback(new Error('请选择监督员'))
      } else {
        callback()
      }
    }
    return {
      caseForm: {
        reporterName: '', // 举报人姓名
        reporterPhone: '', // 举报人电话
        isNeedVerify: '1', // 是否需要核实
        isNeedRevisit: '1', // 是否需要回访
        lng: '', // 经度,
        lat: '', // 纬度
        source: '', // 案卷信息来源
        caseLevel: '', // 案卷等级
        eorc: '', // 案卷类别
        casetypeCode: '', // 案卷大类编码,
        casetypeDetailCode: '', // 案卷小类编码
        areaCode: '361024', // 所属区县ID
        streetCode: '361024100', // 所属街道ID
        communityCode: '1', // 所属社区编码
        communityName: '活力大道', // 所属社区NAME
        gridId: '361024100001', // 万米网格ID(单元网格)
        componentId: '', // 部件ID
        casetypesTimeId: '', // 立案标准ID
        bzhours: 0, // 限制完成总时限(小时)
        bzminis: 0, // 限制完成总时限(分钟)
        description: '', // 案件描述
        fieldintro: '', // 位置描述
        verifyPersonId: '', // 核实人员id
        dispatchDeptId: '', // 处置部门id
        fileIdVerify: '', // 图片存储的地址
        videoIdVerify: '', // 视频地址
        audioIdVerify: '' // 音频地址
      }, // 表单
      rules: {
        reporterName: [{ required: true, message: '举报人姓名不能为空', trigger: ['blur'] }],
        reporterPhone: [{ required: true, trigger: ['blur'], validator: phoneValidator }],
        source: [{ required: true, message: '信息来源不能为空', trigger: ['blur'] }],
        caseLevel: [{ required: true, message: '案卷等级不能为空', trigger: ['blur'] }],
        eorc: [{ required: true, message: '案卷类别不能为空', trigger: ['blur'] }],
        casetypeCode: [{ required: true, message: '案卷大类不能为空', trigger: ['blur'] }],
        casetypeDetailCode: [{ required: true, message: '案卷小类不能为空', trigger: ['blur'] }],
        description: [{ required: true, message: '案卷描述不能为空', trigger: ['blur'] }],
        fieldintro: [{ required: true, message: '位置描述不能为空', trigger: ['blur'] }],
        verifyPersonId: [{ required: false, trigger: ['blur'], validator: verifyPersonValidator }]
      }, // 表单验证
      hideUpload: false,
      fileList: [],
      videoList: [],
      audioList: [],
      uploadPath: this.baseConfig.baseUrl + '/file/upload', // 图片上传路径
      token: '',
      dialogImageUrl: '',
      dialogVisible: false,
      mapDialogVisible: false, // 地图对话框
      labelPosition: 'right',
      caseSourceOpts: [], // 案卷来源下拉框
      caseLevelOpts: [], // 案卷等级下拉框
      caseEorCOpts: [], // 案卷类别下拉框
      caseTypeOpts: [], // 案卷大类下拉框
      caseDetailTypeOpts: [], // 案卷小类下拉框
      caseTypeTimeOpts: [], // 立案标准下拉框
      verifyPersonOpts: [], // 监督员下拉框
      deptOpts: [],
      showVerifyPerson: true,
      showCaseTypesTime: false,
      caseTypeCodeAuto: '', // 自动生成的案卷大类代码
      caseTypeDetailCodeAuto: '', // 自动生成的案卷小类代码
      fileType: '', // 附件类型
      submitDisable: false
    }
  },
  computed: {
    caseLevel() {
      return this.caseForm.caseLevel
    },
    eorc() {
      return this.caseForm.eorc
    },
    caseType() {
      return this.caseForm.casetypeCode
    },
    caseTypeDetail() {
      return this.caseForm.casetypeDetailCode
    },
    caseTypeDetailTime() {
      return this.caseForm.casetypesTimeId
    }
  },
  watch: {
    caseLevel(level) {
      this.calculateTime(this.caseForm.casetypesTimeId)
    },
    eorc(eorcVal) {
      this.cascaderCaseType(eorcVal)
    },
    caseType(typeVal) {
      this.cascaderCaseDetailType(typeVal)
    },
    caseTypeDetail(detailVal) {
      this.cascaderCaseDetailTypeTime(detailVal)
    },
    caseTypeDetailTime(timeVal) {
      this.calculateTime(timeVal)
      this.setDefaultDispatchDept(timeVal)
    }
  },
  mounted: function() {
    this.initCaseSource()
    this.initCaseLevel()
    this.initCaseEorC()
    this.initDept()
    this.initVerifyPerson()

    this.token = this.$store.getters.token
  },
  methods: {

    submitVideo(videoList) {
      console.log('videoList', videoList)
      this.videoList = videoList
    },
    submitAudio(audioList) {
      console.log('audioList', audioList)
      this.audioList = audioList
    },
    initDept() {
      getDeptList().then(response => {
        this.deptOpts = response.data
      })
    },
    initCaseForm: function() {
      this.caseForm.reporterName = ''
      this.caseForm.reporterPhone = ''
      this.caseForm.isNeedVerify = '1'
      this.caseForm.isNeedRevisit = '1'
      this.caseForm.lng = ''
      this.caseForm.lat = ''
      this.caseForm.communityCode = ''
      this.caseForm.communityName = ''
      this.caseForm.gridId = ''
      this.caseForm.componentId = ''
      this.caseForm.casetypesTimeId = ''
      this.caseForm.bzhours = 0
      this.caseForm.bzminis = 0
      this.caseForm.description = ''
      this.caseForm.fieldintro = ''
      this.caseForm.verifyPersonId = ''
      this.caseForm.fileIdVerify = ''
      this.caseForm.videoIdVerify = ''
      this.caseForm.audioIdVerify = ''
      this.caseForm.dispatchDeptId = ''
      this.caseForm.eorc = ''
      this.caseForm.casetypeCode = ''
      this.caseForm.casetypeDetailCode = ''

      this.$refs.upload.clearFiles()
    },
    initCaseSource: function() {
      getCaseSource().then(response => {
        this.caseSourceOpts = []
        for (const opt of response.data) {
          this.caseSourceOpts.push(opt)
          if (opt.name.indexOf('电话') >= 0) {
            this.caseForm.source = opt.value
          }
        }
      })
    },
    initCaseLevel: function() {
      getCaseLevel().then(response => {
        this.caseLevelOpts = []
        for (const opt of response.data) {
          this.caseLevelOpts.push(opt)
          if (opt.name.indexOf('一般') >= 0) {
            this.caseForm.caseLevel = opt.value
          }
        }
      })
    },
    initCaseEorC: function() {
      getCaseEorC().then(response => {
        this.caseEorCOpts = []
        for (const opt of response.data) {
          this.caseEorCOpts.push(opt)
        }
      })
    },
    initVerifyPerson: function() {
      getVerifyPerson().then(response => {
        this.verifyPersonOpts = []
        for (const opt of response.data) {
          this.verifyPersonOpts.push(opt)
        }
      })
    },
    // 级联查询案卷大类
    cascaderCaseType: function(eorc) {
      // 前两行的作用是清除案卷大类的当前值和select中的所有选项
      this.caseTypeOpts = []
      this.caseForm.casetypeCode = ''
      // 以下两行的作用是清除案卷小类的当前值和select中的所有选项
      this.caseDetailTypeOpts = []
      this.caseForm.casetypeDetailCode = ''
      // 以下两行是清除案卷时限(小时和分钟)
      this.caseTypeTimeOpts = []
      this.caseForm.casetypesTimeId = ''
      this.caseForm.bzhours = 0
      this.caseForm.bzminis = 0
      this.caseForm.dispatchDeptId = ''

      // 若事部件选择的值不为空,则查询相应的案卷大类
      if (eorc !== null && eorc.length > 0) {
        getCaseType(eorc).then(response => {
          for (const opt of response.data) {
            this.caseTypeOpts.push(opt)

            if (opt.typeCode === this.caseTypeCodeAuto) {
              this.caseForm.casetypeCode = opt.typeCode
            }
          }
        })
      }
    },
    cascaderCaseDetailType: function(typeCode) {
      // 以下两行的作用是清除案卷小类的当前值和select中的所有选项
      this.caseDetailTypeOpts = []
      this.caseForm.casetypeDetailCode = ''
      // 以下两行是清除案卷时限(小时和分钟)
      this.caseTypeTimeOpts = []
      this.caseForm.casetypesTimeId = ''
      this.caseForm.bzhours = 0
      this.caseForm.bzminis = 0
      this.caseForm.dispatchDeptId = ''

      // 根据code获取ID,进行级联查询
      let typeId = 0
      this.caseTypeOpts.forEach(item => {
        if (item.typeCode === typeCode) {
          typeId = item.id
        }
      })

      if (typeId > 0) {
        getCaseDetailType(typeId).then(response => {
          for (const opt of response.data) {
            this.caseDetailTypeOpts.push(opt)

            if (opt.typeDetailCode === this.caseTypeDetailCodeAuto) {
              this.caseForm.casetypeDetailCode = opt.typeDetailCode
            }
          }
        })
      }
    },
    // 查询立案标准
    cascaderCaseDetailTypeTime: function(detailCode) {
      // 以下两行是清除案卷时限(小时和分钟)
      this.caseTypeTimeOpts = []
      this.caseForm.casetypesTimeId = ''
      this.caseForm.bzhours = 0
      this.caseForm.bzminis = 0
      this.caseForm.dispatchDeptId = ''

      // 根据code获取ID,进行级联查询
      let typeDetailId = 0
      this.caseDetailTypeOpts.forEach(item => {
        if (item.typeDetailCode === detailCode) {
          typeDetailId = item.id
        }
      })

      if (typeDetailId > 0) {
        getCaseTypesTime(typeDetailId).then(response => {
          for (const opt of response.data) {
            this.caseTypeTimeOpts.push(opt)
          }
        })
      }
    },
    calculateTime: function(timeVal) {
      const hoursPerDay = this.caseForm.caseLevel === '1' ? 8 : 24
      let day = 0
      let hours = 0
      this.caseTypeTimeOpts.forEach(item => {
        if (item.id === timeVal) {
          day = item.day
          hours = item.hours
        }
      })

      this.caseForm.bzhours = hoursPerDay * parseInt(day) + parseInt(hours)
    },
    setDefaultDispatchDept(timeVal) {
      this.caseTypeTimeOpts.forEach(item => {
        if (item.id === timeVal) {
          this.caseForm.dispatchDeptId = item.deptId
        }
      })
    },
    // 打开地图查询对话框显示地图
    openMapQueryDialog: function() {
      this.mapDialogVisible = true
    },
    // 关闭地图查询对话框
    closeMapQueryDialogByEvent: function(longitude, latitude, communityId, communityName, gridId) {
      this.mapDialogVisible = false
      // debugger
      // 赋值
      this.caseForm.eorc = '1' // 事件点返回时案卷类别自动选择为事件
      this.caseForm.communityCode = communityId
      this.caseForm.communityName = communityName
      this.caseForm.gridId = gridId
      this.caseForm.lng = longitude
      this.caseForm.lat = latitude

      this.caseForm.areaCode = gridId.substring(0, 6) // 区县代码
      this.caseForm.streetCode = gridId.substring(0, 9) // 街道代码
    },
    // 关闭地图查询对话框
    closeMapQueryDialogByComp: function(longitude, latitude, communityId, communityName, gridId, componentId, componentName) {
      this.mapDialogVisible = false
      console.log(communityId, gridId)
      // 赋值
      this.caseForm.eorc = '2' // 部件点返回时案卷类别自动选择为部件
      this.caseForm.communityCode = communityId
      this.caseForm.communityName = communityName
      this.caseForm.gridId = gridId
      this.caseForm.lng = longitude
      this.caseForm.lat = latitude
      this.caseForm.componentId = componentId
      this.caseForm.componentName = componentName

      // console.log(componentId,componentId.substring(6, 8),componentId.substring(8, 10))

      this.caseForm.areaCode = gridId.substring(0, 6) // 区县代码
      this.caseForm.streetCode = gridId.substring(0, 9) // 街道代码
      this.caseTypeCodeAuto = componentId.substring(6, 8) // 自动赋值部件大类
      this.caseTypeDetailCodeAuto = componentId.substring(8, 10) // 自动赋值部件小类
    },
    // 修改是否需要核实
    changeNeedVerify: function() {
      if (this.caseForm.isNeedVerify === '0') {
        // 不需要核实,显示立案标准、处理时限
        this.showVerifyPerson = false
        this.showCaseTypesTime = true
      } else {
        this.showVerifyPerson = true
        this.showCaseTypesTime = false
      }
    },
    // 保存数据
    saveData: function() {
      const that = this
      if (this.fileList.length > 0) {
        let photos = ''
        this.fileList.forEach(photo => {
          photos += photo.url + ','
        })
        this.caseForm.fileIdVerify = photos.substring(0, photos.length - 1)
      }

      if (this.videoList.length > 0) {
        let videos = ''
        this.videoList.forEach(video => {
          videos += video.simpleUrl + ','
        })
        this.caseForm.videoIdVerify = videos.substring(0, videos.length - 1)
      }

      if (this.audioList.length > 0) {
        let audios = ''
        this.audioList.forEach(audio => {
          audios += audio.url + ','
        })
        this.caseForm.audioIdVerify = audios.substring(0, audios.length - 1)
      }
      console.log('submit form', this.caseForm)
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {
          if (!this.checkCaseTime()) {
            return
          }
          addCase(this.caseForm).then(function(response) {
            if (response.code === 200) {
              that.$message({
                message: '添加案卷成功',
                type: 'success'
              })

              // 重新赋值
              that.initCaseForm()

              that.$router.push({ path: '/supWork' })
            } else {
              that.$message({
                message: '添加案卷失败',
                type: 'error'
              })
            }
          })
        }
      })
    },
    checkCaseTime() {
      if (this.caseForm.isNeedVerify === '0') {
        if (!this.caseForm.casetypesTimeId) {
          this.$message.error('请选择立案标准')
          return false
        }
        if (!this.caseForm.dispatchDeptId) {
          this.$message.error('请选择处置部门')
          return false
        }
      }
      return true
    },
    // 图片上传
    uploadFile(file) {
      console.log('uploadFile:' + file.file.name)
      // const base_url = process.env.BASE_API + '/static/'
      this.submitDisable = true
      Uploadimg(file).then(res => {
        if (res.code === 200) {
          this.fileList.push({ name: file.file.name, url: res.data })
        }
        this.submitDisable = false
      })
    },
    // 上传前判断文件格式及大小
    handleBeforeUpload(file) {
      const isJPG = (file.type === 'image/jpeg') || (file.type === 'image/png')
      let res = true
      const isLt2M = file.size / 1024 / 1024 < 2
      if (!isJPG) {
        this.$message.error('上传图片只能是 JPG 或 PNG 格式!')
        res = false
      }
      if (!isLt2M) {
        this.$message.error('上传图片大小不能超过 2MB!')
        res = false
      }
      for (const i in this.fileList) {
        if (this.fileList[i].name === file.name) {
          this.$message.error('该图片已上传过,请选择其他图片')
          res = false
        }
      }
      return res
    },
    // 文件列表移除文件时的钩子
    handleRemove(file, fileList) {
      console.log('handleRemove')
      for (const i in this.fileList) {
        if (this.fileList[i].name === file.name) {
          this.fileList.splice(i, 1)
          this.hideUpload = this.fileList.length >= 2
          return
        }
      }
      this.handleChange()
    },
    // 限制提示
    handleExceed(files, fileList) {
      console.log('handleExceed')
      this.$message.warning(`限制选择 2 张图片,本次选择了 ${files.length} 张图片,共选择了 ${files.length + fileList.length} 张图片`)
    },
    // 点击文件列表中已上传的文件时的钩子
    handlePictureCardPreview(file) {
      console.log('handlePictureCardPreview')
      this.dialogImageUrl = file.url
      this.dialogVisible = true
    },
    handleChange(file, fileList) {
      console.log('handleChange')
      if (fileList) {
        this.hideUpload = fileList.length >= 2
      } else {
        this.hideUpload = false
      }
    },
    handleSuccess(response, file, fileList) {
      console.log('handleSuccess')
      const base_url = process.env.BASE_API + '/static/'
      if (response.code === 200) {
        this.fileList.push({ name: file.file.name, url: base_url + response.data })
        this.handleChange()
      } else {
        this.$message.warning(response.message)
      }
    },
    showHistoryList() {
      if (!this.caseForm.reporterPhone) {
        this.$message.error('请填写举报人电话!')
        return
      }
      this.$router.push({
        path: '/historyCaseList',
        query: {
          reporterPhone: this.caseForm.reporterPhone
        }
      })
    },
    beforeUpload() {
      console.log('before')
      this.submitDisable = true
    },
    finishUpload() {
      console.log('finish')
      this.submitDisable = false
    }
  }
}
</script>

<style lang="scss" scoped>
  .main-form{
    //padding: 20px;
  }
  .form-row{
    display: -webkit-flex;  /* 新版本语法: Chrome 21+ */
    display: -webkit-box;   /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
    display: -moz-box;      /* 老版本语法: Firefox (buggy) */
    display: -ms-flexbox;   /* 混合版本语法: IE 10 */
    display: flex;          /* 新版本语法: Opera 12.1, Firefox 22+ */
  }
  .form-item{
    display: -webkit-flex;  /* 新版本语法: Chrome 21+ */
    display: -webkit-box;   /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
    display: -moz-box;      /* 老版本语法: Firefox (buggy) */
    display: -ms-flexbox;   /* 混合版本语法: IE 10 */
    display: flex;          /* 新版本语法: Opera 12.1, Firefox 22+ */
    width: 20%;
    padding-right: 20px;
  }
  .form-item-button{
    display: -webkit-flex;  /* 新版本语法: Chrome 21+ */
    display: -webkit-box;   /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
    display: -moz-box;      /* 老版本语法: Firefox (buggy) */
    display: -ms-flexbox;   /* 混合版本语法: IE 10 */
    display: flex;          /* 新版本语法: Opera 12.1, Firefox 22+ */
    padding-left: 10px;
    height: fit-content;
    height: 30px;
  }
  .top-block{
    padding: 20px;
  }
  .sub-block {
    border-top: 12px solid #ebebeb;
    padding: 20px;
  }
  .file-radio {
    //margin: 10px;
  }
  .el-radio-group {
    display: flex;
  }

  /deep/ .el-input__count-inner, .el-input__count{
    line-height: initial !important
  }
</style>