提交
This commit is contained in:
1 parent
6d9354a194
commit
aff71d296b
2759 files changed
+860425
-13211
No files matched your search
@@ -89,8 +89,10 @@ export async function getContract(id: number | string) {
|
||||
return { data: unwrapData(data) as ContractVO }
|
||||
}
|
||||
|
||||
export function addContract(data: ContractForm) {
|
||||
return request.post({ url: BASE, data: stringifyBody(data as Record<string, any>) })
|
||||
export async function addContract(data: ContractForm) {
|
||||
// request 已解包为 data 本体(合同 id);再包一层与 getContract 一致,供调用方读 res.data
|
||||
const id = await request.post({ url: BASE, data: stringifyBody(data as Record<string, any>) })
|
||||
return { data: id }
|
||||
}
|
||||
|
||||
export function updateContract(data: ContractForm) {
|
||||
|
||||
@@ -1591,7 +1591,7 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
/* CRM 新增/编辑弹窗:label 左、控件右,垂直居中,label 可换行 */
|
||||
/* CRM 弹窗表单:默认 label 左、控件右;label-position="top" 时上下布局 */
|
||||
.crm-dialog-form {
|
||||
.el-form-item {
|
||||
align-items: center;
|
||||
@@ -1619,6 +1619,23 @@ body {
|
||||
.el-form-item__content {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* 上下布局:覆盖左右布局的对齐与内边距 */
|
||||
&.el-form--label-top {
|
||||
.el-form-item {
|
||||
display: block;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.el-form-item__label {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding-right: 0;
|
||||
margin-bottom: 4px;
|
||||
align-self: auto;
|
||||
line-height: 1.45 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.el-dialog.dialog-form-layout {
|
||||
|
||||
@@ -35,8 +35,18 @@
|
||||
|
||||
<!-- 联系人列表 -->
|
||||
<div v-if="customerId" class="panel dialog-list-panel">
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
<el-button class="btn-main" type="primary" @click="handleAddContact">
|
||||
<el-icon><Plus /></el-icon>新增
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-body list-wrap dialog-list-body-only">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
:data="contactList"
|
||||
class="list-table"
|
||||
@@ -103,6 +113,8 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<ContactFormDialog ref="contactFormRef" @success="handleContactFormSuccess" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -110,9 +122,10 @@
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import ListPagination from '@/components/ListPagination/index.vue'
|
||||
import { Check, Close, Refresh, Search } from '@element-plus/icons-vue'
|
||||
import ContactFormDialog from '@/views/crm/customer/components/ContactFormDialog.vue'
|
||||
import { Check, Close, Plus, Refresh, Search } from '@element-plus/icons-vue'
|
||||
import { ref, watch } from 'vue'
|
||||
import type { ElFormInstance } from 'element-plus'
|
||||
import type { ElFormInstance, TableInstance } from 'element-plus'
|
||||
import { fetchContactList } from '@/api/crm/contact'
|
||||
import type { ContactQuery, ContactVO } from '@/api/crm/customer'
|
||||
|
||||
@@ -167,6 +180,8 @@ const loading = ref(false)
|
||||
const total = ref(0)
|
||||
const currentContact = ref<ContactVO | null>(null)
|
||||
const queryFormRef = ref<ElFormInstance>()
|
||||
const tableRef = ref<TableInstance>()
|
||||
const contactFormRef = ref<InstanceType<typeof ContactFormDialog>>()
|
||||
|
||||
const resetQueryParams = () => {
|
||||
queryParams.value.pageNum = 1
|
||||
@@ -176,7 +191,7 @@ const resetQueryParams = () => {
|
||||
queryFormRef.value?.resetFields()
|
||||
}
|
||||
|
||||
const getList = async () => {
|
||||
const getList = async (selectId?: string | number) => {
|
||||
if (!props.customerId) {
|
||||
contactList.value = []
|
||||
total.value = 0
|
||||
@@ -196,6 +211,9 @@ const getList = async () => {
|
||||
})
|
||||
contactList.value = res.list || res.rows || []
|
||||
total.value = res.total ?? 0
|
||||
if (selectId) {
|
||||
selectContactById(selectId)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取联系人列表失败:', error)
|
||||
} finally {
|
||||
@@ -203,6 +221,25 @@ const getList = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const selectContactById = (id?: string | number) => {
|
||||
if (!id) return
|
||||
const row = contactList.value.find((item) => String(item.id) === String(id))
|
||||
if (!row) return
|
||||
currentContact.value = row
|
||||
tableRef.value?.setCurrentRow(row)
|
||||
}
|
||||
|
||||
const handleAddContact = () => {
|
||||
if (!props.customerId) return
|
||||
contactFormRef.value?.open(undefined, props.customerId)
|
||||
}
|
||||
|
||||
const handleContactFormSuccess = async (payload?: { id?: string | number }) => {
|
||||
resetQueryParams()
|
||||
queryParams.value.pageNum = 1
|
||||
await getList(payload?.id)
|
||||
}
|
||||
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
|
||||
@@ -62,6 +62,7 @@ import {
|
||||
setupDeliverySlipEditorTypeCheckboxes,
|
||||
type DeliverySlipRenderContext
|
||||
} from '@/utils/pl-delivery-slip-template'
|
||||
import { getPlSlipPdfCanvasScale } from '@/utils/pl-slip-pdf-render'
|
||||
|
||||
const visible = ref(false)
|
||||
const slipContent = ref('')
|
||||
@@ -94,8 +95,7 @@ async function waitForImagesLoaded(container: HTMLElement) {
|
||||
}
|
||||
|
||||
function getPdfCanvasScale() {
|
||||
const dpr = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1
|
||||
return Math.min(4, Math.max(3, dpr * 2))
|
||||
return getPlSlipPdfCanvasScale()
|
||||
}
|
||||
|
||||
async function buildSlipRenderContext(plan: Plan): Promise<DeliverySlipRenderContext> {
|
||||
|
||||
@@ -60,6 +60,7 @@ import {
|
||||
restoreInboundSlipPlaceholders,
|
||||
type InboundSlipRenderContext
|
||||
} from '@/utils/pl-inbound-slip-template'
|
||||
import { getPlSlipPdfCanvasScale } from '@/utils/pl-slip-pdf-render'
|
||||
|
||||
const visible = ref(false)
|
||||
const slipContent = ref('')
|
||||
@@ -92,8 +93,7 @@ async function waitForImagesLoaded(container: HTMLElement) {
|
||||
}
|
||||
|
||||
function getPdfCanvasScale() {
|
||||
const dpr = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1
|
||||
return Math.min(4, Math.max(3, dpr * 2))
|
||||
return getPlSlipPdfCanvasScale()
|
||||
}
|
||||
|
||||
async function buildSlipRenderContext(plan: Plan): Promise<InboundSlipRenderContext> {
|
||||
|
||||
@@ -115,11 +115,14 @@
|
||||
<script setup lang="ts">
|
||||
import { Check, Close } from '@element-plus/icons-vue'
|
||||
import {
|
||||
inboundOrderApi,
|
||||
outboundOrderApi,
|
||||
planApi,
|
||||
transportApi,
|
||||
type Plan,
|
||||
type PlanArchiveBody,
|
||||
type PlanProduct,
|
||||
type PlIoOrder,
|
||||
type Transport
|
||||
} from '@/api/pl'
|
||||
import PlPlanFormProductTable from '@/components/business/pl-plan-form-dialog/PlPlanFormProductTable.vue'
|
||||
@@ -271,6 +274,27 @@ async function handleOpened() {
|
||||
const rawProducts = Array.isArray(data.products) ? data.products : []
|
||||
const enrichedProducts = await enrichPlanProductsHazardFromCrm(rawProducts)
|
||||
productRows.value = mapPlanProducts(enrichedProducts)
|
||||
// 入库/出库单实际数量预填归档表单(归档提交时后端也会再同步一次)
|
||||
if (data.planType === 'inbound' || data.planType === 'outbound') {
|
||||
try {
|
||||
const api = data.planType === 'inbound' ? inboundOrderApi : outboundOrderApi
|
||||
const ioRes = await api.getByPlan(data.id)
|
||||
const io = pickBxData<PlIoOrder | null>(ioRes)
|
||||
if (io && io.status !== 'voided' && Array.isArray(io.items)) {
|
||||
const qtyMap = new Map(
|
||||
io.items
|
||||
.filter(it => it.planProductId && it.actualQty != null)
|
||||
.map(it => [it.planProductId, Number(it.actualQty)])
|
||||
)
|
||||
productRows.value = productRows.value.map(row => {
|
||||
if (!row.id || !qtyMap.has(row.id)) return row
|
||||
return { ...row, actualQty: qtyMap.get(row.id) }
|
||||
})
|
||||
}
|
||||
} catch {
|
||||
// 无入库/出库单时保持计划原实际数量
|
||||
}
|
||||
}
|
||||
await applyFreightPrefill(data)
|
||||
} catch (error) {
|
||||
innerVisible.value = false
|
||||
|
||||
@@ -344,9 +344,6 @@ import { useDictStore } from '@/store/modules/dict'
|
||||
import { isTonProductUnit } from '@/utils/crm-product-display'
|
||||
import { formatDate } from '@/utils/format'
|
||||
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()
|
||||
@@ -439,15 +436,10 @@ const dialogTitle = computed(() => {
|
||||
})
|
||||
|
||||
const isRearrange = computed(() => plan.value.transportStatus === 'arranged')
|
||||
const showInboundSlipPrint = computed(
|
||||
() => arrangeSuccess.value && canPrintInboundSlip(plan.value as Plan)
|
||||
)
|
||||
const showDeliverySlipPrint = computed(
|
||||
() => arrangeSuccess.value && canPrintDeliverySlip(plan.value as Plan)
|
||||
)
|
||||
const showSubpackSlipPrint = computed(
|
||||
() => arrangeSuccess.value && canPrintSubpackSlip(plan.value as Plan)
|
||||
)
|
||||
/** 安排成功后始终展示打印入口,与运输计划列表工具栏一致,便于现场立即开单 */
|
||||
const showInboundSlipPrint = computed(() => arrangeSuccess.value)
|
||||
const showDeliverySlipPrint = computed(() => arrangeSuccess.value)
|
||||
const showSubpackSlipPrint = computed(() => arrangeSuccess.value)
|
||||
|
||||
function getUnitLabel(unit: string) {
|
||||
return dictStore.getLabel('crm_product_unit', unit) || unit
|
||||
@@ -828,12 +820,14 @@ async function handleSubmit() {
|
||||
generateDibangPlan: formData.generateDibangPlan
|
||||
}
|
||||
|
||||
const wasRearrange = isRearrange.value
|
||||
const res = await transportApi.arrange(props.planId, payload)
|
||||
const result = pickBxData<TransportArrangeResult>(res)
|
||||
arrangeResult.value = result
|
||||
plan.value = { ...plan.value, transportStatus: 'arranged' }
|
||||
applyArrangeResult(result, plan.value, products.value)
|
||||
arrangeSuccess.value = true
|
||||
ElMessage.success(isRearrange.value ? '运输调整成功' : '运输安排成功')
|
||||
ElMessage.success(wasRearrange ? '运输调整成功' : '运输安排成功')
|
||||
await tabsRef.value?.reload()
|
||||
tabsRef.value?.setActiveTab('transport')
|
||||
emit('success')
|
||||
|
||||
@@ -224,8 +224,21 @@
|
||||
<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>{{ isEdit ? '保存' : '创建' }}
|
||||
<el-button
|
||||
:type="showSaveAndArrange ? 'default' : 'primary'"
|
||||
:class="showSaveAndArrange ? 'btn-ghost' : undefined"
|
||||
:loading="submitLoading"
|
||||
@click="handleSubmit('save')"
|
||||
>
|
||||
<el-icon><Check /></el-icon>{{ saveButtonLabel }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="showSaveAndArrange"
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="handleSubmit('saveAndArrange')"
|
||||
>
|
||||
<el-icon><Van /></el-icon>{{ saveAndArrangeLabel }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -246,7 +259,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close, Search, View } from '@element-plus/icons-vue'
|
||||
import { Check, Close, Search, Van, View } from '@element-plus/icons-vue'
|
||||
import { getContract } from '@/api/crm/contract'
|
||||
import type { ContractVO } from '@/api/crm/contract/types'
|
||||
import { carrierApi, planApi, transportApi, vehicleApi, type Carrier, type Plan, type PlanProduct, type PlanUpdatePayload, type Vehicle, type VehiclePersonnelRow } from '@/api/pl'
|
||||
@@ -262,13 +275,16 @@ import {
|
||||
mapContractProducts,
|
||||
type PlanFormProductRow
|
||||
} from '@/composables/usePlContractToPlan'
|
||||
import { enrichPlanProductsHazardFromCrm } from '@/composables/usePlToxicProductCertCheck'
|
||||
import {
|
||||
buildMissingHazardCertReadyMessage,
|
||||
enrichPlanProductsHazardFromCrm
|
||||
} from '@/composables/usePlToxicProductCertCheck'
|
||||
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 { pickBxData, pickBxList } from '@/utils/http/bx'
|
||||
|
||||
const ContractDetailDialog = defineAsyncComponent(
|
||||
() => import('@/views/crm/contract/components/ContractDetailDialog.vue')
|
||||
@@ -284,7 +300,7 @@ const props = defineProps<{
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
success: []
|
||||
success: [payload?: { planId: string; openArrange: boolean }]
|
||||
}>()
|
||||
|
||||
const userStore = useUserStore()
|
||||
@@ -315,6 +331,13 @@ function resolveCurrentUserName() {
|
||||
|
||||
const isEdit = computed(() => !!props.planId)
|
||||
const dialogTitle = computed(() => (isEdit.value ? '编辑运输计划' : '新增运输计划'))
|
||||
const showSaveAndArrange = computed(
|
||||
() => !isEdit.value || loadedTransportStatus.value === 'pending'
|
||||
)
|
||||
const saveButtonLabel = computed(() => (isEdit.value ? '保存' : '创建'))
|
||||
const saveAndArrangeLabel = computed(() =>
|
||||
isEdit.value ? '保存并安排运输' : '创建并安排运输'
|
||||
)
|
||||
|
||||
const innerVisible = computed({
|
||||
get: () => props.visible,
|
||||
@@ -323,6 +346,7 @@ const innerVisible = computed({
|
||||
|
||||
const submitLoading = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
const loadedTransportStatus = ref('pending')
|
||||
const contractSelectorVisible = ref(false)
|
||||
const contractDetailDialogActive = ref(false)
|
||||
const contractDetailRef = ref<InstanceType<typeof ContractDetailDialog>>()
|
||||
@@ -618,6 +642,7 @@ async function restoreFreightFromTransport(plan: Plan) {
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
loadedTransportStatus.value = 'pending'
|
||||
contractSnapshot.value = null
|
||||
vehicleBundle.value = null
|
||||
selectedDriverId.value = ''
|
||||
@@ -716,6 +741,7 @@ async function loadPlanForEdit(planId: string) {
|
||||
remark: data.remark || '',
|
||||
products: (data.products || []).map(mapPlanProductToFormRow)
|
||||
})
|
||||
loadedTransportStatus.value = data.transportStatus || 'pending'
|
||||
|
||||
if (data.contractId) {
|
||||
try {
|
||||
@@ -890,26 +916,55 @@ function validateBusinessRules() {
|
||||
return true
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
async function handleSubmit(mode: 'save' | 'saveAndArrange' = 'save') {
|
||||
const valid = await basicFormRef.value?.validate().catch(() => false)
|
||||
if (!valid || !validateBusinessRules()) return
|
||||
|
||||
submitLoading.value = true
|
||||
try {
|
||||
const commonPayload = buildPlanCommonPayload({ allowClearTransport: isEdit.value })
|
||||
let planId = props.planId || ''
|
||||
|
||||
if (isEdit.value) {
|
||||
if (!props.planId) return
|
||||
await planApi.update(props.planId, commonPayload)
|
||||
planId = props.planId
|
||||
ElMessage.success('保存成功')
|
||||
} else {
|
||||
await planApi.createFull({
|
||||
const res = await planApi.createFull({
|
||||
...commonPayload,
|
||||
contractId: formData.contractId
|
||||
} as Parameters<typeof planApi.createFull>[0])
|
||||
const created = pickBxData<Plan>(res)
|
||||
planId = String(created?.id || '')
|
||||
if (!planId) {
|
||||
ElMessage.error('创建成功但未返回计划 ID')
|
||||
return
|
||||
}
|
||||
ElMessage.success('创建成功')
|
||||
}
|
||||
|
||||
let openArrange = false
|
||||
if (mode === 'saveAndArrange' && planId) {
|
||||
const detailRes = await planApi.get(planId)
|
||||
const plan = pickBxData<Plan>(detailRes)
|
||||
const rawProducts = Array.isArray(plan?.products) ? plan.products : []
|
||||
const enrichedProducts = await enrichPlanProductsHazardFromCrm(rawProducts)
|
||||
const certMessage = buildMissingHazardCertReadyMessage(plan, enrichedProducts)
|
||||
if (certMessage) {
|
||||
await ElMessageBox.alert(
|
||||
`${certMessage},请至【危化品证上传】页面操作。`,
|
||||
'无法安排运输',
|
||||
{ type: 'warning' }
|
||||
)
|
||||
openArrange = false
|
||||
} else {
|
||||
openArrange = true
|
||||
}
|
||||
}
|
||||
|
||||
innerVisible.value = false
|
||||
emit('success')
|
||||
emit('success', { planId, openArrange })
|
||||
} finally {
|
||||
submitLoading.value = false
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ import {
|
||||
setupSubpackSlipEditorCheckboxes,
|
||||
type SubpackSlipRenderContext
|
||||
} from '@/utils/pl-subpack-slip-template'
|
||||
import { getPlSlipPdfCanvasScale } from '@/utils/pl-slip-pdf-render'
|
||||
|
||||
const visible = ref(false)
|
||||
const slipContent = ref('')
|
||||
@@ -96,8 +97,7 @@ async function waitForImagesLoaded(container: HTMLElement) {
|
||||
}
|
||||
|
||||
function getPdfCanvasScale() {
|
||||
const dpr = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1
|
||||
return Math.min(4, Math.max(3, dpr * 2))
|
||||
return getPlSlipPdfCanvasScale()
|
||||
}
|
||||
|
||||
async function buildSlipRenderContext(plan: Plan): Promise<SubpackSlipRenderContext> {
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
<ArtIconButton
|
||||
v-if="isLeftMenu && shouldShowMenuButton"
|
||||
icon="fold"
|
||||
class="ml-3 max-sm:ml-[7px]"
|
||||
class="ml-3 max-sm:ml-[7px] menu-fold-btn"
|
||||
:class="{ 'is-menu-collapsed': !menuOpen }"
|
||||
@click="visibleMenu"
|
||||
/>
|
||||
|
||||
@@ -376,6 +377,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
.menu-fold-btn :deep(.art-svg-icon) {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.menu-fold-btn.is-menu-collapsed :deep(.art-svg-icon) {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
/* Hover animation classes */
|
||||
.refresh-btn:hover :deep(.art-svg-icon) {
|
||||
animation: rotate180 0.5s;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<ArtIconButton
|
||||
icon="fold"
|
||||
class="portal-header-icon-btn portal-header-fold-btn"
|
||||
:class="{ 'is-menu-collapsed': !menuOpen }"
|
||||
@click="toggleSidebar"
|
||||
/>
|
||||
<ArtPortalModuleSelect />
|
||||
@@ -190,6 +191,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
.portal-header-fold-btn :deep(.art-svg-icon) {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.portal-header-fold-btn.is-menu-collapsed :deep(.art-svg-icon) {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
@media only screen and (width <= 800px) {
|
||||
.portal-header-title {
|
||||
display: none;
|
||||
|
||||
@@ -9,9 +9,12 @@ import {
|
||||
planApi,
|
||||
transportApi,
|
||||
freightApi,
|
||||
inboundOrderApi,
|
||||
outboundOrderApi,
|
||||
type FreightSettlementBrief,
|
||||
type Plan,
|
||||
type PlanProduct,
|
||||
type PlIoOrder,
|
||||
type Transport,
|
||||
type TransportInventoryLink,
|
||||
type TransportSiteLink
|
||||
@@ -132,6 +135,24 @@ export function usePlPlanViewDetail() {
|
||||
const contractSnapshot = ref<ContractVO | null>(null)
|
||||
const dibangRows = ref<PlPlanTransportDibangRow[]>([])
|
||||
const siteRows = ref<PlPlanTransportSiteRow[]>([])
|
||||
const ioOrder = ref<PlIoOrder | null>(null)
|
||||
|
||||
async function loadIoOrder(data: Plan) {
|
||||
ioOrder.value = null
|
||||
if (data.planType !== 'inbound' && data.planType !== 'outbound') return
|
||||
// 未安排运输时尚无入库/出库单;已作废计划仍可能有历史单据
|
||||
if (data.transportStatus !== 'arranged' && data.followStatus !== 'cancelled') {
|
||||
return
|
||||
}
|
||||
const api = data.planType === 'inbound' ? inboundOrderApi : outboundOrderApi
|
||||
try {
|
||||
const res = await api.getByPlan(data.id)
|
||||
const order = pickBxData<PlIoOrder | null>(res)
|
||||
ioOrder.value = order && typeof order === 'object' && 'id' in order ? order : null
|
||||
} catch {
|
||||
ioOrder.value = null
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSiteRows(planId: string, data: Plan) {
|
||||
siteRows.value = []
|
||||
@@ -140,9 +161,29 @@ export function usePlPlanViewDetail() {
|
||||
}
|
||||
try {
|
||||
const infoRes = await planApi.getArrangeInfo(planId)
|
||||
const info = pickBxData<{ siteRecords?: TransportSiteLink[] }>(infoRes)
|
||||
const info = pickBxData<{ siteRecords?: TransportSiteLink[]; ioOrder?: { orderId: string; orderNo: string; siteUrl?: string; siteAccessToken?: string; kind?: string } }>(infoRes)
|
||||
const links = info?.siteRecords || []
|
||||
siteRows.value = links.map(link => ({ link }))
|
||||
if (links.length) {
|
||||
siteRows.value = links.map(link => ({ link }))
|
||||
return
|
||||
}
|
||||
// 新链路:从入库/出库单合成一条现场链接行
|
||||
if (info?.ioOrder?.siteUrl) {
|
||||
const kind = info.ioOrder.kind || data.planType
|
||||
siteRows.value = [
|
||||
{
|
||||
link: {
|
||||
planProductId: '',
|
||||
productName: info.ioOrder.orderNo,
|
||||
siteLinkId: info.ioOrder.orderId,
|
||||
planNo: data.planNo || '',
|
||||
businessType: kind === 'inbound' ? '入库' : '出库',
|
||||
siteAccessToken: info.ioOrder.siteAccessToken,
|
||||
siteUrl: info.ioOrder.siteUrl
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
} catch {
|
||||
siteRows.value = []
|
||||
}
|
||||
@@ -192,6 +233,7 @@ export function usePlPlanViewDetail() {
|
||||
contractSnapshot.value = null
|
||||
dibangRows.value = []
|
||||
siteRows.value = []
|
||||
ioOrder.value = null
|
||||
try {
|
||||
const res = await planApi.get(planId)
|
||||
const data = pickBxData<Plan>(res)
|
||||
@@ -255,7 +297,11 @@ export function usePlPlanViewDetail() {
|
||||
}
|
||||
|
||||
if (data) {
|
||||
await Promise.all([loadSiteRows(planId, data), loadDibangRows(planId, data)])
|
||||
await Promise.all([
|
||||
loadSiteRows(planId, data),
|
||||
loadDibangRows(planId, data),
|
||||
loadIoOrder(data)
|
||||
])
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
@@ -271,6 +317,7 @@ export function usePlPlanViewDetail() {
|
||||
contractSnapshot.value = null
|
||||
dibangRows.value = []
|
||||
siteRows.value = []
|
||||
ioOrder.value = null
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -283,6 +330,7 @@ export function usePlPlanViewDetail() {
|
||||
contractSnapshot,
|
||||
dibangRows,
|
||||
siteRows,
|
||||
ioOrder,
|
||||
loadDetail,
|
||||
resetDetail
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Plan, PlanProduct } from '@/api/pl'
|
||||
import { applyPdfStableTableCellBorders } from '@/utils/pl-slip-pdf-render'
|
||||
|
||||
/** 送(提)货单打印默认公司信息(可在富文本中修改) */
|
||||
export const DELIVERY_SLIP_DEFAULTS = {
|
||||
@@ -47,9 +48,9 @@ const PRODUCT_TABLE_CELL_LEFT = `padding:10px 6px 14px 6px;border:${PRODUCT_TABL
|
||||
const PRODUCT_TERMS_CELL_LEFT = `padding:10px 6px 14px 6px;border:${PRODUCT_TABLE_BORDER} !important;text-align:left;${FONT_BODY}line-height:1.35;vertical-align:top;background-color:#fff !important;`
|
||||
const TERMS_TEXT_STYLE = 'line-height:1.35;'
|
||||
const SEAL_BLOCK_LINE_STYLE = 'line-height:1.35;'
|
||||
/** 送(提)货单印章:public/sxshzyz.png,定位在地址单元格右上角(相对原位置向上 100px) */
|
||||
/** 送(提)货单印章:public/sxshzyz.png,定位在地址单元格右上角(相对原位置向上 66px) */
|
||||
const DELIVERY_SLIP_SEAL_IMAGE_SRC = '/sxshzyz.png'
|
||||
const DELIVERY_SLIP_SEAL_TOP = -96
|
||||
const DELIVERY_SLIP_SEAL_TOP = -66
|
||||
const DELIVERY_SLIP_SEAL_IMAGE_STYLE = `position:absolute;right:4px;top:${DELIVERY_SLIP_SEAL_TOP}px;width:140px;height:140px;opacity:0.85;z-index:10;`
|
||||
const HANDWRITE_BLANK_INNER = ' '
|
||||
const HANDWRITE_BLANK = `<span class="delivery-slip-handwrite-blank">(${HANDWRITE_BLANK_INNER})</span>`
|
||||
@@ -1065,6 +1066,9 @@ export function prepareDeliverySlipPdfGridCells(root: HTMLElement): void {
|
||||
|
||||
prepareDeliverySlipPdfSignValues(root)
|
||||
prepareDeliverySlipPdfTypeCheckboxes(root)
|
||||
|
||||
// 亚像素 border 在 Windows DPI 下易变粗;截图前改为 1px 背景单线
|
||||
applyPdfStableTableCellBorders(root.querySelectorAll('.delivery-slip-product-cell'))
|
||||
}
|
||||
|
||||
/** 备注、条款、印章行:统一 0.3px 全边框(兼容已保存模板,与物料网格衔接) */
|
||||
@@ -1338,6 +1342,8 @@ function normalizeDeliverySlipDocLayout(html: string): string {
|
||||
.replace(/min-height:120px;/g, 'min-height:0;')
|
||||
.replace(/top:4px !important;/g, `top:${DELIVERY_SLIP_SEAL_TOP}px !important;`)
|
||||
.replace(/top:4px;/g, `top:${DELIVERY_SLIP_SEAL_TOP}px;`)
|
||||
.replace(/top:-96px !important;/g, `top:${DELIVERY_SLIP_SEAL_TOP}px !important;`)
|
||||
.replace(/top:-96px;/g, `top:${DELIVERY_SLIP_SEAL_TOP}px;`)
|
||||
.replace(/>日期:</g, '>日 期:<')
|
||||
.replace(/border-bottom:2px solid #000 !important;/g, `border-bottom:${INFO_UNDERLINE} !important;`)
|
||||
.replace(/border-bottom:1px solid #000 !important;/g, `border-bottom:${INFO_UNDERLINE} !important;`)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Plan, PlanProduct } from '@/api/pl'
|
||||
import { applyPdfStableTableCellBorders } from '@/utils/pl-slip-pdf-render'
|
||||
|
||||
/** 入库单打印默认公司信息(可在富文本中修改) */
|
||||
export const INBOUND_SLIP_DEFAULTS = {
|
||||
@@ -47,9 +48,9 @@ const PRODUCT_TABLE_CELL_LEFT = `padding:10px 6px 14px 6px;border:${PRODUCT_TABL
|
||||
const PRODUCT_TERMS_CELL_LEFT = `padding:10px 6px 14px 6px;border:${PRODUCT_TABLE_BORDER} !important;text-align:left;${FONT_BODY}line-height:1.35;vertical-align:top;background-color:#fff !important;`
|
||||
const TERMS_TEXT_STYLE = 'line-height:1.35;'
|
||||
const SEAL_BLOCK_LINE_STYLE = 'line-height:1.35;'
|
||||
/** 入库单印章:public/sxshzyz.png,定位在地址单元格右上角(相对原位置向上 100px) */
|
||||
/** 入库单印章:public/sxshzyz.png,定位在地址单元格右上角(相对原位置向上 66px) */
|
||||
const INBOUND_SLIP_SEAL_IMAGE_SRC = '/sxshzyz.png'
|
||||
const INBOUND_SLIP_SEAL_TOP = -96
|
||||
const INBOUND_SLIP_SEAL_TOP = -66
|
||||
const INBOUND_SLIP_SEAL_IMAGE_STYLE = `position:absolute;right:4px;top:${INBOUND_SLIP_SEAL_TOP}px;width:140px;height:140px;opacity:0.85;z-index:10;`
|
||||
const HANDWRITE_BLANK_INNER = ' '
|
||||
const HANDWRITE_BLANK = `<span class="inbound-slip-handwrite-blank">(${HANDWRITE_BLANK_INNER})</span>`
|
||||
@@ -807,6 +808,9 @@ export function prepareInboundSlipPdfGridCells(root: HTMLElement): void {
|
||||
})
|
||||
|
||||
prepareInboundSlipPdfSignValues(root)
|
||||
|
||||
// 亚像素 border 在 Windows DPI 下易变粗;截图前改为 1px 背景单线
|
||||
applyPdfStableTableCellBorders(root.querySelectorAll('.inbound-slip-product-cell'))
|
||||
}
|
||||
|
||||
/** 备注、条款、印章行:统一 0.3px 全边框(兼容已保存模板,与物料网格衔接) */
|
||||
@@ -1080,6 +1084,8 @@ function normalizeInboundSlipDocLayout(html: string): string {
|
||||
.replace(/min-height:120px;/g, 'min-height:0;')
|
||||
.replace(/top:4px !important;/g, `top:${INBOUND_SLIP_SEAL_TOP}px !important;`)
|
||||
.replace(/top:4px;/g, `top:${INBOUND_SLIP_SEAL_TOP}px;`)
|
||||
.replace(/top:-96px !important;/g, `top:${INBOUND_SLIP_SEAL_TOP}px !important;`)
|
||||
.replace(/top:-96px;/g, `top:${INBOUND_SLIP_SEAL_TOP}px;`)
|
||||
.replace(/>日期:</g, '>日 期:<')
|
||||
.replace(/border-bottom:2px solid #000 !important;/g, `border-bottom:${INFO_UNDERLINE} !important;`)
|
||||
.replace(/border-bottom:1px solid #000 !important;/g, `border-bottom:${INFO_UNDERLINE} !important;`)
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 运输计划单据(入库单 / 送货单 / 分装单)PDF 截图共用渲染策略。
|
||||
* html2canvas 对 0.3px 边框与 border-collapse 在 Windows DPI 缩放下易画成粗线。
|
||||
*/
|
||||
|
||||
/** 固定像素倍率,不跟 devicePixelRatio,保证 Mac / Windows 栅格化尺度一致 */
|
||||
export function getPlSlipPdfCanvasScale(): number {
|
||||
return 3
|
||||
}
|
||||
|
||||
/**
|
||||
* 将表格单元格边框改为「仅右+底」的 1px 背景线(首行补顶、首列补左)。
|
||||
* 相邻格只画一条共享边,避免全边框叠成双线。
|
||||
*/
|
||||
export function applyPdfStableTableCellBorders(cells: Iterable<Element>): void {
|
||||
const cellList = Array.from(cells) as HTMLElement[]
|
||||
if (!cellList.length) return
|
||||
|
||||
const rows = new Map<HTMLTableRowElement, HTMLElement[]>()
|
||||
for (const cell of cellList) {
|
||||
const tr = cell.closest('tr')
|
||||
if (!tr) continue
|
||||
const list = rows.get(tr)
|
||||
if (list) list.push(cell)
|
||||
else rows.set(tr, [cell])
|
||||
}
|
||||
|
||||
let rowIndex = 0
|
||||
for (const [, rowCells] of rows) {
|
||||
rowCells.forEach((cell, colIndex) => {
|
||||
const gradients = ['linear-gradient(#000,#000)', 'linear-gradient(#000,#000)']
|
||||
const sizes = ['100% 1px', '1px 100%']
|
||||
const positions = ['left bottom', 'right top']
|
||||
|
||||
if (rowIndex === 0) {
|
||||
gradients.push('linear-gradient(#000,#000)')
|
||||
sizes.push('100% 1px')
|
||||
positions.push('left top')
|
||||
}
|
||||
if (colIndex === 0) {
|
||||
gradients.push('linear-gradient(#000,#000)')
|
||||
sizes.push('1px 100%')
|
||||
positions.push('left top')
|
||||
}
|
||||
|
||||
cell.style.setProperty('border', 'none', 'important')
|
||||
cell.style.setProperty('border-width', '0', 'important')
|
||||
cell.style.setProperty('background-color', '#ffffff', 'important')
|
||||
cell.style.setProperty('background-image', gradients.join(','), 'important')
|
||||
cell.style.setProperty('background-size', sizes.join(','), 'important')
|
||||
cell.style.setProperty('background-position', positions.join(','), 'important')
|
||||
cell.style.setProperty('background-repeat', 'no-repeat', 'important')
|
||||
})
|
||||
rowIndex += 1
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Plan, PlanProduct } from '@/api/pl'
|
||||
import { applyPdfStableTableCellBorders } from '@/utils/pl-slip-pdf-render'
|
||||
|
||||
/** 分装单打印默认公司信息(可在富文本中修改) */
|
||||
export const SUBPACK_SLIP_DEFAULTS = {
|
||||
@@ -269,6 +270,19 @@ export const SUBPACK_SLIP_PRINT_CSS = `
|
||||
flex: 1 !important;
|
||||
min-width: 0 !important;
|
||||
}
|
||||
/* 下单/交货日期略宽;下单人与经手人等宽(单号行 spacer 同步,保持右缘对齐) */
|
||||
.subpack-slip-doc .subpack-slip-basic-info-row .subpack-slip-basic-info-inner > .subpack-slip-basic-info-item:nth-child(1),
|
||||
.subpack-slip-doc .subpack-slip-basic-info-row .subpack-slip-basic-info-inner > .subpack-slip-basic-info-item:nth-child(2),
|
||||
.subpack-slip-doc .subpack-slip-slip-no-row .subpack-slip-basic-info-inner > .subpack-slip-basic-info-item:nth-child(1),
|
||||
.subpack-slip-doc .subpack-slip-slip-no-row .subpack-slip-basic-info-inner > .subpack-slip-basic-info-item:nth-child(2) {
|
||||
flex: 1.1 !important;
|
||||
}
|
||||
.subpack-slip-doc .subpack-slip-basic-info-row .subpack-slip-basic-info-inner > .subpack-slip-basic-info-item:nth-child(3),
|
||||
.subpack-slip-doc .subpack-slip-basic-info-row .subpack-slip-basic-info-inner > .subpack-slip-basic-info-item:nth-child(4),
|
||||
.subpack-slip-doc .subpack-slip-slip-no-row .subpack-slip-basic-info-inner > .subpack-slip-basic-info-item:nth-child(3),
|
||||
.subpack-slip-doc .subpack-slip-slip-no-row .subpack-slip-basic-info-inner > .subpack-slip-basic-info-item:nth-child(4) {
|
||||
flex: 1 !important;
|
||||
}
|
||||
.subpack-slip-doc .subpack-slip-remark-row-inner {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
@@ -276,27 +290,53 @@ export const SUBPACK_SLIP_PRINT_CSS = `
|
||||
box-sizing: border-box !important;
|
||||
gap: 12px !important;
|
||||
}
|
||||
.subpack-slip-doc .subpack-slip-remark-text {
|
||||
.subpack-slip-doc .subpack-slip-remark-label {
|
||||
flex-shrink: 0 !important;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
/* 备注正文 + 补充输入共用一条连续下划线(底部 padding 把线推离字模,避免 PDF/html2canvas 遮字) */
|
||||
.subpack-slip-doc .subpack-slip-remark-underline-group {
|
||||
display: inline-flex !important;
|
||||
align-items: baseline !important;
|
||||
flex: 1 !important;
|
||||
min-width: 200px !important;
|
||||
max-width: 420px !important;
|
||||
box-sizing: border-box !important;
|
||||
border-bottom: ${INFO_UNDERLINE} !important;
|
||||
padding: ${SIGN_VALUE_PADDING} !important;
|
||||
gap: 0 !important;
|
||||
line-height: 1.35 !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
.subpack-slip-doc .subpack-slip-remark-value {
|
||||
display: inline-block !important;
|
||||
flex: 0 1 auto !important;
|
||||
min-width: 0 !important;
|
||||
max-width: 260px !important;
|
||||
box-sizing: border-box !important;
|
||||
border-bottom: none !important;
|
||||
padding: 0 2px !important;
|
||||
min-height: 1.3em !important;
|
||||
line-height: 1.35 !important;
|
||||
overflow: visible !important;
|
||||
white-space: nowrap !important;
|
||||
vertical-align: baseline !important;
|
||||
}
|
||||
.subpack-slip-doc .subpack-slip-remark-extra-wrap {
|
||||
flex: 1 !important;
|
||||
min-width: 120px !important;
|
||||
max-width: 320px !important;
|
||||
min-width: 80px !important;
|
||||
display: inline-block !important;
|
||||
vertical-align: middle !important;
|
||||
vertical-align: bottom !important;
|
||||
-webkit-user-modify: read-only !important;
|
||||
}
|
||||
.subpack-slip-doc .subpack-slip-remark-extra-input {
|
||||
width: 100% !important;
|
||||
min-width: 120px !important;
|
||||
max-width: 320px !important;
|
||||
height: 32px !important;
|
||||
padding: 0 6px 2px !important;
|
||||
min-width: 80px !important;
|
||||
height: 28px !important;
|
||||
padding: 0 2px 0 !important;
|
||||
margin: 0 !important;
|
||||
border: none !important;
|
||||
border-bottom: ${INFO_UNDERLINE} !important;
|
||||
border-bottom: none !important;
|
||||
border-radius: 0 !important;
|
||||
background: transparent !important;
|
||||
font-family: inherit !important;
|
||||
@@ -647,13 +687,18 @@ function buildSubpackSlipSlipNoDisplayHtml(): string {
|
||||
return `<span class="subpack-slip-slip-no-display">{{subpackSlipNo}} </span>`
|
||||
}
|
||||
|
||||
/** 基本信息列宽:日期略宽;下单人/经手人等宽(与 content_style nth-child 一致) */
|
||||
const BASIC_INFO_FLEX_DATE = '1.1'
|
||||
const BASIC_INFO_FLEX_PERSON = '1'
|
||||
|
||||
function buildSubpackSlipSlipNoRowHtml(): string {
|
||||
const spacer = `<div class="subpack-slip-basic-info-item subpack-slip-basic-info-spacer" style="flex:1;min-width:0;"> </div>`
|
||||
const spacer = (flex: string) =>
|
||||
`<div class="subpack-slip-basic-info-item subpack-slip-basic-info-spacer" style="flex:${flex};min-width:0;"> </div>`
|
||||
return `<tr class="subpack-slip-slip-no-row">
|
||||
<td colspan="7" style="${INFO_CELL_LEFT}">
|
||||
<div class="subpack-slip-basic-info-inner" style="display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-end;gap:8px 12px;width:100%;box-sizing:border-box;">
|
||||
${spacer}${spacer}${spacer}
|
||||
<div class="subpack-slip-info-row subpack-slip-basic-info-item subpack-slip-slip-no-field" style="${INFO_ROW}flex:1;min-width:0;">
|
||||
${spacer(BASIC_INFO_FLEX_DATE)}${spacer(BASIC_INFO_FLEX_DATE)}${spacer(BASIC_INFO_FLEX_PERSON)}
|
||||
<div class="subpack-slip-info-row subpack-slip-basic-info-item subpack-slip-slip-no-field" style="${INFO_ROW}flex:${BASIC_INFO_FLEX_PERSON};min-width:0;">
|
||||
<span class="subpack-slip-info-label subpack-slip-slip-no-anchor" style="${INFO_LABEL}">
|
||||
<span class="subpack-slip-slip-no-anchor-text">经手人:</span>
|
||||
${buildSubpackSlipSlipNoDisplayHtml()}
|
||||
@@ -666,18 +711,18 @@ function buildSubpackSlipSlipNoRowHtml(): string {
|
||||
}
|
||||
|
||||
function buildSubpackSlipBasicInfoRowHtml(): string {
|
||||
const field = (label: string, placeholder: string) =>
|
||||
`<div class="subpack-slip-info-row subpack-slip-basic-info-item" style="${INFO_ROW}flex:1;min-width:0;">
|
||||
const field = (label: string, placeholder: string, flex: string = BASIC_INFO_FLEX_PERSON) =>
|
||||
`<div class="subpack-slip-info-row subpack-slip-basic-info-item" style="${INFO_ROW}flex:${flex};min-width:0;">
|
||||
<span class="subpack-slip-info-label" style="${INFO_LABEL}">${label}</span>
|
||||
<span class="subpack-slip-info-value-left" style="${INFO_VALUE_INLINE_LEFT}">${placeholder} </span>
|
||||
</div>`
|
||||
return `<tr class="subpack-slip-basic-info-row">
|
||||
<td colspan="7" style="${INFO_CELL_LEFT}">
|
||||
<div class="subpack-slip-basic-info-inner" style="display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-end;gap:8px 12px;width:100%;box-sizing:border-box;">
|
||||
${field('下单日期:', '{{orderDate}}')}
|
||||
${field('交货日期:', '{{deliveryDate}}')}
|
||||
${field('下单人:', '{{orderUser}}')}
|
||||
${field('经手人:', '{{handlerName}}')}
|
||||
${field('下单日期:', '{{orderDate}}', BASIC_INFO_FLEX_DATE)}
|
||||
${field('交货日期:', '{{deliveryDate}}', BASIC_INFO_FLEX_DATE)}
|
||||
${field('下单人:', '{{orderUser}}', BASIC_INFO_FLEX_PERSON)}
|
||||
${field('经手人:', '{{handlerName}}', BASIC_INFO_FLEX_PERSON)}
|
||||
</div>
|
||||
</td>
|
||||
</tr>`
|
||||
@@ -687,10 +732,14 @@ function buildSubpackSlipRemarkExtraInputHtml(): string {
|
||||
return `<span class="subpack-slip-remark-extra-wrap" contenteditable="false"><input type="text" class="subpack-slip-remark-extra-input" value="{{remarkExtra}}" /></span>`
|
||||
}
|
||||
|
||||
function buildSubpackSlipRemarkUnderlineGroupHtml(remarkContent: string = '{{remark}}'): string {
|
||||
return `<span class="subpack-slip-remark-underline-group"><span class="subpack-slip-remark-value">${remarkContent} </span>${buildSubpackSlipRemarkExtraInputHtml()}</span>`
|
||||
}
|
||||
|
||||
function buildSubpackSlipRemarkRowHtml(): string {
|
||||
return `<div class="subpack-slip-remark-row-inner">
|
||||
<span class="subpack-slip-remark-text">备注:{{remark}}</span>
|
||||
${buildSubpackSlipRemarkExtraInputHtml()}
|
||||
<span class="subpack-slip-remark-label">备注:</span>
|
||||
${buildSubpackSlipRemarkUnderlineGroupHtml()}
|
||||
<div class="subpack-slip-bucket-check-row" contenteditable="false" style="${SUBPACK_SLIP_BUCKET_CHECK_INNER_STYLE}">${buildSubpackSlipBucketCheckboxesHtml()}</div>
|
||||
</div>`
|
||||
}
|
||||
@@ -991,6 +1040,31 @@ function unwrapSubpackSlipPdfCellParagraph(cell: HTMLTableCellElement): void {
|
||||
function prepareSubpackSlipPdfRemarkCell(cell: HTMLTableCellElement): void {
|
||||
unwrapSubpackSlipPdfCellParagraph(cell)
|
||||
applySubpackSlipPdfFooterCellStyles(cell)
|
||||
cell.querySelectorAll('.subpack-slip-remark-underline-group').forEach((node) => {
|
||||
const group = node as HTMLElement
|
||||
group.style.setProperty('display', 'inline-flex', 'important')
|
||||
group.style.setProperty('align-items', 'baseline', 'important')
|
||||
group.style.setProperty('flex', '1', 'important')
|
||||
group.style.setProperty('min-width', '200px', 'important')
|
||||
group.style.setProperty('max-width', '420px', 'important')
|
||||
group.style.setProperty('border', 'none', 'important')
|
||||
group.style.setProperty('border-bottom', INFO_UNDERLINE, 'important')
|
||||
// 与签字区一致:加大底部 padding,避免 html2canvas 把下划线叠在文字上
|
||||
group.style.setProperty('padding', SIGN_VALUE_PDF_PADDING, 'important')
|
||||
group.style.setProperty('gap', '0', 'important')
|
||||
group.style.setProperty('line-height', '1.35', 'important')
|
||||
group.style.setProperty('overflow', 'visible', 'important')
|
||||
group.style.setProperty('box-sizing', 'border-box', 'important')
|
||||
})
|
||||
cell.querySelectorAll('.subpack-slip-remark-value').forEach((node) => {
|
||||
const el = node as HTMLElement
|
||||
el.style.setProperty('display', 'inline-block', 'important')
|
||||
el.style.setProperty('border-bottom', 'none', 'important')
|
||||
el.style.setProperty('padding', '0 2px', 'important')
|
||||
el.style.setProperty('line-height', '1.35', 'important')
|
||||
el.style.setProperty('overflow', 'visible', 'important')
|
||||
el.style.setProperty('vertical-align', 'baseline', 'important')
|
||||
})
|
||||
cell.querySelectorAll('input.subpack-slip-remark-extra-input').forEach((node) => {
|
||||
const input = node as HTMLInputElement
|
||||
const text = (input.value || '').trim()
|
||||
@@ -998,11 +1072,12 @@ function prepareSubpackSlipPdfRemarkCell(cell: HTMLTableCellElement): void {
|
||||
span.className = 'subpack-slip-remark-extra-text-pdf'
|
||||
span.textContent = text || '\u00a0'
|
||||
span.style.setProperty('display', 'inline-block', 'important')
|
||||
span.style.setProperty('min-width', '120px', 'important')
|
||||
span.style.setProperty('padding', '0 6px 2px', 'important')
|
||||
span.style.setProperty('border-bottom', INFO_UNDERLINE, 'important')
|
||||
span.style.setProperty('min-width', '80px', 'important')
|
||||
span.style.setProperty('flex', '1', 'important')
|
||||
span.style.setProperty('padding', '0 2px', 'important')
|
||||
span.style.setProperty('border-bottom', 'none', 'important')
|
||||
span.style.setProperty('font-size', '20px', 'important')
|
||||
span.style.setProperty('line-height', PRODUCT_FOOTER_PDF_LINE_HEIGHT, 'important')
|
||||
span.style.setProperty('line-height', '1.35', 'important')
|
||||
span.style.setProperty('vertical-align', 'baseline', 'important')
|
||||
input.replaceWith(span)
|
||||
})
|
||||
@@ -1206,6 +1281,9 @@ export function prepareSubpackSlipPdfGridCells(root: HTMLElement): void {
|
||||
|
||||
prepareSubpackSlipPdfSignValues(root)
|
||||
prepareSubpackSlipPdfCheckboxes(root)
|
||||
|
||||
// 亚像素 border 在 Windows DPI 下易变粗;截图前改为 1px 背景单线
|
||||
applyPdfStableTableCellBorders(root.querySelectorAll('.subpack-slip-product-cell'))
|
||||
}
|
||||
|
||||
/** 备注、条款、印章行:统一 0.3px 全边框(兼容已保存模板,与物料网格衔接) */
|
||||
@@ -1605,10 +1683,40 @@ function normalizeSubpackSlipRemarkRow(html: string): string {
|
||||
|
||||
if (html.includes('subpack-slip-remark-row-inner')) {
|
||||
let result = html
|
||||
// 旧版:备注正文与补充输入分开,升级为同一条连续下划线
|
||||
if (!result.includes('subpack-slip-remark-underline-group')) {
|
||||
const extractRemark = (raw: string) =>
|
||||
String(raw || '')
|
||||
.replace(/<[^>]+>/g, '')
|
||||
.replace(/备注:/g, '')
|
||||
.replace(/ /g, '')
|
||||
.trim() || '{{remark}}'
|
||||
|
||||
result = result.replace(
|
||||
/<div class="subpack-slip-remark-row-inner">([\s\S]*?)<div class="subpack-slip-bucket-check-row"/,
|
||||
(_m, middle: string) => {
|
||||
const valueMatch = String(middle).match(
|
||||
/class="subpack-slip-remark-value"[^>]*>([\s\S]*?)<\/span>/
|
||||
)
|
||||
const plainMatch = String(middle).match(/备注:([^<]*)/)
|
||||
const content = extractRemark(valueMatch?.[1] ?? plainMatch?.[1] ?? '{{remark}}')
|
||||
const extraMatch = String(middle).match(
|
||||
/<input type="text" class="subpack-slip-remark-extra-input"([^>]*)\/?>/
|
||||
)
|
||||
const extraHtml = extraMatch
|
||||
? `<span class="subpack-slip-remark-extra-wrap" contenteditable="false"><input type="text" class="subpack-slip-remark-extra-input"${extraMatch[1]} /></span>`
|
||||
: buildSubpackSlipRemarkExtraInputHtml()
|
||||
return `<div class="subpack-slip-remark-row-inner">
|
||||
<span class="subpack-slip-remark-label">备注:</span>
|
||||
<span class="subpack-slip-remark-underline-group"><span class="subpack-slip-remark-value">${content} </span>${extraHtml}</span>
|
||||
<div class="subpack-slip-bucket-check-row"`
|
||||
}
|
||||
)
|
||||
}
|
||||
if (!result.includes('subpack-slip-remark-extra-input')) {
|
||||
result = result.replace(
|
||||
/(<span class="subpack-slip-remark-text">[\s\S]*?<\/span>)(\s*<div class="subpack-slip-bucket-check-row")/,
|
||||
`$1\n ${buildSubpackSlipRemarkExtraInputHtml()}$2`
|
||||
/(<div class="subpack-slip-remark-row-inner">[\s\S]*?)(\s*<div class="subpack-slip-bucket-check-row")/,
|
||||
`$1\n ${buildSubpackSlipRemarkUnderlineGroupHtml()}$2`
|
||||
)
|
||||
} else if (!result.includes('subpack-slip-remark-extra-wrap')) {
|
||||
result = result.replace(
|
||||
|
||||
@@ -141,8 +141,8 @@ const emit = defineEmits(['success'])
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const actionType = ref<'submit' | 'approve' | 'reject' | 'withdraw'>('submit')
|
||||
const contractId = ref<number>()
|
||||
const contractIds = ref<number[]>()
|
||||
const contractId = ref<string | number>()
|
||||
const contractIds = ref<(string | number)[]>()
|
||||
|
||||
const form = ref({
|
||||
approvalType: 'sequential',
|
||||
@@ -195,7 +195,7 @@ const confirmButtonText = computed(() => {
|
||||
return textMap[actionType.value]
|
||||
})
|
||||
|
||||
const open = (id: number, type: 'submit' | 'approve' | 'reject' | 'withdraw' = 'submit') => {
|
||||
const open = (id: string | number, type: 'submit' | 'approve' | 'reject' | 'withdraw' = 'submit') => {
|
||||
contractId.value = id
|
||||
contractIds.value = undefined
|
||||
actionType.value = type
|
||||
@@ -206,7 +206,10 @@ const open = (id: number, type: 'submit' | 'approve' | 'reject' | 'withdraw' = '
|
||||
}
|
||||
}
|
||||
|
||||
const openBatch = (idList: number[], type: 'submit' | 'approve' | 'reject' | 'withdraw' = 'submit') => {
|
||||
const openBatch = (
|
||||
idList: (string | number)[],
|
||||
type: 'submit' | 'approve' | 'reject' | 'withdraw' = 'submit'
|
||||
) => {
|
||||
contractIds.value = idList
|
||||
contractId.value = undefined
|
||||
actionType.value = type
|
||||
@@ -258,12 +261,17 @@ const getApproverName = (approverId: string | number): string => {
|
||||
|
||||
const handleConfirm = async () => {
|
||||
await formRef.value?.validate()
|
||||
const isBatch = !!(contractIds.value && contractIds.value.length > 0)
|
||||
if (!isBatch && (contractId.value == null || contractId.value === '')) {
|
||||
$modal.msgError('合同 ID 缺失,请关闭后重新打开提交审批')
|
||||
return
|
||||
}
|
||||
submitLoading.value = true
|
||||
try {
|
||||
if (actionType.value === 'submit') {
|
||||
if (contractIds.value && contractIds.value.length > 0) {
|
||||
const count = await batchSubmitContract(contractIds.value, form.value.approverIds, form.value.remark)
|
||||
$modal.msgSuccess(`提交成功,成功 ${count ?? contractIds.value.length} 条`)
|
||||
if (isBatch) {
|
||||
const count = await batchSubmitContract(contractIds.value!, form.value.approverIds, form.value.remark)
|
||||
$modal.msgSuccess(`提交成功,成功 ${count ?? contractIds.value!.length} 条`)
|
||||
} else {
|
||||
await submitContract(contractId.value!, form.value.approverIds, form.value.remark)
|
||||
$modal.msgSuccess('提交成功')
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="合同详情"
|
||||
width="1500px"
|
||||
width="100%"
|
||||
align-center
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
@@ -111,10 +111,30 @@
|
||||
</div>
|
||||
|
||||
<div class="parties-section">
|
||||
<div class="parties-section-toolbar">
|
||||
<el-button text type="primary" size="small" @click="partiesExpanded = !partiesExpanded">
|
||||
<el-icon>
|
||||
<ArrowUp v-if="partiesExpanded" />
|
||||
<ArrowDown v-else />
|
||||
</el-icon>
|
||||
{{ partiesExpanded ? '收起供需方' : '展开供需方' }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="parties-row">
|
||||
<div class="party-panel">
|
||||
<div class="party-panel__title">供方信息</div>
|
||||
<ViewKvTable :fields="detailSupplierViewFields" mode="dual" />
|
||||
<div class="party-panel" :class="{ 'is-collapsed': !partiesExpanded }">
|
||||
<div class="party-panel__header">
|
||||
<div class="party-panel__title">供方信息</div>
|
||||
</div>
|
||||
<div v-if="!partiesExpanded" class="party-panel__summary">
|
||||
<span class="party-panel__summary-label">单位名称</span>
|
||||
<span
|
||||
class="party-panel__summary-value"
|
||||
:class="{ 'is-empty': !detailContract?.partyA }"
|
||||
>
|
||||
{{ detailContract?.partyA || '未填写' }}
|
||||
</span>
|
||||
</div>
|
||||
<ViewKvTable v-show="partiesExpanded" :fields="detailSupplierViewFields" mode="dual" />
|
||||
</div>
|
||||
|
||||
<div class="party-flow-bridge" aria-hidden="true">
|
||||
@@ -138,9 +158,20 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="party-panel">
|
||||
<div class="party-panel__title">需方信息</div>
|
||||
<ViewKvTable :fields="detailBuyerViewFields" mode="dual" />
|
||||
<div class="party-panel" :class="{ 'is-collapsed': !partiesExpanded }">
|
||||
<div class="party-panel__header">
|
||||
<div class="party-panel__title">需方信息</div>
|
||||
</div>
|
||||
<div v-if="!partiesExpanded" class="party-panel__summary">
|
||||
<span class="party-panel__summary-label">单位名称</span>
|
||||
<span
|
||||
class="party-panel__summary-value"
|
||||
:class="{ 'is-empty': !detailContract?.partyB }"
|
||||
>
|
||||
{{ detailContract?.partyB || '未填写' }}
|
||||
</span>
|
||||
</div>
|
||||
<ViewKvTable v-show="partiesExpanded" :fields="detailBuyerViewFields" mode="dual" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -814,7 +845,9 @@ import {
|
||||
Promotion,
|
||||
Upload,
|
||||
VideoPlay,
|
||||
View
|
||||
View,
|
||||
ArrowDown,
|
||||
ArrowUp
|
||||
} from '@element-plus/icons-vue';
|
||||
import {
|
||||
getContract as getContractDetail,
|
||||
@@ -876,6 +909,8 @@ const detailLoading = ref(false);
|
||||
const detailActiveTab = ref('contract');
|
||||
const currentDetailId = ref<string | number>();
|
||||
const detailContract = ref<ContractVO>();
|
||||
/** 供方 / 需方信息展开状态(默认缩略,两侧共用) */
|
||||
const partiesExpanded = ref(false);
|
||||
const detailPaymentList = ref<any[]>([]);
|
||||
const detailPaymentLoading = ref(false);
|
||||
const detailInvoiceList = ref<any[]>([]);
|
||||
@@ -980,6 +1015,7 @@ async function open(id: string | number) {
|
||||
currentDetailId.value = id;
|
||||
visible.value = true;
|
||||
detailActiveTab.value = 'contract';
|
||||
partiesExpanded.value = false;
|
||||
await loadDetailData();
|
||||
}
|
||||
|
||||
@@ -1350,8 +1386,8 @@ const detailBasicViewFields = computed<ViewField[]>(() => {
|
||||
if (!c) return [];
|
||||
|
||||
return [
|
||||
{ label: '合同编号', value: c.contractNo },
|
||||
{ label: '合同名称', value: c.contractName },
|
||||
{ label: '合同编号', value: c.contractNo, long: false },
|
||||
{ label: '合同名称', value: c.contractName, long: false },
|
||||
detailTagField('合同类型', 'crm_contract_type', c.contractType),
|
||||
detailTagField('合同模版', 'crm_contract_template', c.contractTemplate, { long: false }),
|
||||
{ label: '客户名称', value: c.customerName, viewTarget: 'customer', viewId: c.customerId },
|
||||
@@ -2918,6 +2954,14 @@ onMounted(async () => {
|
||||
margin: 8px 0 20px;
|
||||
}
|
||||
|
||||
.parties-section-toolbar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.parties-row {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
@@ -2932,10 +2976,24 @@ onMounted(async () => {
|
||||
border: 1px solid var(--border, #d9e8e2);
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
|
||||
&.is-collapsed {
|
||||
padding: 12px 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.party-panel__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.party-panel.is-collapsed & {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.party-panel__title {
|
||||
margin-bottom: 12px;
|
||||
margin-bottom: 0;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
@@ -2944,6 +3002,37 @@ onMounted(async () => {
|
||||
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
|
||||
}
|
||||
|
||||
.party-panel__summary {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
padding: 2px 0 2px 10px;
|
||||
}
|
||||
|
||||
.party-panel__summary-label {
|
||||
flex-shrink: 0;
|
||||
font-size: 12px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.party-panel__summary-value {
|
||||
min-width: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--mint-text, #0f172a);
|
||||
line-height: 1.5;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
&.is-empty {
|
||||
font-weight: 400;
|
||||
color: var(--mint-text-muted, #94a3b8);
|
||||
}
|
||||
}
|
||||
|
||||
.party-flow-bridge {
|
||||
flex: 0 0 88px;
|
||||
display: flex;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="formTitle"
|
||||
width="calc(100vw - 300px)"
|
||||
width="100%"
|
||||
top="20px"
|
||||
class="dialog-form-layout contract-form-dialog"
|
||||
destroy-on-close
|
||||
@@ -13,7 +13,7 @@
|
||||
>
|
||||
<div class="contract-form-body">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-position="right" label-width="120px" class="crm-dialog-form">
|
||||
<!-- 合同基础信息(一行 5 列) -->
|
||||
<!-- 合同基础信息(一行 4 列) -->
|
||||
<div class="contract-basic-info">
|
||||
<el-form-item label="合同编号" prop="contractNo">
|
||||
<el-input v-model="form.contractNo" placeholder="系统自动生成,格式:SX/X-JT20250926002" maxlength="50" />
|
||||
@@ -117,18 +117,33 @@
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 供方 / 需方信息(左右布局) -->
|
||||
<!-- 供方 / 需方信息(左右布局,默认缩略、各自独立展开) -->
|
||||
<div class="parties-section">
|
||||
<div class="parties-section-toolbar">
|
||||
<el-button text type="primary" size="small" @click="partiesExpanded = !partiesExpanded">
|
||||
<el-icon>
|
||||
<ArrowUp v-if="partiesExpanded" />
|
||||
<ArrowDown v-else />
|
||||
</el-icon>
|
||||
{{ partiesExpanded ? '收起供需方' : '展开供需方' }}
|
||||
</el-button>
|
||||
<el-button type="primary" size="small" @click="handleSwapParties">
|
||||
<el-icon><Sort /></el-icon>
|
||||
供需方调换
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="parties-row">
|
||||
<div class="party-panel">
|
||||
<div class="party-panel__title">供方信息</div>
|
||||
<div class="form-grid-3">
|
||||
<div class="party-panel" :class="{ 'is-collapsed': !partiesExpanded }">
|
||||
<div class="party-panel__header">
|
||||
<div class="party-panel__title">供方信息</div>
|
||||
</div>
|
||||
<div v-if="!partiesExpanded" class="party-panel__summary">
|
||||
<span class="party-panel__summary-label">单位名称</span>
|
||||
<span class="party-panel__summary-value" :class="{ 'is-empty': !form.partyA }">
|
||||
{{ form.partyA || '未填写' }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-show="partiesExpanded" class="form-grid-2">
|
||||
<el-form-item label="单位名称(章)" prop="partyA">
|
||||
<el-input v-model="form.partyA" placeholder="请输入单位名称" maxlength="100" />
|
||||
</el-form-item>
|
||||
@@ -174,9 +189,17 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="party-panel">
|
||||
<div class="party-panel__title">需方信息</div>
|
||||
<div class="form-grid-3">
|
||||
<div class="party-panel" :class="{ 'is-collapsed': !partiesExpanded }">
|
||||
<div class="party-panel__header">
|
||||
<div class="party-panel__title">需方信息</div>
|
||||
</div>
|
||||
<div v-if="!partiesExpanded" class="party-panel__summary">
|
||||
<span class="party-panel__summary-label">单位名称</span>
|
||||
<span class="party-panel__summary-value" :class="{ 'is-empty': !form.partyB }">
|
||||
{{ form.partyB || '未填写' }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-show="partiesExpanded" class="form-grid-2">
|
||||
<el-form-item label="单位名称(章)" prop="partyB">
|
||||
<el-input v-model="form.partyB" placeholder="从客户开票信息带出" maxlength="200" />
|
||||
</el-form-item>
|
||||
@@ -499,7 +522,9 @@ import {
|
||||
Close,
|
||||
FolderChecked,
|
||||
Promotion,
|
||||
Loading
|
||||
Loading,
|
||||
ArrowDown,
|
||||
ArrowUp
|
||||
} from '@element-plus/icons-vue'
|
||||
import {
|
||||
buildUploadFileListFromField,
|
||||
@@ -633,6 +658,22 @@ const form = ref<ExtendedContractForm>({
|
||||
// 供需方是否已调换的标志
|
||||
const isPartiesSwapped = ref(false)
|
||||
|
||||
/** 供方 / 需方信息展开状态(默认缩略,两侧共用) */
|
||||
const partiesExpanded = ref(false)
|
||||
|
||||
const resetPartyExpand = () => {
|
||||
partiesExpanded.value = false
|
||||
}
|
||||
|
||||
/** 校验失败时,自动展开供需方面板 */
|
||||
const expandPartiesForInvalidFields = (invalidFields?: Record<string, unknown>) => {
|
||||
if (!invalidFields) return
|
||||
const keys = Object.keys(invalidFields)
|
||||
if (keys.some((k) => k.startsWith('partyA') || k.startsWith('partyB'))) {
|
||||
partiesExpanded.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 记录原始的模板内容(用于检测是否被意外删除)
|
||||
const originalTemplateContent = ref<string>('')
|
||||
|
||||
@@ -714,6 +755,7 @@ interface QuoteVO {
|
||||
|
||||
/** 对话框打开后的初始化 */
|
||||
const handleOpened = async () => {
|
||||
resetPartyExpand()
|
||||
await loadPerms()
|
||||
await Promise.all([loadSupplierList(), loadUserList()])
|
||||
|
||||
@@ -783,6 +825,7 @@ const resetForm = () => {
|
||||
remark: ''
|
||||
}
|
||||
isPartiesSwapped.value = false
|
||||
resetPartyExpand()
|
||||
originalTemplateContent.value = ''
|
||||
customerShortName.value = ''
|
||||
contractDateRange.value = [] as any
|
||||
@@ -1793,6 +1836,7 @@ const handleSubmit = async () => {
|
||||
try {
|
||||
await formRef.value?.validate()
|
||||
} catch (error) {
|
||||
expandPartiesForInvalidFields(error as Record<string, unknown>)
|
||||
ElMessage.warning({
|
||||
message: '请填写完整的必填信息',
|
||||
duration: 3000
|
||||
@@ -1933,15 +1977,20 @@ const handleSubmit = async () => {
|
||||
delete data.products
|
||||
}
|
||||
|
||||
let contractId: number
|
||||
let contractId: string | number
|
||||
if (form.value.id) {
|
||||
await updateContract(data)
|
||||
contractId = form.value.id as number
|
||||
contractId = form.value.id
|
||||
$modal.msgSuccess('保存成功')
|
||||
} else {
|
||||
const res = await addContract(data)
|
||||
contractId = res.data
|
||||
form.value.id = contractId
|
||||
if (contractId == null || contractId === '') {
|
||||
$modal.msgError('保存成功但未返回合同 ID,请从列表重新提交审批')
|
||||
emit('success')
|
||||
return
|
||||
}
|
||||
form.value.id = contractId as any
|
||||
$modal.msgSuccess('保存成功')
|
||||
}
|
||||
|
||||
@@ -2020,8 +2069,8 @@ const loadSupplierList = async () => {
|
||||
|
||||
.contract-basic-info {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 12px 16px;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px 14px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
@@ -2033,12 +2082,6 @@ const loadSupplierList = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1400px) {
|
||||
.contract-basic-info {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.contract-basic-info {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
@@ -2058,6 +2101,8 @@ const loadSupplierList = async () => {
|
||||
.parties-section-toolbar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
@@ -2076,13 +2121,27 @@ const loadSupplierList = async () => {
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
|
||||
&.is-collapsed {
|
||||
padding: 12px 16px;
|
||||
}
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.party-panel__title {
|
||||
.party-panel__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.party-panel.is-collapsed & {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.party-panel__title {
|
||||
margin-bottom: 0;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
@@ -2091,6 +2150,37 @@ const loadSupplierList = async () => {
|
||||
border-left: 3px solid var(--section-bar-border-color, var(--primary, #10b981));
|
||||
}
|
||||
|
||||
.party-panel__summary {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
padding: 2px 0 2px 10px;
|
||||
}
|
||||
|
||||
.party-panel__summary-label {
|
||||
flex-shrink: 0;
|
||||
font-size: 12px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.party-panel__summary-value {
|
||||
min-width: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--mint-text, #0f172a);
|
||||
line-height: 1.5;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
&.is-empty {
|
||||
font-weight: 400;
|
||||
color: var(--mint-text-muted, #94a3b8);
|
||||
}
|
||||
}
|
||||
|
||||
.party-flow-bridge {
|
||||
flex: 0 0 88px;
|
||||
display: flex;
|
||||
|
||||
@@ -2377,18 +2377,21 @@ const handleSubmit = async () => {
|
||||
delete data.products;
|
||||
}
|
||||
|
||||
let contractId: number;
|
||||
let contractId: string | number;
|
||||
if (form.value.id) {
|
||||
// 编辑时更新合同
|
||||
await updateContract(data);
|
||||
contractId = form.value.id;
|
||||
$modal.msgSuccess('保存成功');
|
||||
} else {
|
||||
// 新增时创建合同
|
||||
// 新增时创建合同(addContract 返回 { data: id })
|
||||
const res = await addContract(data);
|
||||
// 从返回结果中获取合同ID
|
||||
contractId = res.data;
|
||||
form.value.id = contractId;
|
||||
if (contractId == null || contractId === '') {
|
||||
$modal.msgError('保存成功但未返回合同 ID,请从列表重新提交审批');
|
||||
return;
|
||||
}
|
||||
form.value.id = contractId as any;
|
||||
$modal.msgSuccess('保存成功');
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,9 @@ import {
|
||||
|
||||
const dictStore = useDictStore()
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
const emit = defineEmits<{
|
||||
success: [payload?: { id?: string | number }]
|
||||
}>()
|
||||
|
||||
const form = ref({
|
||||
id: undefined as string | undefined,
|
||||
@@ -170,12 +172,15 @@ const submitForm = () => {
|
||||
if (form.value.id) {
|
||||
await fetchUpdateContact(form.value)
|
||||
ElMessage.success('修改成功')
|
||||
dialog.visible = false
|
||||
emit('success', { id: form.value.id })
|
||||
} else {
|
||||
await fetchCreateContact(form.value)
|
||||
const res = await fetchCreateContact(form.value)
|
||||
const data = (res as any)?.data ?? res
|
||||
ElMessage.success('新增成功')
|
||||
dialog.visible = false
|
||||
emit('success', { id: data?.id })
|
||||
}
|
||||
dialog.visible = false
|
||||
emit('success')
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="right"
|
||||
label-width="100px"
|
||||
label-position="top"
|
||||
class="crm-dialog-form"
|
||||
scroll-to-error
|
||||
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
|
||||
|
||||
@@ -405,8 +405,7 @@
|
||||
ref="submitFormRef"
|
||||
:model="submitForm"
|
||||
:rules="submitRules"
|
||||
label-position="right"
|
||||
label-width="100px"
|
||||
label-position="top"
|
||||
class="crm-dialog-form"
|
||||
scroll-to-error
|
||||
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
|
||||
|
||||
@@ -98,15 +98,8 @@
|
||||
/>
|
||||
<el-button
|
||||
v-if="selectedPlan && selectedPlan.followStatus !== 'cancelled'"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedPlan && selectedPlan.followStatus !== 'cancelled'"
|
||||
class="btn-ghost"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarArchive"
|
||||
>
|
||||
@@ -272,12 +265,6 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<PlPlanFormDialog
|
||||
v-model:visible="formDialogVisible"
|
||||
:plan-id="editingPlanId"
|
||||
@success="handlePlanMutationSuccess"
|
||||
/>
|
||||
|
||||
<PlPlanViewDialog
|
||||
ref="viewDialogRef"
|
||||
v-model:visible="viewVisible"
|
||||
@@ -288,13 +275,6 @@
|
||||
v-if="viewingPlan.followStatus !== 'cancelled'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleEdit(viewingPlan)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingPlan.followStatus !== 'cancelled'"
|
||||
class="btn-ghost"
|
||||
@click="handleArchive(viewingPlan)"
|
||||
>
|
||||
<el-icon><FolderChecked /></el-icon>{{ archiveButtonLabel(viewingPlan) }}
|
||||
@@ -315,7 +295,6 @@ import ListQuickSearchInput from '@/components/business/list-quick-search-input/
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import {
|
||||
Edit,
|
||||
FolderChecked,
|
||||
RefreshLeft,
|
||||
Search
|
||||
@@ -327,7 +306,6 @@ import {
|
||||
} from '@/composables/usePlToxicProductCertCheck'
|
||||
import { pickBxData } from '@/utils/http/bx'
|
||||
import PlPlanArchiveDialog from '@/components/business/pl-plan-archive-dialog/index.vue'
|
||||
import PlPlanFormDialog from '@/components/business/pl-plan-form-dialog/index.vue'
|
||||
import PlPlanListCertCell from '@/components/business/pl-plan-list-cert-cell/index.vue'
|
||||
import PlPlanListProductCell from '@/components/business/pl-plan-list-product-cell/index.vue'
|
||||
import PlPlanViewDialog from '@/components/business/pl-plan-view-dialog/index.vue'
|
||||
@@ -349,8 +327,6 @@ import { useMenuStore } from '@/store/modules/menu'
|
||||
|
||||
const menuStore = useMenuStore()
|
||||
const loading = ref(false)
|
||||
const formDialogVisible = ref(false)
|
||||
const editingPlanId = ref('')
|
||||
const viewVisible = ref(false)
|
||||
const viewPlanId = ref('')
|
||||
const viewDialogRef = ref<InstanceType<typeof PlPlanViewDialog>>()
|
||||
@@ -541,11 +517,6 @@ function archiveButtonLabel(row: Plan) {
|
||||
return row.archiveStatus === 'archived' ? '调整' : '归档'
|
||||
}
|
||||
|
||||
function handleEdit(row: Plan) {
|
||||
editingPlanId.value = row.id
|
||||
formDialogVisible.value = true
|
||||
}
|
||||
|
||||
async function handleArchive(row: Plan) {
|
||||
if (row.archiveStatus === 'archived') {
|
||||
archivePlanId.value = row.id
|
||||
@@ -578,11 +549,6 @@ async function handleArchive(row: Plan) {
|
||||
archiveDialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarArchive() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleArchive(selectedRows.value[0])
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
<PlPlanListProductCell :products="row.products" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="isColumnVisible('planAttachments')" label="计划附件" min-width="220">
|
||||
<el-table-column v-if="isColumnVisible('planAttachments')" label="计划附件" min-width="280">
|
||||
<template #default="{ row }">
|
||||
<PlPlanListCertCell
|
||||
:products="row.products"
|
||||
|
||||
@@ -478,9 +478,13 @@ async function refreshViewIfOpen() {
|
||||
await viewDialogRef.value?.reload()
|
||||
}
|
||||
|
||||
async function handlePlanMutationSuccess() {
|
||||
async function handlePlanMutationSuccess(payload?: { planId?: string; openArrange?: boolean }) {
|
||||
await fetchData()
|
||||
await refreshViewIfOpen()
|
||||
if (payload?.openArrange && payload.planId) {
|
||||
arrangePlanId.value = payload.planId
|
||||
arrangeDialogVisible.value = true
|
||||
}
|
||||
}
|
||||
|
||||
const selectedPlan = computed(() => (selectedRows.value.length === 1 ? selectedRows.value[0] : null))
|
||||
@@ -626,11 +630,20 @@ function handleEdit(row: Plan) {
|
||||
formDialogVisible.value = true
|
||||
}
|
||||
|
||||
function isIoPlanFrozen(row: Plan) {
|
||||
return (
|
||||
row.transportStatus === 'arranged' &&
|
||||
(row.planType === 'inbound' || row.planType === 'outbound')
|
||||
)
|
||||
}
|
||||
|
||||
function canEditPlan(row: Plan) {
|
||||
if (isIoPlanFrozen(row)) return false
|
||||
return row.archiveStatus !== 'archived' && row.followStatus !== 'cancelled'
|
||||
}
|
||||
|
||||
function canArrangeTransport(row: Plan) {
|
||||
if (isIoPlanFrozen(row)) return false
|
||||
return (
|
||||
(row.transportStatus === 'pending' || row.transportStatus === 'arranged') &&
|
||||
row.archiveStatus !== 'archived' &&
|
||||
@@ -692,7 +705,7 @@ async function handleDelete(row: Plan) {
|
||||
async function handleVoid(row: Plan) {
|
||||
const hint =
|
||||
row.transportStatus === 'arranged'
|
||||
? '作废后将取消运输安排、作废关联地磅出入库单,司机链接将提示计划已作废。是否继续?'
|
||||
? '作废后将取消运输安排、作废关联入库/出库单与地磅出入库单,现场链接将失效。是否继续?'
|
||||
: '确认作废该运输计划吗?作废后将无法恢复。'
|
||||
await ElMessageBox.confirm(hint, '作废运输计划', { type: 'warning' })
|
||||
voidLoading.value = true
|
||||
|
||||
Reference in new issue
Block a user