<template>
  <el-dialog v-loading="loading" v-if="dialogVisible" :visible.sync="dialogVisible" title="详情">
    <el-form ref="form" :model="form" label-width="150px">
      <el-form-item label="应急预案名称:" prop="FILE_NAME">
        <el-input v-model="form.REMARKS" disabled style="width: 70%"/>
      </el-form-item>
      <el-form-item label="预案类别:" prop="FILE_NAME">
        <el-tag
          v-for="tag in form.TYPES"
          :key="tag.value"
          :disable-transitions="false"
          style="margin-right: 10px">
          {{ tag.CATEGORY_NAME }}
        </el-tag>
      </el-form-item>
      <el-form-item label="国民经济行业分类:" prop="FILE_NAME">
        <el-tag
          v-for="tag in form.CATEGORY_LIST"
          :key="tag.value"
          :disable-transitions="false"
          style="margin-right: 10px">
          {{ tag.CATEGORY_NAME }}
        </el-tag>
      </el-form-item>
      <el-form-item label="预案类型:" prop="FILE_NAME">
        <el-tag
          v-for="tag in form.SPECIFICATION_TYPES"
          :key="tag.value"
          :disable-transitions="false"
          style="margin-right: 10px">
          {{ tag.CATEGORY_NAME }}
        </el-tag>
      </el-form-item>
      <el-form-item label="预案属性:" prop="ATTRIBUTE_LIST">
        <el-tag
          v-for="tag in form.ATTRIBUTE_LIST"
          :key="tag.value"
          :disable-transitions="false"
          style="margin-right: 10px">
          {{ tag.CATEGORY_NAME }}
        </el-tag>
      </el-form-item>
      <el-form-item label="状态:" prop="STATUS">
        <el-select v-model="form.STATUS" disabled placeholder="请选择" style="width: 100%;">
          <el-option label="停用" value="0"/>
          <el-option label="启用" value="1"/>
        </el-select>
      </el-form-item>
      <el-form-item label="上传时间:" prop="FILE_NAME">
        <el-input v-model="form.UPLOAD_TIME" disabled style="width: 70%"/>
      </el-form-item>
      <el-form-item label="上传人:" prop="FILE_NAME">
        <el-input v-model="form.UPLOAD_USER_NAME" disabled style="width: 70%"/>
      </el-form-item>
      <el-form-item prop="tags" label="标签">
        <el-tag
          v-for="tag in form.labels"
          :key="tag.value"
          :disable-transitions="false"
          style="margin-right: 10px">
          {{ tag.NAME }}
        </el-tag>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="goBack">返 回</el-button>
    </div>
  </el-dialog>
</template>
<script>
import Pagination from '@/components/Pagination'
import waves from '@/directive/waves'
import { requestFN } from '@/utils/request'
import multipleChoice from '../../../util/multipleChoice.vue'

export default {
  components: { multipleChoice, Pagination },
  directives: { waves },
  data() {
    return {
      dialogVisible: false,
      form: {
        FILE_NAME: '',
        FILE: [],
        TYPE: '',
        labels: [],
        UPLOAD_TIME: '',
        UPLOAD_USER_NAME: ''
      },
      loading: false
    }
  },
  methods: {
    init(e) {
      this.dialogVisible = true
      this.loading = true
      this.e = e.e
      requestFN(
        '/textLibrary/goEdit',
        {
          BUS_TEXT_LIBRARY_ID: this.e.BUS_TEXT_LIBRARY_ID
        }
      ).then((data) => {
        this.loading = false
        this.form = data.data
        this.form.FILE = []
      }).catch((e) => {
        this.$message.error(e)
        this.loading = false
      })
    },
    goBack() {
      this.dialogVisible = false
      this.$emit('goBack', this.e)
    }
  }
}

</script>
