<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">
                <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="ID" width="120" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="createEmpId" label="创建人id" width="300" header-align="center"
                    align="center" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="createDtm" label="创建时间" width="240" header-align="center"
                    align="center" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="modifyEmpId" label="修改人id" width="300" header-align="center"
                    align="center" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="modifyDtm" label="修改时间" width="240" header-align="center"
                    align="center" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="cancleEmpId" label="删除人ID" width="300" header-align="center"
                    align="center" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="cancleDtm" label="删除时间" width="240" header-align="center"
                    align="center" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="false" prop="cancleYn" label="删除标记" width="240" header-align="center"
                    align="center" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="operDt" label="生产日期" width="130" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="operShift" label="班次" width="60" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="operGrp" label="班组" width="60" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="dutyId" label="值班人" width="120" header-align="center" align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="operRecd" label="运行记录" width="120" header-align="center"
                    align="center" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="handOver" label="交班事项" width="120" header-align="center"
                    align="center" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="operTm1" label="1#运转时间(小时)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="grdiOreQty1" label="1#磨矿量(T)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="suppBallQty1" label="1#补球量(kg)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="flowCctt1" label="1#溢流浓度(%)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="prodHour1" label="1#台时量(T/h)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="operTm2" label="2#运转时间(小时)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="grdiOreQty2" label="2#磨矿量(T)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="suppBallQty2" label="2#补球量(kg)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="flowCctt2" label="2#溢流浓度(%)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="prodHour2" label="2#台时量(T/h)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="operTm3" label="3#运转时间(小时)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="grdiOreQty3" label="3#磨矿量(T)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="suppBallQty3" label="3#补球量(kg)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="flowCctt3" label="3#溢流浓度(%)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="prodHour3" label="3#台时量(T/h)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="operTm4" label="4#运转时间(小时)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="grdiOreQty4" label="4#磨矿量(T)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="suppBallQty4" label="4#补球量(kg)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="flowCctt4" label="4#溢流浓度(%)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="prodHour4" label="4#台时量(T/h)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="operTm5" label="5#运转时间(小时)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="grdiOreQty5" label="5#磨矿量(T)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="suppBallQty5" label="5#补球量(kg)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="flowCctt5" label="5#溢流浓度(%)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="prodHour5" label="5#台时量(T/h)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="operTm6" label="6#运转时间(小时)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="grdiOreQty6" label="6#磨矿量(T)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="suppBallQty6" label="6#补球量(kg)" width="90" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="flowCctt6" label="6#溢流浓度(%)" width="100" header-align="center"
                    align="right" show-overflow-tooltip>
                </el-table-column>
                <el-table-column v-if="true" prop="prodHour6" label="6#台时量(T/h)" width="90" header-align="center"
                    align="right" 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" :title="dialogName" v-model="dialogVisible" width="1300px" top="5vh"
            @open="openDialog" :before-close="handleCancelSave">
            <el-form :model="form" label-width="80px" label-position="right" inline ref="ruleFormRef" status-icon
                :rules="rules" >
                <el-card style=" height: 150px; ">
                    <el-row>
                        <el-col span="6">
                            <el-form-item label="生产日期" prop="operDt">
                                <el-date-picker v-model="form.operDt" type="date" style="width: 190px;"
                                    value-format="YYYY-MM-DD" format="YYYY-MM-DD" clearable></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col span="6">
                            <el-form-item label="班次" prop="operShift">
                                <el-select v-model="form.operShift" placeholder="请选择班次" style="width: 190px;" clearable>
                                    <el-option v-for="option in optionList" :key="option.dicCode"
                                        :label="option.dicCode" :value="option.dicCode" />
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col span="6">
                            <el-form-item label="班组" prop="operGrp">
                                <el-select v-model="form.operGrp" placeholder="请选择班组" style="width: 190px;" clearable>
                                    <el-option v-for="option in optionGrpList" :key="option.dicCode"
                                        :label="option.dicCode" :value="option.dicCode" />
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col span="6">
                            <el-form-item label="值班人" prop="dutyId">
                                <el-input v-model="form.dutyId" clearable style="width: 190px"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-form-item label="运行记录" prop="operRecd">
                            <el-input v-model="form.operRecd" style="width: 495px; font-size: 16px;" clearable :rows="2"
                                show-word-limit maxlength="75" type="textarea" />
                        </el-form-item>
                        <el-form-item label="交班事项" prop="handOver">
                            <el-input v-model="form.handOver" style="width: 495px; font-size: 16px;" clearable :rows="2"
                                show-word-limit maxlength="75" type="textarea" />
                        </el-form-item>
                    </el-row>
                </el-card>

                <el-card style="margin-bottom: 5px;  margin-top: 5px; height: 105px;">
                    <el-row><el-tag style="font-size: 20px; margin-bottom: 10px; ">1#机器运行信息</el-tag></el-row>
                    <el-row :gutter="35">
                        <el-col :span="1"></el-col>
                        <el-col span="4">
                            <el-form-item label="1#运转时间(小时)" style="white-space: nowrap;" prop="operTm1"> 
                                <el-input v-model="form.operTm1" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="1#磨矿量(T)" style="white-space: nowrap;" prop="grdiOreQty1">
                                <el-input v-model="form.grdiOreQty1" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="1#补球量(kg)" style="white-space: nowrap;" prop="suppBallQty1">
                                <el-input v-model="form.suppBallQty1" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="1#溢流浓度(%)" style="white-space: nowrap;" prop="flowCctt1">
                                <el-input v-model="form.flowCctt1" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="1#台时量(T/h)" style="white-space: nowrap;" prop="prodHour1">
                                <el-input v-model="form.prodHour1" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>

                <el-card style="margin-bottom: 5px; height: 105px;">
                    <el-row><el-tag style="font-size: 20px; margin-bottom: 10px; ">2#机器运行信息</el-tag></el-row>
                    <el-row :gutter="35">
                        <el-col :span="1"></el-col>
                        <el-col span="4">
                            <el-form-item label="2#运转时间(小时)" style="white-space: nowrap;" prop="operTm2">
                                <el-input v-model="form.operTm2" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="2#磨矿量(T)" style="white-space: nowrap;" prop="grdiOreQty2">
                                <el-input v-model="form.grdiOreQty2" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="2#补球量(kg)" style="white-space: nowrap;" prop="suppBallQty2">
                                <el-input v-model="form.suppBallQty2" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="2#溢流浓度(%)" style="white-space: nowrap;" prop="flowCctt2">
                                <el-input v-model="form.flowCctt2" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="2#台时量(T/h)" style="white-space: nowrap;" prop="prodHour2">
                                <el-input v-model="form.prodHour2" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>

                <el-card style="margin-bottom: 5px; height: 105px;">
                    <el-row><el-tag style="font-size: 20px; margin-bottom: 10px; ">3#机器运行信息</el-tag></el-row>
                    <el-row :gutter="35">
                        <el-col :span="1"></el-col>
                        <el-col span="4">
                            <el-form-item label="3#运转时间(小时)" style="white-space: nowrap;" prop="operTm3">
                                <el-input v-model="form.operTm3" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="3#磨矿量(T)" style="white-space: nowrap;" prop="grdiOreQty3">
                                <el-input v-model="form.grdiOreQty3" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="3#补球量(kg)" style="white-space: nowrap;" prop="suppBallQty3">
                                <el-input v-model="form.suppBallQty3" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="3#溢流浓度(%)" style="white-space: nowrap;" prop="flowCctt3">
                                <el-input v-model="form.flowCctt3" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="3#台时量(T/h)" style="white-space: nowrap;" prop="prodHour3">
                                <el-input v-model="form.prodHour3" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>

                <el-card style="margin-bottom: 5px; height: 105px;">
                    <el-row><el-tag style="font-size: 20px; margin-bottom: 10px; ">4#机器运行信息</el-tag></el-row>
                    <el-row :gutter="35">
                        <el-col :span="1"></el-col>
                        <el-col span="4">
                            <el-form-item label="4#运转时间(小时)" style="white-space: nowrap;" prop="operTm4">
                                <el-input v-model="form.operTm4" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="4#磨矿量(T)" style="white-space: nowrap;" prop="grdiOreQty4">
                                <el-input v-model="form.grdiOreQty4" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="4#补球量(kg)" style="white-space: nowrap;" prop="suppBallQty4">
                                <el-input v-model="form.suppBallQty4" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="4#溢流浓度(%)" style="white-space: nowrap;" prop="flowCctt4">
                                <el-input v-model="form.flowCctt4" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="4#台时量(T/h)" style="white-space: nowrap;" prop="prodHour4">
                                <el-input v-model="form.prodHour4" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>

                <el-card style="margin-bottom: 5px; height: 105px;">
                    <el-row><el-tag style="font-size: 20px; margin-bottom: 10px; ">5#机器运行信息</el-tag></el-row>
                    <el-row :gutter="35">
                        <el-col :span="1"></el-col>
                        <el-col span="4">
                            <el-form-item label="5#运转时间(小时)" style="white-space: nowrap;" prop="operTm5">
                                <el-input v-model="form.operTm5" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="5#磨矿量(T)" style="white-space: nowrap;" prop="grdiOreQty5">
                                <el-input v-model="form.grdiOreQty5" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="5#补球量(kg)" style="white-space: nowrap;" prop="suppBallQty5">
                                <el-input v-model="form.suppBallQty5" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="5#溢流浓度(%)" style="white-space: nowrap;" prop="flowCctt5">
                                <el-input v-model="form.flowCctt5" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="5#台时量(T/h)" style="white-space: nowrap;" prop="prodHour5">
                                <el-input v-model="form.prodHour5" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>

                <el-card style="margin-bottom: 5px; height: 100px;">
                    <el-row><el-tag style="font-size: 20px; margin-bottom: 10px; ">6#机器运行信息</el-tag></el-row>
                    <el-row :gutter="35">
                        <el-col :span="1"></el-col>
                        <el-col span="4">
                            <el-form-item label="6#运转时间(小时)" style="white-space: nowrap;" prop="operTm6">
                                <el-input v-model="form.operTm6" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="6#磨矿量(T)" style="white-space: nowrap;" prop="grdiOreQty6">
                                <el-input v-model="form.grdiOreQty6" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col span="4">
                            <el-form-item label="6#补球量(kg)" style="white-space: nowrap;" prop="suppBallQty6">
                                <el-input v-model="form.suppBallQty6" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="6#溢流浓度(%)" style="white-space: nowrap;" prop="flowCctt6">
                                <el-input v-model="form.flowCctt6" clearable style="width: 90px"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label="6#台时量(T/h)" style="white-space: nowrap;" prop="prodHour6">
                                <el-input v-model="form.prodHour6" clearable style="width: 90px"></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 Selector from '@/components/Selector.vue'
    import ButtonBar from '@/components/ButtonBar.vue'

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

    const {
        proxy
    } = getCurrentInstance()

    import SearchBox from '@/components/SearchBox.vue'
    const searchBarRef = ref(null)

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

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

    // 数据字典
    const optionList = 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') {
				optionList.value = response.data.data
			} else {
				ElMessage.error('操作失败！' + response.data.msg)
			}
		})
	}
    const optionGrpList = ref([])
    const getGrp = () => {
		var url = 'framework/Common/querySelector'
		var param = {
			type: 'PRD_OPER_GRP'
		}
		proxy.$axios.get(url, param).then(response => {
			if (response.data.code == '0') {
				optionGrpList.value = response.data.data
			} else {
				ElMessage.error('操作失败！' + response.data.msg)
			}
		})
	}


    /**
     *   查询
     */




    const query = ref({
            // operDt:proxy.$dayjs().format('YYYY-MM-DD HH:mm:ss'), 
   })
   const tableData = ref([])
   const handleSearch = () => {
       currentPage.value = 1
       getTableData()
   }

   const getTableData = () => {
       var url = 'prd/BmilRecd/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({
        operDt: '', 
        operShift: '', 
        operGrp: '', 
        dutyId: '', 
        operRecd: '', 
        handOver: '', 
        operTm1: '', 
        grdiOreQty1: '', 
        suppBallQty1: '', 
        flowCctt1: '', 
        prodHour1: '', 
        operTm2: '', 
        grdiOreQty2: '', 
        suppBallQty2: '', 
        flowCctt2: '', 
        prodHour2: '', 
        operTm3: '', 
        grdiOreQty3: '', 
        suppBallQty3: '', 
        flowCctt3: '', 
        prodHour3: '', 
        operTm4: '', 
        grdiOreQty4: '', 
        suppBallQty4: '', 
        flowCctt4: '', 
        prodHour4: '', 
        operTm5: '', 
        grdiOreQty5: '', 
        suppBallQty5: '', 
        flowCctt5: '', 
        prodHour5: '', 
        operTm6: '', 
        grdiOreQty6: '', 
        suppBallQty6: '', 
        flowCctt6: '', 
        prodHour6: ''
    })
    const ruleFormRef = ref()
    const rules = reactive({
        operDt: [{ required: true, message: '请输入生产日期', trigger: 'change' | 'blur' }], 
        operShift: [{ required: true, message: '请输入班次', trigger: 'change' | 'blur' }], 
        operGrp: [{ required: true, message: '请输入班组', trigger: 'change' | 'blur' }], 
        dutyId: [{ required: true, message: '请输入值班人', trigger: 'change' | 'blur' },
        {max: 20, message: '值班人超过有效长度', trigger: 'change' | 'blur'}],
        operRecd: [{ max: 75, message: '运行记录超过有效长度', trigger: 'change' | 'blur' }],
        handOver: [{ max: 75, message: '交班事项超过有效长度', trigger: 'change' | 'blur' }],
        operTm1: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        grdiOreQty1: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        suppBallQty1: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur'| 'change' }], 
        flowCctt1: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        prodHour1: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change'}], 
        operTm2: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        grdiOreQty2: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        suppBallQty2: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur'| 'change' }], 
        flowCctt2: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        prodHour2: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change'}], 
        operTm3: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        grdiOreQty3: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        suppBallQty3: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur'| 'change' }], 
        flowCctt3: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        prodHour3: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change'}], 
        operTm4: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        grdiOreQty4: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        suppBallQty4: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur'| 'change' }], 
        flowCctt4: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        prodHour4: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change'}], 
        operTm5: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        grdiOreQty5: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        suppBallQty5: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur'| 'change' }], 
        flowCctt5: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        prodHour5: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change'}], 
        operTm6: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        grdiOreQty6: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        suppBallQty6: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur'| 'change' }], 
        flowCctt6: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change' }], 
        prodHour6: [{ pattern: /^[0-9]{1,15}(\.[0-9]{1,10})?$/, message: '请输入有效的数字', trigger: 'blur' | 'change'}], 
    })
    const dialogName = ref("")
    const resetForm = () => {
        form.value = {
            operDt: '', 
            operShift: '', 
            operGrp: '', 
            dutyId: '', 
            operRecd: '', 
            handOver: '', 
            operTm1: '', 
            grdiOreQty1: '', 
            suppBallQty1: '', 
            flowCctt1: '', 
            prodHour1: '', 
            operTm2: '', 
            grdiOreQty2: '', 
            suppBallQty2: '', 
            flowCctt2: '', 
            prodHour2: '', 
            operTm3: '', 
            grdiOreQty3: '', 
            suppBallQty3: '', 
            flowCctt3: '', 
            prodHour3: '', 
            operTm4: '', 
            grdiOreQty4: '', 
            suppBallQty4: '', 
            flowCctt4: '', 
            prodHour4: '', 
            operTm5: '', 
            grdiOreQty5: '', 
            suppBallQty5: '', 
            flowCctt5: '', 
            prodHour5: '', 
            operTm6: '', 
            grdiOreQty6: '', 
            suppBallQty6: '', 
            flowCctt6: '', 
            prodHour6: ''
        }
    }
    const handleAdd = () => {
        
        dialogName.value = "新增"
        dialogVisible.value = true
    }
    /**
     * 新增
     */


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

    const openDialog=()=>{
    }

    const handleSave = (ruleFormRef) => {
        ruleFormRef.validate((valid, fields) => {
            if (valid) {
                var url = 'prd/BmilRecd/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)
                ElMessage.error('请输入有效数据')
            }
        })
    }
    const handleCancelSave = () => {
        if(dialogName.value=="编辑"){
            resetForm();
        }
        dialogVisible.value = false
    }
    const handleEdit = (row) => {
        dialogName.value = "编辑"
        dialogVisible.value = true
        form.value = row
    }
    const handleDelete = (row) => {
        ElMessageBox.confirm(
            '确定删除本条记录?',
            '提示', {
                confirmButtonText: '确认',
                cancelButtonText: '取消',
                type: 'warning',
                draggable: true,
            }
        )
            .then(() => {
                var url = 'prd/BmilRecd/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/BmilRecd/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>