<template>
    <view>
        <view v-if="tableData.length != 0">
            <view style="height: 250px; ">
                <qiun-data-charts :chartData="chartData.chartData" :echartsApp="true" :eopts="chartData.eopts" />
            </view>
            <view style="margin-top: 20px;">
                <Table :tableData="tableData" />
            </view>
        </view>
        <view
            style="height:calc(100vh - 160px);display: flex;align-items: center;justify-content: center;background-color: #fff;margin-top:10px"
            v-else>
            <image src="../../../../static/empty.png" mode=""></image>
        </view>
    </view>


</template>
<script>
    import drpOptions from "./chartOptions.js"
    import Table from "./jcsjTable.vue"
    export default {
        components: {
            Table
        },
        data() {
            return {
                show: false,
                chartData: {},
                tableData: []
            }
        },
        methods: {
            async getKrData() {
                try {
                    const {
                        data
                    } = await uni.$http.post(
                        "/gunshiApp/tsg/stZvarlB/list", {
                            stcd: "716164061"
                        })
                    if (data.code == 200) {
                        this.tableData = [...data.data];
                    }
                } catch (error) {
                    uni.$showMsg();
                }
            }
        },
        watch: {
            tableData(n, o) {
                if (n.length > 0) {
                    this.chartData = {
                        ...drpOptions(n)
                    }
                    this.show = true
                }
            }
        },
        mounted() {
            this.getKrData()
        },
    }
</script>
<style lang="scss">

</style>