exportExcelModal.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <a-modal
  3. centered
  4. :footer="null"
  5. :maskClosable="false"
  6. class="export-excel-modal"
  7. title="导出Excel"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. :width="600">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <a-form-model
  13. id="export-excel-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 label="销售单号">{{ itemData&&itemData.salesBillNo || '--' }}</a-form-model-item>
  21. <a-form-model-item label="客户名称">{{ itemData&&itemData.buyerName || '--' }}</a-form-model-item>
  22. <a-form-model-item label="产品售价" prop="priceType" v-if="$hasPermissions('B_dispatchExport_salesPrice')">
  23. <a-radio-group v-model="form.priceType">
  24. <a-radio value="DISPATCH_BILL_PRICE">导出</a-radio>
  25. <a-radio value="DISPATCH_BILL">不导出</a-radio>
  26. </a-radio-group>
  27. </a-form-model-item>
  28. <a-form-model-item label="原厂编码" prop="origCode">
  29. <a-radio-group v-model="form.origCode">
  30. <a-radio value="1">导出</a-radio>
  31. <a-radio value="0">不导出</a-radio>
  32. </a-radio-group>
  33. </a-form-model-item>
  34. </a-form-model>
  35. <div class="btn-cont">
  36. <a-button type="primary" id="export-excel-save" @click="handleSave()">导出</a-button>
  37. <a-button id="export-excel-back" @click="handleCancel" style="margin-left: 15px;">取消</a-button>
  38. </div>
  39. </a-spin>
  40. </a-modal>
  41. </template>
  42. <script>
  43. export default {
  44. props: {
  45. openModal: { // 弹框显示状态
  46. type: Boolean,
  47. default: false
  48. },
  49. itemData: {
  50. type: Object,
  51. default: () => {
  52. return null
  53. }
  54. }
  55. },
  56. data () {
  57. return {
  58. isShow: this.openModal, // 是否打开弹框
  59. form: {
  60. priceType: undefined,
  61. origCode: '0'
  62. },
  63. rules: {
  64. priceType: [{ required: true, message: '请选择产品售价', trigger: 'change' }],
  65. origCode: [{ required: true, message: '请选择原厂编码', trigger: 'change' }]
  66. },
  67. formItemLayout: {
  68. labelCol: { span: 6 },
  69. wrapperCol: { span: 18 }
  70. },
  71. spinning: false
  72. }
  73. },
  74. methods: {
  75. // 确认
  76. handleSave (isPrint) {
  77. const _this = this
  78. _this.$store.state.app.curActionPermission = 'B_dispatchExport'
  79. this.$refs.ruleForm.validate(valid => {
  80. if (valid) {
  81. if (!this.$hasPermissions('B_dispatchExport_salesPrice')) {
  82. _this.form.priceType = 'DISPATCH_BILL'
  83. }
  84. _this.form.priceType += _this.form.origCode == 1 ? '_ORIG_CODE' : ''
  85. _this.$emit('ok', _this.form.priceType, {}, '下推产品')
  86. _this.isShow = false
  87. } else {
  88. console.log('error submit!!')
  89. return false
  90. }
  91. })
  92. },
  93. // 取消选择分类
  94. handleCancel () {
  95. this.isShow = false
  96. }
  97. },
  98. watch: {
  99. // 父页面传过来的弹框状态
  100. openModal (newValue, oldValue) {
  101. this.isShow = newValue
  102. },
  103. // 重定义的弹框状态
  104. isShow (newValue, oldValue) {
  105. if (!newValue) {
  106. this.$emit('close')
  107. this.$refs.ruleForm.resetFields()
  108. }
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="less">
  114. .export-excel-modal{
  115. .btn-cont {
  116. text-align: center;
  117. margin: 35px 0 10px;
  118. }
  119. }
  120. </style>