<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="projectGoodsCode"/>
                <el-table-column label="生产企业" prop="manufactureName"/>
                <el-table-column label="配送企业" prop="distributorName"/>
                <el-table-column label="产品名称" prop="productName"/>
                <!--                <el-table-column label="型号" prop="model"/>
                                <el-table-column label="规格" prop="spec"/>-->
                <el-table-column label="医保编码" prop="medicalCode"/>
                <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/thrsys/udplatGoods";
import myMinix from './../utils/minixs/commMinixs';

export default {
    name: "UdplatGoods",
    mixins: [myMinix],
    methods: {
        getList() {
            this.loading = true;
            let request = this.addDateRange(this.queryParams, this.dateRange);
            GetList(request).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;
            })
        },
        addDateRange(params, dateRange) {
            let search = params;
            search.startDate = null
            search.endDate = null;
            if (null != dateRange && '' != dateRange) {
                search.startDate = dateRange[0];
                search.endDate = dateRange[1];
            }
            return search;
        }

    },
    created() {
        this.getList();
    },
}
</script>

<style scoped>

</style>
