<template>
    <div>
        <el-dialog :title="'上报历史'" width="90%" v-model="visible" @close="closed">
            <div class="treeBox2 ww100">
                <el-table ref="multipleTableRef" v-loading="loading" :row-key="keyid" :data="pageData.tableData" border
                    style="width: 100%" height="50vh">
                    <el-table-column label="企业名称" prop="baOrgName" fixed width="200" />
                    <el-table-column label="烟叶工作站数量(个)" prop="workstationQty" />
                    <el-table-column label="烟叶收购点数量(个)" prop="purQty" />
                    <el-table-column label="年收购量(公斤)" prop="purYearVolumeQty" />
                    <el-table-column align="center" label="主要设备">
                        <el-table-column prop="purBalerQty" label="打包机(台)" />
                        <el-table-column prop="purUnQty" label="装卸机(台)" />
                        <el-table-column prop="purPaAcquisitionQty" label="设置装卸防高坠措施收购点数量(个)" />
                    </el-table-column>
                    <el-table-column align="center" label="动力保障设备">
                        <el-table-column prop="hvdcQty" label="变配电-高压配电柜数量(台)" />
                        <el-table-column prop="transformerQty" label="变配电-变压器数量(台)" />
                        <el-table-column prop="alternatorqty" label="变配电-发电机数量(台)" />
                    </el-table-column>
                    <el-table-column prop="sbcs" label="上报次数" width="110" fixed="right" />
                    <el-table-column prop="gxTime" label="上报时间" width="150" fixed="right" />
                    <el-table-column align="center" label="操作" width="170" fixed="right">
                        <template #default="{ row }">
                            <el-link type="primary" @click="handleClickDetail(row)">详情</el-link>
                        </template>
                    </el-table-column>

                </el-table>
            </div>
        </el-dialog>
        <Dialog v-if="dialogVisibles" :title="'历史上报详情'" @close="dialogClose" :id="currId" />
    </div>
</template>
<script setup>
// 引入
import { ref, reactive, onMounted } from "vue";
import Dialog from './dialog.vue'
import { postApi, getApi } from "@/api/tobAcco_api.js";
const pageData = reactive({
    tableData: [],
    orgCodes: [],
    params: {},
    currItem: {}
});
const loading = ref(false);
const dialogVisibles = ref(false);
const multipleTableRef = ref(null);
const orgCode = ref(false)
const visible = ref(true)
const currId = ref(null)
const props = defineProps({
    chooseUserVisible: {
        type: Boolean,
        default: true,
    },
    orgId: {
        type: String,
        default: ''
    },
    currCode: {
        type: String,
        default: ''
    },
    year: {
        type: String,
        default: ''
    },
    isAuth: {
        type: Boolean,
    },
    params: {
        type: Object,
        default: () => { }
    },
    isReport: {
        type: Boolean,
    },
    currTotal: Number,
    ywId: String
});

// 详情
const handleClickDetail = (row) => {
    currId.value = row.sourceId
    dialogVisibles.value = true;
}
const emits = defineEmits(["close"]);
const closed = () => {
    emits("close");
};
onMounted(() => {
    orgCode.value = props.currCode
    getListData()
})
// 关闭弹窗
const dialogClose = val => {
    dialogVisibles.value = false
    if (val) {
        getListData();
    }
}
//获取列表
const getListData = (params = {}) => {
    params.cs = props.currTotal
    params.year = props.year
    params.orgcode = orgCode.value
    loading.value = true
    postApi(params, '/mosty-jcgl/data/leafPurLedger/getLsjlList').then(res => {
        if (res) {
            pageData.tableData = res
        }
    }).finally(() => {
        loading.value = false
    })
}

</script>

<style lang="scss" scoped>
@import "@/assets/css/layout.scss";
@import "@/assets/css/element-plus.scss";

::v-deep .el-form--inline {
    padding-left: 0 !important;
}

::v-deep .el-radio__label {
    display: none !important;
}

.table-box-radio .el-table1__header-wrapper .el-checkbox {
    display: none !important;
}

:v-deep .el-tree-node {
    .is-leaf+el-checkbox .el-checkbox__inner {
        display: inline-block;
    }
}

::v-deep .el-overlay-dialog {
    overflow: hidden !important;
}

:v-deep .el-checkbox .el-checkbox__inner {
    display: none;
}

:v-deep .wrap .el-checkbox__input.is-disabled {
    display: none;
}

.el-form {
    margin-top: 10px;
    display: flex;
    //   flex-wrap: wrap;
    justify-content: space-between;
}

.search {
    width: 300px;
    display: flex;
    position: absolute;
    right: 20px;
    top: 20px;
}

.el-form-item {
    text-align: center;
    width: 400px;
}

.flx {
    display: flex;
    width: 100%;

    .el-button {
        margin-left: 10px;
    }
}

.box {
    width: 100%;
    height: 516px;
    overflow-y: hidden;
    border: 1px solid var(--el-color-primary);
    display: flex;
    justify-content: space-between;
}

.treeBox2 {
    overflow: auto;
}

.cskbox {
    width: 40px;
    padding: 107px 0;
    margin-right: 20px;

    .el-icon {
        width: 4em !important;
        height: 6em !important;
    }

    .el-icon svg {
        width: 3em !important;
        height: 3em !important;
    }
}

.listbox {
    border: 1px solid var(--el-color-primary);
    width: 45%;
    overflow-y: scroll;

    ul>li {
        padding: 4px 10px;
        box-sizing: border-box;
    }

    .activ {
        background-color: var(--el-color-primary);
    }
}

.bot_font {
    width: 100%;
    text-align: center;
    font-size: 16px;
    color: #ffff;
    margin-top: 10px;
}

.fenye {
    margin-top: 10px;
}
</style>