<template>
    <el-dialog title="增加" append-to-body :modelValue="openShow" width="90%" @close="closeDialog">
        <div style="margin-bottom: 12px;">
            <el-button type="danger" @click="addEdit()">删除选择行</el-button>
            <el-button type="primary" @click="addEdit()">保存</el-button>
        </div>
        <avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" v-model:page="page" ref="crud"
            @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template #menu-left>

            </template>
        </avue-crud>
        <!-- <template #footer>
            <span class="dialog-footer">
                <el-button @click="closeDialog">取 消</el-button>
                <el-button type="primary" @click="submit">确 定</el-button>
            </span>
        </template> -->
    </el-dialog>
</template>
<script>
export default {
    props: {
        showDialog: {
            type: Boolean,
            default: false
        },
    },
    data() {
        return {
            openShow: false,
            option: {
                // height: 'auto',
                calcHeight: 32,
                tip: false,
                size: 'medium',
                simplePage: true,
                searchShow: true,
                searchMenuSpan: 6,
                searchIcon: true,
                searchIndex: 3,
                tree: false,
                border: true,
                index: true,
                selection: true,
                viewBtn: false,
                delBtn: false,
                addBtn: false,
                editBtn: false,
                addBtnText: '申请',
                editBtnText: '修改',
                viewBtnIcon: ' ',
                delBtnIcon: ' ',
                editBtnIcon: ' ',
                viewBtnText: '详情',
                labelWidth: 120,
                menuWidth: 180,
                dialogWidth: 640,
                dialogClickModal: false,
                searchEnter: true,
                excelBtn: false,
                filterBtn: true,
                searchShowBtn: false,
                columnSort: true,
                excelBtn: true,
                columnSort: true,
                index: false,
                showOverflowTooltip: true,
                menu: false,
                header: false,
                searchLabelPosition:'left',
searchLabelPosition:'left',
 searchGutter:24,
  searchSpan:6,
menuAlign: 'left',
gridBtn:false,
searchMenuPosition:'right',
                column: [
                    {
                        label: '镀种',
                        prop: 'plate',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 100,
                    },
                    {
                        label: '厂家代码',
                        prop: 'bsOemCustomer.ocCode',
                        bind: 'bsOemCustomer.ocCode',
                        search: false,
                        sortable: true,
                        filter: true,
                        span: 24,
                        width: 120,
                    },
                    {
                        label: '厂家名称',
                        prop: 'bsOemCustomer.ocName',
                        bind: 'bsOemCustomer.ocName',
                        search: false,
                        sortable: true,
                        filter: true,
                        span: 24,
                        width: 120,
                    },

                    {
                        label: '计划准时完成',
                        children: [
                            {
                                label: '目标值(%)',
                                prop: 'jhzsTarget',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                            },
                            {
                                label: '实际值(%)',
                                prop: 'jhzsReality',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                                cell:true,
                                rules: [
                                    { required: true, message: '请输入姓名', trigger: 'blur' }
                                ]
                            },

                        ]
                    },
                    {
                        label: '重点零件完成率',
                        children: [
                            {
                                label: '目标值(%)',
                                prop: 'zdljTarget',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                            },
                            {
                                label: '实际值(%)',
                                prop: 'zdljReality',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                                cell:true,
                                rules: [
                                    { required: true, message: '请输入姓名', trigger: 'blur' }
                                ]
                            },

                        ]
                    },
                    {
                        label: '清欠项',
                        children: [
                            {
                                label: '目标值',
                                prop: 'qqxTarget',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                            },
                            {
                                label: '实际值',
                                prop: 'qqxReality',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                                cell:true,
                                rules: [
                                    { required: true, message: '请输入姓名', trigger: 'blur' }
                                ]
                            },

                        ]
                    },
                    {
                        label: '客户投诉(扣分项)',
                        children: [
                            {
                                label: '目标值',
                                prop: 'produceTsTarget',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                            },
                            {
                                label: '实际值',
                                prop: 'produceTsReality',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                                cell:true,
                                rules: [
                                    { required: true, message: '请输入姓名', trigger: 'blur' }
                                ]
                            },

                        ]
                    },

                    {
                        label: '后工序审理单',
                        children: [
                            {
                                label: '目标值',
                                prop: 'hgxTarget',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                            },
                            {
                                label: '实际值',
                                prop: 'hgxReality',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                                cell:true,
                                rules: [
                                    { required: true, message: '请输入姓名', trigger: 'blur' }
                                ]
                            },

                        ]
                    },
                    {
                        label: 'DPPM',
                        children: [
                            {
                                label: '目标值',
                                prop: 'dppmTarget',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                            },
                            {
                                label: '实际值',
                                prop: 'dppmReality',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                                cell:true,
                                rules: [
                                    { required: true, message: '请输入姓名', trigger: 'blur' }
                                ]
                            },

                        ]
                    },
                    {
                        label: '低级错误',
                        children: [
                            {
                                label: '目标值',
                                prop: 'djcwTarget',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                            },
                            {
                                label: '实际值',
                                prop: 'djcwReality',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                                cell:true,
                                rules: [
                                    { required: true, message: '请输入姓名', trigger: 'blur' }
                                ]
                            },

                        ]
                    },
                    {
                        label: '顾客投诉(扣分项)',
                        children: [
                            {
                                label: '目标值',
                                prop: 'qualityTsTarget',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                            },
                            {
                                label: '实际值',
                                prop: 'qualityTsReality',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                                cell:true,
                                rules: [
                                    { required: true, message: '请输入姓名', trigger: 'blur' }
                                ]
                            },

                        ]
                    },
                    {
                        label: '批次性(扣分项)',
                        children: [
                            {
                                label: '目标值',
                                prop: 'pcxTarget',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                            },
                            {
                                label: '实际值',
                                prop: 'pcxReality',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                                cell:true,
                                rules: [
                                    { required: true, message: '请输入姓名', trigger: 'blur' }
                                ]
                            },

                        ]
                    },
                    {
                        label: '多余物(扣分项)',
                        children: [
                            {
                                label: '目标值',
                                prop: 'dywTarget',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                            },
                            {
                                label: '实际值',
                                prop: 'dywReality',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                                cell:true,
                                rules: [
                                    { required: true, message: '请输入姓名', trigger: 'blur' }
                                ]
                            },

                        ]
                    },
                    {
                        label: '清零问题(扣分项)',
                        children: [
                            {
                                label: '目标值',
                                prop: 'qlwtTarget',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                            },
                            {
                                label: '实际值',
                                prop: 'qlwtReality',
                                search: false,
                                sortable: true,
                                filter: true,
                                span: 24,
                                width: 120,
                                cell:true,
                                rules: [
                                    { required: true, message: '请输入姓名', trigger: 'blur' }
                                ]
                            },

                        ]
                    },

                    {
                        label: '发展能力',
                        prop: 'growAbility',
                        search: false,
                        sortable: true,
                        filter: true,
                        span: 24,
                        width: 120,
                    },
                    {
                        label: '重大事项',
                        prop: 'ajorIssues',
                        search: false,
                        sortable: true,
                        filter: true,
                        span: 24,
                        width: 120,
                    },
                ]
            },
            form: {

            },
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
        }
    },
    mounted() {
        this.openShow = this.showDialog
    },
    methods: {
        closeDialog() {
            this.openShow = false
            this.$emit('closeDialog');
        },
        onLoad() {
            this.loading = true
            this.data = [
                {
                    $cellEdit: true,
                    "bsOemCustomer": {
                        "abbreviation": "L076",
                        "address": "aaa",
                        "codeAndName": "L076/L076",
                        "contactMan": "aaa",
                        "contactPhone": "aaa",
                        "craftAbility": "镀银、挂镀银、喷砂、涂色标、铜合金化学镀镍、电镀镍、DL零件包装",
                        "curStatus": 0,
                        "curStatusText": "正常供货",
                        "email": "aaa",
                        "keyValue": 21,
                        "limitType": 0,
                        "ocCode": "L076",
                        "ocId": 21,
                        "ocName": "L076",
                        "oemPassword": null,
                        "partCodeYesOrNo": false,
                        "qualification": 10,
                        "qualificationTitle": null,
                        "region": "陕西省",
                        "updateTime": "2023-04-14 18:33:49"
                    },
                    "createMan": {
                        "userId": 541,
                        "userName": "崔殿龙"
                    },
                    "createTime": "2023-11-10 18:06:40",
                    "keyValue": 1,
                    "oaaId": 1,
                    "plate": "222",
                    jhzsTarget: 85,
                    zdljTarget: 92,
                    qqxTarget: 0,
                    produceTsTarget: 0,
                    djcwTarget: 0,
                    djcwReality: 0,
                    qualityTsTarget: 0,
                    qualityTsReality: 0,
                    qualityMerits: 0,
                    payMerits: 0,
                    qualityTsNum: 0,
                    djcwNum: 0,
                    dppmNum: 0,
                    hgxNum: 0,
                    produceTsNum: 0,
                    qqxNum: 0,
                    zdljNum: 0,
                    jhzsNum: 0,
                    ajorIssues: 0,
                    qqxReality: 0,
                    growAbility: 0,
                    produceTsReality: 0,
                    pcxTarget: 0,
                    pcxReality: 0,
                    dywTarget: 0,
                    dywReality: 0,
                    qlwtTarget: 0,
                    qlwtReality: 0
                },
                {
                     $cellEdit: true,
                    "bsOemCustomer": {
                        "abbreviation": "L120",
                        "address": "aaa",
                        "codeAndName": "L120/L120",
                        "contactMan": "aaa",
                        "contactPhone": "aaa",
                        "craftAbility": "不锈钢涂福斯润滑剂、DL零件包装、",
                        "curStatus": 0,
                        "curStatusText": "正常供货",
                        "email": "aaa",
                        "keyValue": 2,
                        "limitType": 0,
                        "ocCode": "L120",
                        "ocId": 2,
                        "ocName": "L120",
                        "oemPassword": null,
                        "partCodeYesOrNo": false,
                        "qualification": 0,
                        "qualificationTitle": "民品&普军",
                        "region": "江苏省",
                        "updateTime": "2023-04-14 18:33:49"
                    },
                    "createMan": {
                        "userId": 541,
                        "userName": "崔殿龙"
                    },
                    "createTime": "2023-11-10 18:06:40",
                    "keyValue": 4,
                    "oaaId": 4,
                    "plate": "222",
                    jhzsTarget: 85,
                    zdljTarget: 92,
                    qqxTarget: 0,
                    produceTsTarget: 0,
                    djcwTarget: 0,
                    djcwReality: 0,
                    qualityTsTarget: 0,
                    qualityTsReality: 0,
                    qualityMerits: 0,
                    payMerits: 0,
                    qualityTsNum: 0,
                    djcwNum: 0,
                    dppmNum: 0,
                    hgxNum: 0,
                    produceTsNum: 0,
                    qqxNum: 0,
                    zdljNum: 0,
                    jhzsNum: 0,
                    ajorIssues: 0,
                    qqxReality: 0,
                    growAbility: 0,
                    produceTsReality: 0,
                    pcxTarget: 0,
                    pcxReality: 0,
                    dywTarget: 0,
                    dywReality: 0,
                    qlwtTarget: 0,
                    qlwtReality: 0
                },
                {
                     $cellEdit: true,
                    "bsOemCustomer": {
                        "abbreviation": "L120",
                        "address": "aaa",
                        "codeAndName": "L120/L120",
                        "contactMan": "aaa",
                        "contactPhone": "aaa",
                        "craftAbility": "不锈钢涂福斯润滑剂、DL零件包装、",
                        "curStatus": 0,
                        "curStatusText": "正常供货",
                        "email": "aaa",
                        "keyValue": 2,
                        "limitType": 0,
                        "ocCode": "L120",
                        "ocId": 2,
                        "ocName": "L120",
                        "oemPassword": null,
                        "partCodeYesOrNo": false,
                        "qualification": 0,
                        "qualificationTitle": "民品&普军",
                        "region": "江苏省",
                        "updateTime": "2023-04-14 18:33:49"
                    },
                    "createMan": {
                        "userId": 541,
                        "userName": "崔殿龙"
                    },
                    "createTime": "2023-12-07 09:53:47",
                    "keyValue": 41,
                    "oaaId": 41,
                    "plate": "222",
                    jhzsTarget: 85,
                    zdljTarget: 92,
                    qqxTarget: 0,
                    produceTsTarget: 0,
                    djcwTarget: 0,
                    djcwReality: 0,
                    qualityTsTarget: 0,
                    qualityTsReality: 0,
                    qualityMerits: 0,
                    payMerits: 0,
                    qualityTsNum: 0,
                    djcwNum: 0,
                    dppmNum: 0,
                    hgxNum: 0,
                    produceTsNum: 0,
                    qqxNum: 0,
                    zdljNum: 0,
                    jhzsNum: 0,
                    ajorIssues: 0,
                    qqxReality: 0,
                    growAbility: 0,
                    produceTsReality: 0,
                    pcxTarget: 0,
                    pcxReality: 0,
                    dywTarget: 0,
                    dywReality: 0,
                    qlwtTarget: 0,
                    qlwtReality: 0
                },

            ]
            this.page.total = this.data.length
            this.loading = false
            setTimeout(() => {
                this.selectionClear()
            }, 500)
        }
    }
}
</script>
<style lang="scss" scoped></style>