|
@@ -116,12 +116,28 @@
|
|
|
</el-tag>
|
|
</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" min-width="260" fixed="right" align="center">
|
|
|
|
|
|
|
+ <el-table-column label="操作" min-width="400" fixed="right" align="center">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
<el-button class="btn-op-item primary" @click="openDetail(row)">
|
|
<el-button class="btn-op-item primary" @click="openDetail(row)">
|
|
|
<el-icon><View /></el-icon>
|
|
<el-icon><View /></el-icon>
|
|
|
查看
|
|
查看
|
|
|
</el-button>
|
|
</el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ class="btn-op-item"
|
|
|
|
|
+ :loading="printingId === (row.instanceId || row.id)"
|
|
|
|
|
+ @click="printRow(row)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-icon><Printer /></el-icon>
|
|
|
|
|
+ 打印
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-if="canUploadBankReceipt"
|
|
|
|
|
+ class="btn-op-item"
|
|
|
|
|
+ @click="openBankReceipt(row)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-icon><Upload /></el-icon>
|
|
|
|
|
+ 上传回执
|
|
|
|
|
+ </el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
@@ -140,24 +156,48 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
+
|
|
|
|
|
+ <OaBankReceiptDialog
|
|
|
|
|
+ v-model="bankReceiptVisible"
|
|
|
|
|
+ :instance-id="bankReceiptInstanceId"
|
|
|
|
|
+ :meta="bankReceiptMeta"
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
- import { onActivated, onMounted, reactive, ref } from 'vue'
|
|
|
|
|
|
|
+ import { computed, onActivated, onMounted, reactive, ref } from 'vue'
|
|
|
import { useRouter } from 'vue-router'
|
|
import { useRouter } from 'vue-router'
|
|
|
- import { RefreshLeft, Search, View } from '@element-plus/icons-vue'
|
|
|
|
|
- import { fetchOaTasks } from '@/api/oaApproval'
|
|
|
|
|
|
|
+ import { ElMessage } from 'element-plus'
|
|
|
|
|
+ import { Printer, RefreshLeft, Search, Upload, View } from '@element-plus/icons-vue'
|
|
|
|
|
+ import { fetchOaInstanceDetail, fetchOaTasks } from '@/api/oaApproval'
|
|
|
|
|
+ import OaBankReceiptDialog from '@/components/oa-approval/OaBankReceiptDialog.vue'
|
|
|
|
|
+ import { useMenuPerm } from '@/hooks/core/useMenuPerm'
|
|
|
|
|
+ import { useUserStore } from '@/store/modules/user'
|
|
|
|
|
+ import { exportOaApprovalPdf } from '@/utils/oa-approval-print'
|
|
|
|
|
|
|
|
defineOptions({ name: 'OaApprovalDone' })
|
|
defineOptions({ name: 'OaApprovalDone' })
|
|
|
|
|
|
|
|
|
|
+ const OA_DONE_BANK_RECEIPT = 'oa:done:bank-receipt'
|
|
|
|
|
+ const { hasMenuPerm } = useMenuPerm()
|
|
|
|
|
+ const canUploadBankReceipt = computed(() => hasMenuPerm(OA_DONE_BANK_RECEIPT))
|
|
|
|
|
+
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
|
|
+ const userStore = useUserStore()
|
|
|
const loading = ref(false)
|
|
const loading = ref(false)
|
|
|
|
|
+ const printingId = ref('')
|
|
|
const rows = ref<any[]>([])
|
|
const rows = ref<any[]>([])
|
|
|
const page = ref(1)
|
|
const page = ref(1)
|
|
|
const pageSize = ref(20)
|
|
const pageSize = ref(20)
|
|
|
const total = ref(0)
|
|
const total = ref(0)
|
|
|
const applyTimeRange = ref<string[] | null>(null)
|
|
const applyTimeRange = ref<string[] | null>(null)
|
|
|
|
|
+ const bankReceiptVisible = ref(false)
|
|
|
|
|
+ const bankReceiptInstanceId = ref('')
|
|
|
|
|
+ const bankReceiptMeta = ref<{
|
|
|
|
|
+ appName?: string
|
|
|
|
|
+ initiatorUserName?: string
|
|
|
|
|
+ applyTime?: string
|
|
|
|
|
+ }>({})
|
|
|
const searchForm = reactive({
|
|
const searchForm = reactive({
|
|
|
appName: '',
|
|
appName: '',
|
|
|
initiatorName: '',
|
|
initiatorName: '',
|
|
@@ -168,6 +208,13 @@
|
|
|
return (page.value - 1) * pageSize.value + index + 1
|
|
return (page.value - 1) * pageSize.value + index + 1
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function currentPrinterName() {
|
|
|
|
|
+ const info: any = userStore.info || userStore.getUserInfo || {}
|
|
|
|
|
+ return String(
|
|
|
|
|
+ info.realName || info.nickName || info.userName || info.username || ''
|
|
|
|
|
+ ).trim()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function statusType(s: string) {
|
|
function statusType(s: string) {
|
|
|
if (s === 'pending' || s === 'running') return 'warning'
|
|
if (s === 'pending' || s === 'running') return 'warning'
|
|
|
if (s === 'approved' || s === 'completed' || s === 'done') return 'success'
|
|
if (s === 'approved' || s === 'completed' || s === 'done') return 'success'
|
|
@@ -197,6 +244,40 @@
|
|
|
router.push({ path: `/system-manage/oa-approval/instances/${id}` })
|
|
router.push({ path: `/system-manage/oa-approval/instances/${id}` })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function openBankReceipt(row: any) {
|
|
|
|
|
+ const id = String(row?.instanceId || row?.id || '').trim()
|
|
|
|
|
+ if (!id) return
|
|
|
|
|
+ bankReceiptInstanceId.value = id
|
|
|
|
|
+ bankReceiptMeta.value = {
|
|
|
|
|
+ appName: row.appName || row.title || '',
|
|
|
|
|
+ initiatorUserName: row.initiatorUserName || '',
|
|
|
|
|
+ applyTime: row.applyTime || ''
|
|
|
|
|
+ }
|
|
|
|
|
+ bankReceiptVisible.value = true
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ 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 = ''
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function buildFilterParams() {
|
|
function buildFilterParams() {
|
|
|
const range = applyTimeRange.value
|
|
const range = applyTimeRange.value
|
|
|
return {
|
|
return {
|