<template>
    <div>
        <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">
            <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="true" prop="prodDt" label="生产日期" width="120" 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>
                </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="oreYeild" label="原矿产率" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="oreWgt" label="原矿重量" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="oreGrdTfe" label="原矿铁品位" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="oreWgtTfe" label="原矿铁金属" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="oreGrdCu" label="原矿铜品位" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="oreWgtCu" label="原矿铜金属" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="oreGrdCo" label="原矿钴品位" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="oreWgtCo" label="原矿钴重量" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="oreGrdS" label="原矿硫品位" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="oreWgtS" label="原矿硫重量" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="oreRor" label="原矿回收率" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contIronYeild" label="铁精矿产率" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contIronWgt" label="铁精矿重量" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contIronGrdTfe" label="铁精矿铁品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contIronWgtTfe" label="铁精矿铁金属" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contIronGrdCu" label="铁精矿铜品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contIronWgtCu" label="铁精矿铜金属" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contIronGrdCo" label="铁精矿钴品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contIronWgtCo" label="铁精矿钴重量" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contIronGrdS" label="铁精矿硫品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contIronWgtS" label="铁精矿硫重量" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contIronRor" label="铁精矿回收率" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contCoppYeild" label="铜精矿产率" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contCoppWgt" label="铜精矿重量" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contCoppGrdTfe" label="铜精矿铁品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contCoppWgtTfe" label="铜精矿铁金属" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contCoppGrdCu" label="铜精矿铜品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contCoppWgtCu" label="铜精矿铜金属" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contCoppGrdCo" label="铜精矿钴品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contCoppWgtCo" label="铜精矿钴重量" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contCoppGrdS" label="铜精矿硫品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contCoppWgtS" label="铜精矿硫重量" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contCoppRor" label="铜精矿回收率" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contSulfYeild" label="硫精矿产率" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contSulfWgt" label="硫精矿重量" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contSulfGrdTfe" label="硫精矿铁品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contSulfWgtTfe" label="硫精矿铁金属" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contSulfGrdCu" label="硫精矿铜品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contSulfWgtCu" label="硫精矿铜金属" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contSulfGrdCo" label="硫精矿钴品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contSulfWgtCo" label="硫精矿钴重量" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contSulfGrdS" label="硫精矿硫品位" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contSulfWgtS" label="硫精矿硫重量" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="contSulfRor" label="硫精矿回收率" width="110" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="tailYeild" label="尾矿产率" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="tailWgt" label="尾矿重量" width="100" header-align="center" align="right"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="tailGrdTfe" label="尾矿铁品位" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="tailWgtTfe" label="尾矿铁金属" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="tailGrdCu" label="尾矿铜品位" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="tailWgtCu" label="尾矿铜金属" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="tailGrdCo" label="尾矿钴品位" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="tailWgtCo" label="尾矿钴重量" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="tailGrdS" label="尾矿硫品位" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="tailWgtS" label="尾矿硫重量" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="tailRor" label="尾矿回收率" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>


                <el-table-column label="操作" header-align="center" align="center" width="160px"  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" 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="30">
                        <el-col span="4">
                            <el-form-item label="生产日期" prop="prodDt">
                                <el-date-picker v-model="form.prodDt" type="date" style="width: 180px;"
                                    value-format="YYYY-MM-DD" format="YYYY-MM-DD"></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="班次" prop="prodShift">
                                <el-select v-model="form.prodShift" placeholder="请选择班次" style="width: 150px;" clearable>
                                    <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="4">
                            <el-form-item label="班组">
                                <!-- <el-input v-model="form.prodGrp" clearable style="width: 150px"></el-input> -->
                                <el-select v-model="form.prodGrp" placeholder="请选择班组" style="width: 150px;" clearable>
                                    <el-option  label="选矿甲班" value="选矿甲班" />
                                    <el-option  label="选矿乙班" value="选矿乙班" />
                                    <el-option  label="选矿丙班" value="选矿丙班" />
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-button plain type="warning" @click="queryOutput">产量计算</el-button>
                        </el-col>
                    </el-row>
                </el-card>
                <el-card style=" height: 220px; margin-bottom: 5px;">
                    <el-tabs>
                        <el-tab-pane label="原矿信息设置">
                            <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.oreYeild" 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.oreWgt" 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.oreRor" 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="原矿铁品位" style="white-space: nowrap;">
                                        <el-input v-model="form.oreGrdTfe" 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.oreWgtTfe" 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.oreGrdCu" 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.oreWgtCu" 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="原矿钴品位" style="white-space: nowrap;">
                                        <el-input v-model="form.oreGrdCo" 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.oreWgtCo" 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.oreGrdS" 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.oreWgtS" 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 :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.contIronYeild" 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.contIronWgt" 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.contIronRor" 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="铁精矿铁品位" style="white-space: nowrap;">
                                        <el-input v-model="form.contIronGrdTfe" 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.contIronWgtTfe" 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.contIronGrdCu" 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.contIronWgtCu" 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="铁精矿钴品位" style="white-space: nowrap;">
                                        <el-input v-model="form.contIronGrdCo" 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.contIronWgtCo" 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.contIronGrdS" 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.contIronWgtS" 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 :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.contCoppYeild" 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.contCoppWgt" 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.contCoppRor" 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="铜精矿铁品位" style="white-space: nowrap;">
                                        <el-input v-model="form.contCoppGrdTfe" 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.contCoppWgtTfe" 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.contCoppGrdCu" 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.contCoppWgtCu" 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="铜精矿钴品位" style="white-space: nowrap;">
                                        <el-input v-model="form.contCoppGrdCo" 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.contCoppWgtCo" 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.contCoppGrdS" 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.contCoppWgtS" 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 :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.contSulfYeild" 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.contSulfWgt" 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.contSulfRor " 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="硫精矿铁品位" style="white-space: nowrap;">
                                        <el-input v-model="form.contSulfGrdTfe" 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.contSulfWgtTfe" 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.contSulfGrdCu" 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.contSulfWgtCu" 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="硫精矿钴品位" style="white-space: nowrap;">
                                        <el-input v-model="form.contSulfGrdCo" 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.contSulfWgtCo" 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.contSulfGrdS" 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.contSulfWgtS" 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 :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.tailYeild" 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.tailWgt" 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.tailRor " 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="尾矿铁品位" style="white-space: nowrap;">
                                        <el-input v-model="form.tailGrdTfe" 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.tailWgtTfe" 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.tailGrdCu" 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.tailWgtCu" 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="尾矿钴品位" style="white-space: nowrap;">
                                        <el-input v-model="form.tailGrdCo" 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.tailWgtCo" 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.tailGrdS" 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.tailWgtS " clearable style="width: 120px"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-tab-pane>
                    </el-tabs>
                </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()
})



