<template>
<div>
    <el-card class="el-card">
        <el-form
            :inline="true"
            :model="queryParams"
            size="mini"
        >
            <el-form-item label="名称">
                <el-input
                    v-model="queryParams.name"
                    size="mini"
                    placeholder="请输入名称"
                ></el-input>
            </el-form-item>
        <el-form-item>
            <span style="color: #000; margin-left: 10px; margin-right: 6px"
            >日期:</span
            >
                <el-date-picker
                    :picker-options="pickerOptions"
                    v-model="dateRange"
                    type="daterange"
                    format="yyyy 年 MM 月 dd 日"
                    value-format="yyyy-MM-dd"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                >
                </el-date-picker>
            </el-form-item>
            <el-form-item>
                <el-button-group>
                    <el-button
                        type="primary"
                        icon="el-icon-refresh"
                        @click="onReset"
                    ></el-button>
                    <el-button type="primary" icon="search" @click="onSubmit"
                    >查询
                    </el-button
                    >

                </el-button-group>
            </el-form-item>

        </el-form>
        <el-table
            v-loading="loading"
            :data="list"
            style="width: 100%"
        >
            <el-table-column label="序号" type="index"/>
            <el-table-column label="ID" prop="distributorId"/>
            <el-table-column label="企业编码" prop="distributorCode"/>
            <el-table-column label="企业名称" prop="distributorName"/>
            <el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
            <el-table-column label="更新时间" align="center" prop="updateTime" :show-overflow-tooltip="true"/>

        </el-table>
        <el-pagination
            :current-page="queryParams.page"
            :page-size="queryParams.limit"
            @current-change="handleCurrentChange"
            layout="prev, pager, next"
            :total="total"
        ></el-pagination>
    </el-card>
</div>
</template>

<script>
import {GetList} from "@/api/udplat/udplatDistributor";
import myMinix from './minixs/commMinixs';
export default {
    name: "udplatDistributor",
   /* data(){
        return{
            dateRange: [],
            loading: false,
            list: [],
            total: 0,
            queryParams: {
                page: 1,
                limit: 10,
                name: ""
            },
            pickerOptions: {
                shortcuts: [
                    {
                        text: "最近一周",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                            picker.$emit("pick", [start, end]);
                        },
                    },
                    {
                        text: "最近一个月",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                            picker.$emit("pick", [start, end]);
                        },
                    },
                    {
                        text: "最近三个月",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                            picker.$emit("pick", [start, end]);
                        },
                    },
                ],
            },
        }
    },
    created() {
        this.getList();
    },*/
    mixins:[myMinix],
    methods:{
        getList() {
            this.loading = true;
            GetList(this.addDateRange(this.queryParams, this.dateRange)).then(res => {
                this.loading = false;
                this.list = res.data.list || [];
                this.total = res.data.total || 0;
            }).catch(error => {
                this.$message.error(error);
                this.loading = false;
            })
        },
       /* handleCurrentChange(val) {
            this.queryParams.page = val;
            this.getList();
        },
        onReset() {
            this.$router.push({
                path: "",
            });
            this.queryParams = {
                page: 1,
                limit: 10,
                name: ""
            };
            this.dateRange = [];
            this.getList();
        },
        onSubmit() {
            this.queryParams.page = 1;
            this.getList();
        },*/
    }
}
</script>

<style scoped>

</style>
