<template>
  <!-- 弹出框表单 -->
  <el-drawer
    :title="title"
    :visible.sync="open"
    :direction="direction"
    :destroy-on-close="true"
    size="50%"
  >
    <el-form ref="form" :model="form" :rules="rules" label-width="120px">
      <el-row>
        <Field
          label="记录ID"
          prop="recordId"
          v-model="form.recordId"
          placeholder="请输入记录ID"
        />
        <Field
          label="考核年度"
          prop="year"
          v-model="form.year"
          placeholder="请输入考核年度"
        />
        <Field
          label="考核月份"
          prop="month"
          v-model="form.month"
          placeholder="请输入考核月份"
        />
        <Field
          label="窗口ID"
          prop="windowId"
          v-model="form.windowId"
          placeholder="请输入窗口ID"
        />
        <Field
          label="窗口名称"
          prop="windowName"
          v-model="form.windowName"
          placeholder="请输入窗口名称"
        />
        <Field
          label="窗口负责人id"
          prop="ownerId"
          v-model="form.ownerId"
          placeholder="请输入窗口负责人id"
        />
        <Field
          label="窗口负责人名称"
          prop="ownerName"
          v-model="form.ownerName"
          placeholder="请输入窗口负责人名称"
        />
        <Field
          label="所属部门id"
          prop="deptId"
          v-model="form.deptId"
          placeholder="请输入所属部门id"
        />
        <Field
          label="所属部门名称"
          prop="deptName"
          v-model="form.deptName"
          type="textarea"
          placeholder="请输入所属部门名称"
        />
        <Field
          label="所属大厅"
          prop="salaId"
          v-model="form.salaId"
          placeholder="请输入所属大厅"
        />
        <Field
          label="所属大厅名称"
          prop="salaName"
          v-model="form.salaName"
          placeholder="请输入所属大厅名称"
        />
        <Field
          label="考核表单名称"
          prop="fromName"
          v-model="form.fromName"
          placeholder="请输入考核表单名称"
        />
        <Field
          label="合计得分"
          prop="sumScore"
          v-model="form.sumScore"
          placeholder="请输入合计得分"
        />
        <Field
          label="提交时间"
          prop="submitDate"
          v-model="form.submitDate"
          type="date"
        />
        <Field
          label="管理组核查人员"
          prop="manageCheckPerson"
          v-model="form.manageCheckPerson"
          placeholder="请输入管理组核查人员"
        />
        <Field
          label="管理组核查时间"
          prop="manageCheckTime"
          v-model="form.manageCheckTime"
          type="date"
        />
        <Field
          label="管理组核查说明"
          prop="manageCheckDesc"
          v-model="form.manageCheckDesc"
          type="textarea"
          placeholder="请输入管理组核查说明"
        />
        <Field
          label="管理组核查结果"
          prop="manageCheckResult"
          v-model="form.manageCheckResult"
          type="radio"
          :enumData="dict.manageCheckResult"
        />
        <Field
          label="领导组核查人员"
          prop="leaderCheckPerson"
          v-model="form.leaderCheckPerson"
          placeholder="请输入领导组核查人员"
        />
        <Field
          label="领导组核查时间"
          prop="leaderCheckTime"
          v-model="form.leaderCheckTime"
          type="date"
        />
        <Field
          label="领导组核查说明"
          prop="leaderCheckDesc"
          v-model="form.leaderCheckDesc"
          type="textarea"
          placeholder="请输入领导组核查说明"
        />
        <Field
          label="领导组核查结果"
          prop="leaderCheckResult"
          v-model="form.leaderCheckResult"
          type="radio"
          :enumData="dict.leaderCheckResult"
        />
        <Field
          label="处理状态"
          prop="checkStatus"
          v-model="form.checkStatus"
          type="select"
          :enumData="dict.checkStatus"
          placeholder="请选择处理状态"
        />
        <Field
          label="备注"
          prop="remark"
          v-model="form.remark"
          type="textarea"
          placeholder="请输入备注"
        />
      </el-row>

      <form-buttons
        @submit="submitForm"
        v-if="pageInfo.type != 'view'"
        noCancelBtn
      />
    </el-form>
  </el-drawer>
</template>

<script>
import form from "@/assets/mixins/formdialog";
export default {
  name: "CheckWindowPerformDetail",
  mixins: [form],
  components: {},
  created() {
    this.changePath("check/window/perform");
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 弹出层标题
      title: "窗口考核核查",
      // 是否显示弹出层
      open: false,
      direction: "rtl",
      toString: ["checkStatus"],
      toDate: ["submitDate", "manageCheckTime", "leaderCheckTime"],
      // 表单校验
      rules: {},
    };
  },

  methods: {
    /** 编辑 */
    edit(row) {
      this.reset();
      this.query = { id: row.id };
      this.urls.currUrl = "check/window/perform/edit";
      this.getData();
      this.pageInfo.type = "edit";
      this.title = "修改窗口考核核查";
    },
    /** 新增 */
    add(row) {
      this.reset();
      this.urls.currUrl = "check/window/perform/add";
      this.getData();
      this.pageInfo.type = "add";
      this.title = "新增窗口考核核查";
    },
    /** 查看*/
    view(row) {
      this.reset();
      this.query = { id: row.id };
      this.urls.currUrl = "check/window/perform/view";
      this.getData();
      this.pageInfo.type = "view";
      this.title = "窗口考核核查详细";
    },
    /**取消按钮 */
    cancel() {
      this.open = false;
    },
    /**获取数据后弹框 */
    afterRender(data) {
      this.open = true;
    },

    afterSubmit(data) {
      this.open = false;
      this.$emit("ok");
    },

    // 表单重置
    reset() {
      this.form = {
        recordId: null,
        year: null,
        month: null,
        windowId: null,
        windowName: "",
        ownerId: null,
        ownerName: "",
        deptId: null,
        deptName: "",
        salaId: null,
        salaName: "",
        fromName: "",
        sumScore: 0,
        submitDate: null,
        manageCheckPerson: "",
        manageCheckTime: null,
        manageCheckDesc: "",
        manageCheckResult: "",
        leaderCheckPerson: "",
        leaderCheckTime: null,
        leaderCheckDesc: "",
        leaderCheckResult: "",
        checkStatus: 1,
        remark: "",
      };
      this.resetForm("form");
    },
    resetForm(refName) {
      if (this.$refs[refName]) {
        this.$refs[refName].resetFields();
      }
    },
  },
};
</script>