// 数据字典
const optionShiftList = ref([{dicName:'夜班'},{dicName:'白班'},{dicName:'中班'},{dicName:'全员'},])
// 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 queryOutput = () => {
    if (form.value.prodDt != '' && form.value.prodDt != null
        && form.value.prodDt != undefined && form.value.prodShift != ''
        && form.value.prodShift != null && form.value.prodShift != undefined) {
        console.log(form.value)
        var url = 'prd/ProduceOut/queryOutput'
        var param = {
            prodDt: form.value.prodDt,
            prodShift: form.value.prodShift
        }
        proxy.$axios.get(url, param).then(response => {
            if (response.data.code == '0') {
                if(response.data.data == '' || response.data.data == null || response.data.data == undefined || response.data.data.length == 0){
                        ElMessage.error('未查询到数据！')
                }else{
                    let id = form.value.id
                    form.value = response.data.data[0]
                    form.value.id = id
                }
            } else {
                ElMessage.error('查询失败！' + response.data.msg)
            }
        })
    }else{
        ElMessage.error('查询失败！请选择生产日期和班次')
    }

}

/**
 *   查询
 */




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

const getTableData = () => {
    var url = 'prd/ProduceOut/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(20)
const handleSizeChange = (val) => {
    pageSize.value = val
    getTableData()
}
const handleCurrentChange = (val) => {
    currentPage.value = val
    getTableData()
}
/**
 * 分页
 */


/**
 * 新增
 */
const dialogVisible = ref(false)
const form = ref({
    prodDt: '',
    prodShift: '',
    oreYeild: '',
    oreWgt: '',
    oreGrdTfe: '',
    oreWgtTfe: '',
    oreGrdCu: '',
    oreWgtCu: '',
    oreGrdCo: '',
    oreWgtCo: '',
    oreGrdS: '',
    oreWgtS: '',
    oreRor: '',
    contIronYeild: '',
    contIronWgt: '',
    contIronGrdTfe: '',
    contIronWgtTfe: '',
    contIronGrdCu: '',
    contIronWgtCu: '',
    contIronGrdCo: '',
    contIronWgtCo: '',
    contIronGrdS: '',
    contIronWgtS: '',
    contIronRor: '',
    contCoppYeild: '',
    contCoppWgt: '',
    contCoppGrdTfe: '',
    contCoppWgtTfe: '',
    contCoppGrdCu: '',
    contCoppWgtCu: '',
    contCoppGrdCo: '',
    contCoppWgtCo: '',
    contCoppGrdS: '',
    contCoppWgtS: '',
    contCoppRor: '',
    contSulfYeild: '',
    contSulfWgt: '',
    contSulfGrdTfe: '',
    contSulfWgtTfe: '',
    contSulfGrdCu: '',
    contSulfWgtCu: '',
    contSulfGrdCo: '',
    contSulfWgtCo: '',
    contSulfGrdS: '',
    contSulfWgtS: '',
    contSulfRor: '',
    tailYeild: '',
    tailWgt: '',
    tailGrdTfe: '',
    tailWgtTfe: '',
    tailGrdCu: '',
    tailWgtCu: '',
    tailGrdCo: '',
    tailWgtCo: '',
    tailGrdS: '',
    tailWgtS: '',
    tailRor: '',
    prodGrp: ''
})
const ruleFormRef = ref()
const rules = reactive({
    prodDt: [{
        required: true,
        message: '请输入生产日期',
        trigger: 'change' | 'blur'
    }],
    prodShift: [{
        required: true,
        message: '请输入生产班次',
        trigger: 'change' | 'blur'
    }],

})

const handleAdd = () => {
    form.value = {
        prodDt: '',
        prodShift: '',
        oreYeild: '',
        oreWgt: '',
        oreGrdTfe: '',
        oreWgtTfe: '',
        oreGrdCu: '',
        oreWgtCu: '',
        oreGrdCo: '',
        oreWgtCo: '',
        oreGrdS: '',
        oreWgtS: '',
        oreRor: '',
        contIronYeild: '',
        contIronWgt: '',
        contIronGrdTfe: '',
        contIronWgtTfe: '',
        contIronGrdCu: '',
        contIronWgtCu: '',
        contIronGrdCo: '',
        contIronWgtCo: '',
        contIronGrdS: '',
        contIronWgtS: '',
        contIronRor: '',
        contCoppYeild: '',
        contCoppWgt: '',
        contCoppGrdTfe: '',
        contCoppWgtTfe: '',
        contCoppGrdCu: '',
        contCoppWgtCu: '',
        contCoppGrdCo: '',
        contCoppWgtCo: '',
        contCoppGrdS: '',
        contCoppWgtS: '',
        contCoppRor: '',
        contSulfYeild: '',
        contSulfWgt: '',
        contSulfGrdTfe: '',
        contSulfWgtTfe: '',
        contSulfGrdCu: '',
        contSulfWgtCu: '',
        contSulfGrdCo: '',
        contSulfWgtCo: '',
        contSulfGrdS: '',
        contSulfWgtS: '',
        contSulfRor: '',
        tailYeild: '',
        tailWgt: '',
        tailGrdTfe: '',
        tailWgtTfe: '',
        tailGrdCu: '',
        tailWgtCu: '',
        tailGrdCo: '',
        tailWgtCo: '',
        tailGrdS: '',
        tailWgtS: '',
        tailRor: '',
        prodGrp: ''
    }
    dialogVisible.value = true
}
/**
 * 新增
 */


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

const openDialog = () => {
}

const handleSave = (ruleFormRef) => {
    ruleFormRef.validate((valid, fields) => {
        if (valid) {
            var url = 'prd/ProduceOut/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/ProduceOut/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/ProduceOut/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>