This commit is contained in:
zlwu committed 2026-07-16 11:45:34 +08:00
1 parent f6efca8fdf
commit 93a83d260f
45 files changed
+1211 -393

No files matched your search

+45 -3
View File
@@ -64,12 +64,20 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" min-width="260" fixed="right" align="center">
<el-table-column label="操作" min-width="300" fixed="right" align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="openDetail(row)">
<el-icon><View /></el-icon>
查看
</el-button>
<el-button
class="btn-op-item"
:loading="printingId === (row.instanceId || row.id)"
@click="printRow(row)"
>
<el-icon><Printer /></el-icon>
打印
</el-button>
</template>
</el-table-column>
</el-table>
@@ -81,15 +89,27 @@
<script setup lang="ts">
import { onActivated, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { View } from '@element-plus/icons-vue'
import { fetchOaTasks } from '@/api/oaApproval'
import { ElMessage } from 'element-plus'
import { Printer, View } from '@element-plus/icons-vue'
import { fetchOaInstanceDetail, fetchOaTasks } from '@/api/oaApproval'
import { useUserStore } from '@/store/modules/user'
import { exportOaApprovalPdf } from '@/utils/oa-approval-print'
defineOptions({ name: 'OaApprovalCc' })
const router = useRouter()
const userStore = useUserStore()
const loading = ref(false)
const printingId = ref('')
const rows = ref<any[]>([])
function currentPrinterName() {
const info: any = userStore.info || userStore.getUserInfo || {}
return String(
info.realName || info.nickName || info.userName || info.username || ''
).trim()
}
function statusType(s: string) {
if (s === 'pending' || s === 'running') return 'warning'
if (s === 'approved' || s === 'completed' || s === 'done') return 'success'
@@ -118,6 +138,28 @@
router.push({ path: `/system-manage/oa-approval/instances/${id}` })
}
async function printRow(row: any) {
const id = String(row?.instanceId || row?.id || '').trim()
if (!id || printingId.value) return
printingId.value = id
let detail: any
try {
detail = await fetchOaInstanceDetail(id)
} catch {
printingId.value = ''
ElMessage.error('加载审批单失败')
return
}
try {
await exportOaApprovalPdf(detail, { printerName: currentPrinterName() })
ElMessage.success('PDF 已下载')
} catch {
ElMessage.error('导出 PDF 失败')
} finally {
printingId.value = ''
}
}
async function load() {
loading.value = true
try {
+45 -3
View File
@@ -64,12 +64,20 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" min-width="260" fixed="right" align="center">
<el-table-column label="操作" min-width="340" fixed="right" align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="openDetail(row)">
<el-icon><View /></el-icon>
查看
</el-button>
<el-button
class="btn-op-item"
:loading="printingId === row.id"
@click="printRow(row)"
>
<el-icon><Printer /></el-icon>
打印
</el-button>
<el-button
v-if="
row.appId &&
@@ -92,15 +100,27 @@
<script setup lang="ts">
import { onActivated, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { RefreshRight, View } from '@element-plus/icons-vue'
import { fetchOaTasks } from '@/api/oaApproval'
import { ElMessage } from 'element-plus'
import { Printer, RefreshRight, View } from '@element-plus/icons-vue'
import { fetchOaInstanceDetail, fetchOaTasks } from '@/api/oaApproval'
import { useUserStore } from '@/store/modules/user'
import { exportOaApprovalPdf } from '@/utils/oa-approval-print'
defineOptions({ name: 'OaApprovalMine' })
const router = useRouter()
const userStore = useUserStore()
const loading = ref(false)
const printingId = ref('')
const rows = ref<any[]>([])
function currentPrinterName() {
const info: any = userStore.info || userStore.getUserInfo || {}
return String(
info.realName || info.nickName || info.userName || info.username || ''
).trim()
}
function statusType(s: string) {
if (s === 'pending' || s === 'running') return 'warning'
if (s === 'approved' || s === 'completed' || s === 'done') return 'success'
@@ -137,6 +157,28 @@
})
}
async function printRow(row: any) {
const id = String(row?.id || '').trim()
if (!id || printingId.value) return
printingId.value = id
let detail: any
try {
detail = await fetchOaInstanceDetail(id)
} catch {
printingId.value = ''
ElMessage.error('加载审批单失败')
return
}
try {
await exportOaApprovalPdf(detail, { printerName: currentPrinterName() })
ElMessage.success('PDF 已下载')
} catch {
ElMessage.error('导出 PDF 失败')
} finally {
printingId.value = ''
}
}
async function load() {
loading.value = true
try {