clearing.vue 3.36 KB
<template>
    <layout-body>
        <layout-filter>
            <filter-item label="对帐单号">
                <Input v-model.trim.trim="filters.sknCode.model"
                       :placeholder="filters.sknCode.holder"
                ></Input>
            </filter-item>
            <filter-item label="供应商">
               
            </filter-item>
            <filter-item label="品牌">
               
            </filter-item>

            <filter-item label="日期">
                <Date-picker type="date" placeholder="选择日期" style="width: 170px"></Date-picker>
            </filter-item>

            <filter-item label="">
                <Date-picker type="daterange" placement="bottom-end" placeholder="选择日期" style="width: 170px"></Date-picker>
            </filter-item>

            <filter-item>
                <Button type="primary" @click="filterSearch">筛选</Button>
                <Button @click="">导出</Button>
            </filter-item>
        </layout-filter>

        <layout-list>
            <Table border :columns="tableCols" :data="tableData"></Table>
            <Page :total="pageData.total" :current="pageData.current"
                  @on-change="pageChange" :page-size="20" show-total></Page>
        </layout-list>

    </layout-body>

</template>

<script>
import _ from 'lodash';
import FinanceService from 'services/finance/finance-service';
import {initialFields, tableCols, tableData, pageData} from './detail';

export default {
    data() {
        return {
            self: this,
            tableCols,
            tableData,
            pageData,
            filters: '',
        };
    },
    created() {
        this.financeService = new FinanceService();
        this.filters = JSON.parse(initialFields);
    },
    methods: {
        filterParams() {
            const fts = this.filters;
            const data = {
                productSkn: fts.sknCode.model
            };

            return data;
        },
        filterSearch() {
            const params = this.filterParams();

            this.useFilterSign = true;
            this.productList(params);
            this.pageData.current = 1;

        },
        clearFilter() {
            this.filters = JSON.parse(initialFields);
            this.productList();
            this.useFilterSign = false;
            this.pageData.current = 1;
        },
        productList(params) {

            if (_.isObject(params) &&
                params.productSkn &&
                !_.isFinite(+params.productSkn)) {
                this.$Message.error('SKN编码只能是数字', 3);
                return;
            }

            this.financeService.productList(
                _.merge(params || {}, {
                    shelfStatus: 1,
                    size: 20
                }))
                .then(res => {
                    if (res.code === 200) {
                        this.updateStore(res.data);
                    }
                });
        },
        pageChange(page) {
            this.pageData.current = page;

            let params = {};

            if (this.useFilterSign) {
                params = this.filterParams();
            }

            _.merge(params, {
                page,
                size: 20,
                productStatusStr: 1
            });

            this.productList(params);
        },
    },
    components: {
    }
};
</script>