<template>
    <div>
        <!-- <el-card :body-style="cardBodyStyle">
            <el-form :inline="true">
                <el-form-item label="生产日期" style="margin-bottom: 0px;">
                    <el-date-picker v-model="query.produceDt" type="datetimerange" align="right" unlink-panels
                        range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间"
                        :picker-options="pickerOptions" style="width: 350px;" value-format="YYYY-MM-DD HH:mm:ss"
                        format="YYYY-MM-DD HH:mm:ss">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="生产班次" style="margin-bottom: 5px;" prop="prodShift">
                    <el-input v-model="query.prodShift" placeholder="请输入生产班次" clearable></el-input>
                </el-form-item>
                <el-form-item label="生产班组" style="margin-bottom: 5px;" prop="prodGrp">
                    <el-input v-model="query.prodGrp" placeholder="请输入生产班组" clearable></el-input>
                </el-form-item>
            </el-form>
        </el-card> -->
        <SearchBox ref="searchBarRef" :formName="search" :formData="query" @showPopupUser="showPop" showResetButton
            @reset="reset" />
        <ButtonBar @search="handleSearch" @add="handleAdd" @remove="handleRemoveBatch" @edit="handleEditBatch"
            @upload="handleUpload" @download="handleDownload" @import="handleImport" @export="handleExport"></ButtonBar>
        <el-card :body-style="cardBodyStyle" style=" margin-bottom: 5px;">
            <el-table :data="tableData" border highlight-current-row @selection-change="handleSelectionChange"
                style=" height: 500px;">
                <el-table-column type="selection" fixed></el-table-column>
                <el-table-column type="index" label="序号" align="center" width="60">
                    <template #default="scope">
                        <span>{{ scope.$index + (currentPage - 1) * pageSize + 1 }}</span>
                    </template>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="" width="0" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="produceDt" label="生产日期" width="110" header-align="center"
                    align="center" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="prodShift" label="生产班次" width="100" header-align="center"
                    align="center" show-overflow-tooltip>
                    <!-- <template #default="scope">
                        <span v-if="scope.row.prodShift == 1">夜班</span>
                        <span v-else-if="scope.row.prodShift == 2">白班</span>
                        <span v-else-if="scope.row.prodShift == 3">中班</span>
                    </template> -->
                </el-table-column>
                <el-table-column v-if="true" prop="prodGrp" label="生产班组" width="100" header-align="center"
                    align="center" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtJz" label="金召入厂量" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtJd" label="金鼎入厂量" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtWk1" label="外矿1入厂量" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtWk2" label="外矿2入厂量" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtWk3" label="外矿3入厂量" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtWk4" label="外矿4入厂量" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtWgfk1" label="外购粉矿1入厂量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtWgfk2" label="外购粉矿2入厂量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtWgfk3" label="外购粉矿3入厂量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtWgfk4" label="外购粉矿4入厂量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wfJz" label="金召外翻量" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wfJd" label="金鼎外翻量" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wfWk1" label="外矿1外翻量" width="110" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wfWk2" label="外矿2外翻量" width="110" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wfWk3" label="外矿3外翻量" width="110" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wfWk4" label="外矿4外翻量" width="110" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wfWgfk1" label="外购粉矿1外翻量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wfWgfk2" label="外购粉矿2外翻量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wfWgfk3" label="外购粉矿3外翻量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wfWgfk4" label="外购粉矿4外翻量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="dkJz" label="金召倒矿量" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="dkJd" label="金鼎倒矿量" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="dkWk1" label="外矿1倒矿量" width="110" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="dkWk2" label="外矿2倒矿量" width="110" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="dkWk3" label="外矿3倒矿量" width="110" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="dkWk4" label="外矿4倒矿量" width="110" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="dkWgfk1" label="外购粉矿1倒矿量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="dkWgfk2" label="外购粉矿2倒矿量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="dkWgfk3" label="外购粉矿3倒矿量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="dkWgfk4" label="外购粉矿4倒矿量" width="140" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtCs" label="粗石量" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtXs" label="细石量" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="wgtHs" label="回收矿量" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="BELONG_ID" width="540" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="流程id" width="240" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="流程状态" width="240" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="创建人id" width="300" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="创建时间" width="240" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="添加人编码" width="300" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="添加人名称" width="300" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="添加部门id" width="360" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="添加部门编码" width="360" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="添加部门名称" width="360" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="修改人id" width="300" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="修改时间" width="240" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="修改人编码" width="300" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="修改人名称" width="300" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="删除人ID" width="300" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="删除时间" width="240" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="删除标记" width="240" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="作废人编码" width="300" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="" label="作废人名称" width="300" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>


                <el-table-column label="操作" header-align="center" align="center" width="200px" fixed="right">
                    <template #default="scope">
                        <el-button plain type="warning" @click="handleEdit(scope.row)">编辑</el-button>
                        <el-button plain type="danger" @click="handleDelete(scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-card>
        <el-card :body-style="cardBodyStyle">
            <el-pagination :current-page="currentPage" :page-size="pageSize" :page-sizes="pageSizes" :total="totalRows"
                background="background" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
                @current-change="handleCurrentChange">
            </el-pagination>
        </el-card>

        <el-dialog :close-on-click-modal="false" draggable title="编辑" v-model="dialogVisible" width="1200px" top="5vh"
            @open="openDialog">
            <el-form :model="form" label-width="80px" label-position="right" inline ref="ruleFormRef" :rules="rules">

                <el-card style=" margin-bottom: 5px; height: 70px;">
                    <el-row :gutter="60">
                        <el-col span="6">
                            <el-form-item label="生产日期" prop="produceDt">
                                <el-date-picker v-model="form.produceDt" type="date" style="width: 190px;"
                                    value-format="YYYY-MM-DD" format="YYYY-MM-DD"></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col span="6">
                            <el-form-item label="班次" prop="prodShift">
                                <el-select v-model="form.prodShift" placeholder="请选择班次" style="width: 190px;">
                                    <el-option v-for="option in optionShiftList" :key="option.dicName"
                                        :label="option.dicName" :value="option.dicName" />
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col span="6">
                            <el-form-item label="班组" prop="prodGrp">
                                <el-input v-model="form.prodGrp" clearable style="width: 190px"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>
                <el-card style=" height: 220px; margin-bottom: 5px;">
                    <el-tabs>
                        <el-tab-pane label="入场量设置">
                            <!-- <el-row style="margin-bottom: 5px;">
                        <el-col>
                            <div style="font-size: 20px; color: black; background-color: #f0f0f0; margin-bottom: 10px;">
                                &nbsp;&nbsp;&nbsp;入场量</div>
                        </el-col>
                    </el-row> -->
                            <el-row :gutter="60">
                                <el-col :span="1"></el-col>
                                <el-col :span="5">
                                    <el-form-item label="金召" style="white-space: nowrap;">
                                        <el-input v-model="form.wgtJz" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="金鼎" style="white-space: nowrap;">
                                        <el-input v-model="form.wgtJd" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="60">
                                <el-col :span="1"></el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿1" style="white-space: nowrap;">
                                        <el-input v-model="form.wgtWk1" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿2" style="white-space: nowrap;">
                                        <el-input v-model="form.wgtWk2" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿3" style="white-space: nowrap;">
                                        <el-input v-model="form.wgtWk3" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿4" style="white-space: nowrap;">
                                        <el-input v-model="form.wgtWk4" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="60">
                                <el-col :span="1"></el-col>
                                <el-col :span="5">
                                    <el-form-item label="外购粉矿1" style="white-space: nowrap;">
                                        <el-input v-model="form.wgtWgfk1" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外购粉矿2" style="white-space: nowrap;">
                                        <el-input v-model="form.wgtWgfk2" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外购粉矿3" style="white-space: nowrap;">
                                        <el-input v-model="form.wgtWgfk3" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外购粉矿4" style="white-space: nowrap;">
                                        <el-input v-model="form.wgtWgfk4" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-tab-pane>
                    </el-tabs>
                </el-card>

                <el-card style=" height: 220px; margin-bottom: 5px;">
                    <el-tabs>
                        <el-tab-pane label="外翻量设置">
                            <!-- <el-row style="margin-bottom: 5px;">
                        <el-col>
                            <div style="font-size: 20px; color: black; background-color: #f0f0f0; margin-bottom: 10px;">
                                &nbsp;&nbsp;&nbsp;外翻量</div>
                        </el-col>
                    </el-row> -->
                            <el-row :gutter="60">
                                <el-col :span="1"></el-col>
                                <el-col :span="5">
                                    <el-form-item label="金召" style="white-space: nowrap;">
                                        <el-input v-model="form.wfJz" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="金鼎" style="white-space: nowrap;">
                                        <el-input v-model="form.wfJd" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="60">
                                <el-col :span="1"></el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿1" style="white-space: nowrap;">
                                        <el-input v-model="form.wfWk1" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿2" style="white-space: nowrap;">
                                        <el-input v-model="form.wfWk2" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿3" style="white-space: nowrap;">
                                        <el-input v-model="form.wfWk3" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿4" style="white-space: nowrap;">
                                        <el-input v-model="form.wfWk4" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="60">
                                <el-col :span="1"></el-col>
                                <el-col :span="5">
                                    <el-form-item label="外购粉矿1" style="white-space: nowrap;">
                                        <el-input v-model="form.wfWgfk1" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外购粉矿2" style="white-space: nowrap;">
                                        <el-input v-model="form.wfWgfk2" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外购粉矿3" style="white-space: nowrap;">
                                        <el-input v-model="form.wfWgfk3" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外购粉矿4" style="white-space: nowrap;">
                                        <el-input v-model="form.wfWgfk4" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-tab-pane>
                    </el-tabs>
                </el-card>
                <el-card style=" height: 220px; margin-bottom: 5px;">
                    <el-tabs>
                        <el-tab-pane label="倒矿量设置">
                            <!-- <el-row style="margin-bottom: 5px;">
                        <el-col>
                            <div style="font-size: 20px; color: black; background-color: #f0f0f0; margin-bottom: 10px;">
                                &nbsp;&nbsp;&nbsp;倒矿量</div>
                        </el-col>
                    </el-row> -->
                            <el-row :gutter="60">
                                <el-col :span="1"></el-col>
                                <el-col :span="5">
                                    <el-form-item label="金召" style="white-space: nowrap;">
                                        <el-input v-model="form.dkJz" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="金鼎" style="white-space: nowrap;">
                                        <el-input v-model="form.dkJd" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="60">
                                <el-col :span="1"></el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿1" style="white-space: nowrap;">
                                        <el-input v-model="form.dkWk1" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿2" style="white-space: nowrap;">
                                        <el-input v-model="form.dkWk2" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿3" style="white-space: nowrap;">
                                        <el-input v-model="form.dkWk3" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外矿4" style="white-space: nowrap;">
                                        <el-input v-model="form.dkWk4" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="60">
                                <el-col :span="1"></el-col>

                                <el-col :span="5">
                                    <el-form-item label="外购粉矿1" style="white-space: nowrap;">
                                        <el-input v-model="form.dkWgfk1" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外购粉矿2" style="white-space: nowrap;">
                                        <el-input v-model="form.dkWgfk2" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外购粉矿3" style="white-space: nowrap;">
                                        <el-input v-model="form.dkWgfk3" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="5">
                                    <el-form-item label="外购粉矿4" style="white-space: nowrap;">
                                        <el-input v-model="form.dkWgfk4" clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-tab-pane>
                    </el-tabs>
                </el-card>


                <el-card style=" height: 70px;">
                    <el-row>
                        <el-col :span="1"></el-col>
                        <el-col :span="7">
                            <el-form-item label="粗石量" style="white-space: nowrap;">
                                <el-input v-model="form.wgtCs" clearable style="width: 120px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="7">
                            <el-form-item label="细石量" style="white-space: nowrap;">
                                <el-input v-model="form.wgtXs" clearable style="width: 120px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="7">
                            <el-form-item label="回收矿量" style="white-space: nowrap;">
                                <el-input v-model="form.wgtHs" clearable style="width: 120px"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>
            </el-form>
            <template #footer>
                <div class="dialog-footer">
                    <el-button type="success" @click="handleSave(ruleFormRef)">保存</el-button>
                    <el-button type="danger" @click="handleCancelSave">取消</el-button>
                </div>
            </template>
        </el-dialog>


    </div>
