feat(web-admin): reuse plan form as a full-page webview variant.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
1a5aa1c934
commit
bc7a1c225a
4 files changed
+199
-26
No files matched your search
@@ -1,18 +1,55 @@
|
||||
<template>
|
||||
<MpWebviewShell>
|
||||
<p class="mp-wv-placeholder">计划表单加载中…</p>
|
||||
<PlPlanFormDialog
|
||||
:key="formKey"
|
||||
variant="page"
|
||||
:visible="true"
|
||||
:plan-id="planId"
|
||||
:copy-from-plan-id="copyFrom"
|
||||
:open-for-arrange="openForArrange"
|
||||
@success="onSuccess"
|
||||
@close="onClose"
|
||||
/>
|
||||
</MpWebviewShell>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import MpWebviewShell from '@/layouts/MpWebviewShell.vue'
|
||||
</script>
|
||||
import PlPlanFormDialog from '@/components/business/pl-plan-form-dialog/index.vue'
|
||||
import '@/styles/mp-webview.scss'
|
||||
|
||||
<style scoped>
|
||||
.mp-wv-placeholder {
|
||||
margin: 24px 0 0;
|
||||
font-size: 14px;
|
||||
color: #6b7b74;
|
||||
text-align: center;
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const planId = computed(() => {
|
||||
if (route.name === 'MpPlPlanNew') return undefined
|
||||
const id = String(route.params.id || '').trim()
|
||||
return id || undefined
|
||||
})
|
||||
const copyFrom = computed(() => {
|
||||
const id = String(route.query.copyFrom || '').trim()
|
||||
return id || undefined
|
||||
})
|
||||
const openForArrange = computed(() => route.name === 'MpPlPlanArrange')
|
||||
const formKey = computed(
|
||||
() => `${String(route.name || '')}-${planId.value || ''}-${copyFrom.value || ''}`
|
||||
)
|
||||
|
||||
function onSuccess(payload?: { planId: string; arranged?: boolean }) {
|
||||
if (payload?.planId) {
|
||||
void router.replace(`/m/pl/plan/${payload.planId}`)
|
||||
return
|
||||
}
|
||||
void router.replace('/m/pl/plan')
|
||||
}
|
||||
</style>
|
||||
|
||||
function onClose() {
|
||||
if (window.history.length > 1) {
|
||||
router.back()
|
||||
return
|
||||
}
|
||||
void router.replace('/m/pl/plan')
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user