64 lines
1.9 KiB
Vue
64 lines
1.9 KiB
Vue
<template>
|
|
<view class="page">
|
|
<fy-header title="协同详情" back />
|
|
<view v-if="row" class="body">
|
|
<view class="card">
|
|
<text class="t">{{ row.title }}</text>
|
|
<text class="s">发起 {{ row.assignerName || '' }} · 办理 {{ row.assigneeName || '' }}</text>
|
|
<text class="s">{{ row.content || row.remark || '' }}</text>
|
|
<text class="chip">{{ row.status === 'done' ? '已办结' : '待办理' }}</text>
|
|
</view>
|
|
<view v-if="canDone" class="btn-primary" @click="done">标记已办理</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import FyHeader from '../../components/fy-header.vue'
|
|
import { store } from '../../utils/store.js'
|
|
import { oaGet, oaPost } from '../../utils/api.js'
|
|
import { toast } from '../../utils/format.js'
|
|
|
|
export default {
|
|
components: { FyHeader },
|
|
data() { return { id: '', row: null } },
|
|
computed: {
|
|
canDone() {
|
|
if (!this.row || this.row.status === 'done') return false
|
|
const me = store.me
|
|
return me && (String(this.row.assigneeId) === me.id || String(this.row.assignee) === me.username)
|
|
}
|
|
},
|
|
onLoad(q) {
|
|
this.id = decodeURIComponent(q.id || '')
|
|
this.load()
|
|
},
|
|
methods: {
|
|
async load() {
|
|
try {
|
|
this.row = await oaGet('/work-tasks/' + encodeURIComponent(this.id), store.token)
|
|
} catch (_) {
|
|
this.row = { id: this.id, title: '协同任务' }
|
|
}
|
|
},
|
|
async done() {
|
|
try {
|
|
await oaPost('/work-tasks/' + encodeURIComponent(this.id) + '/done', {}, store.token)
|
|
toast('已办结', 'success')
|
|
this.load()
|
|
} catch (e) {
|
|
toast(e.message || '操作失败')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.body { padding: 24rpx; }
|
|
.card { padding: 28rpx; margin-bottom: 24rpx; }
|
|
.t { display: block; font-size: 34rpx; font-weight: 700; }
|
|
.s { display: block; font-size: 24rpx; color: #737686; margin-top: 8rpx; }
|
|
.chip { display: inline-block; margin-top: 16rpx; }
|
|
</style>
|