123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <template>
- <a-modal
- centered
- :footer="null"
- :maskClosable="false"
- class="export-excel-modal"
- title="选择导出方式"
- v-model="isShow"
- @cancel="isShow=false"
- :width="600">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-form-model
- id="export-excel-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol"
- >
- <a-form-model-item label="导出库存" prop="exportType">
- <a-radio-group v-model="form.exportType">
- <a-radio value="all">所有</a-radio>
- <a-radio value="type">分类汇总导出</a-radio>
- </a-radio-group>
- </a-form-model-item>
- </a-form-model>
- <div class="btn-cont">
- <a-button type="primary" id="export-excel-save" @click="handleSave()">导出</a-button>
- <a-button id="export-excel-back" @click="handleCancel" style="margin-left: 15px;">取消</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- export default {
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- itemData: {
- type: Object,
- default: () => {
- return null
- }
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- form: {
- exportType: 'all'
- },
- rules: {
- exportType: [{ required: true, message: '请选择导出方式', trigger: 'change' }]
- },
- formItemLayout: {
- labelCol: { span: 6 },
- wrapperCol: { span: 18 }
- },
- spinning: false
- }
- },
- methods: {
- // 确认
- handleSave (isPrint) {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- _this.$emit('ok', _this.form.exportType)
- _this.isShow = false
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- // 取消选择分类
- handleCancel () {
- this.isShow = false
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.$refs.ruleForm.resetFields()
- }
- }
- }
- }
- </script>
- <style lang="less">
- .export-excel-modal{
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|