<template>
    <view class="content">
        <uni-list :border="false">
            <uni-list-item
                show-badge
                badgeType="error"
                isDot
                badge-text="未读"
                title="发生稳态越限监测点10个"
                note="2023-02-03"
                clickable
                @click="jump"
            />
            <uni-list-item
                show-badge
                badgeType="error"
                isDot
                badge-text="未读"
                title="发生稳态越限监测点10个"
                note="2023-02-02"
                clickable
                @click="jump"
            />
            <uni-list-item
                show-badge
                badgeType="error"
                isDot
                badge-text="未读"
                title="发生稳态越限监测点10个"
                note="2023-02-01"
                clickable
                @click="jump"
            />
            <uni-list-item
                badgeType="error"
                isDot
                badge-text="未读"
                title="发生稳态越限监测点10个"
                note="2023-01-31"
                clickable
                @click="jump"
            />
            <uni-list-item
                badgeType="error"
                isDot
                badge-text="未读"
                title="发生稳态越限监测点10个"
                note="2023-01-30"
                clickable
                @click="jump"
            />
        </uni-list>
        <uni-load-more status="nomore"></uni-load-more>
    </view>
</template>
<script>
import list from '@/common/js/list'

export default {
    mixins: [list],
    data() {
        return {
            loading: true,
        }
    },
    onShow() {
        this.init()
    },
    methods: {
        async init() {
            let dictData = await this.$util.getDictData('app_event')
            console.log(dictData)
            this.store = this.DataSource('/cs-harmonic-boot/event/queryEventList')
            this.store.params.type = 1
            this.store.firstCallBack = (res) => {
                this.store.data.forEach((item) => {
                    item.title = item.equipmentName + dictData.find((item2) => item2.code === item.tag).name
                })
                console.log(this.store.data)
                this.loading = false
            }
            this.store.reload()
        },
        jump(item) {
            let str = JSON.stringify(item).replace(/%/g, '百分比')
            uni.navigateTo({ url: '/pages/message/transientDetail?detail=' + encodeURIComponent(str) })
        },
    },
}
</script>

<style lang="scss">
.content {
    padding-top: 20rpx;
}

/deep/ .uni-list-item {
    background-color: $uni-theme-white !important;
}

/deep/ .uni-badge {
    background-color: unset !important;
    color: #dd524d !important;
    font-size: 28rpx !important;
}
</style>
