78 lines
2.9 KiB
Vue
78 lines
2.9 KiB
Vue
<template>
|
||
<view class="page edge">
|
||
<fy-header title="工作通知" back />
|
||
<fy-scroll class="edge-scroll" @refresh="load">
|
||
<view class="bar">
|
||
<text>审批 · 协同 · 投标 · 用章 · 公告</text>
|
||
<text class="count">{{ items.length }} 项待办</text>
|
||
</view>
|
||
<wd-status-tip v-if="!items.length" image="content" tip="暂无待办通知" />
|
||
<view v-for="t in items" :key="t.no || t.id" class="card item" @click="open(t)">
|
||
<view class="main">
|
||
<text class="type">{{ t.typeLabel || t.tag || t.type || '待办' }}</text>
|
||
<text class="title">{{ t.title || t.summary || t.no }}</text>
|
||
<text class="sub">{{ metaOf(t) }}</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, fmtTime } from '../../utils/format.js'
|
||
import { oaGet } from '../../utils/api.js'
|
||
|
||
export default {
|
||
components: { FyHeader, FyScroll },
|
||
data() {
|
||
return { items: [] }
|
||
},
|
||
onShow() {
|
||
this.load()
|
||
},
|
||
methods: {
|
||
async load() {
|
||
try {
|
||
const page = await oaGet('/workflow/requests?tab=pending&page=1&size=50', store.token)
|
||
this.items = asList(page && page.records ? page.records : page).map((t) => ({
|
||
...t,
|
||
createdAt: fmtTime(t.createdAt || t.time)
|
||
}))
|
||
} catch (_) {
|
||
this.items = store.todos || []
|
||
}
|
||
const conv = store.conversations.find((c) => c.type === 'work')
|
||
if (conv) conv.unread = 0
|
||
},
|
||
metaOf(t) {
|
||
const who = [t.submitter || t.applicant, t.dept].filter(Boolean).join(' · ')
|
||
const time = t.createdAt || t.time || ''
|
||
return [who, time].filter(Boolean).join(' · ')
|
||
},
|
||
open(t) {
|
||
const no = t.no || t.id || ''
|
||
if (String(t.source || t.type || '') === 'work' || t.taskId) {
|
||
uni.navigateTo({ url: '/pages/coop/detail?id=' + encodeURIComponent(t.taskId || t.id || no) })
|
||
return
|
||
}
|
||
uni.navigateTo({ url: '/pages/todo/detail?no=' + encodeURIComponent(no) })
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.bar { margin: 16rpx 24rpx 8rpx; padding: 0 8rpx; display: flex; justify-content: space-between; align-items: center; font-size: 22rpx; color: #6B7280; }
|
||
.count { color: #1677FF; font-weight: 600; }
|
||
.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; }
|
||
.title { display: block; margin-top: 10rpx; font-size: 28rpx; font-weight: 650; color: #111827; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||
.sub { display: block; margin-top: 6rpx; font-size: 24rpx; color: #6B7280; }
|
||
.arr { color: #C4C9D4; font-size: 32rpx; margin-left: 8rpx; }
|
||
</style>
|