<template>
  <div class="edu-training-edit">
    <DialogCom title="演练范本详情" :visible.sync="isShow" width="1000px" append-to-body>
      <div class="page-body">
        <el-descriptions
          class="contentArea"
          :column="1"
          size="medium"
          border
          :contentStyle="content_style"
          :label-style="labelStyle"
        >
          <el-descriptions-item labelClassName="gx_info_label" label="演练项目">
            {{
              getLabel(dict.type.core_drill_type, formData.drillType, "未知")
            }}
          </el-descriptions-item>
          <el-descriptions-item labelClassName="gx_info_label" label="演练场景">
            {{ formData.drillProjects }}
          </el-descriptions-item>
          <el-descriptions-item
            labelClassName="gx_info_label"
            span="2"
            label="预设案由"
          >
            <span class="text_nbsp"> {{ formData.defaultCause }}</span>
          </el-descriptions-item>
        </el-descriptions>
      </div>

      <div slot="footer" class="dialog-footer">
        <el-button @click="onHide">关闭</el-button>
      </div>
    </DialogCom>
  </div>
</template>

<script>
import { mapState, mapMutations } from "vuex";
import { getDrillDictionary } from "@/api/core/drill/drillDictionary";
import { getLabel } from "@/views/commonOption";
export default {
  components: { },
  dicts: ["drill_task_status", "core_drill_type"],
  data() {
    const params = this.$route.params;
    return {
      id: params ? params.id : null,
      isShow: false,
      formData: this.reset(),
      drillTypeOptions: [],
      formFileListDefualtValue: [],
      labelStyle: {
        color: "#000",
        "text-align": "center",
        height: "40px",
        "min-width": "150px",
        "word-break": "keep-all",
      },
      content_style: {
        "text-align": "left",
        "min-width": "300px",
        "word-break": "break-all",
      },
      iconClasses: ["icon-rate-face-1", "icon-rate-face-2", "icon-rate-face-3"], // 等同于 { 2: 'icon-rate-face-1', 4: { value: 'icon-rate-face-2', excluded: true }, 5: 'icon-rate-face-3' }
    };
  },
  props: {},
  watch: {},
  computed: {
    ...mapState(["loginUser"]),
  },
  methods: {
    ...mapMutations([]),
    getLabel,
    reset(other = {}) {
      return {
        id: null,
        drillType: null,       
        defaultCause: null,
        drillProjects: null,
        ...other,
      };
    },
    async refresh(id, other) {
      if (!id) {
        this.reset(other);
      } else {
        getDrillDictionary(id).then((response) => {
          this.formData = response.data;
          this.loading = false;
      });
        // getDrillTask(id).then((response) => {
        //   this.formData = response.data;
        //   this.formFileListDefualtValue = response.data.fileList;
        //   this.formData.signImageList = this.getSingImageList();
        //   this.loading = false;
        // });
      }
    },
    async show(id, other = {}) {
      this.id = id;
      await this.refresh(id, other);
      this.isShow = true;
    },
    // 事件
    onHide() {
      this.isShow = false;
    },
    initDrillTypeOptions() {
      initList().then((response) => {
        this.drillTypeOptions = response;
      });
    },
    // 事件
    //apimark//
  },
  mounted() {},
};
</script>

<style lang="scss" scoped></style>
