<template>
  <a-form ref="form" v-bind="formItemLayout" :form="form">
    <a-form-item label="指派人员">
      <a-select
        v-decorator="[
          'role',
          {
            rules: [
              { required: true, message: '请选择指派人员！', type: 'string' },
            ]
          }
        ]"
        placeholder="请选择指派人员！">
        <a-select-option
          :value="item.key"
          v-for="item in order.type[1].children"
          :key="item.key">
          <a-icon
            type="user"
            :style="{ fontSize: '14px', color: '#1890ff', padding: '6px 16px 6px 0' }" />{{ item.title }}</a-select-option>
      </a-select>
    </a-form-item>
    <a-form-item label="备注信息">
      <a-textarea
        :rows="4"
        v-decorator="[
          'description',
          {
            rules: [
              { required: true, message: '请输入备注信息!', type: 'string' },
            ]
          }
        ]"
        placeholder="请输入备注信息!" />
    </a-form-item>
  </a-form>
</template>

<script>
// import { doLogs } from '@/api/order'
import moment from 'moment'
export default {
  name: 'AssignmentAdd',
  props: {
    order: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data: () => ({
    formItemLayout: {
      labelCol: { span: 6 },
      wrapperCol: { span: 14 }
    },
    loading: false,
    expressList: []
  }),
  beforeCreate () {
    this.form = this.$form.createForm(this)
  },
  created () {
    console.log(this.order)
    // getExpressCommonList(this.order.order_no).then(res => {
    //   this.expressList = res
    // })
  },
  methods: {
    moment,
    onChange (date, dateString) {
    },
    onOk () {
      return new Promise(resolve => {
        this.form.validateFields((errors, values) => {
          values.password = values.password || '111111'
          console.log(values)

          if (!errors) {
            // doLogs(this.order.orderId, params).then((res) => {
            //   this.$notification.success({
            //     message: '成功',
            //     description: '添加记录成功'
            //   })
              resolve(true)
            // }).catch((err) => {
            //   this.$notification.error({
            //     message: '失败',
            //     description: err.message
            //   })
            //   resolve(false)
            // })
          }
        })
      })
    }
  }
}
</script>

<style scoped>
.flexrow {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
</style>
