`
<template>
  <p-modal
      title="绑定容器"
      :visible="value"
      :enlargeable="true"
      :draggable="true"
      :destroyOnClose="true"
      @ok="handleOk"
      @cancel="handleCancel"
  >
    <p-form-model ref='formTarget' :label-col='{ span: 8 }' :model='form'
                  :wrapper-col='{ span: 16 }' class='plg-grid-from'>
      <p-form-model-item label='扫描容器码'>
        <p-input v-model='form.containerCode' :maxLength='64'/>
      </p-form-model-item>
    </p-form-model>
  </p-modal>
</template>
<script>
import {bindContainer} from '../../config/api'

export default {
  props: {
    value: {
      type: Boolean,
      default: false,
    },
    selectRecord: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      form: {},
    }
  },
  methods: {
    handleOk() {
      const {pickOrderId} = this.selectRecord
      const {containerCode} = this.form
      if (!containerCode) return this.$message.warn('请输入容器号')
      const params = {
        pickOrderId,
        containerCode,
      }
      bindContainer(params).then(res => {
        if (res.success) {
          this.$emit('input', false)
          this.$message.success(res.message)
        } else {
          this.$message.success(res.message)
        }
      })
    },
    handleCancel() {
      this.$emit('input', false)
    }
  }
}
</script>
<style lang="less" scoped>
</style>
`