feat: 网格包生成改名并在完成后打开结果目录

This commit is contained in:
nixevol
2026-10-15 15:25:35 +08:00
parent e8c8218d11
commit 6227cef264
16 changed files with 62 additions and 44 deletions
+1 -3
View File
@@ -12,7 +12,7 @@ const menuOptions = [
key: 'tools',
children: [
{ label: '工具箱首页', key: 'home' },
{ label: '市场网格出图', key: 'market' },
{ label: '网格包生成', key: 'market' },
{ label: '楼宇数据查询', key: 'buildings' },
],
},
@@ -60,7 +60,6 @@ function go(key) {
<n-layout-sider bordered :width="216" content-style="display:flex;flex-direction:column;">
<div class="brand">
<strong>MarketGrid</strong>
<span>空间数据工具箱</span>
</div>
<n-menu :value="route.name" :options="menuOptions" :indent="16" @update:value="go" />
</n-layout-sider>
@@ -82,7 +81,6 @@ function go(key) {
.main-column { flex: 1; min-width: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { padding: 12px 16px 2px; }
.brand strong { display: block; font-size: 18px; }
.brand span { display: block; margin-top: 2px; color: #66788a; font-size: 12px; }
.topbar {
flex: none;
height: 48px;
+2 -2
View File
@@ -43,7 +43,7 @@ watch(() => props.show, (open) => {
async function load() {
if (!props.path) {
error.value = '请先填写市场边界文件。'
error.value = '请先填写网格边界文件。'
layer.value = null
return
}
@@ -137,7 +137,7 @@ function textOf(row, name) {
<n-modal
v-model:show="visible"
preset="card"
title="市场边界"
title="网格边界"
style="width: min(1080px, 94vw)"
:segmented="{ content: true, footer: 'soft' }"
:content-style="{ maxHeight: '72vh', overflow: 'hidden', display: 'flex' }"
+1 -1
View File
@@ -13,7 +13,7 @@ const router = createRouter({
history: createWebHistory(),
routes: [
{ path: '/', name: 'home', component: Home, meta: { title: '工具箱首页' } },
{ path: '/market', name: 'market', component: Market, meta: { title: '市场网格出图' } },
{ path: '/market', name: 'market', component: Market, meta: { title: '网格包生成' } },
{ path: '/buildings', name: 'buildings', component: Buildings, meta: { title: '楼宇数据查询' } },
{ path: '/tasks', name: 'tasks', component: Tasks, meta: { title: '任务中心' } },
{ path: '/results', name: 'results', component: Results, meta: { title: '成果浏览' } },
+3 -3
View File
@@ -43,9 +43,9 @@ onMounted(load)
<h2 class="section-title">选择工具</h2>
<div class="two-col">
<div class="panel tool">
<strong>市场网格出图</strong>
<p class="muted">按市场生成信号图和成果包。</p>
<n-button type="primary" @click="router.push({ name: 'market' })">开始出图</n-button>
<strong>网格包生成</strong>
<p class="muted">按网格生成信号图和成果包。</p>
<n-button type="primary" @click="router.push({ name: 'market' })">开始生成</n-button>
</div>
<div class="panel tool">
<strong>楼宇数据查询</strong>
+31 -11
View File
@@ -7,7 +7,7 @@ import TaskCard from '../components/TaskCard.vue'
import { getJSON, postJSON } from '../api'
const hints = {
MARKET_GPKG: '市场边界,默认 source/GridMap.gpkg',
MARKET_GPKG: '网格边界,默认 source/GridMap.gpkg',
GIS_PROJECT_SOURCE: 'QGIS 工程模板',
GRID_5G_GPKG: '大文件请直接填写本地路径',
GRID_4G_GPKG: '与 5G Grid 合并为采样点图层。大文件请直接填写本地路径',
@@ -40,6 +40,7 @@ const marketError = ref('')
const error = ref('')
const success = ref('')
const submitting = ref(false)
const opening = ref(false)
const editingBoundary = ref(false)
const editingProject = ref(false)
const settingsOpen = ref(false)
@@ -69,8 +70,8 @@ const fileItems = computed(() => {
})
const canStart = computed(() => draft.ready && options.value.length > 0 && !submitting.value)
const clipOptions = [
{ label: '与市场相交', value: 'intersects' },
{ label: '中心点在市场内', value: 'center' },
{ label: '与网格相交', value: 'intersects' },
{ label: '中心点在网格内', value: 'center' },
]
function fileActions(item) {
@@ -124,14 +125,14 @@ async function loadMarkets(path) {
try {
if (!path) {
options.value = []
marketError.value = '请先导入可用的市场边界。'
marketError.value = '请先导入可用的网格边界。'
return
}
const data = await getJSON(`/api/markets?path=${encodeURIComponent(path)}`)
if (current !== marketTicket) return
options.value = data.options || []
draft.chosen = draft.chosen.filter((id) => options.value.some((item) => item.id === id))
marketError.value = options.value.length ? '' : '请先导入可用的市场边界。'
marketError.value = options.value.length ? '' : '请先导入可用的网格边界。'
} catch (reason) {
if (current !== marketTicket) return
options.value = []
@@ -141,6 +142,19 @@ async function loadMarkets(path) {
}
}
async function openResult() {
if (!lastTask.value?.id) return
opening.value = true
error.value = ''
try {
await postJSON(`/api/results/${encodeURIComponent(lastTask.value.id)}/open`, {})
} catch (reason) {
error.value = reason.message
} finally {
opening.value = false
}
}
async function refreshTask() {
if (!draft.lastTaskId) return
try {
@@ -165,7 +179,7 @@ async function submit() {
}
const ids = draft.allMarkets ? options.value.map((item) => item.id) : [...draft.chosen]
if (!ids.length) {
error.value = '请至少选择一个市场网格。'
error.value = '请至少选择一个网格。'
return
}
for (const item of fileItems.value) {
@@ -281,9 +295,9 @@ onUnmounted(() => {
<template v-else>
<n-tooltip>
<template #trigger>
<n-checkbox v-model:checked="draft.allMarkets" :disabled="!options.length">处理全部市场</n-checkbox>
<n-checkbox v-model:checked="draft.allMarkets" :disabled="!options.length">处理全部网格</n-checkbox>
</template>
取消后可在下方指定市场
取消后可在下方指定网格
</n-tooltip>
<div v-if="options.length && !draft.allMarkets" class="scroll-box">
<n-checkbox-group v-model:value="draft.chosen">
@@ -292,8 +306,8 @@ onUnmounted(() => {
</div>
</n-checkbox-group>
</div>
<p v-else-if="options.length" class="muted">将处理全部 {{ options.length }} 个市场</p>
<p v-else class="muted">请先导入可用的市场边界。</p>
<p v-else-if="options.length" class="muted">将处理全部 {{ options.length }} 个网格</p>
<p v-else class="muted">请先导入可用的网格边界。</p>
</template>
<n-button type="primary" :disabled="!canStart" :loading="submitting" @click="submit">开始生成</n-button>
</div>
@@ -323,7 +337,7 @@ onUnmounted(() => {
</template>
<n-input-number v-model:value="draft.scale" :min="0.1" :max="20" :step="0.5" style="width: 100%" />
</n-form-item>
<n-form-item label="单市场像元上限(百万)">
<n-form-item label="单网格像元上限(百万)">
<n-input-number v-model:value="draft.maxRaster" :min="1" :max="100" :precision="0" style="width: 100%" />
</n-form-item>
<n-form-item label="汇总像元上限(百万)">
@@ -342,6 +356,10 @@ onUnmounted(() => {
</n-space>
</template>
</n-modal>
<div v-if="lastTask && !lastTask.active && lastTask.output" class="result-open">
<n-button type="primary" :loading="opening" @click="openResult">打开目录</n-button>
<span class="muted">{{ lastTask.output }}</span>
</div>
<TaskCard v-if="lastTask" :task="lastTask" log-open @changed="refreshTask" />
</div>
</template>
@@ -358,6 +376,8 @@ onUnmounted(() => {
.layer-head { color: #66788a; font-size: 12px; border-bottom: 1px solid #f0f3f6; }
.layer-row + .layer-row { border-top: 1px solid #f0f3f6; }
.wizard-nav { display: flex; justify-content: flex-end; gap: 8px; }
.result-open { display: flex; align-items: center; gap: 12px; }
.result-open .muted { word-break: break-all; }
.market-box { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.pick { padding: 2px 0; }
.tip { border-bottom: 1px dashed #b7c2cc; cursor: help; }