<template>
    <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>
                <el-button type="primary" @click="addFn(null,true)">增加</el-button>
                <el-button type="danger" @click="handleDelete()">删除</el-button>
            </template>
            <template #menu-right>

            </template>
            <template #menu="scope">
                <el-button type="primary" text plain style="border: 0; background-color: transparent !important"
                    size="medium" @click.stop="addFn(row,false)">修改</el-button>
            </template>

        </avue-crud>
        <!-- 增加  修改 -->
        <addEditDialog v-if="isOpen" :showDialog="isOpen" @closeDialog="closeDialog" :moldAddMore="moldAddMore"></addEditDialog>
    </div>
</template>
<script>
import addEditDialog from './components/addMonthEditDialog.vue'
export default {
    components: {
        addEditDialog
    },
    data() {
        return {
            selectionList: [],
            option: {
                height: 'auto',
                calcHeight: 32,
                tip: false,
                size: 'medium',
                simplePage: true,
                searchShow: true,
                searchMenuSpan: 18,
                searchIcon: true,
                searchIndex: 3,
                tree: false,
                border: true,
                index: true,
                selection: true,
                editBtn: false,
                viewBtn: false,
                delBtn: false,
                addBtn: false,
                editBtnText: '修改',
                labelWidth: 120,
                menuWidth: 70,
                dialogWidth: 640,
                dialogClickModal: false,
                searchEnter: true,
                excelBtn: false,
                filterBtn: true,
                searchShowBtn: false,
                columnSort: true,
                excelBtn: true,
                columnSort: true,
                index: false,
                showOverflowTooltip: true,
                searchLabelPosition: 'left',
                searchGutter: 24,
                searchSpan: 6,
                menuAlign: 'left',
                gridBtn: false,
                searchMenuPosition: 'right',
                addBtnIcon: ' ',
                viewBtnIcon: ' ',
                delBtnIcon: ' ',
                editBtnIcon: ' ',
                align: 'center',
                column: [
                    {
                        label: '月份',
                        prop: 'mauMonth',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: true,
                        width: 120,
                        searchLabelWidth: 50,
                    },
                    {
                        label: '后工序审理实际值',
                        prop: 'actualHgxsld',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },
                    {
                        label: '后工序审理目标值',
                        prop: 'targetHgxsld',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },
                    {
                        label: '后工序批次性实际值',
                        prop: 'actualHgxpcx',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },
                    {
                        label: '后工序批次目标值',
                        prop: 'targetHgxpcx',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },

                    {
                        label: '质量损失额实际值',
                        prop: 'actualZlsse',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },
                    {
                        label: '质量损失额目标值',
                        prop: 'targetZlsse',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },
                    {
                        label: '出厂不合格品率实际值',
                        prop: 'actualBhgpl',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 200,
                    },
                    {
                        label: '出厂不合格品率目标值',
                        prop: 'targetBhgpl',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 200,
                    },
                    {
                        label: '适航宇航实际值',
                        prop: 'actualShyh',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },
                    {
                        label: '适航宇航目标值',
                        prop: 'targetShyh',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },
                    {
                        label: '投诉实际值',
                        prop: 'actualTs',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },
                    {
                        label: '投诉目标值',
                        prop: 'targetTs',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },
                    {
                        label: '低层次实际值',
                        prop: 'actualDcc',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },
                    {
                        label: '低层次目标值',
                        prop: 'targetDcc',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 180,
                    },


                ]
            },
            form: {
                name: '',
            },
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            isOpen: false,
            moldAddMore:false,
        }
    },
    methods: {
        addFn(row,flag) {
            this.isOpen = true
            this.moldAddMore = flag
        },
        closeDialog() {
            this.isOpen = false
        },
        handleDelete() {
            if (this.selectionList.length === 0) {
                this.$message.warning('请选择至少一条数据');
                return;
            }
            this.$confirm('确定将选择数据删除?', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            }).then(() => {
            })
        },
        // 多选
        selectionChange(list) {
            this.selectionList = list;
        },
        onLoad() {
            this.loading = true
            this.data = [
                {
                    "actualBhgpl": 22.0,
                    "actualDcc": 22.0,
                    "actualHgxpcx": 22.0,
                    "actualHgxsld": 22.0,
                    "actualShyh": 22.0,
                    "actualTs": 22.0,
                    "actualZlsse": 22.0,
                    "keyValue": 4,
                    "mauId": 4,
                    "mauMonth": "2024-05",
                    "targetBhgpl": 32.0,
                    "targetDcc": 22.0,
                    "targetHgxpcx": 22.0,
                    "targetHgxsld": 22.0,
                    "targetShyh": 22.0,
                    "targetTs": 22.0,
                    "targetZlsse": 32.0,
                    "updateMan": {
                        "userId": 541,
                        "userName": "崔殿龙"
                    },
                    "updateTime": "2024-04-16 14:05:59"
                },
                {
                    "actualBhgpl": 7.0,
                    "actualDcc": 13.0,
                    "actualHgxpcx": 3.0,
                    "actualHgxsld": 1.0,
                    "actualShyh": 9.0,
                    "actualTs": 11.0,
                    "actualZlsse": 5.0,
                    "keyValue": 1,
                    "mauId": 1,
                    "mauMonth": "2024-04",
                    "targetBhgpl": 18.0,
                    "targetDcc": 14.0,
                    "targetHgxpcx": 4.0,
                    "targetHgxsld": 12.0,
                    "targetShyh": 10.0,
                    "targetTs": 12.0,
                    "targetZlsse": 16.0,
                    "updateMan": {
                        "userId": 541,
                        "userName": "崔殿龙"
                    },
                    "updateTime": "2024-04-16 13:48:56"
                },
                {
                    "actualBhgpl": 11.0,
                    "actualDcc": 11.0,
                    "actualHgxpcx": 11.0,
                    "actualHgxsld": 11.0,
                    "actualShyh": 11.0,
                    "actualTs": 11.0,
                    "actualZlsse": 11.1,
                    "keyValue": 3,
                    "mauId": 3,
                    "mauMonth": "2024-03",
                    "targetBhgpl": 11.0,
                    "targetDcc": 11.0,
                    "targetHgxpcx": 11.0,
                    "targetHgxsld": 11.0,
                    "targetShyh": 11.0,
                    "targetTs": 11.0,
                    "targetZlsse": 12.0,
                    "updateMan": {
                        "userId": 541,
                        "userName": "崔殿龙"
                    },
                    "updateTime": "2024-04-23 09:09:16"
                },
                {
                    "actualBhgpl": 7.0,
                    "actualDcc": 7.0,
                    "actualHgxpcx": 77.0,
                    "actualHgxsld": 7.0,
                    "actualShyh": 7.0,
                    "actualTs": 77.0,
                    "actualZlsse": 7.0,
                    "keyValue": 15,
                    "mauId": 15,
                    "mauMonth": "2024-02",
                    "targetBhgpl": 17.0,
                    "targetDcc": 7.0,
                    "targetHgxpcx": 7.0,
                    "targetHgxsld": 12.0,
                    "targetShyh": 7.0,
                    "targetTs": 7.0,
                    "targetZlsse": 17.0,
                    "updateMan": {
                        "userId": 541,
                        "userName": "崔殿龙"
                    },
                    "updateTime": "2024-04-16 15:51:52"
                }
            ]
            this.page.total = this.data.length
            this.loading = false
            setTimeout(() => {
                this.selectionClear()
            }, 500)
        }
    }
}
</script>
<style lang="scss" scoped></style>