<template>
    <el-skeleton :rows="10" animated v-if="showSkeleton" />
    <div v-if="!showSkeleton">
        <div style="margin-top: 10px;">
            <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: 10px;"></div>
                    <el-switch v-model="switchOpen" size="default" @change="openchange" active-text="自动推送数据" />
                </el-form-item>
            </el-form>
        </div>
        <el-card><el-button type="primary" plain @click="handleExport" style="">导出全部列表数据</el-button>
            <el-button type="primary" @click="dwQuery">查询</el-button></el-card>

        <el-card>
            <div style="display: flex;">
                计划到厂车辆总数：<span style="color: brown;font-size: 21px;">{{ totalAll
                    }}</span>&nbsp;&nbsp;&nbsp;&nbsp;待入厂车辆：<span style="color: brown;font-size: 21px;">{{ totalDrc
                    }}</span>&nbsp;&nbsp;&nbsp;&nbsp;在厂车辆：<span style="color: brown;font-size: 21px;">{{ totalZc
                    }}</span>&nbsp;&nbsp;&nbsp;&nbsp;出厂车辆：<span style="color: brown;font-size: 21px;">{{ totalCc
                    }}</span>&nbsp;&nbsp;&nbsp;&nbsp;本周进出厂车辆：<span style="color: brown;font-size: 21px;">{{ bzjcccl
                    }}</span>
            </div>

        </el-card>


        <el-card :body-style="cardBodyStyle" class="diaClass90">
            <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">


                <el-tab-pane label="待入厂" name="drc">
                    <el-card :body-style="cardBodyStyle">
                        <el-table style="width: 100%;max-height: 400px;overflow: auto;" :data="tableDataDrc" border
                            :row-style="rowStyle">
                            <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="carnoa" label="车号" width="130" header-align="center"
                                align="center" show-overflow-tooltip>
                                <template #default="{ row }">
                                    <div
                                        :class="{ lan: row.ysa == '蓝', lv: row.ysa == '绿', hei: row.ysa == '黑', huanglv: row.ysa == '黄绿', huang: row.ysa == '黄' }">
                                        <p style="color: black;font-weight: 600;">{{ row.carnoa }}</p>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column v-if="true" prop="jhha" label="计划号" width="175" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="ydha" label="运单号" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="ywlxa" label="业务类型" width="90" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="wzmca" label="物资名称" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="true" prop="sjxma" label="司机姓名" width="100" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="dha" label="电话" width="150" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="fhdwa" label="发货单位" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="shdwa" label="收货单位" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="false" prop="pdha" label="排队号" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="false" prop="qdsja" label="签到时间" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="false" prop="faccepta" label="开始/结束" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="false" prop="fstatusa" label="跟踪状态" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>


                            <el-table-column v-if="true" fixed="right" label="操作" width="160" header-align="center"
                                align="center" show-overflow-tooltip>
                                <template #default="scope">
                                    <el-button type="primary" plain @click="confirmPre2(scope.row)">
                                        详情
                                    </el-button>
                                    <el-button type="primary" @click="open(scope.row.ydha)">放行</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 @click="fetchTar(row)" style="cursor: pointer;">
                                        <el-icon>
                                            <InfoFilled />
                                        </el-icon>
                                    </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="currentPageAll" v-model:page-size="pageSizeAll"
                                :page-sizes="[20, 40, 60, 80]" :background="background"
                                layout="total, sizes, prev, pager, next, jumper" :total="totalDrc"
                                @size-change="handleSizeChangeAll" @current-change="handleCurrentChangeAll" />
                            <!-- &nbsp &nbsp &nbsp &nbsp &nbsp <p
                                    style="height: 25px;width: 25px;background-color: rgb(188, 216, 190);"></p>
                                &nbsp已发货&nbsp &nbsp -->
                        </div>
                    </el-card>
                </el-tab-pane>

                <el-tab-pane label="在厂" name="zc">
                    <el-card :body-style="cardBodyStyle">
                        <el-table style="width: 100%;max-height: 400px;overflow: auto;" :data="tableDataZc" border
                            :row-style="rowStyle">
                            <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="carnoa" label="车号" width="130" header-align="center"
                                align="center" show-overflow-tooltip>
                                <template #default="{ row }">
                                    <div
                                        :class="{ lan: row.ysa == '蓝', lv: row.ysa == '绿', hei: row.ysa == '黑', huanglv: row.ysa == '黄绿', huang: row.ysa == '黄' }">
                                        <p style="color: black;font-weight: 600;">{{ row.carnoa }}</p>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column v-if="true" prop="jhha" label="计划号" width="175" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="ydha" label="运单号" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="ywlxa" label="业务类型" width="90" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="wzmca" label="物资名称" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="true" prop="sjxma" label="司机姓名" width="100" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="dha" label="电话" width="150" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="fhdwa" label="发货单位" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="shdwa" label="收货单位" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="false" prop="pdha" label="排队号" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="false" prop="qdsja" label="签到时间" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="false" prop="faccepta" label="开始/结束" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="false" prop="fstatusa" label="跟踪状态" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="true" fixed="right" label="操作" width="110" header-align="center"
                                align="center" show-overflow-tooltip>
                                <template #default="scope">
                                    <el-button type="primary" plain @click="confirmPre(scope.row)">
                                        详情
                                    </el-button>
                                </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="currentPageAll" v-model:page-size="pageSizeAll"
                                :page-sizes="[20, 40, 60, 80]" :background="background"
                                layout="total, sizes, prev, pager, next, jumper" :total="totalZc"
                                @size-change="handleSizeChangeAll" @current-change="handleCurrentChangeAll" />
                            <!-- &nbsp &nbsp &nbsp &nbsp &nbsp <p
                                    style="height: 25px;width: 25px;background-color: rgb(188, 216, 190);"></p>
                                &nbsp已发货&nbsp &nbsp -->
                        </div>
                    </el-card>
                </el-tab-pane>

                <el-tab-pane label="出厂" name="cc">
                    <el-card :body-style="cardBodyStyle">
                        <el-table style="width: 100%;max-height: 400px;overflow: auto;" :data="tableDataCc" border
                            :row-style="rowStyle">
                            <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="carnoa" label="车号" width="130" header-align="center"
                                align="center" show-overflow-tooltip>
                                <template #default="{ row }">
                                    <div
                                        :class="{ lan: row.ysa == '蓝', lv: row.ysa == '绿', hei: row.ysa == '黑', huanglv: row.ysa == '黄绿', huang: row.ysa == '黄' }">
                                        <p style="color: black;font-weight: 600;">{{ row.carnoa }}</p>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column v-if="true" prop="jhha" label="计划号" width="175" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="ydha" label="运单号" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="ywlxa" label="业务类型" width="90" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="wzmca" label="物资名称" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="true" prop="sjxma" label="司机姓名" width="100" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="dha" label="电话" width="150" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="fhdwa" label="发货单位" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="shdwa" label="收货单位" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="false" prop="pdha" label="排队号" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="false" prop="qdsja" label="签到时间" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="false" prop="faccepta" label="开始/结束" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="false" prop="fstatusa" label="跟踪状态" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="true" fixed="right" label="操作" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                                <template #default="scope">
                                    <el-button type="primary" plain @click="confirmPre(scope.row)">
                                        详情
                                    </el-button>
                                </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="currentPageAll" v-model:page-size="pageSizeAll"
                                :page-sizes="[20, 40, 60, 80]" :background="background"
                                layout="total, sizes, prev, pager, next, jumper" :total="totalCc"
                                @size-change="handleSizeChangeAll" @current-change="handleCurrentChangeAll" />
                            <!-- &nbsp &nbsp &nbsp &nbsp &nbsp <p
                                    style="height: 25px;width: 25px;background-color: rgb(188, 216, 190);"></p>
                                &nbsp已发货&nbsp &nbsp -->
                        </div>
                    </el-card>
                </el-tab-pane>
                <el-tab-pane label="全部" name="qb">
                    <el-card>
                        <el-table style="width: 100%;height: 400px;overflow: scroll;" :data="tableDataAll" border
                            :row-style="rowStyle">
                            <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" label="车号" width="130" header-align="center" align="center"
                                show-overflow-tooltip>
                                <template #default="{ row }">
                                    <div
                                        :class="{ lan: row.ysa == '蓝', lv: row.ysa == '绿', hei: row.ysa == '黑', huanglv: row.ysa == '黄绿', huang: row.ysa == '黄' }">
                                        <p style="color: black;font-weight: 600;">{{ row.carnoa }}</p>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column v-if="true" prop="jhha" label="计划号" width="175" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="ydha" label="运单号" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="ywlxa" label="业务类型" width="90" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="wzmca" label="物资名称" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="true" prop="sjxma" label="司机姓名" width="100" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="dha" label="电话" width="150" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="fhdwa" label="发货单位" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="true" prop="shdwa" label="收货单位" width="200" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="false" prop="pdha" label="排队号" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>
                            <el-table-column v-if="false" prop="qdsja" label="签到时间" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="false" prop="faccepta" label="开始/结束" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>

                            <el-table-column v-if="false" prop="fstatusa" label="跟踪状态" width="" header-align="center"
                                align="center" show-overflow-tooltip>
                            </el-table-column>


                            <el-table-column v-if="true" fixed="right" label="操作" width="110" header-align="center"
                                align="center" show-overflow-tooltip>
                                <template #default="scope">
                                    <el-button type="primary" plain @click="confirmPre(scope.row)">
                                        详情
                                    </el-button>
                                </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="currentPageAll" v-model:page-size="pageSizeAll"
                                :page-sizes="[20, 40, 60, 80]" :background="background"
                                layout="total, sizes, prev, pager, next, jumper" :total="totalAll"
                                @size-change="handleSizeChangeAll" @current-change="handleCurrentChangeAll" />
                            <!-- &nbsp &nbsp &nbsp &nbsp &nbsp <p
                                    style="height: 25px;width: 25px;background-color: rgb(188, 216, 190);"></p>
                                &nbsp已发货&nbsp &nbsp -->
                        </div>
                    </el-card>
                </el-tab-pane>
            </el-tabs>

        </el-card>


        <el-dialog :close-on-click-modal="false" draggable title="详细信息" v-model="dialogVisible" width="1000px"
            top="18vh">
            <el-card :body-style="cardBodyStyle" class="diaClass90">
                <el-descriptions title="" :column="3">
                    <el-descriptions-item align="left" label="车号:">{{ xqRc.carnoa }}</el-descriptions-item>
                    <el-descriptions-item align="left" label="计划号:">{{ xqRc.jhha }}</el-descriptions-item>
                    <el-descriptions-item align="left" label="业务类型:">{{ xqRc.ywlxa }}</el-descriptions-item>
                    <el-descriptions-item align="left" label="物资名称:">{{ xqRc.wzmca }}</el-descriptions-item>

                    <el-descriptions-item align="left" label="司机姓名:">{{ xqRc.sjxma }}</el-descriptions-item>
                    <el-descriptions-item align="left" label="电话:">{{ xqRc.dha }}</el-descriptions-item>
                    <el-descriptions-item align="left" label="运单号:">{{ xqRc.ydha }}</el-descriptions-item>
                    <el-descriptions-item align="left" label="发货单位:">{{ xqRc.fhdwa }}</el-descriptions-item>

                    <el-descriptions-item align="left" label="收货单位:">{{ xqRc.shdwa }}</el-descriptions-item>
                    <el-descriptions-item align="left" label="订单号:">{{ xqRc.ddha }}</el-descriptions-item>
                    <el-descriptions-item align="left" label="合同号:">{{ xqRc.htha }}</el-descriptions-item>
                    <el-descriptions-item align="left" label="车型:">{{ xqRc.cxa }}</el-descriptions-item>
                    <el-descriptions-item align="left" label="排放标准:">{{ xqRc.pfbza }}</el-descriptions-item>
                </el-descriptions>
                <el-card>
                    <span v-if="listPic.length > 0" v-for="(a, index) in listPic" :key="index">
                        <el-image @click="showImageViewer(a)" style="width: 100px; height: 100px" :src="a"
                            :fit="cover" />
                        <el-image-viewer :features="features" v-if="showViewer" :url-list="previewList"
                            :initial-index="initialIndex" @close="closeViewer" />
                    </span>
                    <span v-else style="color: red;font-size: 20px">暂无图片</span>
                </el-card>




                <div v-if="false" style="display: flex;justify-content: space-between;">
                    <p></p>
                    <el-button size="default" type="primary" plain @click="passFx(xqRc.ydha)">放行</el-button>
                </div>

            </el-card>

        </el-dialog> 

        <el-dialog :close-on-click-modal="false" draggable title="详细信息" v-model="dialogVisible2" width="1000px"
            top="18vh">
            <el-card :body-style="cardBodyStyle" class="diaClass90">
                <el-descriptions title="" :column="3">
                    <el-descriptions-item label="车号：">{{ xqRc.carnoa }}</el-descriptions-item>
                    <el-descriptions-item label="计划号：">{{ xqRc.jhha }}</el-descriptions-item>
                    <el-descriptions-item label="业务类型：">{{ xqRc.ywlxa }}</el-descriptions-item>
                    <el-descriptions-item label="物资名称：">{{ xqRc.wzmca }}</el-descriptions-item>

                    <el-descriptions-item label="司机姓名：">{{ xqRc.sjxma }}</el-descriptions-item>
                    <el-descriptions-item label="电话：">{{ xqRc.dha }}</el-descriptions-item>
                    <el-descriptions-item label="运单号：">{{ xqRc.ydha }}</el-descriptions-item>
                    <el-descriptions-item label="发货单位：">{{ xqRc.fhdwa }}</el-descriptions-item>

                    <el-descriptions-item label="收货单位：">{{ xqRc.shdwa }}</el-descriptions-item>
                    <el-descriptions-item label="订单号：">{{ xqRc.ddha }}</el-descriptions-item>
                    <el-descriptions-item label="合同号：">{{ xqRc.htha }}</el-descriptions-item>
                    <el-descriptions-item label="车型：">{{ xqRc.cxa }}</el-descriptions-item>
                    <el-descriptions-item label="排放标准：">{{ xqRc.pfbza }}</el-descriptions-item>
                </el-descriptions>
                <el-card>
                    <span v-if="listPic.length > 0" v-for="(a, index) in listPic" :key="index">
                        <el-image @click="showImageViewer(a)" style="width: 100px; height: 100px" :src="a"
                            :fit="cover" />
                        <el-image-viewer :features="features" v-if="showViewer" :url-list="previewList"
                            :initial-index="initialIndex" @close="closeViewer" />
                    </span>
                    <span v-else style="color: red;font-size: 20px">暂无图片</span>
                </el-card>
                <div v-if="true" style="display: flex;justify-content: space-between;margin-top: 20px">
                    <p></p>
                    <!-- <el-button size="default" type="primary" plain @click="passFx(xqRc.ydha)">放行</el-button> -->
                    <el-button size="large" type="primary" @click="open(xqRc.ydha)"><p></p><p style="font-weight: 500;">放行</p></el-button>
                </div>

            </el-card>

        </el-dialog>


    </div>