</template>

<script setup>
import ButtonBar from '@/components/ButtonBar.vue'

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

const {
    proxy
} = getCurrentInstance()

import tools from '@/tools'
const cardBodyStyle = ref(tools.style.card)
const inputStyle = ref(tools.style.input)

onMounted(() => {
    handleSearch()
    getDic()
})

// 数据字典
const optionShiftList = ref([])
     const getDic = () => {
		var url = 'framework/Common/querySelector'
		var param = {
			type: 'PRD_OPER_SHIFT'
		}
		proxy.$axios.get(url, param).then(response => {
			if (response.data.code == '0') {
				optionShiftList.value = response.data.data
			} else {
				ElMessage.error('操作失败！' + response.data.msg)
			}
		})
	}



/**
 *   查询
 */




const query = ref({
    produceDt: [proxy.$dayjs().format('YYYY-MM-DD') + ' 00:00:00', proxy.$dayjs().format('YYYY-MM-DD') + ' 23:59:59'],
    prodShift: '',
    prodGrp: ''
})
const tableData = ref([])
const handleSearch = () => {
    currentPage.value = 1
    getTableData()
}

const getTableData = () => {
    var url = 'prd/WeightInput/query'
    var param = {
        page: currentPage.value,
        rows: pageSize.value,
        params: JSON.stringify(query.value)
    }
    proxy.$axios.get(url, param).then(response => {
        if (response.data.code == '0') {
            tableData.value = response.data.data.records
            totalRows.value = response.data.data.total
        } else {
            ElMessage.error('操作失败！' + response.data.msg)
        }
    })
}
/**
 *   查询
 */

