<template>
  <div>
    <!-- 阅读弹窗 -->
    <el-dialog :title="$t('page.business.study.studyMethod.yuedu')" :visible.sync="open" width="500px" append-to-body
      :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <div class="sbzdtcma"> <input type="text"> <input  type="password" show-password> </div>
        <el-row>
          <el-col :span="24">
            <el-form-item :label="$t('form.qmyy')" prop="qmyy">
              <el-input type="text" :value="form.qmyy" 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.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">
              <div class="sbzdtcma"> <input type="text"></div>
              <el-input type="password" v-model="form.qmrmm" maxlength="20"  show-password
                :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 { studyMethod_read } from "@/api/business/study/studyMethod"
import { mapGetters } from 'vuex'

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