feat(oa): add mobile approval PDF print for mine and cc
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
915253eefb
commit
cbef68199b
7 files changed
+889
-9
No files matched your search
@@ -238,7 +238,8 @@
|
||||
key: 'read',
|
||||
label: '已读',
|
||||
disabled: !!(row && row.isRead)
|
||||
}
|
||||
},
|
||||
{ key: 'print', label: '打印' }
|
||||
]
|
||||
},
|
||||
isSelected(id) {
|
||||
@@ -307,6 +308,7 @@
|
||||
if (!act || !row) return
|
||||
if (act.key === 'view') this.openView(row)
|
||||
else if (act.key === 'read') this.markOneRead(row)
|
||||
else if (act.key === 'print') this.openView(row, { autoPrint: true })
|
||||
},
|
||||
async markOneRead(row) {
|
||||
if (!row || row.isRead || this.markingId) return
|
||||
@@ -350,7 +352,7 @@
|
||||
this.batchMarking = false
|
||||
}
|
||||
},
|
||||
async openView(row) {
|
||||
async openView(row, opts) {
|
||||
if (!row || this.openingId) return
|
||||
const instanceId = String(row.instanceId || '').trim()
|
||||
const taskId = String(row.id || '').trim()
|
||||
@@ -358,6 +360,7 @@
|
||||
uni.showToast({ title: '缺少实例 ID', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const autoPrint = !!(opts && opts.autoPrint)
|
||||
this.openingId = taskId || instanceId
|
||||
try {
|
||||
if (taskId && !row.isRead) {
|
||||
@@ -376,7 +379,8 @@
|
||||
url:
|
||||
'/pages/oa/webview/index?instanceId=' +
|
||||
encodeURIComponent(instanceId) +
|
||||
'&mode=view'
|
||||
'&mode=view' +
|
||||
(autoPrint ? '&autoPrint=1' : '')
|
||||
})
|
||||
} finally {
|
||||
this.openingId = ''
|
||||
|
||||
@@ -143,7 +143,10 @@
|
||||
]
|
||||
},
|
||||
rowActions(row) {
|
||||
const actions = [{ key: 'view', label: '查看', primary: true }]
|
||||
const actions = [
|
||||
{ key: 'view', label: '查看', primary: true },
|
||||
{ key: 'print', label: '打印' }
|
||||
]
|
||||
const status = String((row && (row.instanceStatus || row.status)) || '')
|
||||
const appId = String((row && row.appId) || '').trim()
|
||||
if (COPY_RESTART_STATUSES.includes(status) && appId) {
|
||||
@@ -181,9 +184,13 @@
|
||||
this.openCopyRestart(row)
|
||||
return
|
||||
}
|
||||
if (act.key === 'print') {
|
||||
this.openView(row, { autoPrint: true })
|
||||
return
|
||||
}
|
||||
this.openView(row)
|
||||
},
|
||||
openView(row) {
|
||||
openView(row, opts) {
|
||||
if (!row) return
|
||||
// mine 行是实例:Web 用 row.id;兼容 instanceId
|
||||
const instanceId = String(row.instanceId || row.id || '').trim()
|
||||
@@ -191,12 +198,14 @@
|
||||
uni.showToast({ title: '缺少实例 ID', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const autoPrint = !!(opts && opts.autoPrint)
|
||||
stashOaDetailTitle(row.appName || row.title)
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pages/oa/webview/index?instanceId=' +
|
||||
encodeURIComponent(instanceId) +
|
||||
'&mode=view'
|
||||
'&mode=view' +
|
||||
(autoPrint ? '&autoPrint=1' : '')
|
||||
})
|
||||
},
|
||||
openCopyRestart(row) {
|
||||
|
||||
@@ -37,6 +37,7 @@ export default {
|
||||
const instanceId = String((query && query.instanceId) || '')
|
||||
const taskId = String((query && query.taskId) || '')
|
||||
const mode = String((query && query.mode) || '') || 'view'
|
||||
const autoPrint = String((query && query.autoPrint) || '') === '1'
|
||||
const appId = String((query && query.appId) || '')
|
||||
const draftId = String((query && query.draftId) || '')
|
||||
const fromInstanceId = String((query && query.fromInstanceId) || '')
|
||||
@@ -48,7 +49,7 @@ export default {
|
||||
if (cachedName) {
|
||||
uni.setNavigationBarTitle({ title: cachedName })
|
||||
}
|
||||
src = buildOaDetailUrl({ instanceId, taskId, mode })
|
||||
src = buildOaDetailUrl({ instanceId, taskId, mode, autoPrint })
|
||||
} else if (draftId || appId || fromInstanceId) {
|
||||
const cachedName = takeOaStartTitle()
|
||||
if (cachedName) {
|
||||
|
||||
@@ -39,13 +39,14 @@ export function buildOaStartUrl({ appId, draftId, fromInstanceId } = {}) {
|
||||
return withQuery('/oa-start', params)
|
||||
}
|
||||
|
||||
/** 审批详情页 URL(须带 token;mode 为 view | approve) */
|
||||
export function buildOaDetailUrl({ instanceId, taskId, mode } = {}) {
|
||||
/** 审批详情页 URL(须带 token;mode 为 view | approve;autoPrint=1 加载后自动调打印) */
|
||||
export function buildOaDetailUrl({ instanceId, taskId, mode, autoPrint } = {}) {
|
||||
const token = getToken()
|
||||
const params = {}
|
||||
if (instanceId) params.instanceId = instanceId
|
||||
if (taskId) params.taskId = taskId
|
||||
if (mode) params.mode = mode // view | approve
|
||||
if (autoPrint) params.autoPrint = '1'
|
||||
if (token) params.token = token
|
||||
return withQuery('/oa-detail', params)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user