<template>
    <global-page
        ref="paging"
        :api="getPaDataList2Api"
        :padding="24"
        :params="searchData"
        auto
        isDataList
        loadingMoreEnabled
        navRightIcon="saixuan-01"
        navRightType="icon"
        refresherEnabled
        showNavRight
        title="工程分析"
        @handleRightClick="handleRightClick"
    >
        <template #default="{ item }">
            <view class="item" @tap="goDetails(item)">
                <view class="item-title">
                    <view class="left">
                        <custom-state :value="useGetDictByValue('ee_isOpen', item.isOpen)"></custom-state>
                    </view>
                    <view class="right">
                        <text class="txt u-line-1" v-if="item.ac">{{ item.ac }}</text>
                        <text class="txt u-line-1" v-if="item.acType">{{ item.acType }}</text>
                        <text class="txt u-line-1" v-if="item.acOwn">{{ item.acOwn }}</text>
                        <text class="txt u-line-1" v-if="item.acTerminal">{{ item.acTerminal }}</text>
                    </view>
                </view>
                <view class="item-content u-line-3">
                    {{ item.eventMsg || '无' }}
                </view>
            </view>
        </template>
    </global-page>
</template>

<script setup>
import { storeToRefs } from 'pinia'
import { useGetDictByValue } from 'mocp/hooks/use-dict/useDict'
import { onUnload } from '@dcloudio/uni-app'
import { ref } from 'vue'
import { getPaDataList2Api } from 'mocp/api/engineeringEvaluation'
import useEngineeringEvaluationStore from 'mocp/store/engineeringEvaluation'

//跳转
const goDetails = (data) => {
    uni.$mocpJump.navigateTo('/panel/engineeringEvaluation/details', {
        workbenchId: data.workbenchId
    })
}
//加载下拉框数据
const engineeringEvaluationStore = useEngineeringEvaluationStore()
const { searchData } = storeToRefs(engineeringEvaluationStore)
//筛选
const handleRightClick = () => {
    uni.$mocpJump.navigateTo('/panel/engineeringEvaluation/search')
}
const paging = ref()
uni.$on('engineeringEvaluationReload', () => {
    paging.value?.reload()
})
onUnload(() => {
    uni.$off('engineeringEvaluationReload')
})
</script>
<style lang="scss" scoped>
@import 'mocpStatic/css/list.scss';
</style>