</template>

<script setup>
/**
 * 必写
 */
import {
    onUnmounted,
    ref,
    reactive,
    onMounted,
    getCurrentInstance,
    nextTick
} from 'vue'

const viewa = ref(import.meta.env.VITE_BASE_API)

const {
    proxy
} = getCurrentInstance()

import tools from '@/tools'
import { ElMessage } from 'element-plus';

/**
 * 查看图片
 */
//查询数据（图片id）
const listPic = ref([])
const tableDataPic = ref([])
const showViewer = ref(false);
const initialIndex = ref(0);
const previewList = ref([]);

// 禁用放大和缩小的特征配置
const features = ref({
    zoom: false, // 禁用放大缩小功能
});

// 显示图片预览
const showImageViewer = (item) => {
    previewList.value = [item]; // 只为当前点击的图片提供一个列表
    showViewer.value = true;
};

// 关闭图片预览
const closeViewer = () => {
    showViewer.value = false;

};
const getTableData = (row) => {
    var url = 'framework/Common/queryFile'
    var param = {
        fId: row.carnoa
    }
    proxy.$axios.get(url, param).then(response => {
        if (response.data.code == 0) {
            tableDataPic.value = response.data.data
            tableDataPic.value.forEach(a => {
                listPic.value.push(viewa.value + `/framework/Common/downloadFileFtp?id=` + a.id)
            })
        } else {
            ELMessage({
                type: 'error',
                message: '失败！' + response.data.msg,
            })
        }
    })
}
/**
 * 查看图片
 */