/**
 * 分页
 */
const currentPage = ref(1)
const totalRows = ref(0)
const pageSizes = ref([5, 10, 20, 30, 40])
const pageSize = ref(5)
const handleSizeChange = (val) => {
    pageSize.value = val
    getTableData()
}
const handleCurrentChange = (val) => {
    currentPage.value = val
    getTableData()
}
/**
 * 分页
 */


/**
 * 新增
 */
const dialogVisible = ref(false)
const form = ref({
    produceDt: '',
    prodShift: '',
    prodGrp: '',
    wgtJz: '',
    wgtJd: '',
    wgtWk1: '',
    wgtWk2: '',
    wgtWk3: '',
    wgtWk4: '',
    wgtWgfk1: '',
    wgtWgfk2: '',
    wgtWgfk3: '',
    wgtWgfk4: '',
    wfJz: '',
    wfJd: '',
    wfWk1: '',
    wfWk2: '',
    wfWk3: '',
    wfWk4: '',
    wfWgfk1: '',
    wfWgfk2: '',
    wfWgfk3: '',
    wfWgfk4: '',
    dkJz: '',
    dkJd: '',
    dkWk1: '',
    dkWk2: '',
    dkWk3: '',
    dkWk4: '',
    dkWgfk1: '',
    dkWgfk2: '',
    dkWgfk3: '',
    dkWgfk4: '',
    wgtCs: '',
    wgtXs: '',
    wgtHs: ''
})
const ruleFormRef = ref()
const rules = reactive({
    produceDt: [{
        required: true,
        message: '请输入生产日期',
        trigger: 'change' | 'blur'
    }],
    prodShift: [{
        required: true,
        message: '请输入生产班次',
        trigger: 'change' | 'blur'
    }],
    prodGrp: [{
        required: true,
        message: '请输入生产班组',
        trigger: 'change' | 'blur'
    }],
})

