<template>
    <el-dialog title="批量维护" append-to-body :modelValue="showMaintain" width="80%" @close="closeDialog">
        <div style="margin-bottom: 10px;display: flex;align-items: center;">
            <div style="display: flex;align-items: center;margin-right: 10px;">检查结果：
                <el-radio v-model="isQualified" :label="true">合格</el-radio>
                <el-radio v-model="isQualified" :label="false">不合格</el-radio>
            </div>
            <el-button type="primary" @click="handleSet">批量设置</el-button>
            <el-button type="primary" @click="maintainValue">保存</el-button>
        </div>
        <el-table :data="maintainData">
            <el-table-column align="center" label="作业中心" prop="bsWorkCenter.wcName"></el-table-column>
            <el-table-column align="center" label="作业槽" prop="batchNo"></el-table-column>
            <el-table-column align="center" label="维护内容" prop="preserveContent"></el-table-column>
            <el-table-column align="center" label="合格/不合格" prop="isQualified">
                <template #default=scope>
                    <el-radio v-model="scope.row.isQualified" :label="true">合格</el-radio>
                    <el-radio v-model="scope.row.isQualified" :label="false">不合格</el-radio>
                </template>
            </el-table-column>
            <el-table-column align="center" label="添加量/实测值" prop="actualValue">
                <template #default="scope">
                    <el-input v-model="scope.row.actualValue"></el-input>
                </template>
            </el-table-column>
        </el-table>
    </el-dialog>
</template>

<script>
export default {
    props: {
        showMaintain: {
            type: Boolean,
            default: false
        },
        maintainData:{
            type:Object,
            default:[]
        }
    },
    data(){
        return{
            isQualified:null,
        }
    },
    mounted(){

    },
    methods:{
        closeDialog() {
            this.$emit('closeDialog');
        },
        handleSet(){
            if(this.isQualified == null){
                this.$message.error('请先选择检查结果')
                return
            }
            this.maintainData.map(item =>{
                item.isQualified = this.isQualified
            })
        },
        maintainValue(){
            this.closeDialog()
        }
    }
}
</script>

<style></style>