dsModal.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <a-modal
  3. centered
  4. class="dealerAccountEdit-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="提交调拨单"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. :width="800">
  11. <!-- 表单 -->
  12. <div>
  13. <a-spin :spinning="spinning" tip="Loading...">
  14. <a-form-model
  15. id="dealerAccountEdit-form"
  16. ref="ruleForm"
  17. :model="form"
  18. :rules="rules"
  19. :label-col="formItemLayout.labelCol"
  20. :wrapper-col="formItemLayout.wrapperCol"
  21. >
  22. <a-form-model-item label="收货客户名称" v-if="dealerLevel != 'OTHER'">
  23. <dealerSubareaScopeList ref="custList" defValKey="buyerSn" @change="custChange" v-model="form.receiverSn" />
  24. </a-form-model-item>
  25. <a-form-model-item label="收货客户名称" v-else>
  26. <a-input
  27. id="dealerAccountEdit-receiverName"
  28. :maxLength="30"
  29. v-model.trim="form.receiverName"
  30. placeholder="请输入收货客户名称"
  31. allowClear />
  32. </a-form-model-item>
  33. <a-form-model-item label="发货编号" prop="sendNo">
  34. <a-input
  35. id="dealerAccountEdit-phone"
  36. :maxLength="10"
  37. v-model.trim="form.sendNo"
  38. placeholder="请输入发货编号"
  39. allowClear />
  40. <div style="height: 24px;line-height: normal;">
  41. 常用:<a-button size="small" v-for="i in 5" @click="setSendNo(i)" type="link">{{ i }}</a-button>
  42. </div>
  43. </a-form-model-item>
  44. <a-form-model-item label="发货说明">
  45. <a-input
  46. id="dealerAccountEdit-sendGoodsDesc"
  47. type="textarea"
  48. :maxLength="630"
  49. v-model.trim="form.sendGoodsDesc"
  50. placeholder="请输入发货说明"/>
  51. </a-form-model-item>
  52. <a-form-model-item label="备货打印" prop="printState">
  53. <a-radio-group v-model="form.printState">
  54. <a-radio value="NO_PRINT">
  55. 允许打印
  56. </a-radio>
  57. <a-radio value="UNABLE_PRINT">
  58. 暂不打印
  59. </a-radio>
  60. <a-radio value="CANCEL_PRINT">
  61. 取消打印
  62. </a-radio>
  63. </a-radio-group>
  64. </a-form-model-item>
  65. </a-form-model>
  66. <div class="btn-cont">
  67. <a-button type="primary" id="dealerAccountEdit-save" @click="handleSave">确定</a-button>
  68. <a-button id="dealerAccountEdit-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
  69. </div>
  70. </a-spin>
  71. </div>
  72. </a-modal>
  73. </template>
  74. <script>
  75. import { commonMixin } from '@/utils/mixin'
  76. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  77. export default {
  78. name: 'DealerAccountEditModal',
  79. mixins: [commonMixin],
  80. components: { dealerSubareaScopeList },
  81. props: {
  82. openModal: { // 弹框显示状态
  83. type: Boolean,
  84. default: false
  85. },
  86. dealerLevel: {
  87. type: String,
  88. default: ''
  89. }
  90. },
  91. data () {
  92. return {
  93. isShow: this.openModal, // 是否打开弹框
  94. spinning: false,
  95. formItemLayout: {
  96. labelCol: { span: 4 },
  97. wrapperCol: { span: 18 }
  98. },
  99. form: {
  100. sendNo: '',
  101. printState: '',
  102. receiverSn: '',
  103. receiverName: '',
  104. sendGoodsDesc: ''
  105. },
  106. rules: {
  107. sendNo: [{ required: true, message: '请输入发货编号', trigger: 'change' }],
  108. printState: [{ required: true, message: '请选择备货打印', trigger: 'change' }]
  109. },
  110. detailData: null // 详情数据
  111. }
  112. },
  113. methods: {
  114. setSendNo (i) {
  115. this.form.sendNo = i
  116. this.$refs.ruleForm.validateField('sendNo')
  117. },
  118. custChange (val) {
  119. this.form.receiverSn = val.key || ''
  120. this.form.receiverName = val.name || ''
  121. },
  122. // 保存
  123. handleSave () {
  124. const _this = this
  125. _this.$refs.ruleForm.validate(valid => {
  126. if (valid) {
  127. const formData = JSON.parse(JSON.stringify(_this.form))
  128. _this.$emit('ok', formData)
  129. } else {
  130. return false
  131. }
  132. })
  133. },
  134. // 获取详情
  135. setDetail (data) {
  136. this.detailData = data
  137. },
  138. // 重置表单
  139. resetForm () {
  140. this.detailData = null
  141. this.$refs.ruleForm.resetFields()
  142. this.form = {
  143. sendNo: '',
  144. printState: '',
  145. receiverSn: '',
  146. receiverName: ''
  147. }
  148. this.$refs.custList.resetForm()
  149. }
  150. },
  151. watch: {
  152. // 父页面传过来的弹框状态
  153. openModal (newValue, oldValue) {
  154. this.isShow = newValue
  155. },
  156. // 重定义的弹框状态
  157. isShow (newValue, oldValue) {
  158. if (!newValue) {
  159. this.$emit('close')
  160. this.resetForm()
  161. }
  162. },
  163. itemId (newValue, oldValue) {
  164. if (this.isShow && newValue) {
  165. this.getDetail()
  166. }
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="less">
  172. .dealerAccountEdit-modal{
  173. .ant-modal-body {
  174. padding: 40px 40px 24px;
  175. }
  176. .btn-cont {
  177. text-align: center;
  178. margin: 35px 0 10px;
  179. }
  180. }
  181. </style>