output.vue 3.06 KB
<template>
    <div class="batch-page">
        <Row class-name="row-space">
            <h3>导出</h3>
        </Row>
        <Row :gutter="24" class-name="row-space">
            <Col :span="6">
                <Row>
                    <Col span="6">
                        <span class="field-label">文件类型:</span>
                    </Col>
                    <Col span="18">
                        <Select v-model="fileType.model">
                            <Option v-for="item in fileType.list" :value="item.id" :key="item">{{ item.label }}</Option>
                        </Select>
                    </Col>
                </Row>
            </Col>
        </Row>
        <Row class-name="row-space">
            <Category :field-sort="sort" @on-change="sortChange">
                <Button type="primary" @click="exportFile">导出</Button>
            </Category>
        </Row>
    </div>
</template>

<script>
    import _ from 'lodash';
    import service from 'product-service';
    import {Category} from 'product/filter-select';

    export default {
        data() {
            return {
                fileType: {
                    model: 0,
                    list: [
                        {
                            id: 0,
                            label: '我的商品表'
                        }
                    ]
                },
                sort: {
                    first: {
                        label: '选择类目',
                        holder: '选择一级类目',
                        labelSpan: 6,
                        fieldSpan: 18,
                        model: ''
                    },
                    second: {
                        label: '二级类目',
                        holder: '选择二级类目',
                        labelSpan: 6,
                        fieldSpan: 18,
                        model: ''
                    },
                    third: {
                        label: '三级类目',
                        holder: '选择三级类目',
                        labelSpan: 6,
                        fieldSpan: 18,
                        model: ''
                    }
                }
            }
        },
        created() {
        },
        methods: {
            exportFile() {
                const params = {
                    maxSortId: this.sort.first.model,
                    middleSortId: this.sort.second.model,
                    smallSortId: this.sort.third.model
                };

                service.exportProductFile(params)
                    .then(res => {
                        // todo 接口开发中
                    });

            },
            sortChange(val) {
                this.sort.first.model = val.first;
                this.sort.second.model = val.second;
                this.sort.third.model = val.third;
            }
        },
        components: {
            Category
        }
    }
</script>

<style lang="scss">
    .field-label {
        line-height: 32px;
    }
    .row-space {
        margin-bottom: 20px;
    }

</style>