printModal.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 v-model="form.priceType">
  24. <a-radio value="thj" v-if="$hasPermissions('B_transferReturnPrint_salesPrice')">退货价</a-radio>
  25. <a-radio value="cbj" v-if="$hasPermissions('B_transferReturnPrint_costPrice')">成本价</a-radio>
  26. <a-radio value="bdy">不打印</a-radio>
  27. </a-radio-group>
  28. </a-form-model-item>
  29. <a-form-model-item label="货位编号" prop="orderBy">
  30. <a-radio-group v-model="form.orderBy">
  31. <a-radio value="ASC">打印(↑升序)</a-radio>
  32. <a-radio value="DESC">打印(↓降序)</a-radio>
  33. <a-radio value="-1">不打印</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-save" @click="handleSave(0)">取消</a-button>
  39. <a-button type="primary" id="allocateBill-print-back" @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. isShow: this.openModal, // 是否打开弹框
  65. form: {
  66. id: 'all',
  67. priceType: undefined,
  68. orderBy: undefined
  69. },
  70. rules: {
  71. priceType: [{ required: true, message: '请选择产品价格', trigger: 'change' }],
  72. orderBy: [{ required: true, message: '请选择货位编号', trigger: 'change' }]
  73. },
  74. formItemLayout: {
  75. labelCol: { span: 6 },
  76. wrapperCol: { span: 18 }
  77. },
  78. spinning: false
  79. }
  80. },
  81. methods: {
  82. // 确认
  83. handleSave (type) {
  84. const _this = this
  85. if (type == 0) {
  86. _this.$emit('close')
  87. return
  88. }
  89. this.$refs.ruleForm.validate(valid => {
  90. if (valid) {
  91. // 确定
  92. if (type == 1) {
  93. const obj = {
  94. allocateReturnSn: _this.itemData.allocateReturnSn,
  95. printType: _this.form.priceType,
  96. isPreview: this.nowType
  97. }
  98. if (_this.form.orderBy != '-1') {
  99. obj.orderBy = _this.form.orderBy
  100. }
  101. _this.$store.state.app.curActionPermission = 'B_transferReturnPrint'
  102. _this.$emit('ok', obj)
  103. }
  104. _this.isShow = false
  105. } else {
  106. console.log('error submit!!')
  107. return false
  108. }
  109. })
  110. }
  111. },
  112. watch: {
  113. // 父页面传过来的弹框状态
  114. openModal (newValue, oldValue) {
  115. this.isShow = newValue
  116. },
  117. // 重定义的弹框状态
  118. isShow (newValue, oldValue) {
  119. if (!newValue) {
  120. this.$emit('close')
  121. this.$refs.ruleForm.resetFields()
  122. }else{
  123. if(!this.$hasPermissions('B_transferReturnPrint_salesPrice')&&!this.$hasPermissions('B_transferReturnPrint_costPrice')){
  124. this.form.priceType = "bdy"
  125. }
  126. }
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang="less">
  132. .allocateBill-print-type-modal{
  133. .btn-cont {
  134. text-align: center;
  135. margin: 35px 0 10px;
  136. }
  137. }
  138. </style>