<template>
    <global-page
        ref="paging"
        :api="getRqmListApi"
        :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="desc">
                        <custom-state :value="item.status == 1 ? 'OPEN' : 'CLOSE'"></custom-state>
                        <view class="txt">{{ item.appraisee != '-1' ? item.appraisee : '' }}</view>
                        <view class="place">{{ item.department != '-1' ? item.department : '' }}</view>
                    </view>
                    <custom-score v-if="item.score != -1" :count="item.score" :type="item.eventType == 1 ? 'success' : 'warning'"></custom-score>
                </view>
                <view class="item-content u-line-3">
                    {{ item.eventMsg || '无' }}
                </view>
            </view>
        </template>
    </global-page>
</template>

<script setup>
import { ref } from 'vue'
import { getRqmListApi } from 'mocp/api/appraisal-record'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import useAppraisalRecordStore from 'mocp/store/appraisal-record'
import { storeToRefs } from 'pinia'

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