<template>
  <el-dialog v-loading="loading" :visible.sync="visible" :title="title" :append-to-body="appendToBody" :before-close="handleClose">
    <el-form ref="form" :model="form" label-width="110px" style="width: 500px;">
      <el-row :gutter="2">
        <el-col :span="12">
          <el-form-item label="申请部门" prop="ID_CARD">
            <el-input id="department_name" ref="department_name" v-model="form.department_name" readonly maxlength="60" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="申请人" prop="ID_CARD">
            <el-input id="apply_user_name" ref="apply_user_name" v-model="form.apply_user_name" readonly maxlength="60" />
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="停止服务原因" prop="NAME">
            <el-input id="NAME" ref="NAME" :rows="2" v-model="form.reason" type="textarea" maxlength="100" placeholder="这里输入姓名..." />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="审核部门" prop="ID_CARD">
            <el-input id="jurisdictional_department" ref="jurisdictional_department" v-model="form.jurisdictional_department_name" readonly maxlength="60" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="审核人" prop="ID_CARD">
            <el-input id="judge" ref="judge" v-model="form.judge_name" readonly maxlength="60" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </el-dialog>
</template>

<script>
import waves from '@/directive/waves' // waves directive
import { requestFN } from '@/utils/request'
export default {
  components: { },
  directives: { waves },
  props: {
    title: {
      type: String,
      default: ''
    },
    appendToBody: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      visible: false,
      loading: false,
      heirloom: {},
      form: {
        department_name: '',
        department_id: '',
        apply_user_name: '',
        apply_user_id: '',
        reason: '',
        jurisdictional_department_id: '',
        jurisdictional_department_name: '',
        judge_name: '',
        judge_id: ''
      },
      touristModeFlag: false,
      listQuery: {
        page: 1,
        limit: 10,
        total: 0
      },
      list: []
    }
  },
  methods: {
    init(e) {
      this.visible = true
      this.heirloom = e
    },
    getDate() {
      this.loading = true
      requestFN(
        '/employ/getInfo',
        {}
      ).then((data) => {
        this.loading = false
        this.list = data.list
        this.total = data.page.totalResult
        this.hasButton()
      }).catch((e) => {
        this.loading = false
      })
    },
    confrim() {
      this.loading = true
      requestFN(
        '/employ/applyForAdjust',
        this.form
      ).then((data) => {
        this.loading = false
        this.list = data.list
        this.total = data.page.totalResult
        this.hasButton()
      }).catch((e) => {
        this.loading = false
      })
    },
    handleClose() {
      this.visible = false
    }
  }
}

</script>
