<template>
    <el-skeleton :rows="10" animated v-if="showSkeleton" />
    <div v-if="!showSkeleton">
        <el-card :body-style="cardBodyStyle" class="diaClass90">
            <el-card :body-style="cardBodyStyle" class="diaClass90">
                <el-form :inline="true" :model="queryForm" status-icon>
                    <el-form-item>
                        <el-input v-model="queryForm.tem" placeholder="支持模糊查询/物资名称/发货单位/收货单位/车号"
                            style="margin-left: 20px;width: 318px;" clearable>
                        </el-input>
                        <div style="margin-left: 20px;"></div>
                        <el-switch v-model="switchOpen" size="large" @change="openchange" active-text="自动推送数据" />

                    </el-form-item>
                </el-form>
            </el-card>
            <el-card><el-button type="primary" plain @click="handleExport" style="">导出全部列表数据</el-button><el-button
                    type="primary" @click="dwQuery">查询</el-button></el-card>

            <el-card>
                <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">

                    <el-tab-pane label="已收货" name="ysh">
                        <el-card :body-style="cardBodyStyle">
                            <el-table :data="yshTableData" border highlight-current-row
                                @selection-change="handleSelectionChange">
                                <el-table-column type="index" label="序号" width="80" header-align="center" align="center"
                                    show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="true" prop="jlh" label="计量号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="ybid" label="运单号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="carno" label="车号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="wuzimc" label="物资名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="storageOperatorname" label="收货人" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="storagetime" label="收货时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="shdwmc" label="收货单位名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="storaged" label="收货确认" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="true" prop="kzh" sortable label="扣吨(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="jszl" sortable label="结算重量(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="fdrivername" label="司机姓名" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="fhdwmc" label="发货单位名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="true" prop="wtdwmc" label="承运商名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="ckmc" label="仓库名称" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lsmz" sortable label="来时毛重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lspz" sortable label="来时皮重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lsjz" sortable label="来时净重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="mzh" sortable label="实际毛重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="pzh" sortable label="实际皮重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="jzh" sortable label="实际净重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="rossTime" sortable label="计毛时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="tareTime" sortable label="计皮时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="suttleTime" sortable label="净重时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="ddsj" sortable label="等待时间(分)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="xcys" sortable label="卸车用时(分)???" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="false" fixed="right" label="收货" width="150" header-align="center"
                                    align="center" show-overflow-tooltip>
                                    <template #default="scope">
                                        <p></p>

                                        <el-button size="small" type="primary" plain
                                            @click="confirmPre(scope.row)"><el-icon>
                                                <EditPen />
                                            </el-icon>确认收货</el-button>
                                    </template>
                                </el-table-column>
                                <el-table-column fixed="right" v-if="false" label="查看" width="80" header-align="center"
                                    align="center" show-overflow-tooltip>
                                    <template #default="{ row }">
                                        <p>
                                        <p @click="confirmPre(row)" style="cursor: pointer;">
                                            <el-icon>
                                                <InfoFilled />
                                            </el-icon>
                                        </p>
                                        </p>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-card>
                        <el-card :body-style="cardBodyStyle">
                            <el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize"
                                :page-sizes="[5, 10, 15, 20]" :background="background"
                                layout="total, sizes, prev, pager, next, jumper" :total="yshTotal"
                                @size-change="handleSizeChange" @current-change="handleCurrentChange" />
                        </el-card>
                    </el-tab-pane>
                    <el-tab-pane label="待收货" name="dsh">
                        <el-card :body-style="cardBodyStyle">
                            <el-table :data="dshTableData" border highlight-current-row
                                @selection-change="handleSelectionChange">
                                <el-table-column type="index" label="序号" width="80" header-align="center" align="center"
                                    show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="true" prop="jlh" label="计量号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="ybid" label="运单号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="carno" label="车号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="wuzimc" label="物资名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="storageOperatorname" label="收货人" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="shdwmc" label="收货单位名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="storaged" label="收货确认" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>

                                </el-table-column>
                                <el-table-column v-if="false" prop="kzh" sortable label="扣吨(t)" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="jszl" sortable label="结算重量(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="fdrivername" label="司机姓名" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="fhdwmc" label="发货单位名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="carno" label="车号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="wtdwmc" label="承运商名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="ckmc" label="仓库名称" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lsmz" sortable label="来时毛重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lspz" sortable label="来时皮重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lsjz" sortable label="来时净重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="mzh" sortable label="实际毛重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="mzc" sortable label="毛重差(t)" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="pzh" sortable label="实际皮重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="jzh" label="实际净重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="rossTime" label="计毛时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="tareTime" label="计皮时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="suttleTime" label="净重时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="ddsj" label="等待时间(分)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="xcys" label="卸车用时(分)???" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column fixed="right" label="收货" width="150" header-align="center"
                                    align="center" show-overflow-tooltip>
                                    <template #default="scope">
                                        <el-button size="small" type="primary" plain
                                            @click="confirmPre(scope.row)"><el-icon>
                                                <EditPen />
                                            </el-icon>确认收货</el-button>
                                    </template>
                                </el-table-column>
                                <el-table-column fixed="right" v-if="false" label="查看" width="80" header-align="center"
                                    align="center" show-overflow-tooltip>
                                    <template #default="{ row }">
                                        <p>
                                        <p @click="confirmPre(row)" style="cursor: pointer;">
                                            <el-icon>
                                                <InfoFilled />
                                            </el-icon>
                                        </p>
                                        </p>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-card>
                        <el-card :body-style="cardBodyStyle">

                            <el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize"
                                :page-sizes="[5, 10, 15, 20]" :background="background"
                                layout="total, sizes, prev, pager, next, jumper" :total="dshTotal"
                                @size-change="handleSizeChange" @current-change="handleCurrentChange" />



                        </el-card>
                    </el-tab-pane>
                    <el-tab-pane label="复磅" name="fb">
                        <el-card :body-style="cardBodyStyle">
                            <el-table :data="fbTableData" border highlight-current-row
                                @selection-change="handleSelectionChange">
                                <el-table-column type="index" label="序号" width="80" header-align="center" align="center"
                                    show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="true" prop="jlh" label="计量号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="ybid" label="运单号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="carno" label="车号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="wuzimc" label="物资名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="storageOperatorname" label="操作人" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="storagetime" label="操作时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="shdwmc" label="收货单位名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="storaged" label="收货确认" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>

                                </el-table-column>
                                <el-table-column v-if="false" prop="kzh" sortable label="扣吨(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="jszl" sortable label="结算重量(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="fdrivername" label="司机姓名" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="fhdwmc" label="发货单位名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="true" prop="wtdwmc" label="承运商名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="ckmc" label="仓库名称" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lsmz" sortable label="来时毛重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lspz" sortable label="来时皮重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lsjz" sortable label="来时净重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="mzh" sortable label="实际毛重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="pzh" sortable label="实际皮重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="jzh" sortable label="实际净重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="rossTime" sortable label="计毛时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="tareTime" sortable label="计皮时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="suttleTime" sortable label="净重时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="ddsj" sortable label="等待时间(分)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="xcys" sortable label="卸车用时(分)???" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="false" fixed="right" label="收货" width="150" header-align="center"
                                    align="center" show-overflow-tooltip>
                                    <template #default="scope">
                                        <p></p>

                                        <el-button type="primary" plain @click="confirmPre(scope.row)"><el-icon>
                                                <EditPen />
                                            </el-icon>确认收货</el-button>
                                    </template>
                                </el-table-column>
                                <el-table-column fixed="right" v-if="false" label="查看" width="80" header-align="center"
                                    align="center" show-overflow-tooltip>
                                    <template #default="{ row }">
                                        <p>
                                        <p @click="confirmPre(row)" style="cursor: pointer;">
                                            <el-icon>
                                                <InfoFilled />
                                            </el-icon>
                                        </p>
                                        </p>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-card>
                        <el-card :body-style="cardBodyStyle">
                            <el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize"
                                :page-sizes="[5, 10, 15, 20]" :background="background"
                                layout="total, sizes, prev, pager, next, jumper" :total="fbTotal"
                                @size-change="handleSizeChange" @current-change="handleCurrentChange" />
                        </el-card>
                    </el-tab-pane>
                    <el-tab-pane label="整车退货" name="th">
                        <el-card :body-style="cardBodyStyle">
                            <el-table :data="thTableData" border highlight-current-row
                                @selection-change="handleSelectionChange">
                                <el-table-column type="index" label="序号" width="80" header-align="center" align="center"
                                    show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="true" prop="jlh" label="计量号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="ybid" label="运单号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="carno" label="车号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="wuzimc" label="物资名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="storageOperatorname" label="操作人" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="storagetime" label="操作时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="shdwmc" label="收货单位名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="storaged" label="收货确认" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>

                                </el-table-column>
                                <el-table-column v-if="false" prop="kzh" sortable label="扣吨(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="jszl" sortable label="结算重量(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="fdrivername" label="司机姓名" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="fhdwmc" label="发货单位名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="true" prop="wtdwmc" label="承运商名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="ckmc" label="仓库名称" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lsmz" sortable label="来时毛重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lspz" sortable label="来时皮重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lsjz" sortable label="来时净重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="mzh" sortable label="实际毛重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="pzh" sortable label="实际皮重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="jzh" sortable label="实际净重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="rossTime" sortable label="计毛时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="tareTime" sortable label="计皮时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="suttleTime" sortable label="净重时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="ddsj" sortable label="等待时间(分)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="xcys" sortable label="卸车用时(分)???" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="false" fixed="right" label="收货" width="150" header-align="center"
                                    align="center" show-overflow-tooltip>
                                    <template #default="scope">
                                        <p></p>

                                        <el-button type="primary" plain @click="confirmPre(scope.row)"><el-icon>
                                                <EditPen />
                                            </el-icon>确认收货</el-button>
                                    </template>
                                </el-table-column>
                                <el-table-column fixed="right" v-if="false" label="查看" width="80" header-align="center"
                                    align="center" show-overflow-tooltip>
                                    <template #default="{ row }">
                                        <p>
                                        <p @click="confirmPre(row)" style="cursor: pointer;">
                                            <el-icon>
                                                <InfoFilled />
                                            </el-icon>
                                        </p>
                                        </p>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-card>
                        <el-card :body-style="cardBodyStyle">
                            <el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize"
                                :page-sizes="[5, 10, 15, 20]" :background="background"
                                layout="total, sizes, prev, pager, next, jumper" :total="thTotal"
                                @size-change="handleSizeChange" @current-change="handleCurrentChange" />
                        </el-card>
                    </el-tab-pane>

                    <el-tab-pane label="全部" name="qb">
                        <el-card :body-style="cardBodyStyle">
                            <el-table style="width: 100%" :data="tableData" border :row-style="rowStyle"
                                @selection-change="handleSelectionChange">
                                <el-table-column type="index" label="序号" width="80" header-align="center" align="center"
                                    show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="jlh" label="计量号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="ybid" label="运单号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="carno" label="车号" width="200" header-align="center"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="wuzimc" label="物资名称" width="100"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="storageOperatorname" label="操作人" width="100"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="shdwmc" label="收货单位名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="storaged" label="收货确认" width="81"
                                    header-align="center" align="center" show-overflow-tooltip>
                                    <template #default="scope">
                                        {{ scope.row.storaged == 1 ? '是' : '否' }}
                                    </template>
                                </el-table-column>
                                <el-table-column v-if="true" prop="kzh" sortable label="扣吨(t)" width="100"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="jszl" sortable label="结算重量(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="fdrivername" label="司机姓名" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="fhdwmc" label="发货单位名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="true" prop="wtdwmc" label="承运商名称" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="ckmc" label="仓库名称" header-align="center" width="150"
                                    align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lsmz" sortable label="来时毛重(t)" width="130"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lspz" sortable label="来时皮重(t)" header-align="center"
                                    width="130" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="lsjz" sortable label="来时净重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="mzh" sortable label="实际毛重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="pzh" sortable label="实际皮重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="jzh" sortable label="实际净重(t)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="rossTime" sortable label="计毛时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="tareTime" sortable label="计皮时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="suttleTime" sortable label="净重时间" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="true" prop="ddsj" sortable label="等待时间(分)" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column v-if="false" prop="xcys" sortable label="卸车用时(分)???" width="200"
                                    header-align="center" align="center" show-overflow-tooltip>
                                </el-table-column>

                                <el-table-column v-if="false" fixed="right" label="收货" width="150" header-align="center"
                                    align="center" show-overflow-tooltip>
                                    <template #default="scope">
                                        <p></p>

                                        <el-button type="primary" plain @click="confirmPre(scope.row)"><el-icon>
                                                <EditPen />
                                            </el-icon>确认收货</el-button>
                                    </template>
                                </el-table-column>
                                <el-table-column fixed="right" v-if="false" label="查看" width="80" header-align="center"
                                    align="center" show-overflow-tooltip>
                                    <template #default="{ row }">
                                        <p>
                                        <p @click="confirmPre(row)" style="cursor: pointer;">
                                            <el-icon>
                                                <InfoFilled />
                                            </el-icon>
                                        </p>
                                        </p>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-card>
                        <el-card :body-style="cardBodyStyle">
                            <div style="display: flex;width: 100%;align-items: center;">
                                <el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize"
                                    :page-sizes="[5, 10, 15, 20]" :background="background"
                                    layout="total, sizes, prev, pager, next, jumper" :total="total"
                                    @size-change="handleSizeChange" @current-change="handleCurrentChange" />
                                &nbsp &nbsp &nbsp &nbsp &nbsp <p
                                    style="height: 25px;width: 25px;background-color: rgb(188, 216, 190);"></p>
                                &nbsp已收货&nbsp &nbsp
                                <p style="height: 25px;width: 25px;background-color: rgb(192, 188, 216);"></p>
                                &nbsp复磅&nbsp &nbsp
                                <p style="height: 25px;width: 25px;background-color: #969a98;"></p>&nbsp退货&nbsp &nbsp
                            </div>
                        </el-card>
                    </el-tab-pane>
                </el-tabs>

            </el-card>

        </el-card>


        <!-- 收货凭证弹出框 -->
        <el-dialog :close-on-click-modal="false" draggable title="收货凭证" v-model="dialogVisibleM" width="1200px">
            <div>
                <el-card :body-style="cardBodyStyle">
                    <Attachment ref="AttachmentRefManual" :fId="fId"></Attachment>
                </el-card>
            </div>
        </el-dialog>

        <el-dialog :close-on-click-modal="false" draggable title="收货确认" v-model="dialogVisible" width="1500px"
            top="5vh">
            <div>
                <!-- <el-button type="danger" @click="closeConfirm">关闭</el-button> -->
                <el-button plain @click="fb">复磅</el-button>
                <el-button plain @click="th">退回</el-button>
                <!-- <el-button plain @click="closeConfirm">取消收货</el-button> -->
                <el-button plain @click="uploadSHPhoto">收货凭证

                </el-button>
                <el-button type="primary" @click="ConfrimSure">收货确认后关闭</el-button>
            </div><br>

            <!-- 此处是列表描述 -->
            <el-card :body-style="cardBodyStyle" class="diaClass90">
                <el-descriptions title="车辆及驾驶员信息" :column="4">
                    <el-descriptions-item label="车牌号：">{{ jlzbData.carno }}</el-descriptions-item>
                    <el-descriptions-item label="车辆类型：">{{ carType }}</el-descriptions-item>
                    <el-descriptions-item label="司机姓名：">{{ ydData.fdrivername }}</el-descriptions-item>
                    <el-descriptions-item label="司机联系方式：">{{ ydData.fdriveridcard }}</el-descriptions-item>
                </el-descriptions>
                <el-divider />
                <el-descriptions title="物流信息" :column="4">
                    <el-descriptions-item label="合同号：">{{ jlzbData.htbh }}</el-descriptions-item>
                    <el-descriptions-item label="订单号：">{{ jlzbData.orderid }}</el-descriptions-item>
                    <el-descriptions-item label="发运指示号：">{{ jlzbData.ywh }}</el-descriptions-item>
                    <el-descriptions-item label="运单号：">{{ jlzbData.ybid }}</el-descriptions-item>

                    <el-descriptions-item label="物资名称：">{{ jlzbData.wuzimc }}</el-descriptions-item>
                    <el-descriptions-item label="供应商名称：">{{ ydData.fsupplyname }}</el-descriptions-item>
                    <el-descriptions-item label="货源地：">{{ ydData.faddresssnd }}</el-descriptions-item>
                    <el-descriptions-item label="收货单位：">{{ ydData.frcvstation }}</el-descriptions-item>

                    <el-descriptions-item label="原发毛重：">{{ jlzbData.lsmz }}t</el-descriptions-item>
                    <el-descriptions-item label="原发皮重：">{{ jlzbData.lspz }}t</el-descriptions-item>
                    <el-descriptions-item label="原发净重：">{{ jlzbData.lsjz }}t</el-descriptions-item>
                    <el-descriptions-item label="入场时间：">{{ ydData.ftin }}</el-descriptions-item>

                    <el-descriptions-item label="过磅毛重：">{{ jlzbData.mzh }}t</el-descriptions-item>
                    <el-descriptions-item label="过磅皮重：">{{ jlzbData.pzh }}t</el-descriptions-item>
                    <el-descriptions-item label="过磅净重：">{{ jlzbData.jzh }}t</el-descriptions-item>
                    <el-descriptions-item label="毛重时间：">{{ jlzbData.rossTime }}</el-descriptions-item>

                    <el-descriptions-item label="毛重差：">{{ jlzbData.mzc }}t</el-descriptions-item>
                    <el-descriptions-item label="皮重差：">{{ jlzbData.pzc }}t</el-descriptions-item>
                    <el-descriptions-item label="路损重量：">{{ jlzbData.lszl }}</el-descriptions-item>
                    <el-descriptions-item label="皮重时间：">{{ jlzbData.tareTime }}</el-descriptions-item>

                    <el-descriptions-item label="需采样：">{{ jlzbData.cyflag == 0 ? '否' : '是' }}</el-descriptions-item>
                    <el-descriptions-item label="已采样：">{{ jlzbData.cyh == '' ? '否' : '是' }}</el-descriptions-item>
                </el-descriptions>
                <el-divider />
                <el-descriptions title="操作信息" :column="4">
                    <el-descriptions-item label="是否扣吨:" style="display: flex;">
                        <el-input-number v-model="czConfirm.kzh" min="0" :max="czConfirm.jzh"
                            :disabled="!sfkdDisable" /><el-switch v-model="sfkdDisable" active-text="是"
                            inactive-text="否" />
                    </el-descriptions-item>
                    <el-descriptions-item label="扣吨原因：">
                        <el-autocomplete v-model="autocompleteValue" style="width: 200px;" clearable placeholder="请输入内容"
                            @select="handleSelect" :fetch-suggestions="querySearch">
                            <template #suffix>

                            </template>
                        </el-autocomplete>
                    </el-descriptions-item>
                    <div style="display: flex;">
                        <el-descriptions-item>
                            <Popup_sto_config_one ref="PopupRefThree3" :level1="true" @receive-from-child="retu">
                            </Popup_sto_config_one>
                        </el-descriptions-item>
                    </div>

                </el-descriptions>
            </el-card>

        </el-dialog>


    </div>
</template>

<script setup>

import {
    onUnmounted,
    ref,
    reactive,
    onMounted,
    getCurrentInstance,
    nextTick
} from 'vue'

const {
    proxy
} = getCurrentInstance()

import tools from '@/tools'
import Popup_sto_config_one from "@/views/sto/components/Popup_sto_config_one.vue";
// 控制骨架屏显示的变量
const showSkeleton = ref(false)
function reloadPage() {
    showSkeleton.value = true;

    setTimeout(() => {
        location.reload();
    }, 1000);
}

/**
 * 下拉
 */
const suggestions = ref([]);
const querySearch = (queryString, cb) => {
    const results = [{ value: '装载不足' }, { value: '水分损失' }, { value: '车辆改装或损坏' }, { value: '物资质量下降' }];
    cb(results);
};
const autocompleteValue = ref('');

const handleSelect = (item) => {
    czConfirm.value.kdyy = item.value
    console.log(item)
};

// 示例数据
const someData = ref(['你好']);
/**
 * 下拉
 */
//仓库选择
const retu = (val) => {
    czConfirm.value.ckmc = val.value
    czConfirm.value.ckbm = val.storeCd
}

const cardBodyStyle = ref(tools.style.card)
const inputStyle = ref(tools.style.input)
import Attachment from '../../../components/Attachment.vue';
import { ElMessage, ElSkeleton } from 'element-plus';
import { useRouter, useRoute } from 'vue-router';
const router = useRouter()
const route = useRoute()

const localStorageDeptTree = ref()
onMounted(() => {
    localStorage.setItem('activeName', 'dsh')
    query()
    localStorageDeptTree.value = JSON.parse(localStorage.getItem("deptTree"))
    localStorageDeptTree.value = localStorageDeptTree.value[0]
})

/**
 * 所属类目配置
 */
//已收货
const yshTableData = ref([])
const yshTotal = ref(0)
//待收货
const dshTableData = ref([])
const dshTotal = ref(0)
//复磅
const fbTableData = ref([])
const fbTotal = ref(0)
//整车退货
const thTableData = ref([])
const thTotal = ref(0)

const activeName = ref(localStorage.getItem('activeName'))

const handleClick = (tab, event) => {
    //每次点击标签都会回到第一页
    currentPage.value = 1
    query()
}
/**
 * 所属类目配置
 */

/**
 * 自动推送数据
 */
// localStorage.setItem("switchOpen","false")
const switchOpen = ref(false)
const intervalId = ref(null);

const openchange = (val) => {
    aa()
};

const aa = () => {
    if (switchOpen.value) {
        startTimer()
    } else {
        stopTimer()
    }
}

const bb = () => {
    query()
}

const startTimer = () => {
    if (intervalId.value) {
        return;
    }
    intervalId.value = setInterval(bb, 10000);
};

const stopTimer = () => {
    if (intervalId.value) {
        clearInterval(intervalId.value);
        intervalId.value = null;
    }
};

onUnmounted(() => {
    if (intervalId.value) {
        clearInterval(intervalId.value);
    }
});

/**
 * 自动推送数据
 */

/**
  * 颜色渲染
  */

// const tableRowClassName = ({ row, rowIndex }) => {
//     if (rowIndex === 1) {
//         console.log("rowin", rowIndex)
//         return 'warning-row';
//     } else if (rowIndex === 2) {
//         return 'success-row';
//     } else if (rowIndex === 3) {
//         return 'danger-row';
//     }
// };

const rowStyle = ({ row, rowIndex }) => {
    if (row.storaged == 2) {
        return {
            background: 'rgb(192, 188, 216)'
        };
    } else if (row.storaged == 1) {
        return {
            background: 'rgb(188, 216, 190)'
        }
    } else if (row.storaged == 3) {
        return {
            background: '#969a98'
        }
    }

    return ''
};

/**
 *   查询
 */




const queryForm = ref({
    tem: '',
    ywlxid: '',
})

const tableData = ref([])

const dwQuery = () => {
    currentPage.value = 1
    query()
}

const query = () => {
    var url = 'wgt/Qchjlxx/query'
    queryForm.value.ywlxid = '01'
    var param = {
        page: currentPage.value,
        rows: pageSize.value,
        params: JSON.stringify(queryForm.value)
    }

    proxy.$axios.get(url, param).then(response => {
        if (response.data.code == '0') {
            //全部数据
            tableData.value = response.data.data.list
            total.value = response.data.data.total

            dshTableData.value = response.data.data.dshList
            yshTableData.value = response.data.data.yshList
            fbTableData.value = response.data.data.fbList
            thTableData.value = response.data.data.thList

            dshTotal.value = response.data.data.dshTotal
            yshTotal.value = response.data.data.yshTotal
            fbTotal.value = response.data.data.fbTotal
            thTotal.value = response.data.data.thTotal
        } else {
            ElMessage.error('操作失败！' + response.data.msg)
        }
    })
}
/**
 *   查询
 */

/**
 * 收货确认
 */
//是否扣吨
const sfkdDisable = ref(false)
//根据运单号查运单表数据
const ydData = ref([])
const jlzbData = ref([])

const czConfirm = ref({
    id: '',
    ckbm: '',
    shdwmc: '',
    shdwbm: '',
    ckmc: '',
    kzh: 0,
    memo: '',
    storaged: '',
    ddsj: '',
    mzc: 0,
    pzc: 0,
    lszl: 0,
    jzh: 0,
    kdyy: '',
    storeNm: '',
    storeCd: '',
})
const resetczConfirm = () => {
    czConfirm.value = {
        id: '',
        ckbm: '',
        shdwmc: '',
        shdwbm: '',
        ckmc: '',
        kzh: 0,
        memo: '',
        storaged: '',
        ddsj: '',
        mzc: 0,
        pzc: 0,
        lszl: 0,
        jzh: 0,
        kdyy: '',
        storeNm: '',
        storeCd: '',
    }
}
//复磅
const fb = () => {
    ElMessageBox.confirm(
        '您确认要复磅吗?',
        '警告',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
        }
    )
        .then(() => {
            czConfirm.value.ckmc = ''
            czConfirm.value.ckbm = ''

            var url = 'wgt/Qchjlxx/save'
            czConfirm.value.id = jlzbData.value.id
            czConfirm.value.storaged = 2
            czConfirm.value.shdwmc = localStorageDeptTree.value.deptName
            czConfirm.value.shdwbm = localStorageDeptTree.value.deptCode

            czConfirm.value.ddsj = jlzbData.value.ddsj
            czConfirm.value.mzc = jlzbData.value.mzc
            czConfirm.value.pzc = jlzbData.value.pzc
            czConfirm.value.lszl = jlzbData.value.lszl

            var json = {
                json: JSON.stringify(czConfirm.value)
            }

            proxy.$axios.get(url, json).then(response => {
                if (response.data.code == '0') {
                    ydData.value = { ...response.data.data }
                    ElMessage.success('操作成功')
                    resetczConfirm()
                    query()
                    dialogVisible.value = false
                } else {
                    ElMessage.error('操作失败！' + response.data.msg)
                    resetczConfirm()
                    dialogVisible.value = false
                }
            })
            dialogVisible.value = false
        })
        .catch(() => {
            ElMessage({
                type: 'info',
                message: '取消操作',
            })
        })
}
//退回
const th = () => {
    ElMessageBox.confirm(
        '您确认要退回吗?',
        '警告',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
        }
    )
        .then(() => {
            czConfirm.value.ckmc = ''
            czConfirm.value.ckbm = ''

            var url = 'wgt/Qchjlxx/save'
            czConfirm.value.id = jlzbData.value.id
            czConfirm.value.storaged = 3
            czConfirm.value.shdwmc = localStorageDeptTree.value.deptName
            czConfirm.value.shdwbm = localStorageDeptTree.value.deptCode

            czConfirm.value.ddsj = jlzbData.value.ddsj
            czConfirm.value.mzc = jlzbData.value.mzc
            czConfirm.value.pzc = jlzbData.value.pzc
            czConfirm.value.lszl = jlzbData.value.lszl

            var json = {
                json: JSON.stringify(czConfirm.value)
            }

            proxy.$axios.get(url, json).then(response => {
                if (response.data.code == '0') {
                    ydData.value = { ...response.data.data }
                    ElMessage.success('操作成功')
                    query()
                    dialogVisible.value = false
                    resetczConfirm()
                } else {
                    ElMessage.error('操作失败！' + response.data.msg)
                    dialogVisible.value = false
                    resetczConfirm()
                }
            })
        })
        .catch(() => {
            ElMessage({
                type: 'info',
                message: '取消操作',
            })
        })
}

//收货凭证上传
const uploadSHPhoto = () => {


    nextTick(() => {
        dialogVisibleM.value = true
        fId.value = jlzbData.value.id
        query()
    })



}
//收货确认，访问后端接口
const ConfrimSure = () => {
    ElMessageBox.confirm(
        '您确认要收货吗?',
        '警告',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
        }
    )
        .then(() => {
            var url = 'wgt/Qchjlxx/save'
                czConfirm.value.id = jlzbData.value.id
                czConfirm.value.storaged = 1
                czConfirm.value.shdwmc = localStorageDeptTree.value.deptName
                czConfirm.value.shdwbm = localStorageDeptTree.value.deptCode

                czConfirm.value.ddsj = jlzbData.value.ddsj
                czConfirm.value.mzc = jlzbData.value.mzc
                czConfirm.value.pzc = jlzbData.value.pzc
                czConfirm.value.lszl = jlzbData.value.lszl


                var json = {
                    json: JSON.stringify(czConfirm.value)
                }
                proxy.$axios.get(url, json).then(response => {
                    if (response.data.code == '0') {
                        ydData.value = { ...response.data.data }
                        resetczConfirm()
                        query()
                        ElMessage.success('操作成功')
                    } else {
                        ElMessage.error('操作失败！' + response.data.msg)
                        resetczConfirm()
                        query()
                    }
                })
                dialogVisible.value = false
        })
        .catch(() => {
            ElMessage({
                type: 'info',
                message: '取消操作',
            })
        })
}

