exportExcelModal.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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="priceType" v-if="$hasPermissions('B_dispatchExport_salesPrice')">
  29. <a-radio-group v-model="form.priceType">
  30. <a-radio value="DISPATCH_BILL_PRICE">导出</a-radio>
  31. <a-radio value="DISPATCH_BILL">不导出</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. },
  62. rules: {
  63. priceType: [{ required: true, message: '请选择产品售价', trigger: 'change' }]
  64. },
  65. formItemLayout: {
  66. labelCol: { span: 6 },
  67. wrapperCol: { span: 18 }
  68. },
  69. spinning: false
  70. }
  71. },
  72. methods: {
  73. // 确认
  74. handleSave (isPrint) {
  75. const _this = this
  76. _this.$store.state.app.curActionPermission = 'B_dispatchExport'
  77. this.$refs.ruleForm.validate(valid => {
  78. if (valid) {
  79. if (!this.$hasPermissions('B_dispatchExport_salesPrice')) {
  80. _this.form.priceType = 'DISPATCH_BILL'
  81. }
  82. _this.$emit('ok', _this.form.priceType, {}, '下推产品')
  83. _this.isShow = false
  84. } else {
  85. console.log('error submit!!')
  86. return false
  87. }
  88. })
  89. },
  90. // 取消选择分类
  91. handleCancel () {
  92. this.isShow = false
  93. }
  94. },
  95. watch: {
  96. // 父页面传过来的弹框状态
  97. openModal (newValue, oldValue) {
  98. this.isShow = newValue
  99. },
  100. // 重定义的弹框状态
  101. isShow (newValue, oldValue) {
  102. if (!newValue) {
  103. this.$emit('close')
  104. this.$refs.ruleForm.resetFields()
  105. }
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="less">
  111. .export-excel-modal{
  112. .btn-cont {
  113. text-align: center;
  114. margin: 35px 0 10px;
  115. }
  116. }
  117. </style>