<template>
  <a-modal
    :visible="value"
    title="新建分类"
    @ok="handleOk"
    @cancel="handleCancel"
  >
    <a-form
      :form="form"
    >
      <a-form-item
        label="分类"
        v-bind="formItemLayout"
      >
        <a-input
          v-decorator="[
            'name',
            {
              rules: [{ required: true, message: '请输入分类名' }]
            }
          ]"
        ></a-input>
      </a-form-item>
    </a-form>
  </a-modal>
</template>

<script>
import { addSalesUserType } from '@/api/marketingSetting/salesUser'
import salesUserMixin from './salesUserMixin.js'

export default {
  mixins: [salesUserMixin],
  computed: {
  },
  methods: {
    handleOk (e) {
      e.preventDefault()
      this.form.validateFields((err, values) => {
        if (!err) {
          addSalesUserType(values).then(res => {
            this.$message.success('添加成功。')
            this.form.resetFields()
            this.$emit('input', false)
            this.$emit('update')
          })
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
