Merge remote-tracking branch 'origin/master' into feature/20261016-settlement-adjustment-kingdee
This commit is contained in:
@@ -31,8 +31,15 @@ export const approve = data => request({ url: `${baseUrl}/approve`, method: 'pos
|
|||||||
export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data });
|
export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data });
|
||||||
export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data });
|
export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data });
|
||||||
// 同步金蝶涉及多次金蝶远程接口调用(A102-4 预检 + A102-2 保存),可达 20s+,覆盖全局 10s 超时
|
// 同步金蝶涉及多次金蝶远程接口调用(A102-4 预检 + A102-2 保存),可达 20s+,覆盖全局 10s 超时
|
||||||
export const syncKingdee = id =>
|
// config.meta.suppressErrorMessage=true 时由页面弹框汇总结果,避免拦截器重复 toast
|
||||||
request({ url: `${baseUrl}/sync-kingdee`, method: 'post', timeout: 30000, params: { id } });
|
export const syncKingdee = (id, config = {}) =>
|
||||||
|
request({
|
||||||
|
url: `${baseUrl}/sync-kingdee`,
|
||||||
|
method: 'post',
|
||||||
|
timeout: 30000,
|
||||||
|
params: { id },
|
||||||
|
...config,
|
||||||
|
});
|
||||||
export const getDetailFees = detailId =>
|
export const getDetailFees = detailId =>
|
||||||
request({ url: `${baseUrl}/detail-fees`, method: 'get', params: { detailId } });
|
request({ url: `${baseUrl}/detail-fees`, method: 'get', params: { detailId } });
|
||||||
export const getReceiptClaims = formalSettlementId =>
|
export const getReceiptClaims = formalSettlementId =>
|
||||||
|
|||||||
@@ -77,7 +77,8 @@ export const syncOaDepartment = (
|
|||||||
size = 20,
|
size = 20,
|
||||||
signal,
|
signal,
|
||||||
incremental = false,
|
incremental = false,
|
||||||
modifiedSince
|
modifiedSince,
|
||||||
|
companyOaId
|
||||||
) => {
|
) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/blade-system/dept/sync-oa-department',
|
url: '/blade-system/dept/sync-oa-department',
|
||||||
@@ -87,6 +88,7 @@ export const syncOaDepartment = (
|
|||||||
size,
|
size,
|
||||||
incremental: !!incremental,
|
incremental: !!incremental,
|
||||||
modifiedSince: modifiedSince || undefined,
|
modifiedSince: modifiedSince || undefined,
|
||||||
|
companyOaId: companyOaId || undefined,
|
||||||
},
|
},
|
||||||
timeout: 60000,
|
timeout: 60000,
|
||||||
signal,
|
signal,
|
||||||
|
|||||||
+15
-8
@@ -74,12 +74,15 @@ const redirectToLogin = () => {
|
|||||||
* 统一弹出错误提示并返回带标记的 Error。
|
* 统一弹出错误提示并返回带标记的 Error。
|
||||||
* `_notified` 标记用于让业务层(批量导入等)识别「拦截器已经提示过」,
|
* `_notified` 标记用于让业务层(批量导入等)识别「拦截器已经提示过」,
|
||||||
* 避免同一条错误被弹两次。
|
* 避免同一条错误被弹两次。
|
||||||
|
* meta.suppressErrorMessage=true 时由业务层自行弹框汇总,拦截器不再 toast。
|
||||||
*/
|
*/
|
||||||
const notifiedError = message => {
|
const notifiedError = (message, config) => {
|
||||||
ElMessage({
|
if (config?.meta?.suppressErrorMessage !== true) {
|
||||||
message: message,
|
ElMessage({
|
||||||
type: 'error',
|
message: message,
|
||||||
});
|
type: 'error',
|
||||||
|
});
|
||||||
|
}
|
||||||
const error = new Error(message);
|
const error = new Error(message);
|
||||||
error._notified = true;
|
error._notified = true;
|
||||||
return error;
|
return error;
|
||||||
@@ -260,12 +263,12 @@ axios.interceptors.response.use(
|
|||||||
|
|
||||||
// OAuth2 业务错误码提示
|
// OAuth2 业务错误码提示
|
||||||
if (status > 2000 && !validatenull(res.data.error_description)) {
|
if (status > 2000 && !validatenull(res.data.error_description)) {
|
||||||
return Promise.reject(notifiedError(message));
|
return Promise.reject(notifiedError(message, config));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 其余非 200 响应统一提示
|
// 其余非 200 响应统一提示
|
||||||
if (status !== 200) {
|
if (status !== 200) {
|
||||||
return Promise.reject(notifiedError(message));
|
return Promise.reject(notifiedError(message, config));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
@@ -273,7 +276,11 @@ axios.interceptors.response.use(
|
|||||||
NProgress.done();
|
NProgress.done();
|
||||||
// 网络级失败(HTTP 状态 >500、网关错误、超时、断网等 validateStatus 放行之外的响应)
|
// 网络级失败(HTTP 状态 >500、网关错误、超时、断网等 validateStatus 放行之外的响应)
|
||||||
// 原为静默 reject,接口报错页面无任何感知;统一补错误提示,取消请求与刷新令牌请求除外
|
// 原为静默 reject,接口报错页面无任何感知;统一补错误提示,取消请求与刷新令牌请求除外
|
||||||
if (!axios.isCancel(error) && !isRefreshTokenRequest(error?.config)) {
|
if (
|
||||||
|
!axios.isCancel(error) &&
|
||||||
|
!isRefreshTokenRequest(error?.config) &&
|
||||||
|
error?.config?.meta?.suppressErrorMessage !== true
|
||||||
|
) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: error?.response?.data?.msg || '请求失败,请稍后重试',
|
message: error?.response?.data?.msg || '请求失败,请稍后重试',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ export const config = {
|
|||||||
action: 'startChange',
|
action: 'startChange',
|
||||||
label: '变更',
|
label: '变更',
|
||||||
statusProp: 'approvalStatus',
|
statusProp: 'approvalStatus',
|
||||||
status: ['approved'],
|
// 立项通过、变更通过后均可再次发起变更
|
||||||
|
status: ['approved', 'change_approved'],
|
||||||
permission: 'project_apply_change',
|
permission: 'project_apply_change',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ export const paymentApplicationOption = ({
|
|||||||
searchShow: true,
|
searchShow: true,
|
||||||
searchIcon: true,
|
searchIcon: true,
|
||||||
searchLabelWidth: 88,
|
searchLabelWidth: 88,
|
||||||
searchMenuSpan: 24,
|
// 查询/重置紧跟首行 4 个条件(4×5 + 菜单 4 = 24),不再独占下一整行
|
||||||
|
searchMenuSpan: 4,
|
||||||
searchIndex: 4,
|
searchIndex: 4,
|
||||||
searchMenuPosition: 'right',
|
searchMenuPosition: 'right',
|
||||||
border: true,
|
border: true,
|
||||||
@@ -78,6 +79,7 @@ export const paymentApplicationOption = ({
|
|||||||
prop: 'paymentNo',
|
prop: 'paymentNo',
|
||||||
slot: true,
|
slot: true,
|
||||||
search: true,
|
search: true,
|
||||||
|
searchSpan: 5,
|
||||||
searchOrder: 9,
|
searchOrder: 9,
|
||||||
searchPlaceholder: '请输入',
|
searchPlaceholder: '请输入',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
@@ -88,6 +90,7 @@ export const paymentApplicationOption = ({
|
|||||||
type: 'daterange',
|
type: 'daterange',
|
||||||
searchType: 'daterange',
|
searchType: 'daterange',
|
||||||
search: true,
|
search: true,
|
||||||
|
searchSpan: 5,
|
||||||
searchOrder: 8,
|
searchOrder: 8,
|
||||||
hide: true,
|
hide: true,
|
||||||
showColumn: false,
|
showColumn: false,
|
||||||
@@ -95,18 +98,24 @@ export const paymentApplicationOption = ({
|
|||||||
editDisplay: false,
|
editDisplay: false,
|
||||||
viewDisplay: false,
|
viewDisplay: false,
|
||||||
},
|
},
|
||||||
searchOnlyColumn({
|
{
|
||||||
label: '客户名称',
|
...searchOnlyColumn({
|
||||||
prop: 'payeeNameSearch',
|
label: '客户名称',
|
||||||
searchOrder: 7,
|
prop: 'payeeNameSearch',
|
||||||
searchProp: 'payeeName',
|
searchOrder: 7,
|
||||||
}),
|
searchProp: 'payeeName',
|
||||||
searchOnlyColumn({
|
}),
|
||||||
label: '项目名称',
|
searchSpan: 5,
|
||||||
prop: 'projectNameSearch',
|
},
|
||||||
searchOrder: 6,
|
{
|
||||||
searchProp: 'projectName',
|
...searchOnlyColumn({
|
||||||
}),
|
label: '项目名称',
|
||||||
|
prop: 'projectNameSearch',
|
||||||
|
searchOrder: 6,
|
||||||
|
searchProp: 'projectName',
|
||||||
|
}),
|
||||||
|
searchSpan: 5,
|
||||||
|
},
|
||||||
searchOnlyColumn({
|
searchOnlyColumn({
|
||||||
label: '关联结算单',
|
label: '关联结算单',
|
||||||
prop: 'settlementNo',
|
prop: 'settlementNo',
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const kingdeeSyncStatusOptions = [
|
|||||||
|
|
||||||
export const formalSettlementSearchFields = [
|
export const formalSettlementSearchFields = [
|
||||||
{ label: '结算单号', prop: 'formalSettlementNo', type: 'input' },
|
{ label: '结算单号', prop: 'formalSettlementNo', type: 'input' },
|
||||||
{ label: '预结算单号', prop: 'preSettlementNo', type: 'input' },
|
{ label: '预付结算单号', prop: 'preSettlementNo', type: 'input' },
|
||||||
{ label: '项目', prop: 'projectName', type: 'input' },
|
{ label: '项目', prop: 'projectName', type: 'input' },
|
||||||
{ label: '所属组织', prop: 'deptName', type: 'cascader' },
|
{ label: '所属组织', prop: 'deptName', type: 'cascader' },
|
||||||
{ label: '合同编号', prop: 'contractNo', type: 'input' },
|
{ label: '合同编号', prop: 'contractNo', type: 'input' },
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export const formalSettlementTableColumns = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const sourceColumns = [
|
export const sourceColumns = [
|
||||||
{ label: '预结算单号', prop: 'preSettlementNo', minWidth: 160 },
|
{ label: '预付结算单号', prop: 'preSettlementNo', minWidth: 160 },
|
||||||
{ label: '结算金额', prop: 'settlementAmount', minWidth: 130, money: true },
|
{ label: '结算金额', prop: 'settlementAmount', minWidth: 130, money: true },
|
||||||
{ label: '申请预付金额', prop: 'advanceAppliedAmount', minWidth: 140, money: true },
|
{ label: '申请预付金额', prop: 'advanceAppliedAmount', minWidth: 140, money: true },
|
||||||
{ label: '已付款金额', prop: 'advancePaidAmount', minWidth: 130, money: true },
|
{ label: '已付款金额', prop: 'advancePaidAmount', minWidth: 130, money: true },
|
||||||
@@ -50,6 +50,7 @@ export const detailColumns = [
|
|||||||
{ label: '运输总量', prop: 'transportQuantity', minWidth: 120 },
|
{ label: '运输总量', prop: 'transportQuantity', minWidth: 120 },
|
||||||
{ label: '里程(KM)', prop: 'mileage', minWidth: 120 },
|
{ label: '里程(KM)', prop: 'mileage', minWidth: 120 },
|
||||||
{ label: '批次号', prop: 'batchNo', minWidth: 120 },
|
{ label: '批次号', prop: 'batchNo', minWidth: 120 },
|
||||||
|
{ label: '计费方式', prop: 'billingType', minWidth: 130 },
|
||||||
{ label: '运输单价', prop: 'unitPrice', minWidth: 120, money: true },
|
{ label: '运输单价', prop: 'unitPrice', minWidth: 120, money: true },
|
||||||
{ label: '运费', prop: 'freightAmount', minWidth: 120, money: true },
|
{ label: '运费', prop: 'freightAmount', minWidth: 120, money: true },
|
||||||
{ label: '调整金额', prop: 'adjustAmount', minWidth: 120, money: true },
|
{ label: '调整金额', prop: 'adjustAmount', minWidth: 120, money: true },
|
||||||
@@ -68,7 +69,7 @@ export const summaryColumns = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const candidateColumns = [
|
export const candidateColumns = [
|
||||||
{ label: '预结算单号', prop: 'preSettlementNo', minWidth: 170 },
|
{ label: '预付结算单号', prop: 'preSettlementNo', minWidth: 170 },
|
||||||
{ label: '项目名称', prop: 'projectName', minWidth: 140 },
|
{ label: '项目名称', prop: 'projectName', minWidth: 140 },
|
||||||
{ label: '所属组织', prop: 'deptName', minWidth: 140 },
|
{ label: '所属组织', prop: 'deptName', minWidth: 140 },
|
||||||
{ label: '合同编号', prop: 'contractNo', minWidth: 150 },
|
{ label: '合同编号', prop: 'contractNo', minWidth: 150 },
|
||||||
@@ -88,7 +89,7 @@ export const candidateDetailColumns = [
|
|||||||
{ label: '合同编号', prop: 'contractNo', minWidth: 150 },
|
{ label: '合同编号', prop: 'contractNo', minWidth: 150 },
|
||||||
{ label: '合同名称', prop: 'contractName', minWidth: 170 },
|
{ label: '合同名称', prop: 'contractName', minWidth: 170 },
|
||||||
{ label: '来源', prop: 'sourceType', minWidth: 110 },
|
{ label: '来源', prop: 'sourceType', minWidth: 110 },
|
||||||
{ label: '预结算单号', prop: 'preSettlementNo', minWidth: 160 },
|
{ label: '预付结算单号', prop: 'preSettlementNo', minWidth: 160 },
|
||||||
{ label: '正式结算单号', prop: 'formalSettlementNo', minWidth: 160 },
|
{ label: '正式结算单号', prop: 'formalSettlementNo', minWidth: 160 },
|
||||||
{ label: '运单号', prop: 'waybillNo', minWidth: 150 },
|
{ label: '运单号', prop: 'waybillNo', minWidth: 150 },
|
||||||
{ label: '车号', prop: 'vehicleNo', minWidth: 130 },
|
{ label: '车号', prop: 'vehicleNo', minWidth: 130 },
|
||||||
@@ -96,6 +97,7 @@ export const candidateDetailColumns = [
|
|||||||
{ label: '货物名称', prop: 'cargoName', minWidth: 140 },
|
{ label: '货物名称', prop: 'cargoName', minWidth: 140 },
|
||||||
{ label: '货物类型', prop: 'cargoType', minWidth: 130 },
|
{ label: '货物类型', prop: 'cargoType', minWidth: 130 },
|
||||||
{ label: '批次号', prop: 'batchNo', minWidth: 120 },
|
{ label: '批次号', prop: 'batchNo', minWidth: 120 },
|
||||||
|
{ label: '计费方式', prop: 'billingType', minWidth: 130 },
|
||||||
{ label: '应收应付合计', prop: 'totalAmount', minWidth: 140, money: true },
|
{ label: '应收应付合计', prop: 'totalAmount', minWidth: 140, money: true },
|
||||||
{ label: '状态', prop: 'settlementStatusName', minWidth: 110 },
|
{ label: '状态', prop: 'settlementStatusName', minWidth: 110 },
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export const settlementTypeOptions = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const preSettlementFormFields = [
|
export const preSettlementFormFields = [
|
||||||
{ label: '预结算单号', prop: 'preSettlementNo', readonly: true },
|
{ label: '预付结算单号', prop: 'preSettlementNo', readonly: true },
|
||||||
{ label: '合同名称', prop: 'contractId', type: 'contract', required: true },
|
{ label: '合同名称', prop: 'contractId', type: 'contract', required: true },
|
||||||
{ label: '合同编号', prop: 'contractNo', readonly: true },
|
{ label: '合同编号', prop: 'contractNo', readonly: true },
|
||||||
{ label: '项目名称', prop: 'projectName', readonly: true },
|
{ label: '项目名称', prop: 'projectName', readonly: true },
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export const approvalStatusOptions = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const preSettlementSearchFields = [
|
export const preSettlementSearchFields = [
|
||||||
{ label: '预结算单号', prop: 'preSettlementNo', type: 'input' },
|
{ label: '预付结算单号', prop: 'preSettlementNo', type: 'input' },
|
||||||
{ label: '预付单号', prop: 'advanceNo', type: 'input' },
|
{ label: '预付单号', prop: 'advanceNo', type: 'input' },
|
||||||
{ label: '项目名称', prop: 'projectName', type: 'input' },
|
{ label: '项目名称', prop: 'projectName', type: 'input' },
|
||||||
{ label: '所属组织', prop: 'deptName', type: 'cascader' },
|
{ label: '所属组织', prop: 'deptName', type: 'cascader' },
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const preSettlementTableColumns = [
|
export const preSettlementTableColumns = [
|
||||||
{ label: '预结算单号', prop: 'preSettlementNo', minWidth: 150, link: true, fixed: 'left' },
|
{ label: '预付结算单号', prop: 'preSettlementNo', minWidth: 150, link: true, fixed: 'left' },
|
||||||
{ label: '来源', prop: 'sourceType', minWidth: 100 },
|
{ label: '来源', prop: 'sourceType', minWidth: 100 },
|
||||||
{ label: '付款方', prop: 'payerName', minWidth: 160 },
|
{ label: '付款方', prop: 'payerName', minWidth: 160 },
|
||||||
{ label: '收款方', prop: 'payeeName', minWidth: 160 },
|
{ label: '收款方', prop: 'payeeName', minWidth: 160 },
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const searchFields = [
|
|||||||
{ label: '货物名称', prop: 'cargoName', type: 'input' },
|
{ label: '货物名称', prop: 'cargoName', type: 'input' },
|
||||||
{ label: '合同编号', prop: 'contractNo', type: 'input' },
|
{ label: '合同编号', prop: 'contractNo', type: 'input' },
|
||||||
{ label: '合同名称', prop: 'contractName', type: 'input' },
|
{ label: '合同名称', prop: 'contractName', type: 'input' },
|
||||||
{ label: '预结算单号', prop: 'preSettlementNo', type: 'input' },
|
{ label: '预付结算单号', prop: 'preSettlementNo', type: 'input' },
|
||||||
{ label: '正式结算单号', prop: 'formalSettlementNo', type: 'input' },
|
{ label: '正式结算单号', prop: 'formalSettlementNo', type: 'input' },
|
||||||
{ label: '批次号', prop: 'batchNo', type: 'input' },
|
{ label: '批次号', prop: 'batchNo', type: 'input' },
|
||||||
{ label: '车号', prop: 'vehicleNo', type: 'input' },
|
{ label: '车号', prop: 'vehicleNo', type: 'input' },
|
||||||
@@ -35,7 +35,7 @@ export const tableColumns = [
|
|||||||
{ label: '合同编号', prop: 'contractNo', minWidth: 140 },
|
{ label: '合同编号', prop: 'contractNo', minWidth: 140 },
|
||||||
{ label: '合同名称', prop: 'contractName', minWidth: 140 },
|
{ label: '合同名称', prop: 'contractName', minWidth: 140 },
|
||||||
{ label: '来源', prop: 'sourceType', minWidth: 110 },
|
{ label: '来源', prop: 'sourceType', minWidth: 110 },
|
||||||
{ label: '预结算单号', prop: 'preSettlementNo', minWidth: 140, link: true },
|
{ label: '预付结算单号', prop: 'preSettlementNo', minWidth: 140, link: true },
|
||||||
{ label: '正式结算单号', prop: 'formalSettlementNo', minWidth: 140, link: true },
|
{ label: '正式结算单号', prop: 'formalSettlementNo', minWidth: 140, link: true },
|
||||||
{ label: '运单号', prop: 'waybillNo', minWidth: 140, link: true },
|
{ label: '运单号', prop: 'waybillNo', minWidth: 140, link: true },
|
||||||
{ label: '车号', prop: 'vehicleNo', minWidth: 120 },
|
{ label: '车号', prop: 'vehicleNo', minWidth: 120 },
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export const reconciliationStatusOptions = [
|
|||||||
|
|
||||||
export const transportReconciliationSearchFields = [
|
export const transportReconciliationSearchFields = [
|
||||||
{ prop: 'reconciliationNo', label: '对账单号', type: 'input' },
|
{ prop: 'reconciliationNo', label: '对账单号', type: 'input' },
|
||||||
{ prop: 'preSettlementNos', label: '预结算单号', type: 'input' },
|
{ prop: 'preSettlementNos', label: '预付结算单号', type: 'input' },
|
||||||
{ prop: 'projectName', label: '项目', type: 'input' },
|
{ prop: 'projectName', label: '项目', type: 'input' },
|
||||||
{ prop: 'deptName', label: '所属组织', type: 'cascader' },
|
{ prop: 'deptName', label: '所属组织', type: 'cascader' },
|
||||||
{ prop: 'contractNo', label: '合同编号', type: 'input' },
|
{ prop: 'contractNo', label: '合同编号', type: 'input' },
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export default [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/settlement/pre-settlement/public-view',
|
path: '/settlement/pre-settlement/public-view',
|
||||||
name: '查看预结算信息',
|
name: '查看预付结算单信息',
|
||||||
component: () => import('@/views/settlement/pre-settlement-public-view.vue'),
|
component: () => import('@/views/settlement/pre-settlement-public-view.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
@@ -119,7 +119,7 @@ export default [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/settlement/formal-settlement/public-view',
|
path: '/settlement/formal-settlement/public-view',
|
||||||
name: '查看正式结算信息',
|
name: '查看结算单信息',
|
||||||
component: () => import('@/views/settlement/formal-settlement-public-view.vue'),
|
component: () => import('@/views/settlement/formal-settlement-public-view.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export default [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
name: '新增编辑预结算',
|
name: '新增编辑预付结算单',
|
||||||
meta: {
|
meta: {
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
activeMenu: '/settlement/pre-settlement',
|
activeMenu: '/settlement/pre-settlement',
|
||||||
@@ -110,10 +110,11 @@ export default [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
name: '新增编辑正式结算',
|
name: '新增编辑结算单',
|
||||||
meta: {
|
meta: {
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
activeMenu: '/settlement/formal-settlement',
|
// 付款/收款结算单共用表单页,具体高亮菜单由页面按 settlementType 回写
|
||||||
|
activeMenu: '/settlement/payment-settlement',
|
||||||
},
|
},
|
||||||
component: loadView(() => import('@/views/settlement/formal-settlement-form.vue')),
|
component: loadView(() => import('@/views/settlement/formal-settlement-form.vue')),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const MK_BIZ = {
|
|||||||
},
|
},
|
||||||
'pre-settlement': {
|
'pre-settlement': {
|
||||||
dictName: '提交预结算审核流',
|
dictName: '提交预结算审核流',
|
||||||
subjectPrefix: '预结算审批',
|
subjectPrefix: '预付结算审批',
|
||||||
rejected: ['returned'],
|
rejected: ['returned'],
|
||||||
approved: ['approved'],
|
approved: ['approved'],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/** 结算菜单拆分后的展示名与权限前缀 */
|
||||||
|
|
||||||
|
export const SETTLEMENT_TYPE_PAYABLE = 'payable';
|
||||||
|
export const SETTLEMENT_TYPE_RECEIVABLE = 'receivable';
|
||||||
|
|
||||||
|
export function settlementBillLabel(settlementType) {
|
||||||
|
return settlementType === SETTLEMENT_TYPE_RECEIVABLE ? '收款结算单' : '付款结算单';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function settlementPermissionPrefix(settlementType) {
|
||||||
|
return settlementType === SETTLEMENT_TYPE_RECEIVABLE
|
||||||
|
? 'receipt_settlement'
|
||||||
|
: 'payment_settlement';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function settlementListPath(settlementType) {
|
||||||
|
return settlementType === SETTLEMENT_TYPE_RECEIVABLE
|
||||||
|
? '/settlement/receipt-settlement'
|
||||||
|
: '/settlement/payment-settlement';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限判断:优先新菜单码,兼容旧 formal_settlement_*。
|
||||||
|
* @param {Object} ctx 组件实例(需含 permission、isAdmin、validData)
|
||||||
|
* @param {string} settlementType payable|receivable
|
||||||
|
* @param {string} action add|edit|view...
|
||||||
|
*/
|
||||||
|
export function hasSettlementPermission(ctx, settlementType, action) {
|
||||||
|
if (ctx?.isAdmin) return true;
|
||||||
|
const prefix = settlementPermissionPrefix(settlementType);
|
||||||
|
const codes = [`${prefix}_${action}`, `formal_settlement_${action}`];
|
||||||
|
return codes.some(code => {
|
||||||
|
const value = ctx?.permission?.[code];
|
||||||
|
if (typeof ctx?.validData === 'function') {
|
||||||
|
return ctx.validData(value, false);
|
||||||
|
}
|
||||||
|
return value === true;
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -5897,7 +5897,7 @@ export default {
|
|||||||
'固定金额(整单一口价)': ['固定一口价'],
|
'固定金额(整单一口价)': ['固定一口价'],
|
||||||
按数量: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'],
|
按数量: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'],
|
||||||
},
|
},
|
||||||
settlementTypeOptions: ['月结', '日结', '周结', '半月结', '固定天数周期结算'],
|
settlementTypeOptions: ['月结', '日结', '周结', '固定天数周期结算'],
|
||||||
billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'],
|
billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'],
|
||||||
reconciliationModeOptions: ['明细逐行核对', '按账单汇总核对', '跳过自动核对'],
|
reconciliationModeOptions: ['明细逐行核对', '按账单汇总核对', '跳过自动核对'],
|
||||||
packageOptions,
|
packageOptions,
|
||||||
|
|||||||
@@ -1266,9 +1266,27 @@ const fillEditForm = async row => {
|
|||||||
if (carrierValue) carrierChange(carrierValue);
|
if (carrierValue) carrierChange(carrierValue);
|
||||||
await loadBatchRows(snapshot.id);
|
await loadBatchRows(snapshot.id);
|
||||||
};
|
};
|
||||||
const removeBatches = () =>
|
/** 与行操作一致:仅草稿可删除 */
|
||||||
api.removeImportBatches(selected.value.map(item => item.id).join(',')).then(loadBatches);
|
const canRemoveBatch = row => String(row?.importStatus || '') === 'draft';
|
||||||
const removeBatch = row => api.removeImportBatches(row.id).then(loadBatches);
|
const removeBatches = () => {
|
||||||
|
if (!selected.value.length) {
|
||||||
|
ElMessage.warning('请选择至少一条数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 选中含不可删条目时整批拦截(含已完成/进行中),不静默跳过
|
||||||
|
if (selected.value.some(row => !canRemoveBatch(row))) {
|
||||||
|
ElMessage.warning('已完成运单不可删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return api.removeImportBatches(selected.value.map(item => item.id).join(',')).then(loadBatches);
|
||||||
|
};
|
||||||
|
const removeBatch = row => {
|
||||||
|
if (!canRemoveBatch(row)) {
|
||||||
|
ElMessage.warning('已完成运单不可删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return api.removeImportBatches(row.id).then(loadBatches);
|
||||||
|
};
|
||||||
const projectChange = async id => {
|
const projectChange = async id => {
|
||||||
const requestId = ++projectRequestId;
|
const requestId = ++projectRequestId;
|
||||||
const item = projects.value.find(row => String(row.id) === String(id));
|
const item = projects.value.find(row => String(row.id) === String(id));
|
||||||
|
|||||||
@@ -217,7 +217,12 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<section class="change-section">
|
<section class="change-section">
|
||||||
<div class="section-head"><div class="dialog-section-title">计费信息</div><el-button type="primary" plain @click="addPlan">添加</el-button></div>
|
<div class="section-head">
|
||||||
|
<div class="dialog-section-title">计费信息</div>
|
||||||
|
<el-button v-if="feeGenerationMode !== 'manual'" type="primary" plain @click="addPlan"
|
||||||
|
>添加</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
<el-radio-group v-model="feeGenerationMode"><el-radio label="system">系统生成</el-radio><el-radio label="manual">账单导入生成</el-radio></el-radio-group>
|
<el-radio-group v-model="feeGenerationMode"><el-radio label="system">系统生成</el-radio><el-radio label="manual">账单导入生成</el-radio></el-radio-group>
|
||||||
<el-table :data="plans" border class="change-table"><el-table-column type="index" label="序号" width="70" /><el-table-column prop="planName" label="方案名称" min-width="220" /><el-table-column label="默认方案" min-width="120"><template #default="{ row }">{{ row.defaultPlan ? '是' : '否' }}</template></el-table-column><el-table-column prop="remark" label="备注" min-width="260" /><el-table-column label="操作" width="180"><template #default="{ row, $index }"><el-link type="primary" @click="editPlan(row, $index)">编辑</el-link><el-link type="danger" @click="plans.splice($index, 1)">删除</el-link></template></el-table-column></el-table>
|
<el-table :data="plans" border class="change-table"><el-table-column type="index" label="序号" width="70" /><el-table-column prop="planName" label="方案名称" min-width="220" /><el-table-column label="默认方案" min-width="120"><template #default="{ row }">{{ row.defaultPlan ? '是' : '否' }}</template></el-table-column><el-table-column prop="remark" label="备注" min-width="260" /><el-table-column label="操作" width="180"><template #default="{ row, $index }"><el-link type="primary" @click="editPlan(row, $index)">编辑</el-link><el-link type="danger" @click="plans.splice($index, 1)">删除</el-link></template></el-table-column></el-table>
|
||||||
</section>
|
</section>
|
||||||
@@ -440,7 +445,7 @@ export default {
|
|||||||
},
|
},
|
||||||
preSettlementConfig: {},
|
preSettlementConfig: {},
|
||||||
formalSettlementConfig: {},
|
formalSettlementConfig: {},
|
||||||
settlementTypeOptions: ['月结', '日结', '周结', '半月结', '固定天数周期结算'],
|
settlementTypeOptions: ['月结', '日结', '周结', '固定天数周期结算'],
|
||||||
billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'],
|
billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'],
|
||||||
billCutoffDayOptions: Array.from({ length: 31 }, (_, index) => ({
|
billCutoffDayOptions: Array.from({ length: 31 }, (_, index) => ({
|
||||||
label: `${index + 1}日`,
|
label: `${index + 1}日`,
|
||||||
|
|||||||
@@ -647,7 +647,12 @@
|
|||||||
<el-radio label="manual">账单导入生成</el-radio>
|
<el-radio label="manual">账单导入生成</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</div>
|
</div>
|
||||||
<el-button type="primary" @click="openBillingPlan()">添加</el-button>
|
<el-button
|
||||||
|
v-if="form.feeGenerationMode !== 'manual'"
|
||||||
|
type="primary"
|
||||||
|
@click="openBillingPlan()"
|
||||||
|
>添加</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<el-table :data="billingPlanRows" border>
|
<el-table :data="billingPlanRows" border>
|
||||||
<el-table-column type="index" label="序号" width="80" align="center" />
|
<el-table-column type="index" label="序号" width="80" align="center" />
|
||||||
|
|||||||
@@ -224,7 +224,7 @@
|
|||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
filterable
|
filterable
|
||||||
clearable
|
clearable
|
||||||
:disabled="isBasicInfoReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="平台公司" prop="undertakeDeptId">
|
<el-form-item label="平台公司" prop="undertakeDeptId">
|
||||||
@@ -236,7 +236,7 @@
|
|||||||
collapse-tags-tooltip
|
collapse-tags-tooltip
|
||||||
clearable
|
clearable
|
||||||
filterable
|
filterable
|
||||||
:disabled="isBasicInfoReadonly"
|
:disabled="dialogReadonly"
|
||||||
@change="handleUndertakeDeptChange"
|
@change="handleUndertakeDeptChange"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@@ -2493,7 +2493,8 @@ export default {
|
|||||||
loadDeptOptions() {
|
loadDeptOptions() {
|
||||||
getDeptTree().then(res => {
|
getDeptTree().then(res => {
|
||||||
const deptTree = res.data.data || [];
|
const deptTree = res.data.data || [];
|
||||||
const businessDeptTree = ['add', 'edit', 'majorSupplement'].includes(this.dialogType)
|
// 新增/编辑/重大补录/项目变更均可选择业务部门,排除外部组织
|
||||||
|
const businessDeptTree = ['add', 'edit', 'majorSupplement', 'change'].includes(this.dialogType)
|
||||||
? this.excludeExternalOrganization(deptTree)
|
? this.excludeExternalOrganization(deptTree)
|
||||||
: deptTree;
|
: deptTree;
|
||||||
this.deptOptions = this.flattenDept(businessDeptTree);
|
this.deptOptions = this.flattenDept(businessDeptTree);
|
||||||
|
|||||||
@@ -774,7 +774,7 @@ export default {
|
|||||||
},
|
},
|
||||||
validateSettlements(rule, value, callback) {
|
validateSettlements(rule, value, callback) {
|
||||||
if (!this.form.settlements.length) {
|
if (!this.form.settlements.length) {
|
||||||
callback(new Error('请选择正式结算单'));
|
callback(new Error('请选择付款结算单'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
@@ -1215,7 +1215,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async syncReferenceData() {
|
async syncReferenceData() {
|
||||||
if (!this.settlementIds.length) {
|
if (!this.settlementIds.length) {
|
||||||
this.$message.warning('请先选择正式结算单');
|
this.$message.warning('请先选择付款结算单');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await Promise.all([this.loadReceiverInformation(), this.loadSettlementDetails(false)]);
|
await Promise.all([this.loadReceiverInformation(), this.loadSettlementDetails(false)]);
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ export default {
|
|||||||
item => String(item.formalSettlementNo || '').trim() === normalizedNo
|
item => String(item.formalSettlementNo || '').trim() === normalizedNo
|
||||||
);
|
);
|
||||||
if (!row?.id) {
|
if (!row?.id) {
|
||||||
this.$message.warning('未找到对应的正式结算单');
|
this.$message.warning('未找到对应的付款结算单');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
<el-form-item label="关联结算单" prop="settlementIds">
|
<el-form-item label="关联结算单" prop="settlementIds">
|
||||||
<el-input :model-value="settlementLabel" readonly placeholder="请选择应付正式结算单">
|
<el-input :model-value="settlementLabel" readonly placeholder="请选择应付正式结算单">
|
||||||
<template v-if="!readonly" #append>
|
<template v-if="!readonly" #append>
|
||||||
<el-tooltip content="选择正式结算单" placement="top">
|
<el-tooltip content="选择付款结算单" placement="top">
|
||||||
<el-button :icon="Search" @click="openSettlementDialog" />
|
<el-button :icon="Search" @click="openSettlementDialog" />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -140,7 +140,8 @@
|
|||||||
:step="0.01"
|
:step="0.01"
|
||||||
:controls="false"
|
:controls="false"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
value-on-clear="0"
|
:value-on-clear="null"
|
||||||
|
placeholder="请输入申请付款金额"
|
||||||
/></el-form-item
|
/></el-form-item
|
||||||
></el-col>
|
></el-col>
|
||||||
<el-col :span="6"
|
<el-col :span="6"
|
||||||
@@ -241,11 +242,22 @@
|
|||||||
<template #default="{ row }">{{ formatMoney(row.payableAmount) }}</template>
|
<template #default="{ row }">{{ formatMoney(row.payableAmount) }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="paymentRatio" label="付款比例(%)" min-width="110">
|
<el-table-column prop="paymentRatio" label="付款比例(%)" min-width="110">
|
||||||
<template #default="{ row }">{{ formatMoney(row.paymentRatio) }}</template>
|
<template #default="{ row }">
|
||||||
|
<span :class="{ 'payment-form-page__ratio-exceeded': row.ratioExceeded }">
|
||||||
|
{{ formatMoney(row.paymentRatio) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="appliedAmount" label="付款金额" min-width="130">
|
<el-table-column prop="appliedAmount" label="付款金额" min-width="130">
|
||||||
<template #default="{ row }">{{ formatMoney(row.appliedAmount) }}</template>
|
<template #default="{ row }">{{ formatMoney(row.appliedAmount) }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="ratioRemark" label="备注" min-width="220" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span :class="{ 'payment-form-page__ratio-exceeded': row.ratioExceeded }">
|
||||||
|
{{ row.ratioRemark || '-' }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</section-card>
|
</section-card>
|
||||||
<section-card v-if="showInvoiceSection" title="发票信息">
|
<section-card v-if="showInvoiceSection" title="发票信息">
|
||||||
@@ -409,7 +421,7 @@
|
|||||||
<el-button v-if="!readonly" type="primary" plain @click="syncPaymentRecords"
|
<el-button v-if="!readonly" type="primary" plain @click="syncPaymentRecords"
|
||||||
>同步</el-button
|
>同步</el-button
|
||||||
>
|
>
|
||||||
<el-button v-if="!readonly && canSave" type="primary" plain @click="saveDraft()"
|
<el-button v-if="!readonly && canSave" type="primary" plain @click="handleSave"
|
||||||
>保存</el-button
|
>保存</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
@@ -483,7 +495,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-tabs v-model="referenceTab" @tab-change="handleReferenceTabChange">
|
<el-tabs v-model="referenceTab" @tab-change="handleReferenceTabChange">
|
||||||
<el-tab-pane v-if="canSelectFormalSettlement" label="正式结算单" name="formal">
|
<el-tab-pane v-if="canSelectFormalSettlement" label="付款结算单" name="formal">
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="formalPage.loading"
|
v-loading="formalPage.loading"
|
||||||
:data="formalRows"
|
:data="formalRows"
|
||||||
@@ -491,12 +503,19 @@
|
|||||||
@selection-change="formalSelection = $event"
|
@selection-change="formalSelection = $event"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="50" />
|
<el-table-column type="selection" width="50" />
|
||||||
<el-table-column prop="formalSettlementNo" label="结算单号" />
|
<el-table-column prop="formalSettlementNo" label="结算单号" min-width="150" />
|
||||||
<el-table-column prop="projectName" label="所属项目" />
|
<el-table-column prop="projectName" label="所属项目" min-width="140" />
|
||||||
<el-table-column prop="contractName" label="合同名称" />
|
<el-table-column prop="contractName" label="合同名称" min-width="160" />
|
||||||
<el-table-column prop="settlementAmount" label="结算金额">
|
<el-table-column prop="settlementAmount" label="结算金额" min-width="130">
|
||||||
<template #default="{ row }">{{ formatMoney(row.settlementAmount) }}</template>
|
<template #default="{ row }">{{ formatMoney(row.settlementAmount) }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="payableAmount" label="可付款金额" min-width="130">
|
||||||
|
<template #default="{ row }">{{
|
||||||
|
row.payableAmount === undefined || row.payableAmount === null
|
||||||
|
? '-'
|
||||||
|
: formatMoney(row.payableAmount)
|
||||||
|
}}</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="100">
|
<el-table-column label="操作" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-link type="primary" @click.stop="selectFormal(row)">选择</el-link>
|
<el-link type="primary" @click.stop="selectFormal(row)">选择</el-link>
|
||||||
@@ -515,7 +534,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane v-if="canSelectPreSettlement" label="预结算单" name="pre">
|
<el-tab-pane v-if="canSelectPreSettlement" label="预付结算单" name="pre">
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="prePage.loading"
|
v-loading="prePage.loading"
|
||||||
:data="preRows"
|
:data="preRows"
|
||||||
@@ -523,12 +542,19 @@
|
|||||||
@selection-change="preSelection = $event"
|
@selection-change="preSelection = $event"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="50" />
|
<el-table-column type="selection" width="50" />
|
||||||
<el-table-column prop="preSettlementNo" label="结算单号" />
|
<el-table-column prop="preSettlementNo" label="结算单号" min-width="150" />
|
||||||
<el-table-column prop="projectName" label="所属项目" />
|
<el-table-column prop="projectName" label="所属项目" min-width="140" />
|
||||||
<el-table-column prop="contractName" label="合同名称" />
|
<el-table-column prop="contractName" label="合同名称" min-width="160" />
|
||||||
<el-table-column prop="settlementAmount" label="结算金额">
|
<el-table-column prop="settlementAmount" label="结算金额" min-width="130">
|
||||||
<template #default="{ row }">{{ formatMoney(row.settlementAmount) }}</template>
|
<template #default="{ row }">{{ formatMoney(row.settlementAmount) }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="payableAmount" label="可付款金额" min-width="130">
|
||||||
|
<template #default="{ row }">{{
|
||||||
|
row.payableAmount === undefined || row.payableAmount === null
|
||||||
|
? '-'
|
||||||
|
: formatMoney(row.payableAmount)
|
||||||
|
}}</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="100">
|
<el-table-column label="操作" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-link type="primary" @click.stop="selectPre(row)">选择</el-link>
|
<el-link type="primary" @click.stop="selectPre(row)">选择</el-link>
|
||||||
@@ -562,22 +588,27 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<el-dialog v-model="billDialogVisible" title="选择汇票" width="80%" append-to-body>
|
<el-dialog v-model="billDialogVisible" title="选择汇票" width="80%" append-to-body>
|
||||||
<div class="payment-form-page__reference-search">
|
<div class="payment-form-page__reference-search payment-form-page__bill-search">
|
||||||
<el-form :model="billQuery" label-position="right" label-width="160px" @submit.prevent>
|
<el-form
|
||||||
<div class="payment-form-page__reference-search-fields">
|
:model="billQuery"
|
||||||
<el-form-item label="汇票筛选">
|
inline
|
||||||
<el-input
|
label-position="right"
|
||||||
v-model="billQuery.keyword"
|
label-width="88px"
|
||||||
clearable
|
@submit.prevent
|
||||||
placeholder="请输入汇票号、出票单位或收票单位"
|
>
|
||||||
@keyup.enter="handleBillSearch"
|
<el-form-item label="汇票筛选">
|
||||||
/>
|
<el-input
|
||||||
</el-form-item>
|
v-model="billQuery.keyword"
|
||||||
</div>
|
clearable
|
||||||
<div class="payment-form-page__reference-search-actions">
|
style="width: 320px"
|
||||||
<el-button type="primary" @click="handleBillSearch">搜索</el-button>
|
placeholder="请输入汇票号、出票单位或收票单位"
|
||||||
<el-button @click="resetBillSearch">清空</el-button>
|
@keyup.enter="handleBillSearch"
|
||||||
</div>
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item class="payment-form-page__bill-search-actions">
|
||||||
|
<el-button type="primary" @click="handleBillSearch">查询</el-button>
|
||||||
|
<el-button @click="resetBillSearch">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<el-table v-loading="billPage.loading" :data="billRows" border>
|
<el-table v-loading="billPage.loading" :data="billRows" border>
|
||||||
@@ -652,7 +683,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ElImageViewer } from 'element-plus';
|
import { ElImageViewer, ElMessage } from 'element-plus';
|
||||||
import { OpenFileViewer } from '@open-file-viewer/vue';
|
import { OpenFileViewer } from '@open-file-viewer/vue';
|
||||||
import { fallbackPlugin, imagePlugin, officePlugin, textPlugin } from '@open-file-viewer/core';
|
import { fallbackPlugin, imagePlugin, officePlugin, textPlugin } from '@open-file-viewer/core';
|
||||||
import '@open-file-viewer/core/style.css';
|
import '@open-file-viewer/core/style.css';
|
||||||
@@ -814,8 +845,12 @@ export default {
|
|||||||
contractSignatureFileAvailable: false,
|
contractSignatureFileAvailable: false,
|
||||||
contractPaymentRatioLimit: null,
|
contractPaymentRatioLimit: null,
|
||||||
contractPaymentRatioExceeded: false,
|
contractPaymentRatioExceeded: false,
|
||||||
|
/** 合同付款比例设置(按第1笔、第2笔…顺序) */
|
||||||
|
contractPaymentRatioRows: [],
|
||||||
payeeCustomerLevel: '',
|
payeeCustomerLevel: '',
|
||||||
attachmentRuleLoading: false,
|
attachmentRuleLoading: false,
|
||||||
|
// 最近一次从结算单同步过来的附件 URL,切换结算单时用于整批替换
|
||||||
|
linkedSettlementAttachmentUrls: [],
|
||||||
attachmentImagePreviewVisible: false,
|
attachmentImagePreviewVisible: false,
|
||||||
attachmentImagePreviewUrls: [],
|
attachmentImagePreviewUrls: [],
|
||||||
attachmentImagePreviewIndex: 0,
|
attachmentImagePreviewIndex: 0,
|
||||||
@@ -860,7 +895,7 @@ export default {
|
|||||||
billLedgerId: [{ validator: this.validateBillLedger, trigger: 'change' }],
|
billLedgerId: [{ validator: this.validateBillLedger, trigger: 'change' }],
|
||||||
settlementAmount: [{ validator: this.validateSettlementAmount, trigger: 'change' }],
|
settlementAmount: [{ validator: this.validateSettlementAmount, trigger: 'change' }],
|
||||||
appliedAmount: [
|
appliedAmount: [
|
||||||
{ required: true, validator: this.validateAppliedAmount, trigger: 'change' },
|
{ required: true, validator: this.validateAppliedAmount, trigger: ['change', 'blur'] },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -905,8 +940,8 @@ export default {
|
|||||||
referenceDialogTitle() {
|
referenceDialogTitle() {
|
||||||
if (this.form.paymentType === 'project_advance') return '选择项目合同';
|
if (this.form.paymentType === 'project_advance') return '选择项目合同';
|
||||||
if (this.canSelectPreSettlement && this.canSelectFormalSettlement) return '选择结算单';
|
if (this.canSelectPreSettlement && this.canSelectFormalSettlement) return '选择结算单';
|
||||||
if (this.canSelectPreSettlement) return '选择预结算单';
|
if (this.canSelectPreSettlement) return '选择预付结算单';
|
||||||
if (this.canSelectFormalSettlement) return '选择正式结算单';
|
if (this.canSelectFormalSettlement) return '选择付款结算单';
|
||||||
return '选择结算单';
|
return '选择结算单';
|
||||||
},
|
},
|
||||||
billPayment() {
|
billPayment() {
|
||||||
@@ -960,10 +995,8 @@ export default {
|
|||||||
},
|
},
|
||||||
settlementRows() {
|
settlementRows() {
|
||||||
if (this.referenceRows.length) {
|
if (this.referenceRows.length) {
|
||||||
return this.referenceRows.map(item => ({
|
return this.referenceRows.map(item => {
|
||||||
...item,
|
const appliedAmount =
|
||||||
paymentRatio: this.form.paymentRatio,
|
|
||||||
appliedAmount:
|
|
||||||
item.fixedAppliedAmount === true
|
item.fixedAppliedAmount === true
|
||||||
? Number(item.appliedAmount || 0)
|
? Number(item.appliedAmount || 0)
|
||||||
: Number(
|
: Number(
|
||||||
@@ -971,8 +1004,14 @@ export default {
|
|||||||
(Number(item.settlementAmount || 0) * Number(this.form.paymentRatio || 0)) /
|
(Number(item.settlementAmount || 0) * Number(this.form.paymentRatio || 0)) /
|
||||||
100
|
100
|
||||||
).toFixed(2)
|
).toFixed(2)
|
||||||
),
|
);
|
||||||
}));
|
return {
|
||||||
|
...item,
|
||||||
|
paymentRatio: this.form.paymentRatio,
|
||||||
|
appliedAmount,
|
||||||
|
...this.buildSettlementRatioHint(item),
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (!this.referenceLabel) return [];
|
if (!this.referenceLabel) return [];
|
||||||
return [
|
return [
|
||||||
@@ -982,6 +1021,8 @@ export default {
|
|||||||
payableAmount: this.form.payableAmount,
|
payableAmount: this.form.payableAmount,
|
||||||
paymentRatio: this.form.paymentRatio,
|
paymentRatio: this.form.paymentRatio,
|
||||||
appliedAmount: this.form.appliedAmount,
|
appliedAmount: this.form.appliedAmount,
|
||||||
|
paymentSequence: 1,
|
||||||
|
...this.buildSettlementRatioHint({ paymentSequence: 1 }),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
@@ -1071,7 +1112,7 @@ export default {
|
|||||||
!this.form.preSettlementId &&
|
!this.form.preSettlementId &&
|
||||||
!this.form.preSettlementIds?.length
|
!this.form.preSettlementIds?.length
|
||||||
) {
|
) {
|
||||||
callback(new Error('请选择预结算单'));
|
callback(new Error('请选择预付结算单'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@@ -1102,14 +1143,18 @@ export default {
|
|||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
validateAppliedAmount(rule, value, callback) {
|
validateAppliedAmount(rule, value, callback) {
|
||||||
|
if (value === null || value === undefined || value === '') {
|
||||||
|
callback(new Error('请填写申请付款金额'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
const amount = Number(value);
|
const amount = Number(value);
|
||||||
const payableAmount = Number(this.form.payableAmount || 0);
|
const payableAmount = Number(this.form.payableAmount || 0);
|
||||||
if (value === null || value === undefined || value === '' || !Number.isFinite(amount)) {
|
if (!Number.isFinite(amount)) {
|
||||||
callback(new Error('请填写申请付款金额'));
|
callback(new Error('请填写申请付款金额'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (amount <= 0) {
|
if (amount <= 0) {
|
||||||
callback(new Error('申请付款金额必须大于0'));
|
callback(new Error('申请付款金额必须大于0,不能为0元'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@@ -1132,10 +1177,23 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const selected = this.billOptions.find(item => String(item.id) === String(value));
|
const selected = this.billOptions.find(item => String(item.id) === String(value));
|
||||||
if (
|
if (!selected) {
|
||||||
selected &&
|
callback();
|
||||||
Number(this.form.appliedAmount || 0) > Number(selected.availableBalance || 0)
|
return;
|
||||||
) {
|
}
|
||||||
|
if (selected.billType && selected.billType !== 'received') {
|
||||||
|
callback(new Error('汇票付款仅可选择收票类型的汇票'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (selected.maturityDate) {
|
||||||
|
const maturity = this.$dayjs(selected.maturityDate).startOf('day');
|
||||||
|
const today = this.$dayjs().startOf('day');
|
||||||
|
if (maturity.isValid() && maturity.isBefore(today)) {
|
||||||
|
callback(new Error('所选汇票已到期,不可选择'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Number(this.form.appliedAmount || 0) > Number(selected.availableBalance || 0)) {
|
||||||
callback(new Error('申请付款金额不能超过汇票可用余额'));
|
callback(new Error('申请付款金额不能超过汇票可用余额'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1263,6 +1321,7 @@ export default {
|
|||||||
await this.loadContractOptions(this.form.projectId);
|
await this.loadContractOptions(this.form.projectId);
|
||||||
}
|
}
|
||||||
await this.fillBillTypeFromContract(this.form.contractId);
|
await this.fillBillTypeFromContract(this.form.contractId);
|
||||||
|
await this.refreshSettlementPaymentSequences();
|
||||||
await this.loadAttachmentRuleData(await this.loadCurrentSettlementDetails());
|
await this.loadAttachmentRuleData(await this.loadCurrentSettlementDetails());
|
||||||
if (this.billPayment) await this.loadBillOptions('', data.billLedgerId);
|
if (this.billPayment) await this.loadBillOptions('', data.billLedgerId);
|
||||||
} else {
|
} else {
|
||||||
@@ -1290,6 +1349,7 @@ export default {
|
|||||||
this.form.billType = '';
|
this.form.billType = '';
|
||||||
this.contractPartyBName = '';
|
this.contractPartyBName = '';
|
||||||
this.receiptAccountOptions = [];
|
this.receiptAccountOptions = [];
|
||||||
|
this.resetContractPaymentRatioLimit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -1301,11 +1361,13 @@ export default {
|
|||||||
this.form.payerName = partyA;
|
this.form.payerName = partyA;
|
||||||
}
|
}
|
||||||
this.contractPartyBName = String(data?.partyB || data?.payeeName || '').trim();
|
this.contractPartyBName = String(data?.partyB || data?.payeeName || '').trim();
|
||||||
|
this.applyContractPaymentRatioLimit(data || {});
|
||||||
await this.loadReceiptAccountOptions(autoSelectDefault);
|
await this.loadReceiptAccountOptions(autoSelectDefault);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.form.billType = '';
|
this.form.billType = '';
|
||||||
this.contractPartyBName = '';
|
this.contractPartyBName = '';
|
||||||
this.receiptAccountOptions = [];
|
this.receiptAccountOptions = [];
|
||||||
|
this.resetContractPaymentRatioLimit();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async loadPaymentMethodOptions() {
|
async loadPaymentMethodOptions() {
|
||||||
@@ -1400,16 +1462,33 @@ export default {
|
|||||||
if (!rows.length) return;
|
if (!rows.length) return;
|
||||||
const contractIds = new Set(rows.map(item => String(item.contractId || '')));
|
const contractIds = new Set(rows.map(item => String(item.contractId || '')));
|
||||||
if (contractIds.size !== 1 || contractIds.has('')) {
|
if (contractIds.size !== 1 || contractIds.has('')) {
|
||||||
this.$message.warning('所选正式结算单合同信息不一致,请返回后重新选择');
|
this.$message.warning('所选付款结算单合同信息不一致,请返回后重新选择');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const first = rows[0];
|
const first = rows[0];
|
||||||
const referenceRows = rows.map(item => ({
|
const amountResponses = await Promise.all(
|
||||||
...this.createReferenceRow(item),
|
rows.map(item => {
|
||||||
settlementNo: item.formalSettlementNo || item.settlementNo || '',
|
const referenceId = item.settlementId || item.id;
|
||||||
appliedAmount: Number(item.appliedAmount || 0),
|
if (!this.isValidReferenceId(referenceId)) return Promise.resolve(null);
|
||||||
fixedAppliedAmount: true,
|
return api
|
||||||
}));
|
.getReferenceAmount('settlement_payment', referenceId, this.form.id)
|
||||||
|
.catch(() => null);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
const referenceRows = rows.map((item, index) => {
|
||||||
|
const amount = this.unwrapData(amountResponses[index]) || {};
|
||||||
|
return {
|
||||||
|
...this.createReferenceRow({
|
||||||
|
...item,
|
||||||
|
settlementAmount: amount.settlementAmount ?? item.settlementAmount,
|
||||||
|
payableAmount: amount.payableAmount ?? item.payableAmount,
|
||||||
|
paymentSequence: amount.paymentSequence,
|
||||||
|
}),
|
||||||
|
settlementNo: item.formalSettlementNo || item.settlementNo || '',
|
||||||
|
appliedAmount: Number(item.appliedAmount || 0),
|
||||||
|
fixedAppliedAmount: true,
|
||||||
|
};
|
||||||
|
});
|
||||||
const settlementAmount = referenceRows.reduce(
|
const settlementAmount = referenceRows.reduce(
|
||||||
(total, item) => total + Number(item.settlementAmount || 0),
|
(total, item) => total + Number(item.settlementAmount || 0),
|
||||||
0
|
0
|
||||||
@@ -1503,21 +1582,76 @@ export default {
|
|||||||
},
|
},
|
||||||
createReferenceRow(row) {
|
createReferenceRow(row) {
|
||||||
const settlementAmount = Number(row.settlementAmount || 0);
|
const settlementAmount = Number(row.settlementAmount || 0);
|
||||||
const appliedAmount = Number(row.advanceAppliedAmount || row.appliedPaymentAmount || 0);
|
|
||||||
const isPre = Boolean(row.preSettlementNo || row.preSettlementId || row.referenceType === 'pre');
|
const isPre = Boolean(row.preSettlementNo || row.preSettlementId || row.referenceType === 'pre');
|
||||||
|
const paymentSequence = Number(row.paymentSequence);
|
||||||
|
// 可付款金额必须来自 referenceAmount 接口(已扣减占用中的付款申请);缺失时置 0,避免误用未扣减结算金额
|
||||||
|
const payableAmount =
|
||||||
|
row.payableAmount === undefined || row.payableAmount === null
|
||||||
|
? 0
|
||||||
|
: Number(row.payableAmount || 0);
|
||||||
return {
|
return {
|
||||||
id: row.preSettlementId || row.settlementId || row.id,
|
id: row.preSettlementId || row.settlementId || row.id,
|
||||||
settlementNo: row.preSettlementNo || row.formalSettlementNo || row.settlementNo || '',
|
settlementNo: row.preSettlementNo || row.formalSettlementNo || row.settlementNo || '',
|
||||||
referenceType: isPre ? 'pre' : 'formal',
|
referenceType: isPre ? 'pre' : 'formal',
|
||||||
settlementAmount: Number(Number(settlementAmount || 0).toFixed(2)),
|
settlementAmount: Number(Number(settlementAmount || 0).toFixed(2)),
|
||||||
payableAmount: Number(
|
payableAmount: Number(Math.max(0, payableAmount).toFixed(2)),
|
||||||
(row.payableAmount === undefined || row.payableAmount === null
|
paymentSequence: Number.isFinite(paymentSequence) && paymentSequence > 0 ? paymentSequence : 1,
|
||||||
? Math.max(0, settlementAmount - appliedAmount)
|
|
||||||
: Number(row.payableAmount || 0)
|
|
||||||
).toFixed(2)
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 按合同付款比例配置,判断当前付款次序是否超上限。
|
||||||
|
* @param {Object} row 结算信息行(含 paymentSequence)
|
||||||
|
*/
|
||||||
|
buildSettlementRatioHint(row = {}) {
|
||||||
|
const sequence = Number(row.paymentSequence || 1);
|
||||||
|
const paymentRatio = Number(this.form.paymentRatio);
|
||||||
|
const ratioConfig = this.contractPaymentRatioRows[sequence - 1];
|
||||||
|
const ratioLimitValue = ratioConfig?.ratioLimit;
|
||||||
|
const ratioLimit = Number(ratioLimitValue);
|
||||||
|
const hasLimit =
|
||||||
|
ratioLimitValue !== null &&
|
||||||
|
ratioLimitValue !== undefined &&
|
||||||
|
String(ratioLimitValue).trim() !== '' &&
|
||||||
|
Number.isFinite(ratioLimit);
|
||||||
|
const hasPaymentRatio =
|
||||||
|
this.form.paymentRatio !== null &&
|
||||||
|
this.form.paymentRatio !== undefined &&
|
||||||
|
String(this.form.paymentRatio).trim() !== '' &&
|
||||||
|
Number.isFinite(paymentRatio);
|
||||||
|
const ratioExceeded = hasLimit && hasPaymentRatio && paymentRatio > ratioLimit;
|
||||||
|
return {
|
||||||
|
paymentSequence: Number.isFinite(sequence) && sequence > 0 ? sequence : 1,
|
||||||
|
contractRatioLimit: hasLimit ? ratioLimit : null,
|
||||||
|
ratioExceeded,
|
||||||
|
ratioRemark: ratioExceeded
|
||||||
|
? `合同约定第${sequence}笔付款比例上限为${Number(ratioLimit).toFixed(2)}%`
|
||||||
|
: '',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/** 为结算信息行回填付款次序(第几次付款) */
|
||||||
|
async refreshSettlementPaymentSequences() {
|
||||||
|
if (!this.isSettlementRelatedType || !this.referenceRows.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const paymentType =
|
||||||
|
this.form.paymentType === 'settlement_payment' ? 'settlement_payment' : 'progress_advance';
|
||||||
|
const amountResponses = await Promise.all(
|
||||||
|
this.referenceRows.map(item => {
|
||||||
|
if (!this.isValidReferenceId(item.id)) {
|
||||||
|
return Promise.resolve(null);
|
||||||
|
}
|
||||||
|
return api.getReferenceAmount(paymentType, item.id, this.form.id).catch(() => null);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
this.referenceRows = this.referenceRows.map((item, index) => {
|
||||||
|
const amount = this.unwrapData(amountResponses[index]) || {};
|
||||||
|
const paymentSequence = Number(amount.paymentSequence || item.paymentSequence || 1);
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
paymentSequence: Number.isFinite(paymentSequence) && paymentSequence > 0 ? paymentSequence : 1,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
createInvoiceRows(invoices = [], settlementNo = '') {
|
createInvoiceRows(invoices = [], settlementNo = '') {
|
||||||
return (invoices || []).map(invoice => ({
|
return (invoices || []).map(invoice => ({
|
||||||
settlementNo,
|
settlementNo,
|
||||||
@@ -1568,29 +1702,41 @@ export default {
|
|||||||
if (!rows.length) return;
|
if (!rows.length) return;
|
||||||
const contractIds = new Set(rows.map(item => String(item.contractId || '')));
|
const contractIds = new Set(rows.map(item => String(item.contractId || '')));
|
||||||
if (contractIds.size > 1 || contractIds.has('')) {
|
if (contractIds.size > 1 || contractIds.has('')) {
|
||||||
this.$message.warning('所选预结算单合同信息不一致,请返回后重新选择');
|
this.$message.warning('所选预付结算单合同信息不一致,请返回后重新选择');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const first = rows[0];
|
const first = rows[0];
|
||||||
this.form.invoices = [];
|
this.form.invoices = [];
|
||||||
const paymentType =
|
const paymentType =
|
||||||
this.form.paymentType === 'settlement_payment' ? 'settlement_payment' : 'progress_advance';
|
this.form.paymentType === 'settlement_payment' ? 'settlement_payment' : 'progress_advance';
|
||||||
const amountResponses = await Promise.all(
|
try {
|
||||||
rows.map(item => {
|
const amountResponses = await Promise.all(
|
||||||
const referenceId = item.preSettlementId || item.id;
|
rows.map(item => {
|
||||||
if (!this.isValidReferenceId(referenceId)) return Promise.resolve(null);
|
const referenceId = item.preSettlementId || item.id;
|
||||||
return api.getReferenceAmount(paymentType, referenceId, this.form.id).catch(() => null);
|
if (!this.isValidReferenceId(referenceId)) {
|
||||||
})
|
return Promise.reject(new Error('结算单无效'));
|
||||||
);
|
}
|
||||||
this.referenceRows = rows.map((item, index) => {
|
return api.getReferenceAmount(paymentType, referenceId, this.form.id);
|
||||||
const amount = this.unwrapData(amountResponses[index]) || {};
|
})
|
||||||
return this.createReferenceRow({
|
);
|
||||||
...item,
|
this.referenceRows = rows.map((item, index) => {
|
||||||
referenceType: 'pre',
|
const amount = this.unwrapData(amountResponses[index]) || {};
|
||||||
settlementAmount: amount.settlementAmount ?? item.settlementAmount,
|
const settlementAmount = Number(amount.settlementAmount ?? item.settlementAmount ?? 0);
|
||||||
payableAmount: amount.payableAmount,
|
if (amount.payableAmount === undefined || amount.payableAmount === null) {
|
||||||
|
throw new Error('可付款金额获取失败,请重试');
|
||||||
|
}
|
||||||
|
return this.createReferenceRow({
|
||||||
|
...item,
|
||||||
|
referenceType: 'pre',
|
||||||
|
settlementAmount,
|
||||||
|
payableAmount: Number(amount.payableAmount || 0),
|
||||||
|
paymentSequence: amount.paymentSequence,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
} catch (error) {
|
||||||
|
this.$message.error(error?.message || '可付款金额获取失败,请重试');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const settlementAmount = this.referenceRows.reduce(
|
const settlementAmount = this.referenceRows.reduce(
|
||||||
(total, item) => total + Number(item.settlementAmount || 0),
|
(total, item) => total + Number(item.settlementAmount || 0),
|
||||||
0
|
0
|
||||||
@@ -1600,7 +1746,7 @@ export default {
|
|||||||
0
|
0
|
||||||
);
|
);
|
||||||
const paymentRatio = Number(this.form.paymentRatio || 0);
|
const paymentRatio = Number(this.form.paymentRatio || 0);
|
||||||
// 尾款付款场景下选择预结算单时保留尾款付款类型,不强制改为进度预付
|
// 尾款付款场景下选择预付结算单时保留尾款付款类型,不强制改为进度预付
|
||||||
this.amountSyncing = true;
|
this.amountSyncing = true;
|
||||||
Object.assign(this.form, {
|
Object.assign(this.form, {
|
||||||
paymentType,
|
paymentType,
|
||||||
@@ -1625,7 +1771,8 @@ export default {
|
|||||||
settlementAmount: Number(settlementAmount.toFixed(2)),
|
settlementAmount: Number(settlementAmount.toFixed(2)),
|
||||||
payableAmount: Number(payableAmount.toFixed(2)),
|
payableAmount: Number(payableAmount.toFixed(2)),
|
||||||
billType: '',
|
billType: '',
|
||||||
appliedAmount: Number(((settlementAmount * paymentRatio) / 100).toFixed(2)),
|
// 申请金额按可付款金额×比例,避免未扣减已申请额度
|
||||||
|
appliedAmount: Number(((payableAmount * paymentRatio) / 100).toFixed(2)),
|
||||||
});
|
});
|
||||||
this.paymentRecords = [];
|
this.paymentRecords = [];
|
||||||
this.clearReceiptAccount();
|
this.clearReceiptAccount();
|
||||||
@@ -1827,7 +1974,7 @@ export default {
|
|||||||
);
|
);
|
||||||
return typeMatched || this.matchAttachmentMaterialByFileName(file, materials);
|
return typeMatched || this.matchAttachmentMaterialByFileName(file, materials);
|
||||||
},
|
},
|
||||||
mergeAutomaticAttachments(files, materials, sourceName, defaultMaterial = null) {
|
mergeAutomaticAttachments(files, materials, sourceName, defaultMaterial = null, sourceKey = '') {
|
||||||
const existingUrls = new Set(
|
const existingUrls = new Set(
|
||||||
(this.form.attachments || []).map(file => this.attachmentFileUrl(file)).filter(Boolean)
|
(this.form.attachments || []).map(file => this.attachmentFileUrl(file)).filter(Boolean)
|
||||||
);
|
);
|
||||||
@@ -1848,26 +1995,95 @@ export default {
|
|||||||
attachmentType: MATERIAL_TYPE_MAP[material.key],
|
attachmentType: MATERIAL_TYPE_MAP[material.key],
|
||||||
description: file.description || `自动取自${sourceName}`,
|
description: file.description || `自动取自${sourceName}`,
|
||||||
sourceImported: true,
|
sourceImported: true,
|
||||||
|
sourceKey: sourceKey || undefined,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
if (imported.length) this.form.attachments = [...this.form.attachments, ...imported];
|
if (imported.length) this.form.attachments = [...this.form.attachments, ...imported];
|
||||||
|
return imported;
|
||||||
|
},
|
||||||
|
/** 移除指定来源的自动关联附件(切换结算单/合同时整批替换) */
|
||||||
|
removeAutomaticAttachments(sourceKey, sourceName = '') {
|
||||||
|
const previousUrls = new Set(
|
||||||
|
sourceKey === 'settlement' ? this.linkedSettlementAttachmentUrls || [] : []
|
||||||
|
);
|
||||||
|
this.form.attachments = (this.form.attachments || []).filter(file => {
|
||||||
|
const url = this.attachmentFileUrl(file);
|
||||||
|
if (sourceKey && file.sourceKey === sourceKey) return false;
|
||||||
|
if (
|
||||||
|
sourceName &&
|
||||||
|
file.sourceImported &&
|
||||||
|
String(file.description || '').includes(`自动取自${sourceName}`)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (previousUrls.size && url && previousUrls.has(url)) return false;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
if (sourceKey === 'settlement') {
|
||||||
|
this.linkedSettlementAttachmentUrls = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 按当前结算单附件整批同步:先清旧关联,再写入新结算单上传的附件 */
|
||||||
|
syncSettlementAttachments(settlementRows = []) {
|
||||||
|
const settlementMaterials = [
|
||||||
|
ATTACHMENT_MATERIALS.weighingSlip,
|
||||||
|
ATTACHMENT_MATERIALS.entrustOrder,
|
||||||
|
ATTACHMENT_MATERIALS.settlement,
|
||||||
|
];
|
||||||
|
const settlementFiles = (settlementRows || []).flatMap(row => this.parse(row.attachmentsJson));
|
||||||
|
const nextUrlSet = new Set(
|
||||||
|
settlementFiles.map(file => this.attachmentFileUrl(file)).filter(Boolean)
|
||||||
|
);
|
||||||
|
// 编辑回显时草稿里已有结算单附件但无 sourceKey:用 URL 交集补齐待替换清单
|
||||||
|
if (!(this.linkedSettlementAttachmentUrls || []).length && nextUrlSet.size) {
|
||||||
|
this.linkedSettlementAttachmentUrls = (this.form.attachments || [])
|
||||||
|
.map(file => this.attachmentFileUrl(file))
|
||||||
|
.filter(url => url && nextUrlSet.has(url));
|
||||||
|
}
|
||||||
|
this.removeAutomaticAttachments('settlement', '结算单');
|
||||||
|
const imported = this.mergeAutomaticAttachments(
|
||||||
|
settlementFiles,
|
||||||
|
settlementMaterials,
|
||||||
|
'结算单',
|
||||||
|
null,
|
||||||
|
'settlement'
|
||||||
|
);
|
||||||
|
this.linkedSettlementAttachmentUrls = imported
|
||||||
|
.map(file => this.attachmentFileUrl(file))
|
||||||
|
.filter(Boolean);
|
||||||
},
|
},
|
||||||
async loadCurrentSettlementDetails() {
|
async loadCurrentSettlementDetails() {
|
||||||
|
const preIds = [
|
||||||
|
...(this.form.preSettlementIds || []),
|
||||||
|
this.form.preSettlementId,
|
||||||
|
...(this.referenceRows || [])
|
||||||
|
.filter(item => item.referenceType === 'pre')
|
||||||
|
.map(item => item.id),
|
||||||
|
]
|
||||||
|
.map(id => String(id ?? '').trim())
|
||||||
|
.filter(id => this.isValidReferenceId(id));
|
||||||
|
const formalIds = [
|
||||||
|
...(this.form.settlementIds || []),
|
||||||
|
this.form.settlementId,
|
||||||
|
...(this.referenceRows || [])
|
||||||
|
.filter(item => item.referenceType !== 'pre')
|
||||||
|
.map(item => item.id),
|
||||||
|
]
|
||||||
|
.map(id => String(id ?? '').trim())
|
||||||
|
.filter(id => this.isValidReferenceId(id));
|
||||||
|
const uniquePreIds = [...new Set(preIds)];
|
||||||
|
const uniqueFormalIds = [...new Set(formalIds)];
|
||||||
if (
|
if (
|
||||||
this.form.paymentType === 'progress_advance' &&
|
(this.form.paymentType === 'progress_advance' ||
|
||||||
this.isValidReferenceId(this.form.preSettlementId)
|
this.form.paymentType === 'settlement_payment') &&
|
||||||
|
uniquePreIds.length
|
||||||
) {
|
) {
|
||||||
const response = await preApi.getDetail(this.form.preSettlementId);
|
const responses = await Promise.all(uniquePreIds.map(id => preApi.getDetail(id)));
|
||||||
const detail = this.unwrapData(response);
|
return responses.map(response => this.unwrapData(response)).filter(item => item?.id);
|
||||||
return detail?.id ? [detail] : [];
|
|
||||||
}
|
}
|
||||||
if (
|
if (this.form.paymentType === 'settlement_payment' && uniqueFormalIds.length) {
|
||||||
this.form.paymentType === 'settlement_payment' &&
|
const responses = await Promise.all(uniqueFormalIds.map(id => formalApi.getDetail(id)));
|
||||||
this.isValidReferenceId(this.form.settlementId)
|
return responses.map(response => this.unwrapData(response)).filter(item => item?.id);
|
||||||
) {
|
|
||||||
const response = await formalApi.getDetail(this.form.settlementId);
|
|
||||||
const detail = this.unwrapData(response);
|
|
||||||
return detail?.id ? [detail] : [];
|
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
@@ -1877,32 +2093,29 @@ export default {
|
|||||||
this.contractSignatureFileAvailable = false;
|
this.contractSignatureFileAvailable = false;
|
||||||
this.resetContractPaymentRatioLimit();
|
this.resetContractPaymentRatioLimit();
|
||||||
try {
|
try {
|
||||||
const settlementMaterials = [
|
// 切换结算单时,附件区同步替换为当前结算单已上传附件
|
||||||
ATTACHMENT_MATERIALS.weighingSlip,
|
this.syncSettlementAttachments(settlementRows);
|
||||||
ATTACHMENT_MATERIALS.entrustOrder,
|
|
||||||
ATTACHMENT_MATERIALS.settlement,
|
|
||||||
];
|
|
||||||
const settlementFiles = (settlementRows || []).flatMap(row =>
|
|
||||||
this.parse(row.attachmentsJson)
|
|
||||||
);
|
|
||||||
this.mergeAutomaticAttachments(settlementFiles, settlementMaterials, '结算单');
|
|
||||||
if (!this.form.contractId) {
|
if (!this.form.contractId) {
|
||||||
this.firstContractPayment = false;
|
this.firstContractPayment = false;
|
||||||
|
this.removeAutomaticAttachments('contract', '合同');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const contractResponse = await getContractDetail(this.form.contractId);
|
const contractResponse = await getContractDetail(this.form.contractId);
|
||||||
const contract = this.unwrapData(contractResponse) || {};
|
const contract = this.unwrapData(contractResponse) || {};
|
||||||
|
// 结算信息需用合同全部付款比例配置判断第几笔是否超限
|
||||||
|
this.applyContractPaymentRatioLimit(contract);
|
||||||
if (this.form.paymentType === 'project_advance') {
|
if (this.form.paymentType === 'project_advance') {
|
||||||
this.applyContractPaymentRatioLimit(contract);
|
|
||||||
const contractFiles = this.parse(contract.contractFileJson);
|
const contractFiles = this.parse(contract.contractFileJson);
|
||||||
this.contractSignatureFileAvailable = contractFiles.some(file =>
|
this.contractSignatureFileAvailable = contractFiles.some(file =>
|
||||||
Boolean(this.attachmentFileUrl(file))
|
Boolean(this.attachmentFileUrl(file))
|
||||||
);
|
);
|
||||||
|
this.removeAutomaticAttachments('contract', '合同');
|
||||||
this.mergeAutomaticAttachments(
|
this.mergeAutomaticAttachments(
|
||||||
contractFiles,
|
contractFiles,
|
||||||
[ATTACHMENT_MATERIALS.contract],
|
[ATTACHMENT_MATERIALS.contract],
|
||||||
'合同',
|
'合同',
|
||||||
ATTACHMENT_MATERIALS.contract
|
ATTACHMENT_MATERIALS.contract,
|
||||||
|
'contract'
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1916,12 +2129,14 @@ export default {
|
|||||||
String(item.id || '') !== String(this.form.id || '') &&
|
String(item.id || '') !== String(this.form.id || '') &&
|
||||||
item.approvalStatus !== 'voided'
|
item.approvalStatus !== 'voided'
|
||||||
);
|
);
|
||||||
|
this.removeAutomaticAttachments('contract', '合同');
|
||||||
if (this.firstContractPayment) {
|
if (this.firstContractPayment) {
|
||||||
this.mergeAutomaticAttachments(
|
this.mergeAutomaticAttachments(
|
||||||
this.parse(contract.contractFileJson),
|
this.parse(contract.contractFileJson),
|
||||||
[ATTACHMENT_MATERIALS.contract],
|
[ATTACHMENT_MATERIALS.contract],
|
||||||
'合同',
|
'合同',
|
||||||
ATTACHMENT_MATERIALS.contract
|
ATTACHMENT_MATERIALS.contract,
|
||||||
|
'contract'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -1933,9 +2148,12 @@ export default {
|
|||||||
resetContractPaymentRatioLimit() {
|
resetContractPaymentRatioLimit() {
|
||||||
this.contractPaymentRatioLimit = null;
|
this.contractPaymentRatioLimit = null;
|
||||||
this.contractPaymentRatioExceeded = false;
|
this.contractPaymentRatioExceeded = false;
|
||||||
|
this.contractPaymentRatioRows = [];
|
||||||
},
|
},
|
||||||
applyContractPaymentRatioLimit(contract = {}) {
|
applyContractPaymentRatioLimit(contract = {}) {
|
||||||
const [firstRatio] = this.parse(contract.paymentRatioJson);
|
const ratioRows = this.parse(contract.paymentRatioJson).filter(item => item && typeof item === 'object');
|
||||||
|
this.contractPaymentRatioRows = ratioRows;
|
||||||
|
const [firstRatio] = ratioRows;
|
||||||
const ratioLimitValue = firstRatio?.ratioLimit;
|
const ratioLimitValue = firstRatio?.ratioLimit;
|
||||||
const ratioLimit = Number(ratioLimitValue);
|
const ratioLimit = Number(ratioLimitValue);
|
||||||
this.contractPaymentRatioLimit =
|
this.contractPaymentRatioLimit =
|
||||||
@@ -2279,6 +2497,18 @@ export default {
|
|||||||
this.loadBillPage();
|
this.loadBillPage();
|
||||||
},
|
},
|
||||||
selectBill(row) {
|
selectBill(row) {
|
||||||
|
if (row?.billType && row.billType !== 'received') {
|
||||||
|
ElMessage.warning('汇票付款仅可选择收票类型的汇票');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (row?.maturityDate) {
|
||||||
|
const maturity = this.$dayjs(row.maturityDate).startOf('day');
|
||||||
|
const today = this.$dayjs().startOf('day');
|
||||||
|
if (maturity.isValid() && maturity.isBefore(today)) {
|
||||||
|
ElMessage.warning('所选汇票已到期,不可选择');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.form.billLedgerId = row.id;
|
this.form.billLedgerId = row.id;
|
||||||
this.form.billNo = row.billNo || '';
|
this.form.billNo = row.billNo || '';
|
||||||
this.billOptions = [row];
|
this.billOptions = [row];
|
||||||
@@ -2296,6 +2526,33 @@ export default {
|
|||||||
contractName: String(contractName || '').trim() || undefined,
|
contractName: String(contractName || '').trim() || undefined,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
async fillReferencePayableAmounts(rows, paymentType) {
|
||||||
|
if (!rows?.length) return rows || [];
|
||||||
|
const amountResponses = await Promise.all(
|
||||||
|
rows.map(row => {
|
||||||
|
const referenceId = row.id;
|
||||||
|
if (!this.isValidReferenceId(referenceId)) {
|
||||||
|
return Promise.resolve(null);
|
||||||
|
}
|
||||||
|
return api
|
||||||
|
.getReferenceAmount(paymentType, referenceId, this.form.id)
|
||||||
|
.catch(() => null);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return rows.map((row, index) => {
|
||||||
|
const amount = this.unwrapData(amountResponses[index]) || {};
|
||||||
|
const settlementAmount = Number(amount.settlementAmount ?? row.settlementAmount ?? 0);
|
||||||
|
const payableAmount =
|
||||||
|
amount.payableAmount === undefined || amount.payableAmount === null
|
||||||
|
? null
|
||||||
|
: Number(amount.payableAmount || 0);
|
||||||
|
return {
|
||||||
|
...row,
|
||||||
|
settlementAmount,
|
||||||
|
payableAmount,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
async loadFormalReferences() {
|
async loadFormalReferences() {
|
||||||
this.formalPage.loading = true;
|
this.formalPage.loading = true;
|
||||||
try {
|
try {
|
||||||
@@ -2305,7 +2562,8 @@ export default {
|
|||||||
this.referenceParams('formal')
|
this.referenceParams('formal')
|
||||||
);
|
);
|
||||||
const data = this.unwrapData(response) || {};
|
const data = this.unwrapData(response) || {};
|
||||||
this.formalRows = data.records || [];
|
const records = data.records || [];
|
||||||
|
this.formalRows = await this.fillReferencePayableAmounts(records, 'settlement_payment');
|
||||||
this.formalPage.total = Number(data.total || 0);
|
this.formalPage.total = Number(data.total || 0);
|
||||||
} finally {
|
} finally {
|
||||||
this.formalPage.loading = false;
|
this.formalPage.loading = false;
|
||||||
@@ -2320,7 +2578,10 @@ export default {
|
|||||||
this.referenceParams('pre')
|
this.referenceParams('pre')
|
||||||
);
|
);
|
||||||
const data = this.unwrapData(response) || {};
|
const data = this.unwrapData(response) || {};
|
||||||
this.preRows = data.records || [];
|
const records = data.records || [];
|
||||||
|
const paymentType =
|
||||||
|
this.form.paymentType === 'settlement_payment' ? 'settlement_payment' : 'progress_advance';
|
||||||
|
this.preRows = await this.fillReferencePayableAmounts(records, paymentType);
|
||||||
this.prePage.total = Number(data.total || 0);
|
this.prePage.total = Number(data.total || 0);
|
||||||
} finally {
|
} finally {
|
||||||
this.prePage.loading = false;
|
this.prePage.loading = false;
|
||||||
@@ -2413,7 +2674,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!id) {
|
if (!id) {
|
||||||
this.$message.warning(isPre ? '未找到对应的预结算单' : '未找到对应的正式结算单');
|
this.$message.warning(isPre ? '未找到对应的预付结算单' : '未找到对应的付款结算单');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
@@ -2421,7 +2682,7 @@ export default {
|
|||||||
query: {
|
query: {
|
||||||
mode: 'view',
|
mode: 'view',
|
||||||
id,
|
id,
|
||||||
name: isPre ? '查看预结算' : '查看正式结算',
|
name: isPre ? '查看预付结算单' : '查看付款结算单',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -2463,7 +2724,14 @@ export default {
|
|||||||
const amount = this.unwrapData(amountResponse) || {};
|
const amount = this.unwrapData(amountResponse) || {};
|
||||||
const settlementAmount = Number(amount.settlementAmount ?? row.settlementAmount ?? 0);
|
const settlementAmount = Number(amount.settlementAmount ?? row.settlementAmount ?? 0);
|
||||||
const payableAmount = Number(amount.payableAmount ?? 0);
|
const payableAmount = Number(amount.payableAmount ?? 0);
|
||||||
this.referenceRows = [this.createReferenceRow({ ...row, settlementAmount, payableAmount })];
|
this.referenceRows = [
|
||||||
|
this.createReferenceRow({
|
||||||
|
...row,
|
||||||
|
settlementAmount,
|
||||||
|
payableAmount,
|
||||||
|
paymentSequence: amount.paymentSequence,
|
||||||
|
}),
|
||||||
|
];
|
||||||
this.clearReceiptAccount();
|
this.clearReceiptAccount();
|
||||||
Object.assign(this.form, {
|
Object.assign(this.form, {
|
||||||
paymentType: 'settlement_payment',
|
paymentType: 'settlement_payment',
|
||||||
@@ -2508,14 +2776,17 @@ export default {
|
|||||||
const rows = this.formalSelection || [];
|
const rows = this.formalSelection || [];
|
||||||
if (!rows.length) return;
|
if (!rows.length) return;
|
||||||
if (new Set(rows.map(item => String(item.contractId || ''))).size !== 1) {
|
if (new Set(rows.map(item => String(item.contractId || ''))).size !== 1) {
|
||||||
this.$message.warning('所选正式结算单必须属于同一合同');
|
this.$message.warning('所选付款结算单必须属于同一合同');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const validRows = rows.filter(row => this.isValidReferenceId(row.id));
|
const validRows = rows.filter(row => this.isValidReferenceId(row.id));
|
||||||
const details = await Promise.all(validRows.map(row => formalApi.getDetail(row.id)));
|
const details = await Promise.all(validRows.map(row => formalApi.getDetail(row.id)));
|
||||||
await this.applyTransferredFormalSettlements(
|
const detailRows = details.map((response, index) => ({
|
||||||
details.map((response, index) => ({ ...validRows[index], ...this.unwrapData(response) }))
|
...validRows[index],
|
||||||
);
|
...this.unwrapData(response),
|
||||||
|
}));
|
||||||
|
await this.applyTransferredFormalSettlements(detailRows);
|
||||||
|
await this.loadAttachmentRuleData(detailRows);
|
||||||
this.referenceVisible = false;
|
this.referenceVisible = false;
|
||||||
},
|
},
|
||||||
async selectPre(row) {
|
async selectPre(row) {
|
||||||
@@ -2533,7 +2804,13 @@ export default {
|
|||||||
const settlementAmount = Number(amount.settlementAmount ?? row.settlementAmount ?? 0);
|
const settlementAmount = Number(amount.settlementAmount ?? row.settlementAmount ?? 0);
|
||||||
const payableAmount = Number(amount.payableAmount ?? 0);
|
const payableAmount = Number(amount.payableAmount ?? 0);
|
||||||
this.referenceRows = [
|
this.referenceRows = [
|
||||||
this.createReferenceRow({ ...row, settlementAmount, payableAmount, referenceType: 'pre' }),
|
this.createReferenceRow({
|
||||||
|
...row,
|
||||||
|
settlementAmount,
|
||||||
|
payableAmount,
|
||||||
|
referenceType: 'pre',
|
||||||
|
paymentSequence: amount.paymentSequence,
|
||||||
|
}),
|
||||||
];
|
];
|
||||||
this.form.invoices = [];
|
this.form.invoices = [];
|
||||||
this.paymentRecords = [];
|
this.paymentRecords = [];
|
||||||
@@ -2572,14 +2849,17 @@ export default {
|
|||||||
const rows = this.preSelection || [];
|
const rows = this.preSelection || [];
|
||||||
if (!rows.length) return;
|
if (!rows.length) return;
|
||||||
if (new Set(rows.map(item => String(item.contractId || ''))).size !== 1) {
|
if (new Set(rows.map(item => String(item.contractId || ''))).size !== 1) {
|
||||||
this.$message.warning('所选预结算单必须属于同一合同');
|
this.$message.warning('所选预付结算单必须属于同一合同');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const validRows = rows.filter(row => this.isValidReferenceId(row.id));
|
const validRows = rows.filter(row => this.isValidReferenceId(row.id));
|
||||||
const details = await Promise.all(validRows.map(row => preApi.getDetail(row.id)));
|
const details = await Promise.all(validRows.map(row => preApi.getDetail(row.id)));
|
||||||
await this.applyTransferredPreSettlements(
|
const detailRows = details.map((response, index) => ({
|
||||||
details.map((response, index) => ({ ...validRows[index], ...this.unwrapData(response) }))
|
...validRows[index],
|
||||||
);
|
...this.unwrapData(response),
|
||||||
|
}));
|
||||||
|
await this.applyTransferredPreSettlements(detailRows);
|
||||||
|
await this.loadAttachmentRuleData(detailRows);
|
||||||
this.referenceVisible = false;
|
this.referenceVisible = false;
|
||||||
},
|
},
|
||||||
normalizeAttachments(files) {
|
normalizeAttachments(files) {
|
||||||
@@ -2722,30 +3002,60 @@ export default {
|
|||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/** 顶部「保存」:保存成功后关闭表单页并回到列表 */
|
||||||
|
async handleSave() {
|
||||||
|
await this.saveDraft({ showSuccess: true, closePage: true });
|
||||||
|
},
|
||||||
|
clearMessages() {
|
||||||
|
ElMessage.closeAll();
|
||||||
|
this.$message?.closeAll?.();
|
||||||
|
},
|
||||||
async saveDraft(options = {}) {
|
async saveDraft(options = {}) {
|
||||||
const showSuccess = options.showSuccess !== false;
|
// 仅显式 showSuccess:true 时提示;提交前静默保存默认不弹「保存成功」
|
||||||
|
const showSuccess = options.showSuccess === true;
|
||||||
|
const closePage = options.closePage === true;
|
||||||
await this.$refs.formRef.validate();
|
await this.$refs.formRef.validate();
|
||||||
|
const appliedAmount = Number(this.form.appliedAmount);
|
||||||
|
if (
|
||||||
|
this.form.appliedAmount === null ||
|
||||||
|
this.form.appliedAmount === undefined ||
|
||||||
|
this.form.appliedAmount === '' ||
|
||||||
|
!Number.isFinite(appliedAmount) ||
|
||||||
|
appliedAmount <= 0
|
||||||
|
) {
|
||||||
|
this.clearMessages();
|
||||||
|
ElMessage.warning('申请付款金额必填且必须大于0');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (this.form.paymentType === 'project_advance' && !this.form.projectId) {
|
if (this.form.paymentType === 'project_advance' && !this.form.projectId) {
|
||||||
this.$message.warning('请选择所属项目');
|
this.clearMessages();
|
||||||
|
ElMessage.warning('请选择所属项目');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.validateInvoices();
|
this.validateInvoices();
|
||||||
this.validatePaymentRecords();
|
this.validatePaymentRecords();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$message.warning(error.message);
|
this.clearMessages();
|
||||||
|
ElMessage.warning(error.message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const data = this.unwrapData(await api.save(this.payload()));
|
const data = this.unwrapData(await api.save(this.payload()));
|
||||||
this.form.id = data;
|
this.form.id = data;
|
||||||
if (showSuccess) {
|
if (showSuccess) {
|
||||||
this.$message.success('保存成功');
|
this.clearMessages();
|
||||||
|
ElMessage.success('保存成功');
|
||||||
|
}
|
||||||
|
if (closePage) {
|
||||||
|
sessionStorage.setItem(paymentApplicationListRefreshKey, '1');
|
||||||
|
this.goBack();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
async submitForm() {
|
async submitForm() {
|
||||||
// 提交前静默保存,避免同时弹出「保存成功」与材料缺失 toast
|
// 提交前静默保存;不校验/提示附件未上传;全程只保留一条「提交成功」
|
||||||
const saved = await this.saveDraft({ showSuccess: false });
|
this.clearMessages();
|
||||||
|
const saved = await this.saveDraft({ showSuccess: false, closePage: false });
|
||||||
if (!saved) return;
|
if (!saved) return;
|
||||||
const previousApprovalStatus = this.form.approvalStatus || '';
|
const previousApprovalStatus = this.form.approvalStatus || '';
|
||||||
await api.submit({ id: this.form.id });
|
await api.submit({ id: this.form.id });
|
||||||
@@ -2756,8 +3066,9 @@ export default {
|
|||||||
approvalStatus: previousApprovalStatus,
|
approvalStatus: previousApprovalStatus,
|
||||||
mkEnabled: await loadMkEnabled().catch(() => false),
|
mkEnabled: await loadMkEnabled().catch(() => false),
|
||||||
});
|
});
|
||||||
this.$message.success('提交成功');
|
this.clearMessages();
|
||||||
// 通知列表页(keep-alive)重新拉取数据
|
ElMessage.success('提交成功');
|
||||||
|
// 通知列表页(keep-alive)重新拉取列表
|
||||||
sessionStorage.setItem(paymentApplicationListRefreshKey, '1');
|
sessionStorage.setItem(paymentApplicationListRefreshKey, '1');
|
||||||
this.goBack();
|
this.goBack();
|
||||||
},
|
},
|
||||||
@@ -2820,6 +3131,19 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
.payment-form-page__bill-search :deep(.el-form--inline) {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0 8px;
|
||||||
|
}
|
||||||
|
.payment-form-page__bill-search :deep(.el-form-item) {
|
||||||
|
margin-right: 0;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.payment-form-page__bill-search-actions {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
.payment-form-page__reference-pagination {
|
.payment-form-page__reference-pagination {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
}
|
}
|
||||||
@@ -2854,6 +3178,9 @@ export default {
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
.payment-form-page__ratio-exceeded {
|
||||||
|
color: var(--el-color-danger);
|
||||||
|
}
|
||||||
.payment-form-page__attachment-checklist {
|
.payment-form-page__attachment-checklist {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|||||||
@@ -322,6 +322,7 @@ export default {
|
|||||||
approvalStatus: previousApprovalStatus,
|
approvalStatus: previousApprovalStatus,
|
||||||
mkEnabled: this.mkEnabled,
|
mkEnabled: this.mkEnabled,
|
||||||
});
|
});
|
||||||
|
this.$message.closeAll?.();
|
||||||
this.$message.success('提交成功');
|
this.$message.success('提交成功');
|
||||||
this.refreshChange();
|
this.refreshChange();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -733,7 +733,7 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog v-model="candidate.visible" title="选择预结算单" width="88%" append-to-body>
|
<el-dialog v-model="candidate.visible" title="选择预付结算单" width="88%" append-to-body>
|
||||||
<el-card>
|
<el-card>
|
||||||
<el-form
|
<el-form
|
||||||
:model="candidate.query"
|
:model="candidate.query"
|
||||||
@@ -742,7 +742,7 @@
|
|||||||
label-width="88px"
|
label-width="88px"
|
||||||
class="formal-editor__candidate-search"
|
class="formal-editor__candidate-search"
|
||||||
>
|
>
|
||||||
<el-form-item label="预结算单号"
|
<el-form-item label="预付结算单号"
|
||||||
><el-input v-model="candidate.query.preSettlementNo" clearable
|
><el-input v-model="candidate.query.preSettlementNo" clearable
|
||||||
/></el-form-item>
|
/></el-form-item>
|
||||||
<el-form-item label="合同编号"
|
<el-form-item label="合同编号"
|
||||||
@@ -867,20 +867,6 @@
|
|||||||
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
|
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
|
||||||
<el-table-column prop="cargoName" label="货物名称" min-width="140" align="center" />
|
<el-table-column prop="cargoName" label="货物名称" min-width="140" align="center" />
|
||||||
<el-table-column prop="cargoType" label="货物类型" min-width="130" align="center" />
|
<el-table-column prop="cargoType" label="货物类型" min-width="130" align="center" />
|
||||||
<el-table-column label="计费规则" min-width="190" align="center">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<div class="formal-editor__billing-rule-cell">
|
|
||||||
<span>{{ displayValue(billingRuleName(row)) }}</span>
|
|
||||||
<el-icon
|
|
||||||
class="formal-editor__billing-rule-icon"
|
|
||||||
title="查看计费规则详情"
|
|
||||||
@click="openBillingRuleInfo(row)"
|
|
||||||
>
|
|
||||||
<InfoFilled />
|
|
||||||
</el-icon>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="运输总量" min-width="150" align="center">
|
<el-table-column label="运输总量" min-width="150" align="center">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
@@ -918,11 +904,29 @@
|
|||||||
v-for="feeItem in adjustFeeItemNames"
|
v-for="feeItem in adjustFeeItemNames"
|
||||||
:key="feeItem"
|
:key="feeItem"
|
||||||
:label="feeItem"
|
:label="feeItem"
|
||||||
min-width="140"
|
min-width="160"
|
||||||
align="center"
|
align="center"
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
|
<div v-if="isFreightFeeItem(feeItem)" class="formal-editor__billing-rule-cell">
|
||||||
|
<el-input-number
|
||||||
|
v-model="row.feeItems[feeItem]"
|
||||||
|
:min="0"
|
||||||
|
:precision="2"
|
||||||
|
:controls="false"
|
||||||
|
@change="recalculateAdjustRow(row, feeItem)"
|
||||||
|
/>
|
||||||
|
<el-icon
|
||||||
|
v-if="hasBillingRule(row)"
|
||||||
|
class="formal-editor__billing-rule-icon"
|
||||||
|
title="查看计费规则详情"
|
||||||
|
@click="openBillingRuleInfo(row)"
|
||||||
|
>
|
||||||
|
<InfoFilled />
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
|
v-else
|
||||||
v-model="row.feeItems[feeItem]"
|
v-model="row.feeItems[feeItem]"
|
||||||
:min="0"
|
:min="0"
|
||||||
:precision="2"
|
:precision="2"
|
||||||
@@ -936,11 +940,6 @@
|
|||||||
<el-input-number v-model="row.settlementAmountTax" :precision="2" :controls="false" />
|
<el-input-number v-model="row.settlementAmountTax" :precision="2" :controls="false" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" min-width="200" align="center">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-input v-model="row.remark" maxlength="200" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-form
|
<el-form
|
||||||
:model="adjust"
|
:model="adjust"
|
||||||
@@ -948,8 +947,15 @@
|
|||||||
label-width="auto"
|
label-width="auto"
|
||||||
class="formal-editor__adjust-reason"
|
class="formal-editor__adjust-reason"
|
||||||
>
|
>
|
||||||
<el-form-item label="调整原因" required>
|
<el-form-item label="备注">
|
||||||
<el-input v-model="adjust.reason" maxlength="200" show-word-limit />
|
<el-input
|
||||||
|
v-model="adjust.reason"
|
||||||
|
type="textarea"
|
||||||
|
:rows="2"
|
||||||
|
maxlength="200"
|
||||||
|
show-word-limit
|
||||||
|
placeholder="请输入"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@@ -970,51 +976,45 @@
|
|||||||
<template v-if="billingRuleDialog.rule">
|
<template v-if="billingRuleDialog.rule">
|
||||||
<div class="dialog-section-title">计费规则</div>
|
<div class="dialog-section-title">计费规则</div>
|
||||||
<el-descriptions :column="2" border class="formal-editor__billing-rule-detail">
|
<el-descriptions :column="2" border class="formal-editor__billing-rule-detail">
|
||||||
<el-descriptions-item label="规则名称">{{
|
<el-descriptions-item label="费用项">
|
||||||
displayValue(billingRuleDialog.rule.name)
|
{{ displayValue(billingRuleDialog.rule.feeItem) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="费用类型">{{
|
<el-descriptions-item label="计费要素">
|
||||||
displayValue(billingRuleDialog.rule.feeType)
|
{{ displayValue(billingRuleDialog.rule.billingElement) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="费用项">{{
|
<el-descriptions-item label="计费类型">
|
||||||
displayValue(billingRuleDialog.rule.feeItem)
|
{{ displayValue(billingRuleDialog.rule.billingType) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="计费要素">{{
|
<el-descriptions-item label="计费单位">
|
||||||
displayValue(billingRuleDialog.rule.billingElement)
|
{{ displayValue(billingRuleDialog.rule.billingUnit) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="计费类型">{{
|
<el-descriptions-item label="单价">
|
||||||
displayValue(billingRuleDialog.rule.billingType)
|
{{ displayValue(billingRuleDialog.rule.unitPrice) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="计费单位">{{
|
<el-descriptions-item label="最低计费量">
|
||||||
displayValue(billingRuleDialog.rule.billingUnit)
|
{{ displayValue(billingRuleDialog.rule.minimumBillingWeight) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="单价">{{
|
<el-descriptions-item label="计费区间">
|
||||||
displayValue(billingRuleDialog.rule.unitPrice)
|
{{ billingRuleRanges(billingRuleDialog.rule) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="最低计费量">{{
|
<el-descriptions-item label="备注" :span="2">
|
||||||
displayValue(billingRuleDialog.rule.minimumBillingWeight)
|
{{ displayValue(billingRuleDialog.rule.remark) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="计费区间">{{
|
|
||||||
billingRuleRanges(billingRuleDialog.rule)
|
|
||||||
}}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="备注" :span="2">{{
|
|
||||||
displayValue(billingRuleDialog.rule.remark)
|
|
||||||
}}</el-descriptions-item>
|
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
<div class="dialog-section-title formal-editor__billing-rule-match-title">匹配条件</div>
|
<div class="dialog-section-title formal-editor__billing-rule-match-title">匹配条件</div>
|
||||||
<el-descriptions :column="2" border class="formal-editor__billing-rule-detail">
|
<el-descriptions :column="2" border class="formal-editor__billing-rule-detail">
|
||||||
<el-descriptions-item label="起运地">{{
|
<el-descriptions-item label="起运地">
|
||||||
displayValue(billingRuleDialog.rule.matchCondition.origin)
|
{{ displayValue(billingRuleDialog.rule.matchCondition.origin) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="目的地">{{
|
<el-descriptions-item label="目的地">
|
||||||
displayValue(billingRuleDialog.rule.matchCondition.destination)
|
{{ displayValue(billingRuleDialog.rule.matchCondition.destination) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="运输方式">{{
|
<el-descriptions-item label="货物名称">
|
||||||
displayValue(billingRuleDialog.rule.matchCondition.transportMode)
|
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoName) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="货物类型">{{
|
<el-descriptions-item label="货物类型">
|
||||||
displayValue(billingRuleDialog.rule.matchCondition.cargoType)
|
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoType) }}
|
||||||
}}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
</template>
|
</template>
|
||||||
<el-empty v-else description="暂无计费规则详情" />
|
<el-empty v-else description="暂无计费规则详情" />
|
||||||
@@ -1026,6 +1026,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { InfoFilled } from '@element-plus/icons-vue';
|
||||||
import { getMkPublicDetail } from '@/api/mk-process';
|
import { getMkPublicDetail } from '@/api/mk-process';
|
||||||
import {
|
import {
|
||||||
adjustDetail,
|
adjustDetail,
|
||||||
@@ -1065,7 +1066,6 @@ import {
|
|||||||
} from '@/option/settlement/formalSettlementTable';
|
} from '@/option/settlement/formalSettlementTable';
|
||||||
import { getDictionary } from '@/api/system/dictbiz';
|
import { getDictionary } from '@/api/system/dictbiz';
|
||||||
import { h } from 'vue';
|
import { h } from 'vue';
|
||||||
import { InfoFilled } from '@element-plus/icons-vue';
|
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { formatContractOptionLabel } from '@/utils/contract';
|
import { formatContractOptionLabel } from '@/utils/contract';
|
||||||
import { normalizeCurrencyCode } from '@/utils/currency';
|
import { normalizeCurrencyCode } from '@/utils/currency';
|
||||||
@@ -1257,7 +1257,13 @@ export default {
|
|||||||
return isAdministrator(this.userInfo);
|
return isAdministrator(this.userInfo);
|
||||||
},
|
},
|
||||||
title() {
|
title() {
|
||||||
return this.readonly ? '查看正式结算单' : this.recordId ? '编辑正式结算单' : '新增正式结算单';
|
const billLabel =
|
||||||
|
this.form.settlementType === 'receivable' ? '收款结算单' : '付款结算单';
|
||||||
|
return this.readonly
|
||||||
|
? `查看${billLabel}`
|
||||||
|
: this.recordId
|
||||||
|
? `编辑${billLabel}`
|
||||||
|
: `新增${billLabel}`;
|
||||||
},
|
},
|
||||||
detailFeeItemNames() {
|
detailFeeItemNames() {
|
||||||
const names = new Set();
|
const names = new Set();
|
||||||
@@ -1379,7 +1385,17 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
formatContractOptionLabel,
|
formatContractOptionLabel,
|
||||||
hasPermission(code) {
|
hasPermission(code) {
|
||||||
return this.isAdmin || this.validData(this.permission?.[code], false);
|
if (this.isAdmin) return true;
|
||||||
|
const action = String(code || '').replace(
|
||||||
|
/^(payment_settlement_|receipt_settlement_|formal_settlement_)/,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
const prefix =
|
||||||
|
this.form.settlementType === 'receivable' ? 'receipt_settlement' : 'payment_settlement';
|
||||||
|
return (
|
||||||
|
this.validData(this.permission?.[`${prefix}_${action}`], false) ||
|
||||||
|
this.validData(this.permission?.[`formal_settlement_${action}`], false)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
async handleAdjustmentRepush(row) {
|
async handleAdjustmentRepush(row) {
|
||||||
await this.$confirm(
|
await this.$confirm(
|
||||||
@@ -2264,8 +2280,19 @@ export default {
|
|||||||
)}.xlsx`
|
)}.xlsx`
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
billingRuleName(row) {
|
hasBillingRule(row) {
|
||||||
return this.normalizeBillingRule(row).name;
|
const rule = this.normalizeBillingRule(row);
|
||||||
|
return Boolean(
|
||||||
|
rule.feeItem ||
|
||||||
|
rule.billingElement ||
|
||||||
|
rule.billingType ||
|
||||||
|
rule.unitPrice ||
|
||||||
|
rule.rules?.length ||
|
||||||
|
rule.matchCondition?.origin ||
|
||||||
|
rule.matchCondition?.destination ||
|
||||||
|
rule.matchCondition?.cargoName ||
|
||||||
|
rule.matchCondition?.cargoType
|
||||||
|
);
|
||||||
},
|
},
|
||||||
openBillingRuleInfo(row) {
|
openBillingRuleInfo(row) {
|
||||||
this.billingRuleDialog.rule = this.normalizeBillingRule(row);
|
this.billingRuleDialog.rule = this.normalizeBillingRule(row);
|
||||||
@@ -2291,26 +2318,8 @@ export default {
|
|||||||
const matchCondition = this.parseObject(
|
const matchCondition = this.parseObject(
|
||||||
source.matchCondition ?? source.billingMatchCondition ?? rule.matchCondition
|
source.matchCondition ?? source.billingMatchCondition ?? rule.matchCondition
|
||||||
);
|
);
|
||||||
const ruleNames = matchedRules
|
|
||||||
.map(item => item.ruleName || item.name || item.billingRuleName || item.feeItem)
|
|
||||||
.filter(Boolean);
|
|
||||||
return {
|
return {
|
||||||
...rule,
|
...rule,
|
||||||
name:
|
|
||||||
source.billingRuleName ||
|
|
||||||
source.feeRuleName ||
|
|
||||||
source.ruleName ||
|
|
||||||
source.billingPlanRuleName ||
|
|
||||||
source.billingPlanName ||
|
|
||||||
rule.name ||
|
|
||||||
rule.ruleName ||
|
|
||||||
rule.billingRuleName ||
|
|
||||||
rule.planName ||
|
|
||||||
rule.billingPlanName ||
|
|
||||||
ruleNames.join('、') ||
|
|
||||||
rule.feeItem ||
|
|
||||||
'',
|
|
||||||
feeType: source.billingFeeType || source.feeType || rule.feeType,
|
|
||||||
feeItem: source.billingFeeItem || source.feeItem || rule.feeItem,
|
feeItem: source.billingFeeItem || source.feeItem || rule.feeItem,
|
||||||
billingElement:
|
billingElement:
|
||||||
source.billingElement ||
|
source.billingElement ||
|
||||||
@@ -2328,7 +2337,11 @@ export default {
|
|||||||
...matchCondition,
|
...matchCondition,
|
||||||
origin: matchCondition.origin || matchCondition.originName,
|
origin: matchCondition.origin || matchCondition.originName,
|
||||||
destination: matchCondition.destination || matchCondition.destinationName,
|
destination: matchCondition.destination || matchCondition.destinationName,
|
||||||
transportMode: matchCondition.transportMode || matchCondition.transportType,
|
cargoName:
|
||||||
|
matchCondition.cargoName ||
|
||||||
|
matchCondition.cargoNameLabel ||
|
||||||
|
source.cargoName ||
|
||||||
|
rule.cargoName,
|
||||||
cargoType: matchCondition.cargoType || matchCondition.cargoTypeName,
|
cargoType: matchCondition.cargoType || matchCondition.cargoTypeName,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -2406,7 +2419,11 @@ export default {
|
|||||||
detailId: row.formalSettlementId ? row.id : null,
|
detailId: row.formalSettlementId ? row.id : null,
|
||||||
sourceDetailId: row.sourceDetailId || null,
|
sourceDetailId: row.sourceDetailId || null,
|
||||||
feeKey,
|
feeKey,
|
||||||
reason: pending?.reason || '',
|
// 底部备注回显结算明细备注;暂存过的调整优先取暂存备注
|
||||||
|
reason:
|
||||||
|
pending?.reason !== undefined && pending?.reason !== null
|
||||||
|
? pending.reason
|
||||||
|
: row.remark || '',
|
||||||
rows: [],
|
rows: [],
|
||||||
targetRow: row.formalSettlementId ? null : row,
|
targetRow: row.formalSettlementId ? null : row,
|
||||||
};
|
};
|
||||||
@@ -2429,7 +2446,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async saveAdjustment() {
|
async saveAdjustment() {
|
||||||
if (!this.adjust.reason.trim()) return this.$message.warning('请输入调整原因');
|
|
||||||
if (this.adjust.rows.some(row => row.calculating)) {
|
if (this.adjust.rows.some(row => row.calculating)) {
|
||||||
return this.$message.warning('费用正在重新计算,请稍候');
|
return this.$message.warning('费用正在重新计算,请稍候');
|
||||||
}
|
}
|
||||||
@@ -2458,6 +2474,14 @@ export default {
|
|||||||
.reduce((total, item) => total + Number(item.settlementAmountTax || 0), 0)
|
.reduce((total, item) => total + Number(item.settlementAmountTax || 0), 0)
|
||||||
.toFixed(2)
|
.toFixed(2)
|
||||||
);
|
);
|
||||||
|
const settlementAmountNoTax = Number(
|
||||||
|
this.adjust.rows
|
||||||
|
.reduce((total, item) => total + Number(item.settlementAmountNoTax || 0), 0)
|
||||||
|
.toFixed(2)
|
||||||
|
);
|
||||||
|
const hasSettlementAmountNoTax = this.adjust.rows.some(
|
||||||
|
item => item.settlementAmountNoTax !== undefined && item.settlementAmountNoTax !== null
|
||||||
|
);
|
||||||
const feeItems = this.adjust.rows.reduce((result, item) => {
|
const feeItems = this.adjust.rows.reduce((result, item) => {
|
||||||
Object.entries(item.feeItems || {}).forEach(([name, amount]) => {
|
Object.entries(item.feeItems || {}).forEach(([name, amount]) => {
|
||||||
result[name] = Number((Number(result[name] || 0) + Number(amount || 0)).toFixed(2));
|
result[name] = Number((Number(result[name] || 0) + Number(amount || 0)).toFixed(2));
|
||||||
@@ -2471,24 +2495,37 @@ export default {
|
|||||||
originalAmount,
|
originalAmount,
|
||||||
adjustAmount: Number((settlementAmount - originalAmount).toFixed(2)),
|
adjustAmount: Number((settlementAmount - originalAmount).toFixed(2)),
|
||||||
settlementAmountTax: settlementAmount,
|
settlementAmountTax: settlementAmount,
|
||||||
|
settlementAmountNoTax: hasSettlementAmountNoTax
|
||||||
|
? settlementAmountNoTax
|
||||||
|
: target.settlementAmountNoTax,
|
||||||
feeItemsJson: JSON.stringify(feeItems),
|
feeItemsJson: JSON.stringify(feeItems),
|
||||||
freightAmount: this.adjust.rows.reduce(
|
freightAmount: Number(
|
||||||
(total, item) => total + Number(item.freightAmount || 0),
|
this.adjust.rows
|
||||||
0
|
.reduce((total, item) => total + Number(item.freightAmount || 0), 0)
|
||||||
|
.toFixed(2)
|
||||||
),
|
),
|
||||||
transportQuantity: this.adjust.rows.reduce(
|
transportQuantity: Number(
|
||||||
(total, item) => total + Number(item.transportQuantity || 0),
|
this.adjust.rows
|
||||||
0
|
.reduce((total, item) => total + Number(item.transportQuantity || 0), 0)
|
||||||
|
.toFixed(2)
|
||||||
|
),
|
||||||
|
mileage: Number(
|
||||||
|
this.adjust.rows
|
||||||
|
.reduce((total, item) => total + Number(item.mileage || 0), 0)
|
||||||
|
.toFixed(2)
|
||||||
),
|
),
|
||||||
mileage: this.adjust.rows.reduce((total, item) => total + Number(item.mileage || 0), 0),
|
|
||||||
unitPrice: edited.unitPrice,
|
unitPrice: edited.unitPrice,
|
||||||
remark: edited.remark,
|
// 底部备注写入结算明细备注
|
||||||
|
remark: this.adjust.reason || '',
|
||||||
pendingDetailAdjustment: true,
|
pendingDetailAdjustment: true,
|
||||||
});
|
});
|
||||||
if (this.adjust.feeKey) {
|
if (this.adjust.feeKey) {
|
||||||
|
const clonedRows = this.cloneAdjustRows(this.adjust.rows);
|
||||||
|
// 暂存后同步费用快照,避免再次打开调整弹窗或汇总时仍用调整前数据。
|
||||||
|
this.detailFeeSnapshots[this.adjust.feeKey] = clonedRows;
|
||||||
this.pendingAdjustments[this.adjust.feeKey] = {
|
this.pendingAdjustments[this.adjust.feeKey] = {
|
||||||
reason: this.adjust.reason,
|
reason: this.adjust.reason,
|
||||||
rows: this.cloneAdjustRows(this.adjust.rows),
|
rows: clonedRows,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
await this.refreshSummaryFees();
|
await this.refreshSummaryFees();
|
||||||
@@ -2510,7 +2547,6 @@ export default {
|
|||||||
feeItems: row.feeItems,
|
feeItems: row.feeItems,
|
||||||
settlementAmountTax: row.settlementAmountTax,
|
settlementAmountTax: row.settlementAmountTax,
|
||||||
settlementAmountNoTax: row.settlementAmountNoTax,
|
settlementAmountNoTax: row.settlementAmountNoTax,
|
||||||
remark: row.remark,
|
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
this.$message.success('调整保存成功');
|
this.$message.success('调整保存成功');
|
||||||
@@ -2534,6 +2570,17 @@ export default {
|
|||||||
}));
|
}));
|
||||||
await this.confirmInvoiceClaims();
|
await this.confirmInvoiceClaims();
|
||||||
},
|
},
|
||||||
|
// 发票认领默认金额以当前结算金额为准:优先表单结算金额,其次结算合计,再次明细含税合计。
|
||||||
|
resolveInvoiceClaimSettlementAmount() {
|
||||||
|
const formAmount = Number(this.form.settlementAmount || 0);
|
||||||
|
if (formAmount > 0) return formAmount;
|
||||||
|
const summaryAmount = Number(this.summaryTotal || 0);
|
||||||
|
if (summaryAmount > 0) return summaryAmount;
|
||||||
|
return this.details.reduce(
|
||||||
|
(total, row) => total + Number(row.settlementAmountTax || row.settlementAmount || 0),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
},
|
||||||
async confirmInvoiceClaims() {
|
async confirmInvoiceClaims() {
|
||||||
if (!this.invoiceClaimDialog.selected.length) {
|
if (!this.invoiceClaimDialog.selected.length) {
|
||||||
this.$message.warning('请至少选择一条发票');
|
this.$message.warning('请至少选择一条发票');
|
||||||
@@ -2542,26 +2589,33 @@ export default {
|
|||||||
this.invoiceClaimDialog.confirming = true;
|
this.invoiceClaimDialog.confirming = true;
|
||||||
try {
|
try {
|
||||||
const existingNumbers = new Set(this.invoices.map(item => String(item.invoiceNo)));
|
const existingNumbers = new Set(this.invoices.map(item => String(item.invoiceNo)));
|
||||||
|
const settlementAmount = this.resolveInvoiceClaimSettlementAmount();
|
||||||
|
if (settlementAmount > 0 && Number(this.form.settlementAmount || 0) <= 0) {
|
||||||
|
this.form.settlementAmount = Number(settlementAmount).toFixed(2);
|
||||||
|
}
|
||||||
let remaining = Math.max(
|
let remaining = Math.max(
|
||||||
Number(this.form.settlementAmount || 0) -
|
settlementAmount -
|
||||||
this.invoices.reduce((total, item) => total + Number(item.matchedAmount || 0), 0),
|
this.invoices.reduce((total, item) => total + Number(item.matchedAmount || 0), 0),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
const invoices = this.invoiceClaimDialog.selected
|
const invoices = this.invoiceClaimDialog.selected
|
||||||
.filter(row => !existingNumbers.has(String(row.invoiceNo)))
|
.filter(row => !existingNumbers.has(String(row.invoiceNo)))
|
||||||
.map(row => {
|
.map(row => {
|
||||||
const sourceAmount = Number(row.matchedAmount || 0);
|
// 票池 matchedAmount 默认等于整张发票金额;可匹配口径优先取 availableInvoiceAmount
|
||||||
|
const sourceAmount = Number(
|
||||||
|
row.availableInvoiceAmount || row.matchedAmount || row.invoiceAmount || 0
|
||||||
|
);
|
||||||
|
// 可匹配金额大于剩余结算金额时,默认匹配金额取剩余结算金额(单张发票常见场景)
|
||||||
const matchedAmount =
|
const matchedAmount =
|
||||||
Number(this.form.settlementAmount || 0) > 0
|
settlementAmount > 0 ? Math.min(sourceAmount, remaining) : sourceAmount;
|
||||||
? Math.min(sourceAmount, remaining)
|
if (settlementAmount > 0) {
|
||||||
: sourceAmount;
|
|
||||||
if (Number(this.form.settlementAmount || 0) > 0) {
|
|
||||||
remaining = Math.max(0, remaining - matchedAmount);
|
remaining = Math.max(0, remaining - matchedAmount);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...row,
|
...row,
|
||||||
invoiceType: row.invoiceTypeName || row.invoiceType || '',
|
invoiceType: row.invoiceTypeName || row.invoiceType || '',
|
||||||
matchedAmount,
|
availableInvoiceAmount: sourceAmount,
|
||||||
|
matchedAmount: Number(matchedAmount.toFixed(2)),
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter(row => row.matchedAmount > 0);
|
.filter(row => row.matchedAmount > 0);
|
||||||
@@ -2619,7 +2673,7 @@ export default {
|
|||||||
}
|
}
|
||||||
matchedTotal += matchedAmount;
|
matchedTotal += matchedAmount;
|
||||||
}
|
}
|
||||||
if (matchedTotal > Number(this.form.settlementAmount || 0)) {
|
if (matchedTotal > this.resolveInvoiceClaimSettlementAmount()) {
|
||||||
this.$message.warning('发票匹配结算单金额合计不能超过结算金额');
|
this.$message.warning('发票匹配结算单金额合计不能超过结算金额');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2727,7 +2781,7 @@ export default {
|
|||||||
summaryFees: this.summaryFees
|
summaryFees: this.summaryFees
|
||||||
.filter(
|
.filter(
|
||||||
row =>
|
row =>
|
||||||
row.manualFlag === 1 ||
|
Number(row.manualFlag) === 1 ||
|
||||||
row.id ||
|
row.id ||
|
||||||
Number(row.adjustAmount || 0) !== 0 ||
|
Number(row.adjustAmount || 0) !== 0 ||
|
||||||
String(row.remark || '').trim()
|
String(row.remark || '').trim()
|
||||||
@@ -2738,7 +2792,7 @@ export default {
|
|||||||
feeItem: row.feeItem,
|
feeItem: row.feeItem,
|
||||||
adjustAmount: Number(row.adjustAmount || 0),
|
adjustAmount: Number(row.adjustAmount || 0),
|
||||||
remark: row.remark,
|
remark: row.remark,
|
||||||
manualFlag: row.manualFlag || 0,
|
manualFlag: Number(row.manualFlag) === 1 ? 1 : 0,
|
||||||
})),
|
})),
|
||||||
attachmentsJson: this.stringifyAttachments(this.attachments),
|
attachmentsJson: this.stringifyAttachments(this.attachments),
|
||||||
invoices: this.invoices.map(row => ({
|
invoices: this.invoices.map(row => ({
|
||||||
@@ -3168,20 +3222,6 @@ export default {
|
|||||||
.formal-editor__billing-rule-match-title {
|
.formal-editor__billing-rule-match-title {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
.dialog-section-title {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 22px;
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
.dialog-section-title::before {
|
|
||||||
width: 4px;
|
|
||||||
height: 18px;
|
|
||||||
margin-right: 8px;
|
|
||||||
background: #409eff;
|
|
||||||
content: '';
|
|
||||||
}
|
|
||||||
.formal-editor__attachment-missing {
|
.formal-editor__attachment-missing {
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
color: var(--el-color-danger);
|
color: var(--el-color-danger);
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
<div class="fs-table-panel__toolbar">
|
<div class="fs-table-panel__toolbar">
|
||||||
<div>
|
<div>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="hasPermission('formal_settlement_add')"
|
v-if="hasPermission('add')"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="$emit('create')"
|
@click="$emit('create')"
|
||||||
>新增</el-button
|
>新增</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="hasPermission('formal_settlement_payment')"
|
v-if="showPaymentAction && hasPermission('payment')"
|
||||||
type="primary"
|
type="primary"
|
||||||
plain
|
plain
|
||||||
:disabled="!selection.length"
|
:disabled="!selection.length"
|
||||||
@@ -17,23 +17,23 @@
|
|||||||
>付款申请</el-button
|
>付款申请</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="hasPermission('formal_settlement_sync')"
|
v-if="hasPermission('sync')"
|
||||||
type="primary"
|
type="primary"
|
||||||
plain
|
plain
|
||||||
:disabled="selection.length !== 1"
|
:disabled="!selection.length"
|
||||||
:loading="syncLoading"
|
:loading="syncLoading"
|
||||||
@click="$emit('sync')"
|
@click="$emit('sync')"
|
||||||
>同步金蝶</el-button
|
>同步金蝶</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="hasPermission('formal_settlement_print')"
|
v-if="hasPermission('print')"
|
||||||
type="primary"
|
type="primary"
|
||||||
plain
|
plain
|
||||||
@click="emitSingle('print')"
|
@click="emitSingle('print')"
|
||||||
>打印结算单</el-button
|
>打印结算单</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="hasPermission('formal_settlement_export')"
|
v-if="hasPermission('export')"
|
||||||
type="primary"
|
type="primary"
|
||||||
plain
|
plain
|
||||||
@click="$emit('export')"
|
@click="$emit('export')"
|
||||||
@@ -150,6 +150,9 @@ export default {
|
|||||||
hasPermission: { type: Function, required: true },
|
hasPermission: { type: Function, required: true },
|
||||||
mkEnabled: { type: Boolean, default: false },
|
mkEnabled: { type: Boolean, default: false },
|
||||||
searchVisible: { type: Boolean, default: true },
|
searchVisible: { type: Boolean, default: true },
|
||||||
|
/** 是否展示付款申请按钮(仅付款结算单) */
|
||||||
|
showPaymentAction: { type: Boolean, default: true },
|
||||||
|
billLabel: { type: String, default: '结算单' },
|
||||||
},
|
},
|
||||||
emits: [
|
emits: [
|
||||||
'create',
|
'create',
|
||||||
@@ -224,7 +227,7 @@ export default {
|
|||||||
},
|
},
|
||||||
emitSingle(type) {
|
emitSingle(type) {
|
||||||
if (this.selection.length !== 1) {
|
if (this.selection.length !== 1) {
|
||||||
this.$message.warning(`${type === 'print' ? '打印' : '操作'}需选择一条正式结算单`);
|
this.$message.warning(`${type === 'print' ? '打印' : '操作'}需选择一条${this.billLabel}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$emit('action', { type, row: this.selection[0] });
|
this.$emit('action', { type, row: this.selection[0] });
|
||||||
@@ -234,27 +237,26 @@ export default {
|
|||||||
},
|
},
|
||||||
rowActions(row) {
|
rowActions(row) {
|
||||||
const actions = [];
|
const actions = [];
|
||||||
if (this.hasPermission('formal_settlement_view'))
|
if (this.hasPermission('view')) actions.push({ type: 'view', label: '查看' });
|
||||||
actions.push({ type: 'view', label: '查看' });
|
if (this.hasPermission('edit') && this.isEditable(row))
|
||||||
if (this.hasPermission('formal_settlement_edit') && this.isEditable(row))
|
|
||||||
actions.push({ type: 'edit', label: '编辑' });
|
actions.push({ type: 'edit', label: '编辑' });
|
||||||
if (this.hasPermission('formal_settlement_delete') && row.approvalStatus === 'draft')
|
if (this.hasPermission('delete') && row.approvalStatus === 'draft')
|
||||||
actions.push({ type: 'delete', label: '删除', danger: true });
|
actions.push({ type: 'delete', label: '删除', danger: true });
|
||||||
if (this.hasPermission('formal_settlement_submit') && this.isEditable(row))
|
if (this.hasPermission('submit') && this.isEditable(row))
|
||||||
actions.push({ type: 'submit', label: '提交' });
|
actions.push({ type: 'submit', label: '提交' });
|
||||||
if (
|
if (
|
||||||
this.mkEnabled &&
|
this.mkEnabled &&
|
||||||
this.hasPermission('formal_settlement_approve') &&
|
this.hasPermission('approve') &&
|
||||||
['reviewing', 'approved'].includes(row.approvalStatus)
|
['reviewing', 'approved'].includes(row.approvalStatus)
|
||||||
) {
|
) {
|
||||||
actions.push({ type: 'mkAudit', label: '流程' });
|
actions.push({ type: 'mkAudit', label: '流程' });
|
||||||
}
|
}
|
||||||
if (!this.mkEnabled && this.hasPermission('formal_settlement_approve') && row.approvalStatus === 'reviewing') {
|
if (!this.mkEnabled && this.hasPermission('approve') && row.approvalStatus === 'reviewing') {
|
||||||
actions.push({ type: 'approve', label: '通过' });
|
actions.push({ type: 'approve', label: '通过' });
|
||||||
actions.push({ type: 'return', label: '驳回', danger: true });
|
actions.push({ type: 'return', label: '驳回', danger: true });
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
this.hasPermission('formal_settlement_void') &&
|
this.hasPermission('void') &&
|
||||||
row.approvalStatus === 'approved' &&
|
row.approvalStatus === 'approved' &&
|
||||||
row.kingdeeSyncStatus !== 'synced'
|
row.kingdeeSyncStatus !== 'synced'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -459,7 +459,7 @@
|
|||||||
</section-card>
|
</section-card>
|
||||||
|
|
||||||
<section-card v-if="form.id && readonly" title="变更记录">
|
<section-card v-if="form.id && readonly" title="变更记录">
|
||||||
<el-table :data="adjustChangeRecords" border>
|
<el-table :data="changeRecords" border>
|
||||||
<el-table-column type="index" label="序号" width="64" align="center" />
|
<el-table-column type="index" label="序号" width="64" align="center" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-for="column in changeTableColumns"
|
v-for="column in changeTableColumns"
|
||||||
@@ -753,20 +753,6 @@
|
|||||||
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
|
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
|
||||||
<el-table-column prop="cargoName" label="货物名称" min-width="140" align="center" />
|
<el-table-column prop="cargoName" label="货物名称" min-width="140" align="center" />
|
||||||
<el-table-column prop="cargoType" label="货物类型" min-width="130" align="center" />
|
<el-table-column prop="cargoType" label="货物类型" min-width="130" align="center" />
|
||||||
<el-table-column label="计费规则" min-width="190" align="center">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<div class="pre-settlement-editor__billing-rule-cell">
|
|
||||||
<span>{{ displayValue(billingRuleName(row)) }}</span>
|
|
||||||
<el-icon
|
|
||||||
class="pre-settlement-editor__billing-rule-icon"
|
|
||||||
title="查看计费规则详情"
|
|
||||||
@click="openBillingRuleInfo(row)"
|
|
||||||
>
|
|
||||||
<InfoFilled />
|
|
||||||
</el-icon>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="运输总量" min-width="150" align="center">
|
<el-table-column label="运输总量" min-width="150" align="center">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span v-if="adjustDialog.readonly">{{ formatQuantity(row) }}</span>
|
<span v-if="adjustDialog.readonly">{{ formatQuantity(row) }}</span>
|
||||||
@@ -809,11 +795,33 @@
|
|||||||
v-for="feeItem in adjustFeeItemNames"
|
v-for="feeItem in adjustFeeItemNames"
|
||||||
:key="feeItem"
|
:key="feeItem"
|
||||||
:label="feeItem"
|
:label="feeItem"
|
||||||
min-width="140"
|
min-width="160"
|
||||||
align="center"
|
align="center"
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
|
<div
|
||||||
|
v-if="isFreightFeeItem(feeItem)"
|
||||||
|
class="pre-settlement-editor__billing-rule-cell"
|
||||||
|
>
|
||||||
|
<el-input-number
|
||||||
|
v-model="row.feeItems[feeItem]"
|
||||||
|
:min="0"
|
||||||
|
:precision="2"
|
||||||
|
:controls="false"
|
||||||
|
:disabled="adjustDialog.readonly"
|
||||||
|
@change="recalculateAdjustRow(row, feeItem)"
|
||||||
|
/>
|
||||||
|
<el-icon
|
||||||
|
v-if="hasBillingRule(row)"
|
||||||
|
class="pre-settlement-editor__billing-rule-icon"
|
||||||
|
title="查看计费规则详情"
|
||||||
|
@click="openBillingRuleInfo(row)"
|
||||||
|
>
|
||||||
|
<InfoFilled />
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
|
v-else
|
||||||
v-model="row.feeItems[feeItem]"
|
v-model="row.feeItems[feeItem]"
|
||||||
:min="0"
|
:min="0"
|
||||||
:precision="2"
|
:precision="2"
|
||||||
@@ -833,11 +841,6 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" min-width="200" align="center">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-input v-model="row.remark" maxlength="200" :disabled="adjustDialog.readonly" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-form
|
<el-form
|
||||||
v-if="!adjustDialog.readonly"
|
v-if="!adjustDialog.readonly"
|
||||||
@@ -846,7 +849,7 @@
|
|||||||
label-width="auto"
|
label-width="auto"
|
||||||
class="pre-settlement-editor__adjust-reason"
|
class="pre-settlement-editor__adjust-reason"
|
||||||
>
|
>
|
||||||
<el-form-item label="调整原因">
|
<el-form-item label="备注">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="adjustDialog.reason"
|
v-model="adjustDialog.reason"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
@@ -885,12 +888,6 @@
|
|||||||
<template v-if="billingRuleDialog.rule">
|
<template v-if="billingRuleDialog.rule">
|
||||||
<div class="dialog-section-title">计费规则</div>
|
<div class="dialog-section-title">计费规则</div>
|
||||||
<el-descriptions :column="2" border class="pre-settlement-editor__billing-rule-detail">
|
<el-descriptions :column="2" border class="pre-settlement-editor__billing-rule-detail">
|
||||||
<el-descriptions-item label="规则名称">
|
|
||||||
{{ displayValue(billingRuleDialog.rule.name) }}
|
|
||||||
</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="费用类型">
|
|
||||||
{{ displayValue(billingRuleDialog.rule.feeType) }}
|
|
||||||
</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="费用项">
|
<el-descriptions-item label="费用项">
|
||||||
{{ displayValue(billingRuleDialog.rule.feeItem) }}
|
{{ displayValue(billingRuleDialog.rule.feeItem) }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
@@ -926,8 +923,8 @@
|
|||||||
<el-descriptions-item label="目的地">
|
<el-descriptions-item label="目的地">
|
||||||
{{ displayValue(billingRuleDialog.rule.matchCondition.destination) }}
|
{{ displayValue(billingRuleDialog.rule.matchCondition.destination) }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="运输方式">
|
<el-descriptions-item label="货物名称">
|
||||||
{{ displayValue(billingRuleDialog.rule.matchCondition.transportMode) }}
|
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoName) }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="货物类型">
|
<el-descriptions-item label="货物类型">
|
||||||
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoType) }}
|
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoType) }}
|
||||||
@@ -1203,8 +1200,8 @@ export default {
|
|||||||
return this.editable && this.hasPermission('pre_settlement_adjust');
|
return this.editable && this.hasPermission('pre_settlement_adjust');
|
||||||
},
|
},
|
||||||
dialogTitle() {
|
dialogTitle() {
|
||||||
if (this.readonly) return '查看预结算单';
|
if (this.readonly) return '查看预付结算单';
|
||||||
return this.form.id ? '编辑预结算单' : '新增预结算单';
|
return this.form.id ? '编辑预付结算单' : '新增预付结算单';
|
||||||
},
|
},
|
||||||
settlementTypeName() {
|
settlementTypeName() {
|
||||||
return this.form.settlementType === 'receivable' ? '应收' : '应付';
|
return this.form.settlementType === 'receivable' ? '应收' : '应付';
|
||||||
@@ -1286,13 +1283,6 @@ export default {
|
|||||||
});
|
});
|
||||||
return Array.from(names);
|
return Array.from(names);
|
||||||
},
|
},
|
||||||
adjustChangeRecords() {
|
|
||||||
return this.changeRecords.filter(
|
|
||||||
row =>
|
|
||||||
row.changeType === '结算明细项' &&
|
|
||||||
String(row.lineNo ?? '') === String(this.adjustDialog.detailLineNo ?? '')
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@@ -1866,7 +1856,25 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const manualFees = this.summaryFees.filter(row => Number(row.manualFlag) === 1);
|
const manualFees = this.summaryFees.filter(row => Number(row.manualFlag) === 1);
|
||||||
this.summaryFees = [...summaryMap.values(), ...manualFees];
|
const nextFeeMap = new Map();
|
||||||
|
summaryMap.forEach((row, key) => nextFeeMap.set(`0\u0000${key}`, row));
|
||||||
|
manualFees.forEach(row => {
|
||||||
|
const key = `1\u0000${row.feeType}\u0000${row.feeItem}`;
|
||||||
|
nextFeeMap.set(key, row);
|
||||||
|
});
|
||||||
|
// 按编辑前顺序回填,新增费用项追加到末尾,避免手工费用被统一挤到最后。
|
||||||
|
const orderedFees = [];
|
||||||
|
const previousKeys = this.summaryFees.map(
|
||||||
|
row => `${Number(row.manualFlag) === 1 ? 1 : 0}\u0000${row.feeType}\u0000${row.feeItem}`
|
||||||
|
);
|
||||||
|
previousKeys.forEach(key => {
|
||||||
|
const row = nextFeeMap.get(key);
|
||||||
|
if (!row) return;
|
||||||
|
orderedFees.push(row);
|
||||||
|
nextFeeMap.delete(key);
|
||||||
|
});
|
||||||
|
nextFeeMap.forEach(row => orderedFees.push(row));
|
||||||
|
this.summaryFees = orderedFees;
|
||||||
this.recalculateLocalAmount();
|
this.recalculateLocalAmount();
|
||||||
},
|
},
|
||||||
// 每条明细对应的费用行:[调整前基准行, 调整后当前行],缺少来源费用快照时退化为明细自身的汇总行。
|
// 每条明细对应的费用行:[调整前基准行, 调整后当前行],缺少来源费用快照时退化为明细自身的汇总行。
|
||||||
@@ -2054,7 +2062,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async removeDetailRow(row) {
|
async removeDetailRow(row) {
|
||||||
await this.$confirm('确认将该明细踢出预结算单?', '提示', { type: 'warning' });
|
await this.$confirm('确认将该明细踢出预付结算单?', '提示', { type: 'warning' });
|
||||||
if (!this.form.id || !row.id || row.id === row.sourceDetailId) {
|
if (!this.form.id || !row.id || row.id === row.sourceDetailId) {
|
||||||
this.details = this.details.filter(item => item !== row);
|
this.details = this.details.filter(item => item !== row);
|
||||||
this.buildSummaryFeesFromDetails();
|
this.buildSummaryFeesFromDetails();
|
||||||
@@ -2229,7 +2237,11 @@ export default {
|
|||||||
: '';
|
: '';
|
||||||
const sourceDetailId = String(this.adjustDialog.sourceDetailId || '');
|
const sourceDetailId = String(this.adjustDialog.sourceDetailId || '');
|
||||||
const pending = sourceDetailId ? this.pendingAdjustments[sourceDetailId] : null;
|
const pending = sourceDetailId ? this.pendingAdjustments[sourceDetailId] : null;
|
||||||
this.adjustDialog.reason = pending?.reason || '';
|
// 底部备注回显结算明细备注;暂存过的调整优先取暂存备注
|
||||||
|
this.adjustDialog.reason =
|
||||||
|
pending?.reason !== undefined && pending?.reason !== null
|
||||||
|
? pending.reason
|
||||||
|
: detailRow.remark || '';
|
||||||
try {
|
try {
|
||||||
// 已暂存的调整结果优先回显,避免重新打开时又回到调整前的数据。
|
// 已暂存的调整结果优先回显,避免重新打开时又回到调整前的数据。
|
||||||
if (pending?.rows?.length) {
|
if (pending?.rows?.length) {
|
||||||
@@ -2296,8 +2308,19 @@ export default {
|
|||||||
this.adjustChangeRecordDetailRows = this.buildAdjustChangeRecordRows(row);
|
this.adjustChangeRecordDetailRows = this.buildAdjustChangeRecordRows(row);
|
||||||
this.adjustChangeRecordVisible = true;
|
this.adjustChangeRecordVisible = true;
|
||||||
},
|
},
|
||||||
billingRuleName(row) {
|
hasBillingRule(row) {
|
||||||
return this.normalizeBillingRule(row).name;
|
const rule = this.normalizeBillingRule(row);
|
||||||
|
return Boolean(
|
||||||
|
rule.feeItem ||
|
||||||
|
rule.billingElement ||
|
||||||
|
rule.billingType ||
|
||||||
|
rule.unitPrice ||
|
||||||
|
rule.rules?.length ||
|
||||||
|
rule.matchCondition?.origin ||
|
||||||
|
rule.matchCondition?.destination ||
|
||||||
|
rule.matchCondition?.cargoName ||
|
||||||
|
rule.matchCondition?.cargoType
|
||||||
|
);
|
||||||
},
|
},
|
||||||
openBillingRuleInfo(row) {
|
openBillingRuleInfo(row) {
|
||||||
this.billingRuleDialog.rule = this.normalizeBillingRule(row);
|
this.billingRuleDialog.rule = this.normalizeBillingRule(row);
|
||||||
@@ -2324,27 +2347,8 @@ export default {
|
|||||||
const matchCondition = this.parseObject(
|
const matchCondition = this.parseObject(
|
||||||
source.matchCondition ?? source.billingMatchCondition ?? rule.matchCondition
|
source.matchCondition ?? source.billingMatchCondition ?? rule.matchCondition
|
||||||
);
|
);
|
||||||
const ruleNames = matchedRules
|
|
||||||
.map(item => item.ruleName || item.name || item.billingRuleName || item.feeItem)
|
|
||||||
.filter(Boolean);
|
|
||||||
const name =
|
|
||||||
source.billingRuleName ||
|
|
||||||
source.feeRuleName ||
|
|
||||||
source.ruleName ||
|
|
||||||
source.billingPlanRuleName ||
|
|
||||||
source.billingPlanName ||
|
|
||||||
rule.name ||
|
|
||||||
rule.ruleName ||
|
|
||||||
rule.billingRuleName ||
|
|
||||||
rule.planName ||
|
|
||||||
rule.billingPlanName ||
|
|
||||||
ruleNames.join('、') ||
|
|
||||||
rule.feeItem ||
|
|
||||||
'';
|
|
||||||
return {
|
return {
|
||||||
...rule,
|
...rule,
|
||||||
name,
|
|
||||||
feeType: source.billingFeeType || source.feeType || rule.feeType,
|
|
||||||
feeItem: source.billingFeeItem || source.feeItem || rule.feeItem,
|
feeItem: source.billingFeeItem || source.feeItem || rule.feeItem,
|
||||||
billingElement:
|
billingElement:
|
||||||
source.billingElement ||
|
source.billingElement ||
|
||||||
@@ -2362,7 +2366,11 @@ export default {
|
|||||||
...matchCondition,
|
...matchCondition,
|
||||||
origin: matchCondition.origin || matchCondition.originName,
|
origin: matchCondition.origin || matchCondition.originName,
|
||||||
destination: matchCondition.destination || matchCondition.destinationName,
|
destination: matchCondition.destination || matchCondition.destinationName,
|
||||||
transportMode: matchCondition.transportMode || matchCondition.transportType,
|
cargoName:
|
||||||
|
matchCondition.cargoName ||
|
||||||
|
matchCondition.cargoNameLabel ||
|
||||||
|
source.cargoName ||
|
||||||
|
rule.cargoName,
|
||||||
cargoType: matchCondition.cargoType || matchCondition.cargoTypeName,
|
cargoType: matchCondition.cargoType || matchCondition.cargoTypeName,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -2452,9 +2460,13 @@ export default {
|
|||||||
reason: this.adjustDialog.reason,
|
reason: this.adjustDialog.reason,
|
||||||
rows: this.adjustRows.map(row => ({ ...row, feeItems: { ...row.feeItems } })),
|
rows: this.adjustRows.map(row => ({ ...row, feeItems: { ...row.feeItems } })),
|
||||||
};
|
};
|
||||||
this.applyLocalAdjustment(this.adjustDialog.sourceDetailId, this.adjustRows);
|
this.applyLocalAdjustment(
|
||||||
|
this.adjustDialog.sourceDetailId,
|
||||||
|
this.adjustRows,
|
||||||
|
this.adjustDialog.reason
|
||||||
|
);
|
||||||
this.adjustDialog.visible = false;
|
this.adjustDialog.visible = false;
|
||||||
this.$message.success('结算明细调整已暂存,保存预结算单后生效');
|
this.$message.success('结算明细调整已暂存,保存预付结算单后生效');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await adjustDetail({
|
await adjustDetail({
|
||||||
@@ -2469,7 +2481,6 @@ export default {
|
|||||||
feeItems: row.feeItems,
|
feeItems: row.feeItems,
|
||||||
settlementAmountTax: row.settlementAmountTax,
|
settlementAmountTax: row.settlementAmountTax,
|
||||||
settlementAmountNoTax: row.settlementAmountNoTax,
|
settlementAmountNoTax: row.settlementAmountNoTax,
|
||||||
remark: row.remark,
|
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
this.adjustDialog.visible = false;
|
this.adjustDialog.visible = false;
|
||||||
@@ -2480,12 +2491,12 @@ export default {
|
|||||||
this.adjustDialog.saving = false;
|
this.adjustDialog.saving = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
applyLocalAdjustment(sourceDetailId, rows) {
|
applyLocalAdjustment(sourceDetailId, rows, detailRemark) {
|
||||||
const detail = this.details.find(
|
const detail = this.details.find(
|
||||||
item => String(item.sourceDetailId || item.id) === String(sourceDetailId)
|
item => String(item.sourceDetailId || item.id) === String(sourceDetailId)
|
||||||
);
|
);
|
||||||
if (!detail) return;
|
if (!detail) return;
|
||||||
// 原金额以进入预结算单时的费用快照为基准,调整金额 = 结算金额 - 原金额。
|
// 原金额以进入预付结算单时的费用快照为基准,调整金额 = 结算金额 - 原金额。
|
||||||
const baseRows = this.sourceFeeSnapshots[String(sourceDetailId)] || [];
|
const baseRows = this.sourceFeeSnapshots[String(sourceDetailId)] || [];
|
||||||
const originalAmount = baseRows.length
|
const originalAmount = baseRows.length
|
||||||
? baseRows.reduce((sum, row) => sum + Number(row.settlementAmountTax || 0), 0)
|
? baseRows.reduce((sum, row) => sum + Number(row.settlementAmountTax || 0), 0)
|
||||||
@@ -2494,20 +2505,48 @@ export default {
|
|||||||
(sum, row) => sum + Number(row.settlementAmountTax || 0),
|
(sum, row) => sum + Number(row.settlementAmountTax || 0),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
const settlementAmountNoTax = rows.reduce(
|
||||||
|
(sum, row) => sum + Number(row.settlementAmountNoTax || 0),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
const hasSettlementAmountNoTax = rows.some(
|
||||||
|
row => row.settlementAmountNoTax !== undefined && row.settlementAmountNoTax !== null
|
||||||
|
);
|
||||||
const freightAmount = rows.reduce((sum, row) => sum + Number(row.freightAmount || 0), 0);
|
const freightAmount = rows.reduce((sum, row) => sum + Number(row.freightAmount || 0), 0);
|
||||||
|
const transportQuantity = rows.reduce(
|
||||||
|
(sum, row) => sum + Number(row.transportQuantity || 0),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
const mileage = rows.reduce((sum, row) => sum + Number(row.mileage || 0), 0);
|
||||||
const feeItems = {};
|
const feeItems = {};
|
||||||
rows.forEach(row =>
|
rows.forEach(row =>
|
||||||
Object.entries(row.feeItems || {}).forEach(([name, amount]) => {
|
Object.entries(row.feeItems || {}).forEach(([name, amount]) => {
|
||||||
feeItems[name] = Number((Number(feeItems[name] || 0) + Number(amount || 0)).toFixed(2));
|
feeItems[name] = Number((Number(feeItems[name] || 0) + Number(amount || 0)).toFixed(2));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
const firstRow = rows[0] || {};
|
||||||
Object.assign(detail, {
|
Object.assign(detail, {
|
||||||
|
transportQuantity: Number(transportQuantity.toFixed(2)),
|
||||||
|
mileage: Number(mileage.toFixed(2)),
|
||||||
|
unitPrice: Number(firstRow.unitPrice || 0),
|
||||||
originalAmount: Number(originalAmount.toFixed(2)),
|
originalAmount: Number(originalAmount.toFixed(2)),
|
||||||
adjustAmount: Number((settlementAmountTax - originalAmount).toFixed(2)),
|
adjustAmount: Number((settlementAmountTax - originalAmount).toFixed(2)),
|
||||||
settlementAmountTax: Number(settlementAmountTax.toFixed(2)),
|
settlementAmountTax: Number(settlementAmountTax.toFixed(2)),
|
||||||
|
settlementAmountNoTax: hasSettlementAmountNoTax
|
||||||
|
? Number(settlementAmountNoTax.toFixed(2))
|
||||||
|
: detail.settlementAmountNoTax,
|
||||||
freightAmount: Number(freightAmount.toFixed(2)),
|
freightAmount: Number(freightAmount.toFixed(2)),
|
||||||
feeItemsJson: JSON.stringify(feeItems),
|
feeItemsJson: JSON.stringify(feeItems),
|
||||||
|
// 底部备注写入结算明细备注
|
||||||
|
remark: detailRemark ?? '',
|
||||||
});
|
});
|
||||||
|
// 暂存调整后同步费用缓存,保证货物名称/类型拼接与列表展示一致。
|
||||||
|
if (detail.id) {
|
||||||
|
this.detailFeeCache[detail.id] = rows.map(row => ({
|
||||||
|
...row,
|
||||||
|
feeItems: { ...row.feeItems },
|
||||||
|
}));
|
||||||
|
}
|
||||||
this.buildSummaryFeesFromDetails();
|
this.buildSummaryFeesFromDetails();
|
||||||
},
|
},
|
||||||
async persistPendingAdjustments() {
|
async persistPendingAdjustments() {
|
||||||
@@ -2535,11 +2574,14 @@ export default {
|
|||||||
feeItems: pendingRow.feeItems,
|
feeItems: pendingRow.feeItems,
|
||||||
settlementAmountTax: pendingRow.settlementAmountTax,
|
settlementAmountTax: pendingRow.settlementAmountTax,
|
||||||
settlementAmountNoTax: pendingRow.settlementAmountNoTax,
|
settlementAmountNoTax: pendingRow.settlementAmountNoTax,
|
||||||
remark: pendingRow.remark,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
if (rows.length) {
|
if (rows.length) {
|
||||||
await adjustDetail({ detailId: detail.id, changeReason: pending.reason, rows });
|
await adjustDetail({
|
||||||
|
detailId: detail.id,
|
||||||
|
changeReason: pending.reason,
|
||||||
|
rows,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.pendingAdjustments = {};
|
this.pendingAdjustments = {};
|
||||||
@@ -2611,7 +2653,7 @@ export default {
|
|||||||
XLSX.utils.book_append_sheet(workbook, sheet, '结算明细');
|
XLSX.utils.book_append_sheet(workbook, sheet, '结算明细');
|
||||||
XLSX.writeFile(
|
XLSX.writeFile(
|
||||||
workbook,
|
workbook,
|
||||||
`${this.form.preSettlementNo || '预结算单'}结算明细${this.$dayjs().format(
|
`${this.form.preSettlementNo || '预付结算单'}结算明细${this.$dayjs().format(
|
||||||
'YYYY-MM-DD HH-mm-ss'
|
'YYYY-MM-DD HH-mm-ss'
|
||||||
)}.xlsx`
|
)}.xlsx`
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
<el-option label="正式结算单" value="formal" />
|
<el-option label="正式结算单" value="formal" />
|
||||||
<el-option
|
<el-option
|
||||||
v-if="form.settlementType === 'payable'"
|
v-if="form.settlementType === 'payable'"
|
||||||
label="预结算单"
|
label="预付结算单"
|
||||||
value="pre"
|
value="pre"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|||||||
@@ -508,7 +508,7 @@
|
|||||||
<span class="completion-dialog__value">{{ displayValue(form.reconciliationNo) }}</span>
|
<span class="completion-dialog__value">{{ displayValue(form.reconciliationNo) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="completion-dialog__field">
|
<div class="completion-dialog__field">
|
||||||
<span class="completion-dialog__label">预结算单号</span>
|
<span class="completion-dialog__label">预付结算单号</span>
|
||||||
<span class="completion-dialog__value">{{
|
<span class="completion-dialog__value">{{
|
||||||
displayValue(form.preSettlementNo || form.formalSettlementNo)
|
displayValue(form.preSettlementNo || form.formalSettlementNo)
|
||||||
}}</span>
|
}}</span>
|
||||||
@@ -1278,10 +1278,13 @@ export default {
|
|||||||
delete snapshot._externalKey;
|
delete snapshot._externalKey;
|
||||||
delete snapshot.feeItems;
|
delete snapshot.feeItems;
|
||||||
snapshot.feeItemsJson = row.feeItemsJson || JSON.stringify(row.feeItems || {});
|
snapshot.feeItemsJson = row.feeItemsJson || JSON.stringify(row.feeItems || {});
|
||||||
|
snapshot.actualDepartureTime = this.normalizeExternalDateTime(row.actualDepartureTime);
|
||||||
|
snapshot.actualCompletionTime = this.normalizeExternalDateTime(row.actualCompletionTime);
|
||||||
return snapshot;
|
return snapshot;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
serializeExternalRows() {
|
serializeExternalRows() {
|
||||||
|
const duplicateIds = new Set(this.duplicateRows.map(row => String(row.id)));
|
||||||
return this.externalDetails.map(row => {
|
return this.externalDetails.map(row => {
|
||||||
const snapshot = { ...row };
|
const snapshot = { ...row };
|
||||||
delete snapshot._sourceRows;
|
delete snapshot._sourceRows;
|
||||||
@@ -1290,6 +1293,7 @@ export default {
|
|||||||
snapshot.feeItemsJson = row.feeItemsJson || JSON.stringify(row.feeItems || {});
|
snapshot.feeItemsJson = row.feeItemsJson || JSON.stringify(row.feeItems || {});
|
||||||
snapshot.actualDepartureTime = this.normalizeExternalDateTime(row.actualDepartureTime);
|
snapshot.actualDepartureTime = this.normalizeExternalDateTime(row.actualDepartureTime);
|
||||||
snapshot.actualCompletionTime = this.normalizeExternalDateTime(row.actualCompletionTime);
|
snapshot.actualCompletionTime = this.normalizeExternalDateTime(row.actualCompletionTime);
|
||||||
|
snapshot.suspectedDuplicate = duplicateIds.has(String(row.id));
|
||||||
return snapshot;
|
return snapshot;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -1336,6 +1340,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async handleComplete() {
|
async handleComplete() {
|
||||||
|
const unmatchedInternal = this.internalDetails.filter(item => item.matchResult !== 'matched').length;
|
||||||
|
const unmatchedExternal = this.externalDetails.filter(item => item.matchStatus !== 'matched').length;
|
||||||
|
if (this.duplicateRows.length || unmatchedInternal || unmatchedExternal) {
|
||||||
|
return this.$message.warning('所有内外部账单明细必须一一匹配且不存在疑似重复');
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
Number(this.form.differenceCount || 0) !== 0 ||
|
Number(this.form.differenceCount || 0) !== 0 ||
|
||||||
Number(this.form.differenceQuantity || 0) !== 0 ||
|
Number(this.form.differenceQuantity || 0) !== 0 ||
|
||||||
@@ -1694,8 +1703,11 @@ export default {
|
|||||||
},
|
},
|
||||||
normalizeExternalDateTime(value) {
|
normalizeExternalDateTime(value) {
|
||||||
if (!value) return null;
|
if (!value) return null;
|
||||||
const text = String(value);
|
const text = String(value).trim();
|
||||||
return text.length === 10 ? `${text}T00:00:00` : text;
|
if (!text) return null;
|
||||||
|
const date = this.$dayjs(text);
|
||||||
|
if (date.isValid()) return date.format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
return text.length === 10 ? `${text} 00:00:00` : text.replace('T', ' ');
|
||||||
},
|
},
|
||||||
refreshLocalStats() {
|
refreshLocalStats() {
|
||||||
const internalQuantity = this.internalDetails.reduce(
|
const internalQuantity = this.internalDetails.reduce(
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import FormalSettlementEditor from './components/formal-settlement-editor.vue';
|
import FormalSettlementEditor from './components/formal-settlement-editor.vue';
|
||||||
import { readSettlementTransfer, removeSettlementTransfer } from '@/utils/settlement-transfer';
|
import { readSettlementTransfer, removeSettlementTransfer } from '@/utils/settlement-transfer';
|
||||||
|
import { settlementBillLabel, settlementListPath } from '@/utils/settlement-menu';
|
||||||
|
|
||||||
const LIST_REFRESH_KEY = 'formal-settlement-list-refresh';
|
const LIST_REFRESH_KEY = 'formal-settlement-list-refresh';
|
||||||
|
|
||||||
@@ -35,12 +36,25 @@ export default {
|
|||||||
readonly() {
|
readonly() {
|
||||||
return this.$route.query.mode === 'view';
|
return this.$route.query.mode === 'view';
|
||||||
},
|
},
|
||||||
|
settlementType() {
|
||||||
|
return this.$route.query.settlementType || this.transferPayload?.settlementType || 'payable';
|
||||||
|
},
|
||||||
|
billLabel() {
|
||||||
|
return settlementBillLabel(this.settlementType);
|
||||||
|
},
|
||||||
pageTitle() {
|
pageTitle() {
|
||||||
return this.readonly ? '查看正式结算' : this.recordId ? '编辑正式结算' : '新增正式结算';
|
return this.readonly
|
||||||
|
? `查看${this.billLabel}`
|
||||||
|
: this.recordId
|
||||||
|
? `编辑${this.billLabel}`
|
||||||
|
: `新增${this.billLabel}`;
|
||||||
|
},
|
||||||
|
listPath() {
|
||||||
|
return this.$route.query.listPath || settlementListPath(this.settlementType);
|
||||||
},
|
},
|
||||||
editorInitialData() {
|
editorInitialData() {
|
||||||
const settlementType = this.$route.query.settlementType;
|
const settlementType = this.settlementType;
|
||||||
if (!this.transferPayload && !settlementType) return null;
|
if (!this.transferPayload && !this.$route.query.settlementType) return null;
|
||||||
return {
|
return {
|
||||||
...(this.transferPayload || {}),
|
...(this.transferPayload || {}),
|
||||||
...(settlementType ? { settlementType } : {}),
|
...(settlementType ? { settlementType } : {}),
|
||||||
@@ -63,7 +77,7 @@ export default {
|
|||||||
goBack() {
|
goBack() {
|
||||||
removeSettlementTransfer(this.$route.query.transferToken);
|
removeSettlementTransfer(this.$route.query.transferToken);
|
||||||
this.$router.$avueRouter.closeTag();
|
this.$router.$avueRouter.closeTag();
|
||||||
this.$router.push('/settlement/formal-settlement');
|
this.$router.push(this.listPath);
|
||||||
},
|
},
|
||||||
syncTagTitle() {
|
syncTagTitle() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|||||||
@@ -52,53 +52,32 @@
|
|||||||
|
|
||||||
<section class="formal-page__table-panel">
|
<section class="formal-page__table-panel">
|
||||||
<el-tabs
|
<el-tabs
|
||||||
|
v-if="!lockedSettlementType"
|
||||||
type="border-card"
|
type="border-card"
|
||||||
v-model="activeSettlementType"
|
v-model="activeSettlementType"
|
||||||
@tab-change="handleSettlementTypeChange"
|
@tab-change="handleSettlementTypeChange"
|
||||||
>
|
>
|
||||||
<el-tab-pane label="应付" name="payable">
|
<el-tab-pane label="应付" name="payable">
|
||||||
<formal-settlement-table-panel
|
<formal-settlement-table-panel
|
||||||
:key="activeSettlementType"
|
:key="'payable'"
|
||||||
:rows="rows"
|
v-bind="tablePanelProps"
|
||||||
:columns="columns"
|
v-on="tablePanelListeners"
|
||||||
:loading="loading"
|
|
||||||
:page="page"
|
|
||||||
:has-permission="hasPermissionFn"
|
|
||||||
:sync-loading="syncLoading"
|
|
||||||
:mk-enabled="mkEnabled"
|
|
||||||
v-model:search-visible="searchVisible"
|
|
||||||
@create="openCreate"
|
|
||||||
@payment="openPaymentDialog"
|
|
||||||
@sync="handleSync"
|
|
||||||
@export="handleExport"
|
|
||||||
@refresh="loadTable"
|
|
||||||
@page-change="onPageChange"
|
|
||||||
@action="onAction"
|
|
||||||
@update:selection="selection = $event"
|
|
||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="应收" name="receivable">
|
<el-tab-pane label="应收" name="receivable">
|
||||||
<formal-settlement-table-panel
|
<formal-settlement-table-panel
|
||||||
:key="activeSettlementType"
|
:key="'receivable'"
|
||||||
:rows="rows"
|
v-bind="tablePanelProps"
|
||||||
:columns="columns"
|
v-on="tablePanelListeners"
|
||||||
:loading="loading"
|
|
||||||
:page="page"
|
|
||||||
:has-permission="hasPermissionFn"
|
|
||||||
:sync-loading="syncLoading"
|
|
||||||
:mk-enabled="mkEnabled"
|
|
||||||
v-model:search-visible="searchVisible"
|
|
||||||
@create="openCreate"
|
|
||||||
@payment="openPaymentDialog"
|
|
||||||
@sync="handleSync"
|
|
||||||
@export="handleExport"
|
|
||||||
@refresh="loadTable"
|
|
||||||
@page-change="onPageChange"
|
|
||||||
@action="onAction"
|
|
||||||
@update:selection="selection = $event"
|
|
||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
<formal-settlement-table-panel
|
||||||
|
v-else
|
||||||
|
:key="activeSettlementType"
|
||||||
|
v-bind="tablePanelProps"
|
||||||
|
v-on="tablePanelListeners"
|
||||||
|
/>
|
||||||
</section>
|
</section>
|
||||||
<formal-settlement-editor
|
<formal-settlement-editor
|
||||||
v-model="editor.visible"
|
v-model="editor.visible"
|
||||||
@@ -116,7 +95,7 @@
|
|||||||
<section-card title="付款信息">
|
<section-card title="付款信息">
|
||||||
<template v-if="paymentDialog.rows.length > 1">
|
<template v-if="paymentDialog.rows.length > 1">
|
||||||
<div class="formal-payment-dialog__batch-tip">
|
<div class="formal-payment-dialog__batch-tip">
|
||||||
已选择 {{ paymentDialog.rows.length }} 条同合同应付正式结算单,请确认各单申请金额。
|
已选择 {{ paymentDialog.rows.length }} 条同合同付款结算单,请确认各单申请金额。
|
||||||
</div>
|
</div>
|
||||||
<el-table :data="paymentDialog.rows" border>
|
<el-table :data="paymentDialog.rows" border>
|
||||||
<el-table-column prop="formalSettlementNo" label="结算单号" min-width="160" />
|
<el-table-column prop="formalSettlementNo" label="结算单号" min-width="160" />
|
||||||
@@ -176,6 +155,12 @@
|
|||||||
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue';
|
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { createSettlementTransfer } from '@/utils/settlement-transfer';
|
import { createSettlementTransfer } from '@/utils/settlement-transfer';
|
||||||
|
import {
|
||||||
|
hasSettlementPermission,
|
||||||
|
settlementBillLabel,
|
||||||
|
settlementListPath,
|
||||||
|
} from '@/utils/settlement-menu';
|
||||||
|
import { isAdministrator } from '@/utils/auth';
|
||||||
import { downloadFile } from '@/utils/util';
|
import { downloadFile } from '@/utils/util';
|
||||||
import * as api from '@/api/settlement/formalSettlement';
|
import * as api from '@/api/settlement/formalSettlement';
|
||||||
import * as paymentApi from '@/api/payment/paymentApplication';
|
import * as paymentApi from '@/api/payment/paymentApplication';
|
||||||
@@ -210,6 +195,14 @@ export default {
|
|||||||
name: 'FormalSettlement',
|
name: 'FormalSettlement',
|
||||||
components: { FormalSettlementEditor, FormalSettlementTablePanel },
|
components: { FormalSettlementEditor, FormalSettlementTablePanel },
|
||||||
mixins: [organizationSearch],
|
mixins: [organizationSearch],
|
||||||
|
props: {
|
||||||
|
/** 菜单拆分后锁定结算类型:payable=付款结算单,receivable=收款结算单 */
|
||||||
|
lockedSettlementType: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
validator: value => ['', 'payable', 'receivable'].includes(value),
|
||||||
|
},
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
ArrowDown,
|
ArrowDown,
|
||||||
@@ -237,9 +230,52 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['permission']),
|
...mapGetters(['permission', 'userInfo']),
|
||||||
|
isAdmin() {
|
||||||
|
return isAdministrator(this.userInfo);
|
||||||
|
},
|
||||||
|
billLabel() {
|
||||||
|
return settlementBillLabel(this.activeSettlementType);
|
||||||
|
},
|
||||||
hasPermissionFn() {
|
hasPermissionFn() {
|
||||||
return code => this.permission?.[code] !== false;
|
return actionOrCode => {
|
||||||
|
const action = String(actionOrCode || '').replace(
|
||||||
|
/^(payment_settlement_|receipt_settlement_|formal_settlement_)/,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
return hasSettlementPermission(this, this.activeSettlementType, action);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
tablePanelProps() {
|
||||||
|
return {
|
||||||
|
rows: this.rows,
|
||||||
|
columns: this.columns,
|
||||||
|
loading: this.loading,
|
||||||
|
page: this.page,
|
||||||
|
hasPermission: this.hasPermissionFn,
|
||||||
|
syncLoading: this.syncLoading,
|
||||||
|
mkEnabled: this.mkEnabled,
|
||||||
|
searchVisible: this.searchVisible,
|
||||||
|
showPaymentAction: this.activeSettlementType === 'payable',
|
||||||
|
billLabel: this.billLabel,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
tablePanelListeners() {
|
||||||
|
return {
|
||||||
|
create: this.openCreate,
|
||||||
|
payment: this.openPaymentDialog,
|
||||||
|
sync: this.handleSync,
|
||||||
|
export: this.handleExport,
|
||||||
|
refresh: this.loadTable,
|
||||||
|
'page-change': this.onPageChange,
|
||||||
|
action: this.onAction,
|
||||||
|
'update:selection': selection => {
|
||||||
|
this.selection = selection;
|
||||||
|
},
|
||||||
|
'update:searchVisible': visible => {
|
||||||
|
this.searchVisible = visible;
|
||||||
|
},
|
||||||
|
};
|
||||||
},
|
},
|
||||||
visibleSearchFields() {
|
visibleSearchFields() {
|
||||||
return this.searchExpanded ? this.searchFields : this.searchFields.slice(0, 4);
|
return this.searchExpanded ? this.searchFields : this.searchFields.slice(0, 4);
|
||||||
@@ -249,6 +285,14 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
lockedSettlementType: {
|
||||||
|
immediate: true,
|
||||||
|
handler(value) {
|
||||||
|
if (value === 'payable' || value === 'receivable') {
|
||||||
|
this.activeSettlementType = value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
'$route.query.detailNo'(detailNo) {
|
'$route.query.detailNo'(detailNo) {
|
||||||
if (detailNo) this.openRouteDetail(detailNo);
|
if (detailNo) this.openRouteDetail(detailNo);
|
||||||
},
|
},
|
||||||
@@ -258,6 +302,9 @@ export default {
|
|||||||
this.ownFullPath = this.$route.fullPath;
|
this.ownFullPath = this.$route.fullPath;
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
if (this.lockedSettlementType === 'payable' || this.lockedSettlementType === 'receivable') {
|
||||||
|
this.activeSettlementType = this.lockedSettlementType;
|
||||||
|
}
|
||||||
this.loadOrganizationOptions();
|
this.loadOrganizationOptions();
|
||||||
this.loadTable();
|
this.loadTable();
|
||||||
this.openRouteDetail();
|
this.openRouteDetail();
|
||||||
@@ -276,8 +323,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
hasPermission(code) {
|
hasPermission(actionOrCode) {
|
||||||
return this.permission?.[code] !== false;
|
return this.hasPermissionFn(actionOrCode);
|
||||||
},
|
},
|
||||||
async loadTable() {
|
async loadTable() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@@ -330,15 +377,23 @@ export default {
|
|||||||
path: '/settlement/formal-settlement/form',
|
path: '/settlement/formal-settlement/form',
|
||||||
query: {
|
query: {
|
||||||
mode: 'add',
|
mode: 'add',
|
||||||
name: '新增正式结算',
|
name: `新增${this.billLabel}`,
|
||||||
settlementType: this.activeSettlementType,
|
settlementType: this.activeSettlementType,
|
||||||
|
listPath: settlementListPath(this.activeSettlementType),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openEdit(row) {
|
openEdit(row) {
|
||||||
|
const settlementType = row.settlementType || this.activeSettlementType;
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/settlement/formal-settlement/form',
|
path: '/settlement/formal-settlement/form',
|
||||||
query: { mode: 'edit', id: row.id, name: '编辑正式结算' },
|
query: {
|
||||||
|
mode: 'edit',
|
||||||
|
id: row.id,
|
||||||
|
name: `编辑${settlementBillLabel(settlementType)}`,
|
||||||
|
settlementType,
|
||||||
|
listPath: settlementListPath(settlementType),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openView(row) {
|
openView(row) {
|
||||||
@@ -351,20 +406,22 @@ export default {
|
|||||||
const data = this.unwrapData(response);
|
const data = this.unwrapData(response);
|
||||||
const row = (data.records || []).find(item => item.formalSettlementNo === formalSettlementNo);
|
const row = (data.records || []).find(item => item.formalSettlementNo === formalSettlementNo);
|
||||||
if (!row) {
|
if (!row) {
|
||||||
this.$message.warning('未找到对应的正式结算单');
|
this.$message.warning(`未找到对应的${this.billLabel}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.activeSettlementType = row.settlementType || this.activeSettlementType;
|
if (!this.lockedSettlementType) {
|
||||||
|
this.activeSettlementType = row.settlementType || this.activeSettlementType;
|
||||||
|
}
|
||||||
this.openView(row);
|
this.openView(row);
|
||||||
},
|
},
|
||||||
async handleDelete(row) {
|
async handleDelete(row) {
|
||||||
await this.$confirm('确认删除该正式结算草稿?', '提示', { type: 'warning' });
|
await this.$confirm(`确认删除该${this.billLabel}草稿?`, '提示', { type: 'warning' });
|
||||||
await api.remove(row.id);
|
await api.remove(row.id);
|
||||||
this.$message.success('删除成功');
|
this.$message.success('删除成功');
|
||||||
this.loadTable();
|
this.loadTable();
|
||||||
},
|
},
|
||||||
async handleSubmit(row) {
|
async handleSubmit(row) {
|
||||||
await this.$confirm('提交后来源预结算将保持锁定,确认提交?', '提示', { type: 'warning' });
|
await this.$confirm('提交后来源预付结算单将保持锁定,确认提交?', '提示', { type: 'warning' });
|
||||||
const previousApprovalStatus = row.approvalStatus || '';
|
const previousApprovalStatus = row.approvalStatus || '';
|
||||||
await api.submit({ id: row.id });
|
await api.submit({ id: row.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
@@ -379,7 +436,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleMkAudit(row) {
|
handleMkAudit(row) {
|
||||||
if (!row?.id) {
|
if (!row?.id) {
|
||||||
this.$message.warning('正式结算单ID为空,无法打开审核页');
|
this.$message.warning(`${this.billLabel}ID为空,无法打开审核页`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getMKApprovalUrl({ bizId: String(row.id) })
|
getMKApprovalUrl({ bizId: String(row.id) })
|
||||||
@@ -397,7 +454,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async handleApprove(row) {
|
async handleApprove(row) {
|
||||||
await this.$confirm(
|
await this.$confirm(
|
||||||
'审核通过后正式结算生效,金额只能通过结算调整单处理,确认通过?',
|
`审核通过后${this.billLabel}生效,金额只能通过结算调整单处理,确认通过?`,
|
||||||
'提示',
|
'提示',
|
||||||
{ type: 'warning' }
|
{ type: 'warning' }
|
||||||
);
|
);
|
||||||
@@ -419,7 +476,7 @@ export default {
|
|||||||
this.loadTable();
|
this.loadTable();
|
||||||
},
|
},
|
||||||
async handleVoid(row) {
|
async handleVoid(row) {
|
||||||
const { value } = await this.$prompt('请输入作废原因', '作废正式结算单', {
|
const { value } = await this.$prompt('请输入作废原因', `作废${this.billLabel}`, {
|
||||||
inputValidator: value => Boolean(value?.trim()) || '请输入作废原因',
|
inputValidator: value => Boolean(value?.trim()) || '请输入作废原因',
|
||||||
});
|
});
|
||||||
await api.voidBill({ id: row.id, reason: value });
|
await api.voidBill({ id: row.id, reason: value });
|
||||||
@@ -428,46 +485,80 @@ export default {
|
|||||||
},
|
},
|
||||||
selectedOne(action) {
|
selectedOne(action) {
|
||||||
if (this.selection.length !== 1) {
|
if (this.selection.length !== 1) {
|
||||||
this.$message.warning(`${action}需选择一条正式结算单`);
|
this.$message.warning(`${action}需选择一条${this.billLabel}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return this.selection[0];
|
return this.selection[0];
|
||||||
},
|
},
|
||||||
async handleSync() {
|
async handleSync() {
|
||||||
if (this.syncLoading) return;
|
if (this.syncLoading) return;
|
||||||
const row = this.selectedOne('同步金蝶');
|
const rows = (this.selection || []).filter(row => row.approvalStatus === 'approved');
|
||||||
if (!row) return;
|
if (!rows.length) {
|
||||||
|
this.$message.warning(`请选择至少一条审批通过的${this.billLabel}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.syncLoading = true;
|
this.syncLoading = true;
|
||||||
try {
|
try {
|
||||||
const response = await api.syncKingdee(row.id);
|
let successCount = 0;
|
||||||
const data = this.unwrapData(response);
|
let failCount = 0;
|
||||||
this.$message.success(`同步成功,金蝶单据号:${data}`);
|
let lastFailReason = '';
|
||||||
await this.loadTable();
|
for (const row of rows) {
|
||||||
// 附件联带同步提示:同步成功但附件未全部上传时追加 warning,重推即自动补传
|
try {
|
||||||
const freshRow = (this.rows || []).find(item => String(item.id) === String(row.id));
|
await api.syncKingdee(row.id, { meta: { suppressErrorMessage: true } });
|
||||||
if (freshRow && ['pending', 'partial'].includes(freshRow.attachmentSyncStatus)) {
|
successCount += 1;
|
||||||
this.$message({
|
} catch (error) {
|
||||||
type: 'warning',
|
failCount += 1;
|
||||||
message: '该单附件未全部上传,可重推补传',
|
lastFailReason = String(error?.message || error || '未知错误').trim() || '未知错误';
|
||||||
duration: 8000,
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
await this.loadTable();
|
||||||
|
if (rows.length === 1) {
|
||||||
|
if (failCount) {
|
||||||
|
await this.$alert(`同步失败,${lastFailReason}`, '同步结果', {
|
||||||
|
type: 'error',
|
||||||
|
confirmButtonText: '知道了',
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let message = '同步成功';
|
||||||
|
const freshRow = (this.rows || []).find(item => String(item.id) === String(rows[0].id));
|
||||||
|
if (freshRow && ['pending', 'partial'].includes(freshRow.attachmentSyncStatus)) {
|
||||||
|
message += '\n该单附件未全部上传,可重推补传';
|
||||||
|
}
|
||||||
|
await this.$alert(message, '同步结果', {
|
||||||
|
type: 'success',
|
||||||
|
confirmButtonText: '知道了',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let batchMessage = `完成同步${successCount}条,失败${failCount}条`;
|
||||||
|
const idSet = new Set(rows.map(row => String(row.id)));
|
||||||
|
const pendingCount = (this.rows || []).filter(
|
||||||
|
row =>
|
||||||
|
idSet.has(String(row.id)) && ['pending', 'partial'].includes(row.attachmentSyncStatus)
|
||||||
|
).length;
|
||||||
|
if (pendingCount) {
|
||||||
|
batchMessage += `\n其中${pendingCount}单附件未全部上传,可重推补传`;
|
||||||
|
}
|
||||||
|
await this.$alert(batchMessage, '同步结果', {
|
||||||
|
type: failCount ? 'warning' : 'success',
|
||||||
|
confirmButtonText: '知道了',
|
||||||
|
});
|
||||||
} finally {
|
} finally {
|
||||||
this.syncLoading = false;
|
this.syncLoading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async openPaymentDialog() {
|
async openPaymentDialog() {
|
||||||
if (!this.selection.length) return this.$message.warning('请至少选择一条正式结算单');
|
if (!this.selection.length) return this.$message.warning(`请至少选择一条${this.billLabel}`);
|
||||||
const rows = this.selection;
|
const rows = this.selection;
|
||||||
if (rows.some(row => row.approvalStatus !== 'approved' || row.settlementType !== 'payable'))
|
if (rows.some(row => row.approvalStatus !== 'approved' || row.settlementType !== 'payable'))
|
||||||
return this.$message.warning('仅审批通过的应付正式结算单允许发起付款申请');
|
return this.$message.warning('仅审批通过的付款结算单允许发起付款申请');
|
||||||
const contractIds = new Set(rows.map(row => String(row.contractId || '')));
|
const contractIds = new Set(rows.map(row => String(row.contractId || '')));
|
||||||
if (contractIds.size !== 1 || contractIds.has(''))
|
if (contractIds.size !== 1 || contractIds.has(''))
|
||||||
return this.$message.warning('付款申请必须选择同一个合同的正式结算单');
|
return this.$message.warning('付款申请必须选择同一个合同的付款结算单');
|
||||||
const paymentRows = rows.map(row => ({ ...row, appliedAmount: this.paymentRemaining(row) }));
|
const paymentRows = rows.map(row => ({ ...row, appliedAmount: this.paymentRemaining(row) }));
|
||||||
if (paymentRows.some(row => row.appliedAmount <= 0))
|
if (paymentRows.some(row => row.appliedAmount <= 0))
|
||||||
return this.$message.warning('所选正式结算单均须存在剩余可申请金额');
|
return this.$message.warning('所选付款结算单均须存在剩余可申请金额');
|
||||||
try {
|
try {
|
||||||
const sourceFormalSettlements = await Promise.all(
|
const sourceFormalSettlements = await Promise.all(
|
||||||
paymentRows.map(async row => {
|
paymentRows.map(async row => {
|
||||||
@@ -503,7 +594,7 @@ export default {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
if (sourceFormalSettlements.some(row => row.appliedAmount <= 0)) {
|
if (sourceFormalSettlements.some(row => row.appliedAmount <= 0)) {
|
||||||
this.$message.warning('所选正式结算单均须存在剩余可申请金额');
|
this.$message.warning('所选付款结算单均须存在剩余可申请金额');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const transferToken = createSettlementTransfer({
|
const transferToken = createSettlementTransfer({
|
||||||
@@ -523,7 +614,7 @@ export default {
|
|||||||
const paymentRows = this.paymentDialog.rows;
|
const paymentRows = this.paymentDialog.rows;
|
||||||
if (paymentRows.length > 1) {
|
if (paymentRows.length > 1) {
|
||||||
if (paymentRows.some(row => Number(row.appliedAmount || 0) <= 0))
|
if (paymentRows.some(row => Number(row.appliedAmount || 0) <= 0))
|
||||||
return this.$message.warning('请输入各正式结算单的申请付款金额');
|
return this.$message.warning('请输入各付款结算单的申请付款金额');
|
||||||
if (paymentRows.some(row => Number(row.appliedAmount) > this.paymentRemaining(row)))
|
if (paymentRows.some(row => Number(row.appliedAmount) > this.paymentRemaining(row)))
|
||||||
return this.$message.warning('申请付款金额不能超过剩余可申请金额');
|
return this.$message.warning('申请付款金额不能超过剩余可申请金额');
|
||||||
} else if (Number(this.paymentDialog.form.appliedAmount || 0) <= 0) {
|
} else if (Number(this.paymentDialog.form.appliedAmount || 0) <= 0) {
|
||||||
@@ -559,9 +650,11 @@ export default {
|
|||||||
win.document.write(
|
win.document.write(
|
||||||
`<!doctype html><html><head><title>${
|
`<!doctype html><html><head><title>${
|
||||||
row.formalSettlementNo
|
row.formalSettlementNo
|
||||||
}</title><style>body{font-family:Arial,"Microsoft YaHei",sans-serif;padding:32px;color:#222}h1{text-align:center}.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px 28px;margin-top:30px}.item{border-bottom:1px solid #ddd;padding:8px 0}.actions{text-align:center;margin-top:36px}@media print{.actions{display:none}}</style></head><body><h1>正式结算单</h1><div class="grid"><div class="item">结算单号:${this.escapeHtml(
|
}</title><style>body{font-family:Arial,"Microsoft YaHei",sans-serif;padding:32px;color:#222}h1{text-align:center}.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px 28px;margin-top:30px}.item{border-bottom:1px solid #ddd;padding:8px 0}.actions{text-align:center;margin-top:36px}@media print{.actions{display:none}}</style></head><body><h1>${this.escapeHtml(
|
||||||
|
settlementBillLabel(row.settlementType || this.activeSettlementType)
|
||||||
|
)}</h1><div class="grid"><div class="item">结算单号:${this.escapeHtml(
|
||||||
row.formalSettlementNo
|
row.formalSettlementNo
|
||||||
)}</div><div class="item">预结算单号:${this.escapeHtml(
|
)}</div><div class="item">预付结算单号:${this.escapeHtml(
|
||||||
row.preSettlementNos
|
row.preSettlementNos
|
||||||
)}</div><div class="item">项目:${this.escapeHtml(
|
)}</div><div class="item">项目:${this.escapeHtml(
|
||||||
row.projectName
|
row.projectName
|
||||||
@@ -586,12 +679,15 @@ export default {
|
|||||||
const params = this.buildQueryParams();
|
const params = this.buildQueryParams();
|
||||||
if (this.selection.length) params.ids = this.selection.map(item => item.id).join(',');
|
if (this.selection.length) params.ids = this.selection.map(item => item.id).join(',');
|
||||||
const { data } = await api.exportList(params);
|
const { data } = await api.exportList(params);
|
||||||
downloadFile(data, `正式结算单${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`);
|
downloadFile(
|
||||||
|
data,
|
||||||
|
`${this.billLabel}${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`
|
||||||
|
);
|
||||||
},
|
},
|
||||||
buildQueryParams() {
|
buildQueryParams() {
|
||||||
// 所属组织级联返回 id 路径,转成组织名称传给后端(用副本,避免污染搜索框回显)
|
// 所属组织级联返回 id 路径,转成组织名称传给后端(用副本,避免污染搜索框回显)
|
||||||
const params = this.normalizeOrganizationSearch({ ...this.query }, 'deptName');
|
const params = this.normalizeOrganizationSearch({ ...this.query }, 'deptName');
|
||||||
params.settlementType = this.activeSettlementType;
|
params.settlementType = this.lockedSettlementType || this.activeSettlementType;
|
||||||
const range = params.createDateRange || [];
|
const range = params.createDateRange || [];
|
||||||
delete params.createDateRange;
|
delete params.createDateRange;
|
||||||
if (range.length === 2) {
|
if (range.length === 2) {
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<template>
|
||||||
|
<formal-settlement locked-settlement-type="payable" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import FormalSettlement from './formal-settlement.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PaymentSettlement',
|
||||||
|
components: { FormalSettlement },
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<basic-container class="pre-settlement-form-page">
|
<basic-container class="pre-settlement-form-page">
|
||||||
<div class="pre-settlement-form-page__title">{{ pageTitle }}</div>
|
<div class="pre-settlement-form-page__title">{{ pageTitle }}</div>
|
||||||
<!-- 新增来源明细可直接调整:计费试算走独立接口,调整结果先暂存,保存预结算单时再落库。 -->
|
<!-- 新增来源明细可直接调整:计费试算走独立接口,调整结果先暂存,保存预付结算单时再落库。 -->
|
||||||
<pre-settlement-editor
|
<pre-settlement-editor
|
||||||
v-model="editorVisible"
|
v-model="editorVisible"
|
||||||
page-mode
|
page-mode
|
||||||
@@ -31,7 +31,7 @@ export default {
|
|||||||
return this.$route.query.id || '';
|
return this.$route.query.id || '';
|
||||||
},
|
},
|
||||||
pageTitle() {
|
pageTitle() {
|
||||||
return this.recordId || this.savedRecordId ? '编辑预结算' : '新增预结算';
|
return this.recordId || this.savedRecordId ? '编辑预付结算单' : '新增预付结算单';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<mk-public-shell biz-type="pre-settlement" :get-form="getForm">
|
<mk-public-shell biz-type="pre-settlement" :get-form="getForm">
|
||||||
<basic-container>
|
<basic-container>
|
||||||
<div class="mk-public-form-title">查看预结算</div>
|
<div class="mk-public-form-title">查看预付结算单</div>
|
||||||
<pre-settlement-editor
|
<pre-settlement-editor
|
||||||
ref="page"
|
ref="page"
|
||||||
:model-value="true"
|
:model-value="true"
|
||||||
|
|||||||
@@ -446,13 +446,13 @@ export default {
|
|||||||
openCreate() {
|
openCreate() {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/settlement/pre-settlement/form',
|
path: '/settlement/pre-settlement/form',
|
||||||
query: { mode: 'add', name: '新增预结算' },
|
query: { mode: 'add', name: '新增预付结算单' },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openEdit(row) {
|
openEdit(row) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/settlement/pre-settlement/form',
|
path: '/settlement/pre-settlement/form',
|
||||||
query: { mode: 'edit', id: row.id, name: '编辑预结算' },
|
query: { mode: 'edit', id: row.id, name: '编辑预付结算单' },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openView(row) {
|
openView(row) {
|
||||||
@@ -465,7 +465,7 @@ export default {
|
|||||||
const records = data?.data?.records || [];
|
const records = data?.data?.records || [];
|
||||||
const row = records.find(item => item.preSettlementNo === preSettlementNo);
|
const row = records.find(item => item.preSettlementNo === preSettlementNo);
|
||||||
if (!row) {
|
if (!row) {
|
||||||
this.$message.warning('未找到对应的预结算单');
|
this.$message.warning('未找到对应的预付结算单');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.openView(row);
|
this.openView(row);
|
||||||
@@ -474,30 +474,30 @@ export default {
|
|||||||
return ['draft', 'returned'].includes(row.approvalStatus);
|
return ['draft', 'returned'].includes(row.approvalStatus);
|
||||||
},
|
},
|
||||||
async handleDelete(row) {
|
async handleDelete(row) {
|
||||||
await this.$confirm('确认删除该预结算草稿?', '提示', { type: 'warning' });
|
await this.$confirm('确认删除该预付结算单草稿?', '提示', { type: 'warning' });
|
||||||
await remove(row.id);
|
await remove(row.id);
|
||||||
this.$message.success('删除成功');
|
this.$message.success('删除成功');
|
||||||
this.loadTable();
|
this.loadTable();
|
||||||
},
|
},
|
||||||
selectedOne(operationName) {
|
selectedOne(operationName) {
|
||||||
if (this.selection.length !== 1) {
|
if (this.selection.length !== 1) {
|
||||||
this.$message.warning(`${operationName}需选择一条预结算单`);
|
this.$message.warning(`${operationName}需选择一条预付结算单`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return this.selection[0];
|
return this.selection[0];
|
||||||
},
|
},
|
||||||
handleAdvanceApplication() {
|
handleAdvanceApplication() {
|
||||||
if (!this.selection.length) {
|
if (!this.selection.length) {
|
||||||
this.$message.warning('请选择需要发起预付申请的预结算单');
|
this.$message.warning('请选择需要发起预付申请的预付结算单');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.selection.some(row => !row.contractId)) {
|
if (this.selection.some(row => !row.contractId)) {
|
||||||
this.$message.warning('所选预结算单缺少合同ID,无法发起预付申请');
|
this.$message.warning('所选预付结算单缺少合同ID,无法发起预付申请');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const contractIds = new Set(this.selection.map(row => String(row.contractId)));
|
const contractIds = new Set(this.selection.map(row => String(row.contractId)));
|
||||||
if (contractIds.size > 1) {
|
if (contractIds.size > 1) {
|
||||||
this.$message.warning('预付申请只能选择同一合同下的预结算单');
|
this.$message.warning('预付申请只能选择同一合同下的预付结算单');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@@ -508,7 +508,7 @@ export default {
|
|||||||
row.formalSettlementNo
|
row.formalSettlementNo
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
this.$message.warning('仅审批通过、未转正式结算的应付预结算单可发起预付');
|
this.$message.warning('仅审批通过、未转付款结算的应付预付结算单可发起预付');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const sourcePreSettlements = this.selection.map(row => ({
|
const sourcePreSettlements = this.selection.map(row => ({
|
||||||
@@ -533,11 +533,11 @@ export default {
|
|||||||
},
|
},
|
||||||
handleFormalSettlement() {
|
handleFormalSettlement() {
|
||||||
if (!this.selection.length) {
|
if (!this.selection.length) {
|
||||||
this.$message.warning('请选择需要转正式结算的预结算单');
|
this.$message.warning('请选择需要转付款结算的预付结算单');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.selection.some(row => row.approvalStatus !== 'approved')) {
|
if (this.selection.some(row => row.approvalStatus !== 'approved')) {
|
||||||
this.$message.warning('仅审核通过的预结算单可转正式结算');
|
this.$message.warning('仅审核通过的预付结算单可转付款结算');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const hasCompleteProjectIds = this.selection.every(
|
const hasCompleteProjectIds = this.selection.every(
|
||||||
@@ -549,7 +549,7 @@ export default {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (projectKeys.size > 1) {
|
if (projectKeys.size > 1) {
|
||||||
this.$message.warning('尾款结算只能选择同一项目下的预结算单');
|
this.$message.warning('尾款结算只能选择同一项目下的预付结算单');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const transferToken = createSettlementTransfer({
|
const transferToken = createSettlementTransfer({
|
||||||
@@ -560,14 +560,20 @@ export default {
|
|||||||
});
|
});
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/settlement/formal-settlement/form',
|
path: '/settlement/formal-settlement/form',
|
||||||
query: { mode: 'add', name: '新增正式结算', transferToken },
|
query: {
|
||||||
|
mode: 'add',
|
||||||
|
name: '新增付款结算单',
|
||||||
|
settlementType: 'payable',
|
||||||
|
listPath: '/settlement/payment-settlement',
|
||||||
|
transferToken,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async openPrintDialog() {
|
async openPrintDialog() {
|
||||||
const row = this.selectedOne('打印结算单');
|
const row = this.selectedOne('打印结算单');
|
||||||
if (!row) return;
|
if (!row) return;
|
||||||
if (row.approvalStatus === 'voided') {
|
if (row.approvalStatus === 'voided') {
|
||||||
this.$message.warning('已作废的预结算单不能打印');
|
this.$message.warning('已作废的预付结算单不能打印');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.printDialog.row = row;
|
this.printDialog.row = row;
|
||||||
@@ -622,8 +628,8 @@ export default {
|
|||||||
)
|
)
|
||||||
.join('');
|
.join('');
|
||||||
return `<!doctype html><html><head><meta charset="utf-8"><title>${this.escapeHtml(
|
return `<!doctype html><html><head><meta charset="utf-8"><title>${this.escapeHtml(
|
||||||
detail.preSettlementNo || '预结算单'
|
detail.preSettlementNo || '预付结算单'
|
||||||
)}</title><style>body{font-family:Arial,"Microsoft YaHei",sans-serif;color:#222;padding:28px}h1{text-align:center;font-size:24px}.meta{display:grid;grid-template-columns:repeat(3,1fr);gap:14px 24px;margin:24px 0}.meta div{border-bottom:1px solid #ddd;padding:7px 0}table{width:100%;border-collapse:collapse;margin-top:16px}th,td{border:1px solid #bbb;padding:9px;text-align:center;font-size:13px}th{background:#f5f5f5}.actions{text-align:center;margin-top:24px}@media print{.actions{display:none}}</style></head><body><h1>预结算单</h1><div class="meta"><div>预结算单号:${this.escapeHtml(
|
)}</title><style>body{font-family:Arial,"Microsoft YaHei",sans-serif;color:#222;padding:28px}h1{text-align:center;font-size:24px}.meta{display:grid;grid-template-columns:repeat(3,1fr);gap:14px 24px;margin:24px 0}.meta div{border-bottom:1px solid #ddd;padding:7px 0}table{width:100%;border-collapse:collapse;margin-top:16px}th,td{border:1px solid #bbb;padding:9px;text-align:center;font-size:13px}th{background:#f5f5f5}.actions{text-align:center;margin-top:24px}@media print{.actions{display:none}}</style></head><body><h1>预付结算单</h1><div class="meta"><div>预付结算单号:${this.escapeHtml(
|
||||||
detail.preSettlementNo
|
detail.preSettlementNo
|
||||||
)}</div><div>项目名称:${this.escapeHtml(
|
)}</div><div>项目名称:${this.escapeHtml(
|
||||||
detail.projectName
|
detail.projectName
|
||||||
@@ -651,7 +657,7 @@ export default {
|
|||||||
const params = this.buildQuery();
|
const params = this.buildQuery();
|
||||||
if (this.selection.length) params.ids = this.selection.map(item => item.id).join(',');
|
if (this.selection.length) params.ids = this.selection.map(item => item.id).join(',');
|
||||||
const { data } = await exportList(params);
|
const { data } = await exportList(params);
|
||||||
downloadFile(data, `预结算单${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`);
|
downloadFile(data, `预付结算单${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`);
|
||||||
},
|
},
|
||||||
async handleSubmit(row) {
|
async handleSubmit(row) {
|
||||||
const previousApprovalStatus = row.approvalStatus || '';
|
const previousApprovalStatus = row.approvalStatus || '';
|
||||||
@@ -668,7 +674,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleMkAudit(row) {
|
handleMkAudit(row) {
|
||||||
if (!row?.id) {
|
if (!row?.id) {
|
||||||
this.$message.warning('预结算单ID为空,无法打开审核页');
|
this.$message.warning('预付结算单ID为空,无法打开审核页');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getMKApprovalUrl({ bizId: String(row.id) })
|
getMKApprovalUrl({ bizId: String(row.id) })
|
||||||
@@ -685,7 +691,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
async handleApprove(row) {
|
async handleApprove(row) {
|
||||||
await this.$confirm('确认审批通过该预结算单?', '提示', { type: 'warning' });
|
await this.$confirm('确认审批通过该预付结算单?', '提示', { type: 'warning' });
|
||||||
await approve({ id: row.id });
|
await approve({ id: row.id });
|
||||||
this.$message.success('审批通过');
|
this.$message.success('审批通过');
|
||||||
this.loadTable();
|
this.loadTable();
|
||||||
@@ -700,7 +706,7 @@ export default {
|
|||||||
this.loadTable();
|
this.loadTable();
|
||||||
},
|
},
|
||||||
async handleVoid(row) {
|
async handleVoid(row) {
|
||||||
const { value } = await this.$prompt('请输入作废原因', '作废预结算单', {
|
const { value } = await this.$prompt('请输入作废原因', '作废预付结算单', {
|
||||||
inputType: 'textarea',
|
inputType: 'textarea',
|
||||||
inputValidator: value => Boolean(value?.trim()) || '请输入作废原因',
|
inputValidator: value => Boolean(value?.trim()) || '请输入作废原因',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<template>
|
||||||
|
<formal-settlement locked-settlement-type="receivable" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import FormalSettlement from './formal-settlement.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ReceiptSettlement',
|
||||||
|
components: { FormalSettlement },
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -54,9 +54,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
|
ref="mainTableRef"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="rows"
|
:data="rows"
|
||||||
:size="tableSize"
|
:size="tableSize"
|
||||||
|
:height="listTableHeight"
|
||||||
border
|
border
|
||||||
class="settlement-detail-page__table"
|
class="settlement-detail-page__table"
|
||||||
@selection-change="selectionChange"
|
@selection-change="selectionChange"
|
||||||
@@ -146,7 +148,21 @@
|
|||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ formatFeeDetailCell(row, column.prop) }}
|
<div
|
||||||
|
v-if="isFreightFeeColumn(column)"
|
||||||
|
class="settlement-detail-page__billing-rule-cell"
|
||||||
|
>
|
||||||
|
<span>{{ formatFeeDetailCell(row, column.prop) }}</span>
|
||||||
|
<el-icon
|
||||||
|
v-if="hasBillingRule(row)"
|
||||||
|
class="settlement-detail-page__billing-rule-icon"
|
||||||
|
title="查看计费规则详情"
|
||||||
|
@click.stop="openBillingRuleInfo(row)"
|
||||||
|
>
|
||||||
|
<InfoFilled />
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
<span v-else>{{ formatFeeDetailCell(row, column.prop) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -934,11 +950,70 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
v-model="billingRuleDialog.visible"
|
||||||
|
title="计费规则详情"
|
||||||
|
width="720px"
|
||||||
|
append-to-body
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<template v-if="billingRuleDialog.rule">
|
||||||
|
<div class="dialog-section-title">计费规则</div>
|
||||||
|
<el-descriptions :column="2" border class="settlement-detail-page__billing-rule-detail">
|
||||||
|
<el-descriptions-item label="费用项">
|
||||||
|
{{ displayValue(billingRuleDialog.rule.feeItem) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="计费要素">
|
||||||
|
{{ displayValue(billingRuleDialog.rule.billingElement) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="计费类型">
|
||||||
|
{{ displayValue(billingRuleDialog.rule.billingType) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="计费单位">
|
||||||
|
{{ displayValue(billingRuleDialog.rule.billingUnit) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="单价">
|
||||||
|
{{ displayValue(billingRuleDialog.rule.unitPrice) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="最低计费量">
|
||||||
|
{{ displayValue(billingRuleDialog.rule.minimumBillingWeight) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="计费区间">
|
||||||
|
{{ billingRuleRanges(billingRuleDialog.rule) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="备注" :span="2">
|
||||||
|
{{ displayValue(billingRuleDialog.rule.remark) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<div class="dialog-section-title settlement-detail-page__billing-rule-match-title">
|
||||||
|
匹配条件
|
||||||
|
</div>
|
||||||
|
<el-descriptions :column="2" border class="settlement-detail-page__billing-rule-detail">
|
||||||
|
<el-descriptions-item label="起运地">
|
||||||
|
{{ displayValue(billingRuleDialog.rule.matchCondition.origin) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="目的地">
|
||||||
|
{{ displayValue(billingRuleDialog.rule.matchCondition.destination) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="货物名称">
|
||||||
|
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoName) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="货物类型">
|
||||||
|
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoType) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</template>
|
||||||
|
<el-empty v-else description="暂无计费规则详情" />
|
||||||
|
<template #footer>
|
||||||
|
<el-button type="primary" @click="billingRuleDialog.visible = false">关闭</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</basic-container>
|
</basic-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ArrowDown, ArrowUp, Close } from '@element-plus/icons-vue';
|
import { ArrowDown, ArrowUp, Close, InfoFilled } from '@element-plus/icons-vue';
|
||||||
import {
|
import {
|
||||||
changeRecordColumns,
|
changeRecordColumns,
|
||||||
feeDetailBaseColumns,
|
feeDetailBaseColumns,
|
||||||
@@ -990,7 +1065,7 @@ const ADJUST_BILLING_TYPE_MAP = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { SettlementTableTools },
|
components: { SettlementTableTools, InfoFilled },
|
||||||
props: {
|
props: {
|
||||||
settlementType: {
|
settlementType: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -1002,6 +1077,7 @@ export default {
|
|||||||
ArrowDown,
|
ArrowDown,
|
||||||
ArrowUp,
|
ArrowUp,
|
||||||
Close,
|
Close,
|
||||||
|
InfoFilled,
|
||||||
searchFields,
|
searchFields,
|
||||||
tableColumns,
|
tableColumns,
|
||||||
tableFeeItemNames: [],
|
tableFeeItemNames: [],
|
||||||
@@ -1018,6 +1094,8 @@ export default {
|
|||||||
rows: [],
|
rows: [],
|
||||||
selection: [],
|
selection: [],
|
||||||
page: { current: 1, size: 10, total: 0 },
|
page: { current: 1, size: 10, total: 0 },
|
||||||
|
// 底部详情/调整面板打开时压缩主表高度,露出表格滚动条
|
||||||
|
listTableHeight: undefined,
|
||||||
detailDialog: {
|
detailDialog: {
|
||||||
visible: false,
|
visible: false,
|
||||||
title: '费用明细',
|
title: '费用明细',
|
||||||
@@ -1027,6 +1105,10 @@ export default {
|
|||||||
},
|
},
|
||||||
feeRows: [],
|
feeRows: [],
|
||||||
dynamicFeeColumns: [],
|
dynamicFeeColumns: [],
|
||||||
|
billingRuleDialog: {
|
||||||
|
visible: false,
|
||||||
|
rule: null,
|
||||||
|
},
|
||||||
adjustDialog: { visible: false, loading: false, submitting: false, row: null },
|
adjustDialog: { visible: false, loading: false, submitting: false, row: null },
|
||||||
adjustRows: [],
|
adjustRows: [],
|
||||||
adjustDynamicFeeColumns: [],
|
adjustDynamicFeeColumns: [],
|
||||||
@@ -1210,11 +1292,28 @@ export default {
|
|||||||
transportCargoTypeOptions() {
|
transportCargoTypeOptions() {
|
||||||
return this.cargoTypeOptions.filter(item => item.children?.length);
|
return this.cargoTypeOptions.filter(item => item.children?.length);
|
||||||
},
|
},
|
||||||
|
/** 底部单据详情或调整面板是否展开(与 teleport 面板显示条件一致) */
|
||||||
|
isBottomPanelOpen() {
|
||||||
|
return Boolean(this.detailDialog.visible || this.adjustDialog.visible);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route.fullPath'() {
|
'$route.fullPath'() {
|
||||||
this.openRouteDetail();
|
this.openRouteDetail();
|
||||||
},
|
},
|
||||||
|
isBottomPanelOpen() {
|
||||||
|
this.$nextTick(() => this.updateListTableHeight());
|
||||||
|
},
|
||||||
|
searchVisible() {
|
||||||
|
if (this.isBottomPanelOpen) {
|
||||||
|
this.$nextTick(() => this.updateListTableHeight());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
searchExpanded() {
|
||||||
|
if (this.isBottomPanelOpen) {
|
||||||
|
this.$nextTick(() => this.updateListTableHeight());
|
||||||
|
}
|
||||||
|
},
|
||||||
displayTableColumns: {
|
displayTableColumns: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(columns) {
|
handler(columns) {
|
||||||
@@ -1238,6 +1337,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
window.addEventListener('resize', this.updateListTableHeight);
|
||||||
this.loadTransportTypeOptions();
|
this.loadTransportTypeOptions();
|
||||||
this.loadCargoTypeOptions();
|
this.loadCargoTypeOptions();
|
||||||
this.loadPriceUnitOptions();
|
this.loadPriceUnitOptions();
|
||||||
@@ -1249,6 +1349,7 @@ export default {
|
|||||||
this.closeInnerDialogs();
|
this.closeInnerDialogs();
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
|
window.removeEventListener('resize', this.updateListTableHeight);
|
||||||
this.closeInnerDialogs();
|
this.closeInnerDialogs();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -1262,6 +1363,26 @@ export default {
|
|||||||
this.previewDialog.visible = false;
|
this.previewDialog.visible = false;
|
||||||
this.generateContractDialog.visible = false;
|
this.generateContractDialog.visible = false;
|
||||||
},
|
},
|
||||||
|
/** 底部面板打开时按剩余视口压缩主表高度,关闭后恢复自适应 */
|
||||||
|
updateListTableHeight() {
|
||||||
|
if (!this.isBottomPanelOpen) {
|
||||||
|
this.listTableHeight = undefined;
|
||||||
|
this.$nextTick(() => this.$refs.mainTableRef?.doLayout?.());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const tablePanel = this.$el?.querySelector?.('.settlement-detail-page__table-panel');
|
||||||
|
const toolbar = tablePanel?.querySelector('.settlement-detail-page__toolbar');
|
||||||
|
const pagination = tablePanel?.querySelector('.settlement-detail-page__pagination');
|
||||||
|
const panelTop = tablePanel?.getBoundingClientRect?.()?.top ?? 200;
|
||||||
|
const toolbarHeight = toolbar?.offsetHeight ?? 56;
|
||||||
|
const paginationHeight = pagination?.offsetHeight ?? 64;
|
||||||
|
// 与 .settlement-detail-page__detail-panel 的 max-height: min(60vh, 560px) 对齐
|
||||||
|
const bottomPanelHeight = Math.min(window.innerHeight * 0.6, 560);
|
||||||
|
const available =
|
||||||
|
window.innerHeight - panelTop - toolbarHeight - paginationHeight - bottomPanelHeight - 8;
|
||||||
|
this.listTableHeight = Math.max(180, Math.floor(available));
|
||||||
|
this.$nextTick(() => this.$refs.mainTableRef?.doLayout?.());
|
||||||
|
},
|
||||||
contractCategoryName(value) {
|
contractCategoryName(value) {
|
||||||
return (
|
return (
|
||||||
this.contractCategoryOptions.find(item => String(item.value) === String(value))?.label ||
|
this.contractCategoryOptions.find(item => String(item.value) === String(value))?.label ||
|
||||||
@@ -1690,6 +1811,8 @@ export default {
|
|||||||
this.detailDialog.visible = false;
|
this.detailDialog.visible = false;
|
||||||
this.detailDialog.row = null;
|
this.detailDialog.row = null;
|
||||||
this.changeRecordsDialog.visible = false;
|
this.changeRecordsDialog.visible = false;
|
||||||
|
this.billingRuleDialog.visible = false;
|
||||||
|
this.billingRuleDialog.rule = null;
|
||||||
},
|
},
|
||||||
closeAdjustPanel() {
|
closeAdjustPanel() {
|
||||||
this.clearAdjustCalculations();
|
this.clearAdjustCalculations();
|
||||||
@@ -1934,6 +2057,108 @@ export default {
|
|||||||
isFreightFeeItem(name) {
|
isFreightFeeItem(name) {
|
||||||
return String(name || '').includes('运费') || String(name || '').includes('运输费');
|
return String(name || '').includes('运费') || String(name || '').includes('运输费');
|
||||||
},
|
},
|
||||||
|
isFreightFeeColumn(column = {}) {
|
||||||
|
return (
|
||||||
|
column.prop === 'freightAmount' ||
|
||||||
|
this.isFreightFeeItem(column.label) ||
|
||||||
|
this.isFreightFeeItem(column.feeItemName)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
hasBillingRule(row) {
|
||||||
|
const rule = this.normalizeBillingRule(row);
|
||||||
|
return Boolean(
|
||||||
|
rule.feeItem ||
|
||||||
|
rule.billingElement ||
|
||||||
|
rule.billingType ||
|
||||||
|
rule.unitPrice ||
|
||||||
|
rule.rules?.length ||
|
||||||
|
rule.matchCondition?.origin ||
|
||||||
|
rule.matchCondition?.destination ||
|
||||||
|
rule.matchCondition?.cargoName ||
|
||||||
|
rule.matchCondition?.cargoType
|
||||||
|
);
|
||||||
|
},
|
||||||
|
openBillingRuleInfo(row) {
|
||||||
|
this.billingRuleDialog.rule = this.normalizeBillingRule(row);
|
||||||
|
this.billingRuleDialog.visible = true;
|
||||||
|
},
|
||||||
|
normalizeBillingRule(row) {
|
||||||
|
const source = row || {};
|
||||||
|
const nested = [
|
||||||
|
source.billingRule,
|
||||||
|
source.billingRuleInfo,
|
||||||
|
source.billingRuleJson,
|
||||||
|
source.billingRulesJson,
|
||||||
|
source.billingRules,
|
||||||
|
source.billingPlanRule,
|
||||||
|
source.feeRule,
|
||||||
|
source.rule,
|
||||||
|
].find(value => value !== undefined && value !== null && value !== '');
|
||||||
|
const parsedNested = this.parseJsonValue(nested);
|
||||||
|
const matchedRules = Array.isArray(parsedNested)
|
||||||
|
? parsedNested.filter(item => item && typeof item === 'object')
|
||||||
|
: [];
|
||||||
|
let rule = this.parseObject(matchedRules[0] || parsedNested || nested);
|
||||||
|
if (!Object.keys(rule).length && typeof nested === 'string') rule = { name: nested };
|
||||||
|
const matchCondition = this.parseObject(
|
||||||
|
source.matchCondition ?? source.billingMatchCondition ?? rule.matchCondition
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...rule,
|
||||||
|
feeItem: source.billingFeeItem || source.feeItem || rule.feeItem,
|
||||||
|
billingElement:
|
||||||
|
source.billingElement ||
|
||||||
|
source.billingFactor ||
|
||||||
|
rule.billingElement ||
|
||||||
|
rule.billingFactor,
|
||||||
|
billingType: source.billingType || rule.billingType,
|
||||||
|
billingUnit: source.billingUnit || source.priceUnit || rule.billingUnit || rule.priceUnit,
|
||||||
|
unitPrice: source.billingUnitPrice ?? source.unitPrice ?? rule.unitPrice,
|
||||||
|
minimumBillingWeight:
|
||||||
|
source.minimumBillingWeight ?? rule.minimumBillingWeight ?? rule.lowerLimit,
|
||||||
|
remark: source.billingRuleRemark || source.ruleRemark || rule.remark,
|
||||||
|
rules: matchedRules,
|
||||||
|
matchCondition: {
|
||||||
|
...matchCondition,
|
||||||
|
origin: matchCondition.origin || matchCondition.originName,
|
||||||
|
destination: matchCondition.destination || matchCondition.destinationName,
|
||||||
|
cargoName:
|
||||||
|
matchCondition.cargoName ||
|
||||||
|
matchCondition.cargoNameLabel ||
|
||||||
|
source.cargoName ||
|
||||||
|
rule.cargoName,
|
||||||
|
cargoType: matchCondition.cargoType || matchCondition.cargoTypeName,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
billingRuleRanges(rule) {
|
||||||
|
const ranges = Array.isArray(rule?.limitRanges) ? rule.limitRanges : [];
|
||||||
|
if (ranges.length) {
|
||||||
|
return ranges
|
||||||
|
.map(
|
||||||
|
item => `${item.lowerLimit ?? '-'}~${item.upperLimit ?? '-'}:${item.unitPrice ?? '-'}`
|
||||||
|
)
|
||||||
|
.join(';');
|
||||||
|
}
|
||||||
|
if (rule?.lowerLimit !== undefined || rule?.upperLimit !== undefined) {
|
||||||
|
return `${rule.lowerLimit ?? '-'}~${rule.upperLimit ?? '-'}`;
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
},
|
||||||
|
parseJsonValue(value) {
|
||||||
|
if (value === undefined || value === null || value === '') return null;
|
||||||
|
if (typeof value === 'object') return value;
|
||||||
|
if (typeof value !== 'string') return value;
|
||||||
|
try {
|
||||||
|
return JSON.parse(value);
|
||||||
|
} catch (error) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
parseObject(value) {
|
||||||
|
const parsed = this.parseJsonValue(value);
|
||||||
|
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
|
||||||
|
},
|
||||||
async saveAdjustFee() {
|
async saveAdjustFee() {
|
||||||
if (!this.adjustRows.length || !this.adjustDialog.row) {
|
if (!this.adjustRows.length || !this.adjustDialog.row) {
|
||||||
this.$message.warning('没有可调整的费用明细');
|
this.$message.warning('没有可调整的费用明细');
|
||||||
@@ -3011,6 +3236,28 @@ export default {
|
|||||||
padding-top: 16px;
|
padding-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settlement-detail-page__billing-rule-cell {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 6px;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settlement-detail-page__billing-rule-icon {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settlement-detail-page__billing-rule-detail {
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settlement-detail-page__billing-rule-match-title {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 992px) {
|
@media screen and (max-width: 992px) {
|
||||||
.settlement-detail-page__detail-panel {
|
.settlement-detail-page__detail-panel {
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|||||||
+101
-35
@@ -153,7 +153,12 @@
|
|||||||
/>
|
/>
|
||||||
<div class="oa-sync-meta" v-if="oaSyncStage === 'clear'">当前阶段:{{ oaSyncStageLabel }}</div>
|
<div class="oa-sync-meta" v-if="oaSyncStage === 'clear'">当前阶段:{{ oaSyncStageLabel }}</div>
|
||||||
<div class="oa-sync-meta" v-else>
|
<div class="oa-sync-meta" v-else>
|
||||||
当前阶段:{{ oaSyncStageLabel }},第 {{ oaSyncProgress.current || 0 }} / {{ oaSyncTotalPage }} 页
|
当前阶段:{{ oaSyncStageLabel }}
|
||||||
|
<template v-if="oaSyncStage === 'department' && oaSyncProgress.companyTotal">
|
||||||
|
,公司 {{ oaSyncProgress.companyIndex || 0 }} / {{ oaSyncProgress.companyTotal }}
|
||||||
|
<template v-if="oaSyncProgress.companyOaId">(oaId={{ oaSyncProgress.companyOaId }})</template>
|
||||||
|
</template>
|
||||||
|
,第 {{ oaSyncProgress.current || 0 }} / {{ oaSyncTotalPage }} 页
|
||||||
</div>
|
</div>
|
||||||
<div class="oa-sync-stats">
|
<div class="oa-sync-stats">
|
||||||
<div class="oa-sync-stat">
|
<div class="oa-sync-stat">
|
||||||
@@ -257,6 +262,9 @@ export default {
|
|||||||
synced: 0,
|
synced: 0,
|
||||||
skipped: 0,
|
skipped: 0,
|
||||||
dumpFilePath: '',
|
dumpFilePath: '',
|
||||||
|
companyOaId: '',
|
||||||
|
companyIndex: 0,
|
||||||
|
companyTotal: 0,
|
||||||
},
|
},
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
page: {
|
page: {
|
||||||
@@ -290,7 +298,9 @@ export default {
|
|||||||
{
|
{
|
||||||
label: '组织名称',
|
label: '组织名称',
|
||||||
prop: 'deptName',
|
prop: 'deptName',
|
||||||
minWidth: 160,
|
minWidth: 320,
|
||||||
|
align: 'left',
|
||||||
|
headerAlign: 'left',
|
||||||
order: 80,
|
order: 80,
|
||||||
search: true,
|
search: true,
|
||||||
searchOrder: 2,
|
searchOrder: 2,
|
||||||
@@ -642,12 +652,18 @@ export default {
|
|||||||
}
|
}
|
||||||
const totalPage = this.oaSyncTotalPage;
|
const totalPage = this.oaSyncTotalPage;
|
||||||
const current = Number(this.oaSyncProgress.current) || 0;
|
const current = Number(this.oaSyncProgress.current) || 0;
|
||||||
const stageBase = this.oaSyncStage === 'department' ? 50 : 0;
|
if (this.oaSyncStage === 'department') {
|
||||||
if (totalPage <= 0) {
|
const companyTotal = Math.max(1, Number(this.oaSyncProgress.companyTotal) || 1);
|
||||||
return stageBase;
|
const companyIndex = Math.max(1, Number(this.oaSyncProgress.companyIndex) || 1);
|
||||||
|
const companyBase = ((companyIndex - 1) / companyTotal) * 50;
|
||||||
|
const pageRatio = totalPage > 0 ? Math.min(1, current / totalPage) : 0;
|
||||||
|
const companyPagePercent = (pageRatio * 50) / companyTotal;
|
||||||
|
return Math.min(99, Math.round(50 + companyBase + companyPagePercent));
|
||||||
}
|
}
|
||||||
const stagePercent = Math.min(50, Math.round((current / totalPage) * 50));
|
if (totalPage <= 0) {
|
||||||
return Math.min(99, stageBase + stagePercent);
|
return 0;
|
||||||
|
}
|
||||||
|
return Math.min(49, Math.round((current / totalPage) * 50));
|
||||||
},
|
},
|
||||||
oaSyncProgressStatus() {
|
oaSyncProgressStatus() {
|
||||||
if (this.oaSyncStatus === 'done') {
|
if (this.oaSyncStatus === 'done') {
|
||||||
@@ -661,25 +677,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleOaOrgFullSync() {
|
handleOaOrgFullSync() {
|
||||||
this.$confirm(
|
this.startOaOrgSync({ clearNonTop: false, incremental: false });
|
||||||
'全量同步将拉取 OA 公司/部门(仅保留二级公司 oaId=2、135 及其子公司与部门);已存在且 OA 更新时间一致的记录会跳过。是否清除后同步?选择“是”将保留顶级「外部组织」与集团锚点(id=1/GWWL),删除其余组织后再同步;选择“否”则直接全量同步。',
|
|
||||||
'全量同步',
|
|
||||||
{
|
|
||||||
confirmButtonText: '是',
|
|
||||||
cancelButtonText: '否',
|
|
||||||
distinguishCancelAndClose: true,
|
|
||||||
closeOnClickModal: false,
|
|
||||||
type: 'warning',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.then(() => {
|
|
||||||
this.startOaOrgSync({ clearNonTop: true, incremental: false });
|
|
||||||
})
|
|
||||||
.catch(action => {
|
|
||||||
if (action === 'cancel') {
|
|
||||||
this.startOaOrgSync({ clearNonTop: false, incremental: false });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
handleOaOrgIncrementalSync() {
|
handleOaOrgIncrementalSync() {
|
||||||
this.$confirm(
|
this.$confirm(
|
||||||
@@ -714,6 +712,9 @@ export default {
|
|||||||
synced: 0,
|
synced: 0,
|
||||||
skipped: 0,
|
skipped: 0,
|
||||||
dumpFilePath: '',
|
dumpFilePath: '',
|
||||||
|
companyOaId: '',
|
||||||
|
companyIndex: 0,
|
||||||
|
companyTotal: 0,
|
||||||
};
|
};
|
||||||
this.runOaOrgSyncPages();
|
this.runOaOrgSyncPages();
|
||||||
},
|
},
|
||||||
@@ -725,6 +726,25 @@ export default {
|
|||||||
error?.name === 'AbortError'
|
error?.name === 'AbortError'
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
applyOaOrgSyncPage(page, current, size) {
|
||||||
|
this.oaSyncProgress.current = page.current || current;
|
||||||
|
this.oaSyncProgress.size = page.size || size;
|
||||||
|
this.oaSyncProgress.total = page.total || 0;
|
||||||
|
this.oaSyncProgress.synced += page.syncedCount || 0;
|
||||||
|
this.oaSyncProgress.skipped += page.skippedCount || 0;
|
||||||
|
if (page.dumpFilePath) {
|
||||||
|
this.oaSyncProgress.dumpFilePath = page.dumpFilePath;
|
||||||
|
}
|
||||||
|
if (page.companyOaId != null) {
|
||||||
|
this.oaSyncProgress.companyOaId = page.companyOaId || '';
|
||||||
|
}
|
||||||
|
if (page.companyIndex != null) {
|
||||||
|
this.oaSyncProgress.companyIndex = page.companyIndex || 0;
|
||||||
|
}
|
||||||
|
if (page.companyTotal != null) {
|
||||||
|
this.oaSyncProgress.companyTotal = page.companyTotal || 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
async runOaOrgSyncStage(syncApi) {
|
async runOaOrgSyncStage(syncApi) {
|
||||||
const size = 20;
|
const size = 20;
|
||||||
const incremental = this.oaSyncMode === 'incremental';
|
const incremental = this.oaSyncMode === 'incremental';
|
||||||
@@ -742,20 +762,57 @@ export default {
|
|||||||
if (!modifiedSince && page.modifiedSince) {
|
if (!modifiedSince && page.modifiedSince) {
|
||||||
modifiedSince = page.modifiedSince;
|
modifiedSince = page.modifiedSince;
|
||||||
}
|
}
|
||||||
this.oaSyncProgress.current = page.current || current;
|
this.applyOaOrgSyncPage(page, current, size);
|
||||||
this.oaSyncProgress.size = page.size || size;
|
|
||||||
this.oaSyncProgress.total = page.total || 0;
|
|
||||||
this.oaSyncProgress.synced += page.syncedCount || 0;
|
|
||||||
this.oaSyncProgress.skipped += page.skippedCount || 0;
|
|
||||||
if (page.dumpFilePath) {
|
|
||||||
this.oaSyncProgress.dumpFilePath = page.dumpFilePath;
|
|
||||||
}
|
|
||||||
if (page.finished) {
|
if (page.finished) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
current += 1;
|
current += 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 部门阶段:公司同步完成后,按公司 oaId 轮询;当前公司部门拉完后切换下一公司并重置页码
|
||||||
|
*/
|
||||||
|
async runOaOrgDepartmentSyncStage() {
|
||||||
|
const size = 20;
|
||||||
|
const incremental = this.oaSyncMode === 'incremental';
|
||||||
|
let current = 1;
|
||||||
|
let modifiedSince = '';
|
||||||
|
let companyOaId = '';
|
||||||
|
while (!this.oaSyncCancelled) {
|
||||||
|
const res = await syncOaDepartment(
|
||||||
|
current,
|
||||||
|
size,
|
||||||
|
this.oaSyncController?.signal,
|
||||||
|
incremental,
|
||||||
|
modifiedSince,
|
||||||
|
companyOaId
|
||||||
|
);
|
||||||
|
const page = res?.data?.data || {};
|
||||||
|
if (!modifiedSince && page.modifiedSince) {
|
||||||
|
modifiedSince = page.modifiedSince;
|
||||||
|
}
|
||||||
|
if (page.companyOaId) {
|
||||||
|
companyOaId = page.companyOaId;
|
||||||
|
}
|
||||||
|
this.applyOaOrgSyncPage(page, current, size);
|
||||||
|
if (page.finished) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (page.companyFinished && page.nextCompanyOaId) {
|
||||||
|
companyOaId = page.nextCompanyOaId;
|
||||||
|
current = 1;
|
||||||
|
this.oaSyncProgress.current = 0;
|
||||||
|
this.oaSyncProgress.total = 0;
|
||||||
|
// 单公司部门拉完并重建层级后刷新树,便于中途核对挂载结果
|
||||||
|
this.parentId = 0;
|
||||||
|
this.data = [];
|
||||||
|
this.$refs.crud?.refreshTable?.();
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
current += 1;
|
||||||
|
}
|
||||||
|
},
|
||||||
async runOaOrgSyncPages() {
|
async runOaOrgSyncPages() {
|
||||||
try {
|
try {
|
||||||
if (this.oaSyncClearNonTop) {
|
if (this.oaSyncClearNonTop) {
|
||||||
@@ -775,7 +832,10 @@ export default {
|
|||||||
this.oaSyncStage = 'department';
|
this.oaSyncStage = 'department';
|
||||||
this.oaSyncProgress.current = 0;
|
this.oaSyncProgress.current = 0;
|
||||||
this.oaSyncProgress.total = 0;
|
this.oaSyncProgress.total = 0;
|
||||||
await this.runOaOrgSyncStage(syncOaDepartment);
|
this.oaSyncProgress.companyOaId = '';
|
||||||
|
this.oaSyncProgress.companyIndex = 0;
|
||||||
|
this.oaSyncProgress.companyTotal = 0;
|
||||||
|
await this.runOaOrgDepartmentSyncStage();
|
||||||
if (this.oaSyncCancelled) {
|
if (this.oaSyncCancelled) {
|
||||||
this.oaSyncStatus = 'cancelled';
|
this.oaSyncStatus = 'cancelled';
|
||||||
return;
|
return;
|
||||||
@@ -1460,6 +1520,12 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
/* 覆盖全站表格居中:树形组织名称需左对齐,展开后缩进才可读 */
|
||||||
|
:deep(.el-table th.el-table__cell.is-left .cell),
|
||||||
|
:deep(.el-table td.el-table__cell.is-left .cell) {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
.carrier-search-form {
|
.carrier-search-form {
|
||||||
padding: 12px 12px 4px;
|
padding: 12px 12px 4px;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||||
|
|||||||
Reference in New Issue
Block a user