<template>
    <up-collapse-item title="布置工作（2）">
        <global-page
            :fixed="false"
            :height="height"
            :showNavbar="false"
            :custom="false"
            isDataList
            refresherEnabled
            loadingMoreEnabled
            :api="getArrangeWorkListApi"
            auto
        >
            <template #="{ dataList }">
                <view class="item" v-for="item in dataList" :key="item.id" @tap="goDetails(item)">
                    <view class="item-title">
                        <view class="left">
                            <custom-state :value="item.state == 1 ? 'OPEN' : 'CLOSE'"></custom-state>
                            <view class="txt u-line-1">{{ item.seat }}</view>
                        </view>
                        <view class="right u-line-1">{{ getParamNameByValue('LayoutWorkType', item.workType) }}</view>
                    </view>
                    <view class="item-content u-line-3">
                        {{ item.taskDescribe }}
                    </view>
                    <view class="item-footer">
                        <view class="label">
                            <global-icon icon="calendar"></global-icon>
                            <text class="txt">
                                {{ timeStampFormat(item.startTime, { format: 'YYYY/MM/DD' }) }}
                                -
                                {{ timeStampFormat(item.feedbackTime, { format: 'YYYY/MM/DD' }) }}
                            </text>
                        </view>
                        <view class="label">
                            <global-icon icon="idcard"></global-icon>
                            <text class="txt">提出人:{{ item.presenter || '-' }}</text>
                        </view>
                    </view>
                </view>
            </template>
        </global-page>
    </up-collapse-item>
</template>

<script setup>
import { timeStampFormat } from 'mocp/utils/tool'
import { getArrangeWorkListApi } from 'mocp/api/assign-work'
import { getParamNameByValue } from 'mocp/hooks/use-params/useParams'

const ps = defineProps({
    height: {
        type: String,
        default: ''
    }
})

const goDetails = (data) => {
    uni.$mocpJump.navigateTo('/panel/assign-work/details', { id: data.id })
}
</script>
<style lang="scss" scoped></style>
