<template>
  <el-dialog title="修改可签章份数" top="30vh" :close-on-click-modal="true" draggable width="400px" height="500px"
    @close="close" @keyup.enter.native="" v-model="visible">
    <div style="height: calc(100% - 80px);">
      <el-form size="small" class="query-form" label-width="100px" ref="inputForm" :model="inputForm"
        @keyup.enter.native="refreshList()" @submit.native.prevent>
        <!-- 搜索框-->
        <el-form-item label="姓名" prop="name">
          <el-input class="form-input" disabled size="small" v-model="inputForm.name" placeholder="请输入姓名"
            clearable></el-input>
        </el-form-item>
        <el-form-item label="可签章份数" prop="signatureCount"
          :rules="[{ required: true, message: '请输入可签章份数', trigger: 'blur' }]">
          <el-input-number class="form-input" v-model="inputForm.signatureCount" :min="1" :max="9999" />
        </el-form-item>
      </el-form>
    </div>
    <template #footer>
      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
      <el-button size="small" type="primary" v-if="method != 'view'" @click="submit()" icon="el-icon-circle-check"
        v-noMoreClick>确定</el-button>
    </template>
  </el-dialog>
</template>

<script>
import userService from "@/api/sys/userService";
export default {
  data() {
    return {
      title: '',
      method: '',
      visible: false,
      loading: false,
      inputForm: {
        id: '',
        name: '',
        signatureCount: ''

      },
      rowId: ''
    }
  },
  created() {
  },
  components: {
  },
  methods: {
    init(row) {
      this.inputForm = {
        id: row.id,
        name: row.name,
        signatureCount: row.signatureCount
      }
      this.visible = true
    },
    // 表单提交
    submit() {
      userService.updateSignatureCount(this.inputForm).then(res => {
        this.$message.success('操作成功')
        this.$emit('refreshDataList', this.inputForm)
        this.close()
      })
    },
    close() {
      this.inputForm = {
        id: '',
        name: '',
        signatureCount: ''
      }
      this.$refs.inputForm.resetFields()
      this.visible = false
    }
  }
}
</script>

<style scoped>
.form-input {
  width: 200px;
}
</style>
