feat: ship OA drafts/badges, role dual-track, and test-env deploy tooling.
Add approval instance drafts with menu badges, dual-track user/role read model and role bound names, form-designer outline docs, and bare-metal test deploy scripts. Ignore local test-server credential file. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
7af53fc344
commit
de22678c87
56 files changed
+11861
-6082
No files matched your search
@@ -0,0 +1,323 @@
|
||||
<!-- OA 草稿箱:发起审批暂存记录 -->
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">草稿箱</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form :model="searchForm" class="filter-form" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form-item label="流程名称">
|
||||
<el-input
|
||||
v-model="searchForm.keyword"
|
||||
placeholder="请输入流程名称"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="保存时间">
|
||||
<el-date-picker
|
||||
v-model="searchForm.updateRange"
|
||||
type="daterange"
|
||||
value-format="YYYY-MM-DD"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板分组">
|
||||
<el-select v-model="searchForm.groupId" placeholder="全部" clearable>
|
||||
<el-option
|
||||
v-for="g in groupOptions"
|
||||
:key="g.id"
|
||||
:label="g.groupName"
|
||||
:value="g.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="filter-actions-row">
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset">
|
||||
<el-icon><RefreshLeft /></el-icon>
|
||||
重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch">
|
||||
<el-icon><Search /></el-icon>
|
||||
搜索
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="!selectedRows.length"
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
批量删除
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="tableData"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="onSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
min-width="68"
|
||||
align="center"
|
||||
header-align="center"
|
||||
:index="indexMethod"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="appName"
|
||||
label="流程名称"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">{{ row.appName || row.title || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="versionNo"
|
||||
label="模板版本"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ row.versionNo != null ? `v${row.versionNo}` : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="updateTime"
|
||||
label="最近保存"
|
||||
min-width="170"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">{{ row.updateTime || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态" min-width="100" align="center">
|
||||
<template #default>
|
||||
<el-tag size="small" type="warning">草稿</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="320" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item primary" @click="openEdit(row)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item"
|
||||
:loading="submittingId === row.id"
|
||||
@click="handleSubmit(row)"
|
||||
>
|
||||
<el-icon><Promotion /></el-icon>
|
||||
提交审批
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="handleDelete(row)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="page"
|
||||
v-model:page-size="pageSize"
|
||||
:total="total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
background
|
||||
@size-change="loadList"
|
||||
@current-change="loadList"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onActivated, onMounted, reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { Delete, Edit, Promotion, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
fetchBatchDeleteOaInstanceDrafts,
|
||||
fetchDeleteOaInstanceDraft,
|
||||
fetchOaGroupList,
|
||||
fetchOaInstanceDraftList,
|
||||
fetchSubmitOaInstanceDraft
|
||||
} from '@/api/oaApproval'
|
||||
import { refreshOaMenuBadges } from '@/utils/oa-menu-badge'
|
||||
|
||||
defineOptions({ name: 'OaApprovalDrafts' })
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const tableData = ref<any[]>([])
|
||||
const selectedRows = ref<any[]>([])
|
||||
const groupOptions = ref<Array<{ id: string; groupName: string }>>([])
|
||||
const page = ref(1)
|
||||
const pageSize = ref(20)
|
||||
const total = ref(0)
|
||||
const submittingId = ref('')
|
||||
|
||||
const searchForm = reactive({
|
||||
keyword: '',
|
||||
groupId: '' as string,
|
||||
updateRange: null as string[] | null
|
||||
})
|
||||
|
||||
function indexMethod(index: number) {
|
||||
return (page.value - 1) * pageSize.value + index + 1
|
||||
}
|
||||
|
||||
function onSelectionChange(rows: any[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
async function loadGroups() {
|
||||
try {
|
||||
const res = await fetchOaGroupList()
|
||||
groupOptions.value = res?.list || []
|
||||
} catch {
|
||||
groupOptions.value = []
|
||||
}
|
||||
}
|
||||
|
||||
async function loadList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const range = searchForm.updateRange || []
|
||||
const res = await fetchOaInstanceDraftList({
|
||||
keyword: searchForm.keyword || undefined,
|
||||
groupId: searchForm.groupId || undefined,
|
||||
updateTimeFrom: range[0] || undefined,
|
||||
updateTimeTo: range[1] || undefined,
|
||||
page: page.value,
|
||||
pageSize: pageSize.value
|
||||
})
|
||||
tableData.value = res?.list || []
|
||||
total.value = res?.total || 0
|
||||
selectedRows.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
page.value = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
searchForm.keyword = ''
|
||||
searchForm.groupId = ''
|
||||
searchForm.updateRange = null
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
function openEdit(row: any) {
|
||||
if (!row?.id) return
|
||||
router.push({
|
||||
path: '/system-manage/oa-approval/start',
|
||||
query: { draftId: row.id }
|
||||
})
|
||||
}
|
||||
|
||||
async function handleSubmit(row: any) {
|
||||
if (!row?.id) return
|
||||
try {
|
||||
await ElMessageBox.confirm('确认提交该草稿并发起审批吗?', '提交审批', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '提交',
|
||||
cancelButtonText: '取消'
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
submittingId.value = row.id
|
||||
try {
|
||||
const data: any = await fetchSubmitOaInstanceDraft(row.id)
|
||||
await loadList()
|
||||
void refreshOaMenuBadges()
|
||||
if (data?.id) {
|
||||
router.push({ path: `/system-manage/oa-approval/instances/${data.id}` })
|
||||
}
|
||||
} catch {
|
||||
openEdit(row)
|
||||
} finally {
|
||||
submittingId.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row: any) {
|
||||
if (!row?.id) return
|
||||
try {
|
||||
await ElMessageBox.confirm('确认删除该草稿吗?删除后不可恢复。', '删除草稿', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '删除',
|
||||
cancelButtonText: '取消'
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
await fetchDeleteOaInstanceDraft(row.id)
|
||||
await loadList()
|
||||
void refreshOaMenuBadges()
|
||||
}
|
||||
|
||||
async function handleBatchDelete() {
|
||||
const ids = selectedRows.value.map((r) => r.id).filter(Boolean)
|
||||
if (!ids.length) return
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认删除选中的 ${ids.length} 条草稿吗?`, '批量删除', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '删除',
|
||||
cancelButtonText: '取消'
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
await fetchBatchDeleteOaInstanceDrafts(ids)
|
||||
await loadList()
|
||||
void refreshOaMenuBadges()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadGroups()
|
||||
await loadList()
|
||||
void refreshOaMenuBadges()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
loadList()
|
||||
void refreshOaMenuBadges()
|
||||
})
|
||||
</script>
|
||||
@@ -206,6 +206,7 @@
|
||||
import OaProgressChain from '@/components/oa-approval/OaProgressChain.vue'
|
||||
import { MAX_ADMIN_LIST_PAGE_SIZE } from '@/utils/fetch-paged-list'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { refreshOaMenuBadges } from '@/utils/oa-menu-badge'
|
||||
import {
|
||||
OA_FC_DEFAULT_GUTTER,
|
||||
ensureOaUploadRuleProps
|
||||
@@ -398,6 +399,7 @@
|
||||
if (kind === 'approve') await fetchApproveOaTask(task.id, comment || undefined)
|
||||
else await fetchRejectOaTask(task.id, comment || undefined)
|
||||
await load()
|
||||
void refreshOaMenuBadges()
|
||||
} finally {
|
||||
acting.value = false
|
||||
}
|
||||
@@ -409,6 +411,7 @@
|
||||
try {
|
||||
await fetchWithdrawOaInstance(String(route.params.id || ''))
|
||||
await load()
|
||||
void refreshOaMenuBadges()
|
||||
} finally {
|
||||
acting.value = false
|
||||
}
|
||||
@@ -433,6 +436,7 @@
|
||||
try {
|
||||
await fetchReturnOaTask(task.id, comment)
|
||||
await load()
|
||||
void refreshOaMenuBadges()
|
||||
} finally {
|
||||
acting.value = false
|
||||
}
|
||||
@@ -497,6 +501,7 @@
|
||||
})
|
||||
addSignVisible.value = false
|
||||
await load()
|
||||
void refreshOaMenuBadges()
|
||||
} finally {
|
||||
acting.value = false
|
||||
}
|
||||
@@ -524,6 +529,7 @@
|
||||
})
|
||||
transferVisible.value = false
|
||||
await load()
|
||||
void refreshOaMenuBadges()
|
||||
} finally {
|
||||
acting.value = false
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
import { useRouter } from 'vue-router'
|
||||
import { View } from '@element-plus/icons-vue'
|
||||
import { fetchOaTasks } from '@/api/oaApproval'
|
||||
import { refreshOaMenuBadges } from '@/utils/oa-menu-badge'
|
||||
|
||||
defineOptions({ name: 'OaApprovalPending' })
|
||||
|
||||
@@ -131,6 +132,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(load)
|
||||
onActivated(load)
|
||||
onMounted(() => {
|
||||
load()
|
||||
void refreshOaMenuBadges()
|
||||
})
|
||||
onActivated(() => {
|
||||
load()
|
||||
void refreshOaMenuBadges()
|
||||
})
|
||||
</script>
|
||||
@@ -126,10 +126,14 @@
|
||||
/>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="dlgVisible = false">
|
||||
<el-button class="btn-ghost" @click="closeDialog">
|
||||
<el-icon><Close /></el-icon>
|
||||
取消
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="savingDraft" @click="saveDraft">
|
||||
<el-icon><Document /></el-icon>
|
||||
{{ editingDraftId ? '保存草稿' : '暂存草稿' }}
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="submitting" @click="submit">
|
||||
<el-icon><Check /></el-icon>
|
||||
提交
|
||||
@@ -143,21 +147,26 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { Check, Close, Promotion, Search } from '@element-plus/icons-vue'
|
||||
import { Check, Close, Document, Promotion, Search } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { fetchUserList } from '@/api/admin'
|
||||
import {
|
||||
fetchCreateOaInstanceDraft,
|
||||
fetchOaFlowPreview,
|
||||
fetchOaGroupList,
|
||||
fetchOaInstanceDetail,
|
||||
fetchOaInstanceDraftDetail,
|
||||
fetchOaTemplateDetail,
|
||||
fetchOaTemplates,
|
||||
fetchStartOaInstance,
|
||||
fetchSubmitOaInstanceDraft,
|
||||
fetchUpdateOaInstanceDraft,
|
||||
type OaFlowPreviewStep
|
||||
} from '@/api/oaApproval'
|
||||
import OaAppIcon from '@/components/oa-approval/OaAppIcon.vue'
|
||||
import OaFlowPreview from '@/components/oa-approval/OaFlowPreview.vue'
|
||||
import { MAX_ADMIN_LIST_PAGE_SIZE } from '@/utils/fetch-paged-list'
|
||||
import { refreshOaMenuBadges } from '@/utils/oa-menu-badge'
|
||||
import {
|
||||
OA_FC_DEFAULT_GUTTER,
|
||||
ensureOaUploadRuleProps
|
||||
@@ -214,6 +223,8 @@
|
||||
})
|
||||
const fapi = ref<any>(null)
|
||||
const submitting = ref(false)
|
||||
const savingDraft = ref(false)
|
||||
const editingDraftId = ref('')
|
||||
const needInitiatorSelect = ref(false)
|
||||
const initiatorSelectByNode = ref<Record<string, string[]>>({})
|
||||
const userOptions = ref<Array<{ id: string; nickName: string; userNo: string }>>([])
|
||||
@@ -334,6 +345,7 @@
|
||||
}
|
||||
|
||||
async function onPick(t: any) {
|
||||
editingDraftId.value = ''
|
||||
picked.value = t
|
||||
formData.value = {}
|
||||
formRule.value = []
|
||||
@@ -418,6 +430,77 @@
|
||||
}
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
dlgVisible.value = false
|
||||
editingDraftId.value = ''
|
||||
}
|
||||
|
||||
async function openDraft(draftId: string) {
|
||||
const detail = await fetchOaInstanceDraftDetail(draftId)
|
||||
const appId = String(detail?.appId || '').trim()
|
||||
if (!appId) {
|
||||
ElMessage.error('草稿缺少审批模板')
|
||||
return
|
||||
}
|
||||
let row = templates.value.find((t: any) => t.id === appId)
|
||||
if (!row) {
|
||||
row = {
|
||||
id: appId,
|
||||
appName: detail?.appName || '发起审批'
|
||||
}
|
||||
}
|
||||
await onPick(row)
|
||||
editingDraftId.value = draftId
|
||||
const saved = { ...(detail?.formData || {}) }
|
||||
formData.value = await applyOwnerFieldDefaults(
|
||||
formRule.value,
|
||||
saved,
|
||||
(userStore.info || userStore.getUserInfo) as any
|
||||
)
|
||||
formData.value = applyOvertimeKitDefaults(
|
||||
{ rule: formRule.value },
|
||||
formData.value,
|
||||
(userStore.info || userStore.getUserInfo) as any
|
||||
)
|
||||
const linked = applyConfirmationKitDateLinkage(
|
||||
{ rule: formRule.value },
|
||||
formData.value
|
||||
)
|
||||
formData.value = linked.data
|
||||
confirmationKitPrevSnapshot = { ...linked.data }
|
||||
leaveKitPrevSnapshot = { ...formData.value }
|
||||
tripKitPrevSnapshot = { ...formData.value }
|
||||
const sel = detail?.initiatorSelectByNode
|
||||
initiatorSelectByNode.value =
|
||||
sel && typeof sel === 'object' && !Array.isArray(sel) ? { ...sel } : {}
|
||||
await loadFlowPreview(appId)
|
||||
}
|
||||
|
||||
async function saveDraft() {
|
||||
if (!picked.value?.id) return
|
||||
savingDraft.value = true
|
||||
try {
|
||||
const payload = {
|
||||
formData: { ...formData.value },
|
||||
initiatorSelectByNode: { ...initiatorSelectByNode.value },
|
||||
title: picked.value.appName || ''
|
||||
}
|
||||
if (editingDraftId.value) {
|
||||
await fetchUpdateOaInstanceDraft(editingDraftId.value, payload)
|
||||
} else {
|
||||
const created: any = await fetchCreateOaInstanceDraft({
|
||||
appId: picked.value.id,
|
||||
...payload
|
||||
})
|
||||
if (created?.id) editingDraftId.value = created.id
|
||||
}
|
||||
void refreshOaMenuBadges()
|
||||
closeDialog()
|
||||
} finally {
|
||||
savingDraft.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function syncLeaveKitDurations() {
|
||||
if (leaveKitSyncing) return
|
||||
if (!formRule.value.length) return
|
||||
@@ -604,12 +687,24 @@
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
const data: any = await fetchStartOaInstance({
|
||||
appId: picked.value.id,
|
||||
const payload = {
|
||||
formData: { ...formData.value },
|
||||
initiatorSelectByNode: { ...initiatorSelectByNode.value }
|
||||
})
|
||||
dlgVisible.value = false
|
||||
}
|
||||
let data: any
|
||||
if (editingDraftId.value) {
|
||||
data = await fetchSubmitOaInstanceDraft(editingDraftId.value, {
|
||||
...payload,
|
||||
title: picked.value.appName || ''
|
||||
})
|
||||
} else {
|
||||
data = await fetchStartOaInstance({
|
||||
appId: picked.value.id,
|
||||
...payload
|
||||
})
|
||||
}
|
||||
closeDialog()
|
||||
void refreshOaMenuBadges()
|
||||
if (data?.id) {
|
||||
router.push({ path: `/system-manage/oa-approval/instances/${data.id}` })
|
||||
}
|
||||
@@ -624,9 +719,16 @@
|
||||
const [tpl, groupsRes] = await Promise.all([fetchOaTemplates(), fetchOaGroupList()])
|
||||
templates.value = tpl?.list || []
|
||||
groupOptions.value = groupsRes?.list || []
|
||||
const qDraftId = String(route.query.draftId || '').trim()
|
||||
const qAppId = String(route.query.appId || '').trim()
|
||||
const qCopyFrom = String(route.query.copyFromInstanceId || '').trim()
|
||||
if (qAppId) {
|
||||
if (qDraftId) {
|
||||
try {
|
||||
await openDraft(qDraftId)
|
||||
} catch {
|
||||
ElMessage.error('无法打开草稿')
|
||||
}
|
||||
} else if (qAppId) {
|
||||
const row = templates.value.find((t: any) => t.id === qAppId)
|
||||
if (row) {
|
||||
await onPick(row)
|
||||
|
||||
Reference in new issue
Block a user