style(web-admin): format webview plan form and paste helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-09-14 16:48:25 +08:00
1 parent a382f3e730
commit bf22c4b031
3 files changed
+26 -34

No files matched your search

@@ -96,9 +96,7 @@
<div v-if="conflictRows.length" class="paste-conflict-block">
<h4 class="paste-conflict-title">冲突处理</h4>
<div v-for="row in conflictRows" :key="row.key" class="paste-conflict-row">
<div class="paste-conflict-label">
{{ row.label }}已存在:{{ row.existingLabel }}
</div>
<div class="paste-conflict-label"> {{ row.label }}已存在:{{ row.existingLabel }} </div>
<el-radio-group v-model="row.action">
<el-radio value="reuse">复用</el-radio>
<el-radio value="overwrite">覆盖更新</el-radio>
@@ -122,7 +120,12 @@
<el-button @click="handleCancel">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button type="primary" :loading="submitLoading" :disabled="!parsed" @click="handleSubmit">
<el-button
type="primary"
:loading="submitLoading"
:disabled="!parsed"
@click="handleSubmit"
>
<el-icon><Check /></el-icon>确认生成
</el-button>
</div>
@@ -139,7 +142,7 @@
</template>
<script setup lang="ts">
import { ElDialog } from 'element-plus'
import { ElDialog, ElMessage } from 'element-plus'
import { Check, Close, MagicStick } from '@element-plus/icons-vue'
import {
pasteRecognizeApi,
@@ -297,7 +300,7 @@
})
const page = pickBxPageResult<{ id: string; licensePlate: string }>(res)
const hit = (page.list || []).find(
v => (v.licensePlate || '').trim() === vehicleForm.licensePlate.trim()
(v) => (v.licensePlate || '').trim() === vehicleForm.licensePlate.trim()
)
if (hit) {
rows.push({
@@ -310,7 +313,11 @@
}
}
async function findPersonnelByIdCard(idCardNo: string, key: 'driver' | 'escort', label: string) {
async function findPersonnelByIdCard(
idCardNo: string,
key: 'driver' | 'escort',
label: string
) {
const card = idCardNo.trim()
if (!card) return
const res = await personnelApi.list({
@@ -321,7 +328,7 @@
})
const page = pickBxPageResult<{ id: string; personnelName: string; idCardNo?: string }>(res)
const hit = (page.list || []).find(
p => (p.idCardNo || '').trim().toUpperCase() === card.toUpperCase()
(p) => (p.idCardNo || '').trim().toUpperCase() === card.toUpperCase()
)
if (hit) {
rows.push({
@@ -364,18 +371,18 @@
if (!conflictRows.value.length) {
await detectConflicts()
}
if (conflictRows.value.some(r => r.action === 'cancel')) {
if (conflictRows.value.some((r) => r.action === 'cancel')) {
ElMessage.info('已取消本次生成')
return
}
const conflicts: PasteConflictItem[] = conflictRows.value.map(r => ({
const conflicts: PasteConflictItem[] = conflictRows.value.map((r) => ({
key: r.key,
existingId: r.existingId,
action: r.action
}))
const carrier = carrierOptions.value.find(c => c.id === carrierId.value)
const carrier = carrierOptions.value.find((c) => c.id === carrierId.value)
const needVehicle = showVehicleFields.value
const res = await pasteRecognizeApi.commit({
@@ -447,7 +454,7 @@
watch(
() => props.visible,
async v => {
async (v) => {
if (v) {
rawText.value = PL_PASTE_SAMPLE_TEXT
await ensureCarriers()
@@ -272,11 +272,7 @@
<el-button @click="handleCancel">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button
v-if="showDraftButton"
:loading="submitLoading"
@click="handleSubmit('draft')"
>
<el-button v-if="showDraftButton" :loading="submitLoading" @click="handleSubmit('draft')">
<el-icon><Document /></el-icon>暂存
</el-button>
<el-button
@@ -594,9 +590,7 @@
const showDraftButton = computed(() => {
if (props.planEditOnly) return false
if (!isEdit.value) return true
return (
loadedFollowStatus.value === 'drafting' || loadedFollowStatus.value === 'pending_arrange'
)
return loadedFollowStatus.value === 'drafting' || loadedFollowStatus.value === 'pending_arrange'
})
const showSaveAndArrangeButton = computed(() => {
if (props.planEditOnly) return false
@@ -1259,12 +1253,7 @@
if (seq !== loadContractFetchSeq) return
loadContractProductIds.value = allowedIds
// 合同 id 变化时过滤装货产品(详情首次灌入同 id / 加载中不刷)
if (
prev &&
id !== prevId &&
!detailLoading.value &&
!suppressStopProductSync.value
) {
if (prev && id !== prevId && !detailLoading.value && !suppressStopProductSync.value) {
const nextProducts = filterProductsByAllowedProductIds(
loadForm.value.products || [],
allowedIds
@@ -2019,10 +2008,7 @@
selectedEscortId.value = defaultEscort?.personnelId || ''
}
async function handleVehicleChange(
vehicleId: string,
opts?: { syncStopDibang?: boolean }
) {
async function handleVehicleChange(vehicleId: string, opts?: { syncStopDibang?: boolean }) {
const syncStopDibang = opts?.syncStopDibang !== false
vehicleBundle.value = null
selectedDriverId.value = ''
@@ -2292,9 +2278,7 @@
return missing
}
async function handleSubmit(
mode: 'draft' | 'save' | 'saveAndArrange' | 'rearrange' = 'save'
) {
async function handleSubmit(mode: 'draft' | 'save' | 'saveAndArrange' | 'rearrange' = 'save') {
// 必须在 await validate 之前置位,避免连点并发多次 createFull
if (submitLoading.value) return
submitLoading.value = true
+2 -1
View File
@@ -118,7 +118,8 @@ export async function buildMpPlanPrintHtml(
const userInfo = userStore.getUserInfo as { realName?: string; userName?: string } | null
const loginUserName = String(userInfo?.realName || userInfo?.userName || '').trim()
return replaceSubpackSlipPlaceholders(htmlContent, plan, {
getUnitLabel: (unitCode: string) => dictStore.getLabel('crm_product_unit', unitCode) || unitCode,
getUnitLabel: (unitCode: string) =>
dictStore.getLabel('crm_product_unit', unitCode) || unitCode,
subpackSlipNo,
orderDate: formatSubpackSlipDateIso(),
orderUser: loginUserName,