dispatching.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <div>
  3. <el-dialog
  4. title="确定发货"
  5. width="50%"
  6. :close-on-click-modal="false"
  7. :visible.sync="visible">
  8. <!-- 表单 -->
  9. <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
  10. <el-row class="my-row">
  11. <el-col>
  12. <el-form-item label="发货数量" prop="cnt">
  13. <el-input-number v-model="dataForm.cnt" :min="0" :max="Number(max)"></el-input-number>
  14. </el-form-item>
  15. </el-col>
  16. </el-row>
  17. </el-form>
  18. <span slot="footer" >
  19. <el-button @click="onChose">取消</el-button>
  20. <el-button type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button>
  21. </span>
  22. </el-dialog>
  23. </div>
  24. </template>
  25. <script>
  26. export default {
  27. name: 'dispatching',
  28. data () {
  29. return {
  30. visible: false,
  31. max: 0,
  32. dataForm: {},
  33. dataRule: {
  34. cnt: [{ required: true, message: '发货数量不能为空', trigger: 'change' }]
  35. }
  36. }
  37. },
  38. methods: {
  39. onChose () {
  40. this.visible = false
  41. this.$emit('onChose')
  42. },
  43. async init (deliverId, max) {
  44. if (!deliverId) return
  45. this.max = max
  46. this.dataForm = {
  47. deliverId: deliverId
  48. }
  49. this.visible = true
  50. },
  51. validateField (type) {
  52. this.$refs.dataForm.validateField(type)
  53. },
  54. // 表单提交
  55. dataFormSubmit () {
  56. this.$refs['dataForm'].validate((valid) => {
  57. if (valid) {
  58. this.$http({
  59. url: this.$http.adornUrl(`/biz-service/deliver/deliver`),
  60. method: 'post',
  61. data: this.$http.adornData({...this.dataForm})
  62. }).then(({data}) => {
  63. if (data && data.code === '200') {
  64. this.$message({
  65. message: '操作成功',
  66. type: 'success',
  67. duration: 1500,
  68. onClose: () => {
  69. this.onChose()
  70. this.$emit('refreshDataList')
  71. }
  72. })
  73. } else {
  74. this.$message.error(data.msg)
  75. }
  76. })
  77. }
  78. })
  79. }
  80. }
  81. }
  82. </script>
  83. <style scoped>
  84. </style>