G<template>
  <div>
    <el-dialog :title="$t('page.business.study.studyFormFill.guancha')" :visible.sync="open" width="500px"
      append-to-body :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-row>
          <el-col :span="24">
            <el-form-item :label="$t('page.business.study.studyFormFill.szqk')" prop="qmyy">
              <el-select v-model="form.qmyy" :placeholder="$t('form.placeholderSelect')" style="width: 100%;">
                <el-option label="良好" value="良好" />
                <el-option label="中" value="中" />
                <el-option label="差" value="差" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item :label="$t('form.remark')" prop="remark">
              <el-input type="textarea" v-model="form.remark" :rows="5" maxlength="500"
                :placeholder="$t('form.placeholderInput')">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item :label="$t('form.signer')">
              <el-input type="text" v-model="nickName" maxlength="50" disabled
                :placeholder="$t('form.placeholderInput')" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item :label="$t('form.password')" prop="qmrmm">
              <el-input type="password" v-model="form.qmrmm" maxlength="20"
                :placeholder="$t('form.placeholderInput')" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="save">{{ $t('form.confirm') }}</el-button>
        <el-button @click="cancel">{{ $t('form.cancel') }}</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { studyFormFill_gc } from "@/api/business/study/studyFormFill"
import { mapGetters } from 'vuex'

export default {
  name: "Fz",
  components: {},
  data() {
    return {
      isBatch: false,
      ids: [],
      selectList: [],
      open: false,
      form: {},
      rules: {
        qmrmm: [{
          required: true,
          message: ' ',
          trigger: 'blur'
        }],
        remark: [{
          required: true,
          message: ' ',
          trigger: 'blur'
        }],
        qmyy: [{
          required: true,
          message: ' ',
          trigger: 'blur'
        }],
      }
    }
  },
  computed: {
    ...mapGetters([
      'nickName'
    ]),
  },
  created() {
  },
  methods: {
    cancel() {
      this.open = false
    },
    reset() {
      this.form = {
        id: null,
        qmyy: null,
        remark: null,
        qmrmm: null
      }
      this.resetForm("form")
    },
    show(row) {
      this.reset()
      this.form.id = row.id
      this.open = true
    },
    save() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.$modal.loading()
          studyFormFill_gc(this.form).then(response => {
            this.open = false
            this.$emit('callback')
            this.$modal.closeLoading()
          }).finally(() => {
            this.$modal.closeLoading()
          })
        }
      })
    }
  }
}
</script>