/**
 * 必写
 */
/**
 * 第一行
 */
//本周进出厂车辆
const bzjcccl = ref(0)
const queryByTime = () => {
    var url = 'tms/TmsWaybill/queryByTime'
    var param = {

    }
    proxy.$axios.get(url, param).then(response => {
        if (response.data.code == '0') {
            bzjcccl.value = response.data.data
        } else {
            ElMessage.error('操作失败！' + response.data.msg)
        }
    })
}
/**
 * 第一行
 */

const activeName = ref('drc')

const handleClick = (tab, event) => {
    //每次点击标签都会回到第一页

    currentPageAll.value = 1
    queryAll()
}
/**
 * 所属类目配置
 */
onMounted(() => {
    queryAll()
    queryByTime()
    localStorageDeptTree.value = JSON.parse(localStorage.getItem("deptTree"))
    localStorageDeptTree.value = localStorageDeptTree.value[0]
    deptName.value = localStorageDeptTree.value.deptName
    deptCode.value = localStorageDeptTree.value.deptCode
    deptid.value = localStorageDeptTree.value.id
})
const localStorageDeptTree = ref('')
const deptName = ref('')
const deptCode = ref('')
const deptid = ref('')

/**
 * 自动推送数据
 */
const switchOpen = ref(false)
const intervalId = ref(null);

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

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

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

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);
    }
});

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

