This commit is contained in:
hero920103 committed 2026-10-17 11:52:02 +08:00
1 parent 184d5b0403
commit a758966fae
18 files changed
+2002 -19

No files matched your search

+15
View File
@@ -253,6 +253,21 @@ export function resolveImageUrl(url) {
return `${getBaseURL().replace(/\/$/, '')}${value.startsWith('/') ? '' : '/'}${value}`
}
/** 查我的待审批任务(审批人视角):返回 {task_id,node_name},无待办返回 null */
export function fetchMyApproveTask(id) {
return request({ url: `/api/oa/expense/my-approve-task/${id}` })
}
/** 通过当前审批节点(body: {comment}),返回引擎提示(会签等待/流转/完成) */
export function approveExpense(id, comment = '') {
return request({ url: `/api/oa/expense/approve/${id}`, method: 'POST', data: { comment } })
}
/** 驳回报销单(body: {comment}) */
export function rejectExpense(id, comment = '') {
return request({ url: `/api/oa/expense/reject/${id}`, method: 'POST', data: { comment } })
}
/**
* 发票引用是否为 PDF 文件:PDF 不能用 image 组件渲染(会被 ORB 拦截不显示),
* 需要走 openDocument 打开。
+6 -1
View File
@@ -81,6 +81,11 @@
},
"vueVersion" : "3",
"h5" : {
"title" : "云泽系统"
"title" : "云泽系统",
"router" : {
"mode" : "hash",
"base" : "/h5/"
},
"publicPath" : "/h5/"
}
}
+83 -1
View File
@@ -97,7 +97,7 @@
</view>
</template>
<!-- 操作按钮(统一放详情页,仅草稿可操作) -->
<!-- 操作按钮(统一放详情页):草稿为创建人操作,审批中为待办审批人操作 -->
<view v-if="detail && isDraft" class="footer">
<view class="footer-btn">
<u-button type="error" plain icon="trash" text="删除" @click="onDelete" />
@@ -109,6 +109,20 @@
<u-button type="primary" icon="arrow-up" text="提交审批" @click="onSubmit" />
</view>
</view>
<view v-else-if="detail && myTask" class="footer footer-approve">
<view class="footer-tip">
<FaIcon name="circle-check" color="#10b981" :size="14" />
<text>我是当前节点「{{ myTask.node_name }}」审批人</text>
</view>
<view class="footer-row">
<view class="footer-btn">
<u-button type="error" plain icon="close-circle" text="驳回" @click="onReject" />
</view>
<view class="footer-btn">
<u-button type="primary" icon="checkmark" text="通过" @click="onApprove" />
</view>
</view>
</view>
</view>
</template>
@@ -120,6 +134,9 @@ import {
deleteExpense,
submitExpense,
fetchExpenseRecords,
fetchMyApproveTask,
approveExpense,
rejectExpense,
getExpenseStatusLabel,
getExpenseStatusType,
getExpenseActionLabel,
@@ -132,6 +149,7 @@ const expenseId = ref('')
const detail = ref(null)
const items = ref([])
const records = ref([])
const myTask = ref(null)
const loading = ref(false)
const isDraft = computed(() => Number(detail.value?.status) === EXPENSE_STATUS.DRAFT)
@@ -170,6 +188,14 @@ async function loadDetail() {
detail.value = data
items.value = data.items || []
records.value = await fetchExpenseRecords(expenseId.value)
// 审批人视角:审批中的单据查询自己是否有待办任务(非审批人静默返回 null)
try {
myTask.value = Number(data.status) === EXPENSE_STATUS.APPROVING
? await fetchMyApproveTask(expenseId.value)
: null
} catch (e) {
myTask.value = null
}
} catch (e) {
uni.showToast({ title: '加载失败', icon: 'none' })
} finally {
@@ -244,6 +270,43 @@ function onDelete() {
}
})
}
/** 通过当前审批节点:成功后按引擎提示刷新(会签等待/流转/完成) */
function onApprove() {
uni.showModal({
title: '通过审批',
content: `确认通过「${myTask.value?.node_name || '审批'}」节点吗?`,
success: async (res) => {
if (!res.confirm) return
try {
const result = await approveExpense(expenseId.value, '')
uni.showToast({ title: result?.message || '已通过', icon: 'none' })
loadDetail()
} catch (e) {
// request 封装已弹出服务端错误提示
}
}
})
}
/** 驳回报销单:填写审批意见(可空) */
function onReject() {
uni.showModal({
title: '驳回',
editable: true,
placeholderText: '请输入驳回原因(选填)',
success: async (res) => {
if (!res.confirm) return
try {
await rejectExpense(expenseId.value, (res.content || '').trim())
uni.showToast({ title: '已驳回', icon: 'none' })
loadDetail()
} catch (e) {
// request 封装已弹出服务端错误提示
}
}
})
}
</script>
<style lang="scss" scoped>
@@ -519,6 +582,25 @@ function onDelete() {
flex: 1;
}
.footer-approve {
flex-direction: column;
gap: 12rpx;
}
.footer-row {
display: flex;
gap: 16rpx;
}
.footer-tip {
display: flex;
align-items: center;
justify-content: center;
gap: 8rpx;
font-size: 24rpx;
color: $color-text-secondary;
}
.state-box {
display: flex;
justify-content: center;
+2 -1
View File
@@ -82,7 +82,8 @@ import {
const PAGE_SIZE = 20
const tabs = [{ value: '', label: '全部' }, ...EXPENSE_STATUS_OPTIONS]
// -1 为「待我审批」约定值(后端按当前用户运行中审批待办过滤)
const tabs = [{ value: -1, label: '待我审批' }, { value: '', label: '全部' }, ...EXPENSE_STATUS_OPTIONS]
const list = ref([])
const total = ref(0)
+1
View File
@@ -6,6 +6,7 @@ import { fileURLToPath } from 'node:url'
const rootDir = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig({
base: '/h5/',
plugins: [uni()],
resolve: {
alias: {