dsModal.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <a-modal
  3. centered
  4. class="transferOutDs-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="transferOutDs-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 id="transferOutDs-custList" 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="transferOutDs-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="transferOutDs-sendNo"
  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="transferOutDs-explainInfo"
  47. type="textarea"
  48. :maxLength="630"
  49. v-model.trim="form.explainInfo"
  50. placeholder="请输入发货说明"/>
  51. </a-form-model-item>
  52. <a-form-model-item label="备货打印" prop="printState">
  53. <a-radio-group id="transferOutDs-printState" v-model="form.printState">
  54. <a-radio value="NO_PRINT" id="transferOutDs-printState1">
  55. 允许打印
  56. </a-radio>
  57. <a-radio value="UNABLE_PRINT" id="transferOutDs-printState2">
  58. 暂不打印
  59. </a-radio>
  60. <a-radio value="CANCEL_PRINT" id="transferOutDs-printState3">
  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="transferOutDs-save" @click="handleSave">确定</a-button>
  68. <a-button id="transferOutDs-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. // 组件
  77. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  78. export default {
  79. name: 'TransferOutDsModal',
  80. mixins: [commonMixin],
  81. components: { dealerSubareaScopeList },
  82. props: {
  83. openModal: { // 弹框显示状态
  84. type: Boolean,
  85. default: false
  86. },
  87. dealerLevel: {
  88. type: String,
  89. default: ''
  90. }
  91. },
  92. data () {
  93. return {
  94. isShow: this.openModal, // 是否打开弹框
  95. spinning: false,
  96. // form表单label布局
  97. formItemLayout: {
  98. labelCol: { span: 4 },
  99. wrapperCol: { span: 18 }
  100. },
  101. // 提交参数
  102. form: {
  103. sendNo: '', // 发货编号
  104. printState: '', // 备货打印状态
  105. receiverSn: '', // 收货客户sn
  106. receiverName: '', // 收货客户名称
  107. explainInfo: ''// 发货说明
  108. },
  109. // 表单验证规则
  110. rules: {
  111. sendNo: [{ required: true, message: '请输入发货编号', trigger: 'change' }],
  112. printState: [{ required: true, message: '请选择备货打印', trigger: 'change' }]
  113. },
  114. detailData: null // 详情数据
  115. }
  116. },
  117. methods: {
  118. // 获取常用发货编号
  119. setSendNo (i) {
  120. this.form.sendNo = i
  121. this.$refs.ruleForm.validateField('sendNo')
  122. },
  123. // 收货客户名称
  124. custChange (val) {
  125. this.form.receiverSn = val.key || ''
  126. this.form.receiverName = val.name || ''
  127. },
  128. // 保存
  129. handleSave () {
  130. const _this = this
  131. _this.$refs.ruleForm.validate(valid => {
  132. if (valid) {
  133. const formData = JSON.parse(JSON.stringify(_this.form))
  134. _this.$emit('ok', formData)
  135. } else {
  136. return false
  137. }
  138. })
  139. },
  140. // 获取详情
  141. setDetail (data) {
  142. this.detailData = data
  143. },
  144. // 重置表单
  145. resetForm () {
  146. this.detailData = null
  147. this.$refs.ruleForm.resetFields()
  148. this.form = {
  149. sendNo: '',
  150. printState: '',
  151. receiverSn: '',
  152. receiverName: ''
  153. }
  154. this.$refs.custList.resetForm()
  155. }
  156. },
  157. watch: {
  158. // 父页面传过来的弹框状态
  159. openModal (newValue, oldValue) {
  160. this.isShow = newValue
  161. },
  162. // 重定义的弹框状态
  163. isShow (newValue, oldValue) {
  164. if (!newValue) {
  165. this.$emit('close')
  166. this.resetForm()
  167. }
  168. },
  169. itemId (newValue, oldValue) {
  170. if (this.isShow && newValue) {
  171. this.getDetail()
  172. }
  173. }
  174. }
  175. }
  176. </script>
  177. <style lang="less">
  178. .transferOutDs-modal{
  179. .ant-modal-body {
  180. padding: 40px 40px 24px;
  181. }
  182. .btn-cont {
  183. text-align: center;
  184. margin: 35px 0 10px;
  185. }
  186. }
  187. </style>