Compare commits

..
50 changed files with 1035 additions and 1376 deletions
+9
View File
@@ -34,6 +34,15 @@ export const syncKingdeeBatch = ids =>
// 回写任务按 paymentNo 分批远程查询 A103-2/A103-4,同样可能超过全局超时 // 回写任务按 paymentNo 分批远程查询 A103-2/A103-4,同样可能超过全局超时
export const syncKingdeeResult = () => export const syncKingdeeResult = () =>
request({ url: `${baseUrl}/sync-kingdee-result`, method: 'post', timeout: APPROVE_TIMEOUT }); request({ url: `${baseUrl}/sync-kingdee-result`, method: 'post', timeout: APPROVE_TIMEOUT });
// 付款记录付款凭证下载(后端代理 A801-2 流式回源),耗时较普通接口长,放宽到 120s
export const downloadRecordVoucher = recordId =>
request({
url: `${baseUrl}/record/download-voucher`,
method: 'get',
params: { recordId },
responseType: 'blob',
timeout: 120000,
});
export const paymentTypeOptions = [ export const paymentTypeOptions = [
{ label: '项目预付', value: 'project_advance' }, { label: '项目预付', value: 'project_advance' },
-11
View File
@@ -91,14 +91,3 @@ export const recognizeBaiduOcr = (imageUrl, type, side = '') => {
}, },
}); });
}; };
export const recognizeQualificationCertificateOcr = imageUrl => {
return request({
url: '/blade-transport/baidu-ocr/qualification-certificate',
method: 'post',
timeout: 60000,
params: {
imageUrl,
},
});
};
@@ -0,0 +1,145 @@
<template>
<div class="invoice-write-off-table">
<el-table v-loading="loading" :data="rows" border>
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
<el-table-column prop="arrivalAddress" label="到货地址" min-width="150" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.manualFlag === 1 ? '—' : displayValue(row.arrivalAddress) }}</template>
</el-table-column>
<el-table-column prop="actualDepartureTime" label="实际发货时间" width="150" align="center">
<template #default="{ row }">{{ row.manualFlag === 1 ? '—' : formatDateTime(row.actualDepartureTime) }}</template>
</el-table-column>
<el-table-column prop="completionTime" label="实际完成时间" width="150" align="center">
<template #default="{ row }">{{ row.manualFlag === 1 ? '—' : formatDateTime(row.completionTime) }}</template>
</el-table-column>
<el-table-column prop="transportType" label="运输类型" width="100" align="center">
<template #default="{ row }">{{ row.manualFlag === 1 ? '—' : displayValue(row.transportType) }}</template>
</el-table-column>
<el-table-column prop="cargoName" label="货物名称" min-width="110" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.manualFlag === 1 ? '—' : displayValue(row.cargoName) }}</template>
</el-table-column>
<el-table-column prop="cargoType" label="货物类型" min-width="110" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.manualFlag === 1 ? '—' : displayValue(row.cargoType) }}</template>
</el-table-column>
<el-table-column prop="transportQuantity" label="运输总量" width="110" align="center">
<template #default="{ row }">{{ row.manualFlag === 1 ? '—' : displayValue(row.transportQuantity) }}</template>
</el-table-column>
<el-table-column prop="mileage" label="里程 (KM)" width="100" align="center">
<template #default="{ row }">{{ row.manualFlag === 1 ? '—' : displayValue(row.mileage) }}</template>
</el-table-column>
<el-table-column prop="batchNo" label="批次号" width="100" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.manualFlag === 1 ? '—' : displayValue(row.batchNo) }}</template>
</el-table-column>
<el-table-column prop="invoiceNo" label="发票号" min-width="160" align="center" show-overflow-tooltip />
<!-- 按费用项目动态分组列头,每组三列:结算金额/未开票费用/本次开票金额 -->
<el-table-column v-for="group in feeItemGroups" :key="group.name" :label="group.name" align="center">
<el-table-column :label="'结算金额'" width="110" align="center">
<template #default="{ row }">{{ formatMoney(row.settlementAmounts[group.name]) }}</template>
</el-table-column>
<el-table-column :label="'未开票费用'" width="110" align="center">
<template #default="{ row }">{{ formatMoney(row.beforeRemainAmounts[group.name]) }}</template>
</el-table-column>
<el-table-column :label="'本次开票金额'" width="120" align="center">
<template #default="{ row }">{{ formatMoney(row.writeOffAmounts[group.name]) }}</template>
</el-table-column>
</el-table-column>
</el-table>
<div v-if="!loading && !rows.length" class="invoice-write-off-table__empty">暂无冲销明细</div>
</div>
</template>
<script>
import request from '@/axios';
/**
* 发票冲销明细公共表格(开票申请/收票登记/付款申请通用)
* 数据源:/blade-transport/invoice-write-off/list?bizType=&bizId=
* 行按运单完成时间升序(先完成的运单先冲销),手动添加费用无运输信息显示"—"
*/
export default {
name: 'InvoiceWriteOffTable',
props: {
// invoice_apply-开票申请 receipt-收票登记 payment_receipt-付款申请生成的收票单
bizType: { type: String, required: true },
bizId: { type: [String, Number], default: null },
},
data() {
return {
loading: false,
rows: [],
};
},
computed: {
feeItemGroups() {
const names = [];
this.rows.forEach(row => {
if (row.feeItemName && !names.includes(row.feeItemName)) names.push(row.feeItemName);
});
return names.map(name => ({ name }));
},
},
watch: {
bizId: {
immediate: true,
handler(value) {
if (value) this.load();
},
},
},
methods: {
load() {
this.loading = true;
request({
url: '/blade-transport/invoice-write-off/list',
method: 'get',
params: { bizType: this.bizType, bizId: this.bizId },
})
.then(res => {
const list = res.data.data || [];
// 同一运单同一费用项目可能被多张发票分段冲抵(跨发票拆分),按运单+费用项目归并展示
const merged = new Map();
list.forEach(row => {
const key = `${row.waybillId || row.summaryFeeId || ''}|${row.feeItemName}`;
if (!merged.has(key)) {
merged.set(key, {
...row,
settlementAmounts: { [row.feeItemName]: row.settlementAmount },
beforeRemainAmounts: { [row.feeItemName]: row.beforeRemainAmount },
writeOffAmounts: { [row.feeItemName]: row.writeOffAmount },
});
return;
}
const target = merged.get(key);
target.writeOffAmounts[row.feeItemName] = Number(target.writeOffAmounts[row.feeItemName] || 0) + Number(row.writeOffAmount || 0);
// 未开票费用取首段冲抵前余额,发票号追加展示
if (!String(target.invoiceNo).includes(row.invoiceNo)) {
target.invoiceNo = `${target.invoiceNo},${row.invoiceNo}`;
}
});
this.rows = [...merged.values()];
})
.finally(() => {
this.loading = false;
});
},
displayValue(value) {
return value === null || value === undefined || value === '' ? '-' : value;
},
formatDateTime(value) {
if (!value) return '-';
return this.$dayjs(value).format('YYYY-MM-DD HH:mm:ss');
},
formatMoney(value) {
return Number(value || 0).toFixed(2);
},
},
};
</script>
<style scoped>
.invoice-write-off-table__empty {
padding: 24px 0;
text-align: center;
color: #909399;
font-size: 13px;
}
</style>
@@ -1,8 +1,8 @@
<template> <template>
<el-dialog v-model="visible" :title="title" width="92%" append-to-body destroy-on-close @open="handleOpen"> <el-dialog v-model="visible" :title="title" width="92%" append-to-body align-center destroy-on-close @open="handleOpen">
<el-form :model="query" inline label-width="130px" @submit.prevent> <el-form class="kingdee-pool-dialog__form" :model="query" inline label-position="right" label-width="120px" @submit.prevent>
<el-form-item label="发票号码"> <el-form-item label="发票号码">
<el-input v-model="query.invoiceNo" clearable @keyup.enter="handleQuery" /> <el-input v-model="query.invoiceNo" clearable placeholder="请输入" @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="开票日期"> <el-form-item label="开票日期">
<el-date-picker <el-date-picker
@@ -10,15 +10,16 @@
type="daterange" type="daterange"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
format="YYYY-MM-DD" format="YYYY-MM-DD"
start-placeholder="开始日期" range-separator="-"
end-placeholder="结束日期" start-placeholder="请选择"
end-placeholder="请选择"
/> />
</el-form-item> </el-form-item>
<el-form-item label="开票单位"> <el-form-item label="开票单位">
<el-input v-model="query.salerName" clearable @keyup.enter="handleQuery" /> <el-input v-model="query.salerName" clearable placeholder="请输入" @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="受票单位"> <el-form-item label="受票单位">
<el-input v-model="query.buyerName" clearable @keyup.enter="handleQuery" /> <el-input v-model="query.buyerName" clearable placeholder="请输入" @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="开票单位(销方)"> <el-form-item label="开票单位(销方)">
<el-select <el-select
@@ -93,6 +94,9 @@
<el-form-item> <el-form-item>
<el-button :disabled="loading" @click="resetQuery">重置</el-button> <el-button :disabled="loading" @click="resetQuery">重置</el-button>
<el-button type="primary" :disabled="loading" @click="handleQuery">查询</el-button> <el-button type="primary" :disabled="loading" @click="handleQuery">查询</el-button>
<el-tooltip content="按名称检索范围为已同步票,未找到请改用发票号码或税号精确查找" placement="top">
<el-icon class="kingdee-pool-dialog__query-tip"><QuestionFilled /></el-icon>
</el-tooltip>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
@@ -101,7 +105,7 @@
:data="rows" :data="rows"
:row-key="rowKey" :row-key="rowKey"
border border
height="520" max-height="50vh"
:highlight-current-row="!multiple" :highlight-current-row="!multiple"
@selection-change="selection => (selected = selection)" @selection-change="selection => (selected = selection)"
@row-dblclick="handleRowDblclick" @row-dblclick="handleRowDblclick"
@@ -118,6 +122,7 @@
</el-radio> </el-radio>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column type="index" label="序号" width="70" align="center" :index="indexMethod" />
<el-table-column prop="invoiceNo" label="发票号码" min-width="180" /> <el-table-column prop="invoiceNo" label="发票号码" min-width="180" />
<el-table-column prop="invoiceDate" label="开票日期" min-width="120" /> <el-table-column prop="invoiceDate" label="开票日期" min-width="120" />
<el-table-column prop="invoiceType" label="发票类型" min-width="140" /> <el-table-column prop="invoiceType" label="发票类型" min-width="140" />
@@ -172,8 +177,8 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="kingdee-pool-dialog__pager"> <div class="kingdee-pool-dialog__pagination">
<span class="kingdee-pool-dialog__pager-tip">按名称检索范围为已同步票,未找到请改用发票号码或税号精确查找</span> <span class="kingdee-pool-dialog__pagination-tip">按名称检索范围为已同步票,未找到请改用发票号码或税号精确查找</span>
<el-pagination <el-pagination
v-model:current-page="page.current" v-model:current-page="page.current"
v-model:page-size="page.size" v-model:page-size="page.size"
@@ -323,6 +328,9 @@ export default {
this.page.current = 1; this.page.current = 1;
this.load(); this.load();
}, },
indexMethod(index) {
return (this.page.current - 1) * this.page.size + index + 1;
},
resetQuery() { resetQuery() {
this.query = this.emptyQuery(); this.query = this.emptyQuery();
this.handleQuery(); this.handleQuery();
@@ -420,15 +428,28 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.kingdee-pool-dialog__pager { .kingdee-pool-dialog__form {
margin-bottom: 16px;
padding: 12px 12px 4px;
background: #fff;
border-radius: 6px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.kingdee-pool-dialog__pagination {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
margin-top: 12px; padding: 16px 0;
gap: 16px; gap: 16px;
} }
.kingdee-pool-dialog__pager-tip { .kingdee-pool-dialog__pagination-tip {
color: #909399; color: #909399;
font-size: 12px; font-size: 12px;
white-space: nowrap;
}
.kingdee-pool-dialog__query-tip {
margin-left: 8px;
color: #909399;
cursor: pointer;
} }
</style> </style>
+10 -12
View File
@@ -253,18 +253,16 @@ export const option = createCrudOption([
label: '客商', label: '客商',
prop: 'partyName', prop: 'partyName',
search: true, search: true,
searchOrder: 14, searchOrder: 11,
searchPlaceholder: '请输入甲/乙方名称', searchPlaceholder: '请输入',
hide: true, hide: true,
display: false, display: false,
addDisplay: false,
editDisplay: false,
}, },
{ {
label: '合同编号', label: '合同编号',
prop: 'contractNo', prop: 'contractNo',
search: true, search: true,
searchOrder: 8, searchOrder: 6,
searchPlaceholder: '请输入', searchPlaceholder: '请输入',
order: 185, order: 185,
maxlength: 100, maxlength: 100,
@@ -289,7 +287,7 @@ export const option = createCrudOption([
label: '所属项目', label: '所属项目',
prop: 'projectName', prop: 'projectName',
search: true, search: true,
searchOrder: 11, searchOrder: 8,
searchType: 'select', searchType: 'select',
searchPlaceholder: '请选择', searchPlaceholder: '请选择',
formslot: true, formslot: true,
@@ -336,7 +334,7 @@ export const option = createCrudOption([
prop: 'contractCategory', prop: 'contractCategory',
type: 'select', type: 'select',
search: true, search: true,
searchOrder: 12, searchOrder: 9,
searchPlaceholder: '请选择', searchPlaceholder: '请选择',
order: 170, order: 170,
dicData: contractCategoryOptions, dicData: contractCategoryOptions,
@@ -348,7 +346,7 @@ export const option = createCrudOption([
prop: 'signType', prop: 'signType',
type: 'select', type: 'select',
search: true, search: true,
searchOrder: 13, searchOrder: 10,
searchPlaceholder: '请选择', searchPlaceholder: '请选择',
span: 8, span: 8,
order: 190, order: 190,
@@ -361,7 +359,7 @@ export const option = createCrudOption([
prop: 'effectiveType', prop: 'effectiveType',
type: 'select', type: 'select',
search: true, search: true,
searchOrder: 6, searchOrder: 5,
searchPlaceholder: '请选择', searchPlaceholder: '请选择',
dicData: effectiveTypeOptions, dicData: effectiveTypeOptions,
hide: true, hide: true,
@@ -632,7 +630,7 @@ export const option = createCrudOption([
prop: 'hcsSyncStatus', prop: 'hcsSyncStatus',
type: 'select', type: 'select',
search: true, search: true,
searchOrder: 7, searchOrder: 6,
searchPlaceholder: '请选择', searchPlaceholder: '请选择',
slot: true, slot: true,
dicData: hcsSyncStatusOptions, dicData: hcsSyncStatusOptions,
@@ -662,7 +660,7 @@ export const option = createCrudOption([
type: 'select', type: 'select',
search: true, search: true,
searchPlaceholder: '请选择', searchPlaceholder: '请选择',
searchOrder: 9, searchOrder: 7,
dicData: yesNoOptions, dicData: yesNoOptions,
hide: true, hide: true,
addDisplay: false, addDisplay: false,
@@ -674,7 +672,7 @@ export const option = createCrudOption([
type: 'select', type: 'select',
search: true, search: true,
searchPlaceholder: '请选择', searchPlaceholder: '请选择',
searchOrder: 10, searchOrder: 8,
dicData: yesNoOptions, dicData: yesNoOptions,
hide: true, hide: true,
addDisplay: false, addDisplay: false,
+1 -2
View File
@@ -124,8 +124,7 @@ const formatGoodsInfo = row => {
const text = Object.entries(groups) const text = Object.entries(groups)
.map(([unit, group]) => { .map(([unit, group]) => {
const quantity = formatGoodsQuantity(group.quantity); const quantity = formatGoodsQuantity(group.quantity);
const typeName = group.count > 1 ? `${group.typeName}等${group.count}种货物` : group.typeName; return `${group.typeName}等${group.count}种货物 | ${quantity}${unit ? ` ${unit}` : ''}`;
return `${typeName} | ${quantity}${unit ? ` ${unit}` : ''}`;
}) })
.join('; '); .join('; ');
+1
View File
@@ -6,6 +6,7 @@ export const invoiceApplicationTableColumns = [
{ prop: 'issuerName', label: '开票方', minWidth: 150 }, { prop: 'issuerName', label: '开票方', minWidth: 150 },
{ prop: 'receiverName', label: '受票方', minWidth: 150 }, { prop: 'receiverName', label: '受票方', minWidth: 150 },
{ prop: 'invoiceAmount', label: '开票金额', minWidth: 130, money: true }, { prop: 'invoiceAmount', label: '开票金额', minWidth: 130, money: true },
{ prop: 'estimatedCost', label: '暂估成本', minWidth: 130, money: true },
{ prop: 'createUserName', label: '创建人', minWidth: 110 }, { prop: 'createUserName', label: '创建人', minWidth: 110 },
{ prop: 'createTime', label: '创建时间', minWidth: 170 }, { prop: 'createTime', label: '创建时间', minWidth: 170 },
{ prop: 'approvalStatusName', label: '状态', minWidth: 110, status: true }, { prop: 'approvalStatusName', label: '状态', minWidth: 110, status: true },
+1 -1
View File
@@ -12,7 +12,7 @@ export const invoiceReceiptTableColumns = [
{ prop: 'createUserName', label: '创建人', minWidth: 110 }, { prop: 'createUserName', label: '创建人', minWidth: 110 },
{ prop: 'createTime', label: '创建时间', minWidth: 170 }, { prop: 'createTime', label: '创建时间', minWidth: 170 },
{ prop: 'kingdeeReceivedInvoiceNo', label: '金蝶单据号', minWidth: 150 }, { prop: 'kingdeeReceivedInvoiceNo', label: '金蝶单据号', minWidth: 150 },
{ prop: 'kingdeePushStatusName', label: '金蝶状态', minWidth: 130 }, { prop: 'kingdeePushStatusName', label: '金蝶状态', minWidth: 130, kingdeeStatus: true },
{ prop: 'kingdeePushMsg', label: '失败原因', minWidth: 160 }, { prop: 'kingdeePushMsg', label: '失败原因', minWidth: 160 },
{ prop: 'attachmentSyncStatusName', label: '附件同步', minWidth: 100 }, { prop: 'attachmentSyncStatusName', label: '附件同步', minWidth: 100 },
]; ];
@@ -12,7 +12,6 @@
* ⚠️ column 数组顺序 = 表格列顺序,搜索专用列统一放在数组最前面。 * ⚠️ column 数组顺序 = 表格列顺序,搜索专用列统一放在数组最前面。
*/ */
import { formatSealTypes } from '@/utils/settlement-seal';
import { import {
approvalStatusOptions, approvalStatusOptions,
invoiceStatusOptions, invoiceStatusOptions,
@@ -25,8 +24,6 @@ import { formalSettlementTableColumns } from './formalSettlementTable';
const textFormatter = (row, value) => const textFormatter = (row, value) =>
value === null || value === undefined || value === '' ? '-' : value; value === null || value === undefined || value === '' ? '-' : value;
const sealTypesFormatter = (row, value) => formatSealTypes(value) || '-';
/** 金额统一展示:两位小数 + 币种 */ /** 金额统一展示:两位小数 + 币种 */
const moneyFormatter = (row, value) => const moneyFormatter = (row, value) =>
`${Number(value || 0).toFixed(2)} ${row?.currency || 'RMB'}`; `${Number(value || 0).toFixed(2)} ${row?.currency || 'RMB'}`;
@@ -75,7 +72,6 @@ const COLUMN_EXTRA = {
projectName: { search: true, searchSpan: 5, searchOrder: 11, searchPlaceholder: '请输入' }, projectName: { search: true, searchSpan: 5, searchOrder: 11, searchPlaceholder: '请输入' },
deptName: { search: true, searchslot: true, searchSpan: 5, searchOrder: 10 }, deptName: { search: true, searchslot: true, searchSpan: 5, searchOrder: 10 },
contractNo: { search: true, searchSpan: 5, searchOrder: 9, searchPlaceholder: '请输入' }, contractNo: { search: true, searchSpan: 5, searchOrder: 9, searchPlaceholder: '请输入' },
sealTypes: { formatter: sealTypesFormatter },
invoiceStatusName: { slot: true }, invoiceStatusName: { slot: true },
paymentStatusName: { slot: true }, paymentStatusName: { slot: true },
approvalStatusName: { slot: true }, approvalStatusName: { slot: true },
@@ -10,12 +10,6 @@ export const formalSettlementFormFields = [
{ label: '结算金额', prop: 'settlementAmount', readonly: true, money: true }, { label: '结算金额', prop: 'settlementAmount', readonly: true, money: true },
{ label: '业务模式', prop: 'businessModel', type: 'select', optionsKey: 'businessModelOptions' }, { label: '业务模式', prop: 'businessModel', type: 'select', optionsKey: 'businessModelOptions' },
{ label: '运输方式', prop: 'transportType', type: 'select', optionsKey: 'transportTypeOptions' }, { label: '运输方式', prop: 'transportType', type: 'select', optionsKey: 'transportTypeOptions' },
{
label: '用印类型',
prop: 'sealTypes',
type: 'multi-select',
optionsKey: 'sealTypeOptions',
},
{ label: '汇率日期', prop: 'exchangeRateDate', type: 'date', required: true }, { label: '汇率日期', prop: 'exchangeRateDate', type: 'date', required: true },
{ label: '结算汇率', prop: 'exchangeRate', type: 'number', required: true }, { label: '结算汇率', prop: 'exchangeRate', type: 'number', required: true },
{ label: '本位币合计', prop: 'localSettlementAmount', readonly: true, money: true }, { label: '本位币合计', prop: 'localSettlementAmount', readonly: true, money: true },
@@ -35,7 +29,6 @@ export const createFormalSettlementForm = () => ({
sourceDetailIds: [], sourceDetailIds: [],
businessModel: '', businessModel: '',
transportType: '', transportType: '',
sealTypes: [],
exchangeRateDate: '', exchangeRateDate: '',
exchangeRate: 1, exchangeRate: 1,
createUserName: '', createUserName: '',
@@ -10,7 +10,6 @@ export const formalSettlementTableColumns = [
{ label: '原币结算金额', prop: 'settlementAmount', minWidth: 145, money: true }, { label: '原币结算金额', prop: 'settlementAmount', minWidth: 145, money: true },
{ label: '业务模式', prop: 'businessModelName', minWidth: 120 }, { label: '业务模式', prop: 'businessModelName', minWidth: 120 },
{ label: '运输方式', prop: 'transportTypeName', minWidth: 120 }, { label: '运输方式', prop: 'transportTypeName', minWidth: 120 },
{ label: '用印类型', prop: 'sealTypes', minWidth: 120 },
{ label: '本位币结算金额', prop: 'localSettlementAmount', minWidth: 155, money: true }, { label: '本位币结算金额', prop: 'localSettlementAmount', minWidth: 155, money: true },
{ label: '结算汇率', prop: 'exchangeRate', minWidth: 110 }, { label: '结算汇率', prop: 'exchangeRate', minWidth: 110 },
{ label: '申请付款金额(含预付)', prop: 'appliedPaymentAmount', minWidth: 185, money: true }, { label: '申请付款金额(含预付)', prop: 'appliedPaymentAmount', minWidth: 185, money: true },
@@ -26,12 +26,6 @@ export const preSettlementFormFields = [
{ label: '结算金额', prop: 'settlementAmount', readonly: true, money: true }, { label: '结算金额', prop: 'settlementAmount', readonly: true, money: true },
{ label: '业务模式', prop: 'businessModel', type: 'select', optionsKey: 'businessModelOptions' }, { label: '业务模式', prop: 'businessModel', type: 'select', optionsKey: 'businessModelOptions' },
{ label: '运输方式', prop: 'transportType', type: 'select', optionsKey: 'transportTypeOptions' }, { label: '运输方式', prop: 'transportType', type: 'select', optionsKey: 'transportTypeOptions' },
{
label: '用印类型',
prop: 'sealTypes',
type: 'multi-select',
optionsKey: 'sealTypeOptions',
},
{ label: '汇率日期', prop: 'exchangeRateDate', type: 'date' }, { label: '汇率日期', prop: 'exchangeRateDate', type: 'date' },
{ label: '结算汇率', prop: 'exchangeRate', type: 'number', class: 'exchange-rate-input' }, { label: '结算汇率', prop: 'exchangeRate', type: 'number', class: 'exchange-rate-input' },
{ label: '本位币合计', prop: 'localSettlementAmount', readonly: true, money: true }, { label: '本位币合计', prop: 'localSettlementAmount', readonly: true, money: true },
@@ -88,7 +82,6 @@ export const emptyPreSettlementForm = () => ({
settlementAmount: 0, settlementAmount: 0,
businessModel: '', businessModel: '',
transportType: '', transportType: '',
sealTypes: [],
localCurrency: 'RMB', localCurrency: 'RMB',
localSettlementAmount: 0, localSettlementAmount: 0,
exchangeRateDate: '', exchangeRateDate: '',
@@ -10,7 +10,6 @@ export const preSettlementTableColumns = [
{ label: '原币结算金额', prop: 'settlementAmount', minWidth: 140, money: true, precision: 2 }, { label: '原币结算金额', prop: 'settlementAmount', minWidth: 140, money: true, precision: 2 },
{ label: '业务模式', prop: 'businessModelName', minWidth: 120 }, { label: '业务模式', prop: 'businessModelName', minWidth: 120 },
{ label: '运输方式', prop: 'transportTypeName', minWidth: 120 }, { label: '运输方式', prop: 'transportTypeName', minWidth: 120 },
{ label: '用印类型', prop: 'sealTypes', minWidth: 120 },
{ label: '本位币结算金额', prop: 'localSettlementAmount', minWidth: 150, money: true, precision: 2 }, { label: '本位币结算金额', prop: 'localSettlementAmount', minWidth: 150, money: true, precision: 2 },
{ label: '结算汇率', prop: 'exchangeRate', minWidth: 110, precision: 2 }, { label: '结算汇率', prop: 'exchangeRate', minWidth: 110, precision: 2 },
{ {
+10 -28
View File
@@ -492,35 +492,17 @@ export const treeOption = {
nodeKey: 'id', nodeKey: 'id',
lazy: true, lazy: true,
treeLoad: function (node, resolve) { treeLoad: function (node, resolve) {
const toTreeNode = item => ({ const parentId = node.level === 0 ? 0 : node.data.id;
...item, getDeptLazyTree(parentId).then(res => {
leaf: !item.hasChildren, resolve(
}); res.data.data.map(item => {
// 用户管理组织树从第二级开始展示:根层隐藏一级组织,直接展示其子节点 return {
if (node.level === 0) { ...item,
getDeptLazyTree(0) leaf: !item.hasChildren,
.then(res => { };
const roots = res.data.data || [];
if (!roots.length) {
resolve([]);
return;
}
return Promise.all(roots.map(root => getDeptLazyTree(root.id))).then(childResults => {
const secondLevel = [];
childResults.forEach(childRes => {
(childRes.data.data || []).forEach(item => secondLevel.push(toTreeNode(item)));
});
resolve(secondLevel);
});
}) })
.catch(() => resolve([])); );
return; });
}
getDeptLazyTree(node.data.id)
.then(res => {
resolve((res.data.data || []).map(toTreeNode));
})
.catch(() => resolve([]));
}, },
addBtn: false, addBtn: false,
menu: false, menu: false,
+13
View File
@@ -77,6 +77,19 @@ export default [
}, },
], ],
}, },
{
// 发票冲销明细独立页(不挂菜单,供开票申请/收票登记/付款申请页面跳转引用)
path: '/payment/invoice-write-off',
component: Layout,
children: [
{
path: '',
name: '发票冲销明细',
meta: { keepAlive: false, activeMenu: '/payment/invoice-application' },
component: loadView(() => import('@/views/payment/invoice-write-off.vue')),
},
],
},
{ {
path: '/payment/payment-application/form', path: '/payment/payment-application/form',
component: Layout, component: Layout,
-39
View File
@@ -1,39 +0,0 @@
/**
* 业务部门下拉规范化。
* rawLabel 保留原始部门名供落库;展示名优先追加所属公司,缺省时用上级组织。
*
* @param {Array} list 业务部门原始列表
* @param {{ alwaysShowCompany?: boolean }} [options]
* alwaysShowCompany=true 时始终展示「部门(公司)」;默认仅同名时追加
*/
export function normalizeBusinessDeptOptions(list, options = {}) {
const alwaysShowCompany = !!options.alwaysShowCompany;
const source = Array.isArray(list) ? list : [];
const nameCount = {};
source.forEach(item => {
const name = String(item?.deptName || item?.fullName || '').trim();
if (!name) return;
nameCount[name] = (nameCount[name] || 0) + 1;
});
return source
.map(item => {
const id = item?.id == null || item?.id === '' ? '' : String(item.id);
if (!id) return null;
const rawLabel = item.deptName || item.fullName || id;
const companyName = String(item.belongCompanyName || item.parentName || '').trim();
const label =
companyName && (alwaysShowCompany || nameCount[rawLabel] > 1)
? `${rawLabel}(${companyName})`
: rawLabel;
return {
id,
value: id,
label,
rawLabel,
parentName: String(item.parentName || '').trim(),
belongCompanyName: String(item.belongCompanyName || '').trim(),
kingdeeDeptCode: item.kingdeeDeptCode || '',
};
})
.filter(Boolean);
}
+47 -20
View File
@@ -21,16 +21,17 @@ export const isKingdeePathAttachment = attachment => {
}; };
/** /**
* 请求金蝶文件流:成功返回 Blob;业务失败为 HTTP 200 + R.fail JSON(响应通道未写流时后端即失败), * 请求金蝶文件流(公共核):成功返回 Blob;业务失败为 HTTP 200 + R.fail JSON
* 按 Content-Type 识别并抛出带 msg 的错误;网络级失败拦截器已提示,标记 silent 避免重复提示。 * (响应通道未写流时后端即失败),按 Content-Type 识别并抛出带 msg 的错误;
* 网络级失败拦截器已提示,标记 silent 避免重复提示。
* 供查看(弹窗内预览)/下载两类入口复用 * 供查看(弹窗内预览)/下载两类入口复用
* @param {String} invoiceNo 发票号码 * @param {Function} fetcher 文件流请求函数(返回 axios blob 响应)
* @returns {Promise<Blob>} * @returns {Promise<Blob>}
*/ */
export const requestKingdeeFile = async invoiceNo => { const fetchKingdeeBlob = async fetcher => {
let res; let res;
try { try {
res = await downloadInvoicePoolAttachment(invoiceNo); res = await fetcher();
} catch (error) { } catch (error) {
throw Object.assign(new Error(error?.message || '附件下载失败'), { silent: true }); throw Object.assign(new Error(error?.message || '附件下载失败'), { silent: true });
} }
@@ -51,6 +52,45 @@ export const requestKingdeeFile = async invoiceNo => {
return blob; return blob;
}; };
/**
* 请求金蝶文件流:票池发票按发票号回源(后端代理 A801-2)
* @param {String} invoiceNo 发票号码
* @returns {Promise<Blob>}
*/
export const requestKingdeeFile = invoiceNo => fetchKingdeeBlob(() => downloadInvoicePoolAttachment(invoiceNo));
/**
* 下载金蝶侧附件(经 A801-2 后端代理,公共入口),失败统一 ElMessage 提示
* @param {Function} fetcher 文件流请求函数
* @param {String} fileName 下载文件名
*/
export const downloadKingdeeFile = async (fetcher, fileName) => {
try {
const blob = await fetchKingdeeBlob(fetcher);
downloadFile(blob, fileName);
} catch (error) {
if (!error?.silent) ElMessage.error(error?.message || '金蝶附件下载失败');
}
};
/**
* 新窗口预览金蝶侧附件(经 A801-2 后端代理,公共入口):拉取 Blob 转 objectURL
* (PDF 可预览;OFD 等浏览器不可预览的格式由浏览器触发下载)
* @param {Function} fetcher 文件流请求函数
* @param {String} fileName 预览文件名
*/
export const viewKingdeeFile = async (fetcher, fileName) => {
try {
const blob = await fetchKingdeeBlob(fetcher);
const url = URL.createObjectURL(blob);
window.open(url, '_blank');
// 延迟释放 objectURL:立即回收可能导致新窗口尚未加载完成即失效
setTimeout(() => URL.revokeObjectURL(url), 60000);
} catch (error) {
if (!error?.silent) ElMessage.error(error?.message || '金蝶附件预览失败');
}
};
/** /**
* 下载金蝶侧发票附件(经 A801-2 后端代理),失败统一 ElMessage 提示 * 下载金蝶侧发票附件(经 A801-2 后端代理),失败统一 ElMessage 提示
* @param {String} invoiceNo 发票号码 * @param {String} invoiceNo 发票号码
@@ -61,12 +101,7 @@ export const downloadKingdeeInvoiceFile = async (invoiceNo, fileName) => {
ElMessage.warning('当前发票缺少发票号码,无法下载金蝶侧附件'); ElMessage.warning('当前发票缺少发票号码,无法下载金蝶侧附件');
return; return;
} }
try { await downloadKingdeeFile(() => downloadInvoicePoolAttachment(invoiceNo), fileName || `${invoiceNo}.pdf`);
const blob = await requestKingdeeFile(invoiceNo);
downloadFile(blob, fileName || `${invoiceNo}.pdf`);
} catch (error) {
if (!error?.silent) ElMessage.error(error?.message || '金蝶附件下载失败');
}
}; };
/** /**
@@ -79,13 +114,5 @@ export const viewKingdeeInvoiceFile = async (invoiceNo, fileName) => {
ElMessage.warning('当前发票缺少发票号码,无法预览金蝶侧附件'); ElMessage.warning('当前发票缺少发票号码,无法预览金蝶侧附件');
return; return;
} }
try { await viewKingdeeFile(() => downloadInvoicePoolAttachment(invoiceNo), fileName || `${invoiceNo}.pdf`);
const blob = await requestKingdeeFile(invoiceNo);
const url = URL.createObjectURL(blob);
window.open(url, '_blank');
// 延迟释放 objectURL:立即回收可能导致新窗口尚未加载完成即失效
setTimeout(() => URL.revokeObjectURL(url), 60000);
} catch (error) {
if (!error?.silent) ElMessage.error(error?.message || '金蝶附件预览失败');
}
}; };
+11
View File
@@ -14,6 +14,17 @@ export const KINGDEE_STATUS_TAG_TYPES = {
/** 金蝶单据状态 → el-tag 颜色类型,未映射状态返回 info */ /** 金蝶单据状态 → el-tag 颜色类型,未映射状态返回 info */
export const kingdeeStatusType = status => KINGDEE_STATUS_TAG_TYPES[status] || 'info'; export const kingdeeStatusType = status => KINGDEE_STATUS_TAG_TYPES[status] || 'info';
/** 收票登记推送状态 → el-tag 颜色类型(已指定应付=绿、已保存收票单=黄、推送失败=红、未推送=灰) */
export const KINGDEE_PUSH_STATUS_TAG_TYPES = {
unsynced: 'info',
pushed: 'warning',
assigned: 'success',
failed: 'danger',
};
/** 收票登记推送状态 → el-tag 颜色类型,未映射状态返回 info */
export const kingdeePushStatusType = status => KINGDEE_PUSH_STATUS_TAG_TYPES[status] || 'info';
/** 金蝶冲销状态 → el-tag 颜色类型(已冲销=绿、未冲销=黄) */ /** 金蝶冲销状态 → el-tag 颜色类型(已冲销=绿、未冲销=黄) */
export const KINGDEE_WRITEOFF_TAG_TYPES = { export const KINGDEE_WRITEOFF_TAG_TYPES = {
writtenoff: 'success', writtenoff: 'success',
+1 -1
View File
@@ -154,7 +154,7 @@ export function isMkApprovedStatus(bizType, approvalStatus) {
* @param {string} [options.subjectName] 标题后缀 * @param {string} [options.subjectName] 标题后缀
* @param {string} [options.approvalStatus] 提交前的审批状态 * @param {string} [options.approvalStatus] 提交前的审批状态
* @param {boolean} [options.mkEnabled] 调用方已知开关时传入,false 时立即跳过 * @param {boolean} [options.mkEnabled] 调用方已知开关时传入,false 时立即跳过
* @param {Object} [options.tempVarData] 传给 MK 的临时变量(如项目类型 projectType、用印类型 sealTypes) * @param {Object} [options.tempVarData] 传给 MK 的临时变量(如项目类型 projectType)
* @returns {Promise<boolean>} true=已发起/复用 MK 流程,false=未开启或已跳过 * @returns {Promise<boolean>} true=已发起/复用 MK 流程,false=未开启或已跳过
*/ */
export async function submitMkApprovalFlow({ export async function submitMkApprovalFlow({
-31
View File
@@ -1,31 +0,0 @@
/** 结算单用印类型固定选项(展示顺序固定) */
export const SETTLEMENT_SEAL_TYPE_OPTIONS = [
{ dictKey: '公章', dictValue: '公章' },
{ dictKey: '业务章', dictValue: '业务章' },
];
const SEAL_TYPE_ORDER = SETTLEMENT_SEAL_TYPE_OPTIONS.map(item => item.dictKey);
/**
* 解析用印类型为数组(兼容顿号、逗号分隔)
*/
export const parseSealTypes = value => {
if (Array.isArray(value)) {
return value.map(item => String(item || '').trim()).filter(Boolean);
}
if (value === undefined || value === null || value === '') {
return [];
}
return String(value)
.split(/[、,,\s]+/)
.map(item => item.trim())
.filter(Boolean);
};
/**
* 用印类型按固定顺序顿号拼接,供保存与列表展示
*/
export const formatSealTypes = value => {
const selected = new Set(parseSealTypes(value));
return SEAL_TYPE_ORDER.filter(item => selected.has(item)).join('、');
};
+2 -5
View File
@@ -6,7 +6,6 @@
:data="data" :data="data"
ref="crud" ref="crud"
v-model="form" v-model="form"
v-model:page="page"
:permission="permissionList" :permission="permissionList"
:before-open="beforeOpen" :before-open="beforeOpen"
@row-del="rowDel" @row-del="rowDel"
@@ -102,7 +101,7 @@
style="margin-bottom: 12px; background: #f5f7fa; padding: 6px 10px; border-radius: 4px" style="margin-bottom: 12px; background: #f5f7fa; padding: 6px 10px; border-radius: 4px"
> >
<span style="color: #606266; font-size: 13px" <span style="color: #606266; font-size: 13px"
>仅展示菜单权限已勾选的菜单,已配置的数据权限会保留。勾选多个菜单后点击「设置」可批量配置</span >勾选多个菜单后点击「设置」,可批量配置数据权限;设置后菜单旁展示当前范围</span
> >
<el-button type="primary" size="small" @click="openDataScopeSetting">设置</el-button> <el-button type="primary" size="small" @click="openDataScopeSetting">设置</el-button>
</el-row> </el-row>
@@ -730,9 +729,7 @@ export default {
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true; this.loading = true;
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
const data = res.data.data || {}; this.data = res.data.data;
this.data = data.records || [];
this.page.total = data.total || 0;
this.loading = false; this.loading = false;
this.selectionClear(); this.selectionClear();
}); });
+304 -91
View File
@@ -8,9 +8,6 @@
:data="data" :data="data"
:table-loading="loading" :table-loading="loading"
:permission="permissionList" :permission="permissionList"
:before-open="beforeOpen"
@row-save="rowSave"
@row-update="rowUpdate"
@row-del="rowDel" @row-del="rowDel"
@search-change="searchChange" @search-change="searchChange"
@search-reset="searchReset" @search-reset="searchReset"
@@ -20,11 +17,21 @@
@refresh-change="refreshChange" @refresh-change="refreshChange"
@on-load="onLoad" @on-load="onLoad"
> >
<template #menu-left>
<el-button
v-if="permission.invoice_item_add"
type="primary"
icon="el-icon-plus"
@click="openDialog()"
>
新增
</el-button>
</template>
<template #menu="scope"> <template #menu="scope">
<el-link <el-link
v-if="permission.invoice_item_edit" v-if="permission.invoice_item_edit"
type="primary" type="primary"
@click="$refs.crud.rowEdit(scope.row, scope.index)" @click="openDialog(scope.row)"
> >
修改 修改
</el-link> </el-link>
@@ -37,24 +44,125 @@
</el-link> </el-link>
</template> </template>
<template #defaultTaxRate="scope">{{ scope.row.defaultTaxRate }}%</template> <template #defaultTaxRate="scope">{{ scope.row.defaultTaxRate }}%</template>
<template #defaultTaxRate-form>
<el-input
v-model="form.defaultTaxRate"
inputmode="decimal"
maxlength="6"
clearable
placeholder="请输入默认税率"
@input="handleTaxRateInput"
>
<template #append>%</template>
</el-input>
</template>
</avue-crud> </avue-crud>
<el-dialog
v-model="dialog.visible"
:title="dialog.title"
width="900px"
append-to-body
:close-on-click-modal="false"
>
<el-form ref="dialogForm" :model="dialog.form" label-width="130px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="货物或服务简称" required prop="shortName">
<el-input v-model="dialog.form.shortName" maxlength="100" clearable placeholder="请输入货物或服务简称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="税收分类编码" required prop="taxClassificationCode">
<el-input v-model="dialog.form.taxClassificationCode" maxlength="30" clearable placeholder="请输入税收分类编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商品和服务分类名称" required prop="categoryName">
<el-input v-model="dialog.form.categoryName" maxlength="200" clearable placeholder="请输入商品和服务分类名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="默认税率" required prop="defaultTaxRate">
<el-input
v-model="dialog.form.defaultTaxRate"
inputmode="decimal"
maxlength="6"
clearable
placeholder="请输入默认税率"
@input="handleTaxRateInput"
>
<template #append>%</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="关联费用项目">
<div class="fee-item-box">
<span class="fee-item-tip">可拖动排序,发票冲抵费用项目时,按设置的顺序冲抵费用</span>
<el-button type="primary" size="small" @click="addFeeItem">添加</el-button>
<table class="fee-item-table">
<thead>
<tr>
<th width="36"></th>
<th width="60">序号</th>
<th>费用类型</th>
<th>费用项目</th>
<th width="60">操作</th>
</tr>
</thead>
<tbody>
<tr
v-for="(item, index) in dialog.form.feeItems"
:key="index"
draggable="true"
@dragstart="onFeeDragStart(index, $event)"
@dragover.prevent
@drop="onFeeDrop(index, $event)"
@dragend="onFeeDragEnd"
>
<td class="fee-item-drag" :class="{ 'is-dragging': feeDragIndex === index }">≡</td>
<td>{{ index + 1 }}</td>
<td>
<el-select v-model="item.feeCategory" placeholder="请选择" clearable filterable @change="() => onFeeCategoryChange(item)">
<el-option
v-for="category in feeCategoryOptions"
:key="category.value"
:label="category.label"
:value="category.value"
/>
</el-select>
</td>
<td>
<el-select
v-model="item.feeItemId"
placeholder="请先选择费用类型"
:disabled="!item.feeCategory"
clearable
filterable
@change="onFeeItemChange(item)"
>
<el-option
v-for="fee in feeItemsOfCategory(item.feeCategory)"
:key="fee.id"
:label="fee.name"
:value="fee.id"
/>
</el-select>
</td>
<td>
<el-link type="danger" @click="removeFeeItem(index)">删除</el-link>
</td>
</tr>
<tr v-if="!dialog.form.feeItems.length">
<td colspan="5" class="fee-item-empty">暂无数据</td>
</tr>
</tbody>
</table>
</div>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialog.visible = false">取消</el-button>
<el-button type="primary" :loading="dialog.saving" @click="saveDialog">保存</el-button>
</template>
</el-dialog>
</basic-container> </basic-container>
</template> </template>
<script> <script>
import { getList, getDetail, submit, remove } from '@/api/base/invoice-item'; import { getList, getDetail, submit, remove } from '@/api/base/invoice-item';
import { getList as getFeeItemList } from '@/api/base/fee-item';
import { getDictionaryAll } from '@/api/system/dictbiz';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
@@ -65,6 +173,16 @@ export default {
loading: true, loading: true,
query: {}, query: {},
selectionList: [], selectionList: [],
feeItemOptions: [],
// 费用类型字典选项(fee_category 字典:dictKey-编码A01,dictValue-名称运输)
feeCategoryDictOptions: [],
feeDragIndex: null,
dialog: {
visible: false,
title: '新增',
saving: false,
form: this.emptyForm(),
},
page: { page: {
pageSize: 10, pageSize: 10,
pageSizes: [10, 30, 50, 100, 200], pageSizes: [10, 30, 50, 100, 200],
@@ -81,13 +199,11 @@ export default {
indexLabel: '序号', indexLabel: '序号',
indexWidth: 70, indexWidth: 70,
selection: false, selection: false,
addBtn: true, addBtn: false,
editBtn: false, editBtn: false,
delBtn: false, delBtn: false,
viewBtn: false, viewBtn: false,
menuWidth: 140, menuWidth: 140,
dialogWidth: 900,
dialogClickModal: false,
labelPosition: 'right', labelPosition: 'right',
labelWidth: 'auto', labelWidth: 'auto',
searchShow: true, searchShow: true,
@@ -100,49 +216,22 @@ export default {
label: '货物或服务简称', label: '货物或服务简称',
prop: 'shortName', prop: 'shortName',
minWidth: 160, minWidth: 160,
span: 12,
maxlength: 100,
rules: [{ required: true, message: '请输入货物或服务简称', trigger: 'blur' }],
}, },
{ {
label: '税收分类编码', label: '税收分类编码',
prop: 'taxClassificationCode', prop: 'taxClassificationCode',
minWidth: 190, minWidth: 190,
span: 12,
maxlength: 30,
rules: [{ required: true, message: '请输入税收分类编码', trigger: 'blur' }],
}, },
{ {
label: '商品和服务分类名称', label: '商品和服务分类名称',
prop: 'categoryName', prop: 'categoryName',
minWidth: 220, minWidth: 220,
span: 12,
maxlength: 200,
rules: [{ required: true, message: '请输入商品和服务分类名称', trigger: 'blur' }],
}, },
{ {
label: '默认税率', label: '默认税率',
prop: 'defaultTaxRate', prop: 'defaultTaxRate',
type: 'input',
formslot: true,
slot: true,
minWidth: 120, minWidth: 120,
span: 12, slot: true,
rules: [
{ required: true, message: '请输入默认税率', trigger: 'blur' },
{
validator: (rule, value, callback) => {
const text = String(value ?? '');
const rate = Number(text);
if (!/^\d+(\.\d+)?$/.test(text) || rate < 0 || rate > 100) {
callback(new Error('默认税率必须是0到100之间的数字'));
return;
}
callback();
},
trigger: 'blur',
},
],
}, },
{ {
label: '税收项目', label: '税收项目',
@@ -193,27 +282,131 @@ export default {
delBtn: false, delBtn: false,
}; };
}, },
// 费用类型下拉选项:优先字典(显示"名称/编码"),无字典数据时兜底费用项目库提取
feeCategoryOptions() {
if (this.feeCategoryDictOptions.length) return this.feeCategoryDictOptions;
return [...new Set(this.feeItemOptions.map(fee => fee.feeCategory).filter(Boolean))]
.map(category => ({ label: category, value: category }));
},
}, },
methods: { methods: {
rowSave(row, done, loading) { emptyForm() {
submit(this.normalizeTaxRateRow(row)).then( return {
() => { id: null,
this.onLoad(this.page); shortName: '',
this.$message.success('操作成功'); taxClassificationCode: '',
done(); categoryName: '',
}, defaultTaxRate: 0,
() => loading() feeItems: [],
); };
}, },
rowUpdate(row, index, done, loading) { openDialog(row) {
submit(this.normalizeTaxRateRow(row)).then( this.dialog.form = this.emptyForm();
() => { this.dialog.title = row ? '编辑' : '新增';
this.onLoad(this.page); this.dialog.visible = true;
this.loadFeeItemOptions();
this.initFeeCategoryOptions();
if (row) {
// 编辑回填:后端 detail 返回关联费用项目(按排序号升序)
getDetail(row.id).then(res => {
const detail = res.data.data || {};
this.dialog.form = {
...this.emptyForm(),
...detail,
defaultTaxRate: detail.defaultTaxRate ?? 0,
feeItems: (detail.feeItems || []).map(item => ({
feeItemId: item.feeItemId,
feeItemName: item.feeItemName,
feeCategory: item.feeCategory,
})),
};
});
}
},
loadFeeItemOptions() {
if (this.feeItemOptions.length) return;
getFeeItemList(1, 1000, { status: 1 }).then(res => {
this.feeItemOptions = (res.data.data?.records) || [];
});
},
// 费用类型字典:code=fee_category(dictKey-编码如A01,dictValue-名称如运输),label 显示"名称/编码"与费用项目页一致
initFeeCategoryOptions() {
if (this.feeCategoryDictOptions.length) return;
getDictionaryAll().then(res => {
this.feeCategoryDictOptions = (res.data.data || [])
.filter(item => item.code === 'fee_category' && Number(item.parentId) > 0)
.sort((first, second) => Number(first.sort || 0) - Number(second.sort || 0))
.map(item => ({
label: `${item.dictValue}/${item.dictKey}`,
value: String(item.dictKey),
}));
});
},
// 级联:该费用类型下的费用项目选项
feeItemsOfCategory(feeCategory) {
if (!feeCategory) return [];
return this.feeItemOptions.filter(fee => fee.feeCategory === feeCategory);
},
// 先选费用类型:清空原费用项目(原项目可能不属于新类型)
onFeeCategoryChange(item) {
item.feeItemId = null;
item.feeItemName = '';
},
// 后选费用项目:带出名称(费用类型已由上级确定)
onFeeItemChange(item) {
const fee = this.feeItemsOfCategory(item.feeCategory).find(option => option.id === item.feeItemId);
item.feeItemName = fee ? fee.name : '';
},
addFeeItem() {
this.dialog.form.feeItems.push({ feeItemId: null, feeItemName: '', feeCategory: '' });
},
removeFeeItem(index) {
this.dialog.form.feeItems.splice(index, 1);
},
onFeeDragStart(index, event) {
this.feeDragIndex = index;
event.dataTransfer.effectAllowed = 'move';
},
onFeeDrop(index) {
const from = this.feeDragIndex;
if (from === null || from === index) return;
const items = this.dialog.form.feeItems;
items.splice(index, 0, items.splice(from, 1)[0]);
this.feeDragIndex = null;
},
onFeeDragEnd() {
this.feeDragIndex = null;
},
saveDialog() {
const formItem = this.dialog.form;
if (!formItem.shortName) return this.$message.warning('请输入货物或服务简称');
if (!formItem.taxClassificationCode) return this.$message.warning('请输入税收分类编码');
if (!formItem.categoryName) return this.$message.warning('请输入商品和服务分类名称');
const rate = Number(formItem.defaultTaxRate);
if (!/^\d+(\.\d+)?$/.test(String(formItem.defaultTaxRate ?? '')) || rate < 0 || rate > 100) {
return this.$message.warning('默认税率必须是0到100之间的数字');
}
if (formItem.feeItems.some(item => !item.feeItemId)) {
return this.$message.warning('请选择关联费用项目');
}
this.dialog.saving = true;
submit({
...formItem,
defaultTaxRate: rate,
feeItems: formItem.feeItems.map(item => ({
feeItemId: item.feeItemId,
feeItemName: item.feeItemName,
feeCategory: item.feeCategory,
})),
})
.then(() => {
this.$message.success('操作成功'); this.$message.success('操作成功');
done(); this.dialog.visible = false;
}, this.onLoad(this.page);
() => loading() })
); .finally(() => {
this.dialog.saving = false;
});
}, },
rowDel(row) { rowDel(row) {
this.$confirm('确定将选择数据删除?', '提示', { type: 'warning' }) this.$confirm('确定将选择数据删除?', '提示', { type: 'warning' })
@@ -223,27 +416,11 @@ export default {
this.$message.success('操作成功'); this.$message.success('操作成功');
}); });
}, },
beforeOpen(done, type) {
if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(res => {
this.form = res.data.data || {};
done();
});
return;
}
this.form = { defaultTaxRate: 0 };
done();
},
handleTaxRateInput(value) { handleTaxRateInput(value) {
let normalized = String(value || '').replace(/[^\d.]/g, ''); let normalized = String(value || '').replace(/[^\d.]/g, '');
normalized = normalized.replace(/(\..*)\./g, '$1'); normalized = normalized.replace(/(\..*)\./g, '$1');
if (normalized.startsWith('.')) normalized = `0${normalized}`; if (normalized.startsWith('.')) normalized = `0${normalized}`;
this.form.defaultTaxRate = normalized; this.dialog.form.defaultTaxRate = normalized;
},
normalizeTaxRateRow(row) {
const values = { ...row };
values.defaultTaxRate = Number(values.defaultTaxRate);
return values;
}, },
searchChange(params, done) { searchChange(params, done) {
this.query = { this.query = {
@@ -292,17 +469,53 @@ export default {
margin-bottom: 8px; margin-bottom: 8px;
} }
.invoice-item-page :deep(.avue-crud__dialog .el-form-item) {
margin-bottom: 28px;
}
.invoice-item-page :deep(.avue-crud__dialog .el-form-item__error) {
position: relative;
line-height: 20px;
white-space: normal;
}
.invoice-item-page :deep(.avue-crud__menu .el-link) { .invoice-item-page :deep(.avue-crud__menu .el-link) {
margin-right: 8px; margin-right: 8px;
} }
.fee-item-box {
width: 100%;
}
.fee-item-tip {
display: inline-block;
margin-right: 12px;
color: #f56c6c;
font-size: 12px;
}
.fee-item-table {
width: 100%;
margin-top: 8px;
border-collapse: collapse;
}
.fee-item-table th,
.fee-item-table td {
padding: 8px;
border: 1px solid #ebeef5;
text-align: center;
font-size: 13px;
}
.fee-item-table th {
background: #f8f8f9;
color: #515a6e;
font-weight: 500;
}
.fee-item-drag {
cursor: move;
color: #909399;
font-size: 16px;
user-select: none;
}
.fee-item-drag.is-dragging {
color: #409eff;
}
.fee-item-empty {
color: #909399;
}
</style> </style>
@@ -3949,9 +3949,9 @@ export default {
return Object.values(groups) return Object.values(groups)
.map(group => { .map(group => {
const quantity = this.formatDispatchQuantity(group.quantity); const quantity = this.formatDispatchQuantity(group.quantity);
const typeName = return `${group.typeName}等${group.count}种货物 | ${quantity}${
group.count > 1 ? `${group.typeName}等${group.count}种货物` : group.typeName; group.unit ? ` ${group.unit}` : ''
return `${typeName} | ${quantity}${group.unit ? ` ${group.unit}` : ''}`; }`;
}) })
.join('; '); .join('; ');
}, },
@@ -7549,13 +7549,12 @@ export default {
}, {}); }, {});
const cargoInfo = Object.values(groups) const cargoInfo = Object.values(groups)
.map(group => { .map(
const typeName = group =>
group.count > 1 ? `${group.cargoType}等${group.count}种货物` : group.cargoType; `${group.cargoType}等${group.count}种货物 | ${this.formatDispatchQuantity(
return `${typeName} | ${this.formatDispatchQuantity(group.quantity)}${ group.quantity
group.unit ? ` ${group.unit}` : '' )}${group.unit ? ` ${group.unit}` : ''}`
}`; )
})
.join('; '); .join('; ');
return cargoInfo || plan.goodsInfo || ''; return cargoInfo || plan.goodsInfo || '';
}, },
@@ -5018,9 +5018,9 @@ export default {
return Object.values(groups) return Object.values(groups)
.map(group => { .map(group => {
const quantity = this.formatQuantity(group.quantity); const quantity = this.formatQuantity(group.quantity);
const typeName = return `${group.typeName}等${group.count}种货物 | ${quantity}${
group.count > 1 ? `${group.typeName}等${group.count}种货物` : group.typeName; group.unit ? ` ${group.unit}` : ''
return `${typeName} | ${quantity}${group.unit ? ` ${group.unit}` : ''}`; }`;
}) })
.join('; '); .join('; ');
}, },
@@ -13,18 +13,8 @@ export default {
components: { MkPublicShell, ContractManageChange }, components: { MkPublicShell, ContractManageChange },
methods: { methods: {
getForm() { getForm() {
const page = this.$refs.page; const row = this.$refs.page?.form || {};
const row = page?.form || {}; return { ...row, subject: row.contractName || row.contractNo || '' };
return {
...row,
partyAJson: row.partyAJson || '',
partyBJson: row.partyBJson || '',
partyCJson: row.partyCJson || '',
partyARows: page?.partyARows || [],
partyBRows: page?.partyBRows || [],
partyCRows: page?.partyCRows || [],
subject: row.contractName || row.contractNo || '',
};
}, },
}, },
}; };
+5 -42
View File
@@ -69,8 +69,11 @@
<el-form-item label="合同负责部门"> <el-form-item label="合同负责部门">
<el-input v-model="form.organizationName" disabled /> <el-input v-model="form.organizationName" disabled />
</el-form-item> </el-form-item>
<el-form-item label="平台公司"> <el-form-item label="甲方">
<el-input v-model="form.platformCompanyName" disabled /> <el-input v-model="form.partyA" disabled />
</el-form-item>
<el-form-item label="乙方">
<el-input v-model="form.partyB" disabled />
</el-form-item> </el-form-item>
<el-form-item label="签订日期"> <el-form-item label="签订日期">
<el-date-picker <el-date-picker
@@ -269,29 +272,6 @@
</div> </div>
</section> </section>
<section
v-for="party in partySections"
:key="party.role"
class="change-section contract-party-section"
>
<div class="dialog-section-title">{{ party.label }}</div>
<el-table :data="party.rows" border empty-text="暂无数据" class="change-table">
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column prop="customerName" label="客商名称" min-width="200" align="center">
<template #default="{ row }">{{ row.customerName || '-' }}</template>
</el-table-column>
<el-table-column prop="creditCode" label="统一信用代码" min-width="180" align="center">
<template #default="{ row }">{{ row.creditCode || '-' }}</template>
</el-table-column>
<el-table-column prop="contactName" label="联系人" min-width="160" align="center">
<template #default="{ row }">{{ row.contactName || '-' }}</template>
</el-table-column>
<el-table-column prop="contactPhone" label="联系电话" min-width="150" align="center">
<template #default="{ row }">{{ row.contactPhone || '-' }}</template>
</el-table-column>
</el-table>
</section>
<contract-attachment-section <contract-attachment-section
title="用印材料" title="用印材料"
description description
@@ -819,13 +799,6 @@ export default {
.join('、'); .join('、');
return `【${parties || '相对方'}】:被列入外部黑名单;涉贪污受贿裁判相关提及方(3年以上及其他);被执行人信息;买卖合同纠纷;劳动纠纷;重大纠纷。提交变更前须上传「特批附件」类型附件`; return `【${parties || '相对方'}】:被列入外部黑名单;涉贪污受贿裁判相关提及方(3年以上及其他);被执行人信息;买卖合同纠纷;劳动纠纷;重大纠纷。提交变更前须上传「特批附件」类型附件`;
}, },
partySections() {
return [
{ role: 'A', label: '甲方', rows: this.partyARows },
{ role: 'B', label: '乙方', rows: this.partyBRows },
{ role: 'C', label: '丙方', rows: this.partyCRows },
];
},
isSettlementRuleChange() { isSettlementRuleChange() {
return this.form.changeType === '结算规则变更'; return this.form.changeType === '结算规则变更';
}, },
@@ -1280,16 +1253,6 @@ export default {
.contract-change-page :deep(.basic-container__card) { border: 0; background: transparent; box-shadow: none; } .contract-change-page :deep(.basic-container__card) { border: 0; background: transparent; box-shadow: none; }
.contract-change-form { background: #f5f6fa; } .contract-change-form { background: #f5f6fa; }
.change-section { padding: 20px 24px; background: #fff; border-bottom: 1px solid #eff1f7; margin-top: 12px; } .change-section { padding: 20px 24px; background: #fff; border-bottom: 1px solid #eff1f7; margin-top: 12px; }
.contract-party-section {
margin-bottom: 12px;
padding: 14px 16px 16px;
overflow: hidden;
background: #fff;
border-bottom: 0;
border-radius: 6px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.contract-party-section > .dialog-section-title { margin-bottom: 16px; color: #303133; }
.contract-basic-section { margin-bottom: 12px; padding: 14px 16px 16px; overflow: hidden; background: #fff; border-bottom: 0; border-radius: 6px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); } .contract-basic-section { margin-bottom: 12px; padding: 14px 16px 16px; overflow: hidden; background: #fff; border-bottom: 0; border-radius: 6px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
.contract-basic-section > .dialog-section-title { margin-bottom: 20px; color: #303133; } .contract-basic-section > .dialog-section-title { margin-bottom: 20px; color: #303133; }
.contract-basic-section__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 48px; } .contract-basic-section__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 48px; }
@@ -13,18 +13,8 @@ export default {
components: { MkPublicShell, ContractManage }, components: { MkPublicShell, ContractManage },
methods: { methods: {
getForm() { getForm() {
const page = this.$refs.page; const row = this.$refs.page?.detailRow || {};
const row = page?.detailRow || {}; return { ...row, subject: row.contractName || row.contractNo || '' };
return {
...row,
partyAJson: row.partyAJson || '',
partyBJson: row.partyBJson || '',
partyCJson: row.partyCJson || '',
partyARows: page?.detailPartyARows || [],
partyBRows: page?.detailPartyBRows || [],
partyCRows: page?.detailPartyCRows || [],
subject: row.contractName || row.contractNo || '',
};
}, },
}, },
}; };
+28 -87
View File
@@ -174,6 +174,9 @@
<el-descriptions-item label="项目">{{ <el-descriptions-item label="项目">{{
detailValue('projectName') detailValue('projectName')
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="甲方">{{ detailValue('partyA') }}</el-descriptions-item>
<el-descriptions-item label="乙方">{{ detailValue('partyB') }}</el-descriptions-item>
<el-descriptions-item label="丙方">{{ detailValue('partyC') || '-' }}</el-descriptions-item>
<el-descriptions-item label="合同期限">{{ detailContractPeriod }}</el-descriptions-item> <el-descriptions-item label="合同期限">{{ detailContractPeriod }}</el-descriptions-item>
<el-descriptions-item label="合同负责部门">{{ <el-descriptions-item label="合同负责部门">{{
detailValue('organizationName') detailValue('organizationName')
@@ -236,29 +239,6 @@
</el-descriptions> </el-descriptions>
</section> </section>
<section
v-for="party in detailPartySections"
:key="`detail-${party.role}`"
class="contract-manage-form__section contract-manage-form__section--panel"
>
<div class="dialog-section-title">{{ party.label }}</div>
<el-table :data="party.rows" border empty-text="暂无数据">
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column prop="customerName" label="客商名称" min-width="200" align="center">
<template #default="{ row }">{{ row.customerName || '-' }}</template>
</el-table-column>
<el-table-column prop="creditCode" label="统一信用代码" min-width="180" align="center">
<template #default="{ row }">{{ row.creditCode || '-' }}</template>
</el-table-column>
<el-table-column prop="contactName" label="联系人" min-width="160" align="center">
<template #default="{ row }">{{ row.contactName || '-' }}</template>
</el-table-column>
<el-table-column prop="contactPhone" label="联系电话" min-width="150" align="center">
<template #default="{ row }">{{ row.contactPhone || '-' }}</template>
</el-table-column>
</el-table>
</section>
<hcs-contract-panel <hcs-contract-panel
v-if="!isPublicViewPage" v-if="!isPublicViewPage"
:contract="detailRow" :contract="detailRow"
@@ -1225,8 +1205,7 @@ import {
getDetail as getCustomerArchiveDetail, getDetail as getCustomerArchiveDetail,
getList as getCustomerArchiveList, getList as getCustomerArchiveList,
} from '@/api/vehicle/customer-archive'; } from '@/api/vehicle/customer-archive';
import { getBusinessDeptSelect, getDeptTree, getPlatformCompanySelect } from '@/api/system/dept'; import { getBusinessDeptSelect, getDeptTree } from '@/api/system/dept';
import { normalizeBusinessDeptOptions } from '@/utils/dept';
import { getDictionary as getSystemDictionary } from '@/api/system/dict'; import { getDictionary as getSystemDictionary } from '@/api/system/dict';
import { getDictionary as getBizDictionary } from '@/api/system/dictbiz'; import { getDictionary as getBizDictionary } from '@/api/system/dictbiz';
import { config, option } from '@/option/business/contract-manage'; import { config, option } from '@/option/business/contract-manage';
@@ -1600,9 +1579,6 @@ export default {
billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'], billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'],
detailLoading: false, detailLoading: false,
detailRow: {}, detailRow: {},
detailPartyARows: [],
detailPartyBRows: [],
detailPartyCRows: [],
// 合规(HCS)推送/对账状态;受 thirdParty.hcs.push.immediate-enabled 控制显隐 // 合规(HCS)推送/对账状态;受 thirdParty.hcs.push.immediate-enabled 控制显隐
hcsRepushingId: null, hcsRepushingId: null,
hcsImmediateEnabled: false, hcsImmediateEnabled: false,
@@ -1731,13 +1707,6 @@ export default {
{ role: 'C', label: '丙方', rows: this.partyCRows }, { role: 'C', label: '丙方', rows: this.partyCRows },
]; ];
}, },
detailPartySections() {
return [
{ role: 'A', label: '甲方', rows: this.detailPartyARows },
{ role: 'B', label: '乙方', rows: this.detailPartyBRows },
{ role: 'C', label: '丙方', rows: this.detailPartyCRows },
];
},
/** /**
* 计费方案适用客商: * 计费方案适用客商:
* - 客户合同:仅甲方(仅 1 个甲方时编辑器自动选中) * - 客户合同:仅甲方(仅 1 个甲方时编辑器自动选中)
@@ -2709,55 +2678,28 @@ export default {
applyProjectPlatformCompanies(project, autoSelect = false) { applyProjectPlatformCompanies(project, autoSelect = false) {
const ids = this.parseUndertakeDeptIds(project?.undertakeDeptId); const ids = this.parseUndertakeDeptIds(project?.undertakeDeptId);
const names = this.parseUndertakeDeptNames(project?.undertakeDeptName); const names = this.parseUndertakeDeptNames(project?.undertakeDeptName);
// 项目可能仍挂旧组织 ID(已删/非平台公司),按名称映射到现行「是否平台公司=是」的组织 this.platformCompanyOptions = ids.map((id, index) => ({
return this.resolveProjectPlatformCompanyOptions(ids, names).then(options => {
this.platformCompanyOptions = options;
if (!autoSelect) {
this.syncCurrentPlatformCompanyOption();
return options;
}
if (this.platformCompanyOptions.length === 1) {
this.form.platformCompanyId = this.platformCompanyOptions[0].id;
this.form.platformCompanyName = this.platformCompanyOptions[0].label;
} else if (
!this.platformCompanyOptions.some(
item => String(item.id) === String(this.form.platformCompanyId)
)
) {
this.form.platformCompanyId = '';
this.form.platformCompanyName = '';
} else {
this.handlePlatformCompanyChange(this.form.platformCompanyId);
}
if (this.formMode === 'add') this.refreshPreviewContractNo();
return options;
});
},
resolveProjectPlatformCompanyOptions(ids, names) {
const fallback = ids.map((id, index) => ({
id: String(id), id: String(id),
label: names[index] || String(id), label: names[index] || String(id),
})); }));
if (!ids.length) return Promise.resolve([]); if (!autoSelect) {
return getPlatformCompanySelect() this.syncCurrentPlatformCompanyOption();
.then(res => { return;
const liveList = (res.data?.data || []).map(item => ({ }
id: String(item.id), if (this.platformCompanyOptions.length === 1) {
label: item.deptName || item.fullName || String(item.id), this.form.platformCompanyId = this.platformCompanyOptions[0].id;
})); this.form.platformCompanyName = this.platformCompanyOptions[0].label;
return ids.map((id, index) => { } else if (
const name = String(names[index] || '').trim(); !this.platformCompanyOptions.some(
const byId = liveList.find(item => String(item.id) === String(id)); item => String(item.id) === String(this.form.platformCompanyId)
if (byId) return byId; )
const byName = name ? liveList.find(item => item.label === name) : null; ) {
if (byName) return byName; this.form.platformCompanyId = '';
return { this.form.platformCompanyName = '';
id: String(id), } else {
label: name || String(id), this.handlePlatformCompanyChange(this.form.platformCompanyId);
}; }
}); if (this.formMode === 'add') this.refreshPreviewContractNo();
})
.catch(() => fallback);
}, },
handlePlatformCompanyChange(value) { handlePlatformCompanyChange(value) {
const matched = this.platformCompanyOptions.find(item => String(item.id) === String(value)); const matched = this.platformCompanyOptions.find(item => String(item.id) === String(value));
@@ -3151,8 +3093,11 @@ export default {
this.businessDeptLoading = true; this.businessDeptLoading = true;
getBusinessDeptSelect() getBusinessDeptSelect()
.then(res => { .then(res => {
// 同名业务部门(不同上级公司)展示「部门(上级)」;落库仍用 rawLabel 原始部门名 this.businessDeptOptions = (res.data?.data || []).map(item => ({
this.businessDeptOptions = normalizeBusinessDeptOptions(res.data?.data || []); id: String(item.id),
label: item.deptName || item.fullName || String(item.id),
rawLabel: item.deptName || item.fullName || String(item.id),
}));
this.syncCurrentBusinessDeptOption(); this.syncCurrentBusinessDeptOption();
}) })
.finally(() => { .finally(() => {
@@ -3168,7 +3113,6 @@ export default {
} }
this.businessDeptOptions.unshift({ this.businessDeptOptions.unshift({
id: String(this.form.organizationId), id: String(this.form.organizationId),
value: String(this.form.organizationId),
label: this.form.organizationName, label: this.form.organizationName,
rawLabel: this.form.organizationName, rawLabel: this.form.organizationName,
}); });
@@ -3512,9 +3456,6 @@ export default {
invoiceCycle: normalizeOptionalInteger(detail.invoiceCycle), invoiceCycle: normalizeOptionalInteger(detail.invoiceCycle),
paymentDays: normalizeOptionalInteger(detail.paymentDays), paymentDays: normalizeOptionalInteger(detail.paymentDays),
}; };
this.detailPartyARows = this.normalizePartyRows(detail.partyAJson, detail.partyA, true);
this.detailPartyBRows = this.normalizePartyRows(detail.partyBJson, detail.partyB, true);
this.detailPartyCRows = this.normalizePartyRows(detail.partyCJson, detail.partyC, false);
this.detailContractFileRows = normalizeContractFileRows(parseArray(detail.contractFileJson)); this.detailContractFileRows = normalizeContractFileRows(parseArray(detail.contractFileJson));
this.detailAttachmentRows = parseArray(detail.attachmentsJson); this.detailAttachmentRows = parseArray(detail.attachmentsJson);
this.detailBillingPlanRows = parseArray(detail.billingPlanJson); this.detailBillingPlanRows = parseArray(detail.billingPlanJson);
+3 -3
View File
@@ -2545,9 +2545,9 @@ export default {
Object.values(groups) Object.values(groups)
.map(group => { .map(group => {
const quantity = this.formatGoodsQuantity(group.quantity); const quantity = this.formatGoodsQuantity(group.quantity);
const typeName = return `${group.typeName}等${group.count}种货物 | ${quantity}${
group.count > 1 ? `${group.typeName}等${group.count}种货物` : group.typeName; group.unit ? ` ${group.unit}` : ''
return `${typeName} | ${quantity}${group.unit ? ` ${group.unit}` : ''}`; }`;
}) })
.join('; ') || '-' .join('; ') || '-'
); );
+2 -24
View File
@@ -489,12 +489,6 @@ const NODE_TEMPLATES = [
}, },
]; ];
// 过程配置必须覆盖装货端与卸货端各一个节点;货量下限只看装货端——
// 到场没有货量开关,不能拿它顶替货量采集
const PICKUP_NODE_KEYS = ['arrive_scene', 'load', 'dispatch'];
const DELIVERY_NODE_KEYS = ['unload', 'arrival', 'sign', 'return'];
const CARGO_NODE_KEYS = ['load', 'dispatch'];
export default { export default {
data() { data() {
return { return {
@@ -922,24 +916,8 @@ export default {
this.$message.warning('备注不能超过500个字符'); this.$message.warning('备注不能超过500个字符');
return false; return false;
} }
const isEnabledNode = key => this.nodeRows.some(item => item.key === key && item.enabled); if (!this.enabledNodes.length) {
if (!PICKUP_NODE_KEYS.some(isEnabledNode)) { this.$message.warning('请至少选择一个过程节点');
this.$message.warning('发货、装货、到场至少选择一个');
return false;
}
if (!DELIVERY_NODE_KEYS.some(isEnabledNode)) {
this.$message.warning('卸货、到货、签收、回单至少选择一个');
return false;
}
// 装货端没有节点采集货量时,整条配置在小程序侧等于不采集货量
const collectsCargo = CARGO_NODE_KEYS.some(key =>
this.nodeRows.some(
item =>
item.key === key && item.enabled && item.uploadCargo && (item.cargoTypes || []).length
)
);
if (!collectsCargo) {
this.$message.warning('发货或装货至少勾选一个货量类型');
return false; return false;
} }
const transit = this.nodeRows.find(item => item.key === 'transit'); const transit = this.nodeRows.find(item => item.key === 'transit');
+19 -332
View File
@@ -676,7 +676,7 @@
<div class="project-apply-form__material-head"> <div class="project-apply-form__material-head">
<div class="dialog-section-title project-apply-form__material-title">项目材料</div> <div class="dialog-section-title project-apply-form__material-title">项目材料</div>
<span <span
v-if="!isChangeDialog && missingRequiredAttachmentTypes.length" v-if="missingRequiredAttachmentTypes.length"
class="project-apply-form__material-warn" class="project-apply-form__material-warn"
> >
未上传:{{ missingRequiredAttachmentTypes.join('、') }} 未上传:{{ missingRequiredAttachmentTypes.join('、') }}
@@ -698,11 +698,7 @@
<el-table-column type="index" label="序号" width="80" align="center" /> <el-table-column type="index" label="序号" width="80" align="center" />
<el-table-column label="附件类型" min-width="160" align="center"> <el-table-column label="附件类型" min-width="160" align="center">
<template #default="{ row }"> <template #default="{ row }">
<el-select <el-select v-model="row.fileType" placeholder="请选择" :disabled="dialogReadonly">
v-model="row.fileType"
placeholder="请选择"
:disabled="dialogReadonly || isChangeDialog"
>
<el-option <el-option
v-for="item in projectAttachmentTypeOptions" v-for="item in projectAttachmentTypeOptions"
:key="item.value" :key="item.value"
@@ -735,7 +731,7 @@
<el-input <el-input
v-model="row.description" v-model="row.description"
placeholder="请输入" placeholder="请输入"
:disabled="dialogReadonly || isChangeDialog" :disabled="dialogReadonly"
/> />
</template> </template>
</el-table-column> </el-table-column>
@@ -745,26 +741,14 @@
<el-table-column prop="uploadUserName" label="上传人" min-width="140" align="center" /> <el-table-column prop="uploadUserName" label="上传人" min-width="140" align="center" />
<el-table-column prop="uploadTime" label="上传时间" min-width="170" align="center" sortable/> <el-table-column prop="uploadTime" label="上传时间" min-width="170" align="center" sortable/>
<el-table-column label="操作" width="110" align="center"> <el-table-column label="操作" width="110" align="center">
<template #default="{ row, $index }"> <template #default="{ $index }">
<el-link <el-link v-if="!dialogReadonly" type="danger" @click="removeAttachment($index)"
v-if="isChangeDialog && !dialogReadonly" >删除</el-link
type="primary"
@click="openAdjustAttachmentDialog(row, $index)"
> >
调整
</el-link>
<el-link
v-else-if="!dialogReadonly && !isChangeDialog"
type="danger"
@click="removeAttachment($index)"
>
删除
</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<vehicle-attachment-upload <vehicle-attachment-upload
v-if="!isChangeDialog"
v-model="attachmentRows" v-model="attachmentRows"
class="project-apply-form__upload" class="project-apply-form__upload"
:readonly="dialogReadonly" :readonly="dialogReadonly"
@@ -777,57 +761,6 @@
/> />
</div> </div>
<div v-if="isChangeDialog" class="project-apply-form__material-card">
<div class="project-apply-form__material-head">
<div class="dialog-section-title project-apply-form__material-title">调整材料</div>
</div>
<el-table :data="adjustAttachmentRows" border class="project-apply-form__material-table">
<el-table-column type="index" label="序号" width="80" align="center" />
<el-table-column label="原附件" min-width="180" align="center" show-overflow-tooltip>
<template #default="{ row }">
{{ attachmentName(row.originAttachment) || '-' }}
</template>
</el-table-column>
<el-table-column label="附件类型" min-width="160" align="center">
<template #default="{ row }">{{ row.fileType || '-' }}</template>
</el-table-column>
<el-table-column
label="文件名"
min-width="220"
align="center"
show-overflow-tooltip
class-name="is-ellipsis-link"
>
<template #default="{ row }">
<span
class="attachment-file-name"
role="button"
tabindex="0"
@click="previewAttachment(row)"
@keydown.enter="previewAttachment(row)"
@keydown.space.prevent="previewAttachment(row)"
>{{ attachmentName(row) }}</span>
</template>
</el-table-column>
<el-table-column label="附件描述" min-width="200" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.description || '-' }}</template>
</el-table-column>
<el-table-column label="调整原因" min-width="180" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.adjustReason || '-' }}</template>
</el-table-column>
<el-table-column label="文件大小" min-width="120" align="center">
<template #default="{ row }">{{ formatFileSize(row.size) }}</template>
</el-table-column>
<el-table-column prop="uploadUserName" label="上传人" min-width="140" align="center" />
<el-table-column prop="uploadTime" label="上传时间" min-width="170" align="center" />
<el-table-column v-if="!dialogReadonly" label="操作" width="110" align="center">
<template #default="{ $index }">
<el-link type="danger" @click="removeAdjustAttachment($index)">删除</el-link>
</template>
</el-table-column>
</el-table>
</div>
<template v-if="showProjectContractSection"> <template v-if="showProjectContractSection">
<div class="dialog-section-title project-apply-form__table-title">项目合同</div> <div class="dialog-section-title project-apply-form__table-title">项目合同</div>
<el-table <el-table
@@ -1078,86 +1011,6 @@
@close="attachmentImagePreviewVisible = false" @close="attachmentImagePreviewVisible = false"
/> />
<el-dialog
v-model="adjustAttachmentBox"
title="调整材料"
append-to-body
destroy-on-close
width="720px"
class="project-apply-adjust-dialog"
@closed="resetAdjustAttachmentForm"
>
<el-form
ref="adjustAttachmentFormRef"
:model="adjustAttachmentForm"
:rules="adjustAttachmentRules"
label-position="right"
label-width="auto"
>
<el-form-item label="原附件">
<span>{{ attachmentName(adjustAttachmentForm.originAttachment) || '-' }}</span>
</el-form-item>
<el-form-item label="附件类型" prop="fileType">
<el-select v-model="adjustAttachmentForm.fileType" placeholder="请选择" clearable>
<el-option
v-for="item in projectAttachmentTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="附件文件" prop="url">
<div class="project-apply-adjust-dialog__upload">
<span
v-if="attachmentName(adjustAttachmentForm)"
class="attachment-file-name"
role="button"
tabindex="0"
@click="previewAttachment(adjustAttachmentForm)"
@keydown.enter="previewAttachment(adjustAttachmentForm)"
@keydown.space.prevent="previewAttachment(adjustAttachmentForm)"
>
{{ attachmentName(adjustAttachmentForm) }}
</span>
<span v-else class="project-apply-adjust-dialog__upload-empty">请上传新材料</span>
<vehicle-attachment-upload
v-model="adjustAttachmentUploadRows"
:readonly="false"
:multiple="false"
:limit="1"
:file-types="attachmentFileTypes"
:max-size="50"
:show-file-list="false"
button-text="上传附件"
tip="支持pdf、bmp、jpeg、png、jpg、doc、docx、ppt、pptx、xlsx、xls、eml、msg、zip,单个文件不超过50M"
@change="handleAdjustAttachmentUploadChange"
/>
</div>
</el-form-item>
<el-form-item label="附件描述" prop="description">
<el-input v-model="adjustAttachmentForm.description" placeholder="请输入" maxlength="200" />
</el-form-item>
<el-form-item label="文件大小">
<span>{{ formatFileSize(adjustAttachmentForm.size) || '-' }}</span>
</el-form-item>
<el-form-item label="调整原因" prop="adjustReason" class="project-apply-form__change-textarea">
<el-input
v-model="adjustAttachmentForm.adjustReason"
type="textarea"
:rows="3"
maxlength="2000"
show-word-limit
placeholder="请输入调整原因"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="adjustAttachmentBox = false">取消</el-button>
<el-button type="primary" @click="confirmAdjustAttachment">确定</el-button>
</template>
</el-dialog>
<el-dialog <el-dialog
v-model="userBox" v-model="userBox"
title="选择用户" title="选择用户"
@@ -1241,7 +1094,6 @@ import {
getDetail as getCustomerArchiveDetail, getDetail as getCustomerArchiveDetail,
} from '@/api/vehicle/customer-archive'; } from '@/api/vehicle/customer-archive';
import { getBusinessDeptSelect, getPlatformCompanySelect } from '@/api/system/dept'; import { getBusinessDeptSelect, getPlatformCompanySelect } from '@/api/system/dept';
import { normalizeBusinessDeptOptions } from '@/utils/dept';
import { getDictionary as getSystemDictionary } from '@/api/system/dict'; import { getDictionary as getSystemDictionary } from '@/api/system/dict';
import { getDictionary as getBizDictionary } from '@/api/system/dictbiz'; import { getDictionary as getBizDictionary } from '@/api/system/dictbiz';
import { getList as getUserList } from '@/api/system/user'; import { getList as getUserList } from '@/api/system/user';
@@ -1313,7 +1165,6 @@ const emptyForm = () => ({
customerJson: '', customerJson: '',
carrierJson: '', carrierJson: '',
attachmentsJson: '', attachmentsJson: '',
adjustAttachmentsJson: '',
situationRemark: '', situationRemark: '',
projectIntro: '', projectIntro: '',
profitRemark: '', profitRemark: '',
@@ -1323,24 +1174,6 @@ const emptyForm = () => ({
changeReason: '', changeReason: '',
}); });
const emptyAdjustAttachmentForm = () => ({
uid: '',
fileType: '',
originalName: '',
name: '',
fileName: '',
url: '',
link: '',
fileUrl: '',
description: '',
size: '',
uploadUserName: '',
uploadTime: '',
adjustReason: '',
originAttachment: null,
originKey: '',
});
const optionalSentinelFields = [ const optionalSentinelFields = [
'projectScale', 'projectScale',
'estimatedProfit', 'estimatedProfit',
@@ -1615,29 +1448,6 @@ export default {
customerRows: [], customerRows: [],
carrierRows: [], carrierRows: [],
attachmentRows: [], attachmentRows: [],
adjustAttachmentRows: [],
adjustAttachmentBox: false,
adjustAttachmentForm: emptyAdjustAttachmentForm(),
adjustAttachmentUploadRows: [],
adjustAttachmentRules: {
fileType: [{ required: true, message: '请选择附件类型', trigger: 'change' }],
url: [
{
validator: (rule, value, callback) => {
if (!this.attachmentUrl(this.adjustAttachmentForm)) {
callback(new Error('请上传新材料'));
return;
}
callback();
},
trigger: 'change',
},
],
adjustReason: [
{ required: true, message: '请输入调整原因', trigger: 'blur' },
{ max: 2000, message: '调整原因不能超过2000个字符', trigger: 'blur' },
],
},
selectedAttachmentRows: [], selectedAttachmentRows: [],
attachmentImagePreviewVisible: false, attachmentImagePreviewVisible: false,
attachmentImagePreviewUrls: [], attachmentImagePreviewUrls: [],
@@ -2396,9 +2206,6 @@ export default {
this.customerRows = []; this.customerRows = [];
this.carrierRows = []; this.carrierRows = [];
this.attachmentRows = []; this.attachmentRows = [];
this.adjustAttachmentRows = [];
this.adjustAttachmentBox = false;
this.resetAdjustAttachmentForm();
this.selectedAttachmentRows = []; this.selectedAttachmentRows = [];
this.changeRows = []; this.changeRows = [];
this.projectContractRows = []; this.projectContractRows = [];
@@ -2440,7 +2247,6 @@ export default {
this.carrierRows = carrierRows; this.carrierRows = carrierRows;
this.attachmentRows = this.parseJsonArray(displayRow.attachmentsJson); this.attachmentRows = this.parseJsonArray(displayRow.attachmentsJson);
this.normalizeAttachmentFileTypes(); this.normalizeAttachmentFileTypes();
this.adjustAttachmentRows = this.parseJsonArray(displayRow.adjustAttachmentsJson);
this.selectedAttachmentRows = []; this.selectedAttachmentRows = [];
this.changeRows = this.buildChangeRows(displayRow); this.changeRows = this.buildChangeRows(displayRow);
this.selectedCustomerId = this.customerRows this.selectedCustomerId = this.customerRows
@@ -2749,9 +2555,6 @@ export default {
customerJson: JSON.stringify(this.customerRows), customerJson: JSON.stringify(this.customerRows),
carrierJson: JSON.stringify(this.carrierRows), carrierJson: JSON.stringify(this.carrierRows),
attachmentsJson: JSON.stringify(this.attachmentRows), attachmentsJson: JSON.stringify(this.attachmentRows),
adjustAttachmentsJson: this.isChangeDialog
? JSON.stringify(this.adjustAttachmentRows || [])
: undefined,
situationRemark: JSON.stringify({ situationRemark: JSON.stringify({
projectIntro: this.form.projectIntro || '', projectIntro: this.form.projectIntro || '',
profitRemark: this.form.profitRemark || '', profitRemark: this.form.profitRemark || '',
@@ -2767,9 +2570,6 @@ export default {
if (this.isNewProjectDialog && !options.includeChangeType) { if (this.isNewProjectDialog && !options.includeChangeType) {
delete submitRow.changeReason; delete submitRow.changeReason;
} }
if (!this.isChangeDialog) {
delete submitRow.adjustAttachmentsJson;
}
['projectIntro', 'profitRemark', 'riskPoint', 'emergencyPlan'].forEach( ['projectIntro', 'profitRemark', 'riskPoint', 'emergencyPlan'].forEach(
key => delete submitRow[key] key => delete submitRow[key]
); );
@@ -3179,8 +2979,19 @@ export default {
loadDeptOptions() { loadDeptOptions() {
getBusinessDeptSelect() getBusinessDeptSelect()
.then(res => { .then(res => {
// 仅展示「是否业务部门=是」;同名部门追加上级组织名区分 const bizList = res.data.data || [];
this.deptOptions = normalizeBusinessDeptOptions(res.data.data || []); // 仅展示「是否业务部门=是」的本级部门,扁平下拉
this.deptOptions = bizList
.map(item => {
const value = item.id == null || item.id === '' ? '' : String(item.id);
const label = item.deptName || item.fullName || item.title || item.name || value;
return {
label,
rawLabel: label,
value,
};
})
.filter(item => item.value);
this.fillDefaultBusinessDept(); this.fillDefaultBusinessDept();
this.ensureCurrentBusinessDeptOption(); this.ensureCurrentBusinessDeptOption();
}) })
@@ -3390,112 +3201,6 @@ export default {
removeAttachment(index) { removeAttachment(index) {
this.attachmentRows.splice(index, 1); this.attachmentRows.splice(index, 1);
}, },
attachmentIdentity(row = {}) {
const uid = String(row.uid || '').trim();
if (uid) return `uid:${uid}`;
const url = String(this.attachmentUrl(row) || '').trim();
if (url) return `url:${url}`;
const name = String(this.attachmentName(row) || '').trim();
const fileType = String(row.fileType || '').trim();
if (name || fileType) return `name:${fileType}|${name}`;
return '';
},
openAdjustAttachmentDialog(row) {
const originKey = this.attachmentIdentity(row);
const existing = this.adjustAttachmentRows.find(item => item.originKey === originKey);
if (existing) {
this.adjustAttachmentForm = {
...emptyAdjustAttachmentForm(),
...existing,
originAttachment: existing.originAttachment || { ...row },
originKey,
};
this.adjustAttachmentUploadRows = this.attachmentUrl(existing)
? [{ ...existing }]
: [];
} else {
this.adjustAttachmentForm = {
...emptyAdjustAttachmentForm(),
fileType: row.fileType || '',
description: row.description || '',
originAttachment: { ...row },
originKey,
};
this.adjustAttachmentUploadRows = [];
}
this.adjustAttachmentBox = true;
this.$nextTick(() => this.$refs.adjustAttachmentFormRef?.clearValidate?.());
},
resetAdjustAttachmentForm() {
this.adjustAttachmentForm = emptyAdjustAttachmentForm();
this.adjustAttachmentUploadRows = [];
this.$refs.adjustAttachmentFormRef?.clearValidate?.();
},
handleAdjustAttachmentUploadChange(list) {
const latest = Array.isArray(list) && list.length ? list[list.length - 1] : null;
if (!latest) {
this.adjustAttachmentForm = {
...this.adjustAttachmentForm,
uid: '',
originalName: '',
name: '',
fileName: '',
url: '',
link: '',
fileUrl: '',
size: '',
uploadUserName: '',
uploadTime: '',
};
this.adjustAttachmentUploadRows = [];
return;
}
const userName = this.userInfo?.realName || this.userInfo?.userName || '';
const uploadTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss');
this.adjustAttachmentForm = {
...this.adjustAttachmentForm,
...latest,
fileType:
this.adjustAttachmentForm.fileType || this.resolveAttachmentFileType(latest),
description: this.adjustAttachmentForm.description || latest.description || '',
uploadUserName: latest.uploadUserName || userName,
uploadTime: latest.uploadTime || uploadTime,
};
this.adjustAttachmentUploadRows = [{ ...latest }];
this.$refs.adjustAttachmentFormRef?.validateField?.('url');
},
confirmAdjustAttachment() {
this.$refs.adjustAttachmentFormRef?.validate(valid => {
if (!valid) return;
if (!this.attachmentUrl(this.adjustAttachmentForm)) {
this.$message.warning('请上传新材料');
return;
}
const nextRow = {
...this.adjustAttachmentForm,
fileType: this.adjustAttachmentForm.fileType,
description: this.adjustAttachmentForm.description || '',
adjustReason: String(this.adjustAttachmentForm.adjustReason || '').trim(),
originAttachment: this.adjustAttachmentForm.originAttachment
? { ...this.adjustAttachmentForm.originAttachment }
: null,
originKey: this.adjustAttachmentForm.originKey,
};
const index = this.adjustAttachmentRows.findIndex(
item => item.originKey === nextRow.originKey
);
if (index >= 0) {
this.adjustAttachmentRows.splice(index, 1, nextRow);
} else {
this.adjustAttachmentRows.push(nextRow);
}
this.adjustAttachmentBox = false;
this.$message.success('已加入调整材料');
});
},
removeAdjustAttachment(index) {
this.adjustAttachmentRows.splice(index, 1);
},
formatFileSize(size) { formatFileSize(size) {
const number = Number(size); const number = Number(size);
if (!number) return ''; if (!number) return '';
@@ -4013,24 +3718,6 @@ export default {
} }
} }
.project-apply-adjust-dialog {
&__upload {
display: flex;
flex-direction: column;
gap: 8px;
width: 100%;
}
&__upload-empty {
color: #909399;
}
:deep(.el-select),
:deep(.el-input) {
width: 100%;
}
}
@media (max-width: 1200px) { @media (max-width: 1200px) {
.project-apply-form { .project-apply-form {
&__grid { &__grid {
+11 -120
View File
@@ -2,40 +2,16 @@
<div ref="page" class="mk-public-biz-view"> <div ref="page" class="mk-public-biz-view">
<basic-container> <basic-container>
<div class="mk-public-biz-view__title">{{ pageTitle }}</div> <div class="mk-public-biz-view__title">{{ pageTitle }}</div>
<template v-if="detail"> <el-descriptions v-if="detail" :column="2" border>
<el-descriptions :column="2" border> <el-descriptions-item
<el-descriptions-item v-for="item in visibleFields"
v-for="item in visibleFields" :key="item.prop"
:key="item.prop" :label="item.label"
:label="item.label" :span="item.span || 1"
:span="item.span || 1"
>
{{ fieldDisplayValue(item.prop, detail[item.prop]) }}
</el-descriptions-item>
</el-descriptions>
<section
v-for="party in partySections"
:key="party.role"
class="mk-public-biz-view__party"
> >
<div class="mk-public-biz-view__party-title">{{ party.label }}</div> {{ displayValue(detail[item.prop]) }}
<el-table :data="party.rows" border empty-text="暂无数据"> </el-descriptions-item>
<el-table-column type="index" label="序号" width="70" align="center" /> </el-descriptions>
<el-table-column prop="customerName" label="客商名称" min-width="180" align="center">
<template #default="{ row }">{{ row.customerName || '-' }}</template>
</el-table-column>
<el-table-column prop="creditCode" label="统一信用代码" min-width="160" align="center">
<template #default="{ row }">{{ row.creditCode || '-' }}</template>
</el-table-column>
<el-table-column prop="contactName" label="联系人" min-width="140" align="center">
<template #default="{ row }">{{ row.contactName || '-' }}</template>
</el-table-column>
<el-table-column prop="contactPhone" label="联系电话" min-width="140" align="center">
<template #default="{ row }">{{ row.contactPhone || '-' }}</template>
</el-table-column>
</el-table>
</section>
</template>
<el-empty v-else description="暂无数据" /> <el-empty v-else description="暂无数据" />
</basic-container> </basic-container>
</div> </div>
@@ -43,36 +19,6 @@
<script> <script>
import { getMkPublicDetail, postMkPublicProcessMessage } from '@/api/mk-process'; import { getMkPublicDetail, postMkPublicProcessMessage } from '@/api/mk-process';
import { formatSealTypes } from '@/utils/settlement-seal';
const createPartyRow = (row = {}) => ({
customerId: row.customerId || '',
customerName: row.customerName || '',
creditCode: row.creditCode || row.unifiedCreditCode || '',
contactId: row.contactId || '',
contactName: row.contactName || '',
contactPhone: row.contactPhone || '',
});
const parsePartyRows = (partyJson, fallbackName) => {
const rows = (() => {
if (Array.isArray(partyJson)) return partyJson;
if (!partyJson) return [];
try {
const data = JSON.parse(partyJson);
return Array.isArray(data) ? data : [];
} catch (error) {
return [];
}
})().map(item => createPartyRow(item));
if (rows.length) return rows;
if (!fallbackName) return [];
return String(fallbackName)
.split(/[、,]/)
.map(name => name.trim())
.filter(Boolean)
.map(name => createPartyRow({ customerName: name }));
};
const FIELD_MAP = { const FIELD_MAP = {
'project-apply': [ 'project-apply': [
@@ -92,6 +38,8 @@ const FIELD_MAP = {
{ label: '审核状态', prop: 'approvalStatusName' }, { label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' }, { label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' }, { label: '当前处理人', prop: 'currentProcessor' },
{ label: '甲方', prop: 'partyA' },
{ label: '乙方', prop: 'partyB' },
{ label: '项目名称', prop: 'projectName', span: 2 }, { label: '项目名称', prop: 'projectName', span: 2 },
], ],
'pre-settlement': [ 'pre-settlement': [
@@ -99,7 +47,6 @@ const FIELD_MAP = {
{ label: '合同名称', prop: 'contractName' }, { label: '合同名称', prop: 'contractName' },
{ label: '项目名称', prop: 'projectName' }, { label: '项目名称', prop: 'projectName' },
{ label: '结算金额', prop: 'settlementAmount' }, { label: '结算金额', prop: 'settlementAmount' },
{ label: '用印类型', prop: 'sealTypes' },
{ label: '审核状态', prop: 'approvalStatusName' }, { label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' }, { label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' }, { label: '当前处理人', prop: 'currentProcessor' },
@@ -111,7 +58,6 @@ const FIELD_MAP = {
{ label: '项目名称', prop: 'projectName' }, { label: '项目名称', prop: 'projectName' },
{ label: '合同名称', prop: 'contractName' }, { label: '合同名称', prop: 'contractName' },
{ label: '结算金额', prop: 'settlementAmount' }, { label: '结算金额', prop: 'settlementAmount' },
{ label: '用印类型', prop: 'sealTypes' },
{ label: '审核状态', prop: 'approvalStatusName' }, { label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' }, { label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' }, { label: '当前处理人', prop: 'currentProcessor' },
@@ -153,26 +99,6 @@ export default {
visibleFields() { visibleFields() {
return FIELD_MAP[this.bizType] || []; return FIELD_MAP[this.bizType] || [];
}, },
partySections() {
if (!this.detail || this.bizType !== 'contract-manage') return [];
return [
{
role: 'A',
label: '甲方',
rows: parsePartyRows(this.detail.partyAJson, this.detail.partyA),
},
{
role: 'B',
label: '乙方',
rows: parsePartyRows(this.detail.partyBJson, this.detail.partyB),
},
{
role: 'C',
label: '丙方',
rows: parsePartyRows(this.detail.partyCJson, this.detail.partyC),
},
];
},
}, },
created() { created() {
this.handleIframeHeight = () => this.sendIframeHeight(); this.handleIframeHeight = () => this.sendIframeHeight();
@@ -266,7 +192,6 @@ export default {
id: this.getFormId() || detail.id, id: this.getFormId() || detail.id,
subject: this.pageTitle, subject: this.pageTitle,
formInstanceId: this.getFormId(), formInstanceId: this.getFormId(),
sealTypes: formatSealTypes(detail.sealTypes) || detail.sealTypes || '',
}; };
}, },
getFormId() { getFormId() {
@@ -280,12 +205,6 @@ export default {
'' ''
); );
}, },
fieldDisplayValue(prop, value) {
if (prop === 'sealTypes') {
return formatSealTypes(value) || '-';
}
return this.displayValue(value);
},
displayValue(value) { displayValue(value) {
if (value === null || value === undefined || value === '') return '-'; if (value === null || value === undefined || value === '') return '-';
if (Array.isArray(value)) return value.join('、') || '-'; if (Array.isArray(value)) return value.join('、') || '-';
@@ -336,33 +255,5 @@ html.mk-iframe-page #app.mk-iframe-page {
background: #409eff; background: #409eff;
} }
} }
&__party {
margin-top: 16px;
padding: 14px 16px 16px;
background: #fff;
border-radius: 6px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
&__party-title {
position: relative;
padding-left: 12px;
margin-bottom: 12px;
font-size: 14px;
font-weight: 600;
line-height: 22px;
color: #303133;
&::before {
content: '';
position: absolute;
left: 0;
top: 2px;
width: 4px;
height: 18px;
background: #409eff;
}
}
} }
</style> </style>
+64 -3
View File
@@ -86,6 +86,27 @@
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6">
<el-form-item label="项目利润率">
<el-input
:model-value="profitRatePercent"
:disabled="readonly"
placeholder="选结算单后自动带出,可修改"
@input="handleProfitRateInput"
>
<template #append>%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="暂估成本(不含税)">
<el-input
:model-value="estimatedCost > 0 ? formatMoney(estimatedCost) : ''"
disabled
placeholder="开票不含税金额合计×项目利润率"
/>
</el-form-item>
</el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="部门邮箱" prop="departmentEmails"> <el-form-item label="部门邮箱" prop="departmentEmails">
<el-select <el-select
@@ -326,12 +347,18 @@
<el-table-column label="结算总金额" min-width="140" align="right"> <el-table-column label="结算总金额" min-width="140" align="right">
<template #default="{ row }">{{ formatMoney(row.settlementAmount) }}</template> <template #default="{ row }">{{ formatMoney(row.settlementAmount) }}</template>
</el-table-column> </el-table-column>
<el-table-column label="历史累计开票金额" min-width="150" align="right">
<template #default="{ row }">{{ formatMoney(row.historyInvoicedAmount) }}</template>
</el-table-column>
<el-table-column label="本次开票金额" min-width="140" align="right">
<template #default="{ row }">{{ formatMoney(row.allocatedInvoiceAmount) }}</template>
</el-table-column>
<el-table-column label="剩余未开票金额" min-width="150" align="right">
<template #default="{ row }">{{ formatMoney(row.remainingUninvoicedAmount) }}</template>
</el-table-column>
<el-table-column label="可开票金额" min-width="140" align="right"> <el-table-column label="可开票金额" min-width="140" align="right">
<template #default="{ row }">{{ formatMoney(row.availableInvoiceAmount) }}</template> <template #default="{ row }">{{ formatMoney(row.availableInvoiceAmount) }}</template>
</el-table-column> </el-table-column>
<el-table-column label="分摊发票金额" min-width="140" align="right">
<template #default="{ row }">{{ formatMoney(row.allocatedInvoiceAmount) }}</template>
</el-table-column>
</el-table> </el-table>
</section-card> </section-card>
@@ -385,6 +412,10 @@
</el-table> </el-table>
</section-card> </section-card>
<section-card v-if="recordId" title="发票冲销明细">
<invoice-write-off-table biz-type="invoice_apply" :biz-id="recordId" />
</section-card>
<section-card title="附件信息"> <section-card title="附件信息">
<vehicle-attachment-table v-model="form.attachments" :readonly="readonly" /> <vehicle-attachment-table v-model="form.attachments" :readonly="readonly" />
</section-card> </section-card>
@@ -491,6 +522,7 @@ import { getList as getReceivablePayableDetailList } from '@/api/settlement/rece
import { getDictionary } from '@/api/system/dictbiz'; import { getDictionary } from '@/api/system/dictbiz';
import { invoiceApplicationDetailColumns } from '@/option/payment/invoiceApplication'; import { invoiceApplicationDetailColumns } from '@/option/payment/invoiceApplication';
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue'; import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
import InvoiceWriteOffTable from '@/components/invoice-write-off-table/main.vue';
import { getMkPublicDetail } from '@/api/mk-process'; import { getMkPublicDetail } from '@/api/mk-process';
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval'; import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
@@ -538,12 +570,15 @@ const emptyForm = () => ({
sheets: [emptySheet()], sheets: [emptySheet()],
attachments: [], attachments: [],
remark: '', remark: '',
// 项目利润率(小数,如0.04表示4%;保存时后端快照并重算暂估成本)
profitRate: null,
}); });
export default { export default {
name: 'InvoiceApplicationForm', name: 'InvoiceApplicationForm',
components: { components: {
VehicleAttachmentTable, VehicleAttachmentTable,
InvoiceWriteOffTable,
}, },
data() { data() {
return { return {
@@ -621,6 +656,24 @@ export default {
0 0
); );
}, },
// 项目利润率百分数展示/输入(后端存小数:0.04 ↔ 4)
profitRatePercent() {
const rate = Number(this.form.profitRate);
if (!Number.isFinite(rate) || rate <= 0) return '';
return String(Math.round(rate * 10000) / 100);
},
// 暂估成本 = 开票不含税金额合计 × 项目利润率(实时计算,后端保存时重算覆盖)
estimatedCost() {
const rate = Number(this.form.profitRate);
if (!Number.isFinite(rate) || rate <= 0) return 0;
const amountNoTaxTotal = this.form.sheets.reduce(
(sheetTotal, sheet) =>
sheetTotal +
sheet.lines.reduce((lineTotal, line) => lineTotal + Number(line.amountNoTax || 0), 0),
0
);
return amountNoTaxTotal * rate;
},
detailColumns() { detailColumns() {
return [...this.detailBaseColumns, ...this.feeItemColumns]; return [...this.detailBaseColumns, ...this.feeItemColumns];
}, },
@@ -732,6 +785,13 @@ export default {
this.transportTypeOptions.find(item => String(item.value) === String(value))?.label || value this.transportTypeOptions.find(item => String(item.value) === String(value))?.label || value
); );
}, },
// 项目利润率输入(百分数),转小数存储:4 → 0.04
handleProfitRateInput(value) {
let normalized = String(value || '').replace(/[^\d.]/g, '');
normalized = normalized.replace(/(\..*)\./g, '$1');
const percent = Number(normalized);
this.form.profitRate = Number.isFinite(percent) && percent > 0 ? percent / 100 : null;
},
invoiceItemNames(categoryName) { invoiceItemNames(categoryName) {
return this.invoiceItems.filter(item => item.categoryName === categoryName); return this.invoiceItems.filter(item => item.categoryName === categoryName);
}, },
@@ -1173,6 +1233,7 @@ export default {
contactName: this.form.contactName, contactName: this.form.contactName,
contactPhone: this.form.contactPhone, contactPhone: this.form.contactPhone,
email: this.form.email, email: this.form.email,
profitRate: Number(this.form.profitRate) > 0 ? Number(this.form.profitRate) : null,
attachmentsJson: JSON.stringify(this.form.attachments || []), attachmentsJson: JSON.stringify(this.form.attachments || []),
remark: this.form.remark, remark: this.form.remark,
settlements: this.form.settlements.map(item => ({ settlements: this.form.settlements.map(item => ({
+25 -1
View File
@@ -128,7 +128,12 @@
</section-card> </section-card>
<section-card title="发票明细"> <section-card title="发票明细">
<el-table :data="invoiceItems" border empty-text="选择金蝶票据池发票后带出发票明细行"> <template #extra>
<el-button size="small" type="primary" :loading="invoiceDetailLoading" :disabled="!form.invoiceNo" @click="reloadInvoiceDetail">
查询明细
</el-button>
</template>
<el-table v-loading="invoiceDetailLoading" :data="invoiceItems" border empty-text="选择金蝶票据池发票后带出发票明细行">
<el-table-column type="index" label="序号" width="64" align="center" /> <el-table-column type="index" label="序号" width="64" align="center" />
<el-table-column prop="goodsName" label="货物名称" min-width="160" show-overflow-tooltip /> <el-table-column prop="goodsName" label="货物名称" min-width="160" show-overflow-tooltip />
<el-table-column prop="specModel" label="规格型号" min-width="120" show-overflow-tooltip /> <el-table-column prop="specModel" label="规格型号" min-width="120" show-overflow-tooltip />
@@ -179,6 +184,10 @@
</el-table> </el-table>
</section-card> </section-card>
<section-card v-if="recordId" title="发票冲销明细">
<invoice-write-off-table biz-type="receipt" :biz-id="recordId" />
</section-card>
<section-card title="附件信息"> <section-card title="附件信息">
<!-- 金蝶票池认领的发票附件为 piaozone path 型,需带发票号走 A801-2 代理查看/下载 --> <!-- 金蝶票池认领的发票附件为 piaozone path 型,需带发票号走 A801-2 代理查看/下载 -->
<vehicle-attachment-table <vehicle-attachment-table
@@ -276,6 +285,7 @@ import * as api from '@/api/payment/invoiceReceipt';
import { getList as getContractList } from '@/api/business/contract-manage'; import { getList as getContractList } from '@/api/business/contract-manage';
import KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/main.vue'; import KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/main.vue';
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue'; import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
import InvoiceWriteOffTable from '@/components/invoice-write-off-table/main.vue';
import { getMkPublicDetail } from '@/api/mk-process'; import { getMkPublicDetail } from '@/api/mk-process';
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval'; import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
@@ -315,6 +325,7 @@ export default {
components: { components: {
KingdeeInvoicePoolDialog, KingdeeInvoicePoolDialog,
VehicleAttachmentTable, VehicleAttachmentTable,
InvoiceWriteOffTable,
}, },
data() { data() {
return { return {
@@ -323,6 +334,7 @@ export default {
customerEmailOptions: [], customerEmailOptions: [],
departmentEmailOptions: [], departmentEmailOptions: [],
invoiceItems: [], invoiceItems: [],
invoiceDetailLoading: false,
contractDialog: { contractDialog: {
visible: false, visible: false,
loading: false, loading: false,
@@ -504,6 +516,18 @@ export default {
this.invoiceItems = []; this.invoiceItems = [];
} }
}, },
// 手动按发票号查询金蝶发票明细(历史单据无缓存明细时点击刷新)
async reloadInvoiceDetail() {
this.invoiceDetailLoading = true;
try {
this.invoiceItems = this.unwrapData(await api.invoiceDetailQuery(this.form.invoiceNo)) || [];
if (!this.invoiceItems.length) this.$message.info('未查询到该发票的明细行');
} catch {
this.$message.error('查询金蝶发票明细失败');
} finally {
this.invoiceDetailLoading = false;
}
},
// 所属合同=承运商合同:选择后带出承办部门(结算组织=承办部门对应平台公司金蝶编码,后端派生) // 所属合同=承运商合同:选择后带出承办部门(结算组织=承办部门对应平台公司金蝶编码,后端派生)
openContractDialog() { openContractDialog() {
this.contractDialog.visible = true; this.contractDialog.visible = true;
+5
View File
@@ -119,6 +119,9 @@
<el-tag v-else-if="column.status" :type="statusType(row.approvalStatus)" class="status-text"> <el-tag v-else-if="column.status" :type="statusType(row.approvalStatus)" class="status-text">
{{ displayValue(row[column.prop]) }} {{ displayValue(row[column.prop]) }}
</el-tag> </el-tag>
<el-tag v-else-if="column.kingdeeStatus" :type="kingdeePushStatusType(row.kingdeePushStatus)">
{{ displayValue(row[column.prop]) }}
</el-tag>
<span v-else-if="column.money">{{ formatMoney(row[column.prop]) }}</span> <span v-else-if="column.money">{{ formatMoney(row[column.prop]) }}</span>
<span v-else>{{ displayValue(row[column.prop]) }}</span> <span v-else>{{ displayValue(row[column.prop]) }}</span>
</template> </template>
@@ -222,6 +225,7 @@ import TableHeaderTools from '@/components/table-header-tools/main.vue';
import organizationSearch from '@/mixins/organization-search'; import organizationSearch from '@/mixins/organization-search';
import { getMKApprovalUrl } from '@/api/system/business-process'; import { getMKApprovalUrl } from '@/api/system/business-process';
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval'; import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
import { kingdeePushStatusType } from '@/utils/kingdee';
// 表单提交成功后带标记返回,keep-alive 缓存的列表页据此重新拉取 // 表单提交成功后带标记返回,keep-alive 缓存的列表页据此重新拉取
const invoiceReceiptListRefreshKey = 'invoice-receipt-list-refresh'; const invoiceReceiptListRefreshKey = 'invoice-receipt-list-refresh';
@@ -480,6 +484,7 @@ export default {
'' ''
); );
}, },
kingdeePushStatusType,
displayValue(value) { displayValue(value) {
return value === null || value === undefined || value === '' ? '-' : value; return value === null || value === undefined || value === '' ? '-' : value;
}, },
+28
View File
@@ -0,0 +1,28 @@
<template>
<basic-container>
<section-card title="发票冲销明细">
<invoice-write-off-table :biz-type="bizType" :biz-id="bizId" />
</section-card>
</basic-container>
</template>
<script>
import InvoiceWriteOffTable from '@/components/invoice-write-off-table/main.vue';
/**
* 发票冲销明细独立页(不挂菜单,供其他页面 $router 跳转引用)
* 用法:$router.push({ path: '/payment/invoice-write-off', query: { bizType: 'invoice_apply', bizId: id } })
*/
export default {
name: 'InvoiceWriteOff',
components: { InvoiceWriteOffTable },
computed: {
bizType() {
return String(this.$route.query.bizType || 'invoice_apply');
},
bizId() {
return this.$route.query.bizId || null;
},
},
};
</script>
+95 -46
View File
@@ -316,6 +316,13 @@
<el-table-column label="匹配金额(含税)" min-width="150"> <el-table-column label="匹配金额(含税)" min-width="150">
<template #default="{ row }">{{ formatMoney(row.matchedAmount) }}</template> <template #default="{ row }">{{ formatMoney(row.matchedAmount) }}</template>
</el-table-column> </el-table-column>
<el-table-column label="冲销状态" width="110" align="center">
<template #default="{ row }">
<el-tag v-if="row.writeOffStatus === 'finished'" type="success">已完成</el-tag>
<el-tag v-else-if="row.invoiceNo" type="warning">未完成</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="操作" width="220" fixed="right" align="center"> <el-table-column label="操作" width="220" fixed="right" align="center">
<template #default="{ row, $index }"> <template #default="{ row, $index }">
<div class="payment-form-page__invoice-actions"> <div class="payment-form-page__invoice-actions">
@@ -343,6 +350,9 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</section-card> </section-card>
<section-card v-if="recordId" title="发票冲销明细">
<invoice-write-off-table biz-type="payment_receipt" :biz-id="recordId" />
</section-card>
<section-card title="付款记录"> <section-card title="付款记录">
<el-table :data="paymentRecords" border <el-table :data="paymentRecords" border
><el-table-column type="index" label="序号" width="70" /><el-table-column ><el-table-column type="index" label="序号" width="70" /><el-table-column
@@ -354,11 +364,23 @@
><el-table-column prop="paidDate" label="付款日期" min-width="150" /><el-table-column ><el-table-column prop="paidDate" label="付款日期" min-width="150" /><el-table-column
prop="paymentNo" prop="paymentNo"
label="付款单号" label="付款单号"
min-width="160" /><el-table-column min-width="160" /><el-table-column label="付款凭证" min-width="160"
prop="kingdeeBillNo" ><template #default="{ row }"
label="付款凭证" ><div v-if="row.voucherFileName" class="payment-form-page__invoice-actions"
min-width="160" ><el-link
/></el-table> type="primary"
:disabled="kingdeeAttachmentBusy"
@click="viewRecordVoucher(row)"
>查看</el-link
><el-link
type="primary"
:disabled="kingdeeAttachmentBusy"
@click="downloadRecordVoucher(row)"
>下载</el-link
></div
><span v-else>-</span></template
></el-table-column
></el-table>
</section-card> </section-card>
<section-card> <section-card>
<template #title> <template #title>
@@ -733,14 +755,15 @@ import {
} from '@/api/vehicle/customer-archive'; } from '@/api/vehicle/customer-archive';
import { readSettlementTransfer, removeSettlementTransfer } from '@/utils/settlement-transfer'; import { readSettlementTransfer, removeSettlementTransfer } from '@/utils/settlement-transfer';
import { formatContractOptionLabel } from '@/utils/contract'; import { formatContractOptionLabel } from '@/utils/contract';
import { downloadFileByUrl } from '@/utils/util'; import { downloadFile, downloadFileByUrl } from '@/utils/util';
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval'; import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
import { import {
downloadKingdeeInvoiceFile, downloadKingdeeFile,
isKingdeePathAttachment, requestKingdeeFile,
viewKingdeeInvoiceFile, viewKingdeeFile,
} from '@/utils/kingdee-attachment'; } from '@/utils/kingdee-attachment';
import PdfPreview from '@/components/pdf-preview/main.vue'; import PdfPreview from '@/components/pdf-preview/main.vue';
import InvoiceWriteOffTable from '@/components/invoice-write-off-table/main.vue';
const attachmentViewerPlugins = [ const attachmentViewerPlugins = [
imagePlugin(), imagePlugin(),
@@ -817,6 +840,7 @@ export default {
ElImageViewer, ElImageViewer,
OpenFileViewer, OpenFileViewer,
PdfPreview, PdfPreview,
InvoiceWriteOffTable,
}, },
data() { data() {
return { return {
@@ -1899,55 +1923,80 @@ export default {
return {}; return {};
} }
}, },
invoiceAttachmentUrl(row) {
return this.attachmentFileUrl(this.invoiceAttachment(row));
},
invoiceAttachmentName(row) { invoiceAttachmentName(row) {
return ( return (
this.attachmentFileName(this.invoiceAttachment(row)) || `${row.invoiceNo || '发票'}.pdf` this.attachmentFileName(this.invoiceAttachment(row)) || `${row.invoiceNo || '发票'}.pdf`
); );
}, },
/** 金蝶附件查看/下载互斥闸门(A801-2 拉流较慢,进行中忽略重复点击,结束自动释放) */
async withKingdeeAttachmentBusy(action) {
if (this.kingdeeAttachmentBusy) return;
this.kingdeeAttachmentBusy = true;
try {
await action();
} finally {
this.kingdeeAttachmentBusy = false;
}
},
async viewInvoiceAttachment(row) { async viewInvoiceAttachment(row) {
const attachment = this.invoiceAttachment(row); await this.withKingdeeAttachmentBusy(async () => {
// 金蝶侧附件(path 型)经后端代理 A801-2 预览,OSS 直链维持本地预览组件 // 发票版式文件按票号走金蝶票池(A801-2 镜像优先/实时回源),登记扫描件仅在票池无此票时兜底
if (isKingdeePathAttachment(attachment)) {
if (this.kingdeeAttachmentBusy) return;
this.kingdeeAttachmentBusy = true;
try { try {
await viewKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row)); const blob = await requestKingdeeFile(row.invoiceNo);
} finally { const url = URL.createObjectURL(blob);
this.kingdeeAttachmentBusy = false; window.open(url, '_blank');
// 延迟释放 objectURL:立即回收可能导致新窗口尚未加载完成即失效
setTimeout(() => URL.revokeObjectURL(url), 60000);
return;
} catch (error) {
// 网络级失败(silent,拦截器已提示)不再回退;票池无此票回退登记附件
if (error?.silent) return;
} }
return; const attachment = this.invoiceAttachment(row);
} if (!this.attachmentFileUrl(attachment)) {
if (!this.attachmentFileUrl(attachment)) { this.$message.warning('当前发票没有金蝶版式文件,也没有登记附件');
this.$message.warning('当前发票暂无可查看附件'); return;
return; }
} this.previewAttachment(
this.previewAttachment( { ...attachment, name: this.invoiceAttachmentName(row) },
{ ...attachment, name: this.invoiceAttachmentName(row) }, [attachment]
[attachment] );
); });
}, },
async downloadInvoiceAttachment(row) { async downloadInvoiceAttachment(row) {
const attachment = this.invoiceAttachment(row); await this.withKingdeeAttachmentBusy(async () => {
// 金蝶侧附件(path 型)经后端代理 A801-2 下载,OSS 直链维持前端直连下载
if (isKingdeePathAttachment(attachment)) {
if (this.kingdeeAttachmentBusy) return;
this.kingdeeAttachmentBusy = true;
try { try {
await downloadKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row)); const blob = await requestKingdeeFile(row.invoiceNo);
} finally { downloadFile(blob, this.invoiceAttachmentName(row));
this.kingdeeAttachmentBusy = false; return;
} catch (error) {
if (error?.silent) return;
} }
return; const attachment = this.invoiceAttachment(row);
} const url = this.attachmentFileUrl(attachment);
const url = this.attachmentFileUrl(attachment); if (!url) {
if (!url) { this.$message.warning('当前发票没有金蝶版式文件,也没有登记附件');
this.$message.warning('当前发票暂无可下载附件'); return;
return; }
} downloadFileByUrl(url, this.invoiceAttachmentName(row));
downloadFileByUrl(url, this.invoiceAttachmentName(row)); });
},
/** 付款记录付款凭证(金蝶电子回单,A801-2 代理):查看=新窗口预览,下载=保存文件 */
viewRecordVoucher(row) {
return this.withKingdeeAttachmentBusy(() =>
viewKingdeeFile(
() => api.downloadRecordVoucher(row.id),
`${row.paymentNo || '付款记录'}-付款凭证.pdf`
)
);
},
downloadRecordVoucher(row) {
return this.withKingdeeAttachmentBusy(() =>
downloadKingdeeFile(
() => api.downloadRecordVoucher(row.id),
`${row.paymentNo || '付款记录'}-付款凭证.pdf`
)
);
}, },
attachmentFileName(file) { attachmentFileName(file) {
return String(file?.originalName || file?.name || file?.fileName || '').trim(); return String(file?.originalName || file?.name || file?.fileName || '').trim();
@@ -78,22 +78,6 @@
:value="item.dictKey" :value="item.dictKey"
/> />
</el-select> </el-select>
<el-select
v-else-if="field.type === 'multi-select' && editable"
v-model="form[field.prop]"
multiple
collapse-tags
collapse-tags-tooltip
clearable
placeholder="请选择"
>
<el-option
v-for="item in formSelectOptions(field)"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey"
/>
</el-select>
<span <span
v-else-if="field.prop === 'formalSettlementNo'" v-else-if="field.prop === 'formalSettlementNo'"
:class="{ 'form-readonly--code': form.formalSettlementNo }" :class="{ 'form-readonly--code': form.formalSettlementNo }"
@@ -101,7 +85,7 @@
{{ form.formalSettlementNo || (form.id ? '-' : '系统自动生成') }} {{ form.formalSettlementNo || (form.id ? '-' : '系统自动生成') }}
</span> </span>
<span v-else-if="field.money">{{ formatMoney(form[field.prop]) }}</span> <span v-else-if="field.money">{{ formatMoney(form[field.prop]) }}</span>
<span v-else-if="field.type === 'select' || field.type === 'multi-select'">{{ <span v-else-if="field.type === 'select'">{{
formSelectLabel(field, form[field.prop]) formSelectLabel(field, form[field.prop])
}}</span> }}</span>
<span v-else-if="field.type === 'contract'">{{ <span v-else-if="field.type === 'contract'">{{
@@ -1149,22 +1133,13 @@ import {
settlementRecordTypeName, settlementRecordTypeName,
settlementStatusName, settlementStatusName,
} from '@/utils/settlementStatus'; } from '@/utils/settlementStatus';
import { downloadFileByUrl } from '@/utils/util'; import { downloadFile, downloadFileByUrl } from '@/utils/util';
import { import { requestKingdeeFile } from '@/utils/kingdee-attachment';
downloadKingdeeInvoiceFile,
isKingdeePathAttachment,
viewKingdeeInvoiceFile,
} from '@/utils/kingdee-attachment';
import KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/main.vue'; import KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/main.vue';
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue'; import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
import ProjectAdvanceWriteOff from './project-advance-write-off.vue'; import ProjectAdvanceWriteOff from './project-advance-write-off.vue';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import { isAdministrator } from '@/utils/auth'; import { isAdministrator } from '@/utils/auth';
import {
formatSealTypes,
parseSealTypes,
SETTLEMENT_SEAL_TYPE_OPTIONS,
} from '@/utils/settlement-seal';
import * as settlementAdjustmentApi from '@/api/settlement/settlementAdjustment'; import * as settlementAdjustmentApi from '@/api/settlement/settlementAdjustment';
// 结算币种为本位币(人民币)时汇率恒为1,汇率日期、结算汇率与按汇率换算的本位币合计都不展示 // 结算币种为本位币(人民币)时汇率恒为1,汇率日期、结算汇率与按汇率换算的本位币合计都不展示
@@ -1256,7 +1231,6 @@ export default {
feeCategoryOptions: [], feeCategoryOptions: [],
businessModelOptions: [], businessModelOptions: [],
transportTypeOptions: [], transportTypeOptions: [],
sealTypeOptions: SETTLEMENT_SEAL_TYPE_OPTIONS,
fields: formalSettlementFormFields, fields: formalSettlementFormFields,
sourceTableColumns: sourceColumns, sourceTableColumns: sourceColumns,
summaryTableColumns: summaryColumns, summaryTableColumns: summaryColumns,
@@ -1520,7 +1494,6 @@ export default {
this.form = { this.form = {
...createFormalSettlementForm(), ...createFormalSettlementForm(),
...data, ...data,
sealTypes: parseSealTypes(data.sealTypes),
sourcePreSettlementIds: (data.sources || []).map(item => item.preSettlementId), sourcePreSettlementIds: (data.sources || []).map(item => item.preSettlementId),
sourceDetailIds: (data.details || []) sourceDetailIds: (data.details || [])
.filter(item => !item.sourcePreSettlementId) .filter(item => !item.sourcePreSettlementId)
@@ -1725,7 +1698,6 @@ export default {
contractId, contractId,
settlementType, settlementType,
settlementTypeName: settlementType === 'receivable' ? '应收' : '应付', settlementTypeName: settlementType === 'receivable' ? '应收' : '应付',
sealTypes: parseSealTypes(first.sealTypes),
sourcePreSettlementIds: this.form.sourcePreSettlementIds, sourcePreSettlementIds: this.form.sourcePreSettlementIds,
}); });
const responses = await Promise.all( const responses = await Promise.all(
@@ -1968,7 +1940,6 @@ export default {
Object.assign(this.form, this.sources[0], { Object.assign(this.form, this.sources[0], {
contractId: this.sources[0].contractId, contractId: this.sources[0].contractId,
formalSettlementNo: this.form.formalSettlementNo, formalSettlementNo: this.form.formalSettlementNo,
sealTypes: parseSealTypes(this.sources[0].sealTypes),
}); });
this.refreshFormalSettlementNo(); this.refreshFormalSettlementNo();
} }
@@ -2943,38 +2914,45 @@ export default {
return attachment.originalName || attachment.name || `${row.invoiceNo || '发票'}.pdf`; return attachment.originalName || attachment.name || `${row.invoiceNo || '发票'}.pdf`;
}, },
async viewInvoiceAttachment(row) { async viewInvoiceAttachment(row) {
const attachment = this.invoiceAttachment(row); if (this.kingdeeAttachmentBusy) return;
// 金蝶侧附件(path 型)经后端代理 A801-2 预览,OSS 直链维持 window.open this.kingdeeAttachmentBusy = true;
if (isKingdeePathAttachment(attachment)) { try {
if (this.kingdeeAttachmentBusy) return; // 发票版式文件按票号走金蝶票池(A801-2 镜像优先/实时回源),登记扫描件仅在票池无此票时兜底
this.kingdeeAttachmentBusy = true;
try { try {
await viewKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row)); const blob = await requestKingdeeFile(row.invoiceNo);
} finally { const url = URL.createObjectURL(blob);
this.kingdeeAttachmentBusy = false; window.open(url, '_blank');
// 延迟释放 objectURL:立即回收可能导致新窗口尚未加载完成即失效
setTimeout(() => URL.revokeObjectURL(url), 60000);
return;
} catch (error) {
// 网络级失败(silent,拦截器已提示)不再回退;票池无此票回退登记附件
if (error?.silent) return;
} }
return; const url = this.invoiceAttachmentUrl(row);
if (!url) return this.$message.warning('当前发票没有金蝶版式文件,也没有登记附件');
window.open(url, '_blank');
} finally {
this.kingdeeAttachmentBusy = false;
} }
const url = this.invoiceAttachmentUrl(row);
if (!url) return this.$message.warning('当前发票暂无可查看附件');
window.open(url, '_blank');
}, },
async downloadInvoiceAttachment(row) { async downloadInvoiceAttachment(row) {
const attachment = this.invoiceAttachment(row); if (this.kingdeeAttachmentBusy) return;
// 金蝶侧附件(path 型)经后端代理 A801-2 下载,OSS 直链维持前端直连下载 this.kingdeeAttachmentBusy = true;
if (isKingdeePathAttachment(attachment)) { try {
if (this.kingdeeAttachmentBusy) return;
this.kingdeeAttachmentBusy = true;
try { try {
await downloadKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row)); const blob = await requestKingdeeFile(row.invoiceNo);
} finally { downloadFile(blob, this.invoiceAttachmentName(row));
this.kingdeeAttachmentBusy = false; return;
} catch (error) {
if (error?.silent) return;
} }
return; const url = this.invoiceAttachmentUrl(row);
if (!url) return this.$message.warning('当前发票没有金蝶版式文件,也没有登记附件');
downloadFileByUrl(url, this.invoiceAttachmentName(row));
} finally {
this.kingdeeAttachmentBusy = false;
} }
const url = this.invoiceAttachmentUrl(row);
if (!url) return this.$message.warning('当前发票暂无可下载附件');
downloadFileByUrl(url, this.invoiceAttachmentName(row));
}, },
// 开票发票预览地址:数电PDF优先(OFD浏览器无法预览),退预览图、板式文件 // 开票发票预览地址:数电PDF优先(OFD浏览器无法预览),退预览图、板式文件
issuedInvoicePreviewUrl(row) { issuedInvoicePreviewUrl(row) {
@@ -3018,7 +2996,6 @@ export default {
})), })),
businessModel: this.form.businessModel || undefined, businessModel: this.form.businessModel || undefined,
transportType: this.form.transportType || undefined, transportType: this.form.transportType || undefined,
sealTypes: formatSealTypes(this.form.sealTypes) || undefined,
exchangeRateDate: this.form.exchangeRateDate, exchangeRateDate: this.form.exchangeRateDate,
exchangeRate: this.form.exchangeRate, exchangeRate: this.form.exchangeRate,
summaryFees: this.summaryFees summaryFees: this.summaryFees
@@ -3231,9 +3208,6 @@ export default {
return Array.isArray(options) ? options : []; return Array.isArray(options) ? options : [];
}, },
formSelectLabel(field, value) { formSelectLabel(field, value) {
if (field?.type === 'multi-select') {
return formatSealTypes(value) || '-';
}
if (value === undefined || value === null || value === '') return '-'; if (value === undefined || value === null || value === '') return '-';
const normalized = String(value).trim(); const normalized = String(value).trim();
const option = this.formSelectOptions(field).find( const option = this.formSelectOptions(field).find(
@@ -74,6 +74,7 @@
<script> <script>
import { claimCandidates } from '@/api/payment/invoiceReceipt'; import { claimCandidates } from '@/api/payment/invoiceReceipt';
import { kingdeePushStatusType } from '@/utils/kingdee';
export default { export default {
name: 'InvoiceReceiptCandidatesDialog', name: 'InvoiceReceiptCandidatesDialog',
@@ -152,7 +153,7 @@ export default {
); );
}, },
pushStatusType(value) { pushStatusType(value) {
return { pushed: 'warning', assigned: 'success', failed: 'danger', unsynced: 'info' }[value] || 'info'; return kingdeePushStatusType(value);
}, },
formatMoney(value) { formatMoney(value) {
const number = Number(value); const number = Number(value);
@@ -67,26 +67,7 @@
:value="item.dictKey" :value="item.dictKey"
/> />
</el-select> </el-select>
<el-select <span v-else-if="field.type === 'select'" class="form-readonly">
v-else-if="field.type === 'multi-select' && editable"
v-model="form[field.prop]"
multiple
collapse-tags
collapse-tags-tooltip
clearable
placeholder="请选择"
>
<el-option
v-for="item in formSelectOptions(field)"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey"
/>
</el-select>
<span
v-else-if="field.type === 'select' || field.type === 'multi-select'"
class="form-readonly"
>
{{ formSelectLabel(field, form[field.prop]) }} {{ formSelectLabel(field, form[field.prop]) }}
</span> </span>
<el-input <el-input
@@ -1044,11 +1025,6 @@ import { downloadFileByUrl } from '@/utils/util';
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval'; import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import { isAdministrator } from '@/utils/auth'; import { isAdministrator } from '@/utils/auth';
import {
formatSealTypes,
parseSealTypes,
SETTLEMENT_SEAL_TYPE_OPTIONS,
} from '@/utils/settlement-seal';
// 结算币种为本位币(人民币)时汇率恒为1,汇率日期、结算汇率与按汇率换算的本位币合计都不展示 // 结算币种为本位币(人民币)时汇率恒为1,汇率日期、结算汇率与按汇率换算的本位币合计都不展示
const LOCAL_CURRENCY_HIDDEN_FIELDS = ['exchangeRateDate', 'exchangeRate', 'localSettlementAmount']; const LOCAL_CURRENCY_HIDDEN_FIELDS = ['exchangeRateDate', 'exchangeRate', 'localSettlementAmount'];
@@ -1141,7 +1117,6 @@ export default {
feeCategoryOptions: [], feeCategoryOptions: [],
businessModelOptions: [], businessModelOptions: [],
transportTypeOptions: [], transportTypeOptions: [],
sealTypeOptions: SETTLEMENT_SEAL_TYPE_OPTIONS,
summaryFees: [], summaryFees: [],
details: [], details: [],
detailCollapsed: false, detailCollapsed: false,
@@ -1578,11 +1553,7 @@ export default {
? await getMkPublicDetail('pre-settlement', this.form.id || this.recordId) ? await getMkPublicDetail('pre-settlement', this.form.id || this.recordId)
: await getDetail(this.form.id || this.recordId); : await getDetail(this.form.id || this.recordId);
const detail = response.data?.data || {}; const detail = response.data?.data || {};
this.form = { this.form = { ...emptyPreSettlementForm(), ...detail };
...emptyPreSettlementForm(),
...detail,
sealTypes: parseSealTypes(detail.sealTypes),
};
this.summaryFees = (detail.summaryFees || []).map(row => ({ ...row })); this.summaryFees = (detail.summaryFees || []).map(row => ({ ...row }));
this.details = (detail.details || []).map(row => this.normalizeSourceDetail(row)); this.details = (detail.details || []).map(row => this.normalizeSourceDetail(row));
this.detailPage.current = 1; this.detailPage.current = 1;
@@ -1746,9 +1717,6 @@ export default {
return Array.isArray(options) ? options : []; return Array.isArray(options) ? options : [];
}, },
formSelectLabel(field, value) { formSelectLabel(field, value) {
if (field?.type === 'multi-select') {
return formatSealTypes(value) || '-';
}
if (value === undefined || value === null || value === '') return '-'; if (value === undefined || value === null || value === '') return '-';
const normalized = String(value).trim(); const normalized = String(value).trim();
const option = this.formSelectOptions(field).find( const option = this.formSelectOptions(field).find(
@@ -1974,9 +1942,6 @@ export default {
subjectName: this.form.preSettlementNo || this.form.contractName || '', subjectName: this.form.preSettlementNo || this.form.contractName || '',
approvalStatus: previousApprovalStatus, approvalStatus: previousApprovalStatus,
mkEnabled: await loadMkEnabled().catch(() => false), mkEnabled: await loadMkEnabled().catch(() => false),
tempVarData: {
sealTypes: formatSealTypes(this.form.sealTypes) || '',
},
}); });
this.$message.success(mkStarted ? '审批流程已发起' : '提交成功'); this.$message.success(mkStarted ? '审批流程已发起' : '提交成功');
this.visible = false; this.visible = false;
@@ -1996,7 +1961,6 @@ export default {
contractId: this.form.contractId, contractId: this.form.contractId,
businessModel: this.form.businessModel || undefined, businessModel: this.form.businessModel || undefined,
transportType: this.form.transportType || undefined, transportType: this.form.transportType || undefined,
sealTypes: formatSealTypes(this.form.sealTypes) || undefined,
exchangeRateDate: this.form.exchangeRateDate || undefined, exchangeRateDate: this.form.exchangeRateDate || undefined,
exchangeRate: this.form.exchangeRate, exchangeRate: this.form.exchangeRate,
attachmentsJson: JSON.stringify(this.attachments || []), attachmentsJson: JSON.stringify(this.attachments || []),
@@ -17,7 +17,6 @@
<script> <script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue'; import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import FormalSettlementEditor from '@/views/settlement/components/formal-settlement-editor.vue'; import FormalSettlementEditor from '@/views/settlement/components/formal-settlement-editor.vue';
import { formatSealTypes } from '@/utils/settlement-seal';
export default { export default {
name: 'FormalSettlementPublicView', name: 'FormalSettlementPublicView',
@@ -30,11 +29,7 @@ export default {
methods: { methods: {
getForm() { getForm() {
const form = this.$refs.page?.form || {}; const form = this.$refs.page?.form || {};
return { return { ...form, subject: form.formalSettlementNo || form.contractName || '' };
...form,
sealTypes: formatSealTypes(form.sealTypes) || '',
subject: form.formalSettlementNo || form.contractName || '',
};
}, },
}, },
}; };
+6 -6
View File
@@ -145,10 +145,10 @@
<el-descriptions-item label="创建时间"> <el-descriptions-item label="创建时间">
{{ invoiceRegisterDialog.row.createTime || '-' }} {{ invoiceRegisterDialog.row.createTime || '-' }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="金蝶同步状态" :span="2"> <el-descriptions-item label="金蝶同步状态">
{{ kingdeeSyncName(invoiceRegisterDialog.row.kingdeeSyncStatus) }} {{ kingdeeSyncName(invoiceRegisterDialog.row.kingdeeSyncStatus) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="备注" :span="2"> <el-descriptions-item label="备注">
{{ invoiceRegisterDialog.row.remark || '-' }} {{ invoiceRegisterDialog.row.remark || '-' }}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
@@ -240,7 +240,6 @@ import FormalSettlementTablePanel from './components/formal-settlement-table-pan
import InvoiceReceiptCandidatesDialog from './components/invoice-receipt-candidates-dialog.vue'; import InvoiceReceiptCandidatesDialog from './components/invoice-receipt-candidates-dialog.vue';
import { submitMkApprovalFlow, loadMkEnabled } from '@/utils/mk-approval'; import { submitMkApprovalFlow, loadMkEnabled } from '@/utils/mk-approval';
import { getMKApprovalUrl } from '@/api/system/business-process'; import { getMKApprovalUrl } from '@/api/system/business-process';
import { formatSealTypes } from '@/utils/settlement-seal';
export default { export default {
name: 'FormalSettlement', name: 'FormalSettlement',
@@ -508,9 +507,6 @@ export default {
subjectName: row.formalSettlementNo || '', subjectName: row.formalSettlementNo || '',
approvalStatus: previousApprovalStatus, approvalStatus: previousApprovalStatus,
mkEnabled: this.mkEnabled, mkEnabled: this.mkEnabled,
tempVarData: {
sealTypes: formatSealTypes(row.sealTypes) || '',
},
}); });
this.$message.success('提交成功'); this.$message.success('提交成功');
this.onLoad(this.page); this.onLoad(this.page);
@@ -851,6 +847,10 @@ export default {
settlementTypeName(value) { settlementTypeName(value) {
return { payable: '付款', receivable: '收款' }[value] || '-'; return { payable: '付款', receivable: '收款' }[value] || '-';
}, },
// 模板无法直接访问 script 顶部 import,包装成实例方法(与 formal-settlement-table-panel 同模式)
kingdeeSyncName(value) {
return kingdeeSyncName(value);
},
unwrapData(response) { unwrapData(response) {
const body = response?.data || response || {}; const body = response?.data || response || {};
return body?.data || body; return body?.data || body;
@@ -17,7 +17,6 @@
<script> <script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue'; import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import PreSettlementEditor from '@/views/settlement/components/pre-settlement-editor.vue'; import PreSettlementEditor from '@/views/settlement/components/pre-settlement-editor.vue';
import { formatSealTypes } from '@/utils/settlement-seal';
export default { export default {
name: 'PreSettlementPublicView', name: 'PreSettlementPublicView',
@@ -30,11 +29,7 @@ export default {
methods: { methods: {
getForm() { getForm() {
const form = this.$refs.page?.form || {}; const form = this.$refs.page?.form || {};
return { return { ...form, subject: form.preSettlementNo || form.contractName || '' };
...form,
sealTypes: formatSealTypes(form.sealTypes) || '',
subject: form.preSettlementNo || form.contractName || '',
};
}, },
}, },
}; };
-8
View File
@@ -148,9 +148,6 @@
<span v-else-if="column.prop === 'sourceType'"> <span v-else-if="column.prop === 'sourceType'">
{{ row[column.prop] === '应收应付' ? '应付' : displayValue(row[column.prop]) }} {{ row[column.prop] === '应收应付' ? '应付' : displayValue(row[column.prop]) }}
</span> </span>
<span v-else-if="column.prop === 'sealTypes'">
{{ formatSealTypes(row[column.prop]) || '-' }}
</span>
<span v-else>{{ displayValue(row[column.prop]) }}</span> <span v-else>{{ displayValue(row[column.prop]) }}</span>
</template> </template>
</el-table-column> </el-table-column>
@@ -309,7 +306,6 @@ import { preSettlementSearchFields } from '@/option/settlement/preSettlementSear
import organizationSearch from '@/mixins/organization-search'; import organizationSearch from '@/mixins/organization-search';
import { preSettlementTableColumns } from '@/option/settlement/preSettlementTable'; import { preSettlementTableColumns } from '@/option/settlement/preSettlementTable';
import { createSettlementTransfer } from '@/utils/settlement-transfer'; import { createSettlementTransfer } from '@/utils/settlement-transfer';
import { formatSealTypes } from '@/utils/settlement-seal';
import { downloadFile } from '@/utils/util'; import { downloadFile } from '@/utils/util';
import { getMKApprovalUrl } from '@/api/system/business-process'; import { getMKApprovalUrl } from '@/api/system/business-process';
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval'; import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
@@ -405,7 +401,6 @@ export default {
}); });
}, },
methods: { methods: {
formatSealTypes,
hasPermission(code) { hasPermission(code) {
return this.isAdmin || this.validData(this.permission?.[code], false); return this.isAdmin || this.validData(this.permission?.[code], false);
}, },
@@ -675,9 +670,6 @@ export default {
subjectName: row.preSettlementNo || '', subjectName: row.preSettlementNo || '',
approvalStatus: previousApprovalStatus, approvalStatus: previousApprovalStatus,
mkEnabled: this.mkEnabled, mkEnabled: this.mkEnabled,
tempVarData: {
sealTypes: formatSealTypes(row.sealTypes) || '',
},
}); });
this.$message.success('提交成功'); this.$message.success('提交成功');
this.loadTable(); this.loadTable();
@@ -1067,8 +1067,7 @@ import { formatContractOptionLabel } from '@/utils/contract';
import { isTierUnitPrice, isUnitPriceAdjustable } from '@/utils/settlement-adjust-rule'; import { isTierUnitPrice, isUnitPriceAdjustable } from '@/utils/settlement-adjust-rule';
import { downloadXls } from '@/utils/util'; import { downloadXls } from '@/utils/util';
import { createSettlementTransfer } from '@/utils/settlement-transfer'; import { createSettlementTransfer } from '@/utils/settlement-transfer';
import { settlementBillLabel, settlementListPath } from '@/utils/settlement-menu'; import { settlementListPath } from '@/utils/settlement-menu';
import { getList as getFormalSettlementList } from '@/api/settlement/formalSettlement';
import { import {
contractApprovalStatusOptions, contractApprovalStatusOptions,
contractCategoryOptions, contractCategoryOptions,
@@ -1922,9 +1921,8 @@ export default {
this.openSettlementDetail('/settlement/pre-settlement', row.preSettlementNo); this.openSettlementDetail('/settlement/pre-settlement', row.preSettlementNo);
return; return;
} }
// 正式结算单号:跳转付款/收款结算单表单页并打开详情(与开票申请等入口一致) if (this.settlementType === 'payable' && column.prop === 'formalSettlementNo') {
if (column.prop === 'formalSettlementNo') { this.openSettlementDetail('/settlement/payment-settlement', row.formalSettlementNo);
this.openFormalSettlementDetail(row.formalSettlementNo);
return; return;
} }
this.openDetailDialog(row); this.openDetailDialog(row);
@@ -1936,42 +1934,6 @@ export default {
} }
this.$router.push({ path, query: { detailNo } }); this.$router.push({ path, query: { detailNo } });
}, },
async openFormalSettlementDetail(formalSettlementNo) {
const normalizedNo = String(formalSettlementNo || '')
.split(/[、,,]/)
.map(item => item.trim())
.find(Boolean);
if (!normalizedNo) {
this.$message.info('当前记录未关联结算单详情');
return;
}
try {
const data = this.unwrapPage(
await getFormalSettlementList(1, 10, { formalSettlementNo: normalizedNo })
);
const row = (data.records || []).find(
item => String(item.formalSettlementNo || '').trim() === normalizedNo
);
if (!row?.id) {
this.$message.warning('未找到对应的正式结算单');
return;
}
const settlementType = row.settlementType || this.settlementType || 'payable';
const listPath = settlementListPath(settlementType);
await this.$router.push({
path: `${listPath}/form`,
query: {
mode: 'view',
id: row.id,
settlementType,
listPath,
name: `查看${settlementBillLabel(settlementType)}`,
},
});
} catch (error) {
this.$message.error('正式结算单详情加载失败');
}
},
async openRouteDetail(detailId = this.$route.query.detailId) { async openRouteDetail(detailId = this.$route.query.detailId) {
// 结算明细点「单据号」会带 detailId 跳到本页;只有当前停在应收/应付明细页时才自动展开详情 // 结算明细点「单据号」会带 detailId 跳到本页;只有当前停在应收/应付明细页时才自动展开详情
const routePath = const routePath =
+4 -26
View File
@@ -93,7 +93,6 @@
<script> <script>
import { getList, getDetail, submit, remove } from '@/api/system/business-dept-config'; import { getList, getDetail, submit, remove } from '@/api/system/business-dept-config';
import { getBusinessDeptSelect, getPlatformCompanySelect } from '@/api/system/dept'; import { getBusinessDeptSelect, getPlatformCompanySelect } from '@/api/system/dept';
import { normalizeBusinessDeptOptions } from '@/utils/dept';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
@@ -155,9 +154,8 @@ export default {
{ {
label: '业务部门', label: '业务部门',
prop: 'businessDeptName', prop: 'businessDeptName',
minWidth: 260, minWidth: 160,
display: false, display: false,
formatter: row => this.formatBusinessDeptLabel(row),
}, },
{ {
label: '平台公司', label: '平台公司',
@@ -279,16 +277,11 @@ export default {
Promise.all([getPlatformCompanySelect(), getBusinessDeptSelect()]).then( Promise.all([getPlatformCompanySelect(), getBusinessDeptSelect()]).then(
([platformRes, businessRes]) => { ([platformRes, businessRes]) => {
this.platformCompanyOptions = this.normalizeDeptOptions(platformRes?.data?.data); this.platformCompanyOptions = this.normalizeDeptOptions(platformRes?.data?.data);
// 业务部门配置页始终展示「部门(所属公司)」,便于与平台公司配对 this.businessDeptOptions = this.normalizeDeptOptions(businessRes?.data?.data);
this.businessDeptOptions = normalizeBusinessDeptOptions(businessRes?.data?.data, {
alwaysShowCompany: true,
});
const platformColumn = this.findColumn(this.option.column, 'platformCompanyId'); const platformColumn = this.findColumn(this.option.column, 'platformCompanyId');
if (platformColumn) platformColumn.dicData = this.platformCompanyOptions; if (platformColumn) platformColumn.dicData = this.platformCompanyOptions;
const businessColumn = this.findColumn(this.option.column, 'businessDeptId'); const businessColumn = this.findColumn(this.option.column, 'businessDeptId');
if (businessColumn) businessColumn.dicData = this.businessDeptOptions; if (businessColumn) businessColumn.dicData = this.businessDeptOptions;
// 下拉选项就绪后刷新列表展示名(避免列表先于选项返回时只显示裸部门名)
this.refreshBusinessDeptLabels();
} }
); );
}, },
@@ -299,19 +292,6 @@ export default {
kingdeeDeptCode: item.kingdeeDeptCode || '', kingdeeDeptCode: item.kingdeeDeptCode || '',
})); }));
}, },
/** 列表业务部门列:部门名(所属公司) */
formatBusinessDeptLabel(row) {
if (!row) return '-';
const matched = this.businessDeptOptions.find(
item => String(item.value) === String(row.businessDeptId)
);
if (matched?.label) return matched.label;
return row.businessDeptName || '-';
},
refreshBusinessDeptLabels() {
if (!this.data?.length) return;
this.data = this.data.map(row => ({ ...row }));
},
formatSerial(value) { formatSerial(value) {
// Avue number 空值常落成 -1,历史脏数据也按空展示 // Avue number 空值常落成 -1,历史脏数据也按空展示
if (value === null || value === undefined || value === '' || value === -1 || value === '-1') { if (value === null || value === undefined || value === '' || value === -1 || value === '-1') {
@@ -337,15 +317,13 @@ export default {
}, },
handleBusinessDeptChange(value) { handleBusinessDeptChange(value) {
const matched = this.businessDeptOptions.find(item => String(item.value) === String(value)); const matched = this.businessDeptOptions.find(item => String(item.value) === String(value));
this.form.businessDeptName = matched ? matched.rawLabel || matched.label : ''; this.form.businessDeptName = matched ? matched.label : '';
}, },
beforeOpen(done, type) { beforeOpen(done, type) {
const loadOptions = Promise.all([getPlatformCompanySelect(), getBusinessDeptSelect()]).then( const loadOptions = Promise.all([getPlatformCompanySelect(), getBusinessDeptSelect()]).then(
([platformRes, businessRes]) => { ([platformRes, businessRes]) => {
this.platformCompanyOptions = this.normalizeDeptOptions(platformRes?.data?.data); this.platformCompanyOptions = this.normalizeDeptOptions(platformRes?.data?.data);
this.businessDeptOptions = normalizeBusinessDeptOptions(businessRes?.data?.data, { this.businessDeptOptions = this.normalizeDeptOptions(businessRes?.data?.data);
alwaysShowCompany: true,
});
const platformColumn = this.findColumn(this.option.column, 'platformCompanyId'); const platformColumn = this.findColumn(this.option.column, 'platformCompanyId');
if (platformColumn) platformColumn.dicData = this.platformCompanyOptions; if (platformColumn) platformColumn.dicData = this.platformCompanyOptions;
const businessColumn = this.findColumn(this.option.column, 'businessDeptId'); const businessColumn = this.findColumn(this.option.column, 'businessDeptId');
+19 -39
View File
@@ -66,21 +66,17 @@
/> />
</template> </template>
<template #dataScopeDeptIds-form> <template #dataScopeDeptIds-form>
<!-- 与用户管理「数据管理权限」一致:组织多选级联,数据源同左侧组织树 --> <el-tree
<el-cascader
v-if="Number(form.dataScopeRange) === 3" v-if="Number(form.dataScopeRange) === 3"
v-model="dataScopeCascaderValue" ref="dataScopeTree"
:options="permissionDeptTree" :data="permissionDeptTree"
:props="deptCascaderProps" show-checkbox
:disabled="isViewMode" node-key="id"
clearable :default-checked-keys="form.dataScopeDeptIds || []"
filterable :props="{ label: 'title', children: 'children' }"
collapse-tags @check="handleDataScopeCheck"
collapse-tags-tooltip
placeholder="请选择数据权限组织(可多选)"
style="width: 100%"
/> />
<span v-else class="form-tip">选择「自定义」后可选择数据权限组织</span> <span v-else class="form-tip">选择「自定义」后可勾选数据权限组织</span>
</template> </template>
<template #menu="{ row, index }"> <template #menu="{ row, index }">
<el-link <el-link
@@ -197,26 +193,6 @@ export default {
: []; : [];
}, },
}, },
// 自定义数据权限组织:与用户管理数据管理权限相同的多选级联
dataScopeCascaderValue: {
get() {
const ids = Array.isArray(this.form.dataScopeDeptIds)
? this.form.dataScopeDeptIds
: this.form.dataScopeDeptIds
? String(this.form.dataScopeDeptIds).split(',').filter(Boolean)
: [];
return ids
.filter(item => item !== undefined && item !== null && item !== '')
.map(item => (typeof item === 'number' ? item : String(item)));
},
set(value) {
this.form.dataScopeDeptIds = Array.isArray(value)
? value.filter(item => item !== undefined && item !== null && item !== '')
: value
? [value]
: [];
},
},
}, },
created() { created() {
this.sensitiveManager = sensitive.create({ this.sensitiveManager = sensitive.create({
@@ -252,6 +228,12 @@ export default {
this.permissionDeptTree = res.data.data || []; this.permissionDeptTree = res.data.data || [];
}); });
}, },
handleDataScopeCheck(_, checked) {
if (this.isViewMode) {
return;
}
this.form.dataScopeDeptIds = checked.checkedKeys || [];
},
normalizeSubmitRow(row = {}, isUpdate = false) { normalizeSubmitRow(row = {}, isUpdate = false) {
let payload = { ...row }; let payload = { ...row };
// 编辑时剔除未改动的脱敏字段,避免把 138****8000 写回库 // 编辑时剔除未改动的脱敏字段,避免把 138****8000 写回库
@@ -296,19 +278,17 @@ export default {
detail.identities = detail.identities.split(',').filter(Boolean); detail.identities = detail.identities.split(',').filter(Boolean);
} }
const deptIds = func.split(detail.deptId || ''); const deptIds = func.split(detail.deptId || '');
const dataScopeDeptIds = Array.isArray(detail.dataScopeDeptIds)
? detail.dataScopeDeptIds.map(item => String(item))
: detail.dataScopeDeptIds
? String(detail.dataScopeDeptIds).split(',').filter(Boolean)
: [];
this.form = { this.form = {
...detail, ...detail,
deptId: Array.isArray(deptIds) ? deptIds : [], deptId: Array.isArray(deptIds) ? deptIds : [],
dataScopeRange: detail.dataScopeRange || 1, dataScopeRange: detail.dataScopeRange || 1,
dataLevelRange: detail.dataLevelRange || 1, dataLevelRange: detail.dataLevelRange || 1,
dataScopeDeptIds, dataScopeDeptIds: detail.dataScopeDeptIds || [],
}; };
this.sensitiveManager?.saveInitialData(this.form); this.sensitiveManager?.saveInitialData(this.form);
this.$nextTick(() => {
this.$refs.dataScopeTree?.setCheckedKeys?.(this.form.dataScopeDeptIds || []);
});
done(); done();
}); });
return; return;
+3 -11
View File
@@ -713,12 +713,6 @@ export default {
} }
this.selectDeptOnTree(deptId); this.selectDeptOnTree(deptId);
}, },
startDeptTreeFromSecondLevel(tree) {
if (!Array.isArray(tree) || !tree.length) {
return [];
}
return tree.flatMap(node => (Array.isArray(node.children) ? node.children : []));
},
findDeptIdByName(name, tree = this.permissionDeptTree) { findDeptIdByName(name, tree = this.permissionDeptTree) {
if (!name) return null; if (!name) return null;
for (const node of tree || []) { for (const node of tree || []) {
@@ -739,7 +733,7 @@ export default {
const tenantId = this.userInfo.tenantId || this.website.tenantId; const tenantId = this.userInfo.tenantId || this.website.tenantId;
try { try {
const res = await getDeptTree(tenantId); const res = await getDeptTree(tenantId);
this.permissionDeptTree = this.startDeptTreeFromSecondLevel(res.data.data || []); this.permissionDeptTree = res.data.data || [];
} catch (error) { } catch (error) {
this.$message.error('组织树加载失败'); this.$message.error('组织树加载失败');
return; return;
@@ -969,11 +963,9 @@ export default {
column.dicData = res.data.data; column.dicData = res.data.data;
}); });
getDeptTree(tenantId).then(res => { getDeptTree(tenantId).then(res => {
// 用户管理组织从第二级开始展示:去掉一级根节点,保留其子节点 this.permissionDeptTree = res.data.data;
const deptTree = this.startDeptTreeFromSecondLevel(res.data.data || []);
this.permissionDeptTree = deptTree;
const column = this.findColumn(this.userOption.group, 'deptId'); const column = this.findColumn(this.userOption.group, 'deptId');
column.dicData = deptTree; column.dicData = res.data.data;
}); });
getPostList(tenantId).then(res => { getPostList(tenantId).then(res => {
this.postList = res.data.data; this.postList = res.data.data;
+47 -68
View File
@@ -689,7 +689,6 @@ import {
recognitionIDCard, recognitionIDCard,
recognitionTransportCertificates, recognitionTransportCertificates,
recognizeBaiduOcr, recognizeBaiduOcr,
recognizeQualificationCertificateOcr,
} from '@/api/transportCapacity/driver'; } from '@/api/transportCapacity/driver';
import { getList as getVehicleList } from '@/api/transportCapacity/transport-vehicle'; import { getList as getVehicleList } from '@/api/transportCapacity/transport-vehicle';
import { getDeptTree } from '@/api/system/dept'; import { getDeptTree } from '@/api/system/dept';
@@ -1323,29 +1322,9 @@ export default {
}, },
handleQualificationUploadSuccess(prop, url) { handleQualificationUploadSuccess(prop, url) {
this.setImage(prop, url); this.setImage(prop, url);
this.recognizeQualificationCertificate(url); this.recognizeBaiduOcr(url, 'general', '', '从业资格证', data => {
}, this.applyQualificationRecognition(data);
recognizeQualificationCertificate(url) {
if (!url) {
this.$message.warning('从业资格证图片上传成功,未获取到图片地址,无法自动识别');
return;
}
const loading = ElLoading.service({
lock: true,
text: '从业资格证识别中',
background: 'rgba(255, 255, 255, 0.7)',
}); });
recognizeQualificationCertificateOcr(url)
.then(res => {
this.applyQualificationRecognition(res?.data?.data || {});
this.$message.success('从业资格证识别完成');
})
.catch(() => {
this.$message.warning('从业资格证图片上传成功,自动识别失败,请手动填写相关信息');
})
.finally(() => {
loading.close();
});
}, },
recognizeBaiduOcr(url, type, side, documentName, applyRecognition) { recognizeBaiduOcr(url, type, side, documentName, applyRecognition) {
if (!url) { if (!url) {
@@ -1635,43 +1614,25 @@ export default {
return typeof value === 'object' ? value.words || value.value || '' : value || ''; return typeof value === 'object' ? value.words || value.value || '' : value || '';
}, },
applyQualificationRecognition(data = {}) { applyQualificationRecognition(data = {}) {
const fields = this.normalizeQualificationOcrFields(data); const qualificationType = this.getQualificationType(data);
const qualificationType = this.getQualificationOcrValue(fields, [ const qualificationNo = this.getQualificationNo(data);
'qualification_category',
'从业资格类别',
'从业资格类型',
]).replace(/[,,;;]+$/, '');
const qualificationNo = this.getQualificationOcrValue(fields, [
'certificate_no',
'证号',
'从业资格证号',
'资格证号',
'证书编号',
]);
const validFrom = this.getQualificationOcrValue(fields, ['valid_from', '有效起始日期']);
const validUntil = this.getQualificationOcrValue(fields, ['valid_until', '有效期限', '有效期']);
const matchedType = this.matchQualificationType(qualificationType); const matchedType = this.matchQualificationType(qualificationType);
if (matchedType) { if (matchedType) {
this.driverForm.qualificationType = matchedType; this.driverForm.qualificationType = matchedType;
} else if (qualificationType && !this.qualificationTypeOptions.length) { } else if (qualificationType && !this.qualificationTypeOptions.length) {
this.driverForm.qualificationType = qualificationType; this.driverForm.qualificationType = qualificationType;
} }
if (qualificationNo) { if (qualificationNo && !this.driverForm.qualificationNo) {
this.driverForm.qualificationNo = String(qualificationNo).replace(/\s/g, ''); this.driverForm.qualificationNo = String(qualificationNo).replace(/\s/g, '');
} }
const startDate = this.normalizeBirthday(validFrom); const words = this.getBaiduOcrWords(data).join(' ');
if (startDate) { const dateList = words.match(/\d{4}[-/.年]\d{1,2}[-/.月]\d{1,2}日?/g) || [];
this.driverForm.qualificationStartDate = startDate; if (/(长期|永久有效)/.test(words)) {
}
if (/(长期|永久)/.test(validUntil)) {
this.driverForm.qualificationLongTerm = 1; this.driverForm.qualificationLongTerm = 1;
this.driverForm.qualificationEndDate = ''; this.driverForm.qualificationEndDate = '';
} else { } else if (dateList.length) {
const endDate = this.normalizeBirthday(validUntil); this.driverForm.qualificationEndDate = this.normalizeBirthday(dateList[dateList.length - 1]);
if (endDate) { this.driverForm.qualificationLongTerm = 0;
this.driverForm.qualificationEndDate = endDate;
this.driverForm.qualificationLongTerm = 0;
}
} }
this.$nextTick(() => { this.$nextTick(() => {
['qualificationType', 'qualificationNo', 'qualificationEndDate'].forEach(prop => { ['qualificationType', 'qualificationNo', 'qualificationEndDate'].forEach(prop => {
@@ -1679,25 +1640,22 @@ export default {
}); });
}); });
}, },
normalizeQualificationOcrFields(result = {}) { getQualificationType(data = {}) {
if (result.fields && typeof result.fields === 'object' && !Array.isArray(result.fields)) { const fieldValue = this.getOcrValue(data, ['从业资格类别', '从业资格类型']);
return result.fields; if (fieldValue) return String(fieldValue).trim();
const words = this.getBaiduOcrWords(data);
const labelIndex = words.findIndex(word => /从业资格类别|从业资格类型/.test(word));
if (labelIndex < 0) return '';
const firstValue = words[labelIndex].replace(/^.*?(?:从业资格类别|从业资格类型)\s*[::]?/, '').trim();
const values = firstValue ? [firstValue] : [];
for (let index = labelIndex + 1; index < words.length; index += 1) {
const word = String(words[index] || '').trim();
if (!word || /^(有效起始日期|有效期限|核发机关|继续教育信息|诚信考核信息)/.test(word)) {
break;
}
values.push(word);
} }
const keyInfos = result.key_info || result.keyInfo || result.keyInfos || []; return values.join('').replace(/[,,;;]+$/, '').trim();
if (!Array.isArray(keyInfos)) return {};
return Object.fromEntries(
keyInfos
.filter(item => item && item.key)
.map(item => [String(item.key).trim(), String(item.value ?? '').trim()])
.filter(([, value]) => value)
);
},
getQualificationOcrValue(fields = {}, keys = []) {
const normalizedKeys = keys.map(key => String(key).toLowerCase());
const entry = Object.entries(fields).find(([key]) =>
normalizedKeys.includes(String(key).toLowerCase())
);
return entry ? String(entry[1] || '').trim() : '';
}, },
matchQualificationType(value = '') { matchQualificationType(value = '') {
const text = String(value || '').replace(/\s/g, ''); const text = String(value || '').replace(/\s/g, '');
@@ -1715,6 +1673,27 @@ export default {
); );
return matched?.value || ''; return matched?.value || '';
}, },
getQualificationNo(data = {}) {
const fieldValue = this.getOcrValue(data, ['从业资格证号', '资格证号', '证书编号']);
if (fieldValue) return fieldValue;
const words = this.getBaiduOcrWords(data);
const labelIndex = words.findIndex(word => /^(?:(?:从业)?资格证号?|证书编号)[::]?$/.test(word));
if (labelIndex >= 0 && words[labelIndex + 1]) {
return words[labelIndex + 1];
}
const certificateLine = words.find(word => /(?:从业)?资格证号?|证书编号/.test(word));
const match = certificateLine?.match(/(?:(?:从业)?资格证号?|证书编号)\s*[::]?\s*([A-Z0-9-]{6,})/i);
return match?.[1] || '';
},
getBaiduOcrWords(data = {}) {
const wordsResult = data.words_result || data.wordsResult || {};
if (Array.isArray(wordsResult)) {
return wordsResult.map(item => item.words || item.value || '').filter(Boolean);
}
return Object.values(wordsResult)
.map(item => (typeof item === 'object' ? item.words || item.value || '' : item || ''))
.filter(Boolean);
},
normalizeNation(value = '') { normalizeNation(value = '') {
const nation = String(value || '').trim(); const nation = String(value || '').trim();
if (!nation) return ''; if (!nation) return '';
+23 -97
View File
@@ -310,7 +310,6 @@
v-model="archiveForm.customerCode" v-model="archiveForm.customerCode"
maxlength="20" maxlength="20"
show-word-limit show-word-limit
:disabled="Boolean(archiveForm.id)"
placeholder="请输入,留空则自动生成" placeholder="请输入,留空则自动生成"
/> />
</el-form-item> </el-form-item>
@@ -379,7 +378,7 @@
placeholder="请输入" placeholder="请输入"
maxlength="18" maxlength="18"
show-word-limit show-word-limit
:disabled="Boolean(archiveForm.id)" :disabled="kingdeeLocked && Boolean(archiveForm.id)"
@input=" @input="
archiveForm.unifiedCreditCode = String( archiveForm.unifiedCreditCode = String(
archiveForm.unifiedCreditCode || '' archiveForm.unifiedCreditCode || ''
@@ -395,7 +394,7 @@
placeholder="请输入" placeholder="请输入"
maxlength="100" maxlength="100"
show-word-limit show-word-limit
:disabled="kingdeeLocked && !archiveForm.id" :disabled="kingdeeLocked"
@blur="checkArchiveNameRisk" @blur="checkArchiveNameRisk"
/> />
<el-tooltip <el-tooltip
@@ -435,7 +434,7 @@
v-model="archiveForm.legalPerson" v-model="archiveForm.legalPerson"
maxlength="10" maxlength="10"
show-word-limit show-word-limit
:disabled="kingdeeLocked && !archiveForm.id" :disabled="kingdeeLocked"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -536,7 +535,7 @@
<el-input <el-input
v-model="archiveForm.registeredCapital" v-model="archiveForm.registeredCapital"
maxlength="18" maxlength="18"
:disabled="kingdeeLocked && !archiveForm.id" :disabled="kingdeeLocked"
@input="value => handleDecimalInput('registeredCapital', value)" @input="value => handleDecimalInput('registeredCapital', value)"
/> />
</el-form-item> </el-form-item>
@@ -546,7 +545,7 @@
<el-input <el-input
v-model="archiveForm.paidInCapital" v-model="archiveForm.paidInCapital"
maxlength="18" maxlength="18"
:disabled="kingdeeLocked && !archiveForm.id" :disabled="kingdeeLocked"
@input="value => handleDecimalInput('paidInCapital', value)" @input="value => handleDecimalInput('paidInCapital', value)"
/> />
</el-form-item> </el-form-item>
@@ -1410,10 +1409,9 @@
<el-form-item label="自评得分" :required="isOfflineScore"> <el-form-item label="自评得分" :required="isOfflineScore">
<el-input <el-input
v-if="isOfflineScore" v-if="isOfflineScore"
:model-value="formatScoreValue(currentScore.selfScore)" v-model="currentScore.selfScore"
maxlength="10" maxlength="10"
:disabled="readonly" :disabled="readonly"
placeholder="请输入自评得分"
@input="handleOfflineSelfScoreInput" @input="handleOfflineSelfScoreInput"
@blur="recalculateOfflineScore" @blur="recalculateOfflineScore"
> >
@@ -2491,14 +2489,8 @@ export default {
]; ];
const rows = categoryMap.map((category, index) => { const rows = categoryMap.map((category, index) => {
const details = this.getScoreCategoryDetails(category.categoryCode); const details = this.getScoreCategoryDetails(category.categoryCode);
const sumCategoryScore = prop => let selfScore = details.reduce((sum, item) => sum + Number(item.selfScore || 0), 0);
details.reduce((sum, item) => { let reviewScore = details.reduce((sum, item) => sum + Number(item.reviewScore || 0), 0);
if (this.isBlankScore(item[prop])) return sum;
const value = Number(item[prop]);
return sum + (Number.isFinite(value) ? value : 0);
}, 0);
let selfScore = sumCategoryScore('selfScore');
let reviewScore = sumCategoryScore('reviewScore');
// 暂定:加分/减分合计最高按 15 分计(分类汇总展示封顶后值) // 暂定:加分/减分合计最高按 15 分计(分类汇总展示封顶后值)
if (category.categoryCode === 'plus') { if (category.categoryCode === 'plus') {
selfScore = Math.min(selfScore, HARDCODED_MAX_PLUS_SCORE); selfScore = Math.min(selfScore, HARDCODED_MAX_PLUS_SCORE);
@@ -4246,9 +4238,7 @@ export default {
'核准日期', '核准日期',
]); ]);
const scope = this.getBusinessLicenseOcrValue(fields, ['经营范围']); const scope = this.getBusinessLicenseOcrValue(fields, ['经营范围']);
if (code && !this.archiveForm.id) { if (code) this.archiveForm.unifiedCreditCode = code.replace(/\s/g, '').toUpperCase();
this.archiveForm.unifiedCreditCode = code.replace(/\s/g, '').toUpperCase();
}
if (name) this.archiveForm.fullName = name; if (name) this.archiveForm.fullName = name;
if (name) this.checkArchiveNameRisk(); if (name) this.checkArchiveNameRisk();
if (legalPerson) this.archiveForm.legalPerson = legalPerson; if (legalPerson) this.archiveForm.legalPerson = legalPerson;
@@ -4562,9 +4552,6 @@ export default {
quantificationId: score.quantificationId ? String(score.quantificationId) : '', quantificationId: score.quantificationId ? String(score.quantificationId) : '',
evaluateMode: score.evaluateMode === 'offline' ? 'offline' : 'online', evaluateMode: score.evaluateMode === 'offline' ? 'offline' : 'online',
nextEvaluateDate: score.nextEvaluateDate || '', nextEvaluateDate: score.nextEvaluateDate || '',
selfScore: this.normalizeScoreInputValue(score.selfScore),
reviewScore: this.normalizeScoreInputValue(score.reviewScore),
finalScore: this.normalizeScoreInputValue(score.finalScore),
applyCreditLimit: this.normalizeOptionalAmount( applyCreditLimit: this.normalizeOptionalAmount(
score.applyCreditLimit === undefined score.applyCreditLimit === undefined
? this.archiveForm.applyCreditLimit ? this.archiveForm.applyCreditLimit
@@ -4578,8 +4565,6 @@ export default {
details: (score.details || []).map(detail => ({ details: (score.details || []).map(detail => ({
...detail, ...detail,
scoreInput: this.normalizeScoreInputValue(detail.scoreInput), scoreInput: this.normalizeScoreInputValue(detail.scoreInput),
selfScore: this.normalizeScoreInputValue(detail.selfScore),
reviewScore: this.normalizeScoreInputValue(detail.reviewScore),
})), })),
}; };
}, },
@@ -5360,9 +5345,7 @@ export default {
return this.getScoreDetailCategoryCode(detail) === 'basic'; return this.getScoreDetailCategoryCode(detail) === 'basic';
}, },
getSignedScore(detail, prop) { getSignedScore(detail, prop) {
if (this.isBlankScore(detail[prop])) return ''; const score = Number(detail[prop] || 0);
const score = Number(detail[prop]);
if (!Number.isFinite(score)) return '';
return this.isMinusScoreDetail(detail) && score > 0 ? -score : score; return this.isMinusScoreDetail(detail) && score > 0 ? -score : score;
}, },
getScoreItemFullScore(detail = {}) { getScoreItemFullScore(detail = {}) {
@@ -5436,12 +5419,7 @@ export default {
const basicDetails = this.getScoreCategoryDetailsByList(details, 'basic'); const basicDetails = this.getScoreCategoryDetailsByList(details, 'basic');
const plusDetails = this.getScoreCategoryDetailsByList(details, 'plus'); const plusDetails = this.getScoreCategoryDetailsByList(details, 'plus');
const minusDetails = this.getScoreCategoryDetailsByList(details, 'minus'); const minusDetails = this.getScoreCategoryDetailsByList(details, 'minus');
const sumScore = (list, prop) => const sumScore = (list, prop) => list.reduce((sum, item) => sum + Number(item[prop] || 0), 0);
list.reduce((sum, item) => {
if (this.isBlankScore(item[prop])) return sum;
const value = Number(item[prop]);
return sum + (Number.isFinite(value) ? value : 0);
}, 0);
const rawPlusSelf = sumScore(plusDetails, 'selfScore'); const rawPlusSelf = sumScore(plusDetails, 'selfScore');
const rawPlusReview = sumScore(plusDetails, 'reviewScore'); const rawPlusReview = sumScore(plusDetails, 'reviewScore');
const rawMinusSelf = sumScore(minusDetails, 'selfScore'); const rawMinusSelf = sumScore(minusDetails, 'selfScore');
@@ -5456,51 +5434,33 @@ export default {
const hasReviewScore = details.some( const hasReviewScore = details.some(
item => !this.isBlankScore(item.reviewScore) item => !this.isBlankScore(item.reviewScore)
); );
// 线下模式允许手工改自评得分:有手工值时优先采用,否则回退明细合计;-1 视为未填 // 线下模式允许手工改自评得分:有手工值时优先采用,否则回退明细合计
const isOffline = String(score.evaluateMode || '') === 'offline'; const isOffline = String(score.evaluateMode || '') === 'offline';
const hasManualSelfScore = isOffline && !this.isBlankScore(score.selfScore);
const hasFilledDetail = details.some(item => {
if (this.isScoreTypeDetail(item)) {
const input = String(item.scoreInput ?? '').trim();
return input !== '' && input !== '-' && input !== '.';
}
return !this.isBlankScore(item.selectedOption);
});
const manualSelfScore = Number(score.selfScore); const manualSelfScore = Number(score.selfScore);
const selfScore = const selfScore =
hasManualSelfScore && Number.isFinite(manualSelfScore) ? manualSelfScore : computedSelfScore; isOffline && Number.isFinite(manualSelfScore) && String(score.selfScore ?? '').trim() !== ''
? manualSelfScore
: computedSelfScore;
const finalScore = hasReviewScore ? reviewScore : selfScore; const finalScore = hasReviewScore ? reviewScore : selfScore;
const fullMark = this.getScoreFullMark(details); const fullMark = this.getScoreFullMark(details);
const scoreRate = const scoreRate =
fullMark > 0 ? Math.max(0, Math.min(100, (finalScore / fullMark) * 100)) : 0; fullMark > 0 ? Math.max(0, Math.min(100, (finalScore / fullMark) * 100)) : 0;
const standard = this.matchCreditStandard(score, scoreRate); const standard = this.matchCreditStandard(score, scoreRate);
const hasStandards = (score.standards || []).some(item => item && item.creditLevel); const hasStandards = (score.standards || []).some(item => item && item.creditLevel);
// 线下未手工填写且明细未实际填报时保留空,避免默认写出 -1/0 score.selfScore = Number(Number(selfScore).toFixed(2));
const keepOfflineScoreBlank = isOffline && !hasManualSelfScore && !hasFilledDetail;
score.selfScore = keepOfflineScoreBlank ? '' : Number(Number(selfScore).toFixed(2));
score.reviewScore = Number(reviewScore.toFixed(2)); score.reviewScore = Number(reviewScore.toFixed(2));
score.finalScore = score.finalScore = Number(Number(finalScore).toFixed(2));
keepOfflineScoreBlank && !hasReviewScore ? '' : Number(Number(finalScore).toFixed(2)); score.scoreRate = Number(scoreRate.toFixed(2));
score.scoreRate = keepOfflineScoreBlank && !hasReviewScore ? '' : Number(scoreRate.toFixed(2));
if (hasStandards) { if (hasStandards) {
score.creditLevel = keepOfflineScoreBlank && !hasReviewScore ? '' : standard?.creditLevel || ''; score.creditLevel = standard?.creditLevel || '';
score.maxCreditLimit = score.maxCreditLimit = standard
keepOfflineScoreBlank && !hasReviewScore ? this.calculateCreditLimitByStandard(standard, scoreRate)
? '' : '';
: standard
? this.calculateCreditLimitByStandard(standard, scoreRate)
: '';
} }
return score; return score;
}, },
isBlankScore(value) { isBlankScore(value) {
return ( return value === undefined || value === null || String(value).trim() === '';
value === undefined ||
value === null ||
value === -1 ||
value === '-1' ||
String(value).trim() === ''
);
}, },
hasIncompleteBasicScoreDetail(details = []) { hasIncompleteBasicScoreDetail(details = []) {
return this.getScoreCategoryDetailsByList(details, 'basic').some(item => { return this.getScoreCategoryDetailsByList(details, 'basic').some(item => {
@@ -6008,27 +5968,6 @@ export default {
this.currentScore.evaluateMode = mode === 'offline' ? 'offline' : 'online'; this.currentScore.evaluateMode = mode === 'offline' ? 'offline' : 'online';
if (this.isOfflineScore) { if (this.isOfflineScore) {
this.expandedScoreCategoryKeys = []; this.expandedScoreCategoryKeys = [];
// 切到线下且明细尚未实际填报时清空自评,避免沿用线上合计或 -1 哨兵值
const hasFilledDetail = (this.currentScore.details || []).some(item => {
if (this.isScoreTypeDetail(item)) {
const input = String(item.scoreInput ?? '').trim();
return input !== '' && input !== '-' && input !== '.';
}
return !this.isBlankScore(item.selectedOption);
});
if (!hasFilledDetail || this.isBlankScore(this.currentScore.selfScore)) {
this.currentScore.selfScore = '';
}
if (!hasFilledDetail || this.isBlankScore(this.currentScore.finalScore)) {
this.currentScore.finalScore = '';
}
if (!hasFilledDetail) {
this.currentScore.scoreRate = '';
this.currentScore.creditLevel = '';
this.currentScore.maxCreditLimit = '';
}
} else {
this.calculateScore(this.currentScore);
} }
}, },
handleOfflineSelfScoreInput(value) { handleOfflineSelfScoreInput(value) {
@@ -6042,19 +5981,6 @@ export default {
}, },
recalculateOfflineScore() { recalculateOfflineScore() {
if (!this.isOfflineScore) return; if (!this.isOfflineScore) return;
if (this.isBlankScore(this.currentScore.selfScore)) {
this.currentScore.selfScore = '';
const hasReviewScore = (this.currentScore.details || []).some(
item => !this.isBlankScore(item.reviewScore)
);
if (!hasReviewScore) {
this.currentScore.finalScore = '';
}
this.currentScore.scoreRate = '';
this.currentScore.creditLevel = '';
this.currentScore.maxCreditLimit = '';
return;
}
const selfScore = Number(this.currentScore.selfScore); const selfScore = Number(this.currentScore.selfScore);
if (!Number.isFinite(selfScore)) return; if (!Number.isFinite(selfScore)) return;
this.currentScore.selfScore = Number(selfScore.toFixed(2)); this.currentScore.selfScore = Number(selfScore.toFixed(2));