setWarehouse.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <a-modal
  3. v-model="opened"
  4. :title="title"
  5. centered
  6. :maskClosable="false"
  7. :confirmLoading="confirmLoading"
  8. width="36%"
  9. :footer="null"
  10. @cancel="cancel"
  11. >
  12. <a-spin :spinning="spinning" tip="Loading...">
  13. <a-form-model
  14. id="chooseCustom-form"
  15. ref="ruleForm"
  16. :model="form"
  17. :rules="rules"
  18. :label-col="formItemLayout.labelCol"
  19. :wrapper-col="formItemLayout.wrapperCol">
  20. <a-form-model-item label="出库仓库" prop="warehouseSn">
  21. <chooseWarehouse ref="warehouse" v-model="form.warehouseSn"></chooseWarehouse>
  22. </a-form-model-item>
  23. <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;margin-top:60px;">
  24. <a-button @click="cancel" style="margin-right: 15px" id="chooseCustom-btn-back">取消</a-button>
  25. <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">确定</a-button>
  26. </a-form-model-item>
  27. </a-form-model>
  28. </a-spin>
  29. </a-modal>
  30. </template>
  31. <script>
  32. import { commonMixin } from '@/utils/mixin'
  33. import { VSelect } from '@/components'
  34. import chooseWarehouse from '@/views/common/chooseWarehouse'
  35. export default {
  36. name: 'SetWarehouse',
  37. mixins: [commonMixin],
  38. components: { VSelect, chooseWarehouse },
  39. props: {
  40. show: [Boolean]
  41. },
  42. data () {
  43. return {
  44. opened: this.show,
  45. spinning: false,
  46. title: '批量设置出库仓库',
  47. confirmLoading: false,
  48. formItemLayout: {
  49. labelCol: { span: 4 },
  50. wrapperCol: { span: 18 }
  51. },
  52. form: {
  53. warehouseSn: undefined
  54. },
  55. rules: {
  56. warehouseSn: [ { required: true, message: '请选择出库仓库', trigger: ['change', 'blur'] } ]
  57. }
  58. }
  59. },
  60. methods: {
  61. // 保存
  62. handleSubmit (e) {
  63. e.preventDefault()
  64. const _this = this
  65. this.$refs.ruleForm.validate(valid => {
  66. if (valid) {
  67. _this.$emit('ok', this.form.warehouseSn)
  68. } else {
  69. console.log('error submit!!')
  70. return false
  71. }
  72. })
  73. },
  74. cancel () {
  75. this.opened = false
  76. this.$emit('cancel')
  77. this.$refs.ruleForm.resetFields()
  78. }
  79. },
  80. watch: {
  81. show (newValue, oldValue) {
  82. this.opened = newValue
  83. if (!newValue) {
  84. this.$refs.dealerSubareaScopeList.resetForm()
  85. this.$refs.ruleForm.resetFields()
  86. this.verifyFun(this.addressId)
  87. }
  88. }
  89. }
  90. }
  91. </script>