Files
oa_app/pages/coop/list.vue
T
2026-09-24 14:31:24 +08:00

79 lines
2.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="page edge">
<fy-header title="工作协同" back>
<template #right>
<text v-if="canCreate" class="add" @click="create">+ 新建</text>
</template>
</fy-header>
<fy-scroll class="edge-scroll" @refresh="load">
<view class="sec">待我办理</view>
<wd-status-tip v-if="!pending.length" image="content" tip="暂无待办" />
<view v-for="t in pending" :key="t.id" class="card item" @click="open(t)">
<view class="main">
<text class="type">待办理</text>
<text class="t">{{ t.title }}</text>
<text class="s">{{ lineOf(t.assignerName, t.dueAt) }}</text>
</view>
<text class="arr">›</text>
</view>
<view class="sec">我发起的</view>
<wd-status-tip v-if="!mine.length" image="content" tip="暂无发起" />
<view v-for="t in mine" :key="'m' + t.id" class="card item" @click="open(t)">
<view class="main">
<text class="type">协同</text>
<text class="t">{{ t.title }}</text>
<text class="s">{{ lineOf(t.assigneeName, t.status) }}</text>
</view>
<text class="arr">›</text>
</view>
</fy-scroll>
</view>
</template>
<script>
import FyHeader from '../../components/fy-header.vue'
import FyScroll from '../../components/fy-scroll.vue'
import { store } from '../../utils/store.js'
import { asList } from '../../utils/format.js'
import { oaGet } from '../../utils/api.js'
export default {
components: { FyHeader, FyScroll },
data() {
return { pending: [], mine: [] }
},
computed: {
canCreate() { return store.can('personal', 'view') }
},
onShow() { this.load() },
methods: {
async load() {
try {
this.pending = asList(await oaGet('/work-tasks?tab=pending', store.token))
this.mine = asList(await oaGet('/work-tasks?tab=review', store.token))
} catch (_) {}
},
lineOf(a, b) {
return [a, b].filter(Boolean).join(' · ')
},
open(t) {
uni.navigateTo({ url: '/pages/coop/detail?id=' + encodeURIComponent(t.id) })
},
create() {
uni.navigateTo({ url: '/pages/coop/create' })
}
}
}
</script>
<style scoped>
.sec { padding: 24rpx 32rpx 4rpx; font-size: 26rpx; font-weight: 650; color: #6B7280; }
.item { margin: 16rpx 24rpx; padding: 24rpx; display: flex; align-items: center; }
.main { flex: 1; min-width: 0; }
.type { display: inline-block; font-size: 22rpx; color: #1677FF; background: #E8F1FF; border-radius: 8rpx; padding: 2rpx 10rpx; }
.t { display: block; margin-top: 10rpx; font-size: 28rpx; font-weight: 650; color: #111827; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s { display: block; margin-top: 6rpx; font-size: 24rpx; color: #6B7280; }
.arr { color: #C4C9D4; font-size: 32rpx; margin-left: 8rpx; }
.add { color: #1677FF; font-size: 26rpx; font-weight: 650; padding: 8rpx; }
</style>