/**
 * 行样式
 * @param param0 
 */
// 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 ''
// };
/**
 * 行样式
 * @param param0 
 */

/**
 *   查询
 */

/**
  * 详情
*/
const xqRc = ref([])
const dialogVisible = ref(false)
const dialogVisible2 = ref(false)
const confirmPre = (row) => {
    //请空列表
    listPic.value = []
    yd.value = row.ydha
    dialogVisible.value = true
    xqRc.value = row
    getTableData(row)
}
const confirmPre2 = (row) => {
    //请空列表
    listPic.value = []
    dialogVisible2.value = true
    xqRc.value = row
    getTableData(row)
}
/**
 * 详情
 */
/**
 * 入厂审核
 */
const jcmg = ref('')
const yd = ref('')
const passFx = (a) => {
    yd.value = a
    var url = 'tms/TmsWaybill/rcSh'
    var param = {
        ydha: yd.value,
        jcmg: jcmg.value,
        deptName: deptName.value,
        deptCode: deptCode.value,
        deptid: deptid.value
    }
    proxy.$axios.get(url, param).then(response => {
        if (response.data.code == '0') {
            ElMessage.success('操作成功')
            queryAll()
            queryByTime()
            dialogVisible2.value = false
        } else {
            ElMessage.error('操作失败！' + response.data.msg)
            dialogVisible2.value = false
        }
    })
}
/**
 * 入厂审核
 */

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

