exportExcelModal.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. @cancle="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">
  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>
  29. <div class="btn-cont">
  30. <a-button type="primary" id="export-excel-save" @click="handleSave()">导出</a-button>
  31. <a-button id="export-excel-back" @click="handleCancel" style="margin-left: 15px;">取消</a-button>
  32. </div>
  33. </a-spin>
  34. </a-modal>
  35. </template>
  36. <script>
  37. export default {
  38. props: {
  39. openModal: { // 弹框显示状态
  40. type: Boolean,
  41. default: false
  42. },
  43. itemData: {
  44. type: Object,
  45. default: () => {
  46. return null
  47. }
  48. }
  49. },
  50. data () {
  51. return {
  52. isShow: this.openModal, // 是否打开弹框
  53. form: {
  54. priceType: undefined
  55. },
  56. rules: {
  57. priceType: [{ required: true, message: '请选择产品售价', trigger: 'change' }]
  58. },
  59. formItemLayout: {
  60. labelCol: { span: 6 },
  61. wrapperCol: { span: 18 }
  62. },
  63. spinning: false
  64. }
  65. },
  66. methods: {
  67. // 确认
  68. handleSave (isPrint) {
  69. const _this = this
  70. this.$refs.ruleForm.validate(valid => {
  71. if (valid) {
  72. _this.$emit('ok', _this.form.priceType)
  73. _this.isShow = false
  74. } else {
  75. console.log('error submit!!')
  76. return false
  77. }
  78. })
  79. },
  80. // 取消选择分类
  81. handleCancel () {
  82. this.isShow = false
  83. }
  84. },
  85. watch: {
  86. // 父页面传过来的弹框状态
  87. openModal (newValue, oldValue) {
  88. this.isShow = newValue
  89. },
  90. // 重定义的弹框状态
  91. isShow (newValue, oldValue) {
  92. if (!newValue) {
  93. this.$emit('close')
  94. this.$refs.ruleForm.resetFields()
  95. }
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="less">
  101. .export-excel-modal{
  102. .btn-cont {
  103. text-align: center;
  104. margin: 35px 0 10px;
  105. }
  106. }
  107. </style>