const handleAdd = () => {
    form.value = {
        produceDt: '',
        prodShift: '',
        prodGrp: '',
        wgtJz: '',
        wgtJd: '',
        wgtWk1: '',
        wgtWk2: '',
        wgtWk3: '',
        wgtWk4: '',
        wgtWgfk1: '',
        wgtWgfk2: '',
        wgtWgfk3: '',
        wgtWgfk4: '',
        wfJz: '',
        wfJd: '',
        wfWk1: '',
        wfWk2: '',
        wfWk3: '',
        wfWk4: '',
        wfWgfk1: '',
        wfWgfk2: '',
        wfWgfk3: '',
        wfWgfk4: '',
        dkJz: '',
        dkJd: '',
        dkWk1: '',
        dkWk2: '',
        dkWk3: '',
        dkWk4: '',
        dkWgfk1: '',
        dkWgfk2: '',
        dkWgfk3: '',
        dkWgfk4: '',
        wgtCs: '',
        wgtXs: '',
        wgtHs: ''
    }
    dialogVisible.value = true
}
/**
 * 新增
 */


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

const openDialog = () => {
}

const handleSave = (ruleFormRef) => {
    ruleFormRef.validate((valid, fields) => {
        if (valid) {
            var url = 'prd/WeightInput/save'
            var param = {
                json: JSON.stringify(form.value),
            }
            proxy.$axios.post(url, param).then(response => {
                if (response.data.code == 0) {
                    form.value = response.data.data
                    ElMessage({
                        message: '保存成功',
                        type: 'success',
                    })
                    getTableData()
                    dialogVisible.value = false
                } else {
                    // ElMessage.error('操作失败！' + response.data.msg)
                    ElMessage({
                        message: '操作失败' + response.data.msg,
                        type: 'error'
                    })
                }
            })

        } else {
            console.log('error submit!', fields)
        }
    })
}
const handleCancelSave = () => {
    dialogVisible.value = false
}
const handleEdit = (row) => {
    dialogVisible.value = true
    form.value = row
}
const handleDelete = (row) => {
    ElMessageBox.confirm(
        '确定删除本条记录?',
        '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning',
        draggable: true,
    }
    )
        .then(() => {
            var url = 'prd/WeightInput/remove'
            var param = {
                id: row.id
            }
            proxy.$axios.post(url, param).then(response => {
                if (response.data.code == 0) {
                    ElMessage({
                        type: 'success',
                        message: '删除成功',
                    })
                    getTableData()
                } else {
                    ElMessage({
                        type: 'error',
                        message: '删除失败' + response.data.msg
                    });
                }
            });
        })
        .catch(() => {
            ElMessage({
                type: 'info',
                message: '已取消',
            })
        })
}

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

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

