<template>
  <el-dialog
    append-to-body
    :close-on-click-modal="false"
    :visible="show"
    :title="isDeal ? '报警处理' : '报警查看'"
    @close="handleCancel"
    width="500px"
  >
    <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
      <el-form-item label="报警时间" prop="alarmTime">
        <el-input v-model="form.alarmTime" style="width: 370px" />
      </el-form-item>
      <el-form-item label="报警位置" prop="location">
        <el-input v-model="form.location" style="width: 370px" />
      </el-form-item>
      <el-form-item label="报警内容" prop="alarmContent">
        <el-input v-model="form.alarmContent" style="width: 370px" />
      </el-form-item>
      <el-form-item label="报警图片" prop="imageUrl">
        <div class="image-box" v-if="form.imageUrl">
          <el-image
            fit="contain"
            :src="`${VUE_APP_BASE_API}${form.imageUrl.replace('\/\/', '/')}`"
            :preview-src-list="[`${VUE_APP_BASE_API}${form.imageUrl.replace('\/\/', '/')}`]"
          />
        </div>
      </el-form-item>
      <el-form-item label="处理信息" prop="dealContent">
        <el-input type="textarea" v-model="form.dealContent" style="width: 370px" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="text" @click="handleCancel">取消</el-button>
      <el-button :loading="loading" type="primary" @click="handleConfirm">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'AlarmDetailDialog',
  props: {
    isDeal: {
      type: Boolean,
      default: false,
    },
    show: {
      type: Boolean,
      default: false,
    },
    form: {
      type: Object,
      default() {
        return {}
      },
    },
  },
  data() {
    return {
      VUE_APP_BASE_API: process.env.VUE_APP_BASE_API,
      loading: false,
      rules: {},
    }
  },
  computed: {},
  methods: {
    handleCancel() {
      this.$emit('update:show', false)
    },
    handleConfirm() {},
  },
}
</script>

<style></style>
