优化
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { Check, Pencil, Plus, RefreshCw, Sparkles, Trash2 } from '@lucide/vue'
|
||||
import { Pencil, Plus, RefreshCw, Sparkles, Trash2 } from '@lucide/vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useAccessPreviewStore } from '@/core/access/accessPreview'
|
||||
import ApiErrorMeta from '@/shared/components/ApiErrorMeta.vue'
|
||||
@@ -13,12 +13,10 @@ import { ApiResponseError, getApiErrorDetails, type ApiErrorDetails } from '@/sh
|
||||
import {
|
||||
adjustSmartLoadingItem,
|
||||
assignSmartLoadingItem,
|
||||
createSmartLoadingPlan,
|
||||
deleteSmartLoadingItem,
|
||||
getContainerBooking,
|
||||
getSmartLoadingPlanByBooking,
|
||||
listSmartLoadingCandidates,
|
||||
pushSmartLoadingPreload,
|
||||
recommendSmartLoading,
|
||||
type ContainerBooking,
|
||||
type SmartLoadingCandidate,
|
||||
@@ -45,7 +43,6 @@ const conflictRefreshed = ref(false)
|
||||
const assignOpen = ref(false)
|
||||
const adjustOpen = ref(false)
|
||||
const removeOpen = ref(false)
|
||||
const pushOpen = ref(false)
|
||||
const selectedCandidate = ref<SmartLoadingCandidate | null>(null)
|
||||
const selectedItem = ref<SmartLoadingPlanItem | null>(null)
|
||||
const packageCount = ref(1)
|
||||
@@ -53,10 +50,8 @@ const filters = ref<QueryModel>({ keyword: '', eligibility: '' })
|
||||
const appliedFilters = ref<QueryModel>({ ...filters.value })
|
||||
|
||||
const canView = computed(() => access.can('platform:firstleg:smart-loading:list'))
|
||||
const canCreate = computed(() => !props.readOnly && access.can('platform:firstleg:smart-loading:create'))
|
||||
const canAssign = computed(() => !props.readOnly && access.can('platform:firstleg:smart-loading:assign'))
|
||||
const canDelete = computed(() => !props.readOnly && access.can('platform:firstleg:smart-loading:delete'))
|
||||
const canPush = computed(() => !props.readOnly && access.can('platform:firstleg:smart-loading:push'))
|
||||
const editable = computed(() => plan.value?.status === 'EDITING')
|
||||
const usedVolume = computed(() => plan.value?.items.reduce((sum, item) => sum + item.volumeCbm, 0) ?? 0)
|
||||
const usedWeight = computed(() => plan.value?.items.reduce((sum, item) => sum + item.grossWeightKg, 0) ?? 0)
|
||||
@@ -199,10 +194,6 @@ async function runAction(name: string, operation: () => Promise<SmartLoadingPlan
|
||||
}
|
||||
}
|
||||
|
||||
async function createPlan() {
|
||||
await runAction('create', () => createSmartLoadingPlan(props.bookingId), '装柜草稿已创建')
|
||||
}
|
||||
|
||||
async function recommend() {
|
||||
if (!plan.value) return
|
||||
await runAction('recommend', () => recommendSmartLoading(plan.value!.id, plan.value!.version), '智能建议已生成')
|
||||
@@ -258,12 +249,6 @@ async function confirmRemove() {
|
||||
if (success) removeOpen.value = false
|
||||
}
|
||||
|
||||
async function confirmPush() {
|
||||
if (!plan.value) return
|
||||
const success = await runAction('push', () => pushSmartLoadingPreload(plan.value!.id, plan.value!.version), '装柜计划已推送预装')
|
||||
if (success) pushOpen.value = false
|
||||
}
|
||||
|
||||
function applyFilters(model: QueryModel) {
|
||||
appliedFilters.value = { keyword: model.keyword || '', eligibility: model.eligibility || '' }
|
||||
}
|
||||
@@ -278,9 +263,8 @@ onMounted(() => { void load() })
|
||||
<div class="smart-loading__context"><span>当前柜次</span><strong>{{ container?.cabinetNo || container?.containerNo || '柜次信息待补充' }}</strong><small>{{ container?.warehouseName || '仓库待加载' }}</small></div>
|
||||
<div class="smart-loading__actions">
|
||||
<el-button circle :loading="loading" aria-label="刷新智能排柜" @click="load"><RefreshCw :size="16" /></el-button>
|
||||
<el-button v-if="!plan" type="primary" :disabled="!canCreate || loading" :loading="action === 'create'" @click="createPlan"><Plus :size="15" />创建装柜草稿</el-button>
|
||||
<el-tag v-if="!plan" type="danger">自动预装计划缺失</el-tag>
|
||||
<el-button v-if="plan" :disabled="!canAssign || !editable || Boolean(action)" :loading="action === 'recommend'" @click="recommend"><Sparkles :size="15" />生成智能建议</el-button>
|
||||
<el-button v-if="plan" type="primary" :disabled="!canPush || !editable || !plan.items.length || Boolean(action)" @click="pushOpen = true"><Check :size="15" />推送预装</el-button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -352,10 +336,6 @@ onMounted(() => { void load() })
|
||||
<ApiErrorMeta v-if="actionError" :details="actionError" />
|
||||
</AppDialog>
|
||||
|
||||
<AppDialog v-model="pushOpen" title="推送预装清单" confirm-type="primary" confirm-text="确认推送" :confirm-loading="action === 'push'" @confirm="confirmPush">
|
||||
<p>推送后当前草稿明细不可再增删调整。真实集装箱号可在订舱放舱后补录,现场 PDA 任务将在条件齐备后开放。</p>
|
||||
<ApiErrorMeta v-if="actionError" :details="actionError" />
|
||||
</AppDialog>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user