70 lines
2.2 KiB
Vue
70 lines
2.2 KiB
Vue
<template>
|
||
<view class="page">
|
||
<fy-header title="工作协同" back>
|
||
<template #right>
|
||
<text v-if="canCreate" class="add" @click="create">+ 新建</text>
|
||
</template>
|
||
</fy-header>
|
||
<view class="sec">待我办理</view>
|
||
<view v-if="!pending.length" class="empty">暂无</view>
|
||
<view v-for="t in pending" :key="t.id" class="card item" @click="open(t)">
|
||
<view class="stripe" />
|
||
<view class="body">
|
||
<text class="t">{{ t.title }}</text>
|
||
<text class="s">{{ t.assignerName || '' }} · {{ t.dueAt || '' }}</text>
|
||
</view>
|
||
</view>
|
||
<view class="sec">我发起的</view>
|
||
<view v-for="t in mine" :key="'m' + t.id" class="card item" @click="open(t)">
|
||
<view class="body wide">
|
||
<text class="t">{{ t.title }}</text>
|
||
<text class="s">{{ t.assigneeName || '' }} · {{ t.status || '' }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import FyHeader from '../../components/fy-header.vue'
|
||
import { store } from '../../utils/store.js'
|
||
import { asList } from '../../utils/format.js'
|
||
import { oaGet } from '../../utils/api.js'
|
||
|
||
export default {
|
||
components: { FyHeader },
|
||
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 (_) {}
|
||
},
|
||
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 24rpx 8rpx; font-size: 28rpx; font-weight: 700; }
|
||
.item { margin: 12rpx 24rpx; display: flex; overflow: hidden; }
|
||
.stripe { width: 8rpx; background: #2563eb; }
|
||
.body { flex: 1; padding: 24rpx; }
|
||
.body.wide { padding: 24rpx; }
|
||
.t { display: block; font-size: 28rpx; font-weight: 600; }
|
||
.s { font-size: 22rpx; color: #737686; }
|
||
.empty { padding: 24rpx; text-align: center; color: #737686; }
|
||
.add { color: #2563eb; font-size: 26rpx; font-weight: 700; padding: 8rpx; }
|
||
</style>
|