This commit is contained in:
zlwu committed 2026-07-11 17:15:17 +08:00
1 parent 843e13bce3
commit 7b1d4c8729
629 files changed
+74059 -7929

No files matched your search

@@ -13,6 +13,8 @@
style="backdrop-filter: none"
@open="handleOpen"
>
<p v-if="selectableStatusHint" class="contract-selector-hint">{{ selectableStatusHint }}</p>
<div class="filter-block contract-selector-filter">
<el-form ref="queryFormRef" :model="queryParams" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -65,6 +67,7 @@
stripe
highlight-current-row
row-key="id"
:row-class-name="getRowClassName"
:max-height="420"
@row-click="handleRowClick"
@current-change="handleCurrentChange"
@@ -74,6 +77,7 @@
<el-radio
v-model="selectedId"
:label="String(row.id)"
:disabled="!isContractSelectable(row)"
@click.stop
@change="handleRadioChange(row)"
>
@@ -173,18 +177,24 @@ import type { ContractQuery, ContractVO } from '@/api/crm/contract/types'
import { planApi } from '@/api/pl'
import DictTag from '@/components/DictTag/index.vue'
import ListPagination from '@/components/ListPagination/index.vue'
import { useDictStore } from '@/store/modules/dict'
import { formatMoneyDisplay } from '@/utils/money-format'
const props = withDefaults(
defineProps<{
visible: boolean
hideAmount?: boolean
/** 仅这些状态的合同可被选中;未配置时列表内均可选 */
selectableStatuses?: string[]
}>(),
{
hideAmount: false
hideAmount: false,
selectableStatuses: undefined
}
)
const dictStore = useDictStore()
const emit = defineEmits<{
'update:visible': [value: boolean]
confirm: [contract: ContractVO]
@@ -214,6 +224,35 @@ const queryParams = reactive<ContractQuery>({
excludeStatus: 'invalid'
})
const selectableStatusHint = computed(() => {
if (!props.selectableStatuses?.length) return ''
const labels = props.selectableStatuses
.map(status => dictStore.getLabel('crm_contract_status', status))
.filter(Boolean)
if (!labels.length) return '仅部分状态的合同可被选择'
return `仅「${labels.join('」「')}」状态的合同可被选择,其他状态仅展示不可选`
})
function isContractSelectable(row: ContractVO): boolean {
if (!props.selectableStatuses?.length) return true
return props.selectableStatuses.includes(row.status)
}
function getRowClassName({ row }: { row: ContractVO }) {
return isContractSelectable(row) ? '' : 'contract-selector-row--disabled'
}
function warnContractNotSelectable(row?: ContractVO | null) {
const statusLabel = row?.status
? dictStore.getLabel('crm_contract_status', row.status) || row.status
: '当前'
const allowedLabels = (props.selectableStatuses || [])
.map(status => dictStore.getLabel('crm_contract_status', status) || status)
.filter(Boolean)
const allowedText = allowedLabels.length ? allowedLabels.join('、') : '指定'
ElMessage.warning(`仅${allowedText}状态的合同可被选择,该合同状态为「${statusLabel}」`)
}
async function getList() {
loading.value = true
try {
@@ -236,7 +275,7 @@ function syncTableSelection() {
return
}
const row = contractList.value.find(item => String(item.id) === selectedId.value)
if (!row) {
if (!row || !isContractSelectable(row)) {
selectedId.value = ''
currentRow.value = null
table.setCurrentRow(undefined)
@@ -246,13 +285,20 @@ function syncTableSelection() {
table.setCurrentRow(row)
}
function selectContractRow(row: ContractVO | null | undefined) {
function selectContractRow(row: ContractVO | null | undefined, options?: { silent?: boolean }) {
if (!row?.id) {
selectedId.value = ''
currentRow.value = null
syncTableSelection()
return
}
if (!isContractSelectable(row)) {
if (!options?.silent) {
warnContractNotSelectable(row)
}
syncTableSelection()
return
}
selectedId.value = String(row.id)
currentRow.value = row
syncTableSelection()
@@ -306,11 +352,19 @@ watchDebounced(
)
function handleCurrentChange(row: ContractVO | undefined) {
if (row?.id && String(row.id) === selectedId.value) {
if (!row?.id) {
selectContractRow(row, { silent: true })
return
}
if (!isContractSelectable(row)) {
syncTableSelection()
return
}
if (String(row.id) === selectedId.value) {
currentRow.value = row
return
}
selectContractRow(row)
selectContractRow(row, { silent: true })
}
function handleOpen() {
@@ -326,6 +380,10 @@ function handleOpen() {
async function handleConfirm() {
if (!currentRow.value?.id) return
if (!isContractSelectable(currentRow.value)) {
warnContractNotSelectable(currentRow.value)
return
}
detailLoading.value = true
try {
const res = await getContract(currentRow.value.id)
@@ -339,6 +397,17 @@ async function handleConfirm() {
</script>
<style scoped lang="scss">
.contract-selector-hint {
margin: 0 0 12px;
padding: 8px 12px;
font-size: 13px;
line-height: 1.5;
color: #64748b;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 8px;
}
.contract-selector-filter {
padding: 12px 16px 10px;
background: var(--mint-surface);
@@ -393,6 +462,19 @@ async function handleConfirm() {
:deep(.el-radio__label) {
display: none;
}
:deep(.contract-selector-row--disabled) {
color: #94a3b8;
cursor: not-allowed;
td {
background-color: #f8fafc !important;
}
&:hover > td {
background-color: #f8fafc !important;
}
}
}
.sr-only {
@@ -17,10 +17,11 @@
<script setup lang="ts">
import { Search } from '@element-plus/icons-vue'
import { watchDebounced } from '@vueuse/core'
defineOptions({ name: 'ListQuickSearchInput' })
defineProps<{
const props = defineProps<{
modelValue: string
placeholder: string
}>()
@@ -30,4 +31,12 @@
search: []
clear: []
}>()
watchDebounced(
() => props.modelValue,
() => {
emit('search')
},
{ debounce: 300 }
)
</script>
@@ -231,8 +231,8 @@ function buildCertViewFields(cert: CertRead): ViewField[] {
padding-left: 10px;
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #1ca851;
color: var(--section-bar-title-color, var(--primary-dark, #059669));
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
line-height: 1;
}
@@ -293,7 +293,7 @@ defineExpose({ openSubmit, openApprove, openReject })
margin: 0 0 12px;
font-size: 14px;
font-weight: 600;
color: var(--text, #1e293b);
color: var(--section-bar-title-color, var(--primary-dark, #059669));
}
.approval-flow {
@@ -457,7 +457,8 @@ import {
type Vehicle
} from '@/api/pl'
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
import { pickBxList } from '@/utils/http/bx'
import { fetchAllPagedRecords } from '@/utils/fetch-paged-list'
import { pickBxPageResult } from '@/utils/http/bx'
import { buildVehicleTrailerLookup, formatPlVehiclePlateDisplay } from '@/utils/pl-display'
import { formatMoneyDisplay } from '@/utils/money-format'
import { formatDateTime } from '@/utils/format'
@@ -572,8 +573,10 @@ function planToTransportRow(plan: UnsettledPlanItem): EditableTransport {
async function loadVehicleOptions() {
try {
const res = await vehicleApi.list({ page: 1, pageSize: 500 })
vehicleOptions.value = pickBxList(res)
vehicleOptions.value = await fetchAllPagedRecords<Vehicle>(async (page, pageSize) => {
const res = await vehicleApi.list({ page, pageSize })
return pickBxPageResult<Vehicle>(res)
})
} catch {
vehicleOptions.value = []
}
@@ -89,7 +89,7 @@
<section class="pl-arrange-view-panel">
<h3 class="pl-arrange-view-title">计划单查看</h3>
<PlPlanViewTabs v-if="planId" ref="tabsRef" :plan-id="planId" embedded />
<PlPlanViewTabs v-if="planId" ref="tabsRef" :plan-id="planId" embedded feedback-editable />
</section>
</div>
@@ -379,7 +379,7 @@ async function handleSubmit() {
margin: 0 0 12px;
font-size: 14px;
font-weight: 600;
color: #1e293b;
color: var(--section-bar-title-color, var(--primary-dark, #059669));
}
.pl-plan-subtitle {
@@ -45,23 +45,34 @@
class="pl-arrange-block-alert"
/>
<el-form ref="formRef" :model="formData" :rules="formRules" label-position="right" label-width="100px" class="pl-dialog-form">
<h4 class="pl-plan-subtitle">车辆信息</h4>
<div class="form-grid-4">
<el-form-item label="选择车辆" prop="vehicleId">
<el-select
v-model="formData.vehicleId"
placeholder="请选择车辆"
filterable
:loading="vehicleLoading"
@change="handleVehicleChange"
>
<el-option
v-for="v in vehicleList"
:key="v.id"
:label="`${v.licensePlate} (${v.loadCapacity || '-'}吨)`"
:value="v.id"
/>
</el-select>
<div class="pl-arrange-vehicle-field">
<el-select
v-model="formData.vehicleId"
class="pl-arrange-vehicle-select"
placeholder="请选择车辆"
filterable
:loading="vehicleLoading"
@change="handleVehicleChange"
>
<el-option
v-for="v in vehicleList"
:key="v.id"
:label="formatPlVehiclePlateDisplay(v.licensePlate, v.trailerNo)"
:value="v.id"
/>
</el-select>
<el-button
link
type="primary"
class="pl-arrange-vehicle-view-btn"
:disabled="!formData.vehicleId || !vehicleBundle"
@click="vehicleViewVisible = true"
>
<el-icon><View /></el-icon>查看
</el-button>
</div>
</el-form-item>
<el-form-item label="选择司机" prop="driverId">
<el-select
@@ -88,19 +99,13 @@
<el-option v-for="c in carrierList" :key="c.id" :label="c.carrierName" :value="c.id" />
</el-select>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="formData.remark" placeholder="请输入备注" />
</el-form-item>
</div>
<PlVehicleSummaryStrip
v-if="vehicleBundle"
:detail="vehicleBundle.detail"
:personnel-list="vehicleBundle.personnelList"
:carrier-name="summaryCarrierName"
@view="vehicleViewVisible = true"
/>
<div class="pl-plan-logistics-row">
<div class="pl-plan-logistics-block">
<h4 class="pl-plan-subtitle">取货信息</h4>
<div class="pl-plan-logistics-fields">
<el-form-item label="取货地址" class="pl-logistics-address-item">
<PlAddressWithLibrary
@@ -149,7 +154,6 @@
</div>
<div class="pl-plan-logistics-block">
<h4 class="pl-plan-subtitle">送货信息</h4>
<div class="pl-plan-logistics-fields">
<el-form-item label="送货地址" class="pl-logistics-address-item">
<PlAddressWithLibrary
@@ -177,19 +181,9 @@
</div>
</div>
<h4 class="pl-plan-subtitle">安排项</h4>
<div class="form-grid-4">
<el-form-item label="运输介质" class="pl-arrange-medium-item">
<el-input :model-value="transportMediumText" readonly placeholder="—" />
</el-form-item>
<el-form-item label="备注" class="pl-arrange-remark-item">
<el-input v-model="formData.remark" placeholder="请输入备注" />
</el-form-item>
</div>
<div class="pl-arrange-dibang-row">
<span class="pl-arrange-dibang-label">
是否生成地磅单
生成地磅单
<span v-if="dibangPlanDisabledTip" class="form-label-tip">{{ dibangPlanDisabledTip }}</span>
</span>
<el-tooltip v-if="dibangPlanDisabledTip" :content="dibangPlanDisabledTip" placement="top">
@@ -197,13 +191,10 @@
</el-tooltip>
<el-checkbox v-else v-model="formData.generateDibangPlan">生成地磅单</el-checkbox>
<p
v-if="planSupportsSiteInventory || showDibangHint || (isRearrange && (hasHistoricalDibang || hasHistoricalSiteLinks))"
v-if="showDibangHint || hasHistoricalDibang || (isRearrange && hasHistoricalSiteLinks && planSupportsSiteInventory)"
class="pl-arrange-dibang-hint"
>
<template v-if="planSupportsSiteInventory && !showDibangHint && !hasHistoricalDibang">
入库/出库安排运输时将自动生成工厂现场链接(与是否勾选地磅单无关),不会在地磅出入库管理中产生记录。
</template>
<template v-else-if="hasHistoricalDibang && formData.generateDibangPlan">
<template v-if="hasHistoricalDibang && formData.generateDibangPlan">
将作废本运输单此前待处理的地磅出入库单,并按当前计划产品重新进行地磅单生成;已关联磅单或已完成的单据不会被自动作废,需先在地磅管理中处理。
</template>
<template v-else-if="hasHistoricalDibang">
@@ -323,7 +314,7 @@
</template>
<script setup lang="ts">
import { Check, Close, CopyDocument, Printer } from '@element-plus/icons-vue'
import { Check, Close, CopyDocument, Printer, View } from '@element-plus/icons-vue'
import {
carrierApi,
planApi,
@@ -342,7 +333,6 @@ import PlInboundSlipPrintDialog from '@/components/business/pl-inbound-slip-prin
import PlDeliverySlipPrintDialog from '@/components/business/pl-delivery-slip-print-dialog/index.vue'
import PlSubpackSlipPrintDialog from '@/components/business/pl-subpack-slip-print-dialog/index.vue'
import PlAddressWithLibrary from '@/components/business/pl-address-with-library/index.vue'
import PlVehicleSummaryStrip from '@/components/business/pl-vehicle-summary-strip/index.vue'
import PlVehicleViewDialog from '@/components/business/pl-vehicle-view-dialog/index.vue'
import PlPlanViewTabs from '@/components/business/pl-plan-view-tabs/index.vue'
import type { PlanFormProductRow } from '@/composables/usePlContractToPlan'
@@ -357,6 +347,7 @@ import { pickBxData, pickBxList } from '@/utils/http/bx'
import { canPrintInboundSlip } from '@/utils/pl-inbound-slip-template'
import { canPrintDeliverySlip } from '@/utils/pl-delivery-slip-template'
import { canPrintSubpackSlip } from '@/utils/pl-subpack-slip-template'
import { formatPlVehiclePlateDisplay } from '@/utils/pl-display'
const dictStore = useDictStore()
@@ -507,11 +498,6 @@ const freightCalc = usePlFreightCalc({
const selectedVehicle = computed(() => vehicleList.value.find(item => item.id === formData.vehicleId))
const summaryCarrierName = computed(() => {
const carrier = carrierList.value.find(item => item.id === formData.carrierId)
return carrier?.carrierName || vehicleBundle.value?.detail?.carrierName || ''
})
const showDibangHint = computed(
() => formData.generateDibangPlan && canGenerateDibangPlan.value
)
@@ -910,17 +896,6 @@ function handlePrintSubpackSlip() {
margin-bottom: 12px;
}
.pl-plan-subtitle {
margin: 16px 0 10px;
font-size: 13px;
font-weight: 600;
color: #475569;
}
.pl-plan-subtitle:first-of-type {
margin-top: 0;
}
.pl-plan-logistics-fields {
display: flex;
flex-direction: column;
@@ -995,12 +970,25 @@ function handlePrintSubpackSlip() {
border-radius: 8px;
background: #f8fafc;
.pl-plan-subtitle {
margin: 0 0 8px;
:deep(.el-form-item) {
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 0;
}
:deep(.el-form-item) {
margin-bottom: 0;
:deep(.el-form-item__label) {
width: auto !important;
flex: 0 0 auto;
padding-right: 8px;
text-align: left !important;
justify-content: flex-start !important;
}
:deep(.el-form-item__content) {
flex: 1;
min-width: 0;
margin-left: 0 !important;
}
}
@@ -1064,8 +1052,8 @@ function handlePrintSubpackSlip() {
padding-left: 10px;
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #1ca851;
color: var(--section-bar-title-color, var(--primary-dark, #059669));
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
line-height: 1;
}
@@ -1081,11 +1069,29 @@ function handlePrintSubpackSlip() {
padding-left: 10px;
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #1ca851;
color: var(--section-bar-title-color, var(--primary-dark, #059669));
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
line-height: 1;
}
.pl-arrange-vehicle-field {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
}
.pl-arrange-vehicle-select {
flex: 1;
min-width: 0;
}
.pl-arrange-vehicle-view-btn {
flex-shrink: 0;
margin: 0;
padding: 0 4px;
}
.pl-arrange-dibang-row {
display: flex;
align-items: center;
@@ -1111,11 +1117,6 @@ function handlePrintSubpackSlip() {
min-width: 0;
}
.pl-arrange-medium-item,
.pl-arrange-remark-item {
grid-column: span 2;
}
.pl-arrange-success {
display: flex;
flex-direction: column;
@@ -0,0 +1,165 @@
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<el-dialog
v-model="innerVisible"
:title="dialogTitle"
width="640px"
align-center
destroy-on-close
append-to-body
class="dialog-form-layout pl-plan-driver-feedback-dialog"
modal-class="order-module-dialog-mask"
:close-on-click-modal="false"
style="backdrop-filter: none"
@closed="handleClosed"
@opened="handleOpened"
>
<el-form
ref="formRef"
:model="formData"
label-position="top"
class="form-grid-2"
>
<el-form-item label="回传时间">
<el-date-picker
v-model="formData.feedbackTime"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="不填则保存为当前时间"
style="width: 100%"
clearable
/>
</el-form-item>
<el-form-item label="回传数量">
<el-input-number
v-model="formData.feedbackQty"
:min="0"
:precision="3"
placeholder="回传数量"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="回传备注" class="form-col-span-2">
<el-input
v-model="formData.feedbackRemark"
type="textarea"
:rows="3"
maxlength="500"
show-word-limit
placeholder="回传备注"
/>
</el-form-item>
<el-form-item label="回传附件" class="form-col-span-2">
<AttachmentUploadField
v-model="formData.feedbackImages"
folder="pl/transport/feedback"
accept="image/*,video/*,.pdf"
:limit="15"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="innerVisible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">
<el-icon><Check /></el-icon>保存
</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { Check, Close } from '@element-plus/icons-vue'
import type { FormInstance } from 'element-plus'
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
import { planApi, type PlanDriverFeedbackUpdateBody } from '@/api/pl'
import { parsePlFeedbackImages } from '@/utils/pl-display'
const props = defineProps<{
visible: boolean
planId: string
isEdit?: boolean
feedbackQty?: number | null
feedbackRemark?: string | null
feedbackImages?: string | string[] | null
feedbackTime?: string | null
}>()
const emit = defineEmits<{
'update:visible': [value: boolean]
success: []
}>()
const innerVisible = computed({
get: () => props.visible,
set: value => emit('update:visible', value)
})
const formRef = ref<FormInstance>()
const submitLoading = ref(false)
const formData = reactive({
feedbackTime: '' as string,
feedbackQty: undefined as number | undefined,
feedbackRemark: '',
feedbackImages: ''
})
const dialogTitle = computed(() => (props.isEdit ? '编辑司机回传信息' : '补充司机回传信息'))
function resetForm() {
formData.feedbackTime = props.feedbackTime ? String(props.feedbackTime) : ''
formData.feedbackQty =
props.feedbackQty != null && props.feedbackQty !== undefined
? Number(props.feedbackQty)
: undefined
formData.feedbackRemark = props.feedbackRemark ? String(props.feedbackRemark) : ''
const images = parsePlFeedbackImages(props.feedbackImages)
formData.feedbackImages = images.length ? images.join(',') : ''
}
function handleOpened() {
resetForm()
}
function handleClosed() {
formRef.value?.resetFields()
}
async function handleSubmit() {
if (!props.planId) return
submitLoading.value = true
try {
const imageList = formData.feedbackImages
? formData.feedbackImages.split(',').map(item => item.trim()).filter(Boolean)
: []
const body: PlanDriverFeedbackUpdateBody = {
feedbackQty: formData.feedbackQty ?? null,
feedbackRemark: formData.feedbackRemark.trim() || null,
feedbackImages: imageList,
feedbackTime: formData.feedbackTime || null
}
await planApi.updateDriverFeedback(props.planId, body)
ElMessage.success('司机回传信息已保存')
emit('success')
innerVisible.value = false
} catch (e: unknown) {
const message = e instanceof Error ? e.message : '保存失败'
ElMessage.error(message)
} finally {
submitLoading.value = false
}
}
</script>
<style scoped lang="scss">
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 8px;
}
</style>
@@ -84,6 +84,17 @@
</template>
</section>
<section class="pl-plan-form-section">
<h3 class="pl-plan-form-section-title">产品信息</h3>
<PlPlanFormProductTable
:products="formData.products"
show-delete
editable-remark
editable-qty
@remove="handleRemoveProduct"
/>
</section>
<section class="pl-plan-form-section">
<h3 class="pl-plan-form-section-title">运输信息</h3>
<el-form :model="formData" label-position="right" label-width="100px" class="pl-dialog-form">
@@ -199,61 +210,9 @@
</div>
</div>
</div>
<div class="pl-plan-freight-section">
<h4 class="pl-plan-subtitle">运费信息</h4>
<div class="form-grid-4">
<el-form-item label="是否有运输费用">
<el-switch v-model="formData.hasFreight" :active-value="1" :inactive-value="0" />
</el-form-item>
<template v-if="formData.hasFreight === 1">
<el-form-item label="运输公里数">
<el-input-number v-model="formData.distanceKm" :min="0" :precision="2" style="width: 100%" />
</el-form-item>
<el-form-item label="运费计算方式">
<el-select v-model="formData.freightType">
<el-option label="按重量" value="by_weight" />
<el-option label="按趟" value="by_trip" />
</el-select>
</el-form-item>
<el-form-item v-if="formData.freightType === 'by_weight'" :label="`运输量(${freightUnitLabel})`">
<el-input-number
v-model="freightCalc.transportQty.value"
:min="0"
:precision="3"
style="width: 100%"
@change="freightCalc.markTransportQtyTouched()"
/>
</el-form-item>
<el-form-item v-if="formData.freightType === 'by_weight'" :label="`运输单价(元/${freightUnitLabel})`">
<el-input-number v-model="freightCalc.freightPrice.value" :min="0" :precision="2" style="width: 100%" />
</el-form-item>
<el-form-item label="运费金额(元)">
<el-input-number
v-model="freightCalc.freightAmount.value"
:min="0"
:precision="2"
style="width: 100%"
@change="freightCalc.markFreightAmountTouched()"
/>
</el-form-item>
</template>
</div>
</div>
</el-form>
</section>
<section class="pl-plan-form-section">
<h3 class="pl-plan-form-section-title">产品信息</h3>
<PlPlanFormProductTable
:products="formData.products"
show-delete
editable-remark
editable-qty
@remove="handleRemoveProduct"
/>
</section>
<section class="pl-plan-form-section">
<h3 class="pl-plan-form-section-title">备注</h3>
<el-input v-model="formData.remark" type="textarea" :rows="3" placeholder="请输入备注" />
@@ -271,7 +230,12 @@
</div>
</template>
<ContractSelector v-model:visible="contractSelectorVisible" hide-amount @confirm="handleContractConfirm" />
<ContractSelector
v-model:visible="contractSelectorVisible"
hide-amount
:selectable-statuses="planSelectableContractStatuses"
@confirm="handleContractConfirm"
/>
<ContractDetailDialog v-if="contractDetailDialogActive" ref="contractDetailRef" hide-product-price />
<PlVehicleViewDialog
v-model:visible="vehicleViewVisible"
@@ -299,18 +263,20 @@ import {
type PlanFormProductRow
} from '@/composables/usePlContractToPlan'
import { enrichPlanProductsHazardFromCrm } from '@/composables/usePlToxicProductCertCheck'
import { usePlFreightCalc, resolveFreightUnitLabel } from '@/composables/usePlFreightCalc'
import { usePlFreightCalc } from '@/composables/usePlFreightCalc'
import { loadVehicleViewBundle, type VehicleViewBundle } from '@/composables/usePlVehicleViewDetail'
import { useDictStore } from '@/store/modules/dict'
import { useUserStore } from '@/store/modules/user'
import { formatDate } from '@/utils/format'
import { pickBxList } from '@/utils/http/bx'
import { formatMoneyDisplay } from '@/utils/money-format'
const ContractDetailDialog = defineAsyncComponent(
() => import('@/views/crm/contract/components/ContractDetailDialog.vue')
)
/** 运输计划仅允许关联已审批、执行中的合同 */
const planSelectableContractStatuses = ['approved', 'executing']
const props = defineProps<{
visible: boolean
planId?: string
@@ -424,11 +390,6 @@ const freightCalc = usePlFreightCalc({
freightType: freightTypeRef
})
const freightUnitLabel = computed(() => {
const unitCode = resolveFreightUnitLabel(formData.products)
return dictStore.getLabel('crm_product_unit', unitCode) || unitCode || '吨'
})
const selectedVehicle = computed(() => vehicleList.value.find(item => item.id === formData.vehicleId))
const summaryCarrierName = computed(() => {
@@ -926,21 +887,6 @@ function validateBusinessRules() {
ElMessage.warning('请至少保留一条产品明细')
return false
}
if (formData.vehicleId && formData.hasFreight === 1) {
if (formData.freightType === 'by_weight') {
if (!freightCalc.freightPrice.value || freightCalc.freightPrice.value <= 0) {
ElMessage.warning('按重量计费时请填写运输单价')
return false
}
if (!freightCalc.transportQty.value || freightCalc.transportQty.value <= 0) {
ElMessage.warning('运输量须大于0,请填写产品实际数量或手动输入运输量')
return false
}
} else if (!freightCalc.freightAmount.value || freightCalc.freightAmount.value <= 0) {
ElMessage.warning('按趟计费时请填写运费金额')
return false
}
}
return true
}
@@ -1004,8 +950,8 @@ async function handleSubmit() {
padding-left: 10px;
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #1ca851;
color: var(--section-bar-title-color, var(--primary-dark, #059669));
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
line-height: 1;
}
@@ -1020,17 +966,6 @@ async function handleSubmit() {
color: #1e293b;
}
.pl-plan-freight-section {
.pl-plan-subtitle {
margin-top: 16px;
}
:deep(.el-form-item__label) {
width: 140px !important;
max-width: 140px;
}
}
.pl-plan-form-empty-hint,
.text-muted {
margin: 0 0 8px;
@@ -8,10 +8,8 @@
:key="product.id || `${product.productNo}-${index}`"
class="pl-plan-hazard-cert-view-table__block"
>
<div class="pl-plan-hazard-cert-view-table__head">
<span class="pl-plan-hazard-cert-view-table__index">{{ index + 1 }}.</span>
<PlProductNameHazardCell :product="product" />
</div>
<span class="pl-plan-hazard-cert-view-table__index">{{ index + 1 }}.</span>
<PlProductNameHazardCell class="pl-plan-hazard-cert-view-table__product" :product="product" />
<div class="pl-plan-hazard-cert-view-table__slots">
<div
v-for="slot in getRequiredCertSlots(product)"
@@ -23,7 +21,6 @@
<AttachmentUploadField
:model-value="getProductCertUrl(product, slot.key)"
disabled
compact
/>
</div>
<span v-else class="pl-plan-hazard-cert-view-table__missing">未上传</span>
@@ -64,66 +61,81 @@ withDefaults(
}
.pl-plan-hazard-cert-view-table__block {
padding: 16px;
display: flex;
align-items: flex-start;
flex-wrap: wrap;
gap: 10px 16px;
padding: 14px 16px;
border: 1px solid var(--border, #d9e8e2);
border-radius: 10px;
background: #fff;
}
.pl-plan-hazard-cert-view-table__head {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 12px;
}
.pl-plan-hazard-cert-view-table__index {
flex-shrink: 0;
color: var(--mint-text);
font-size: 13px;
}
.pl-plan-hazard-cert-view-table__product {
flex: 0 1 auto;
min-width: 0;
}
.pl-plan-hazard-cert-view-table__slots {
display: flex;
align-items: flex-start;
flex-wrap: wrap;
gap: 16px;
gap: 12px 20px;
}
.pl-plan-hazard-cert-view-table__slot {
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
min-width: 120px;
display: inline-flex;
align-items: flex-start;
gap: 8px;
}
.pl-plan-hazard-cert-view-table__label {
flex-shrink: 0;
color: var(--mint-text);
font-size: 12px;
font-size: 13px;
line-height: 1.4;
text-align: center;
white-space: nowrap;
}
.pl-plan-hazard-cert-view-table__attachment {
display: inline-flex;
justify-content: center;
width: 100%;
flex-shrink: 0;
:deep(.attachment-upload) {
width: auto;
}
:deep(.attachment-list) {
justify-content: center;
gap: 0;
}
:deep(.attachment-item) {
width: 140px;
margin-bottom: 0;
border-radius: 8px;
}
:deep(.attachment-preview) {
height: 96px;
}
:deep(.attachment-footer) {
display: none;
}
}
.pl-plan-hazard-cert-view-table__missing {
display: flex;
display: inline-flex;
align-items: center;
justify-content: center;
width: 96px;
height: 56px;
width: 140px;
height: 96px;
border: 1px dashed var(--border, #d9e8e2);
border-radius: 8px;
background: var(--table-head, #f8fafc);
@@ -9,7 +9,7 @@
:key="product.id || `${product.productNo}-${index}`"
class="pl-plan-list-cert-cell__group"
>
<div class="pl-plan-list-cert-cell__product">
<div v-if="!hideProduct" class="pl-plan-list-cert-cell__product">
<span class="pl-plan-list-cert-cell__name">{{ product.productName || '—' }}</span>
<el-tag v-if="product.isToxic" type="warning" size="small">
{{ useShortHazardTag ? '毒' : '易制毒' }}
@@ -19,7 +19,7 @@
</el-tag>
</div>
<div
v-if="compact"
v-if="compact && !clickable"
class="pl-plan-list-cert-cell__certs pl-plan-list-cert-cell__certs--text"
>
<span
@@ -27,9 +27,58 @@
:key="slot.key"
class="pl-plan-list-cert-cell__cert-text"
>
{{ slot.label }}({{ isProductCertSlotFilled(product, slot.key) ? '有' : '无' }})
{{ slot.label }}(<span
:class="{ 'pl-plan-list-cert-cell__cert-status--missing': !isProductCertSlotFilled(product, slot.key) }"
>{{ isProductCertSlotFilled(product, slot.key) ? '有' : '无' }}</span>)
</span>
</div>
<div
v-else-if="clickable"
class="pl-plan-list-cert-cell__certs pl-plan-list-cert-cell__certs--clickable"
>
<div
v-for="slot in getRequiredCertSlots(product)"
:key="slot.key"
class="pl-plan-list-cert-cell__cert-item"
:class="{ 'is-disabled': clickableDisabled }"
role="button"
:tabindex="clickableDisabled ? -1 : 0"
@click="handleCertClick"
@keyup.enter="handleCertClick"
>
<div
class="pl-plan-list-cert-cell__thumb"
:class="{
'pl-plan-list-cert-cell__thumb--empty': !getProductCertUrl(product, slot.key),
'pl-plan-list-cert-cell__thumb--filled': getProductCertUrl(product, slot.key)
}"
>
<template v-if="getProductCertUrl(product, slot.key)">
<img
v-if="isCertImageUrl(getProductCertUrl(product, slot.key))"
:src="resolveCertFileUrl(getProductCertUrl(product, slot.key))"
:alt="slot.label"
/>
<div
v-else
class="pl-plan-list-cert-cell__thumb-icon"
:class="
isCertPdfUrl(getProductCertUrl(product, slot.key))
? 'pl-plan-list-cert-cell__thumb-icon--pdf'
: 'pl-plan-list-cert-cell__thumb-icon--doc'
"
>
<el-icon :size="20"><Document /></el-icon>
</div>
<span class="pl-plan-list-cert-cell__cert-caption">{{ slot.label }}</span>
</template>
<template v-else>
<el-icon :size="18"><Upload /></el-icon>
<span class="pl-plan-list-cert-cell__upload-hint">上传{{ slot.label }}</span>
</template>
</div>
</div>
</div>
<div v-else class="pl-plan-list-cert-cell__certs">
<div
v-for="slot in getRequiredCertSlots(product)"
@@ -52,6 +101,7 @@
<script setup lang="ts">
import { computed } from 'vue'
import { Document, Upload } from '@element-plus/icons-vue'
import type { PlanProduct } from '@/api/pl'
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
import {
@@ -66,19 +116,60 @@ const props = withDefaults(
products?: PlanProduct[]
/** 列表紧凑模式:文字展示证书有无,不显示缩略图 */
compact?: boolean
/** 隐藏产品名称行(产品信息由独立列展示时使用) */
hideProduct?: boolean
/** 缩略图模式,点击触发上传 */
clickable?: boolean
/** 禁止点击上传(仍展示缩略图) */
clickableDisabled?: boolean
/** 危化标签短文案:毒 / 爆 */
shortHazardTag?: boolean
}>(),
{
products: () => [],
compact: false,
hideProduct: false,
clickable: false,
clickableDisabled: false,
shortHazardTag: false
}
)
const emit = defineEmits<{
click: []
}>()
const useShortHazardTag = computed(() => props.compact || props.shortHazardTag)
const hazardProducts = computed(() => (props.products || []).filter(product => isHazardProduct(product)))
function resolveCertFileUrl(url: string) {
const trimmed = String(url || '').trim()
if (!trimmed) return ''
if (/^https?:\/\//i.test(trimmed)) return trimmed
const base = String(import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
return base ? `${base}/${trimmed.replace(/^\//, '')}` : trimmed
}
function getCertFileName(url: string) {
return String(url || '').trim().split('/').pop() || ''
}
function isCertImageUrl(url: string) {
const name = getCertFileName(url).toLowerCase()
return /\.(png|jpe?g|gif|webp|bmp|svg)(\?|$)/i.test(name)
}
function isCertPdfUrl(url: string) {
const name = getCertFileName(url).toLowerCase()
const normalized = String(url || '').toLowerCase()
return /\.pdf(\?|$)/i.test(name) || /\.pdf(\?|$)/i.test(normalized)
}
function handleCertClick() {
if (props.clickableDisabled) return
emit('click')
}
</script>
<style scoped lang="scss">
@@ -118,7 +209,6 @@ const hazardProducts = computed(() => (props.products || []).filter(product => i
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
width: 96px;
}
@@ -142,6 +232,92 @@ const hazardProducts = computed(() => (props.products || []).filter(product => i
font-size: 12px;
}
.pl-plan-list-cert-cell__certs--clickable {
.pl-plan-list-cert-cell__cert-item {
cursor: pointer;
&:hover:not(.is-disabled) .pl-plan-list-cert-cell__thumb {
border-color: var(--primary, #10b981);
box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.12);
}
&.is-disabled {
cursor: not-allowed;
opacity: 0.72;
}
}
}
.pl-plan-list-cert-cell__thumb {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 96px;
height: 56px;
overflow: hidden;
border: 1px solid var(--border, #d9e8e2);
border-radius: 8px;
background: #fff;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.pl-plan-list-cert-cell__thumb--filled {
align-items: stretch;
}
.pl-plan-list-cert-cell__cert-caption {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 2px 4px;
background: rgba(15, 23, 42, 0.62);
color: #fff;
font-size: 11px;
line-height: 1.3;
text-align: center;
word-break: keep-all;
}
.pl-plan-list-cert-cell__thumb--empty {
flex-direction: column;
gap: 2px;
border-style: dashed;
background: var(--table-head, #f8fafc);
color: var(--mint-text);
font-size: 11px;
}
.pl-plan-list-cert-cell__upload-hint {
max-width: 88px;
line-height: 1.3;
text-align: center;
word-break: keep-all;
}
.pl-plan-list-cert-cell__thumb-icon {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
color: #64748b;
}
.pl-plan-list-cert-cell__thumb-icon--pdf {
color: #dc2626;
}
.pl-plan-list-cert-cell__thumb-icon--doc {
color: #2563eb;
}
.pl-plan-list-cert-cell__empty {
color: var(--mint-text);
}
@@ -179,9 +355,10 @@ const hazardProducts = computed(() => (props.products || []).filter(product => i
}
.pl-plan-list-cert-cell__certs--text {
flex-direction: column;
align-items: flex-start;
gap: 2px;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
gap: 8px;
}
.pl-plan-list-cert-cell__cert-text {
@@ -190,5 +367,10 @@ const hazardProducts = computed(() => (props.products || []).filter(product => i
line-height: 1.4;
white-space: nowrap;
}
.pl-plan-list-cert-cell__cert-status--missing {
color: var(--danger, #dc2626);
font-weight: 500;
}
}
</style>
@@ -5,23 +5,20 @@
:key="product.id || `${product.productNo}-${index}`"
class="pl-plan-list-product-cell__row"
>
<span class="pl-plan-list-product-cell__index">{{ index + 1 }}.</span>
<div class="pl-plan-list-product-cell__content">
<span class="pl-plan-list-product-cell__line">
<span class="pl-plan-list-product-cell__text">{{ formatProductLine(product) }}</span>
<el-tag v-if="getHazardFlags(product).isToxic" type="warning" size="small" class="pl-plan-list-product-cell__mark">
毒
</el-tag>
<el-tag
v-if="getHazardFlags(product).isExplosive"
type="danger"
size="small"
class="pl-plan-list-product-cell__mark"
>
爆
</el-tag>
</span>
<div
<span class="pl-plan-list-product-cell__line">
<span class="pl-plan-list-product-cell__text">{{ formatProductLine(product) }}</span>
<el-tag v-if="getHazardFlags(product).isToxic" type="warning" size="small" class="pl-plan-list-product-cell__mark">
毒
</el-tag>
<el-tag
v-if="getHazardFlags(product).isExplosive"
type="danger"
size="small"
class="pl-plan-list-product-cell__mark"
>
爆
</el-tag>
<span
v-if="showCertStatus && isHazardProduct(product)"
class="pl-plan-list-product-cell__certs"
>
@@ -29,12 +26,13 @@
v-for="slot in getRequiredCertSlots(product)"
:key="slot.key"
class="pl-plan-list-product-cell__cert-text"
:class="{ 'pl-plan-list-product-cell__cert-text--missing': !isProductCertSlotFilled(product, slot.key) }"
>
{{ slot.label }}({{ isProductCertSlotFilled(product, slot.key) ? '有' : '无' }})
{{ slot.label }}(<span
:class="{ 'pl-plan-list-product-cell__cert-status--missing': !isProductCertSlotFilled(product, slot.key) }"
>{{ isProductCertSlotFilled(product, slot.key) ? '有' : '无' }}</span>)
</span>
</div>
</div>
</span>
</span>
</div>
</div>
<span v-else class="pl-plan-list-product-cell__empty">—</span>
@@ -89,36 +87,18 @@ function getHazardFlags(product: PlanProduct) {
}
.pl-plan-list-product-cell__row {
display: flex;
flex-direction: row;
align-items: flex-start;
gap: 4px;
width: 100%;
min-width: 0;
}
.pl-plan-list-product-cell__index {
flex-shrink: 0;
min-width: 1.25em;
font-size: 13px;
line-height: 1.5;
color: var(--mint-text);
text-align: right;
}
.pl-plan-list-product-cell__content {
flex: 1;
min-width: 0;
}
.pl-plan-list-product-cell__line {
display: flex;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
gap: 4px;
width: 100%;
max-width: 100%;
flex: 1;
min-width: 0;
font-size: 13px;
line-height: 1.5;
color: var(--text, #1e293b);
@@ -135,15 +115,11 @@ function getHazardFlags(product: PlanProduct) {
}
.pl-plan-list-product-cell__certs {
display: flex;
flex-direction: row;
display: inline-flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-start;
gap: 0;
width: 100%;
margin-top: 2px;
text-align: left;
gap: 8px;
margin-left: 4px;
}
.pl-plan-list-product-cell__cert-text {
@@ -151,11 +127,11 @@ function getHazardFlags(product: PlanProduct) {
font-size: 12px;
line-height: 1.4;
white-space: nowrap;
}
&--missing {
color: var(--danger, #dc2626);
font-weight: 500;
}
.pl-plan-list-product-cell__cert-status--missing {
color: var(--danger, #dc2626);
font-weight: 500;
}
.pl-plan-list-product-cell__empty {
@@ -0,0 +1,159 @@
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<el-dialog
v-model="innerVisible"
:title="dialogTitle"
width="640px"
align-center
destroy-on-close
append-to-body
class="dialog-form-layout pl-plan-site-feedback-dialog"
modal-class="order-module-dialog-mask"
:close-on-click-modal="false"
style="backdrop-filter: none"
@closed="handleClosed"
@opened="handleOpened"
>
<p v-if="productName" class="pl-plan-site-feedback-dialog__product">{{ productName }}</p>
<el-form
ref="formRef"
:model="formData"
label-position="top"
class="form-grid-2"
>
<el-form-item label="保存时间" class="form-col-span-2">
<el-date-picker
v-model="formData.siteFeedbackTime"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="不填则保存为当前时间"
style="width: 100%"
clearable
/>
</el-form-item>
<el-form-item label="现场备注" class="form-col-span-2">
<el-input
v-model="formData.siteFeedbackRemark"
type="textarea"
:rows="3"
maxlength="500"
show-word-limit
placeholder="现场备注"
/>
</el-form-item>
<el-form-item label="现场附件" class="form-col-span-2">
<AttachmentUploadField
v-model="formData.siteFeedbackImages"
folder="pl/transport/site-feedback"
accept="image/*,video/*,.pdf"
:limit="15"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="innerVisible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">
<el-icon><Check /></el-icon>保存
</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { Check, Close } from '@element-plus/icons-vue'
import type { FormInstance } from 'element-plus'
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
import { planApi, type PlanSiteFeedbackUpdateBody } from '@/api/pl'
const props = defineProps<{
visible: boolean
planId: string
linkId: string
productName?: string
isEdit?: boolean
siteFeedbackRemark?: string | null
siteFeedbackImages?: string[] | null
siteFeedbackTime?: string | null
}>()
const emit = defineEmits<{
'update:visible': [value: boolean]
success: []
}>()
const innerVisible = computed({
get: () => props.visible,
set: value => emit('update:visible', value)
})
const formRef = ref<FormInstance>()
const submitLoading = ref(false)
const formData = reactive({
siteFeedbackTime: '' as string,
siteFeedbackRemark: '',
siteFeedbackImages: ''
})
const dialogTitle = computed(() => (props.isEdit ? '编辑现场回传信息' : '补充现场回传信息'))
function resetForm() {
formData.siteFeedbackTime = props.siteFeedbackTime ? String(props.siteFeedbackTime) : ''
formData.siteFeedbackRemark = props.siteFeedbackRemark ? String(props.siteFeedbackRemark) : ''
const images = Array.isArray(props.siteFeedbackImages)
? props.siteFeedbackImages.filter(Boolean)
: []
formData.siteFeedbackImages = images.length ? images.join(',') : ''
}
function handleOpened() {
resetForm()
}
function handleClosed() {
formRef.value?.resetFields()
}
async function handleSubmit() {
if (!props.planId || !props.linkId) return
submitLoading.value = true
try {
const imageList = formData.siteFeedbackImages
? formData.siteFeedbackImages.split(',').map(item => item.trim()).filter(Boolean)
: []
const body: PlanSiteFeedbackUpdateBody = {
siteFeedbackRemark: formData.siteFeedbackRemark.trim() || null,
siteFeedbackImages: imageList,
siteFeedbackTime: formData.siteFeedbackTime || null
}
await planApi.updateSiteFeedback(props.planId, props.linkId, body)
ElMessage.success('现场回传信息已保存')
emit('success')
innerVisible.value = false
} catch (e: unknown) {
const message = e instanceof Error ? e.message : '保存失败'
ElMessage.error(message)
} finally {
submitLoading.value = false
}
}
</script>
<style scoped lang="scss">
.pl-plan-site-feedback-dialog__product {
margin: 0 0 12px;
font-size: 13px;
color: var(--el-text-color-secondary);
}
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 8px;
}
</style>
@@ -114,7 +114,18 @@
<ViewKvTable :fields="freightViewFields" mode="quad" />
<div class="pl-plan-feedback-region">
<h4 class="pl-plan-feedback-region__title">司机回传信息</h4>
<div class="pl-plan-feedback-region__head">
<h4 class="pl-plan-feedback-region__title">司机回传信息</h4>
<el-button
v-if="feedbackEditable"
class="btn-op-item"
:disabled="!canEditDriverFeedback"
@click="openDriverFeedbackDialog"
>
<el-icon><Edit /></el-icon>
{{ hasDriverFeedback ? '编辑' : '补充' }}
</el-button>
</div>
<p v-if="!hasDriverFeedback" class="pl-plan-form-empty-hint">暂无司机回传</p>
<div v-else class="view-subtable-wrap">
<el-table :data="driverFeedbackTableRows" class="view-subtable list-table" stripe>
@@ -213,12 +224,20 @@
</el-table-column>
<el-table-column
label="操作"
min-width="120"
min-width="240"
align="center"
fixed="right"
class-name="col-actions"
>
<template #default="{ row }">
<el-button
v-if="feedbackEditable"
class="btn-op-item"
@click="openSiteFeedbackDialog(row)"
>
<el-icon><Edit /></el-icon>
{{ rowHasSiteFeedback(row) ? '编辑' : '补充' }}
</el-button>
<el-button class="btn-op-item" @click="copySiteSummaryForRow(row.sourceRow)">
<el-icon><CopyDocument /></el-icon>
复制给现场
@@ -414,6 +433,28 @@
</el-tabs>
<ContractDetailDialog v-if="contractDetailDialogActive" ref="contractDetailRef" hide-product-price />
<PlPlanDriverFeedbackDialog
v-model:visible="driverFeedbackDialogVisible"
:plan-id="planId"
:is-edit="hasDriverFeedback"
:feedback-qty="transport?.feedbackQty"
:feedback-remark="transport?.feedbackRemark"
:feedback-images="transport?.feedbackImages"
:feedback-time="transport?.feedbackTime"
@success="handleFeedbackSaved"
/>
<PlPlanSiteFeedbackDialog
v-if="siteFeedbackTarget"
v-model:visible="siteFeedbackDialogVisible"
:plan-id="planId"
:link-id="siteFeedbackTarget.linkId"
:product-name="siteFeedbackTarget.productName"
:is-edit="siteFeedbackTarget.isEdit"
:site-feedback-remark="siteFeedbackTarget.siteFeedbackRemark"
:site-feedback-images="siteFeedbackTarget.siteFeedbackImages"
:site-feedback-time="siteFeedbackTarget.siteFeedbackTime"
@success="handleFeedbackSaved"
/>
<PlVehicleViewDialog
v-model:visible="vehicleViewVisible"
:vehicle-id="plan?.vehicleId"
@@ -423,10 +464,12 @@
</template>
<script setup lang="ts">
import { CopyDocument, View } from '@element-plus/icons-vue'
import { CopyDocument, Edit, View } from '@element-plus/icons-vue'
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
import PlPlanDriverFeedbackDialog from '@/components/business/pl-plan-driver-feedback-dialog/index.vue'
import PlPlanFormProductTable from '@/components/business/pl-plan-form-dialog/PlPlanFormProductTable.vue'
import PlPlanHazardCertViewTable from '@/components/business/pl-plan-hazard-cert-view-table/index.vue'
import PlPlanSiteFeedbackDialog from '@/components/business/pl-plan-site-feedback-dialog/index.vue'
import PlVehicleSummaryStrip from '@/components/business/pl-vehicle-summary-strip/index.vue'
import PlVehicleViewDialog from '@/components/business/pl-vehicle-view-dialog/index.vue'
import ViewKvTable from '@/components/business/system-view-dialog/ViewKvTable.vue'
@@ -473,12 +516,14 @@
showArrangeLinks?: boolean
arrangeDriverUrl?: string
arrangeSiteRecords?: TransportSiteLink[]
feedbackEditable?: boolean
}>(),
{
embedded: false,
showArrangeLinks: false,
arrangeDriverUrl: '',
arrangeSiteRecords: () => []
arrangeSiteRecords: () => [],
feedbackEditable: false
}
)
@@ -486,6 +531,16 @@
const contractDetailDialogActive = ref(false)
const contractDetailRef = ref<InstanceType<typeof ContractDetailDialog>>()
const vehicleViewVisible = ref(false)
const driverFeedbackDialogVisible = ref(false)
const siteFeedbackDialogVisible = ref(false)
const siteFeedbackTarget = ref<{
linkId: string
productName: string
isEdit: boolean
siteFeedbackRemark?: string | null
siteFeedbackImages?: string[]
siteFeedbackTime?: string | null
} | null>(null)
const {
loading,
plan,
@@ -566,6 +621,55 @@
const siteInventoryRows = computed(() => siteRows.value)
const canEditDriverFeedback = computed(() => Boolean(plan.value?.transportId))
function rowHasSiteFeedback(row: {
siteFeedbackRemark?: string
siteFeedbackImages?: string
siteFeedbackTime?: string
}) {
return Boolean(
(row.siteFeedbackRemark && row.siteFeedbackRemark !== '—') ||
row.siteFeedbackImages ||
(row.siteFeedbackTime && row.siteFeedbackTime !== '—')
)
}
function openDriverFeedbackDialog() {
if (!canEditDriverFeedback.value) {
ElMessage.warning('计划未安排运输,无法编辑司机回传')
return
}
driverFeedbackDialogVisible.value = true
}
function openSiteFeedbackDialog(row: {
sourceRow: PlPlanTransportSiteRow
productName: string
siteFeedbackRemark?: string
siteFeedbackImages?: string
siteFeedbackTime?: string
}) {
const link = row.sourceRow.link
if (!link.siteLinkId) {
ElMessage.error('现场链接数据无效')
return
}
siteFeedbackTarget.value = {
linkId: link.siteLinkId,
productName: row.productName !== '—' ? row.productName : link.productName || '',
isEdit: rowHasSiteFeedback(row),
siteFeedbackRemark: link.siteFeedbackRemark,
siteFeedbackImages: link.siteFeedbackImages,
siteFeedbackTime: link.siteFeedbackTime
}
siteFeedbackDialogVisible.value = true
}
function handleFeedbackSaved() {
reload()
}
const hasArrangeSiteLinks = computed(
() => props.showArrangeLinks && (props.arrangeSiteRecords?.length ?? 0) > 0
)
@@ -884,8 +988,8 @@
padding-left: 10px;
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #1ca851;
color: var(--section-bar-title-color, var(--primary-dark, #059669));
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
line-height: 1;
}
@@ -996,9 +1100,9 @@
padding-left: 10px;
font-size: 14px;
font-weight: 600;
color: var(--text, #1e293b);
color: var(--section-bar-title-color, var(--primary-dark, #059669));
line-height: 1.5;
border-left: 3px solid var(--primary, #1ca851);
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
}
.party-flow-bridge {
@@ -1068,13 +1172,25 @@
background: #f8fafc;
}
.pl-plan-feedback-region__head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.pl-plan-feedback-region__head .pl-plan-feedback-region__title {
margin-bottom: 0;
}
.pl-plan-feedback-region__title {
margin: 0 0 12px;
padding-left: 10px;
font-size: 13px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #1ca851;
color: var(--section-bar-title-color, var(--primary-dark, #059669));
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
line-height: 1;
}
@@ -102,8 +102,8 @@ function getRoleTagType(role: string) {
padding-left: 10px;
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #1ca851;
color: var(--section-bar-title-color, var(--primary-dark, #059669));
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
line-height: 1.4;
}
@@ -166,8 +166,8 @@ watch(
padding-left: 10px;
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #1ca851;
color: var(--section-bar-title-color, var(--primary-dark, #059669));
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
line-height: 1;
}
</style>
@@ -463,8 +463,8 @@
padding-left: 10px;
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #1ca851;
color: var(--section-bar-title-color, var(--primary-dark, #059669));
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
line-height: 1;
}
}
@@ -729,9 +729,9 @@
background: #f8fafc;
}
/* 区块标题:深色字 + 主色竖条(与 OpenSpec ui-conventions 一致,避免被全局 h3 染色) */
/* 区块标题:主色字 + 主色竖条(与 OpenSpec ui-conventions 一致,避免被全局 h3 染色) */
.view-section > h3 {
color: #1e293b;
color: var(--section-bar-title-color, var(--primary-dark, #059669));
font-weight: 600;
letter-spacing: normal;
text-transform: none;