80 lines
2.8 KiB
Vue
80 lines
2.8 KiB
Vue
<template>
|
|
<view class="page">
|
|
<fy-header title="工作通知" back />
|
|
<view class="bar">
|
|
<text>审批 · 协同 · 投标 · 用章 · 公告</text>
|
|
<text class="badge">{{ items.length }} 项待办</text>
|
|
</view>
|
|
<view v-if="!items.length" class="empty">暂无待办通知</view>
|
|
<view v-for="t in items" :key="t.no || t.id" class="card item" @click="open(t)">
|
|
<view class="stripe" />
|
|
<view class="body">
|
|
<view class="top">
|
|
<text class="kind">{{ t.typeLabel || t.tag || t.type || '待办' }}</text>
|
|
<text class="time">{{ t.createdAt || t.time || '' }}</text>
|
|
</view>
|
|
<text class="title">{{ t.title || t.summary || t.no }}</text>
|
|
<text class="sub">{{ t.submitter || t.applicant || '' }}{{ t.dept ? ' · ' + t.dept : '' }}</text>
|
|
<view class="acts">
|
|
<text class="go">去办理</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import FyHeader from '../../components/fy-header.vue'
|
|
import { store } from '../../utils/store.js'
|
|
import { asList, fmtTime } from '../../utils/format.js'
|
|
import { oaGet } from '../../utils/api.js'
|
|
|
|
export default {
|
|
components: { FyHeader },
|
|
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
|
|
},
|
|
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; background: #f2f3ff; border-radius: 16rpx; padding: 16rpx 20rpx; display: flex; justify-content: space-between; font-size: 22rpx; color: #434655; }
|
|
.item { margin: 0 24rpx 20rpx; display: flex; overflow: hidden; }
|
|
.stripe { width: 8rpx; background: #2563eb; }
|
|
.body { flex: 1; padding: 24rpx; }
|
|
.top { display: flex; justify-content: space-between; }
|
|
.kind { font-size: 28rpx; font-weight: 700; }
|
|
.time { font-size: 22rpx; color: #737686; }
|
|
.title { display: block; font-size: 28rpx; font-weight: 600; margin: 12rpx 0 6rpx; }
|
|
.sub { font-size: 22rpx; color: #737686; }
|
|
.acts { margin-top: 16rpx; }
|
|
.go { color: #2563eb; font-size: 24rpx; font-weight: 600; }
|
|
.empty { text-align: center; color: #737686; padding: 80rpx; }
|
|
</style>
|