<template>

</template>



<script>
import {selectActSuppliesHistorydata ,addActSuppliesSixMinesSummaryTable} from "@/api/Actsupplies/cleaning_rule";
import LuckyExcel from 'luckyexcel'
export default {
    name: "cleaningRule",
    components: {
    },
    data() {
        return {
            // 表单参数
            from: {
                hId : "",
                projectId : "",
                projectName : "",
                departmentName : "",
                number  : "",
                nuitPrice : "",
                money : "",
                createBy  : ""

            },
        };
    },
    created() {
        this.getList();
    },
    methods: {
        /** 查询规则详情列表 */

        getList() {
            let timer = setTimeout(() => {
                //需要定时执行的代码
                getList();
            }, 2000)
            selectActSuppliesHistorydata().then(response => {

                var  data = response.data;

                for (let i = 0; i < data.length; i++) {
                    if(data[i].identifyingCode == 1){
                        /*生成表*/
                        let jsonDataa = JSON.parse(data[i].historyContent);
                        for (let j = 0; j < jsonDataa.length; j++) {
                            let  dataa=window.luckysheet.transToData(jsonDataa[j].celldata);
                            for (let k = 2; k < dataa.length; k++) {
                                if(dataa[k][1] == null){
                                    break;
                                }
                                let a0;
                                let a1;
                                let a3;
                                let a4;
                                let a5;
                                let a6;

                                if(dataa[k][0] != null){
                                     a0= dataa[k][0].v;
                                    if(a0 == undefined){
                                        a0="";
                                    }
                                }

                                if(dataa[k][1] != null){
                                    a1= dataa[k][1].v;
                                    if(a1 == undefined){
                                        a1="";
                                    }
                                }

                                if(dataa[k][3] != null){
                                    a3= dataa[k][3].v;
                                    if(a3 == undefined){
                                        a3="";
                                    }
                                }

                                if(dataa[k][4] != null){
                                    a4= dataa[k][4].v;
                                    if(a4 == undefined){
                                        a4="";
                                    }
                                }

                                if(dataa[k][5] != null){
                                    a5= dataa[k][5].v;
                                    if(a5 == undefined){
                                        a5="";
                                    }
                                }

                                if(dataa[k][6] != null){
                                    a6= dataa[k][6].v;
                                    if(a6 == undefined){
                                        a6="";
                                    }
                                }

                                if(data[i].id != null){
                                       this.from.hId = data[i].id;
                                        this.from.projectId =a0;
                                        this.from.projectName =a1;
                                        this.from.departmentName =a3;
                                        this.from.number =a4;
                                        this.from.nuitPrice =a5;
                                        this.from.money =a6;
                                        this.from.createBy = data[i].createBy;
                                    addActSuppliesSixMinesSummaryTable(this.from).then(response => {});
                                }



                            }
                        }
                    }else {
                        /*导入表*/
                        /*let jsonDatab = JSON.parse(data[i].historyContent);
                        for (let j = 0; j < jsonDatab.length; j++) {
                            let  datab=window.luckysheet.transToData(jsonDatab[j].celldata);
                        }*/
                    }


                }

            });
        },
    }
};
</script>
