feat(web-admin): edit and submit OA drafts in-place via shared dialog.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
cf009de58a
commit
3cf2f68b1a
1 file changed
+31
-12
@@ -59,11 +59,7 @@
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="!selectedRows.length"
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
<el-button class="btn-ghost" :disabled="!selectedRows.length" @click="handleBatchDelete">
|
||||
<el-icon><Delete /></el-icon>
|
||||
批量删除
|
||||
</el-button>
|
||||
@@ -159,6 +155,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<OaStartFormDialog
|
||||
ref="draftDialogRef"
|
||||
@saved="onDraftDialogSaved"
|
||||
@submitted="onDraftDialogSubmitted"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -166,7 +168,7 @@
|
||||
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 { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
fetchBatchDeleteOaInstanceDrafts,
|
||||
fetchDeleteOaInstanceDraft,
|
||||
@@ -174,6 +176,7 @@
|
||||
fetchOaInstanceDraftList,
|
||||
fetchSubmitOaInstanceDraft
|
||||
} from '@/api/oaApproval'
|
||||
import OaStartFormDialog from '@/components/oa-approval/OaStartFormDialog.vue'
|
||||
import { refreshOaMenuBadges } from '@/utils/oa-menu-badge'
|
||||
|
||||
defineOptions({ name: 'OaApprovalDrafts' })
|
||||
@@ -187,6 +190,7 @@
|
||||
const pageSize = ref(20)
|
||||
const total = ref(0)
|
||||
const submittingId = ref('')
|
||||
const draftDialogRef = ref<InstanceType<typeof OaStartFormDialog> | null>(null)
|
||||
|
||||
const searchForm = reactive({
|
||||
keyword: '',
|
||||
@@ -243,12 +247,26 @@
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
function openEdit(row: any) {
|
||||
async function openEdit(row: any) {
|
||||
if (!row?.id) return
|
||||
router.push({
|
||||
path: '/system-manage/oa-approval/start',
|
||||
query: { draftId: row.id }
|
||||
})
|
||||
try {
|
||||
await draftDialogRef.value?.openForDraft(row.id)
|
||||
} catch {
|
||||
ElMessage.error('无法打开草稿')
|
||||
}
|
||||
}
|
||||
|
||||
function onDraftDialogSaved() {
|
||||
void loadList()
|
||||
void refreshOaMenuBadges()
|
||||
}
|
||||
|
||||
function onDraftDialogSubmitted(data: any) {
|
||||
void loadList()
|
||||
void refreshOaMenuBadges()
|
||||
if (data?.id) {
|
||||
router.push({ path: `/system-manage/oa-approval/instances/${data.id}` })
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit(row: any) {
|
||||
@@ -271,7 +289,8 @@
|
||||
router.push({ path: `/system-manage/oa-approval/instances/${data.id}` })
|
||||
}
|
||||
} catch {
|
||||
openEdit(row)
|
||||
// 快捷提交失败:打开同一弹窗回显,不跳发起页
|
||||
await openEdit(row)
|
||||
} finally {
|
||||
submittingId.value = ''
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user