const dialogVisible = ref(false)

//车辆类型
const carType = ref('')
const confirmPre = (row) => {
    console.log("row", row)
    nextTick(() => {
        carType.value = ''
    })
    query()
    if (row.cyh == '' && row.cyflag == 1) {
        ElMessage.warning('无法确认，改物品未采样')
        return
    }
    czConfirm.value.jzh = Number(row.jzh)
    var url2 = 'tms/Carinfo/queryByCarNo'


    jlzbData.value = row



    dialogVisible.value = true

    var url = 'tms/TmsWaybill/queryByfbillno'
    var param = {
        fbillno: row.ybid,
        carNo: row.carno,
    }
    proxy.$axios.get(url2, param).then(response => {
        if (response.data.code == '0') {
            carType.value = response.data.data.carType
        } else {
            ElMessage.error('操作失败！' + response.data.msg)
        }
    })
    proxy.$axios.get(url, param).then(response => {
        if (response.data.code == '0') {
            ydData.value = { ...response.data.data }
        } else {
            ElMessage.error('操作失败！' + response.data.msg)
        }
    })
}


const dialogVisibleM = ref(false)
const dialogVisibleP = ref(false)

/**
 * 收货确认
 */

/**
 * 上传
 */

const fId = ref('x')
const AttachmentRefManual = ref(null)

/**
 * 上传
 */

//获得所有仓库

/**
 * 分页
 */
const currentPage = ref(1)
const total = ref(0)
const pageSize = ref(5)
const handleSizeChange = (val) => {
    pageSize.value = val
    query()
}
const handleCurrentChange = (val) => {
    currentPage.value = val
    query()
}
/**
 * 分页
 */

/**
 * 导出表格
 */
const handleExport = () => {
    location.href = import.meta.env.VITE_BASE_API + '/wgt/excel/exportAll'
}
/**
 * 导出表格
 */

/**
 * 保存、修改、删除
 */

const openDialog = () => {
}


/**
 * 保存、修改、删除
 */

const multipleSelection = ref([])
const handleSelectionChange = (val) => {
    multipleSelection.value = val
}



</script>

<style scoped>
::v-deep .diaClass90 .el-form-item {
    width: 90%
}

.el-descriptions {
    margin-top: 20px;
}

.cell-item {
    display: flex;
    align-items: center;
}

.margin-top {
    margin-top: 20px;
    background-color: #969a98;
}
</style>