const handleRemoveBatch = () => {
    console.log('handleRemoveBatch')

    if (multipleSelection.value.length < 1) {
        ElMessage({
            type: 'warning',
            message: '请选择要删除的数据!'
        })
        return
    }

    ElMessageBox.confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
    }).then(() => {
        var ids = []
        multipleSelection.value.forEach((item, index) => {
            ids.push(item.id)
        })
        var url = 'prd/WeightInput/removeBatch'
        var param = {
            ids: JSON.stringify(ids)
        }
        proxy.$axios.post(url, param).then(response => {
            if (response.data.code == '0') {
                ElMessage({
                    type: 'success',
                    message: '操作成功!',
                });
                getTableData()
                dialogVisible.value = false
            } else {
                ElMessage({
                    type: 'error',
                    message: '操作失败!' + response.data.msg
                });
            }
        })
    }).catch(() => {
        ElMessage({
            type: 'info',
            message: '已取消删除'
        })
    })
}

const handleEditBatch = () => {
    console.log('handleEditBatch')
    if (multipleSelection.value.length != 1) {
        ElMessage({
            type: 'warning',
            message: '请选择一条数据编辑!'
        })
        return
    }
    handleEdit(multipleSelection.value[0])
}

const handleUpload = () => {
    console.log('handleUpload')
}

const handleDownload = () => {
    console.log('handleDownload')
}

const handleImport = () => {
    console.log('handleImport')
}

const handleExport = () => {
    console.log('handleExport')
}

</script>

<style></style>