
<template>
  <div class="opBtn">
    <VaButton :round="false" color="info" gradient @click="showModal = true"> 新增考勤点</VaButton>
    <VaModal :modelValue="showModal" :noDismiss="true" blur @cancel='showModal=false' @ok="submit" ok-text="提交" cancelText="取消">
      <h3 class="va-h3">考勤点信息</h3>
      <pointForm ref="pointForm"></pointForm>
    </VaModal>
  </div>
</template>

<script>
  import pointForm from './pointForm.vue'
  export default {
    name: 'addPointBtn',
    components: {
      pointForm,
    },
    methods: {
      submit() {
        let params = {
          ...this.$refs.pointForm.form
        }
        this.$api.addWorkPoint(params).then(res=>{
          this.$toast.success({message:res.message})
          this.showModal = false
          this.$emit('after-op')
        })
      },
    },
    data() {
      return {
        showModal: false,
      }
    },
  }
</script>

<style scoped>
  .opBtn {
    display: inline-block;
    vertical-align: 11%;
  }
</style>

