printModal.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <a-modal
  3. centered
  4. :footer="null"
  5. :maskClosable="false"
  6. class="allocateBill-print-type-modal"
  7. title="调拨退货打印"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. :width="600">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <a-form-model
  13. id="allocateBill-print-form"
  14. ref="ruleForm"
  15. :model="form"
  16. :rules="rules"
  17. :label-col="formItemLayout.labelCol"
  18. :wrapper-col="formItemLayout.wrapperCol"
  19. >
  20. <a-form-model-item style="margin:0" label="调拨退货单号">{{ itemData&&itemData.allocateReturnNo || '--' }}</a-form-model-item>
  21. <a-form-model-item style="margin:0" label="调拨退货对象">{{ itemData&&itemData.targetName || '--' }}</a-form-model-item>
  22. <a-form-model-item label="产品价格" prop="priceType">
  23. <a-radio-group id="allocateBill-print-priceType" v-model="form.priceType">
  24. <a-radio value="thj" id="allocateBill-print-priceType1" v-if="$hasPermissions('B_transferReturnPrint_salesPrice')">退货价</a-radio>
  25. <a-radio value="cbj" id="allocateBill-print-priceType2" v-if="$hasPermissions('B_transferReturnPrint_costPrice')">成本价</a-radio>
  26. <a-radio value="bdy" id="allocateBill-print-priceType3">不打印</a-radio>
  27. </a-radio-group>
  28. </a-form-model-item>
  29. <a-form-model-item label="货位编号" prop="orderBy">
  30. <a-radio-group id="allocateBill-print-orderBy" v-model="form.orderBy">
  31. <a-radio value="ASC" id="allocateBill-print-orderBy1">打印(↑升序)</a-radio>
  32. <a-radio value="DESC" id="allocateBill-print-orderBy2">打印(↓降序)</a-radio>
  33. <a-radio value="-1" id="allocateBill-print-orderBy3">不打印</a-radio>
  34. </a-radio-group>
  35. </a-form-model-item>
  36. </a-form-model>
  37. <div class="btn-cont">
  38. <a-button id="allocateBill-print-cancel" @click="handleSave(0)">取消</a-button>
  39. <a-button type="primary" id="allocateBill-print-save" @click="handleSave(1)" style="margin-left: 15px;">确定</a-button>
  40. </div>
  41. </a-spin>
  42. </a-modal>
  43. </template>
  44. <script>
  45. export default {
  46. props: {
  47. openModal: { // 弹框显示状态
  48. type: Boolean,
  49. default: false
  50. },
  51. itemData: {
  52. type: Object,
  53. default: () => {
  54. return null
  55. }
  56. },
  57. nowType: {
  58. type: String,
  59. default: ''
  60. }
  61. },
  62. data () {
  63. return {
  64. spinning: false,
  65. isShow: this.openModal, // 是否打开弹框
  66. // 提交参数
  67. form: {
  68. id: 'all',
  69. priceType: undefined, // 产品价格
  70. orderBy: undefined// 货位编号
  71. },
  72. // 表单验证规则
  73. rules: {
  74. priceType: [{ required: true, message: '请选择产品价格', trigger: 'change' }],
  75. orderBy: [{ required: true, message: '请选择货位编号', trigger: 'change' }]
  76. },
  77. // form表单label布局
  78. formItemLayout: {
  79. labelCol: { span: 6 },
  80. wrapperCol: { span: 18 }
  81. }
  82. }
  83. },
  84. methods: {
  85. // 确认
  86. handleSave (type) {
  87. const _this = this
  88. if (type == 0) {
  89. _this.$emit('close')
  90. return
  91. }
  92. this.$refs.ruleForm.validate(valid => {
  93. if (valid) {
  94. // 确定
  95. if (type == 1) {
  96. const obj = {
  97. allocateReturnSn: _this.itemData.allocateReturnSn,
  98. printType: _this.form.priceType,
  99. isPreview: this.nowType
  100. }
  101. if (_this.form.orderBy != '-1') {
  102. obj.orderBy = _this.form.orderBy
  103. }
  104. _this.$store.state.app.curActionPermission = 'B_transferReturnPrint'
  105. _this.$emit('ok', obj)
  106. }
  107. _this.isShow = false
  108. } else {
  109. console.log('error submit!!')
  110. return false
  111. }
  112. })
  113. }
  114. },
  115. watch: {
  116. // 父页面传过来的弹框状态
  117. openModal (newValue, oldValue) {
  118. this.isShow = newValue
  119. },
  120. // 重定义的弹框状态
  121. isShow (newValue, oldValue) {
  122. if (!newValue) {
  123. this.$emit('close')
  124. this.$refs.ruleForm.resetFields()
  125. } else {
  126. if (!this.$hasPermissions('B_transferReturnPrint_salesPrice') && !this.$hasPermissions('B_transferReturnPrint_costPrice')) {
  127. this.form.priceType = 'bdy'
  128. }
  129. }
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="less">
  135. .allocateBill-print-type-modal{
  136. .btn-cont {
  137. text-align: center;
  138. margin: 35px 0 10px;
  139. }
  140. }
  141. </style>