<template>
  <el-drawer
    :title="`[` + form.mplanNo + `]检修月计划管理`"
    :visible.sync="visible"
    :size="650"
    destroy-on-close
    @closed="$emit('closed')"
  >
    <el-container v-loading="loading">
      <el-main>
        <el-form>
          <el-row :gutter="24">
            <el-col :lg="12">
              <el-form-item label="线路名称" prop="lineName">
                <template>
                  {{ form.lineName }}
                </template>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :lg="12">
              <el-form-item label="月计划编号" prop="mplanNo"
                >{{ form.mplanNo }}
              </el-form-item>
            </el-col>
            <el-col :lg="12">
              <el-form-item label="状态" prop="mplanSt">
                <el-tag type=""> {{ monthPlanStateMap[form.mplanSt] }}</el-tag>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row :gutter="24">
            <el-col :lg="12">
              <el-form-item label="开始时间" prop="startTm"
                >{{ form.startTm }}
              </el-form-item>
            </el-col>
            <el-col :lg="12">
              <el-form-item label="结束时间" prop="endTm">
                {{ form.endTm }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :lg="12">
              <el-form-item label="工作单位" prop="orgNm"
                >{{ form.orgNm }}
              </el-form-item>
            </el-col>
            <el-col :lg="12">
              <el-form-item label="所属县公司" prop="workOrgNm"
                >{{ form.workOrgNm }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :lg="12">
              <el-form-item label="用户数" prop="consNum"
                >{{ form.consNum }}
              </el-form-item>
            </el-col>
            <el-col :lg="12">
              <el-form-item label="时户数" prop="hourNum"
                >{{ form.hourNum }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24" v-if="form.isMaintenance > 0">
            <el-col :lg="24">
              <el-form-item label="检修方案" prop="maintenanceFileName">
                <a
                  v-if="form.isMaintenance == 2"
                  :href="form.maintenanceFilePath"
                  style="color: #00afff; cursor: pointer"
                  >{{ form.maintenanceFileName }}</a
                >
                <span v-else>待上传</span>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24" v-if="form.isApprove > 0">
            <el-col :lg="24">
              <el-form-item label="审批手续" prop="approveFileName">
                <a
                  v-if="form.isApprove == 2"
                  :href="form.approveFilePath"
                  style="color: #00afff; cursor: pointer"
                  >{{ form.approveFileName }}</a
                >
                <span v-else>待上传</span>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <el-footer style="text-align: center">
          <el-button @click="visible = false">关闭</el-button>
        </el-footer>
      </el-main>
    </el-container>
  </el-drawer>
</template>

<script>
export default {
  emits: ["success", "closed"],
  components: {},
  data() {
    return {
      loading: false,
      form: {},
      visible: false,
      isSaveing: false,
      monthPlanStateMap: {},
    };
  },
  mounted() {},
  methods: {
    // 作业类型
    async getMonthPlanStateList() {
      const { data = [] } = await this.getDicts("pdm_mplan_st");
      data.forEach((ite) => {
        this.monthPlanStateMap[ite.dictValue] = ite.dictLabel;
      });
    },
    //显示
    open() {
      this.visible = true;
      return this;
    },
    //表单注入数据
    async setData(data) {
      await this.getMonthPlanStateList();
      data.isMaintenance = Number(data.isMaintenance);
      data.isApprove = Number(data.isApprove);
      this.form = data;
    },
  },
};
</script>

<style></style>
