
<!-- 驳回原因用户姓名输入 -->
<template>
  <a-form
    ref="form"
    v-bind="formItemLayout"
    :form="form"
  >
    <a-form-item label="机构状态" style="padding-top:30px;">
      <a-select
        v-decorator="[
          'status',
          {
            rules: [
              { required: true, message: `请选择机构状态!`, type: 'string' },
            ]
          }
        ]"
        :placeholder="`请选择机构状态!`"
      >
        <a-select-option v-for="(it) in item.status_two.texts" :key="it.key" :value="it.key+''">
          {{ it.title }}
        </a-select-option>
      </a-select>
    </a-form-item>
  </a-form>
</template>

<script>
import { changeStatusTwo } from '@/api/organization'
export default {
  name: 'EditRole',
  props: {
    item: {
      type: Object,
      default: () => {
          return {}
        }
    }
  },
  data: () => ({
    formItemLayout: {
      labelCol: { span: 6 },
      wrapperCol: { span: 14 }
    },
    loading: false
  }),
  beforeCreate () {
    this.form = this.$form.createForm(this)
  },
  methods: {
    onOk () {
      return new Promise(resolve => {
        this.form.validateFields((errors, values) => {
          if (!errors) {
            const params = {
              status: values.status
            }
            changeStatusTwo(this.item.order_item_id, params).then((res) => {
              this.$notification.success({
                message: '成功',
                description: '修改成功'
              })
              resolve(true)
            }).catch((err) => {
              this.$notification.error({
                message: '失败',
                description: err.message
              })
              resolve(false)
            })
          }
        })
      })
    }
  }
}
</script>

<style scoped>

</style>