const tableDataAll = ref([])
const tableDataDrc = ref([])
const tableDataZc = ref([])
const tableDataCc = ref([])

const dwQuery = () => {
    currentPageAll.value = 1
    queryAll()
}

const queryAll = () => {
    var url = 'tms/TmsWaybill/queryAllRc'
    queryForm.value.tt = activeName.value
    var param = {
        page: currentPageAll.value,
        pageSize: pageSizeAll.value,
        activeName: activeName.value,
        json: JSON.stringify(queryForm.value)
    }

    proxy.$axios.get(url, param).then(response => {
        if (response.data.code == '0') {
            //全部数据
            tableDataAll.value = response.data.data.list
            totalAll.value = response.data.data.total
            tableDataDrc.value = response.data.data.listDrc
            totalDrc.value = response.data.data.totalDrc
            tableDataZc.value = response.data.data.listZc
            totalZc.value = response.data.data.totalZc
            tableDataCc.value = response.data.data.listCc
            totalCc.value = response.data.data.totalCc
        } else {
            ElMessage.error('操作失败！' + response.data.msg)
        }
    })
}
/**
 *   查询
 */

/**
  * 触发确认
  */
const open = (a) => {
    ElMessageBox.confirm(
        '您确认要放行吗?',
        '警告',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
        }
    )
        .then(() => {
            passFx(a)
        })
        .catch(() => {
            ElMessage({
                type: 'info',
                message: '取消操作',
            })
        })
}
/**
  * 触发确认
  */


/**
 * 分页
 */
const currentPageAll = ref(1)
const totalAll = ref(0)
const totalDrc = ref(0)
const totalZc = ref(0)
const totalCc = ref(0)
const pageSizeAll = ref(20)
const handleSizeChangeAll = (val) => {
    pageSizeAll.value = val
    queryAll()
}
const handleCurrentChangeAll = (val) => {
    currentPageAll.value = val
    queryAll()
}
/**
 * 分页
 */

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

</script>

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

/* 修改滚动条轨道 */
::-webkit-scrollbar {
    width: 10px;
    /* 滚动条宽度 */
}

/* 修改滚动条轨道背景 */
::-webkit-scrollbar-track {
    background: #f1f1f1;
    /* 轨道背景颜色 */
}

/* 修改滚动条滑块 */
::-webkit-scrollbar-thumb {
    background: #888;
    /* 滑块颜色 */
    border-radius: 5px;
    /* 滑块圆角 */
}

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

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

.margin-top {
    margin-top: 20px;
    background-color: #969a98;
}

.lv {
    background-color: #00ff80;
}

.lan {
    background-color: #00a6ff;
}

.hei {
    background-color: rgba(0, 0, 0, 0.777);
}

.huanglv {
    background-color: #9ACD32;
}

.huang {
    background-color: #e1fa00;
}
</style>