<template>
    <global-page
        ref="paging"
        :api="getTaDataList2Api"
        :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('os_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 { getTaDataList2Api } from 'mocp/api/technicalAnalysis'
import useTechnicalAnalysisStore from 'mocp/store/technicalAnalysis'

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