<template>
    <basic-container>
        <!-- 薪资维护标准 -->
        <avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" v-model:page="page" ref="crud"
            @row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad" :span-method="spanMethod">
            <template #menu-left>
                <el-button type="danger" icon="el-icon-delete" @click="handleDelete">删除</el-button>
            </template>

            <template #militaryProducts="scope">
                <el-tag v-if="scope.row.militaryProducts == 1" type="success">军品</el-tag>
                <el-tag v-if="scope.row.militaryProducts == 2" type="danger">非军品</el-tag>
                <el-tag v-if="scope.row.militaryProducts == 3">通用</el-tag>
            </template>
            <template #ppsName="{ row }">{{ row.bsProcedureSet && row.bsProcedureSet.ppsName }}</template>
        </avue-crud>
    </basic-container>
</template>

<script>
export default {
    data() {
        return {
            loading: false,
            data: [],
            form: {},
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            spanArr: [
                { prop: 'militaryProducts', span: [] },
                { prop: 'ppsName', span: [] },
                { prop: 'twlOther', span: [] },
                { prop: 'workerPrice', span: [] },
                { prop: 'twlUnitTitle', span: [] },
            ],
            selectionList: [],
            option: {
                height: 'auto',
                calcHeight: 32,
                rowKey: 'twlId',
                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: true,
                editBtn: true,
                editBtnText: '修改',
                addBtnIcon: ' ',
        viewBtnIcon: ' ',
        delBtnIcon: ' ',
        editBtnIcon: ' ',
                viewBtnText: '详情',
                labelWidth: 120,
                searchLabelWidth: 120,
                menuWidth: 220,
                dialogWidth: 1200,
                dialogClickModal: false,
                searchEnter: true,
                excelBtn: false,
                filterBtn: true,
                searchShowBtn: false,
                columnSort: true,
                excelBtn: true,
                columnSort: true,
                index: false,
                showOverflowTooltip: true,
                searchLabelPosition:'left',
searchLabelPosition:'left',
 searchGutter:24,
  searchSpan:6,
menuAlign: 'left',
gridBtn:false,
searchMenuPosition:'right',
                column: [
                    {
                        label: '规则类型',
                        prop: 'militaryProducts',
                        type: 'select',
                        search: false,
                        sortable: true,
                        overHidden: true,
                        width: 200,
                        rules: [
                            {
                                required: true,
                                message: '请输入是否军品',
                                trigger: 'blur',
                            },
                        ],
                        dicData: [
                            { label: '军品', value: 1 },
                            { label: '非军品', value: 2 },
                            { label: '通用', value: 3 },
                        ]
                    },
                    // {
                    //     label: '类别',
                    //     prop: 'twlTypeTitle',
                    //     type: 'select',
                    //     search: false,
                    //     sortable: true,
                    //     overHidden: true,
                    //     width: 200,
                    //     rules: [
                    //         {
                    //             required: true,
                    //             message: '请输入类别',
                    //             trigger: 'blur',
                    //         },
                    //     ],
                    //     dicData: [
                    //         { label: '工序', value: 1 },
                    //         { label: '异性壳体', value: 2 },
                    //         { label: '零件号', value: 3 },
                    //         { label: '产品型号', value: 4 },
                    //         { label: '单位面积以上', value: 5 },
                    //         { label: '单位面积以下', value: 6 }
                    //     ],
                    //     control: (val, form) => {
                    //         let tmp = this.option.column.find(item => item.prop == 'ppsId')
                    //         let tmp1 = this.option.column.find(item => item.prop == 'twlOther')
                    //         form.ppsId = null
                    //         form.twlOther = ''
                    //         if(tmp){
                    //             if(form.twlTypeTitle == 1){
                    //                 tmp.addDisabled = false
                    //             }else{
                    //                 tmp.addDisabled = true
                    //             }
                    //         }
                    //         if(tmp1){
                    //             if(form.twlTypeTitle == 1){
                    //                 tmp1.addDisabled = true
                    //             }else{
                    //                 tmp1.addDisabled = false
                    //             }
                    //         }
                    //     },
                    // },
                    {
                        label: '工序名称',
                        prop: 'ppsName',
                        search: true,
                        sortable: true,
                        overHidden: true,
                        addDisplay: false,
                        editDisplay: false,
                        width: 200,
                        rules: [
                            {
                                required: true,
                                message: '请输入工序名称',
                                trigger: 'blur',
                            },
                        ],
                    },
                    {
                        label: '工序',
                        prop: 'ppsId',
                        hide: true,
                        type: 'select',
                        search: false,
                        sortable: true,
                        width: 200,
                        props: {
                            label: 'ppsName',
                            value: "ppsId"
                        },
                        dicData: [
                            {
                                "assist": false,
                                "assistTitle": "否",
                                "createMan": {
                                    "accountId": null,
                                    "card": null,
                                    "createTime": "2022-08-31",
                                    "curStatus": 1,
                                    "deleted": false,
                                    "deptName": null,
                                    "dimissionTime": null,
                                    "factoryId": 41,
                                    "head": 0,
                                    "jobName": "总工",
                                    "keyValue": 1,
                                    "ldapName": "admin",
                                    "mail": "13699999999@136.com",
                                    "mobile": "13699999999",
                                    "pfDepartment": {
                                        "appLink": null,
                                        "createTime": "2022-08-31",
                                        "deleted": false,
                                        "deptCode": "001",
                                        "deptId": 1,
                                        "deptName": "MES开发部",
                                        "deptType": 1,
                                        "deptTypeTitle": "厂",
                                        "keyValue": 1,
                                        "memo": null,
                                        "orders": "00",
                                        "parentDeptId": null,
                                        "parentPath": null,
                                        "ucDeptId": null,
                                        "updateTime": "2022-08-31 16:32:46"
                                    },
                                    "pinyinIndex": "ADMIN,ADMIN",
                                    "ucUserId": null,
                                    "updateTime": "2022-08-31 16:32:46",
                                    "userCode": "00",
                                    "userId": 1,
                                    "userName": "admin",
                                    "userSex": 1,
                                    "userSources": "admin",
                                    "userString": "1:A:admin",
                                    "userType": "A"
                                },
                                "createTime": "2022-11-15 10:30:29",
                                "cycle": 0.0,
                                "cyropactorControl": false,
                                "deleted": false,
                                "eleRate": true,
                                "eleStream": true,
                                "keyValue": 6,
                                "mainProcess": true,
                                "mainProcessTitle": "是",
                                "niValue": false,
                                "phValue": false,
                                "ppsCode": "002",
                                "ppsId": 6,
                                "ppsName": "上挂",
                                "special": false,
                                "specialTitle": "否",
                                "team": null,
                                "updateTime": "2022-11-15 10:30:29",
                                "vSpeed": false
                            },
                            {
                                "assist": false,
                                "assistTitle": "否",
                                "createMan": {
                                    "accountId": null,
                                    "card": null,
                                    "createTime": "2022-08-31",
                                    "curStatus": 1,
                                    "deleted": false,
                                    "deptName": null,
                                    "dimissionTime": null,
                                    "factoryId": 41,
                                    "head": 0,
                                    "jobName": "总工",
                                    "keyValue": 1,
                                    "ldapName": "admin",
                                    "mail": "13699999999@136.com",
                                    "mobile": "13699999999",
                                    "pfDepartment": {
                                        "appLink": null,
                                        "createTime": "2022-08-31",
                                        "deleted": false,
                                        "deptCode": "001",
                                        "deptId": 1,
                                        "deptName": "MES开发部",
                                        "deptType": 1,
                                        "deptTypeTitle": "厂",
                                        "keyValue": 1,
                                        "memo": null,
                                        "orders": "00",
                                        "parentDeptId": null,
                                        "parentPath": null,
                                        "ucDeptId": null,
                                        "updateTime": "2022-08-31 16:32:46"
                                    },
                                    "pinyinIndex": "ADMIN,ADMIN",
                                    "ucUserId": null,
                                    "updateTime": "2022-08-31 16:32:46",
                                    "userCode": "00",
                                    "userId": 1,
                                    "userName": "admin",
                                    "userSex": 1,
                                    "userSources": "admin",
                                    "userString": "1:A:admin",
                                    "userType": "A"
                                },
                                "createTime": "2022-11-15 10:30:45",
                                "cycle": 0.0,
                                "cyropactorControl": true,
                                "deleted": false,
                                "eleRate": true,
                                "eleStream": true,
                                "keyValue": 7,
                                "mainProcess": true,
                                "mainProcessTitle": "是",
                                "niValue": true,
                                "phValue": true,
                                "ppsCode": "003",
                                "ppsId": 7,
                                "ppsName": "化学镀镍",
                                "special": false,
                                "specialTitle": "否",
                                "team": null,
                                "updateTime": "2022-11-15 10:30:45",
                                "vSpeed": true
                            },
                            {
                                "assist": false,
                                "assistTitle": "否",
                                "createMan": {
                                    "accountId": null,
                                    "card": null,
                                    "createTime": "2022-08-31",
                                    "curStatus": 1,
                                    "deleted": false,
                                    "deptName": null,
                                    "dimissionTime": null,
                                    "factoryId": 41,
                                    "head": 0,
                                    "jobName": "总工",
                                    "keyValue": 1,
                                    "ldapName": "admin",
                                    "mail": "13699999999@136.com",
                                    "mobile": "13699999999",
                                    "pfDepartment": {
                                        "appLink": null,
                                        "createTime": "2022-08-31",
                                        "deleted": false,
                                        "deptCode": "001",
                                        "deptId": 1,
                                        "deptName": "MES开发部",
                                        "deptType": 1,
                                        "deptTypeTitle": "厂",
                                        "keyValue": 1,
                                        "memo": null,
                                        "orders": "00",
                                        "parentDeptId": null,
                                        "parentPath": null,
                                        "ucDeptId": null,
                                        "updateTime": "2022-08-31 16:32:46"
                                    },
                                    "pinyinIndex": "ADMIN,ADMIN",
                                    "ucUserId": null,
                                    "updateTime": "2022-08-31 16:32:46",
                                    "userCode": "00",
                                    "userId": 1,
                                    "userName": "admin",
                                    "userSex": 1,
                                    "userSources": "admin",
                                    "userString": "1:A:admin",
                                    "userType": "A"
                                },
                                "createTime": "2022-11-15 10:31:00",
                                "cycle": 0.0,
                                "cyropactorControl": false,
                                "deleted": false,
                                "eleRate": false,
                                "eleStream": false,
                                "keyValue": 8,
                                "mainProcess": true,
                                "mainProcessTitle": "是",
                                "niValue": false,
                                "phValue": false,
                                "ppsCode": "004",
                                "ppsId": 8,
                                "ppsName": "下挂",
                                "special": false,
                                "specialTitle": "否",
                                "team": null,
                                "updateTime": "2022-11-15 10:31:00",
                                "vSpeed": false
                            },
                            {
                                "assist": false,
                                "assistTitle": "否",
                                "createMan": {
                                    "accountId": null,
                                    "card": null,
                                    "createTime": "2022-08-31",
                                    "curStatus": 1,
                                    "deleted": false,
                                    "deptName": null,
                                    "dimissionTime": null,
                                    "factoryId": 41,
                                    "head": 0,
                                    "jobName": "总工",
                                    "keyValue": 1,
                                    "ldapName": "admin",
                                    "mail": "13699999999@136.com",
                                    "mobile": "13699999999",
                                    "pfDepartment": {
                                        "appLink": null,
                                        "createTime": "2022-08-31",
                                        "deleted": false,
                                        "deptCode": "001",
                                        "deptId": 1,
                                        "deptName": "MES开发部",
                                        "deptType": 1,
                                        "deptTypeTitle": "厂",
                                        "keyValue": 1,
                                        "memo": null,
                                        "orders": "00",
                                        "parentDeptId": null,
                                        "parentPath": null,
                                        "ucDeptId": null,
                                        "updateTime": "2022-08-31 16:32:46"
                                    },
                                    "pinyinIndex": "ADMIN,ADMIN",
                                    "ucUserId": null,
                                    "updateTime": "2022-08-31 16:32:46",
                                    "userCode": "00",
                                    "userId": 1,
                                    "userName": "admin",
                                    "userSex": 1,
                                    "userSources": "admin",
                                    "userString": "1:A:admin",
                                    "userType": "A"
                                },
                                "createTime": "2025-02-27 12:22:37",
                                "cycle": 0.0,
                                "cyropactorControl": false,
                                "deleted": false,
                                "eleRate": false,
                                "eleStream": false,
                                "keyValue": 12,
                                "mainProcess": true,
                                "mainProcessTitle": "是",
                                "niValue": false,
                                "phValue": false,
                                "ppsCode": "008",
                                "ppsId": 12,
                                "ppsName": "涂色标test",
                                "special": true,
                                "specialTitle": "是",
                                "team": "涂色标班组",
                                "updateTime": "2022-11-15 10:33:17",
                                "vSpeed": false
                            },
                            {
                                "assist": false,
                                "assistTitle": "否",
                                "createMan": {
                                    "accountId": null,
                                    "card": null,
                                    "createTime": "2022-08-31",
                                    "curStatus": 1,
                                    "deleted": false,
                                    "deptName": null,
                                    "dimissionTime": null,
                                    "factoryId": 41,
                                    "head": 0,
                                    "jobName": "总工",
                                    "keyValue": 1,
                                    "ldapName": "admin",
                                    "mail": "13699999999@136.com",
                                    "mobile": "13699999999",
                                    "pfDepartment": {
                                        "appLink": null,
                                        "createTime": "2022-08-31",
                                        "deleted": false,
                                        "deptCode": "001",
                                        "deptId": 1,
                                        "deptName": "MES开发部",
                                        "deptType": 1,
                                        "deptTypeTitle": "厂",
                                        "keyValue": 1,
                                        "memo": null,
                                        "orders": "00",
                                        "parentDeptId": null,
                                        "parentPath": null,
                                        "ucDeptId": null,
                                        "updateTime": "2022-08-31 16:32:46"
                                    },
                                    "pinyinIndex": "ADMIN,ADMIN",
                                    "ucUserId": null,
                                    "updateTime": "2022-08-31 16:32:46",
                                    "userCode": "00",
                                    "userId": 1,
                                    "userName": "admin",
                                    "userSex": 1,
                                    "userSources": "admin",
                                    "userString": "1:A:admin",
                                    "userType": "A"
                                },
                                "createTime": "2023-02-07 18:16:37",
                                "cycle": 0.0,
                                "cyropactorControl": false,
                                "deleted": false,
                                "eleRate": false,
                                "eleStream": false,
                                "keyValue": 112,
                                "mainProcess": true,
                                "mainProcessTitle": "是",
                                "niValue": false,
                                "phValue": false,
                                "ppsCode": "112",
                                "ppsId": 112,
                                "ppsName": "热处理",
                                "special": false,
                                "specialTitle": "否",
                                "team": null,
                                "updateTime": "2023-02-07 18:16:37",
                                "vSpeed": false
                            },
                            {
                                "assist": false,
                                "assistTitle": "否",
                                "createMan": {
                                    "accountId": 365,
                                    "card": null,
                                    "createTime": "2023-02-08",
                                    "curStatus": 1,
                                    "deleted": false,
                                    "deptName": null,
                                    "dimissionTime": null,
                                    "factoryId": 41,
                                    "head": 0,
                                    "jobName": "工艺员",
                                    "keyValue": 307,
                                    "ldapName": "06758",
                                    "mail": null,
                                    "mobile": null,
                                    "pfDepartment": {
                                        "appLink": null,
                                        "createTime": "2023-02-08",
                                        "deleted": false,
                                        "deptCode": "32",
                                        "deptId": 75,
                                        "deptName": "壳体工艺室",
                                        "deptType": 1,
                                        "deptTypeTitle": "厂",
                                        "keyValue": 75,
                                        "memo": null,
                                        "orders": "32",
                                        "parentDeptId": 41,
                                        "parentPath": null,
                                        "ucDeptId": null,
                                        "updateTime": "2023-02-08 16:43:31"
                                    },
                                    "pinyinIndex": "06758,06758",
                                    "ucUserId": null,
                                    "updateTime": "2023-02-08 17:25:05",
                                    "userCode": "06758",
                                    "userId": 307,
                                    "userName": "06758",
                                    "userSex": 0,
                                    "userSources": "06758",
                                    "userString": "307:A:06758",
                                    "userType": "A"
                                },
                                "createTime": "2023-04-08 17:03:14",
                                "cycle": 0.0,
                                "cyropactorControl": false,
                                "deleted": false,
                                "eleRate": false,
                                "eleStream": false,
                                "keyValue": 340,
                                "mainProcess": true,
                                "mainProcessTitle": "是",
                                "niValue": false,
                                "phValue": false,
                                "ppsCode": "340",
                                "ppsId": 340,
                                "ppsName": "稳定化处理",
                                "special": false,
                                "specialTitle": "否",
                                "team": null,
                                "updateTime": "2023-04-08 17:03:14",
                                "vSpeed": false
                            },
                            {
                                "assist": false,
                                "assistTitle": "否",
                                "createMan": {
                                    "accountId": 90,
                                    "card": null,
                                    "createTime": "2023-02-08",
                                    "curStatus": 1,
                                    "deleted": false,
                                    "deptName": null,
                                    "dimissionTime": null,
                                    "factoryId": 41,
                                    "head": 1,
                                    "jobName": "生产调度员",
                                    "keyValue": 90,
                                    "ldapName": "03891",
                                    "mail": null,
                                    "mobile": null,
                                    "pfDepartment": {
                                        "appLink": null,
                                        "createTime": "2023-02-08",
                                        "deleted": false,
                                        "deptCode": "06",
                                        "deptId": 47,
                                        "deptName": "经营管理室",
                                        "deptType": 1,
                                        "deptTypeTitle": "厂",
                                        "keyValue": 47,
                                        "memo": null,
                                        "orders": "6",
                                        "parentDeptId": 41,
                                        "parentPath": null,
                                        "ucDeptId": null,
                                        "updateTime": "2023-02-08 13:23:30"
                                    },
                                    "pinyinIndex": "03891,03891",
                                    "ucUserId": null,
                                    "updateTime": "2023-02-08 13:20:39",
                                    "userCode": "03891",
                                    "userId": 90,
                                    "userName": "03891",
                                    "userSex": 1,
                                    "userSources": "03891",
                                    "userString": "90:A:03891",
                                    "userType": "A"
                                },
                                "createTime": "2023-04-12 17:43:55",
                                "cycle": 2.0,
                                "cyropactorControl": true,
                                "deleted": false,
                                "eleRate": true,
                                "eleStream": true,
                                "keyValue": 341,
                                "mainProcess": true,
                                "mainProcessTitle": "是",
                                "niValue": false,
                                "phValue": false,
                                "ppsCode": "341",
                                "ppsId": 341,
                                "ppsName": "除镀层",
                                "special": true,
                                "specialTitle": "是",
                                "team": null,
                                "updateTime": "2023-04-12 17:43:55",
                                "vSpeed": false
                            }
                        ]
                    },
                    {
                        label: '零件号',
                        prop: 'twlOther',
                        search: false,
                        sortable: true,
                        overHidden: true,
                        width: 200,
                        // rules: [
                        //     {
                        //         required: true,
                        //         message: '请输入其他',
                        //         trigger: 'blur',
                        //     },
                        // ],
                    },
                    {
                        label: '工人结算价',
                        prop: 'workerPrice',
                        type: 'number',
                        search: false,
                        sortable: true,
                        overHidden: true,
                        width: 200,
                        rules: [
                            {
                                required: true,
                                message: '请输入工人结算价',
                                trigger: 'blur',
                            },
                        ],
                    },
                    {
                        label: '工人结算单位',
                        prop: 'twlUnitTitle',
                        type: 'select',
                        search: false,
                        sortable: true,
                        overHidden: true,
                        width: 200,
                        rules: [
                            {
                                required: true,
                                message: '请输入工人结算单位',
                                trigger: 'blur',
                            },
                        ],
                        dicData: [
                            { label: '件(根)', value: 1 },
                            { label: '批', value: 2 },
                            { label: '面积', value: 3 }
                        ]
                    },
                    {
                        label: '阶梯上下限',
                        prop: 'bound',
                        search: false,
                        sortable: true,
                        overHidden: true,
                        width: 200,
                        hide: true,
                        // rules: [
                        //     {
                        //         required: true,
                        //         message: '请输入最小标准',
                        //         trigger: 'blur',
                        //     },
                        // ],
                    },
                    {
                        label: '阶梯下限',
                        prop: 'minLevel',
                        type: 'number',
                        search: false,
                        sortable: true,
                        overHidden: true,
                        width: 200,
                        addDisplay: false,
                        editDisplay: false,
                        // rules: [
                        //     {
                        //         required: true,
                        //         message: '请输入最小标准',
                        //         trigger: 'blur',
                        //     },
                        // ],
                    },
                    {
                        label: '阶梯上限',
                        prop: 'maxLevel',
                        search: false,
                        type: 'number',
                        sortable: true,
                        overHidden: true,
                        addDisplay: false,
                        editDisplay: false,
                        width: 200,
                        // rules: [
                        //     {
                        //         required: true,
                        //         message: '请输入最大标准',
                        //         trigger: 'blur',
                        //     },
                        // ],
                    },
                    {
                        label: '阶梯单位',
                        prop: 'countUnitTitle',
                        type: 'select',
                        search: false,
                        sortable: true,
                        overHidden: true,
                        width: 200,
                        dicData: [
                            { label: '件', value: 1 },
                            { label: '面积', value: 2 }
                        ]
                        // rules: [
                        //     {
                        //         required: true,
                        //         message: '请输入计算单位',
                        //         trigger: 'blur',
                        //     },
                        // ],
                    },
                    {
                        label: '小批量结算',
                        prop: 'xplSettlements',
                        search: false,
                        sortable: true,
                        overHidden: true,
                        hide:true,
                        width: 200,
                        // rules: [
                        //     {
                        //         required: true,
                        //         message: '请输入小批量结算',
                        //         trigger: 'blur',
                        //     },
                        // ],
                    },
                    {
                        label: '小批量结算',
                        prop: 'xplSettlement',
                        type: 'number',
                        search: false,
                        sortable: true,
                        overHidden: true,
                        addDisplay:false,
                        editDisplay:false,
                        width: 200,
                        // rules: [
                        //     {
                        //         required: true,
                        //         message: '请输入小批量结算',
                        //         trigger: 'blur',
                        //     },
                        // ],
                    },
                    {
                        label: '结算单位',
                        prop: 'settlementUnitTitle',
                        type: "select",
                        search: false,
                        sortable: true,
                        overHidden: true,
                        width: 200,
                        dicData: [
                            { label: '批', value: 1 },
                            { label: '倍', value: 2 }
                        ]
                        // rules: [
                        //     {
                        //         required: true,
                        //         message: '请输入结算单位',
                        //         trigger: 'blur',
                        //     },
                        // ],
                    },
                ]

            }
        }
    },
    mounted() {
        this.rowSort()
        this.rowCalc();
    },
    methods: {
        rowCalc() {
            this.spanArr.forEach((ele, index) => {
                let parent
                if (index !== 0) parent = this.spanArr[ele.parent || index - 1].span
                ele.span = this.rowSpan(ele.prop, parent)
            })
        },
        rowSort(list) {
            let propList = this.spanArr.map(ele => ele.prop)
            this.spanArr.forEach((ele, index) => {
                let key = ele.prop
                this.data = this.data.sort((a, b) => {
                    let flag = true;
                    for (let i = 0; i < index; i++) {
                        let prop = this.spanArr[i].prop
                        flag = flag && a[prop] == b[prop]
                    }
                    if (flag) {
                        if (a[key] < b[key]) { return 1; }
                        else if (a[key] > b[key]) { return -1; }
                        return 0;
                    }
                    return 0;
                })
            })
        },
        rowSpan(key, parent) {
            let list = [];
            let position = 0;
            this.data.forEach((item, index) => {
                if (index === 0) {
                    list.push(1)
                    let position = 0;
                } else {
                    if (this.data[index][key] === this.data[index - 1][key]) {
                        if (parent && parent[index] !== 0) {
                            list.push(1)
                            position = index
                        } else {
                            list[position] += 1;
                            list.push(0)
                        }
                    } else {
                        list.push(1)
                        position = index
                    }
                }
            })
            return list
        },
        spanMethod({ row, column, rowIndex, columnIndex }) {
            for (let i = 0; i < this.spanArr.length; i++) {
                const ele = this.spanArr[i]
                if (column.property == ele.prop) {
                    const _row = ele.span[rowIndex];
                    const _col = _row > 0 ? 1 : 0;
                    return {
                        rowspan: _row,
                        colspan: _col
                    }
                } else if (columnIndex == 0) {
                    const _row = ele.span[rowIndex];
                    const _col = _row > 0 ? 1 : 0;
                    return {
                        rowspan: _row,
                        colspan: _col
                    }
                } else if (columnIndex == 11) {
                    const _row = ele.span[rowIndex];
                    const _col = _row > 0 ? 1 : 0;
                    return {
                        rowspan: _row,
                        colspan: _col
                    }
                }
            }

        },
        selectionChange(val) {
            this.selectionList = val
        },
        // 新增数据
        rowSave(row, done, loading) {
            done()
        },
        // 修改数据
        rowUpdate(row, index, done, loading) {
            done()
        },
        // 批量删除
        handleDelete() {
            if (this.selectionList.length == 0) {
                this.$message.error('请先选择数据')
                return
            }
            this.$confirm('确定将选择数据删除?', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            }).then(() => {

            })
        },
        currentChange(currentPage) {
            this.page.currentPage = currentPage;
        },
        sizeChange(pageSize) {
            this.page.pageSize = pageSize;
        },
        refreshChange() {
            this.onLoad(this.page, this.query);
        },
        searchReset() {
            this.query = {};
            this.treeDeptId = '';
            this.onLoad(this.page);
        },
        searchChange(params, done) {
            this.query = params;
            this.page.currentPage = 1;
            this.onLoad(this.page, params);
            done();
        },
        selectionChange(list) {
            this.selectionList = list;
        },
        selectionClear() {
            this.selectionList = [];
            this.$refs.crud.toggleSelection();
        },
        onLoad() {
            this.data = [
                {
                    "bsProcedureSet": null,
                    "countUnit": 1,
                    "countUnitTitle": "件",
                    "createMan": {
                        "accountId": 541,
                        "card": null,
                        "createTime": "2023-05-04",
                        "curStatus": 1,
                        "deleted": false,
                        "deptName": null,
                        "dimissionTime": null,
                        "factoryId": 102,
                        "head": 0,
                        "jobName": "MES开发",
                        "keyValue": 541,
                        "ldapName": "cdl",
                        "mail": null,
                        "mobile": null,
                        "pfDepartment": {
                            "appLink": null,
                            "createTime": "2022-08-31",
                            "deleted": false,
                            "deptCode": "001",
                            "deptId": 1,
                            "deptName": "MES开发部",
                            "deptType": 1,
                            "deptTypeTitle": "厂",
                            "keyValue": 1,
                            "memo": null,
                            "orders": "00",
                            "parentDeptId": null,
                            "parentPath": null,
                            "ucDeptId": null,
                            "updateTime": "2022-08-31 16:32:46"
                        },
                        "pinyinIndex": "CUIDIANLONG,CDL",
                        "ucUserId": null,
                        "updateTime": "2023-05-04 09:16:54",
                        "userCode": "cdl",
                        "userId": 541,
                        "userName": "崔殿龙",
                        "userSex": 1,
                        "userSources": "崔殿龙",
                        "userString": "541:A:崔殿龙",
                        "userType": "A"
                    },
                    "createTime": "2023-12-07 20:57:12",
                    "keyValue": 2,
                    "maxLevel": 10,
                    "militaryProducts": 1,
                    "minLevel": 0,
                    "settlementUnit": 1,
                    "settlementUnitTitle": "批",
                    'bound': '10,20',
                    'xplSettlements':'10,20,30',
                    "twlId": 2,
                    "twlOther": "21E8-0041",
                    "twlType": 2,
                    "twlTypeTitle": "异性壳体",
                    "twlUnit": 1,
                    "twlUnitTitle": "件(根)",
                    "workerPrice": 3.0,
                    "xplSettlement": 10.0
                },
                {
                    "bsProcedureSet": null,
                    "countUnit": 1,
                    "countUnitTitle": "件",
                    "createMan": {
                        "accountId": 541,
                        "card": null,
                        "createTime": "2023-05-04",
                        "curStatus": 1,
                        "deleted": false,
                        "deptName": null,
                        "dimissionTime": null,
                        "factoryId": 102,
                        "head": 0,
                        "jobName": "MES开发",
                        "keyValue": 541,
                        "ldapName": "cdl",
                        "mail": null,
                        "mobile": null,
                        "pfDepartment": {
                            "appLink": null,
                            "createTime": "2022-08-31",
                            "deleted": false,
                            "deptCode": "001",
                            "deptId": 1,
                            "deptName": "MES开发部",
                            "deptType": 1,
                            "deptTypeTitle": "厂",
                            "keyValue": 1,
                            "memo": null,
                            "orders": "00",
                            "parentDeptId": null,
                            "parentPath": null,
                            "ucDeptId": null,
                            "updateTime": "2022-08-31 16:32:46"
                        },
                        "pinyinIndex": "CUIDIANLONG,CDL",
                        "ucUserId": null,
                        "updateTime": "2023-05-04 09:16:54",
                        "userCode": "cdl",
                        "userId": 541,
                        "userName": "崔殿龙",
                        "userSex": 1,
                        "userSources": "崔殿龙",
                        "userString": "541:A:崔殿龙",
                        "userType": "A"
                    },
                    "createTime": "2023-12-07 20:57:12",
                    "keyValue": 2,
                    "maxLevel": 20,
                    "militaryProducts": 1,
                    "minLevel": 10,
                    "settlementUnit": 1,
                    "settlementUnitTitle": "批",
                    "twlId": 2,
                    "twlOther": "21E8-0041",
                    "twlType": 2,
                    'bound': '10,20',
                    'xplSettlements':'10,20,30',
                    "twlTypeTitle": "异性壳体",
                    "twlUnit": 1,
                    "twlUnitTitle": "件(根)",
                    "workerPrice": 3.0,
                    "xplSettlement": 20.0
                },
                {
                    "bsProcedureSet": null,
                    "countUnit": 1,
                    "countUnitTitle": "件",
                    "createMan": {
                        "accountId": 541,
                        "card": null,
                        "createTime": "2023-05-04",
                        "curStatus": 1,
                        "deleted": false,
                        "deptName": null,
                        "dimissionTime": null,
                        "factoryId": 102,
                        "head": 0,
                        "jobName": "MES开发",
                        "keyValue": 541,
                        "ldapName": "cdl",
                        "mail": null,
                        "mobile": null,
                        "pfDepartment": {
                            "appLink": null,
                            "createTime": "2022-08-31",
                            "deleted": false,
                            "deptCode": "001",
                            "deptId": 1,
                            "deptName": "MES开发部",
                            "deptType": 1,
                            "deptTypeTitle": "厂",
                            "keyValue": 1,
                            "memo": null,
                            "orders": "00",
                            "parentDeptId": null,
                            "parentPath": null,
                            "ucDeptId": null,
                            "updateTime": "2022-08-31 16:32:46"
                        },
                        "pinyinIndex": "CUIDIANLONG,CDL",
                        "ucUserId": null,
                        "updateTime": "2023-05-04 09:16:54",
                        "userCode": "cdl",
                        "userId": 541,
                        "userName": "崔殿龙",
                        "userSex": 1,
                        "userSources": "崔殿龙",
                        "userString": "541:A:崔殿龙",
                        "userType": "A"
                    },
                    "createTime": "2023-12-07 20:57:12",
                    "keyValue": 2,
                    "maxLevel": null,
                    "militaryProducts": 1,
                    "minLevel": 20,
                    "settlementUnit": 1,
                    "settlementUnitTitle": "批",
                    "twlId": 2,
                    "twlOther": "21E8-0041",
                    'bound': '10,20',
                    'xplSettlements':'10,20,30',
                    "twlType": 2,
                    "twlTypeTitle": "异性壳体",
                    "twlUnit": 1,
                    "twlUnitTitle": "件(根)",
                    "workerPrice": 3.0,
                    "xplSettlement": 30.0
                },
                {
                    "bsProcedureSet": {
                        "assist": false,
                        "assistTitle": "否",
                        "createMan": {
                            "accountId": null,
                            "card": null,
                            "createTime": "2022-08-31",
                            "curStatus": 1,
                            "deleted": false,
                            "deptName": null,
                            "dimissionTime": null,
                            "factoryId": 41,
                            "head": 0,
                            "jobName": "总工",
                            "keyValue": 1,
                            "ldapName": "admin",
                            "mail": "13699999999@136.com",
                            "mobile": "13699999999",
                            "pfDepartment": {
                                "appLink": null,
                                "createTime": "2022-08-31",
                                "deleted": false,
                                "deptCode": "001",
                                "deptId": 1,
                                "deptName": "MES开发部",
                                "deptType": 1,
                                "deptTypeTitle": "厂",
                                "keyValue": 1,
                                "memo": null,
                                "orders": "00",
                                "parentDeptId": null,
                                "parentPath": null,
                                "ucDeptId": null,
                                "updateTime": "2022-08-31 16:32:46"
                            },
                            "pinyinIndex": "ADMIN,ADMIN",
                            "ucUserId": null,
                            "updateTime": "2022-08-31 16:32:46",
                            "userCode": "00",
                            "userId": 1,
                            "userName": "admin",
                            "userSex": 1,
                            "userSources": "admin",
                            "userString": "1:A:admin",
                            "userType": "A"
                        },
                        "createTime": "2022-11-15 10:30:29",
                        "cycle": 0.0,
                        "cyropactorControl": false,
                        "deleted": false,
                        "eleRate": true,
                        "eleStream": true,
                        "keyValue": 6,
                        "mainProcess": true,
                        "mainProcessTitle": "是",
                        "niValue": false,
                        "phValue": false,
                        "ppsCode": "002",
                        "ppsId": 6,
                        "ppsName": "上挂",
                        "special": false,
                        "specialTitle": "否",
                        "team": null,
                        "updateTime": "2022-11-15 10:30:29",
                        "vSpeed": false
                    },
                    "countUnit": null,
                    "countUnitTitle": null,
                    "createMan": {
                        "accountId": 541,
                        "card": null,
                        "createTime": "2023-05-04",
                        "curStatus": 1,
                        "deleted": false,
                        "deptName": null,
                        "dimissionTime": null,
                        "factoryId": 102,
                        "head": 0,
                        "jobName": "MES开发",
                        "keyValue": 541,
                        "ldapName": "cdl",
                        "mail": null,
                        "mobile": null,
                        "pfDepartment": {
                            "appLink": null,
                            "createTime": "2022-08-31",
                            "deleted": false,
                            "deptCode": "001",
                            "deptId": 1,
                            "deptName": "MES开发部",
                            "deptType": 1,
                            "deptTypeTitle": "厂",
                            "keyValue": 1,
                            "memo": null,
                            "orders": "00",
                            "parentDeptId": null,
                            "parentPath": null,
                            "ucDeptId": null,
                            "updateTime": "2022-08-31 16:32:46"
                        },
                        "pinyinIndex": "CUIDIANLONG,CDL",
                        "ucUserId": null,
                        "updateTime": "2023-05-04 09:16:54",
                        "userCode": "cdl",
                        "userId": 541,
                        "userName": "崔殿龙",
                        "userSex": 1,
                        "userSources": "崔殿龙",
                        "userString": "541:A:崔殿龙",
                        "userType": "A"
                    },
                    "createTime": "2023-12-07 20:23:57",
                    "keyValue": 3,
                    "maxLevel": null,
                    "militaryProducts": 2,
                    "minLevel": null,
                    "settlementUnit": null,
                    "settlementUnitTitle": null,
                    "twlId": 3,
                    "twlOther": null,
                    "twlType": 1,
                    "twlTypeTitle": "工序",
                    "twlUnit": 2,
                    "twlUnitTitle": "批",
                    "workerPrice": 22.0,
                    "xplSettlement": null
                },
                {
                    "bsProcedureSet": {
                        "assist": false,
                        "assistTitle": "否",
                        "createMan": {
                            "accountId": null,
                            "card": null,
                            "createTime": "2022-08-31",
                            "curStatus": 1,
                            "deleted": false,
                            "deptName": null,
                            "dimissionTime": null,
                            "factoryId": 41,
                            "head": 0,
                            "jobName": "总工",
                            "keyValue": 1,
                            "ldapName": "admin",
                            "mail": "13699999999@136.com",
                            "mobile": "13699999999",
                            "pfDepartment": {
                                "appLink": null,
                                "createTime": "2022-08-31",
                                "deleted": false,
                                "deptCode": "001",
                                "deptId": 1,
                                "deptName": "MES开发部",
                                "deptType": 1,
                                "deptTypeTitle": "厂",
                                "keyValue": 1,
                                "memo": null,
                                "orders": "00",
                                "parentDeptId": null,
                                "parentPath": null,
                                "ucDeptId": null,
                                "updateTime": "2022-08-31 16:32:46"
                            },
                            "pinyinIndex": "ADMIN,ADMIN",
                            "ucUserId": null,
                            "updateTime": "2022-08-31 16:32:46",
                            "userCode": "00",
                            "userId": 1,
                            "userName": "admin",
                            "userSex": 1,
                            "userSources": "admin",
                            "userString": "1:A:admin",
                            "userType": "A"
                        },
                        "createTime": "2022-11-15 10:30:29",
                        "cycle": 0.0,
                        "cyropactorControl": false,
                        "deleted": false,
                        "eleRate": true,
                        "eleStream": true,
                        "keyValue": 6,
                        "mainProcess": true,
                        "mainProcessTitle": "是",
                        "niValue": false,
                        "phValue": false,
                        "ppsCode": "002",
                        "ppsId": 6,
                        "ppsName": "上挂",
                        "special": false,
                        "specialTitle": "否",
                        "team": null,
                        "updateTime": "2022-11-15 10:30:29",
                        "vSpeed": false
                    },
                    "countUnit": null,
                    "countUnitTitle": null,
                    "createMan": {
                        "accountId": 541,
                        "card": null,
                        "createTime": "2023-05-04",
                        "curStatus": 1,
                        "deleted": false,
                        "deptName": null,
                        "dimissionTime": null,
                        "factoryId": 102,
                        "head": 0,
                        "jobName": "MES开发",
                        "keyValue": 541,
                        "ldapName": "cdl",
                        "mail": null,
                        "mobile": null,
                        "pfDepartment": {
                            "appLink": null,
                            "createTime": "2022-08-31",
                            "deleted": false,
                            "deptCode": "001",
                            "deptId": 1,
                            "deptName": "MES开发部",
                            "deptType": 1,
                            "deptTypeTitle": "厂",
                            "keyValue": 1,
                            "memo": null,
                            "orders": "00",
                            "parentDeptId": null,
                            "parentPath": null,
                            "ucDeptId": null,
                            "updateTime": "2022-08-31 16:32:46"
                        },
                        "pinyinIndex": "CUIDIANLONG,CDL",
                        "ucUserId": null,
                        "updateTime": "2023-05-04 09:16:54",
                        "userCode": "cdl",
                        "userId": 541,
                        "userName": "崔殿龙",
                        "userSex": 1,
                        "userSources": "崔殿龙",
                        "userString": "541:A:崔殿龙",
                        "userType": "A"
                    },
                    "createTime": "2023-12-07 20:23:57",
                    "keyValue": 3,
                    "maxLevel": null,
                    "militaryProducts": 3,
                    "minLevel": null,
                    "settlementUnit": null,
                    "settlementUnitTitle": null,
                    "twlId": 4,
                    "twlOther": null,
                    "twlType": 1,
                    "twlTypeTitle": "工序",
                    "twlUnit": 2,
                    "twlUnitTitle": "批",
                    "workerPrice": 22.0,
                    "xplSettlement": null
                }
            ]
            this.page.total = this.data.length
        }
    }
}
</script>

<style></style>