Merge remote-tracking branch 'origin/master' into feature/hcs-api-p0-web
This commit is contained in:
@@ -6,17 +6,17 @@ export const getList = (current, size, params) =>
|
||||
request({ url: `${baseUrl}/list`, method: 'get', params: { current, size, ...params } });
|
||||
export const getDetail = id => request({ url: `${baseUrl}/detail`, method: 'get', params: { id } });
|
||||
export const getExpiryCounts = () => request({ url: `${baseUrl}/expiry-counts`, method: 'get' });
|
||||
export const getAvailableOptions = (keyword, deptId, selectedId) =>
|
||||
export const getAvailableOptions = (keyword, deptId, selectedId, payerName, payeeName) =>
|
||||
request({
|
||||
url: `${baseUrl}/available-options`,
|
||||
method: 'get',
|
||||
params: { keyword, deptId, selectedId },
|
||||
params: { keyword, deptId, selectedId, payerName, payeeName },
|
||||
});
|
||||
export const getAvailablePage = (current, size, keyword, deptId, selectedId) =>
|
||||
export const getAvailablePage = (current, size, keyword, deptId, selectedId, payerName, payeeName) =>
|
||||
request({
|
||||
url: `${baseUrl}/available-page`,
|
||||
method: 'get',
|
||||
params: { current, size, keyword, deptId, selectedId },
|
||||
params: { current, size, keyword, deptId, selectedId, payerName, payeeName },
|
||||
});
|
||||
export const submit = data => request({ url: `${baseUrl}/submit`, method: 'post', data });
|
||||
export const remove = id => request({ url: `${baseUrl}/remove`, method: 'post', params: { id } });
|
||||
|
||||
@@ -10,6 +10,13 @@ export const getReferenceAmount = (paymentType, referenceId, excludeId) =>
|
||||
method: 'get',
|
||||
params: { paymentType, referenceId, excludeId: excludeId || undefined },
|
||||
});
|
||||
/** 按合同查询可选项目预付核销列表(审批通过且仍有可核销余额) */
|
||||
export const getProjectAdvanceWriteOffOptions = params =>
|
||||
request({
|
||||
url: `${baseUrl}/project-advance-write-off-options`,
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
export const save = data => request({ url: `${baseUrl}/save`, method: 'post', data });
|
||||
export const remove = id => request({ url: `${baseUrl}/remove`, method: 'post', params: { id } });
|
||||
export const submit = data => request({ url: `${baseUrl}/submit`, method: 'post', data });
|
||||
|
||||
@@ -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 voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data });
|
||||
// 同步金蝶涉及多次金蝶远程接口调用(A102-4 预检 + A102-2 保存),可达 20s+,覆盖全局 10s 超时
|
||||
export const syncKingdee = id =>
|
||||
request({ url: `${baseUrl}/sync-kingdee`, method: 'post', timeout: 30000, params: { id } });
|
||||
// config.meta.suppressErrorMessage=true 时由页面弹框汇总结果,避免拦截器重复 toast
|
||||
export const syncKingdee = (id, config = {}) =>
|
||||
request({
|
||||
url: `${baseUrl}/sync-kingdee`,
|
||||
method: 'post',
|
||||
timeout: 30000,
|
||||
params: { id },
|
||||
...config,
|
||||
});
|
||||
export const getDetailFees = detailId =>
|
||||
request({ url: `${baseUrl}/detail-fees`, method: 'get', params: { detailId } });
|
||||
export const getReceiptClaims = formalSettlementId =>
|
||||
|
||||
@@ -24,6 +24,8 @@ export const getContractList = (current, size, params) =>
|
||||
|
||||
export const getFeeOptions = () => request({ url: `${baseUrl}/fee-options`, method: 'get' });
|
||||
|
||||
export const getNextNo = () => request({ url: `${baseUrl}/next-no`, method: 'get' });
|
||||
|
||||
export const getCandidateDetails = (current, size, params) =>
|
||||
request({
|
||||
url: `${baseUrl}/candidate-details`,
|
||||
|
||||
@@ -17,6 +17,10 @@ export const approve = id => request({ url: `${baseUrl}/approve`, method: 'post'
|
||||
export const returnBill = (id, reason) =>
|
||||
request({ url: `${baseUrl}/return`, method: 'post', data: { id, reason } });
|
||||
export const repush = id => request({ url: `${baseUrl}/repush`, method: 'post', params: { id } });
|
||||
export const syncKingdee = id =>
|
||||
request({ url: `${baseUrl}/sync-kingdee`, method: 'post', timeout: 30000, params: { id } });
|
||||
export const kingdeeWriteOffPrecheck = formalSettlementId =>
|
||||
request({ url: `${baseUrl}/kingdee-writeoff-precheck`, method: 'get', params: { formalSettlementId } });
|
||||
|
||||
export const approvalStatusOptions = [
|
||||
{ label: '草稿', value: 'draft' },
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import request from '@/axios';
|
||||
|
||||
const baseUrl = '/blade-transport/settlement-import';
|
||||
|
||||
export const getOptions = () => request({ url: `${baseUrl}/options`, method: 'get' });
|
||||
|
||||
export const getNextCode = () => request({ url: `${baseUrl}/next-code`, method: 'get' });
|
||||
|
||||
export const getList = (current, size, params) =>
|
||||
request({
|
||||
url: `${baseUrl}/list`,
|
||||
method: 'get',
|
||||
params: { current, size, ...params },
|
||||
});
|
||||
|
||||
export const getDetail = id =>
|
||||
request({ url: `${baseUrl}/detail`, method: 'get', params: { id } });
|
||||
|
||||
export const exportTemplate = () =>
|
||||
request({
|
||||
url: `${baseUrl}/export-template`,
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
});
|
||||
|
||||
export const parseFile = file => {
|
||||
const data = new FormData();
|
||||
data.append('file', file);
|
||||
return request({
|
||||
url: `${baseUrl}/parse`,
|
||||
method: 'post',
|
||||
data,
|
||||
timeout: 120000,
|
||||
});
|
||||
};
|
||||
|
||||
export const validate = data =>
|
||||
request({ url: `${baseUrl}/validate`, method: 'post', data, timeout: 120000 });
|
||||
|
||||
export const exportFailures = data =>
|
||||
request({
|
||||
url: `${baseUrl}/export-failures`,
|
||||
method: 'post',
|
||||
data,
|
||||
responseType: 'blob',
|
||||
timeout: 120000,
|
||||
});
|
||||
|
||||
export const saveDraft = data =>
|
||||
request({ url: `${baseUrl}/draft`, method: 'post', data, timeout: 120000 });
|
||||
|
||||
export const confirm = data =>
|
||||
request({ url: `${baseUrl}/confirm`, method: 'post', data, timeout: 120000 });
|
||||
|
||||
export const voidBatch = data => request({ url: `${baseUrl}/void`, method: 'post', data });
|
||||
|
||||
export const removeDraft = id =>
|
||||
request({ url: `${baseUrl}/remove`, method: 'post', params: { id } });
|
||||
|
||||
export const getHistoryWaybills = params =>
|
||||
request({
|
||||
url: `${baseUrl}/history-waybills`,
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
@@ -77,7 +77,8 @@ export const syncOaDepartment = (
|
||||
size = 20,
|
||||
signal,
|
||||
incremental = false,
|
||||
modifiedSince
|
||||
modifiedSince,
|
||||
companyOaId
|
||||
) => {
|
||||
return request({
|
||||
url: '/blade-system/dept/sync-oa-department',
|
||||
@@ -87,6 +88,7 @@ export const syncOaDepartment = (
|
||||
size,
|
||||
incremental: !!incremental,
|
||||
modifiedSince: modifiedSince || undefined,
|
||||
companyOaId: companyOaId || undefined,
|
||||
},
|
||||
timeout: 60000,
|
||||
signal,
|
||||
|
||||
+15
-8
@@ -74,12 +74,15 @@ const redirectToLogin = () => {
|
||||
* 统一弹出错误提示并返回带标记的 Error。
|
||||
* `_notified` 标记用于让业务层(批量导入等)识别「拦截器已经提示过」,
|
||||
* 避免同一条错误被弹两次。
|
||||
* meta.suppressErrorMessage=true 时由业务层自行弹框汇总,拦截器不再 toast。
|
||||
*/
|
||||
const notifiedError = message => {
|
||||
ElMessage({
|
||||
message: message,
|
||||
type: 'error',
|
||||
});
|
||||
const notifiedError = (message, config) => {
|
||||
if (config?.meta?.suppressErrorMessage !== true) {
|
||||
ElMessage({
|
||||
message: message,
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
const error = new Error(message);
|
||||
error._notified = true;
|
||||
return error;
|
||||
@@ -260,12 +263,12 @@ axios.interceptors.response.use(
|
||||
|
||||
// OAuth2 业务错误码提示
|
||||
if (status > 2000 && !validatenull(res.data.error_description)) {
|
||||
return Promise.reject(notifiedError(message));
|
||||
return Promise.reject(notifiedError(message, config));
|
||||
}
|
||||
|
||||
// 其余非 200 响应统一提示
|
||||
if (status !== 200) {
|
||||
return Promise.reject(notifiedError(message));
|
||||
return Promise.reject(notifiedError(message, config));
|
||||
}
|
||||
return res;
|
||||
},
|
||||
@@ -273,7 +276,11 @@ axios.interceptors.response.use(
|
||||
NProgress.done();
|
||||
// 网络级失败(HTTP 状态 >500、网关错误、超时、断网等 validateStatus 放行之外的响应)
|
||||
// 原为静默 reject,接口报错页面无任何感知;统一补错误提示,取消请求与刷新令牌请求除外
|
||||
if (!axios.isCancel(error) && !isRefreshTokenRequest(error?.config)) {
|
||||
if (
|
||||
!axios.isCancel(error) &&
|
||||
!isRefreshTokenRequest(error?.config) &&
|
||||
error?.config?.meta?.suppressErrorMessage !== true
|
||||
) {
|
||||
ElMessage({
|
||||
message: error?.response?.data?.msg || '请求失败,请稍后重试',
|
||||
type: 'error',
|
||||
|
||||
@@ -254,8 +254,8 @@ export const option = createCrudOption([
|
||||
searchOrder: 6,
|
||||
searchPlaceholder: '请输入',
|
||||
order: 185,
|
||||
disabled: true,
|
||||
placeholder: '不填写,则系统自动生成',
|
||||
maxlength: 100,
|
||||
placeholder: '不填写则按部门规则自动生成',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -99,7 +99,8 @@ export const config = {
|
||||
action: 'startChange',
|
||||
label: '变更',
|
||||
statusProp: 'approvalStatus',
|
||||
status: ['approved'],
|
||||
// 立项通过、变更通过后均可再次发起变更
|
||||
status: ['approved', 'change_approved'],
|
||||
permission: 'project_apply_change',
|
||||
},
|
||||
],
|
||||
|
||||
@@ -52,7 +52,8 @@ export const paymentApplicationOption = ({
|
||||
searchShow: true,
|
||||
searchIcon: true,
|
||||
searchLabelWidth: 88,
|
||||
searchMenuSpan: 24,
|
||||
// 查询/重置紧跟首行 4 个条件(4×5 + 菜单 4 = 24),不再独占下一整行
|
||||
searchMenuSpan: 4,
|
||||
searchIndex: 4,
|
||||
searchMenuPosition: 'right',
|
||||
border: true,
|
||||
@@ -78,6 +79,7 @@ export const paymentApplicationOption = ({
|
||||
prop: 'paymentNo',
|
||||
slot: true,
|
||||
search: true,
|
||||
searchSpan: 5,
|
||||
searchOrder: 9,
|
||||
searchPlaceholder: '请输入',
|
||||
minWidth: 150,
|
||||
@@ -88,6 +90,7 @@ export const paymentApplicationOption = ({
|
||||
type: 'daterange',
|
||||
searchType: 'daterange',
|
||||
search: true,
|
||||
searchSpan: 5,
|
||||
searchOrder: 8,
|
||||
hide: true,
|
||||
showColumn: false,
|
||||
@@ -95,18 +98,24 @@ export const paymentApplicationOption = ({
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
},
|
||||
searchOnlyColumn({
|
||||
label: '客户名称',
|
||||
prop: 'payeeNameSearch',
|
||||
searchOrder: 7,
|
||||
searchProp: 'payeeName',
|
||||
}),
|
||||
searchOnlyColumn({
|
||||
label: '项目名称',
|
||||
prop: 'projectNameSearch',
|
||||
searchOrder: 6,
|
||||
searchProp: 'projectName',
|
||||
}),
|
||||
{
|
||||
...searchOnlyColumn({
|
||||
label: '客户名称',
|
||||
prop: 'payeeNameSearch',
|
||||
searchOrder: 7,
|
||||
searchProp: 'payeeName',
|
||||
}),
|
||||
searchSpan: 5,
|
||||
},
|
||||
{
|
||||
...searchOnlyColumn({
|
||||
label: '项目名称',
|
||||
prop: 'projectNameSearch',
|
||||
searchOrder: 6,
|
||||
searchProp: 'projectName',
|
||||
}),
|
||||
searchSpan: 5,
|
||||
},
|
||||
searchOnlyColumn({
|
||||
label: '关联结算单',
|
||||
prop: 'settlementNo',
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
/**
|
||||
* 正式结算单列表(avue-crud)配置
|
||||
* ------------------------------------------------------------------
|
||||
* 列表页与其它模块统一使用 avue-crud,头部 4 个按钮(刷新 / 列显隐 / 搜索显隐 /
|
||||
* 显示方式)由 avue-crud 自带,不做二次封装。
|
||||
*
|
||||
* 表格列复用 formalSettlementTable.js 的 formalSettlementTableColumns(与弹窗内
|
||||
* 明细表共用同一份列定义),此处只补充 avue 需要的展示/搜索属性,避免两处维护。
|
||||
*
|
||||
* ⚠️ searchOrder 为降序排序,值越大越靠前。
|
||||
* ⚠️ 仅用于搜索的列必须 hide + showColumn: false,否则会混进「列显隐」抽屉。
|
||||
* ⚠️ column 数组顺序 = 表格列顺序,搜索专用列统一放在数组最前面。
|
||||
*/
|
||||
|
||||
import {
|
||||
approvalStatusOptions,
|
||||
invoiceStatusOptions,
|
||||
kingdeeSyncStatusOptions,
|
||||
paymentStatusOptions,
|
||||
} from './formalSettlementSearch';
|
||||
import { formalSettlementTableColumns } from './formalSettlementTable';
|
||||
|
||||
const textFormatter = (row, value) =>
|
||||
value === null || value === undefined || value === '' ? '-' : value;
|
||||
|
||||
/** 金额统一展示:两位小数 + 币种 */
|
||||
const moneyFormatter = (row, value) =>
|
||||
`${Number(value || 0).toFixed(2)} ${row?.currency || 'RMB'}`;
|
||||
|
||||
const pickLabel = (options, value) =>
|
||||
options.find(item => item.value === value)?.label || value || '-';
|
||||
|
||||
const searchOnlyColumn = ({ label, prop, searchOrder, type = 'input', dicData }) => {
|
||||
const column = {
|
||||
label,
|
||||
prop,
|
||||
search: true,
|
||||
searchOrder,
|
||||
searchSpan: 5,
|
||||
hide: true,
|
||||
showColumn: false,
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
};
|
||||
if (type === 'select') {
|
||||
column.type = 'select';
|
||||
column.searchPlaceholder = '请选择';
|
||||
column.dicData = dicData || [];
|
||||
} else if (type === 'daterange') {
|
||||
column.type = 'daterange';
|
||||
column.searchType = 'daterange';
|
||||
column.searchPlaceholder = '请选择';
|
||||
} else {
|
||||
column.searchPlaceholder = '请输入';
|
||||
}
|
||||
return column;
|
||||
};
|
||||
|
||||
/** 表格列的 avue 增量配置:搜索项、插槽、覆盖宽度等 */
|
||||
const COLUMN_EXTRA = {
|
||||
formalSettlementNo: {
|
||||
slot: true,
|
||||
search: true,
|
||||
searchSpan: 5,
|
||||
searchOrder: 12,
|
||||
searchPlaceholder: '请输入',
|
||||
},
|
||||
payerName: { search: true, searchSpan: 5, searchOrder: 7, searchPlaceholder: '请输入' },
|
||||
payeeName: { search: true, searchSpan: 5, searchOrder: 6, searchPlaceholder: '请输入' },
|
||||
projectName: { search: true, searchSpan: 5, searchOrder: 11, searchPlaceholder: '请输入' },
|
||||
deptName: { search: true, searchslot: true, searchSpan: 5, searchOrder: 10 },
|
||||
contractNo: { search: true, searchSpan: 5, searchOrder: 9, searchPlaceholder: '请输入' },
|
||||
invoiceStatusName: { slot: true },
|
||||
paymentStatusName: { slot: true },
|
||||
approvalStatusName: { slot: true },
|
||||
adjustFlag: {
|
||||
formatter: row => row.adjustStatusName || (row.originFormalSettlementNo ? '调整后单' : '-'),
|
||||
},
|
||||
kingdeeSyncStatus: {
|
||||
slot: true,
|
||||
search: true,
|
||||
type: 'select',
|
||||
dicData: kingdeeSyncStatusOptions,
|
||||
searchSpan: 5,
|
||||
searchOrder: 2,
|
||||
searchPlaceholder: '请选择',
|
||||
},
|
||||
kingdeeLockStatus: { slot: true },
|
||||
createTime: { width: 180 },
|
||||
};
|
||||
|
||||
const buildTableColumns = () =>
|
||||
formalSettlementTableColumns.map(column => {
|
||||
const extra = { ...(COLUMN_EXTRA[column.prop] || {}) };
|
||||
if (column.money) {
|
||||
extra.formatter = moneyFormatter;
|
||||
extra.align = 'right';
|
||||
}
|
||||
// link / status 标记的列统一走单元格插槽
|
||||
if (column.link || column.status) extra.slot = true;
|
||||
if (!extra.formatter) extra.formatter = textFormatter;
|
||||
return { ...column, ...extra };
|
||||
});
|
||||
|
||||
export const formalSettlementOption = () => ({
|
||||
height: 'auto',
|
||||
calcHeight: 32,
|
||||
tip: false,
|
||||
searchBtnText: '查询',
|
||||
emptyBtnText: '重置',
|
||||
searchShow: true,
|
||||
searchIcon: true,
|
||||
searchLabelWidth: 88,
|
||||
// 查询/重置紧跟首行 4 个条件(4×5 + 菜单 4 = 24),不再独占下一整行
|
||||
searchMenuSpan: 4,
|
||||
searchIndex: 4,
|
||||
searchMenuPosition: 'right',
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: '序号',
|
||||
indexWidth: 64,
|
||||
indexFixed: 'left',
|
||||
selection: true,
|
||||
selectionWidth: 52,
|
||||
selectionFixed: 'left',
|
||||
addBtn: false,
|
||||
viewBtn: false,
|
||||
delBtn: false,
|
||||
editBtn: false,
|
||||
menuWidth: 320,
|
||||
menuFixed: 'right',
|
||||
column: [
|
||||
// ---------- 仅搜索列 ----------
|
||||
searchOnlyColumn({
|
||||
label: '预付结算单号',
|
||||
prop: 'preSettlementNo',
|
||||
searchOrder: 8,
|
||||
}),
|
||||
searchOnlyColumn({
|
||||
label: '发票状态',
|
||||
prop: 'invoiceStatus',
|
||||
searchOrder: 5,
|
||||
type: 'select',
|
||||
dicData: invoiceStatusOptions,
|
||||
}),
|
||||
searchOnlyColumn({
|
||||
label: '收付款状态',
|
||||
prop: 'paymentStatus',
|
||||
searchOrder: 4,
|
||||
type: 'select',
|
||||
dicData: paymentStatusOptions,
|
||||
}),
|
||||
searchOnlyColumn({
|
||||
label: '审核状态',
|
||||
prop: 'approvalStatus',
|
||||
searchOrder: 3,
|
||||
type: 'select',
|
||||
dicData: approvalStatusOptions,
|
||||
}),
|
||||
searchOnlyColumn({
|
||||
label: '生成日期',
|
||||
prop: 'createDateRange',
|
||||
searchOrder: 1,
|
||||
type: 'daterange',
|
||||
}),
|
||||
// ---------- 表格列(部分兼搜索项) ----------
|
||||
...buildTableColumns(),
|
||||
],
|
||||
});
|
||||
|
||||
export const kingdeeSyncName = value => pickLabel(kingdeeSyncStatusOptions, value);
|
||||
export const paymentStatusName = value => pickLabel(paymentStatusOptions, value);
|
||||
@@ -8,6 +8,8 @@ export const formalSettlementFormFields = [
|
||||
{ label: '收款方', prop: 'payeeName', readonly: true },
|
||||
{ label: '结算类型', prop: 'settlementTypeName', readonly: true },
|
||||
{ label: '结算金额', prop: 'settlementAmount', readonly: true, money: true },
|
||||
{ label: '业务模式', prop: 'businessModel', type: 'select', optionsKey: 'businessModelOptions' },
|
||||
{ label: '运输方式', prop: 'transportType', type: 'select', optionsKey: 'transportTypeOptions' },
|
||||
{ label: '汇率日期', prop: 'exchangeRateDate', type: 'date', required: true },
|
||||
{ label: '结算汇率', prop: 'exchangeRate', type: 'number', required: true },
|
||||
{ label: '本位币合计', prop: 'localSettlementAmount', readonly: true, money: true },
|
||||
@@ -25,6 +27,8 @@ export const createFormalSettlementForm = () => ({
|
||||
settlementType: '',
|
||||
sourcePreSettlementIds: [],
|
||||
sourceDetailIds: [],
|
||||
businessModel: '',
|
||||
transportType: '',
|
||||
exchangeRateDate: '',
|
||||
exchangeRate: 1,
|
||||
createUserName: '',
|
||||
|
||||
@@ -36,7 +36,7 @@ export const kingdeeSyncStatusOptions = [
|
||||
|
||||
export const formalSettlementSearchFields = [
|
||||
{ label: '结算单号', prop: 'formalSettlementNo', type: 'input' },
|
||||
{ label: '预结算单号', prop: 'preSettlementNo', type: 'input' },
|
||||
{ label: '预付结算单号', prop: 'preSettlementNo', type: 'input' },
|
||||
{ label: '项目', prop: 'projectName', type: 'input' },
|
||||
{ label: '所属组织', prop: 'deptName', type: 'cascader' },
|
||||
{ label: '合同编号', prop: 'contractNo', type: 'input' },
|
||||
|
||||
@@ -8,6 +8,8 @@ export const formalSettlementTableColumns = [
|
||||
{ label: '合同编号', prop: 'contractNo', minWidth: 150 },
|
||||
{ label: '合同名称', prop: 'contractName', minWidth: 170 },
|
||||
{ label: '原币结算金额', prop: 'settlementAmount', minWidth: 145, money: true },
|
||||
{ label: '业务模式', prop: 'businessModelName', minWidth: 120 },
|
||||
{ label: '运输方式', prop: 'transportTypeName', minWidth: 120 },
|
||||
{ label: '本位币结算金额', prop: 'localSettlementAmount', minWidth: 155, money: true },
|
||||
{ label: '结算汇率', prop: 'exchangeRate', minWidth: 110 },
|
||||
{ label: '申请付款金额(含预付)', prop: 'appliedPaymentAmount', minWidth: 185, money: true },
|
||||
@@ -19,6 +21,8 @@ export const formalSettlementTableColumns = [
|
||||
{ label: '审核状态', prop: 'approvalStatusName', minWidth: 110, status: true },
|
||||
{ label: '当前节点', prop: 'currentNode', minWidth: 130 },
|
||||
{ label: '当前处理人', prop: 'currentProcessor', minWidth: 130 },
|
||||
{ label: '调整标识', prop: 'adjustFlag', minWidth: 110 },
|
||||
{ label: '来源原单号', prop: 'originFormalSettlementNo', minWidth: 170 },
|
||||
{ label: '金蝶单据号', prop: 'kingdeeBillNo', minWidth: 150 },
|
||||
{ label: '金蝶单据状态', prop: 'kingdeeSyncStatus', minWidth: 135 },
|
||||
{ label: '金蝶锁状态', prop: 'kingdeeLockStatus', minWidth: 150 },
|
||||
@@ -28,15 +32,15 @@ export const formalSettlementTableColumns = [
|
||||
];
|
||||
|
||||
export const sourceColumns = [
|
||||
{ label: '预结算单号', prop: 'preSettlementNo', minWidth: 160 },
|
||||
{ label: '预付结算单号', prop: 'preSettlementNo', minWidth: 160 },
|
||||
{ label: '结算金额', prop: 'settlementAmount', minWidth: 130, money: true },
|
||||
{ label: '申请预付金额', prop: 'advanceAppliedAmount', minWidth: 140, money: true },
|
||||
{ label: '已付款金额', prop: 'advancePaidAmount', minWidth: 130, money: true },
|
||||
];
|
||||
|
||||
export const detailColumns = [
|
||||
{ label: '单据号', prop: 'documentNo', minWidth: 180 },
|
||||
{ label: '运单号', prop: 'waybillNo', minWidth: 160 },
|
||||
{ label: '单据号', prop: 'documentNo', minWidth: 180, link: true },
|
||||
{ label: '运单号', prop: 'waybillNo', minWidth: 160, link: true },
|
||||
{ label: '车号', prop: 'vehicleNo', minWidth: 130 },
|
||||
{ label: '发货地址', prop: 'departureAddress', minWidth: 180 },
|
||||
{ label: '到货地址', prop: 'arrivalAddress', minWidth: 180 },
|
||||
@@ -48,11 +52,11 @@ export const detailColumns = [
|
||||
{ label: '运输总量', prop: 'transportQuantity', minWidth: 120 },
|
||||
{ label: '里程(KM)', prop: 'mileage', minWidth: 120 },
|
||||
{ label: '批次号', prop: 'batchNo', minWidth: 120 },
|
||||
{ label: '计费方式', prop: 'billingType', minWidth: 130 },
|
||||
{ label: '运输单价', prop: 'unitPrice', minWidth: 120, money: true },
|
||||
{ label: '运费', prop: 'freightAmount', minWidth: 120, money: true },
|
||||
{ label: '调整金额', prop: 'adjustAmount', minWidth: 120, money: true },
|
||||
{ label: '结算金额(含税)', prop: 'settlementAmountTax', minWidth: 155, money: true },
|
||||
{ label: '结算金额(不含税)', prop: 'settlementAmountNoTax', minWidth: 170, money: true },
|
||||
{ label: '备注', prop: 'remark', minWidth: 180 },
|
||||
];
|
||||
|
||||
@@ -66,7 +70,7 @@ export const summaryColumns = [
|
||||
];
|
||||
|
||||
export const candidateColumns = [
|
||||
{ label: '预结算单号', prop: 'preSettlementNo', minWidth: 170 },
|
||||
{ label: '预付结算单号', prop: 'preSettlementNo', minWidth: 170 },
|
||||
{ label: '项目名称', prop: 'projectName', minWidth: 140 },
|
||||
{ label: '所属组织', prop: 'deptName', minWidth: 140 },
|
||||
{ label: '合同编号', prop: 'contractNo', minWidth: 150 },
|
||||
@@ -86,7 +90,7 @@ export const candidateDetailColumns = [
|
||||
{ label: '合同编号', prop: 'contractNo', minWidth: 150 },
|
||||
{ label: '合同名称', prop: 'contractName', minWidth: 170 },
|
||||
{ label: '来源', prop: 'sourceType', minWidth: 110 },
|
||||
{ label: '预结算单号', prop: 'preSettlementNo', minWidth: 160 },
|
||||
{ label: '预付结算单号', prop: 'preSettlementNo', minWidth: 160 },
|
||||
{ label: '正式结算单号', prop: 'formalSettlementNo', minWidth: 160 },
|
||||
{ label: '运单号', prop: 'waybillNo', minWidth: 150 },
|
||||
{ label: '车号', prop: 'vehicleNo', minWidth: 130 },
|
||||
@@ -94,6 +98,7 @@ export const candidateDetailColumns = [
|
||||
{ label: '货物名称', prop: 'cargoName', minWidth: 140 },
|
||||
{ label: '货物类型', prop: 'cargoType', minWidth: 130 },
|
||||
{ label: '批次号', prop: 'batchNo', minWidth: 120 },
|
||||
{ label: '计费方式', prop: 'billingType', minWidth: 130 },
|
||||
{ label: '应收应付合计', prop: 'totalAmount', minWidth: 140, money: true },
|
||||
{ label: '状态', prop: 'settlementStatusName', minWidth: 110 },
|
||||
];
|
||||
|
||||
@@ -4,7 +4,7 @@ export const settlementTypeOptions = [
|
||||
];
|
||||
|
||||
export const preSettlementFormFields = [
|
||||
{ label: '预结算单号', prop: 'preSettlementNo', readonly: true },
|
||||
{ label: '预付结算单号', prop: 'preSettlementNo', readonly: true },
|
||||
{ label: '合同名称', prop: 'contractId', type: 'contract', required: true },
|
||||
{ label: '合同编号', prop: 'contractNo', readonly: true },
|
||||
{ label: '项目名称', prop: 'projectName', readonly: true },
|
||||
@@ -12,6 +12,8 @@ export const preSettlementFormFields = [
|
||||
{ label: '付款方', prop: 'payerName', readonly: true },
|
||||
{ label: '结算类型', prop: 'settlementType', readonly: true },
|
||||
{ label: '结算金额', prop: 'settlementAmount', readonly: true, money: true },
|
||||
{ label: '业务模式', prop: 'businessModel', type: 'select', optionsKey: 'businessModelOptions' },
|
||||
{ label: '运输方式', prop: 'transportType', type: 'select', optionsKey: 'transportTypeOptions' },
|
||||
{ label: '汇率日期', prop: 'exchangeRateDate', type: 'date' },
|
||||
{ label: '结算汇率', prop: 'exchangeRate', type: 'number', class: 'exchange-rate-input' },
|
||||
{ label: '本位币合计', prop: 'localSettlementAmount', readonly: true, money: true },
|
||||
@@ -64,6 +66,8 @@ export const emptyPreSettlementForm = () => ({
|
||||
settlementType: 'payable',
|
||||
currency: 'RMB',
|
||||
settlementAmount: 0,
|
||||
businessModel: '',
|
||||
transportType: '',
|
||||
localCurrency: 'RMB',
|
||||
localSettlementAmount: 0,
|
||||
exchangeRateDate: '',
|
||||
|
||||
@@ -7,7 +7,7 @@ export const approvalStatusOptions = [
|
||||
];
|
||||
|
||||
export const preSettlementSearchFields = [
|
||||
{ label: '预结算单号', prop: 'preSettlementNo', type: 'input' },
|
||||
{ label: '预付结算单号', prop: 'preSettlementNo', type: 'input' },
|
||||
{ label: '预付单号', prop: 'advanceNo', type: 'input' },
|
||||
{ label: '项目名称', prop: 'projectName', type: 'input' },
|
||||
{ label: '所属组织', prop: 'deptName', type: 'cascader' },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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: 'payerName', minWidth: 160 },
|
||||
{ label: '收款方', prop: 'payeeName', minWidth: 160 },
|
||||
@@ -8,6 +8,8 @@ export const preSettlementTableColumns = [
|
||||
{ label: '合同编号', prop: 'contractNo', minWidth: 140 },
|
||||
{ label: '合同名称', prop: 'contractName', minWidth: 160 },
|
||||
{ label: '原币结算金额', prop: 'settlementAmount', minWidth: 140, money: true, precision: 2 },
|
||||
{ label: '业务模式', prop: 'businessModelName', minWidth: 120 },
|
||||
{ label: '运输方式', prop: 'transportTypeName', minWidth: 120 },
|
||||
{ label: '本位币结算金额', prop: 'localSettlementAmount', minWidth: 150, money: true, precision: 2 },
|
||||
{ label: '结算汇率', prop: 'exchangeRate', minWidth: 110, precision: 2 },
|
||||
{
|
||||
@@ -40,7 +42,7 @@ export const settlementSummaryColumns = [
|
||||
|
||||
export const settlementDetailColumns = [
|
||||
{ label: '单据号', prop: 'documentNo', minWidth: 180, link: true },
|
||||
{ label: '运单号', prop: 'waybillNo', minWidth: 160 },
|
||||
{ label: '运单号', prop: 'waybillNo', minWidth: 160, link: true },
|
||||
{ label: '车号', prop: 'vehicleNo', minWidth: 130 },
|
||||
{ label: '发货地址', prop: 'departureAddress', minWidth: 180 },
|
||||
{ label: '到货地址', prop: 'arrivalAddress', minWidth: 180 },
|
||||
@@ -52,6 +54,7 @@ export const settlementDetailColumns = [
|
||||
{ label: '运输总量', prop: 'transportQuantityText', minWidth: 120 },
|
||||
{ label: '里程(KM)', prop: 'mileage', minWidth: 120 },
|
||||
{ label: '批次号', prop: 'batchNo', minWidth: 130 },
|
||||
{ label: '计费方式', prop: 'billingType', minWidth: 130 },
|
||||
{ label: '运输单价', prop: 'unitPrice', minWidth: 120, money: true },
|
||||
{ label: '运费', prop: 'freightAmount', minWidth: 120, money: true },
|
||||
{ label: '原金额', prop: 'originalAmount', minWidth: 120, money: true },
|
||||
@@ -94,5 +97,6 @@ export const candidateDetailColumns = [
|
||||
{ label: '货物名称', prop: 'cargoName', minWidth: 140 },
|
||||
{ label: '货物类型', prop: 'cargoType', minWidth: 130 },
|
||||
{ label: '批次号', prop: 'batchNo', minWidth: 120 },
|
||||
{ label: '计费方式', prop: 'billingType', minWidth: 130 },
|
||||
{ label: '结算金额', prop: 'totalAmount', minWidth: 130, money: true },
|
||||
];
|
||||
|
||||
@@ -20,7 +20,7 @@ export const searchFields = [
|
||||
{ label: '货物名称', prop: 'cargoName', type: 'input' },
|
||||
{ label: '合同编号', prop: 'contractNo', type: 'input' },
|
||||
{ label: '合同名称', prop: 'contractName', type: 'input' },
|
||||
{ label: '预结算单号', prop: 'preSettlementNo', type: 'input' },
|
||||
{ label: '预付结算单号', prop: 'preSettlementNo', type: 'input' },
|
||||
{ label: '正式结算单号', prop: 'formalSettlementNo', type: 'input' },
|
||||
{ label: '批次号', prop: 'batchNo', type: 'input' },
|
||||
{ label: '车号', prop: 'vehicleNo', type: 'input' },
|
||||
@@ -35,7 +35,7 @@ export const tableColumns = [
|
||||
{ label: '合同编号', prop: 'contractNo', minWidth: 140 },
|
||||
{ label: '合同名称', prop: 'contractName', minWidth: 140 },
|
||||
{ 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: 'waybillNo', minWidth: 140, link: true },
|
||||
{ label: '车号', prop: 'vehicleNo', minWidth: 120 },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const settlementAdjustmentTableColumns = [
|
||||
{ label: '单据号', prop: 'adjustmentNo', minWidth: 160, link: true, fixed: 'left' },
|
||||
{ label: '结算单号', prop: 'formalSettlementNo', minWidth: 160 },
|
||||
{ label: '结算单号', prop: 'formalSettlementNo', minWidth: 160, link: true },
|
||||
{ label: '结算单类型', prop: 'settlementTypeName', minWidth: 110 },
|
||||
{ label: '项目名称', prop: 'projectName', minWidth: 140 },
|
||||
{ label: '所属组织', prop: 'deptName', minWidth: 140 },
|
||||
@@ -9,6 +9,8 @@ export const settlementAdjustmentTableColumns = [
|
||||
{ label: '合同名称', prop: 'contractName', minWidth: 170 },
|
||||
{ label: '调整金额', prop: 'adjustmentAmount', minWidth: 130, money: true },
|
||||
{ label: '审核状态', prop: 'approvalStatusName', minWidth: 110, status: true },
|
||||
{ label: '金蝶单据状态', prop: 'kingdeeSyncStatus', minWidth: 130, kingdee: true },
|
||||
{ label: '金蝶单据号', prop: 'kingdeeBillNo', minWidth: 150 },
|
||||
{ label: '当前节点', prop: 'currentNode', minWidth: 120 },
|
||||
{ label: '当前处理人', prop: 'currentProcessor', minWidth: 130 },
|
||||
{ label: '创建人', prop: 'createUserName', minWidth: 110 },
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/**
|
||||
* 导入结算单列表(avue-crud)配置
|
||||
* ------------------------------------------------------------------
|
||||
* 列表页与其它模块统一使用 avue-crud,头部 4 个按钮(刷新 / 列显隐 / 搜索显隐 /
|
||||
* 显示方式)由 avue-crud 自带,不做二次封装。
|
||||
*
|
||||
* ⚠️ searchOrder 为降序排序,值越大越靠前。
|
||||
* ⚠️ 仅用于搜索的列必须 hide + showColumn: false,否则会混进「列显隐」抽屉。
|
||||
*/
|
||||
|
||||
const IMPORT_STATUS_OPTIONS = [
|
||||
{ label: '草稿', value: 'draft' },
|
||||
{ label: '已完成', value: 'completed' },
|
||||
{ label: '已作废', value: 'voided' },
|
||||
];
|
||||
|
||||
const SETTLEMENT_TYPE_OPTIONS = [
|
||||
{ label: '应收', value: 'receivable' },
|
||||
{ label: '应付', value: 'payable' },
|
||||
];
|
||||
|
||||
const textFormatter = (row, value) =>
|
||||
value === null || value === undefined || value === '' ? '-' : value;
|
||||
|
||||
const pickLabel = (options, value) =>
|
||||
options.find(item => item.value === value)?.label || value || '-';
|
||||
|
||||
const settlementTypeLabel = value => pickLabel(SETTLEMENT_TYPE_OPTIONS, value);
|
||||
|
||||
const billTypeLabel = value => (value === 'pre' ? '预结算单' : value ? '正式结算单' : '-');
|
||||
|
||||
export const importStatusLabel = value => pickLabel(IMPORT_STATUS_OPTIONS, value);
|
||||
|
||||
export const settlementImportOption = () => ({
|
||||
height: 'auto',
|
||||
calcHeight: 32,
|
||||
tip: false,
|
||||
searchBtnText: '查询',
|
||||
emptyBtnText: '重置',
|
||||
searchShow: true,
|
||||
searchIcon: true,
|
||||
searchLabelWidth: 88,
|
||||
// 查询/重置紧跟首行 4 个条件(4×5 + 菜单 4 = 24),不再独占下一整行
|
||||
searchMenuSpan: 4,
|
||||
searchIndex: 4,
|
||||
searchMenuPosition: 'right',
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: '序号',
|
||||
indexWidth: 64,
|
||||
indexFixed: 'left',
|
||||
selection: false,
|
||||
addBtn: false,
|
||||
viewBtn: false,
|
||||
delBtn: false,
|
||||
editBtn: false,
|
||||
menuWidth: 220,
|
||||
menuFixed: 'right',
|
||||
column: [
|
||||
// ---------- 搜索项(前 4 项默认展示,其余折叠;searchOrder 越大越靠前) ----------
|
||||
{
|
||||
label: '状态',
|
||||
prop: 'importStatus',
|
||||
type: 'select',
|
||||
search: true,
|
||||
searchSpan: 5,
|
||||
searchOrder: 6,
|
||||
searchPlaceholder: '请选择',
|
||||
dicData: IMPORT_STATUS_OPTIONS,
|
||||
hide: true,
|
||||
showColumn: false,
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
},
|
||||
{
|
||||
label: '导入类型',
|
||||
prop: 'settlementType',
|
||||
type: 'select',
|
||||
search: true,
|
||||
searchSpan: 5,
|
||||
searchOrder: 5,
|
||||
searchPlaceholder: '请选择',
|
||||
dicData: SETTLEMENT_TYPE_OPTIONS,
|
||||
hide: true,
|
||||
showColumn: false,
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
},
|
||||
// ---------- 表格列 ----------
|
||||
{
|
||||
label: '导入批次号',
|
||||
prop: 'batchNo',
|
||||
slot: true,
|
||||
search: true,
|
||||
searchSpan: 5,
|
||||
searchOrder: 7,
|
||||
searchPlaceholder: '请选择',
|
||||
minWidth: 160,
|
||||
},
|
||||
{ label: '状态', prop: 'importStatusName', slot: true, width: 100, align: 'center' },
|
||||
{
|
||||
label: '导入类型',
|
||||
prop: 'settlementTypeName',
|
||||
minWidth: 100,
|
||||
align: 'center',
|
||||
formatter: (row, value) => value || settlementTypeLabel(row.settlementType),
|
||||
},
|
||||
{
|
||||
label: '结算单',
|
||||
prop: 'settlementBillTypeName',
|
||||
minWidth: 110,
|
||||
align: 'center',
|
||||
formatter: (row, value) => value || billTypeLabel(row.settlementBillType),
|
||||
},
|
||||
{
|
||||
label: '项目',
|
||||
prop: 'projectName',
|
||||
search: true,
|
||||
searchSpan: 5,
|
||||
searchOrder: 4,
|
||||
searchPlaceholder: '请输入',
|
||||
minWidth: 140,
|
||||
formatter: textFormatter,
|
||||
},
|
||||
{
|
||||
label: '客户',
|
||||
prop: 'customerName',
|
||||
search: true,
|
||||
searchSpan: 5,
|
||||
searchOrder: 3,
|
||||
searchPlaceholder: '请输入',
|
||||
minWidth: 140,
|
||||
formatter: textFormatter,
|
||||
},
|
||||
{
|
||||
label: '承运商',
|
||||
prop: 'carrierName',
|
||||
search: true,
|
||||
searchSpan: 5,
|
||||
searchOrder: 2,
|
||||
searchPlaceholder: '请输入',
|
||||
minWidth: 140,
|
||||
formatter: textFormatter,
|
||||
},
|
||||
{
|
||||
label: '明细行数',
|
||||
prop: 'detailCount',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
formatter: row => row.detailCount ?? row.waybillCount ?? 0,
|
||||
},
|
||||
{ label: '创建时间', prop: 'createTime', width: 180, align: 'center', formatter: textFormatter },
|
||||
{ label: '创建人', prop: 'createUserName', minWidth: 110, formatter: textFormatter },
|
||||
],
|
||||
});
|
||||
@@ -13,7 +13,7 @@ export const reconciliationStatusOptions = [
|
||||
|
||||
export const transportReconciliationSearchFields = [
|
||||
{ prop: 'reconciliationNo', label: '对账单号', type: 'input' },
|
||||
{ prop: 'preSettlementNos', label: '预结算单号', type: 'input' },
|
||||
{ prop: 'preSettlementNos', label: '预付结算单号', type: 'input' },
|
||||
{ prop: 'projectName', label: '项目', type: 'input' },
|
||||
{ prop: 'deptName', label: '所属组织', type: 'cascader' },
|
||||
{ prop: 'contractNo', label: '合同编号', type: 'input' },
|
||||
|
||||
@@ -72,6 +72,7 @@ export const userOption = safe => {
|
||||
},
|
||||
{ label: '岗位', prop: 'postName', overHidden: true, display: false },
|
||||
{ label: '性别', prop: 'sexName', width: 80, display: false },
|
||||
{ label: 'OA登录名', prop: 'oaLoginId', minWidth: 140, overHidden: true, display: false },
|
||||
{ label: 'OA人员id', prop: 'oaPersonId', minWidth: 120, overHidden: true, display: false },
|
||||
{ label: '备注', prop: 'remark', minWidth: 160, overHidden: true, display: false },
|
||||
{
|
||||
|
||||
@@ -108,7 +108,7 @@ export default [
|
||||
},
|
||||
{
|
||||
path: '/settlement/pre-settlement/public-view',
|
||||
name: '查看预结算信息',
|
||||
name: '查看预付结算单信息',
|
||||
component: () => import('@/views/settlement/pre-settlement-public-view.vue'),
|
||||
meta: {
|
||||
keepAlive: false,
|
||||
@@ -119,7 +119,7 @@ export default [
|
||||
},
|
||||
{
|
||||
path: '/settlement/formal-settlement/public-view',
|
||||
name: '查看正式结算信息',
|
||||
name: '查看结算单信息',
|
||||
component: () => import('@/views/settlement/formal-settlement-public-view.vue'),
|
||||
meta: {
|
||||
keepAlive: false,
|
||||
|
||||
@@ -95,7 +95,7 @@ export default [
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: '新增编辑预结算',
|
||||
name: '新增编辑预付结算单',
|
||||
meta: {
|
||||
keepAlive: false,
|
||||
activeMenu: '/settlement/pre-settlement',
|
||||
@@ -110,15 +110,31 @@ export default [
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: '新增编辑正式结算',
|
||||
name: '新增编辑结算单',
|
||||
meta: {
|
||||
keepAlive: false,
|
||||
activeMenu: '/settlement/formal-settlement',
|
||||
// 付款/收款结算单共用表单页,具体高亮菜单由页面按 settlementType 回写
|
||||
activeMenu: '/settlement/payment-settlement',
|
||||
},
|
||||
component: loadView(() => import('@/views/settlement/formal-settlement-form.vue')),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/settlement/settlement-import/form',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: '新增导入结算单',
|
||||
meta: {
|
||||
keepAlive: false,
|
||||
activeMenu: '/settlement/settlement-import',
|
||||
},
|
||||
component: loadView(() => import('@/views/settlement/settlement-import-form.vue')),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/settlement/transport-reconciliation/form',
|
||||
component: Layout,
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'nprogress/nprogress.css';
|
||||
const excelPattern = /\.(xls|xlsx)$/;
|
||||
|
||||
/** 是否为浏览器 Blob(含跨 realm 的 Blob-like) */
|
||||
const isBlobLike = value =>
|
||||
export const isBlobLike = value =>
|
||||
value != null &&
|
||||
typeof value === 'object' &&
|
||||
typeof value.size === 'number' &&
|
||||
@@ -15,14 +15,14 @@ const isBlobLike = value =>
|
||||
(typeof value.text === 'function' || typeof value.arrayBuffer === 'function');
|
||||
|
||||
/** axios 拦截器已把 JSON Blob 解析成的业务对象 */
|
||||
const isBusinessJson = value =>
|
||||
export const isBusinessJson = value =>
|
||||
value != null &&
|
||||
typeof value === 'object' &&
|
||||
!isBlobLike(value) &&
|
||||
!(value instanceof ArrayBuffer) &&
|
||||
('code' in value || 'success' in value || 'msg' in value);
|
||||
|
||||
const isExcelResponse = res => {
|
||||
export const isExcelResponse = res => {
|
||||
// 已是业务 JSON(导入成功/失败提示)时,绝不能当失败明细 Excel 处理
|
||||
if (isBusinessJson(res?.data)) {
|
||||
return false;
|
||||
@@ -54,7 +54,7 @@ const isExcelResponse = res => {
|
||||
* 提前解析成普通对象;此处需同时兼容 Blob / 字符串 / 已解析对象,避免再调
|
||||
* `blob.text()` 时出现「blob.text is not a function」。
|
||||
*/
|
||||
const parseBlobJson = async data => {
|
||||
export const parseBlobJson = async data => {
|
||||
if (data == null) {
|
||||
return {};
|
||||
}
|
||||
|
||||
+66
-14
@@ -23,7 +23,7 @@ export const MK_BIZ = {
|
||||
},
|
||||
'pre-settlement': {
|
||||
dictName: '提交预结算审核流',
|
||||
subjectPrefix: '预结算审批',
|
||||
subjectPrefix: '预付结算审批',
|
||||
rejected: ['returned'],
|
||||
approved: ['approved'],
|
||||
},
|
||||
@@ -61,9 +61,18 @@ export const MK_BIZ = {
|
||||
|
||||
const MK_SWITCH_NAME = '开启MK';
|
||||
|
||||
async function loadMkTemplateList() {
|
||||
/** 进程内缓存,避免每次提交都打字典;登录后同一会话开关一般不变 */
|
||||
let mkEnabledCache = null;
|
||||
let mkEnabledPromise = null;
|
||||
let mkTemplateListCache = null;
|
||||
|
||||
async function loadMkTemplateList(force = false) {
|
||||
if (!force && mkTemplateListCache) {
|
||||
return mkTemplateListCache;
|
||||
}
|
||||
const res = await getDictionary({ code: 'mk_template' });
|
||||
return res?.data?.data || [];
|
||||
mkTemplateListCache = res?.data?.data || [];
|
||||
return mkTemplateListCache;
|
||||
}
|
||||
|
||||
/** 业务字典 mk_template:名称「开启MK」且键值为 1 时才请求 MK */
|
||||
@@ -72,10 +81,37 @@ export function isMkEnabled(list = []) {
|
||||
return String(matched?.dictKey ?? '').trim() === '1';
|
||||
}
|
||||
|
||||
/** 加载业务字典并判断是否开启 MK */
|
||||
export async function loadMkEnabled() {
|
||||
const list = await loadMkTemplateList();
|
||||
return isMkEnabled(list);
|
||||
/** 清除 MK 开关缓存(字典变更后可调用) */
|
||||
export function clearMkEnabledCache() {
|
||||
mkEnabledCache = null;
|
||||
mkEnabledPromise = null;
|
||||
mkTemplateListCache = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载业务字典并判断是否开启 MK
|
||||
* @param {boolean} [force=false] 是否强制刷新缓存
|
||||
*/
|
||||
export async function loadMkEnabled(force = false) {
|
||||
if (!force && mkEnabledCache !== null) {
|
||||
return mkEnabledCache;
|
||||
}
|
||||
if (!force && mkEnabledPromise) {
|
||||
return mkEnabledPromise;
|
||||
}
|
||||
mkEnabledPromise = loadMkTemplateList(force)
|
||||
.then(list => {
|
||||
mkEnabledCache = isMkEnabled(list);
|
||||
return mkEnabledCache;
|
||||
})
|
||||
.catch(error => {
|
||||
mkEnabledCache = false;
|
||||
throw error;
|
||||
})
|
||||
.finally(() => {
|
||||
mkEnabledPromise = null;
|
||||
});
|
||||
return mkEnabledPromise;
|
||||
}
|
||||
|
||||
export async function resolveMkTemplateCode(dictName, list) {
|
||||
@@ -99,19 +135,22 @@ export function isMkApprovedStatus(bizType, approvalStatus) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交 MK 审核流
|
||||
* 提交 MK 审核流。未开启 MK 时直接跳过,不请求流程实例相关接口。
|
||||
* @param {Object} options
|
||||
* @param {string} options.bizType 业务类型
|
||||
* @param {string|number} options.bizId 业务主键(后端据此生成/复用 formInstanceId)
|
||||
* @param {string|number} options.bizId 业务主键
|
||||
* @param {string} [options.subjectName] 标题后缀
|
||||
* @param {string} [options.approvalStatus] 提交前的审批状态(须在业务 submit 改状态前取值;通过态强制新建实例)
|
||||
* @param {string} [options.approvalStatus] 提交前的审批状态
|
||||
* @param {boolean} [options.mkEnabled] 调用方已知开关时传入,false 时立即跳过
|
||||
* @returns {Promise<boolean>} true=已发起/复用 MK 流程,false=未开启或已跳过
|
||||
*/
|
||||
export async function submitMkApprovalFlow({
|
||||
bizType,
|
||||
bizId,
|
||||
subjectName = '',
|
||||
approvalStatus = '',
|
||||
}) {
|
||||
mkEnabled,
|
||||
} = {}) {
|
||||
const conf = MK_BIZ[bizType];
|
||||
if (!conf) {
|
||||
return Promise.reject(new Error(`不支持的MK业务类型:${bizType}`));
|
||||
@@ -119,17 +158,29 @@ export async function submitMkApprovalFlow({
|
||||
if (bizId == null || bizId === '') {
|
||||
return Promise.reject(new Error('业务id不能为空'));
|
||||
}
|
||||
|
||||
// 调用方显式关闭,或字典未开启:不请求 hasMkProcessInstance / processSubmit 等 MK 接口
|
||||
if (mkEnabled === false) {
|
||||
return false;
|
||||
}
|
||||
const enabled = mkEnabled === true ? true : await loadMkEnabled();
|
||||
if (!enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const list = await loadMkTemplateList();
|
||||
if (!isMkEnabled(list)) {
|
||||
return;
|
||||
mkEnabledCache = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
const bizIdText = String(bizId);
|
||||
const forceNewFormInstance = isMkApprovedStatus(bizType, approvalStatus);
|
||||
// 审核通过后再提交必须新建流程;其余场景已有有效实例则跳过
|
||||
if (!forceNewFormInstance) {
|
||||
const existsRes = await hasMkProcessInstance({ bizId: bizIdText });
|
||||
if (existsRes?.data?.data) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ((conf.rejected || []).includes(approvalStatus)) {
|
||||
@@ -139,11 +190,12 @@ export async function submitMkApprovalFlow({
|
||||
const subject = subjectName
|
||||
? `${conf.subjectPrefix}:${subjectName}`
|
||||
: `${conf.subjectPrefix}:${bizIdText}`;
|
||||
return processSubmit({
|
||||
await processSubmit({
|
||||
templateCode,
|
||||
bizId: bizIdText,
|
||||
subject,
|
||||
bizType,
|
||||
forceNewFormInstance,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,35 @@
|
||||
/**
|
||||
* 合并列表搜索条件:新条件覆盖旧条件,本次显式清空的字段从查询中移除。
|
||||
*/
|
||||
export const applyIncomingSearch = (current = {}, incoming = {}) => {
|
||||
const merged = { ...current, ...incoming };
|
||||
Object.keys(incoming || {}).forEach(key => {
|
||||
const value = incoming[key];
|
||||
if (
|
||||
value === '' ||
|
||||
value === null ||
|
||||
value === undefined ||
|
||||
(Array.isArray(value) && value.length === 0)
|
||||
) {
|
||||
delete merged[key];
|
||||
}
|
||||
});
|
||||
return merged;
|
||||
};
|
||||
|
||||
/**
|
||||
* 启停状态下拉「全部」在数字类型下会被转成 0/-1,不能当作查询条件。
|
||||
* 状态 0 表示草稿等有效值的页面不要调用。
|
||||
*/
|
||||
export const omitInvalidListStatus = (params = {}) => {
|
||||
const values = { ...params };
|
||||
const status = values.status;
|
||||
if (status === 0 || status === '0' || status === -1 || status === '-1') {
|
||||
delete values.status;
|
||||
}
|
||||
return values;
|
||||
};
|
||||
|
||||
export const normalizeSearchRangeParams = (params = {}, rangeMap = {}) => {
|
||||
const values = { ...params };
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
export function isFreightFeeName(name) {
|
||||
const text = String(name || '');
|
||||
return text.includes('运费') || text.includes('运输费');
|
||||
}
|
||||
|
||||
function parseBillingRules(row = {}) {
|
||||
const rule = row.billingRule || {};
|
||||
const nested = Array.isArray(rule.rules) ? rule.rules : [];
|
||||
if (nested.length) return nested;
|
||||
const raw = row.billingRulesJson ?? row.billingRules;
|
||||
if (Array.isArray(raw)) return raw.filter(item => item && typeof item === 'object');
|
||||
if (typeof raw === 'string' && raw.trim()) {
|
||||
try {
|
||||
const parsed = JSON.parse(raw);
|
||||
return Array.isArray(parsed) ? parsed.filter(item => item && typeof item === 'object') : [];
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/** 运输单价对应的运费计费类型。 */
|
||||
export function freightBillingType(row = {}) {
|
||||
const rule = row.billingRule || {};
|
||||
const rules = parseBillingRules(row);
|
||||
const freightRule = rules.find(
|
||||
item => isFreightFeeName(item?.feeItem) || isFreightFeeName(item?.feeType)
|
||||
);
|
||||
return freightRule?.billingType || row.billingType || rule.billingType || '';
|
||||
}
|
||||
|
||||
export function isTierUnitPrice(row) {
|
||||
return freightBillingType(row) === '阶梯单价';
|
||||
}
|
||||
|
||||
export function isIntervalBilling(row) {
|
||||
const type = freightBillingType(row);
|
||||
return type === '区间单价' || (type.includes('区间') && type.includes('一口价'));
|
||||
}
|
||||
|
||||
/** 阶梯单价、区间单价、区间一口价的运输单价不开放手工调整。 */
|
||||
export function isUnitPriceAdjustable(row) {
|
||||
const type = freightBillingType(row);
|
||||
if (!type) return true;
|
||||
return !isTierUnitPrice(row) && !isIntervalBilling(row);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/** 审批通过、驳回等审批流转类变更内容,不在结算单变更记录中展示。 */
|
||||
export function isApprovalSettlementChange(content) {
|
||||
const text = String(content || '').trim();
|
||||
if (!text) return false;
|
||||
return text.includes('审批通过') || text.includes('审批驳回') || text === '已驳回';
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { getList as getReceivablePayableDetailList } from '@/api/settlement/receivable-payable-detail';
|
||||
import { getList as getWaybillList } from '@/api/business/waybill-manage';
|
||||
|
||||
// 结算明细的「单据号」是应收应付明细单据号(应收 YS…/应付 YF…),按结算类型落到对应菜单页
|
||||
const SETTLEMENT_DETAIL_PATHS = {
|
||||
receivable: '/settlement/receivable-detail',
|
||||
payable: '/settlement/payable-detail',
|
||||
};
|
||||
|
||||
const unwrapPage = response => {
|
||||
const body = response?.data || response || {};
|
||||
return body?.data || body;
|
||||
};
|
||||
|
||||
const firstRecordId = data => (Array.isArray(data) ? data : data?.records || [])[0]?.id || '';
|
||||
|
||||
export const settlementDetailPath = settlementType =>
|
||||
SETTLEMENT_DETAIL_PATHS[settlementType] || SETTLEMENT_DETAIL_PATHS.payable;
|
||||
|
||||
/**
|
||||
* 结算明细行「单据号」对应的应收应付明细ID:已落库的明细自带 sourceDetailId,未落库的行按单据号回查。
|
||||
*/
|
||||
export const resolveReceivablePayableDetailId = async (row = {}, settlementType) => {
|
||||
if (row.sourceDetailId) return row.sourceDetailId;
|
||||
if (!row.documentNo) return '';
|
||||
try {
|
||||
const data = unwrapPage(
|
||||
await getReceivablePayableDetailList(1, 1, {
|
||||
documentNo: row.documentNo,
|
||||
settlementType,
|
||||
})
|
||||
);
|
||||
return firstRecordId(data);
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 结算明细行「运单号」对应的运单ID:总单来源的明细没有 waybillId(运单号列存的是总单号),按运单号回查。
|
||||
*/
|
||||
export const resolveWaybillId = async (row = {}) => {
|
||||
if (row.waybillId) return row.waybillId;
|
||||
if (!row.waybillNo) return '';
|
||||
try {
|
||||
const data = unwrapPage(await getWaybillList(1, 1, { waybillNo: row.waybillNo }));
|
||||
return firstRecordId(data);
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 结算单预付记录单据状态名(预结算编辑器与正式结算编辑器共用,避免两页状态名不一致)
|
||||
*/
|
||||
export function settlementStatusName(status, displayValue) {
|
||||
const labels = {
|
||||
reviewing: '审批中',
|
||||
approved: '审批通过',
|
||||
paid: '已付款',
|
||||
returned: '已驳回',
|
||||
voided: '已作废',
|
||||
draft: '草稿',
|
||||
};
|
||||
const name = labels[status];
|
||||
if (name) return name;
|
||||
return typeof displayValue === 'function' ? displayValue(status) : status || '-';
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一预付付款记录类型名
|
||||
*/
|
||||
export function settlementRecordTypeName(recordType) {
|
||||
return { progress_advance: '进度预付', project_advance: '项目预付核销' }[recordType] || '';
|
||||
}
|
||||
@@ -150,6 +150,7 @@ import { mapGetters } from 'vuex';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { formatUpdateUserName } from '@/utils/audit';
|
||||
import { omitInvalidListStatus } from '@/utils/search-range';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate';
|
||||
import AddressMapPicker from '@/components/address-map-picker/main.vue';
|
||||
@@ -1182,7 +1183,7 @@ export default {
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, { ...params, ...this.query })
|
||||
getList(page.currentPage, page.pageSize, omitInvalidListStatus({ ...params, ...this.query }))
|
||||
.then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
|
||||
@@ -104,6 +104,7 @@ import { mapGetters } from 'vuex';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { formatUpdateUserName } from '@/utils/audit';
|
||||
import { omitInvalidListStatus } from '@/utils/search-range';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import NProgress from 'nprogress';
|
||||
import 'nprogress/nprogress.css';
|
||||
@@ -507,7 +508,7 @@ export default {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
const values = { ...params, ...this.query };
|
||||
const values = omitInvalidListStatus({ ...params, ...this.query });
|
||||
const rangeMap = {
|
||||
effectiveDateRange: ['effectiveDateStart', 'effectiveDateEnd'],
|
||||
expiryDateRange: ['expiryDateStart', 'expiryDateEnd'],
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
|
||||
<script>
|
||||
import { getList, getDetail, submit, remove, changeStatus } from '@/api/base/customer-type';
|
||||
import { omitInvalidListStatus } from '@/utils/search-range';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
@@ -290,7 +291,7 @@ export default {
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||
getList(page.currentPage, page.pageSize, omitInvalidListStatus(Object.assign(params, this.query))).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
|
||||
@@ -97,6 +97,7 @@ import { exportBlob } from '@/api/common';
|
||||
import { getDictionaryAll } from '@/api/system/dictbiz';
|
||||
import { getDeptTree } from '@/api/system/dept';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { omitInvalidListStatus } from '@/utils/search-range';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { Download } from '@element-plus/icons-vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
@@ -569,7 +570,7 @@ export default {
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||
getList(page.currentPage, page.pageSize, omitInvalidListStatus(Object.assign(params, this.query))).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
import { mapGetters } from 'vuex';
|
||||
import { changeStatus, getDetail, getList, remove, submit } from '@/api/base/measurement-unit';
|
||||
import { createOption } from '@/option/base/measurement-unit';
|
||||
import { omitInvalidListStatus } from '@/utils/search-range';
|
||||
import { isAdministrator } from '@/utils/auth';
|
||||
|
||||
export default {
|
||||
@@ -218,7 +219,7 @@ export default {
|
||||
},
|
||||
onLoad(page = this.page, params = this.query) {
|
||||
this.loading = true;
|
||||
return getList(page.currentPage, page.pageSize, params)
|
||||
return getList(page.currentPage, page.pageSize, omitInvalidListStatus(params))
|
||||
.then(res => {
|
||||
const pageData = res.data.data || {};
|
||||
this.data = pageData.records || [];
|
||||
|
||||
@@ -270,6 +270,7 @@ import { mapGetters } from 'vuex';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { formatUpdateUserName } from '@/utils/audit';
|
||||
import { omitInvalidListStatus } from '@/utils/search-range';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate';
|
||||
import AddressMapPicker from '@/components/address-map-picker/main.vue';
|
||||
@@ -1636,7 +1637,7 @@ export default {
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, { ...params, ...this.query })
|
||||
getList(page.currentPage, page.pageSize, omitInvalidListStatus({ ...params, ...this.query }))
|
||||
.then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
|
||||
@@ -150,6 +150,7 @@ import { mapGetters } from 'vuex';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { formatUpdateUserName } from '@/utils/audit';
|
||||
import { omitInvalidListStatus } from '@/utils/search-range';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate';
|
||||
import AddressMapPicker from '@/components/address-map-picker/main.vue';
|
||||
@@ -1157,7 +1158,7 @@ export default {
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, { ...params, ...this.query })
|
||||
getList(page.currentPage, page.pageSize, omitInvalidListStatus({ ...params, ...this.query }))
|
||||
.then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
|
||||
@@ -396,8 +396,11 @@ export default {
|
||||
return this.selectionList.map(item => item.id).join(',');
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.applyDefaultDeptSearch();
|
||||
created() {
|
||||
// 超管默认查全部组织,不预填组织筛选;普通用户预填当前组织。
|
||||
if (!this.isAdmin) {
|
||||
this.applyDefaultDeptSearch();
|
||||
}
|
||||
this.initDeptTree();
|
||||
},
|
||||
methods: {
|
||||
@@ -455,10 +458,23 @@ export default {
|
||||
normalizeListQuery(params = {}) {
|
||||
// 搜索条件优先于缓存的 query,避免默认组织 ID 覆盖用户新选择的组织。
|
||||
const query = { ...this.query, ...params };
|
||||
const rawDeptId = query.deptId ?? query.searchDeptId;
|
||||
// 本次搜索显式带了组织字段时,以本次为准(含清空);否则沿用缓存。
|
||||
const hasDeptInParams =
|
||||
Object.prototype.hasOwnProperty.call(params, 'deptId') ||
|
||||
Object.prototype.hasOwnProperty.call(params, 'searchDeptId');
|
||||
const rawDeptId = hasDeptInParams
|
||||
? params.deptId ?? params.searchDeptId
|
||||
: query.deptId ?? query.searchDeptId;
|
||||
delete query.searchDeptId;
|
||||
if (rawDeptId !== undefined && rawDeptId !== null && String(rawDeptId).trim() !== '') {
|
||||
query.deptId = String(rawDeptId).split(',')[0].trim();
|
||||
// 级联可能回传路径数组,统一取末级并保持字符串,避免雪花 ID 精度丢失。
|
||||
const deptValue = Array.isArray(rawDeptId) ? rawDeptId.at(-1) : rawDeptId;
|
||||
query.deptId = String(deptValue ?? '')
|
||||
.split(',')[0]
|
||||
.trim();
|
||||
if (!query.deptId) {
|
||||
delete query.deptId;
|
||||
}
|
||||
} else {
|
||||
delete query.deptId;
|
||||
}
|
||||
@@ -466,6 +482,23 @@ export default {
|
||||
return query;
|
||||
},
|
||||
applyDefaultDeptSearch() {
|
||||
// 超管默认不限组织,避免预填组织后新增落在其他组织时列表看不见。
|
||||
if (this.isAdmin) {
|
||||
const deptColumn = this.findColumn(this.option.column, 'searchDeptId');
|
||||
if (deptColumn) {
|
||||
deptColumn.searchValue = undefined;
|
||||
}
|
||||
const nextQuery = { ...this.query };
|
||||
delete nextQuery.deptId;
|
||||
delete nextQuery.searchDeptId;
|
||||
this.query = nextQuery;
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.crud?.searchForm) {
|
||||
this.$refs.crud.searchForm.searchDeptId = undefined;
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
const deptId = this.defaultDeptId();
|
||||
const deptColumn = this.findColumn(this.option.column, 'searchDeptId');
|
||||
if (!deptId || !deptColumn) return;
|
||||
@@ -477,6 +510,11 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
resolveDeptName(deptId) {
|
||||
if (!deptId) return '';
|
||||
const matched = this.deptOptions.find(item => String(item.value) === String(deptId));
|
||||
return matched ? String(matched.label || '').trim() : '';
|
||||
},
|
||||
resetAddressQuery() {
|
||||
this.addressQuery = {
|
||||
addressName: '',
|
||||
@@ -933,7 +971,8 @@ export default {
|
||||
}
|
||||
api.submit(submitRow).then(
|
||||
() => {
|
||||
this.onLoad(this.page);
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, this.query);
|
||||
this.$message({ type: 'success', message: '操作成功!' });
|
||||
done();
|
||||
},
|
||||
@@ -951,7 +990,7 @@ export default {
|
||||
}
|
||||
api.submit(submitRow).then(
|
||||
() => {
|
||||
this.onLoad(this.page);
|
||||
this.onLoad(this.page, this.query);
|
||||
this.$message({ type: 'success', message: '操作成功!' });
|
||||
done();
|
||||
},
|
||||
@@ -1006,7 +1045,13 @@ export default {
|
||||
beforeOpen(done, type) {
|
||||
this.dialogReadonly = type === 'view';
|
||||
if (type === 'add') {
|
||||
this.form = {};
|
||||
const form = {};
|
||||
// 超管若当前按某组织筛选,新增默认归属该组织,避免保存后被筛选条件滤掉。
|
||||
if (this.isAdmin && this.query.deptId) {
|
||||
form.deptId = String(this.query.deptId);
|
||||
form.deptName = this.resolveDeptName(form.deptId);
|
||||
}
|
||||
this.form = form;
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3774,7 +3774,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="剩余数量" min-width="130" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ formatDispatchQuantity(dispatchItemRemainingQuantity(row)) }}
|
||||
{{ formatDispatchQuantity(dispatchItemDisplayRemainingQuantity(row)) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="130" align="center">
|
||||
@@ -4031,7 +4031,7 @@
|
||||
</el-input>
|
||||
<div class="business-crud-page__dispatch-quantity-hint">
|
||||
剩余数量:{{
|
||||
formatDispatchQuantity(dispatchItemHintRemainingQuantity(dispatchItemForm))
|
||||
formatDispatchQuantity(dispatchItemDisplayRemainingQuantity(dispatchItemForm))
|
||||
}}
|
||||
{{ dispatchItemForm.quantityUnit || '吨' }}
|
||||
</div>
|
||||
@@ -5740,6 +5740,8 @@ export default {
|
||||
dispatchItemIndex: -1,
|
||||
dispatchItemForm: defaultDispatchRow(),
|
||||
dispatchItemCargoRows: [],
|
||||
// 本次数量变更版本号:驱动同表其他行「剩余数量」同步重算
|
||||
dispatchCargoQuantityVersion: 0,
|
||||
dispatchItemAttachmentRows: [],
|
||||
selectedDispatchItemAttachmentRows: [],
|
||||
attachmentRows: [],
|
||||
@@ -5897,7 +5899,7 @@ export default {
|
||||
'固定金额(整单一口价)': ['固定一口价'],
|
||||
按数量: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'],
|
||||
},
|
||||
settlementTypeOptions: ['月结', '日结', '周结', '半月结', '固定天数周期结算'],
|
||||
settlementTypeOptions: ['月结', '日结', '周结', '固定天数周期结算'],
|
||||
billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'],
|
||||
reconciliationModeOptions: ['明细逐行核对', '按账单汇总核对', '跳过自动核对'],
|
||||
packageOptions,
|
||||
@@ -12776,18 +12778,23 @@ export default {
|
||||
row.cargoName = '';
|
||||
row.specification = '';
|
||||
row.model = '';
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
},
|
||||
handleDispatchConfiguredCargoNameChange(row, value) {
|
||||
const option = this.getDispatchConfiguredCargoNameOptions(row).find(
|
||||
item => String(item.value) === String(value || '')
|
||||
);
|
||||
row.cargoName = option?.value || '';
|
||||
if (!option) return;
|
||||
if (!option) {
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
return;
|
||||
}
|
||||
row.cargoType = option.cargoTypeLabel || row.cargoType || '';
|
||||
row.cargoTypeCode = option.cargoTypeCode || row.cargoTypeCode || '';
|
||||
row.cargoTypePath = option.cargoTypePath || row.cargoTypePath || [];
|
||||
row.specification = option.specification || row.specification || '';
|
||||
row.model = option.model || row.model || '';
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
},
|
||||
openDispatchItemDialog(index = -1, row = defaultDispatchRow()) {
|
||||
const defaultSummaryItem =
|
||||
@@ -13119,6 +13126,7 @@ export default {
|
||||
const parts = text.split('.');
|
||||
row.quantity =
|
||||
parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 3)}` : parts[0];
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
},
|
||||
handleDispatchCargoNumberInput(row, prop, value) {
|
||||
this.handleTaskFullFreightNumberInput(row, prop, value);
|
||||
@@ -13138,12 +13146,14 @@ export default {
|
||||
const nextRow = this.normalizeTransportCargoRow({ priceUnit: '元/吨' });
|
||||
if (index > -1) this.dispatchItemCargoRows.splice(index + 1, 0, nextRow);
|
||||
else this.dispatchItemCargoRows.push(nextRow);
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
},
|
||||
removeDispatchCargoRow(index) {
|
||||
this.dispatchItemCargoRows.splice(index, 1);
|
||||
if (!this.dispatchItemCargoRows.length) {
|
||||
this.dispatchItemCargoRows.push(this.normalizeTransportCargoRow());
|
||||
}
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
},
|
||||
dispatchCargoFreightAmount(cargo = {}) {
|
||||
const quantity = Number(cargo.quantity || 0);
|
||||
@@ -13217,11 +13227,52 @@ export default {
|
||||
}, 0)
|
||||
);
|
||||
},
|
||||
/** 精简录入提示:可调度余量扣减当前本次数量后的剩余 */
|
||||
dispatchItemHintRemainingQuantity(row = {}) {
|
||||
/**
|
||||
* 当前编辑表单中,与指定行同货物(有身份)或同单位(无身份)已占用的本次数量合计。
|
||||
* 用于剩余数量展示联动,不参与提交校验(校验仍按整单合计对比计划余量)。
|
||||
*/
|
||||
getDispatchFormOccupiedQuantity(row = {}) {
|
||||
const goodsRows =
|
||||
this.dispatchItemForm?.taskEntryMode === 'full'
|
||||
? this.dispatchItemCargoRows || []
|
||||
: [this.dispatchItemForm || row];
|
||||
const hasCargoIdentity = Boolean(
|
||||
String(row.cargoName || row.goodsName || row.name || '').trim() ||
|
||||
String(
|
||||
row.cargoType || row.secondCargoTypeName || row.goodsType || row.type || ''
|
||||
).trim()
|
||||
);
|
||||
const unit = this.getDispatchQuantityUnit(row);
|
||||
const cargoKey = this.getDispatchCargoIdentity(row);
|
||||
return goodsRows.reduce((sum, goods) => {
|
||||
if (!goods) return sum;
|
||||
if (hasCargoIdentity) {
|
||||
const goodsHasIdentity = Boolean(
|
||||
String(goods.cargoName || goods.goodsName || goods.name || '').trim() ||
|
||||
String(
|
||||
goods.cargoType || goods.secondCargoTypeName || goods.goodsType || goods.type || ''
|
||||
).trim()
|
||||
);
|
||||
if (!goodsHasIdentity || this.getDispatchCargoIdentity(goods) !== cargoKey) {
|
||||
return sum;
|
||||
}
|
||||
} else if (this.getDispatchQuantityUnit(goods) !== unit) {
|
||||
return sum;
|
||||
}
|
||||
return sum + this.parseDispatchQuantity(goods.quantity);
|
||||
}, 0);
|
||||
},
|
||||
/** 展示用剩余数量:计划可调度余量扣减本单已填本次数量(含当前行) */
|
||||
dispatchItemDisplayRemainingQuantity(row = {}) {
|
||||
// 依赖版本号,确保一行本次数量变化后其他行剩余数量一并刷新
|
||||
void this.dispatchCargoQuantityVersion;
|
||||
const available = this.dispatchItemRemainingQuantity(row);
|
||||
const current = this.parseDispatchQuantity(row.quantity);
|
||||
return Math.max(available - current, 0);
|
||||
const occupied = this.getDispatchFormOccupiedQuantity(row);
|
||||
return Math.max(available - occupied, 0);
|
||||
},
|
||||
/** 精简录入提示:与完整录入剩余数量展示规则一致 */
|
||||
dispatchItemHintRemainingQuantity(row = {}) {
|
||||
return this.dispatchItemDisplayRemainingQuantity(row);
|
||||
},
|
||||
pruneDispatchPendingRows(rows = []) {
|
||||
const planQuantities = new Map();
|
||||
|
||||
@@ -388,7 +388,7 @@
|
||||
:disabled="dialogReadonly"
|
||||
@visible-change="visible => visible && loadFeeUnitOptions()"
|
||||
><el-option
|
||||
v-for="unit in feeUnitOptions"
|
||||
v-for="unit in feeUnitSelectOptions"
|
||||
:key="unit.value"
|
||||
:label="unit.label"
|
||||
:value="unit.value" /></el-select
|
||||
@@ -1124,6 +1124,10 @@ import { getDictionary as getSystemDictionary } from '@/api/system/dict';
|
||||
import { getDictionary } from '@/api/system/dictbiz';
|
||||
import { packageOptions } from '@/option/business/common';
|
||||
import { formatContractOptionLabel } from '@/utils/contract';
|
||||
import {
|
||||
mapFeeUnitOptions,
|
||||
resolvePriceUnitByQuantityUnit,
|
||||
} from '@/utils/currency';
|
||||
import { loadMeasurementUnitOptions } from '@/utils/measurement-unit';
|
||||
import { normalizeMapSearchResults, searchAmapPlaceText } from '@/utils/map-search';
|
||||
import { downloadFileByUrl, downloadXls } from '@/utils/util';
|
||||
@@ -1264,6 +1268,10 @@ const PageAvueForm = {
|
||||
},
|
||||
};
|
||||
|
||||
const shippingTemplateListRoute = '/business/shipping-template';
|
||||
const shippingTemplateFormRoute = '/business/shipping-template/form';
|
||||
const shippingTemplateListRefreshKey = 'shipping-template-list-refresh';
|
||||
|
||||
export default {
|
||||
name: 'ShippingTemplatePage',
|
||||
components: { PageAvueForm, ElImageViewer, OpenFileViewer },
|
||||
@@ -1280,6 +1288,9 @@ export default {
|
||||
return {
|
||||
Location,
|
||||
OfficeBuilding,
|
||||
// 实例所属路由快照,避免 keep-alive 列表实例被全局 $route 误判成表单页。
|
||||
routePathLocked: this.$route.path,
|
||||
isFormPageInstance: this.$route.path === shippingTemplateFormRoute,
|
||||
form: {},
|
||||
query: {},
|
||||
loading: true,
|
||||
@@ -1401,13 +1412,18 @@ export default {
|
||||
isStandaloneBusinessPage() {
|
||||
return (
|
||||
this.standaloneFormPage &&
|
||||
['/business/shipping-template', '/business/shipping-template/form'].includes(
|
||||
this.$route.path
|
||||
)
|
||||
(this.isFormPageInstance ||
|
||||
[shippingTemplateListRoute, shippingTemplateFormRoute].includes(this.routePathLocked) ||
|
||||
[shippingTemplateListRoute, shippingTemplateFormRoute].includes(this.$route.path))
|
||||
);
|
||||
},
|
||||
isStandaloneFormPage() {
|
||||
return this.isStandaloneBusinessPage && ['add', 'edit'].includes(this.$route.query.mode);
|
||||
// 用实例锁定标志,避免列表 keep-alive 实例被全局路由误判成表单页。
|
||||
return (
|
||||
this.standaloneFormPage &&
|
||||
this.isFormPageInstance &&
|
||||
['add', 'edit'].includes(this.$route.query.mode)
|
||||
);
|
||||
},
|
||||
formPageTitle() {
|
||||
return this.isStandaloneFormPage
|
||||
@@ -1464,6 +1480,12 @@ export default {
|
||||
);
|
||||
return this.currencyUnit(option?.label || this.shippingTemplateFreight.currency);
|
||||
},
|
||||
feeUnitSelectOptions() {
|
||||
return mapFeeUnitOptions(
|
||||
this.feeUnitOptions,
|
||||
this.shippingTemplateFreight.currency || 'RMB'
|
||||
);
|
||||
},
|
||||
roadFreightTotal() {
|
||||
const total = this.shippingTemplateFreight.freightItems.reduce(
|
||||
(sum, item) => sum + Number(this.freightAmount(item) || 0),
|
||||
@@ -1530,6 +1552,18 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
// 列表实例:从其他页进入列表时刷新(activated 负责标签切回)。
|
||||
if (!this.isFormPageInstance) {
|
||||
const enteringList =
|
||||
(to.path === this.routePathLocked || to.path === shippingTemplateListRoute) &&
|
||||
from?.path &&
|
||||
from.path !== to.path;
|
||||
if (enteringList) {
|
||||
sessionStorage.removeItem(shippingTemplateListRefreshKey);
|
||||
this.$nextTick(() => this.onLoad(this.page, this.query));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (
|
||||
this.isStandaloneFormPage &&
|
||||
(to.query.mode !== from?.query?.mode ||
|
||||
@@ -1550,6 +1584,10 @@ export default {
|
||||
this.handleTransportTypeChange(value);
|
||||
this.syncFreightItems();
|
||||
},
|
||||
'form.templateType'() {
|
||||
// 切换到运单模板时立即按货物数量单位生成公路运费明细。
|
||||
this.$nextTick(() => this.syncFreightItems());
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.loadProjectOptions();
|
||||
@@ -1559,8 +1597,16 @@ export default {
|
||||
this.loadCurrencyOptions();
|
||||
if (this.isStandaloneFormPage) this.$nextTick(() => this.initStandaloneFormPage());
|
||||
},
|
||||
activated() {
|
||||
if (this.isFormPageInstance) return;
|
||||
sessionStorage.removeItem(shippingTemplateListRefreshKey);
|
||||
this.$nextTick(() => this.onLoad(this.page, this.query));
|
||||
},
|
||||
methods: {
|
||||
formatContractOptionLabel,
|
||||
markShippingTemplateListNeedRefresh() {
|
||||
sessionStorage.setItem(shippingTemplateListRefreshKey, '1');
|
||||
},
|
||||
loadQuantityUnitOptions() {
|
||||
if (this.quantityUnitLoading) return this.quantityUnitLoadPromise;
|
||||
this.quantityUnitLoading = true;
|
||||
@@ -1591,12 +1637,8 @@ export default {
|
||||
});
|
||||
}
|
||||
if (this.menuWidth != null) next.menuWidth = this.menuWidth;
|
||||
if (
|
||||
this.standaloneFormPage &&
|
||||
['/business/shipping-template', '/business/shipping-template/form'].includes(
|
||||
this.$route.path
|
||||
)
|
||||
) {
|
||||
// 仅表单页实例套用全屏表单弹窗样式,避免列表页误用后表格区域异常。
|
||||
if (this.standaloneFormPage && this.$route.path === shippingTemplateFormRoute) {
|
||||
next.dialogAppendToBody = false;
|
||||
next.dialogModal = false;
|
||||
next.dialogCustomClass = 'shipping-template-form-page-dialog';
|
||||
@@ -1776,13 +1818,22 @@ export default {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
if (this.isFormPageInstance) return;
|
||||
this.loading = true;
|
||||
const currentPage = page?.currentPage || this.page.currentPage || 1;
|
||||
const pageSize = page?.pageSize || this.page.pageSize || 10;
|
||||
this.api
|
||||
.getList(page.currentPage, page.pageSize, { ...this.query, ...params })
|
||||
.getList(currentPage, pageSize, { ...this.query, ...params })
|
||||
.then(res => {
|
||||
const data = res?.data?.data || {};
|
||||
this.data = extractRecords(res);
|
||||
this.page.total = data.total || this.data.length;
|
||||
const data = res?.data?.data || res?.data || {};
|
||||
const records = extractRecords(res);
|
||||
this.data = records;
|
||||
this.page.total = Number(data.total ?? records.length) || 0;
|
||||
})
|
||||
.catch(error => {
|
||||
window.console.error(error);
|
||||
this.data = [];
|
||||
this.page.total = 0;
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
@@ -1821,9 +1872,10 @@ export default {
|
||||
.submit(submit)
|
||||
.then(() => {
|
||||
this.$message.success('操作成功');
|
||||
this.markShippingTemplateListNeedRefresh();
|
||||
done?.();
|
||||
this.closeCrudDialog();
|
||||
this.onLoad(this.page, this.query);
|
||||
if (!this.isFormPageInstance) this.onLoad(this.page, this.query);
|
||||
})
|
||||
.catch(() => loading?.());
|
||||
},
|
||||
@@ -1837,9 +1889,10 @@ export default {
|
||||
.submit(submit)
|
||||
.then(() => {
|
||||
this.$message.success('操作成功');
|
||||
this.markShippingTemplateListNeedRefresh();
|
||||
done?.();
|
||||
this.closeCrudDialog();
|
||||
this.onLoad(this.page, this.query);
|
||||
if (!this.isFormPageInstance) this.onLoad(this.page, this.query);
|
||||
})
|
||||
.catch(() => loading?.());
|
||||
},
|
||||
@@ -1883,6 +1936,8 @@ export default {
|
||||
this.attachmentRows = [];
|
||||
this.shippingTemplateFreight = defaultFreight();
|
||||
this.loadCurrencyOptions();
|
||||
this.loadFeeUnitOptions();
|
||||
this.$nextTick(() => this.syncFreightItems());
|
||||
if (typeof this.api.nextCode === 'function')
|
||||
this.api
|
||||
.nextCode()
|
||||
@@ -2005,20 +2060,47 @@ export default {
|
||||
return false;
|
||||
}
|
||||
if (this.transportMode === 'road') {
|
||||
const invalid = this.shippingTemplateFreight.freightItems.findIndex(
|
||||
item =>
|
||||
Number(item.unitPrice || 0) < 0 ||
|
||||
!item.priceUnit ||
|
||||
(!this.isFreightAutoCalculable(item) &&
|
||||
(item.freightAmount === '' ||
|
||||
item.freightAmount === null ||
|
||||
item.freightAmount === undefined)) ||
|
||||
Number(item.freightAmount || 0) < 0
|
||||
);
|
||||
if (invalid > -1) {
|
||||
this.$message.warning(`第${invalid + 1}条货物的单价、计价单位或运费无效`);
|
||||
if (!this.shippingTemplateFreight.freightItems.length) {
|
||||
this.$message.warning('请先完善货物数量单位,以便生成运费明细');
|
||||
return false;
|
||||
}
|
||||
for (const [index, item] of this.shippingTemplateFreight.freightItems.entries()) {
|
||||
const label = `第${index + 1}条运费明细`;
|
||||
if (
|
||||
item.unitPrice === '' ||
|
||||
item.unitPrice === null ||
|
||||
item.unitPrice === undefined
|
||||
) {
|
||||
this.$message.warning(`请填写${label}的单价`);
|
||||
return false;
|
||||
}
|
||||
if (Number(item.unitPrice) < 0) {
|
||||
this.$message.warning(`${label}的单价不能小于0`);
|
||||
return false;
|
||||
}
|
||||
if (!String(item.priceUnit || '').trim()) {
|
||||
this.$message.warning(`请选择${label}的计价单位`);
|
||||
return false;
|
||||
}
|
||||
if (this.isFreightAutoCalculable(item)) {
|
||||
if (!item.freightAmountManual) {
|
||||
item.freightAmount = this.freightAmount(item);
|
||||
}
|
||||
} else if (
|
||||
item.freightAmount === '' ||
|
||||
item.freightAmount === null ||
|
||||
item.freightAmount === undefined
|
||||
) {
|
||||
this.$message.warning(
|
||||
`${label}的计价单位与货物数量单位不匹配,无法自动计算运费,请手动填写运费`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (Number(item.freightAmount || 0) < 0) {
|
||||
this.$message.warning(`${label}的运费不能小于0`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (Number(this.shippingTemplateFreight.freightAmount || 0) < 0) {
|
||||
this.$message.warning('运费不能小于0');
|
||||
return false;
|
||||
@@ -2033,8 +2115,11 @@ export default {
|
||||
return true;
|
||||
},
|
||||
closeCrudDialog() {
|
||||
if (this.isStandaloneBusinessPage) {
|
||||
this.$router.push({ path: '/business/shipping-template', query: {} });
|
||||
if (this.isStandaloneBusinessPage || this.isFormPageInstance) {
|
||||
// 关闭独立表单页时标记列表需刷新(含直接点关闭未保存的场景)
|
||||
this.markShippingTemplateListNeedRefresh();
|
||||
this.$router.$avueRouter?.closeTag?.();
|
||||
this.$router.push({ path: shippingTemplateListRoute, query: {} });
|
||||
return;
|
||||
}
|
||||
this.$refs.crud?.closeDialog?.();
|
||||
@@ -2294,7 +2379,16 @@ export default {
|
||||
},
|
||||
loadFeeUnitOptions() {
|
||||
getDictionary({ code: 'unit_fee' }).then(res => {
|
||||
this.feeUnitOptions = this.normalizeDictOptions(res?.data?.data || []);
|
||||
// 计价单位必须保存可读文案(如 元/吨),才能与货物数量单位匹配并自动计算运费。
|
||||
this.feeUnitOptions = (res?.data?.data || []).map(item => {
|
||||
const label = String(item.dictValue || item.label || item.value || '').trim();
|
||||
const key = String(item.dictKey || item.value || '').trim();
|
||||
return {
|
||||
label: label || key,
|
||||
value: label.includes('/') ? label : key || label,
|
||||
remark: item.remark || '',
|
||||
};
|
||||
});
|
||||
});
|
||||
},
|
||||
loadCurrencyOptions() {
|
||||
@@ -3098,24 +3192,53 @@ export default {
|
||||
: [];
|
||||
const quantityUnits = [];
|
||||
this.transportCargoRows.forEach(row => {
|
||||
const quantityUnit = row.quantityUnit || '';
|
||||
const quantityUnit = String(row.quantityUnit || '').trim();
|
||||
if (!quantityUnit) return;
|
||||
if (!quantityUnits.some(unit => unit === quantityUnit)) quantityUnits.push(quantityUnit);
|
||||
});
|
||||
const currency = this.shippingTemplateFreight.currency || 'RMB';
|
||||
this.shippingTemplateFreight.freightItems = quantityUnits.map((quantityUnit, index) => {
|
||||
const matched =
|
||||
previousItems.find(item => String(item.quantityUnit || '') === String(quantityUnit)) ||
|
||||
previousItems[index] ||
|
||||
{};
|
||||
const defaultPriceUnit = resolvePriceUnitByQuantityUnit(quantityUnit, currency);
|
||||
const priceUnit = this.normalizeFreightPriceUnit(
|
||||
matched.priceUnit || defaultPriceUnit || '',
|
||||
quantityUnit,
|
||||
currency
|
||||
);
|
||||
return {
|
||||
quantityUnit,
|
||||
unitPrice: matched.unitPrice || '',
|
||||
priceUnit: matched.priceUnit || '',
|
||||
priceUnit,
|
||||
freightAmount: matched.freightAmount ?? '',
|
||||
freightAmountManual:
|
||||
matched.freightAmountManual === true || matched.manualFreightAmount === true,
|
||||
};
|
||||
});
|
||||
},
|
||||
normalizeFreightPriceUnit(priceUnit, quantityUnit, currency = 'RMB') {
|
||||
const text = this.resolvePriceUnitText(priceUnit);
|
||||
if (text && this.priceUnitMatchesQuantity(text, quantityUnit)) return text;
|
||||
return (
|
||||
resolvePriceUnitByQuantityUnit(quantityUnit, currency) ||
|
||||
text ||
|
||||
String(priceUnit || '').trim()
|
||||
);
|
||||
},
|
||||
resolvePriceUnitText(priceUnit) {
|
||||
const raw = String(priceUnit || '').trim();
|
||||
if (!raw) return '';
|
||||
if (raw.includes('/')) return raw;
|
||||
const options = this.feeUnitSelectOptions.length
|
||||
? this.feeUnitSelectOptions
|
||||
: this.feeUnitOptions;
|
||||
const matched = options.find(
|
||||
item => String(item.value) === raw || String(item.label) === raw
|
||||
);
|
||||
return matched?.label || raw;
|
||||
},
|
||||
quantityUnits() {
|
||||
return [
|
||||
...new Set(
|
||||
@@ -3131,7 +3254,7 @@ export default {
|
||||
.replace(/\s+/g, '')
|
||||
.replace(/立方米|立方公尺|方/g, '立方');
|
||||
const unit = normalizeUnit(quantityUnit).replace(/[·*.]/g, '');
|
||||
const value = String(priceUnit || '')
|
||||
const value = String(this.resolvePriceUnitText(priceUnit) || '')
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/\s+/g, '');
|
||||
@@ -3163,6 +3286,10 @@ export default {
|
||||
return this.formatFreightNumber(item.freightAmount);
|
||||
}
|
||||
if (!this.isFreightAutoCalculable(item)) {
|
||||
// 无法自动计算且未手工填写时返回空,避免把空值显示成 0 造成“已填写”的错觉。
|
||||
if (item.freightAmount === '' || item.freightAmount === null || item.freightAmount === undefined) {
|
||||
return '';
|
||||
}
|
||||
return this.formatFreightNumber(item.freightAmount);
|
||||
}
|
||||
return this.formatFreightNumber(
|
||||
|
||||
@@ -1677,7 +1677,7 @@
|
||||
{{
|
||||
isDispatchPlanQuantityUnlimited(row)
|
||||
? '-'
|
||||
: formatDispatchQuantity(dispatchItemRemainingQuantity(row))
|
||||
: formatDispatchQuantity(dispatchItemDisplayRemainingQuantity(row))
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -1861,7 +1861,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="司机" :required="dispatchItemForm.carrierType !== '承运商'">
|
||||
<el-form-item label="司机" required>
|
||||
<el-autocomplete
|
||||
v-model="dispatchItemForm.driverName"
|
||||
placeholder="请输入"
|
||||
@@ -1874,7 +1874,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="dispatchItemForm.carrierType === '承运商' ? '手机号' : '司机手机号'"
|
||||
:required="dispatchItemForm.carrierType !== '承运商'"
|
||||
required
|
||||
>
|
||||
<el-input v-model="dispatchItemForm.driverPhone" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
@@ -1955,7 +1955,7 @@
|
||||
class="transport-plan-page__dispatch-quantity-hint"
|
||||
>
|
||||
剩余数量:{{
|
||||
formatDispatchQuantity(dispatchItemHintRemainingQuantity(dispatchItemForm))
|
||||
formatDispatchQuantity(dispatchItemDisplayRemainingQuantity(dispatchItemForm))
|
||||
}}
|
||||
{{ dispatchItemForm.quantityUnit || '吨' }}
|
||||
</div>
|
||||
@@ -2096,11 +2096,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="dispatchIsRoadTransport"
|
||||
label="司机"
|
||||
:required="dispatchItemForm.carrierType === '自运'"
|
||||
>
|
||||
<el-form-item v-if="dispatchIsRoadTransport" label="司机" required>
|
||||
<el-autocomplete
|
||||
v-model="dispatchItemForm.driverName"
|
||||
placeholder="请输入"
|
||||
@@ -2111,11 +2107,7 @@
|
||||
@select="item => handleTaskDriverSelect('dispatch', item)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="dispatchIsRoadTransport"
|
||||
label="手机号"
|
||||
:required="dispatchItemForm.carrierType === '自运'"
|
||||
>
|
||||
<el-form-item v-if="dispatchIsRoadTransport" label="手机号" required>
|
||||
<el-input v-model="dispatchItemForm.driverPhone" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
@@ -2807,8 +2799,11 @@ import 'nprogress/nprogress.css';
|
||||
const AMAP_KEY = '653b7cf105ad7fb8ec9b2f5198ade315';
|
||||
const AMAP_SECURITY_CODE = '5aab65c632e48ebae0d0e28f5b28e21a';
|
||||
let amapLoader;
|
||||
const transportPlanListRoute = '/business/transport-plan';
|
||||
const transportPlanFormRoute = '/business/transport-plan/form';
|
||||
const transportPlanListRefreshKey = 'transport-plan-list-refresh';
|
||||
const standaloneTransportPlanFormRoutes = {
|
||||
'/business/transport-plan': '/business/transport-plan/form',
|
||||
[transportPlanListRoute]: transportPlanFormRoute,
|
||||
};
|
||||
const standaloneTransportPlanFormPaths = [
|
||||
...Object.keys(standaloneTransportPlanFormRoutes),
|
||||
@@ -3072,6 +3067,10 @@ export default {
|
||||
// 必须放 data:Options API 的顺序是 data → computed → watch(immediate) → created,
|
||||
// 放 created 的话首个 immediate watcher 会读到空值,把首次加载也挡掉。
|
||||
routePathLocked: this.$route.path,
|
||||
// 表单页实例在创建时锁定,避免 keep-alive 列表实例随全局 $route 误切到表单态。
|
||||
isFormPageInstance: Object.values(standaloneTransportPlanFormRoutes).includes(
|
||||
this.$route.path
|
||||
),
|
||||
form: {},
|
||||
suppressTransportTypeClear: false,
|
||||
query: {},
|
||||
@@ -3112,10 +3111,11 @@ export default {
|
||||
option: (() => {
|
||||
const opt = this.cloneOption(this.crudOption, estimateMenuButtonCount(this.config));
|
||||
if (this.menuWidth != null) opt.menuWidth = this.menuWidth;
|
||||
if (
|
||||
this.standaloneFormPage &&
|
||||
standaloneTransportPlanFormPaths.includes(this.$route.path)
|
||||
) {
|
||||
// 仅表单页实例套用全屏表单弹窗样式,避免列表页误用后表格区域异常。
|
||||
const isFormInstance = Object.values(standaloneTransportPlanFormRoutes).includes(
|
||||
this.$route.path
|
||||
);
|
||||
if (this.standaloneFormPage && isFormInstance) {
|
||||
opt.dialogAppendToBody = false;
|
||||
opt.dialogModal = false;
|
||||
opt.dialogCustomClass = 'transport-plan-form-page-dialog';
|
||||
@@ -3150,6 +3150,8 @@ export default {
|
||||
dispatchItemIndex: -1,
|
||||
dispatchItemForm: defaultDispatchRow(),
|
||||
dispatchItemCargoRows: [],
|
||||
// 本次数量变更版本号:驱动同表其他行「剩余数量」同步重算
|
||||
dispatchCargoQuantityVersion: 0,
|
||||
dispatchItemAttachmentRows: [],
|
||||
selectedDispatchItemAttachmentRows: [],
|
||||
attachmentRows: [],
|
||||
@@ -3289,6 +3291,12 @@ export default {
|
||||
}
|
||||
this.loadTaskQuantityUnitOptions();
|
||||
},
|
||||
// keep-alive 重新激活列表时强制刷新,避免缓存脏数据;标记位用于兼容旧跳转逻辑。
|
||||
activated() {
|
||||
if (this.isFormPageInstance) return;
|
||||
sessionStorage.removeItem(transportPlanListRefreshKey);
|
||||
this.$nextTick(() => this.onLoad(this.page, this.query));
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['permission', 'userInfo']),
|
||||
permissionList() {
|
||||
@@ -3300,10 +3308,20 @@ export default {
|
||||
return this.config.detailSections || [];
|
||||
},
|
||||
isStandaloneBusinessPage() {
|
||||
return this.standaloneFormPage && standaloneTransportPlanFormPaths.includes(this.$route.path);
|
||||
return (
|
||||
this.standaloneFormPage &&
|
||||
(this.isFormPageInstance ||
|
||||
standaloneTransportPlanFormPaths.includes(this.routePathLocked) ||
|
||||
standaloneTransportPlanFormPaths.includes(this.$route.path))
|
||||
);
|
||||
},
|
||||
isStandaloneFormPage() {
|
||||
return this.isStandaloneBusinessPage && ['add', 'edit'].includes(this.$route.query.mode);
|
||||
// 用实例锁定标志,避免列表 keep-alive 实例被全局路由误判成表单页。
|
||||
return (
|
||||
this.standaloneFormPage &&
|
||||
this.isFormPageInstance &&
|
||||
['add', 'edit'].includes(this.$route.query.mode)
|
||||
);
|
||||
},
|
||||
formPageTitle() {
|
||||
if (this.isStandaloneFormPage) {
|
||||
@@ -3752,6 +3770,18 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
// 列表实例:从其他页进入列表时刷新(activated 负责标签切回)。
|
||||
if (!this.isFormPageInstance) {
|
||||
const enteringList =
|
||||
(to.path === this.routePathLocked || to.path === transportPlanListRoute) &&
|
||||
from?.path &&
|
||||
from.path !== to.path;
|
||||
if (enteringList) {
|
||||
sessionStorage.removeItem(transportPlanListRefreshKey);
|
||||
this.$nextTick(() => this.onLoad(this.page, this.query));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!this.isStandaloneFormPage) return;
|
||||
if (
|
||||
to.query.mode !== from?.query?.mode ||
|
||||
@@ -4484,6 +4514,9 @@ export default {
|
||||
loading();
|
||||
}
|
||||
},
|
||||
markTransportPlanListNeedRefresh() {
|
||||
sessionStorage.setItem(transportPlanListRefreshKey, '1');
|
||||
},
|
||||
rowSave(row, done, loading) {
|
||||
const submitRow = this.normalizeRow(row);
|
||||
if (!submitRow) {
|
||||
@@ -4492,6 +4525,7 @@ export default {
|
||||
}
|
||||
this.getSaveRequest()(submitRow).then(
|
||||
() => {
|
||||
this.markTransportPlanListNeedRefresh();
|
||||
this.onLoad(this.page);
|
||||
this.$message({ type: 'success', message: '操作成功!' });
|
||||
done();
|
||||
@@ -4511,6 +4545,7 @@ export default {
|
||||
}
|
||||
this.getSaveRequest()(submitRow).then(
|
||||
() => {
|
||||
this.markTransportPlanListNeedRefresh();
|
||||
this.onLoad(this.page);
|
||||
this.$message({ type: 'success', message: '操作成功!' });
|
||||
done();
|
||||
@@ -4540,7 +4575,7 @@ export default {
|
||||
.submit(submitRow)
|
||||
.then(() => {
|
||||
this.$message.success(action === 'draft' ? '暂存成功' : '创建成功');
|
||||
this.onLoad(this.page, this.query);
|
||||
this.markTransportPlanListNeedRefresh();
|
||||
this.closeCrudDialog();
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -4548,12 +4583,14 @@ export default {
|
||||
});
|
||||
},
|
||||
closeCrudDialog() {
|
||||
if (this.isStandaloneBusinessPage) {
|
||||
if (this.isStandaloneBusinessPage || this.isFormPageInstance) {
|
||||
// 关闭独立表单页时标记列表需刷新(含直接点关闭未保存的场景)
|
||||
this.markTransportPlanListNeedRefresh();
|
||||
this.$router.$avueRouter?.closeTag?.();
|
||||
const listPath =
|
||||
Object.entries(standaloneTransportPlanFormRoutes).find(
|
||||
([, formPath]) => formPath === this.$route.path
|
||||
)?.[0] || this.$route.path;
|
||||
([, formPath]) => formPath === this.$route.path || formPath === this.routePathLocked
|
||||
)?.[0] || transportPlanListRoute;
|
||||
this.$router.push({ path: listPath, query: {} });
|
||||
return;
|
||||
}
|
||||
@@ -6634,20 +6671,33 @@ export default {
|
||||
return query;
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
if (this.isFormPageInstance) return;
|
||||
this.loading = true;
|
||||
const currentPage = page?.currentPage || this.page.currentPage || 1;
|
||||
const pageSize = page?.pageSize || this.page.pageSize || 10;
|
||||
const query = this.normalizeQueryParams({
|
||||
...params,
|
||||
...this.query,
|
||||
allDept: 0,
|
||||
});
|
||||
this.api
|
||||
.getList(page.currentPage, page.pageSize, query)
|
||||
.getList(currentPage, pageSize, query)
|
||||
.then(res => {
|
||||
const result = res.data.data;
|
||||
this.page.total = result.total;
|
||||
this.data = result.records;
|
||||
const result = res?.data?.data || res?.data || {};
|
||||
const records = Array.isArray(result.records)
|
||||
? result.records
|
||||
: Array.isArray(result)
|
||||
? result
|
||||
: [];
|
||||
this.page.total = Number(result.total ?? records.length) || 0;
|
||||
this.data = records;
|
||||
this.selectionClear();
|
||||
})
|
||||
.catch(error => {
|
||||
window.console.error(error);
|
||||
this.data = [];
|
||||
this.page.total = 0;
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
@@ -7652,6 +7702,7 @@ export default {
|
||||
row.cargoName = '';
|
||||
row.specification = '';
|
||||
row.model = '';
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
},
|
||||
handleDispatchConfiguredCargoNameChange(row, value) {
|
||||
const nextValue = String(value ?? row.cargoName ?? '').trim();
|
||||
@@ -7660,6 +7711,7 @@ export default {
|
||||
);
|
||||
if (!option) {
|
||||
row.cargoName = nextValue;
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
return;
|
||||
}
|
||||
const previousType = String(row.cargoType || '').trim();
|
||||
@@ -7674,6 +7726,7 @@ export default {
|
||||
}
|
||||
row.specification = option.specification || row.specification || '';
|
||||
row.model = option.model || row.model || '';
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
},
|
||||
openDispatchItemDialog(index = -1, row = defaultDispatchRow()) {
|
||||
const defaultSummaryItem =
|
||||
@@ -8002,6 +8055,7 @@ export default {
|
||||
const parts = text.split('.');
|
||||
row.quantity =
|
||||
parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 3)}` : parts[0];
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
},
|
||||
handleDispatchCargoNumberInput(row, prop, value) {
|
||||
this.handleFreightNumberInput(row, prop, value);
|
||||
@@ -8021,12 +8075,14 @@ export default {
|
||||
const nextRow = this.normalizeTransportCargoRow({ priceUnit: this.defaultPriceUnit });
|
||||
if (index > -1) this.dispatchItemCargoRows.splice(index + 1, 0, nextRow);
|
||||
else this.dispatchItemCargoRows.push(nextRow);
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
},
|
||||
removeDispatchCargoRow(index) {
|
||||
this.dispatchItemCargoRows.splice(index, 1);
|
||||
if (!this.dispatchItemCargoRows.length) {
|
||||
this.dispatchItemCargoRows.push(this.normalizeTransportCargoRow());
|
||||
}
|
||||
this.dispatchCargoQuantityVersion += 1;
|
||||
},
|
||||
dispatchCargoFreightAmount(cargo = {}) {
|
||||
if (cargo.freightAmount !== undefined && cargo.freightAmount !== null) {
|
||||
@@ -8176,11 +8232,50 @@ export default {
|
||||
}, 0)
|
||||
);
|
||||
},
|
||||
/** 精简录入提示:可调度余量扣减当前本次数量后的剩余 */
|
||||
dispatchItemHintRemainingQuantity(row = {}) {
|
||||
/**
|
||||
* 当前编辑表单中,与指定行同货物(有身份)或同单位(无身份)已占用的本次数量合计。
|
||||
* 用于剩余数量展示联动,不参与提交校验(校验仍按整单合计对比计划余量)。
|
||||
*/
|
||||
getDispatchFormOccupiedQuantity(row = {}) {
|
||||
const goodsRows =
|
||||
this.dispatchItemForm?.taskEntryMode === 'full'
|
||||
? this.dispatchItemCargoRows || []
|
||||
: [this.dispatchItemForm || row];
|
||||
const hasCargoIdentity = Boolean(
|
||||
String(row.cargoName || row.goodsName || row.name || '').trim() ||
|
||||
String(row.cargoType || row.secondCargoTypeName || row.goodsType || row.type || '').trim()
|
||||
);
|
||||
const unit = this.getDispatchQuantityUnit(row);
|
||||
const cargoKey = this.getDispatchCargoIdentity(row);
|
||||
return goodsRows.reduce((sum, goods) => {
|
||||
if (!goods) return sum;
|
||||
if (hasCargoIdentity) {
|
||||
const goodsHasIdentity = Boolean(
|
||||
String(goods.cargoName || goods.goodsName || goods.name || '').trim() ||
|
||||
String(
|
||||
goods.cargoType || goods.secondCargoTypeName || goods.goodsType || goods.type || ''
|
||||
).trim()
|
||||
);
|
||||
if (!goodsHasIdentity || this.getDispatchCargoIdentity(goods) !== cargoKey) {
|
||||
return sum;
|
||||
}
|
||||
} else if (this.getDispatchQuantityUnit(goods) !== unit) {
|
||||
return sum;
|
||||
}
|
||||
return sum + this.parseDispatchQuantity(goods.quantity);
|
||||
}, 0);
|
||||
},
|
||||
/** 展示用剩余数量:计划可调度余量扣减本单已填本次数量(含当前行) */
|
||||
dispatchItemDisplayRemainingQuantity(row = {}) {
|
||||
// 依赖版本号,确保一行本次数量变化后其他行剩余数量一并刷新
|
||||
void this.dispatchCargoQuantityVersion;
|
||||
const available = this.dispatchItemRemainingQuantity(row);
|
||||
const current = this.parseDispatchQuantity(row.quantity);
|
||||
return Math.max(available - current, 0);
|
||||
const occupied = this.getDispatchFormOccupiedQuantity(row);
|
||||
return Math.max(available - occupied, 0);
|
||||
},
|
||||
/** 精简录入提示:与完整录入剩余数量展示规则一致 */
|
||||
dispatchItemHintRemainingQuantity(row = {}) {
|
||||
return this.dispatchItemDisplayRemainingQuantity(row);
|
||||
},
|
||||
pruneDispatchPendingRows(rows = []) {
|
||||
const planQuantities = new Map();
|
||||
@@ -8278,13 +8373,17 @@ export default {
|
||||
const fullEntry = row.taskEntryMode === 'full';
|
||||
const roadTransport = this.resolveTransportMode(row.transportType) === 'road';
|
||||
if (fullEntry) {
|
||||
if (roadTransport && row.carrierType === '自运') {
|
||||
// 公路运输时司机/手机号一律必填(含承运类型为承运商)
|
||||
if (roadTransport && row.carrierType) {
|
||||
requiredFields.push(['driverName', '司机']);
|
||||
requiredFields.push(['driverPhone', '手机号']);
|
||||
}
|
||||
} else if (row.carrierType && row.carrierType !== '承运商') {
|
||||
} else if (row.carrierType) {
|
||||
requiredFields.push(['driverName', '司机']);
|
||||
requiredFields.push(['driverPhone', '司机手机号']);
|
||||
requiredFields.push([
|
||||
'driverPhone',
|
||||
row.carrierType === '承运商' ? '手机号' : '司机手机号',
|
||||
]);
|
||||
}
|
||||
const emptyField = requiredFields.find(([prop]) => this.isBillingFieldEmpty(row[prop]));
|
||||
if (emptyField) return requiredMessage(emptyField[1]);
|
||||
|
||||
@@ -96,22 +96,12 @@
|
||||
prop="carrierName"
|
||||
label="承运商"
|
||||
min-width="140"
|
||||
/><el-table-column
|
||||
v-if="columnVisible.carrierType"
|
||||
prop="carrierType"
|
||||
label="承运类型"
|
||||
min-width="120"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="columnVisible.waybillCount"
|
||||
prop="waybillCount"
|
||||
label="运单数"
|
||||
width="90"
|
||||
/> <el-table-column
|
||||
v-if="columnVisible.importTypeName"
|
||||
prop="importTypeName"
|
||||
label="导入方式"
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="columnVisible.statusName"
|
||||
@@ -119,6 +109,12 @@
|
||||
label="状态"
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="columnVisible.settlementStatusName"
|
||||
prop="settlementStatusName"
|
||||
label="结算状态"
|
||||
width="110"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="columnVisible.createUserName"
|
||||
prop="createUserName"
|
||||
@@ -159,7 +155,7 @@
|
||||
>编辑</el-link
|
||||
>
|
||||
<el-link
|
||||
v-if="row.importStatus === 'draft'"
|
||||
v-if="canRemoveBatch(row)"
|
||||
type="danger"
|
||||
@click="removeBatch(row)"
|
||||
>删除</el-link
|
||||
@@ -641,10 +637,9 @@ const columnOptions = [
|
||||
{ prop: 'batchNo', label: '运单批次号' },
|
||||
{ prop: 'projectName', label: '项目名称' },
|
||||
{ prop: 'carrierName', label: '承运商' },
|
||||
{ prop: 'carrierType', label: '承运类型' },
|
||||
{ prop: 'waybillCount', label: '运单数' },
|
||||
{ prop: 'importTypeName', label: '导入方式' },
|
||||
{ prop: 'statusName', label: '状态' },
|
||||
{ prop: 'settlementStatusName', label: '结算状态' },
|
||||
{ prop: 'createUserName', label: '创建人' },
|
||||
{ prop: 'createTime', label: '创建时间' },
|
||||
{ prop: 'updateTime', label: '更新时间' },
|
||||
@@ -1266,9 +1261,47 @@ const fillEditForm = async row => {
|
||||
if (carrierValue) carrierChange(carrierValue);
|
||||
await loadBatchRows(snapshot.id);
|
||||
};
|
||||
const removeBatches = () =>
|
||||
api.removeImportBatches(selected.value.map(item => item.id).join(',')).then(loadBatches);
|
||||
const removeBatch = row => api.removeImportBatches(row.id).then(loadBatches);
|
||||
/** 与后端一致:仅未结算批次可整批删除 */
|
||||
const canRemoveBatch = row => String(row?.settlementStatus || 'unsettled') === 'unsettled';
|
||||
const removeBatches = async () => {
|
||||
if (!selected.value.length) {
|
||||
ElMessage.warning('请选择至少一条数据');
|
||||
return;
|
||||
}
|
||||
// 选中含部分结算/已结算时整批拦截,不静默跳过
|
||||
if (selected.value.some(row => !canRemoveBatch(row))) {
|
||||
ElMessage.warning('仅未结算的运单批次可以删除');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm('确认删除选中的运单批次?删除后不可恢复。', '提示', {
|
||||
type: 'warning',
|
||||
});
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
await api.removeImportBatches(selected.value.map(item => item.id).join(','));
|
||||
ElMessage.success('删除成功');
|
||||
return loadBatches();
|
||||
};
|
||||
const removeBatch = async row => {
|
||||
if (!canRemoveBatch(row)) {
|
||||
ElMessage.warning('仅未结算的运单批次可以删除');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认删除运单批次「${row.batchNo || ''}」?删除后不可恢复。`,
|
||||
'提示',
|
||||
{ type: 'warning' }
|
||||
);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
await api.removeImportBatches(row.id);
|
||||
ElMessage.success('删除成功');
|
||||
return loadBatches();
|
||||
};
|
||||
const projectChange = async id => {
|
||||
const requestId = ++projectRequestId;
|
||||
const item = projects.value.find(row => String(row.id) === String(id));
|
||||
|
||||
@@ -222,7 +222,12 @@
|
||||
/>
|
||||
|
||||
<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-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>
|
||||
@@ -337,7 +342,7 @@
|
||||
|
||||
<script>
|
||||
import * as api from '@/api/business/contract-manage';
|
||||
import { submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
import BillingPlanEditor from './components/billing-plan-editor.vue';
|
||||
import ContractAttachmentSection, {
|
||||
isContractSealMaterialLocation,
|
||||
@@ -445,7 +450,7 @@ export default {
|
||||
},
|
||||
preSettlementConfig: {},
|
||||
formalSettlementConfig: {},
|
||||
settlementTypeOptions: ['月结', '日结', '周结', '半月结', '固定天数周期结算'],
|
||||
settlementTypeOptions: ['月结', '日结', '周结', '固定天数周期结算'],
|
||||
billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'],
|
||||
billCutoffDayOptions: Array.from({ length: 31 }, (_, index) => ({
|
||||
label: `${index + 1}日`,
|
||||
@@ -754,7 +759,7 @@ export default {
|
||||
removeCustomPeriodRow(index) { if (index <= 0) return; const periods = [...(this.settlementRule.customPeriods || [])]; periods.splice(index, 1); this.settlementRule.customPeriods = normalizeCustomPeriods(periods); },
|
||||
validateCustomPeriods(periods = [], label) { const rows = normalizeCustomPeriods(periods); if (!rows.length) { this.$message.warning(`${label}:请至少配置一段自定义周期`); return false; } for (let index = 0; index < rows.length; index += 1) { const row = rows[index]; const startDay = Number(row.startDay); const endDay = Number(row.endDay); if (!Number.isFinite(startDay) || startDay < 1 || startDay > 31) { this.$message.warning(`${label}:请选择第${index + 1}行运单区间开始日`); return false; } if (!Number.isFinite(endDay) || endDay < 1 || endDay > 31) { this.$message.warning(`${label}:请选择第${index + 1}行运单区间结束日`); return false; } if (endDay < startDay) { this.$message.warning(`${label}:第${index + 1}行结束日不能早于开始日`); return false; } if (index > 0 && startDay !== Number(rows[index - 1].endDay) + 1) { this.$message.warning(`${label}:自定义多周期区间必须连续,不允许重叠或存在日期缺口`); return false; } } return true; },
|
||||
validateSettlementRule(rule, label) { if (Number(rule.autoGenerate) !== 1) return true; if (!rule.billStartDate || !rule.settlementType) { this.$message.warning(`${label}:请完整填写账单起始日和结算类型`); return false; } if (rule.settlementType === '月结' && !rule.billCycleType) { this.$message.warning(`${label}:请选择结算周期`); return false; } if (rule.settlementType === '月结' && rule.billCycleType === '固定截单日' && !rule.billCutoffDay) { this.$message.warning(`${label}:请选择账单截单日`); return false; } if (rule.settlementType === '月结' && rule.billCycleType === '自定义多周期') return this.validateCustomPeriods(rule.customPeriods, label); if (rule.settlementType === '固定天数周期结算' && !rule.cycleDays) { this.$message.warning(`${label}:请选择周期天数`); return false; } return true; },
|
||||
async submit() { await this.$refs.formRef.validate(); const total = this.paymentRatioRows.reduce((sum, row) => sum + Number(row.ratioLimit || 0), 0); if (this.paymentRatioRows.length && Math.abs(total - 100) > 0.0001) { this.$message.warning('付款比例上限合计必须等于100%'); return; } if (this.settlementConfigTab === 'pre') this.preSettlementConfig = { ...this.settlementRule }; else this.formalSettlementConfig = { ...this.settlementRule }; if (!this.validateSettlementRule(this.preSettlementConfig, '预结算配置') || !this.validateSettlementRule(this.formalSettlementConfig, '正式结算配置')) return; const settlementRule = { preSettlementConfig: this.preSettlementConfig, formalSettlementConfig: this.formalSettlementConfig }; await api.submitChange({ ...this.form, settlementCurrency: String(this.form.settlementCurrency || '').trim() || 'RMB', copyCount: normalizeOptionalPositiveInteger(this.form.copyCount), invoiceCycle: normalizeOptionalPositiveInteger(this.form.invoiceCycle), paymentDays: normalizeOptionalPositiveInteger(this.form.paymentDays), contractAmount: normalizeOptionalAmount(this.form.contractAmount), startDate: this.period[0], endDate: this.period[1], feeGenerationMode: this.feeGenerationMode, billingEnabled: this.feeGenerationMode === 'system' ? 1 : 0, billingPlanJson: JSON.stringify(this.plans), settlementRuleJson: JSON.stringify(settlementRule), preSettlementConfigJson: JSON.stringify(this.preSettlementConfig), formalSettlementConfigJson: JSON.stringify(this.formalSettlementConfig), paymentRatioJson: JSON.stringify(this.paymentRatioRows), contractFileJson: JSON.stringify(this.contractFileRows), attachmentsJson: JSON.stringify(this.attachments), changeContent: this.form.changeContent, changeReason: this.form.changeReason, changeAttachmentsJson: JSON.stringify(this.changeMaterials) }); await submitMkApprovalFlow({ bizType: 'contract-manage', bizId: this.form.id, subjectName: this.form.contractName || '', approvalStatus: this.form.approvalStatus || 'change_rejected' }); this.$message.success('变更已提交'); this.$router.back(); },
|
||||
async submit() { await this.$refs.formRef.validate(); const total = this.paymentRatioRows.reduce((sum, row) => sum + Number(row.ratioLimit || 0), 0); if (this.paymentRatioRows.length && Math.abs(total - 100) > 0.0001) { this.$message.warning('付款比例上限合计必须等于100%'); return; } if (this.settlementConfigTab === 'pre') this.preSettlementConfig = { ...this.settlementRule }; else this.formalSettlementConfig = { ...this.settlementRule }; if (!this.validateSettlementRule(this.preSettlementConfig, '预结算配置') || !this.validateSettlementRule(this.formalSettlementConfig, '正式结算配置')) return; const settlementRule = { preSettlementConfig: this.preSettlementConfig, formalSettlementConfig: this.formalSettlementConfig }; await api.submitChange({ ...this.form, settlementCurrency: String(this.form.settlementCurrency || '').trim() || 'RMB', copyCount: normalizeOptionalPositiveInteger(this.form.copyCount), invoiceCycle: normalizeOptionalPositiveInteger(this.form.invoiceCycle), paymentDays: normalizeOptionalPositiveInteger(this.form.paymentDays), contractAmount: normalizeOptionalAmount(this.form.contractAmount), startDate: this.period[0], endDate: this.period[1], feeGenerationMode: this.feeGenerationMode, billingEnabled: this.feeGenerationMode === 'system' ? 1 : 0, billingPlanJson: JSON.stringify(this.plans), settlementRuleJson: JSON.stringify(settlementRule), preSettlementConfigJson: JSON.stringify(this.preSettlementConfig), formalSettlementConfigJson: JSON.stringify(this.formalSettlementConfig), paymentRatioJson: JSON.stringify(this.paymentRatioRows), contractFileJson: JSON.stringify(this.contractFileRows), attachmentsJson: JSON.stringify(this.attachments), changeContent: this.form.changeContent, changeReason: this.form.changeReason, changeAttachmentsJson: JSON.stringify(this.changeMaterials) }); await submitMkApprovalFlow({ bizType: 'contract-manage', bizId: this.form.id, subjectName: this.form.contractName || '', approvalStatus: this.form.approvalStatus || 'change_rejected', mkEnabled: await loadMkEnabled().catch(() => false) }); this.$message.success('变更已提交'); this.$router.back(); },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -413,17 +413,15 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同编号">
|
||||
<el-form-item label="合同编号" prop="contractNo">
|
||||
<el-input
|
||||
v-model="form.contractNo"
|
||||
disabled
|
||||
maxlength="100"
|
||||
clearable
|
||||
:placeholder="
|
||||
formMode === 'add'
|
||||
? form.organizationId
|
||||
? '系统按部门规则自动生成'
|
||||
: '请先选择合同负责部门'
|
||||
: ''
|
||||
formMode === 'add' ? '不填写则按部门规则自动生成' : '请输入合同编号'
|
||||
"
|
||||
@input="handleContractNoInput"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同名称" prop="contractName">
|
||||
@@ -687,7 +685,12 @@
|
||||
<el-radio label="manual">账单导入生成</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<el-button type="primary" @click="openBillingPlan()">添加</el-button>
|
||||
<el-button
|
||||
v-if="form.feeGenerationMode !== 'manual'"
|
||||
type="primary"
|
||||
@click="openBillingPlan()"
|
||||
>添加</el-button
|
||||
>
|
||||
</div>
|
||||
<el-table :data="billingPlanRows" border>
|
||||
<el-table-column type="index" label="序号" width="80" align="center" />
|
||||
@@ -1313,7 +1316,23 @@ export default {
|
||||
{ label: '已到期', value: 'expired', statKey: 'expired' },
|
||||
],
|
||||
form: defaultForm(),
|
||||
contractNoManual: false,
|
||||
formRules: {
|
||||
contractNo: [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
const contractNo = String(value || '').trim();
|
||||
if (this.formMode === 'edit' && !contractNo) {
|
||||
return callback(new Error('请输入合同编号'));
|
||||
}
|
||||
if (contractNo.length > 100) {
|
||||
return callback(new Error('合同编号不能超过100个字符'));
|
||||
}
|
||||
callback();
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
contractName: [{ required: true, message: '请输入合同名称', trigger: 'blur' }],
|
||||
contractCategory: [{ required: true, message: '请选择合同类别', trigger: 'change' }],
|
||||
signType: [{ required: true, message: '请选择签约类型', trigger: 'change' }],
|
||||
@@ -1936,6 +1955,7 @@ export default {
|
||||
this.api.getDetail(id).then(res => this.applyDetail(res.data?.data || {}));
|
||||
},
|
||||
resetFormState() {
|
||||
this.contractNoManual = false;
|
||||
this.form = {
|
||||
...defaultForm(),
|
||||
handlerUserName:
|
||||
@@ -2011,7 +2031,20 @@ export default {
|
||||
this.$router.$avueRouter?.closeTag?.();
|
||||
this.$router.push(contractManageListRoute);
|
||||
},
|
||||
validateContractNo() {
|
||||
const contractNo = String(this.form.contractNo || '').trim();
|
||||
if (this.formMode === 'edit' && !contractNo) {
|
||||
this.$message.warning('请输入合同编号');
|
||||
return false;
|
||||
}
|
||||
if (contractNo.length > 100) {
|
||||
this.$message.warning('合同编号不能超过100个字符');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
validateBase(action) {
|
||||
if (!this.validateContractNo()) return false;
|
||||
if (action === 'temporary') {
|
||||
const required = [
|
||||
['signType', '签约类型'],
|
||||
@@ -2097,6 +2130,7 @@ export default {
|
||||
const projectName = projectId ? normalizeProjectValue(this.form.projectName) : '';
|
||||
return {
|
||||
...this.form,
|
||||
contractNo: String(this.form.contractNo || '').trim(),
|
||||
projectId,
|
||||
projectName,
|
||||
copyCount: normalizeOptionalInteger(this.form.copyCount),
|
||||
@@ -2145,7 +2179,9 @@ export default {
|
||||
bizType: 'contract-manage',
|
||||
bizId: id,
|
||||
subjectName: saved.contractName || submit.contractName || '',
|
||||
approvalStatus: previousApprovalStatus || saved.approvalStatus || submit.approvalStatus || '',
|
||||
approvalStatus:
|
||||
previousApprovalStatus || saved.approvalStatus || submit.approvalStatus || '',
|
||||
mkEnabled: this.mkEnabled,
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -2184,6 +2220,7 @@ export default {
|
||||
bizId: payload.id || this.form.id,
|
||||
subjectName: payload.contractName || this.form.contractName || '',
|
||||
approvalStatus: this.form.approvalStatus || 'change_rejected',
|
||||
mkEnabled: this.mkEnabled,
|
||||
}).then(() => {
|
||||
this.$message.success('已重新提交变更审批');
|
||||
this.closeForm();
|
||||
@@ -2507,11 +2544,14 @@ export default {
|
||||
this.refreshPreviewContractNo();
|
||||
}
|
||||
},
|
||||
handleContractNoInput(value) {
|
||||
this.contractNoManual = String(value || '').trim() !== '';
|
||||
},
|
||||
refreshPreviewContractNo() {
|
||||
if (this.formMode !== 'add') return;
|
||||
const organizationId = this.form.organizationId;
|
||||
if (!organizationId) {
|
||||
this.form.contractNo = '';
|
||||
if (!this.contractNoManual) this.form.contractNo = '';
|
||||
return;
|
||||
}
|
||||
const requestId = (this.contractNoPreviewRequestId =
|
||||
@@ -2519,11 +2559,11 @@ export default {
|
||||
api
|
||||
.nextContractNo(organizationId)
|
||||
.then(res => {
|
||||
if (requestId !== this.contractNoPreviewRequestId) return;
|
||||
if (requestId !== this.contractNoPreviewRequestId || this.contractNoManual) return;
|
||||
this.form.contractNo = res.data?.data || '';
|
||||
})
|
||||
.catch(() => {
|
||||
if (requestId !== this.contractNoPreviewRequestId) return;
|
||||
if (requestId !== this.contractNoPreviewRequestId || this.contractNoManual) return;
|
||||
this.form.contractNo = '';
|
||||
});
|
||||
},
|
||||
@@ -2956,6 +2996,7 @@ export default {
|
||||
},
|
||||
getContractChangeFieldLabel(field) {
|
||||
const labels = {
|
||||
contractNo: '合同编号',
|
||||
contractName: '合同名称',
|
||||
partyB: '乙方',
|
||||
startDate: '开始日期',
|
||||
@@ -3202,6 +3243,7 @@ export default {
|
||||
bizId: row.id,
|
||||
subjectName: row.contractName || '',
|
||||
approvalStatus: row.approvalStatus || '',
|
||||
mkEnabled: this.mkEnabled,
|
||||
})
|
||||
)
|
||||
: request();
|
||||
@@ -3578,7 +3620,7 @@ export default {
|
||||
|
||||
:deep(.el-form-item) {
|
||||
align-items: center;
|
||||
margin-bottom: 24px;
|
||||
//margin-bottom: 24px;
|
||||
}
|
||||
|
||||
:deep(.el-form-item__label) {
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<p>{{ timeRange(row) }}</p>
|
||||
<p>{{ goodsSummary(row) }}</p>
|
||||
<p>创建人:{{ row.createUserName || '-' }}</p>
|
||||
<p>创建时间:{{ row.createTime || '-' }}</p>
|
||||
<p>创建时间:{{ formatDate(row.createTime) }}</p>
|
||||
</section>
|
||||
<section class="route-progress">
|
||||
<div class="route-track">
|
||||
@@ -155,6 +155,7 @@
|
||||
|
||||
<script>
|
||||
import * as api from '@/api/business/master-order';
|
||||
import { splitRegionTokens } from '@/utils/region-address';
|
||||
import TableHeaderTools from '@/components/table-header-tools/main.vue';
|
||||
import MasterOrderEditor from './components/master-order-editor.vue';
|
||||
import MasterOrderDispatch from './components/master-order-dispatch.vue';
|
||||
@@ -332,6 +333,10 @@ export default {
|
||||
? `${String(row.planStartTime).slice(0, 10)} - ${String(row.planEndTime).slice(0, 10)}`
|
||||
: '-';
|
||||
},
|
||||
// 创建时间只展示日期。
|
||||
formatDate(value) {
|
||||
return value ? String(value).slice(0, 10) : '-';
|
||||
},
|
||||
goodsSummary(row) {
|
||||
const item = (row.goods || [])[0] || {};
|
||||
if (!item.cargoName && !item.cargoType) return '-';
|
||||
@@ -391,6 +396,26 @@ export default {
|
||||
}`;
|
||||
return `${city} ${district}`;
|
||||
},
|
||||
// 悬停气泡里的地址:起讫点若只保存了名称或详细地址的一半,气泡就会显示成
|
||||
// “柳南区”“安徽”这类残缺地址,故把两个字段互为补充后展示。
|
||||
completeAddress(name, address) {
|
||||
const rawName = String(name || '').trim();
|
||||
const rawAddress = String(address || '').trim();
|
||||
if (!rawName) return rawAddress;
|
||||
if (!rawAddress) return rawName;
|
||||
// 详细地址已含省市,本身就是完整地址,不再拼接名称,避免重复卡片上已有的站点名。
|
||||
if (/(?:省|自治区|特别行政区|市)/.test(rawAddress)) return rawAddress;
|
||||
const normalizedName = rawName.replace(/\s+/g, '');
|
||||
const normalizedAddress = rawAddress.replace(/\s+/g, '');
|
||||
if (normalizedAddress.includes(normalizedName)) return rawAddress;
|
||||
if (normalizedName.includes(normalizedAddress)) return rawName;
|
||||
// “珠海1号港口”与“珠海港口1号”这类同字异序写法只保留一个。
|
||||
if ([...normalizedName].sort().join('') === [...normalizedAddress].sort().join('')) {
|
||||
return normalizedName.length >= normalizedAddress.length ? rawName : rawAddress;
|
||||
}
|
||||
// 区域在前、详细地址在后。
|
||||
return splitRegionTokens(rawName) ? `${rawName}${rawAddress}` : `${rawAddress}${rawName}`;
|
||||
},
|
||||
routeNodeName(value, address, transportType, region = {}) {
|
||||
const text = String(value || '').trim();
|
||||
if (!text) return '-';
|
||||
@@ -457,15 +482,12 @@ export default {
|
||||
if (this.isStationLikeName(rawAddress) && !this.isStationLikeName(rawName)) {
|
||||
return {
|
||||
name: rawAddress,
|
||||
address: rawName || regionText || rawAddress,
|
||||
address: this.completeAddress(rawName, rawAddress) || regionText || rawAddress,
|
||||
};
|
||||
}
|
||||
const displayName = rawName || rawAddress || '-';
|
||||
const tipAddress =
|
||||
(rawAddress && rawAddress !== displayName ? rawAddress : '') ||
|
||||
regionText ||
|
||||
rawAddress ||
|
||||
displayName;
|
||||
this.completeAddress(rawName, rawAddress) || regionText || rawAddress || displayName;
|
||||
return { name: displayName, address: tipAddress };
|
||||
}
|
||||
return {
|
||||
@@ -475,7 +497,7 @@ export default {
|
||||
siteCode,
|
||||
nextTransportType,
|
||||
}),
|
||||
address: rawAddress || rawName || regionText || '-',
|
||||
address: this.completeAddress(rawName, rawAddress) || regionText || '-',
|
||||
};
|
||||
},
|
||||
routeNodes(row = {}) {
|
||||
|
||||
@@ -416,6 +416,7 @@ import { getList as getProjectList } from '@/api/business/project-apply';
|
||||
import { getDeptTree } from '@/api/system/dept';
|
||||
import { exportBlob } from '@/api/common';
|
||||
import { config, option } from '@/option/business/process-config';
|
||||
import { applyIncomingSearch } from '@/utils/search-range';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { mapGetters } from 'vuex';
|
||||
@@ -603,7 +604,8 @@ export default {
|
||||
});
|
||||
},
|
||||
normalizeListQuery(params = {}) {
|
||||
const query = { ...params, ...this.query };
|
||||
// 新条件覆盖旧条件,清空的筛选项不再沿用上一次的值。
|
||||
const query = applyIncomingSearch(this.query, params);
|
||||
const rawDeptId = query.deptId ?? query.searchDeptId;
|
||||
delete query.searchDeptId;
|
||||
if (rawDeptId !== undefined && rawDeptId !== null && String(rawDeptId).trim() !== '') {
|
||||
|
||||
@@ -256,7 +256,7 @@
|
||||
placeholder="请选择"
|
||||
filterable
|
||||
clearable
|
||||
:disabled="isBasicInfoReadonly"
|
||||
:disabled="dialogReadonly"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="平台公司" prop="undertakeDeptId">
|
||||
@@ -268,7 +268,7 @@
|
||||
collapse-tags-tooltip
|
||||
clearable
|
||||
filterable
|
||||
:disabled="isBasicInfoReadonly"
|
||||
:disabled="dialogReadonly"
|
||||
@change="handleUndertakeDeptChange"
|
||||
>
|
||||
<el-option
|
||||
@@ -1866,6 +1866,7 @@ export default {
|
||||
bizId: row.id,
|
||||
subjectName: row.projectName || '',
|
||||
approvalStatus: row.approvalStatus || '',
|
||||
mkEnabled: this.mkEnabled,
|
||||
}).then(() => request())
|
||||
: request();
|
||||
// 项目通过会同步等待合规推送,加遮罩防重复点击
|
||||
@@ -2089,6 +2090,7 @@ export default {
|
||||
bizId: id,
|
||||
subjectName: name,
|
||||
approvalStatus: status,
|
||||
mkEnabled: this.mkEnabled,
|
||||
}).then(() => {
|
||||
this.$message.success('提交成功!');
|
||||
this.closeProjectForm();
|
||||
@@ -2160,6 +2162,7 @@ export default {
|
||||
bizId: id,
|
||||
subjectName: this.form.projectName || '',
|
||||
approvalStatus: this.form.approvalStatus || 'change_rejected',
|
||||
mkEnabled: this.mkEnabled,
|
||||
}).then(() => {
|
||||
this.$message.success('提交成功!');
|
||||
this.closeProjectForm();
|
||||
@@ -2623,7 +2626,8 @@ export default {
|
||||
loadDeptOptions() {
|
||||
getDeptTree().then(res => {
|
||||
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)
|
||||
: deptTree;
|
||||
this.deptOptions = this.flattenDept(businessDeptTree);
|
||||
@@ -2636,8 +2640,9 @@ export default {
|
||||
const list = res.data.data || [];
|
||||
this.platformCompanyOptions = list.map(item => ({
|
||||
label: item.deptName || item.fullName || item.title || item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
// 雪花 ID 必须以字符串绑定,避免 JS Number 精度丢失导致多选提交异常
|
||||
value: item.id == null || item.id === '' ? '' : String(item.id),
|
||||
})).filter(item => item.value);
|
||||
this.ensureCurrentPlatformOption();
|
||||
});
|
||||
},
|
||||
|
||||
@@ -602,6 +602,8 @@ export default {
|
||||
if (result.code !== 200) throw new Error(result.msg || '导入失败');
|
||||
this.$message.success('导入完成');
|
||||
}
|
||||
// 与运单/配载一致:通知 keep-alive 列表实例重新拉取
|
||||
sessionStorage.setItem('transport-plan-list-refresh', '1');
|
||||
this.$router.push('/business/transport-plan');
|
||||
} catch (error) {
|
||||
this.$message.error(error.message || '导入失败');
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
reserve-keyword
|
||||
:remote-method="searchCustomers"
|
||||
:loading="customerLoading"
|
||||
placeholder="请选择客商基础档案"
|
||||
placeholder="请选择"
|
||||
@change="syncFeeBearer"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in customerOptions"
|
||||
@@ -63,6 +64,7 @@
|
||||
allow-create
|
||||
default-first-option
|
||||
placeholder="请选择或输入"
|
||||
@change="syncFeeBearer"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in receiverOptions"
|
||||
@@ -74,7 +76,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="票面金额" prop="faceAmount">
|
||||
<el-form-item label="票面金额" prop="faceAmount" required>
|
||||
<el-input-number
|
||||
v-model="form.faceAmount"
|
||||
:min="0"
|
||||
@@ -111,17 +113,15 @@
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="可用部门" prop="availableDeptIds">
|
||||
<el-tree-select
|
||||
v-model="form.availableDeptIds"
|
||||
:data="deptTree"
|
||||
:props="deptProps"
|
||||
node-key="id"
|
||||
multiple
|
||||
show-checkbox
|
||||
<el-cascader
|
||||
v-model="availableDeptCascaderValue"
|
||||
:options="businessDeptTreeOptions"
|
||||
:props="deptCascaderProps"
|
||||
placeholder="请选择"
|
||||
filterable
|
||||
clearable
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
placeholder="请选择,默认全部"
|
||||
@change="handleDeptChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -140,17 +140,9 @@
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="费用承担方" prop="feeBearerId">
|
||||
<el-select
|
||||
v-model="form.feeBearerId"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
:remote-method="searchCustomers"
|
||||
:loading="customerLoading"
|
||||
placeholder="请选择客商基础档案"
|
||||
>
|
||||
<el-select v-model="form.feeBearerId" filterable clearable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in customerOptions"
|
||||
v-for="item in feeBearerOptions"
|
||||
:key="item.id"
|
||||
:label="customerName(item)"
|
||||
:value="item.id"
|
||||
@@ -245,13 +237,13 @@ const emptyForm = () => ({
|
||||
billNo: '',
|
||||
issuerId: null,
|
||||
receiverName: '',
|
||||
billType: 'issued',
|
||||
billType: '',
|
||||
faceAmount: null,
|
||||
availableBalance: 0,
|
||||
issueDate: '',
|
||||
maturityDate: '',
|
||||
availableDeptIds: ['all'],
|
||||
availableDeptNames: '全部',
|
||||
availableDeptIds: [],
|
||||
availableDeptNames: '',
|
||||
feeBearerId: null,
|
||||
confirmedDiscountRate: null,
|
||||
issuingBank: '',
|
||||
@@ -272,9 +264,17 @@ export default {
|
||||
receiverOptions: [],
|
||||
customerLoading: false,
|
||||
saving: false,
|
||||
deptTree: [],
|
||||
businessDeptTreeOptions: [],
|
||||
deptMap: new Map(),
|
||||
deptProps: { label: 'title', value: 'id', children: 'children' },
|
||||
deptCascaderProps: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
children: 'children',
|
||||
multiple: true,
|
||||
checkStrictly: true,
|
||||
emitPath: true,
|
||||
expandTrigger: 'click',
|
||||
},
|
||||
bankOptions: [
|
||||
'中国工商银行',
|
||||
'中国农业银行',
|
||||
@@ -309,7 +309,10 @@ export default {
|
||||
issuerId: [{ required: true, message: '请选择出票单位', trigger: 'change' }],
|
||||
receiverName: [{ required: true, message: '请选择或输入收票单位', trigger: 'change' }],
|
||||
billType: [{ required: true, message: '请选择汇票类型', trigger: 'change' }],
|
||||
faceAmount: [{ validator: this.validateFaceAmount, trigger: 'change' }],
|
||||
faceAmount: [
|
||||
{ required: true, message: '请输入票面金额', trigger: 'change' },
|
||||
{ validator: this.validateFaceAmount, trigger: 'change' },
|
||||
],
|
||||
issueDate: [{ required: true, message: '请选择出票日期', trigger: 'change' }],
|
||||
maturityDate: [{ required: true, validator: this.validateMaturityDate, trigger: 'change' }],
|
||||
availableDeptIds: [{ validator: this.validateDepartments, trigger: 'change' }],
|
||||
@@ -340,6 +343,42 @@ export default {
|
||||
(Number(this.form.faceAmount || 0) * Number(this.form.confirmedDiscountRate || 0)) / 100
|
||||
);
|
||||
},
|
||||
// 可用部门:表单存部门 id,级联多选回显用根到节点的路径
|
||||
availableDeptCascaderValue: {
|
||||
get() {
|
||||
return (this.form.availableDeptIds || [])
|
||||
.filter(id => id !== undefined && id !== null && String(id) !== 'all' && String(id) !== '')
|
||||
.map(id => this.findDeptPath(id, this.businessDeptTreeOptions) || [String(id)]);
|
||||
},
|
||||
set(paths) {
|
||||
const ids = [
|
||||
...new Set(
|
||||
(paths || [])
|
||||
.map(path => {
|
||||
const nodes = Array.isArray(path) ? path.filter(item => item !== undefined && item !== null && item !== '') : [];
|
||||
return nodes.length ? String(nodes.at(-1)) : '';
|
||||
})
|
||||
.filter(Boolean)
|
||||
),
|
||||
];
|
||||
this.form.availableDeptIds = ids;
|
||||
this.form.availableDeptNames = ids
|
||||
.map(id => this.deptMap.get(String(id)))
|
||||
.filter(Boolean)
|
||||
.join('、');
|
||||
},
|
||||
},
|
||||
feeBearerOptions() {
|
||||
const issuer = this.customerOptions.find(item => String(item.id) === String(this.form.issuerId));
|
||||
const receiverName = String(this.form.receiverName || '').trim();
|
||||
const receiver = receiverName
|
||||
? this.customerOptions.find(item => this.customerName(item) === receiverName)
|
||||
: null;
|
||||
return [issuer, receiver].filter(
|
||||
(item, index, rows) =>
|
||||
item && rows.findIndex(row => row && String(row.id) === String(item.id)) === index
|
||||
);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.initialize();
|
||||
@@ -352,7 +391,6 @@ export default {
|
||||
async initialize() {
|
||||
await Promise.all([this.loadDepartments(), this.searchCustomers('')]);
|
||||
if (!this.recordId) {
|
||||
this.form.issueDate = this.$dayjs().format('YYYY-MM-DD');
|
||||
return;
|
||||
}
|
||||
const data = this.unwrapData(await api.getDetail(this.recordId));
|
||||
@@ -361,14 +399,20 @@ export default {
|
||||
...data,
|
||||
confirmedDiscountRate: this.normalizeDiscountRate(data.confirmedDiscountRate),
|
||||
bankDiscountReferenceRate: this.normalizeDiscountRate(data.bankDiscountReferenceRate),
|
||||
availableDeptIds: this.parse(data.availableDeptIdsJson),
|
||||
availableDeptIds: this.parse(data.availableDeptIdsJson)
|
||||
.filter(id => String(id) !== 'all')
|
||||
.map(id => String(id)),
|
||||
attachments: this.parse(data.attachmentsJson),
|
||||
};
|
||||
this.usageRecords = data.usageRecords || [];
|
||||
this.receiverOptions = data.receiverName ? [data.receiverName] : [];
|
||||
this.ensureCustomerOption(data.issuerId, data.issuerName);
|
||||
this.ensureCustomerOption(data.feeBearerId, data.feeBearerName);
|
||||
this.handleDeptChange(this.form.availableDeptIds);
|
||||
this.form.availableDeptNames = (this.form.availableDeptIds || [])
|
||||
.map(id => this.deptMap.get(String(id)))
|
||||
.filter(Boolean)
|
||||
.join('、');
|
||||
this.syncFeeBearer();
|
||||
},
|
||||
parse(value) {
|
||||
if (!value) return [];
|
||||
@@ -381,22 +425,52 @@ export default {
|
||||
},
|
||||
async loadDepartments() {
|
||||
const response = await getDeptTree(this.userInfo?.tenantId);
|
||||
const rows = this.unwrapData(response) || [];
|
||||
this.deptTree = [{ id: 'all', title: '全部', children: rows }];
|
||||
this.deptMap = new Map([['all', '全部']]);
|
||||
this.flattenDepartments(rows).forEach(item => this.deptMap.set(String(item.id), item.title));
|
||||
const rows = this.excludeExternalOrganization(this.unwrapData(response) || []);
|
||||
this.businessDeptTreeOptions = this.toDeptCascaderOptions(rows);
|
||||
this.deptMap = new Map();
|
||||
this.flattenDepartments(rows).forEach(item =>
|
||||
this.deptMap.set(String(item.id), item.title || item.deptName || item.name)
|
||||
);
|
||||
},
|
||||
excludeExternalOrganization(list = []) {
|
||||
return list.reduce((result, item) => {
|
||||
const deptName = item.title || item.deptName || item.name;
|
||||
if (String(deptName || '').trim() === '外部组织') return result;
|
||||
result.push({
|
||||
...item,
|
||||
children: item.children?.length
|
||||
? this.excludeExternalOrganization(item.children)
|
||||
: item.children,
|
||||
});
|
||||
return result;
|
||||
}, []);
|
||||
},
|
||||
toDeptCascaderOptions(list = []) {
|
||||
return list.map(item => ({
|
||||
label: item.title || item.deptName || item.name,
|
||||
value: item.id == null || item.id === '' ? '' : String(item.id),
|
||||
children: item.children?.length ? this.toDeptCascaderOptions(item.children) : undefined,
|
||||
}));
|
||||
},
|
||||
flattenDepartments(rows) {
|
||||
return (rows || []).flatMap(item => [item, ...this.flattenDepartments(item.children || [])]);
|
||||
},
|
||||
handleDeptChange(values) {
|
||||
const ids = values || [];
|
||||
this.form.availableDeptNames = ids.some(item => String(item) === 'all')
|
||||
? '全部'
|
||||
: ids
|
||||
.map(item => this.deptMap.get(String(item)))
|
||||
.filter(Boolean)
|
||||
.join('、');
|
||||
findDeptPath(id, tree = [], parents = []) {
|
||||
const target = Array.isArray(id) ? id.at(-1) : id;
|
||||
if (target === undefined || target === null || target === '') return null;
|
||||
for (const node of tree || []) {
|
||||
const path = [...parents, node.value];
|
||||
if (String(node.value) === String(target)) return path;
|
||||
const matched = this.findDeptPath(target, node.children, path);
|
||||
if (matched) return matched;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
syncFeeBearer() {
|
||||
const allowed = this.feeBearerOptions.map(item => String(item.id));
|
||||
if (this.form.feeBearerId && !allowed.includes(String(this.form.feeBearerId))) {
|
||||
this.form.feeBearerId = null;
|
||||
}
|
||||
},
|
||||
async searchCustomers(keyword) {
|
||||
this.customerLoading = true;
|
||||
@@ -545,7 +619,7 @@ export default {
|
||||
.bill-ledger-form-page__form :deep(.el-select),
|
||||
.bill-ledger-form-page__form :deep(.el-input-number),
|
||||
.bill-ledger-form-page__form :deep(.el-date-editor),
|
||||
.bill-ledger-form-page__form :deep(.el-tree-select) {
|
||||
.bill-ledger-form-page__form :deep(.el-cascader) {
|
||||
width: 100%;
|
||||
}
|
||||
.bill-ledger-form-page__form :deep(.el-input-number .el-input__inner) {
|
||||
|
||||
@@ -140,7 +140,7 @@ import * as api from '@/api/payment/billPayment';
|
||||
import * as billLedgerApi from '@/api/payment/billLedger';
|
||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||
import { getMkPublicDetail } from '@/api/mk-process';
|
||||
import { submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
|
||||
const emptyForm = () => ({
|
||||
id: null,
|
||||
@@ -348,6 +348,7 @@ export default {
|
||||
bizId: this.form.id,
|
||||
subjectName: this.form.paymentNo || this.form.billNo || '',
|
||||
approvalStatus: previousApprovalStatus,
|
||||
mkEnabled: await loadMkEnabled().catch(() => false),
|
||||
});
|
||||
this.$message.success('提交成功');
|
||||
this.goBack();
|
||||
|
||||
@@ -132,6 +132,7 @@ export default {
|
||||
bizId: row.id,
|
||||
subjectName: row.paymentNo || row.billNo || '',
|
||||
approvalStatus: previousApprovalStatus,
|
||||
mkEnabled: this.mkEnabled,
|
||||
});
|
||||
this.$message.success('提交成功');
|
||||
this.loadTable();
|
||||
|
||||
@@ -492,7 +492,7 @@ import { getDictionary } from '@/api/system/dictbiz';
|
||||
import { invoiceApplicationDetailColumns } from '@/option/payment/invoiceApplication';
|
||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||
import { getMkPublicDetail } from '@/api/mk-process';
|
||||
import { submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
|
||||
let localId = 0;
|
||||
const emptyLine = () => ({
|
||||
@@ -774,7 +774,7 @@ export default {
|
||||
},
|
||||
validateSettlements(rule, value, callback) {
|
||||
if (!this.form.settlements.length) {
|
||||
callback(new Error('请选择正式结算单'));
|
||||
callback(new Error('请选择付款结算单'));
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
@@ -1208,13 +1208,14 @@ export default {
|
||||
bizId: this.form.id,
|
||||
subjectName: this.form.applicationNo || '',
|
||||
approvalStatus: previousApprovalStatus,
|
||||
mkEnabled: await loadMkEnabled().catch(() => false),
|
||||
});
|
||||
this.$message.success('提交成功');
|
||||
this.goBack();
|
||||
},
|
||||
async syncReferenceData() {
|
||||
if (!this.settlementIds.length) {
|
||||
this.$message.warning('请先选择正式结算单');
|
||||
this.$message.warning('请先选择付款结算单');
|
||||
return;
|
||||
}
|
||||
await Promise.all([this.loadReceiverInformation(), this.loadSettlementDetails(false)]);
|
||||
|
||||
@@ -359,7 +359,7 @@ export default {
|
||||
item => String(item.formalSettlementNo || '').trim() === normalizedNo
|
||||
);
|
||||
if (!row?.id) {
|
||||
this.$message.warning('未找到对应的正式结算单');
|
||||
this.$message.warning('未找到对应的付款结算单');
|
||||
return;
|
||||
}
|
||||
this.$router.push({
|
||||
@@ -384,6 +384,7 @@ export default {
|
||||
bizId: row.id,
|
||||
subjectName: row.applicationNo || '',
|
||||
approvalStatus: previousApprovalStatus,
|
||||
mkEnabled: this.mkEnabled,
|
||||
});
|
||||
this.$message.success('提交成功');
|
||||
this.loadTable();
|
||||
@@ -504,6 +505,16 @@ export default {
|
||||
tip: row.kingdeeLockFailReason || '系统将自动补偿重锁',
|
||||
};
|
||||
}
|
||||
// 金蝶解锁终态标识:删单解锁的源单已作废,此标签用于区分人工作废与金蝶删单
|
||||
if (row.kingdeeUnlockTime) {
|
||||
const isDelete = row.kingdeeUnlockOperationName === '金蝶删单';
|
||||
return {
|
||||
show: true,
|
||||
type: isDelete ? 'danger' : 'warning',
|
||||
label: row.kingdeeUnlockOperationName || '金蝶解锁',
|
||||
tip: `${row.kingdeeUnlockOperator || '-'} 于 ${this.$dayjs(row.kingdeeUnlockTime).format('YYYY-MM-DD HH:mm:ss')} 解锁`,
|
||||
};
|
||||
}
|
||||
return { show: false };
|
||||
},
|
||||
displayValue(value) {
|
||||
|
||||
@@ -16,13 +16,22 @@
|
||||
<el-row :gutter="32">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="发票号码" prop="invoiceNo">
|
||||
<el-input v-model="form.invoiceNo" readonly placeholder="请选择金蝶票据池发票">
|
||||
<template v-if="!readonly" #append>
|
||||
<el-tooltip content="查询金蝶票据池" placement="top">
|
||||
<el-button :icon="Search" @click="openInvoiceDialog" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-tooltip
|
||||
:content="form.invoiceNo"
|
||||
:disabled="!form.invoiceNo"
|
||||
placement="top"
|
||||
:show-after="200"
|
||||
>
|
||||
<div class="receipt-form-page__overflow-trigger">
|
||||
<el-input v-model="form.invoiceNo" readonly placeholder="请选择金蝶票据池发票">
|
||||
<template v-if="!readonly" #append>
|
||||
<el-tooltip content="查询金蝶票据池" placement="top">
|
||||
<el-button :icon="Search" @click="openInvoiceDialog" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
@@ -32,7 +41,16 @@
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="发票类型">
|
||||
<el-input v-model="form.invoiceType" disabled placeholder="从金蝶票据池带出" />
|
||||
<el-tooltip
|
||||
:content="form.invoiceType"
|
||||
:disabled="!form.invoiceType"
|
||||
placement="top"
|
||||
:show-after="200"
|
||||
>
|
||||
<div class="receipt-form-page__overflow-trigger">
|
||||
<el-input v-model="form.invoiceType" disabled placeholder="从金蝶票据池带出" />
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
@@ -64,23 +82,54 @@
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="受票单位">
|
||||
<el-input v-model="form.receiverName" disabled placeholder="从金蝶票据池带出" />
|
||||
<el-tooltip
|
||||
:content="form.receiverName"
|
||||
:disabled="!form.receiverName"
|
||||
placement="top"
|
||||
:show-after="200"
|
||||
>
|
||||
<div class="receipt-form-page__overflow-trigger">
|
||||
<el-input v-model="form.receiverName" disabled placeholder="从金蝶票据池带出" />
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="开票单位">
|
||||
<el-input v-model="form.issuerName" disabled placeholder="从金蝶票据池带出" />
|
||||
<el-tooltip
|
||||
:content="form.issuerName"
|
||||
:disabled="!form.issuerName"
|
||||
placement="top"
|
||||
:show-after="200"
|
||||
>
|
||||
<div class="receipt-form-page__overflow-trigger">
|
||||
<el-input v-model="form.issuerName" disabled placeholder="从金蝶票据池带出" />
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="关联结算单" prop="settlementIds">
|
||||
<el-input :model-value="settlementLabel" readonly placeholder="请选择应付正式结算单">
|
||||
<template v-if="!readonly" #append>
|
||||
<el-tooltip content="选择正式结算单" placement="top">
|
||||
<el-button :icon="Search" @click="openSettlementDialog" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-tooltip
|
||||
:content="settlementLabel"
|
||||
:disabled="!settlementLabel"
|
||||
placement="top"
|
||||
:show-after="200"
|
||||
>
|
||||
<div class="receipt-form-page__overflow-trigger">
|
||||
<el-input
|
||||
:model-value="settlementLabel"
|
||||
readonly
|
||||
placeholder="请选择应付正式结算单"
|
||||
>
|
||||
<template v-if="!readonly" #append>
|
||||
<el-tooltip content="选择付款结算单" placement="top">
|
||||
<el-button :icon="Search" @click="openSettlementDialog" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -89,7 +138,12 @@
|
||||
<section-card title="结算信息">
|
||||
<el-table :data="form.settlements" border>
|
||||
<el-table-column type="index" label="序号" width="64" align="center" />
|
||||
<el-table-column label="结算单号" min-width="180" align="center">
|
||||
<el-table-column
|
||||
label="结算单号"
|
||||
min-width="180"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openSettlementDetail(row)">
|
||||
{{ row.formalSettlementNo }}
|
||||
@@ -173,7 +227,7 @@
|
||||
<el-input
|
||||
v-model="settlementDialog.keyword"
|
||||
clearable
|
||||
placeholder="3结算单号、项目或合同"
|
||||
placeholder="结算单号、项目或合同"
|
||||
@keyup.enter="loadSettlementCandidates"
|
||||
/>
|
||||
<el-button type="primary" @click="loadSettlementCandidates">查询</el-button>
|
||||
@@ -182,16 +236,32 @@
|
||||
ref="settlementTable"
|
||||
v-loading="settlementDialog.loading"
|
||||
:data="settlementDialog.rows"
|
||||
row-key="id"
|
||||
border
|
||||
@selection-change="settlementDialog.selection = $event"
|
||||
>
|
||||
<el-table-column type="selection" width="52" align="center" />
|
||||
<el-table-column prop="formalSettlementNo" label="结算单号" min-width="170" />
|
||||
<el-table-column prop="projectName" label="所属项目" min-width="150" />
|
||||
<el-table-column prop="deptName" label="所属组织" min-width="150" />
|
||||
<el-table-column prop="contractNo" label="合同编号" min-width="150" />
|
||||
<el-table-column prop="payerName" label="付款方" min-width="150" />
|
||||
<el-table-column prop="payeeName" label="收款方" min-width="150" />
|
||||
<el-table-column type="selection" width="52" align="center" reserve-selection />
|
||||
<el-table-column
|
||||
prop="formalSettlementNo"
|
||||
label="结算单号"
|
||||
min-width="170"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="projectName"
|
||||
label="所属项目"
|
||||
min-width="150"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column prop="deptName" label="所属组织" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column
|
||||
prop="contractNo"
|
||||
label="合同编号"
|
||||
min-width="150"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column prop="payerName" label="付款方" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="payeeName" label="收款方" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column label="结算总金额" min-width="140" align="right">
|
||||
<template #default="{ row }">{{ formatMoney(row.settlementAmount) }}</template>
|
||||
</el-table-column>
|
||||
@@ -206,7 +276,9 @@
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<el-button @click="settlementDialog.visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="confirmSettlements">确定</el-button>
|
||||
<el-button type="primary" @click="confirmSettlements">
|
||||
确定{{ settlementDialog.selection.length ? `(${settlementDialog.selection.length})` : '' }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</basic-container>
|
||||
@@ -219,7 +291,7 @@ import * as api from '@/api/payment/invoiceReceipt';
|
||||
import KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/main.vue';
|
||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||
import { getMkPublicDetail } from '@/api/mk-process';
|
||||
import { submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
|
||||
const emptyForm = () => ({
|
||||
id: null,
|
||||
@@ -437,7 +509,15 @@ export default {
|
||||
},
|
||||
async openSettlementDialog() {
|
||||
this.settlementDialog.visible = true;
|
||||
this.settlementDialog.selection = [];
|
||||
await this.loadSettlementCandidates();
|
||||
await this.$nextTick();
|
||||
const selectedIds = new Set(this.settlementIds.map(id => String(id)));
|
||||
this.settlementDialog.rows.forEach(row => {
|
||||
if (selectedIds.has(String(row.id))) {
|
||||
this.$refs.settlementTable?.toggleRowSelection(row, true);
|
||||
}
|
||||
});
|
||||
},
|
||||
async loadSettlementCandidates() {
|
||||
this.settlementDialog.loading = true;
|
||||
@@ -468,11 +548,21 @@ export default {
|
||||
this.$message.warning('关联结算单必须属于同一项目、组织及收付款方');
|
||||
return;
|
||||
}
|
||||
const previousAmount = new Map(
|
||||
this.form.settlements.map(item => [
|
||||
String(item.formalSettlementId || item.settlementId),
|
||||
item.allocatedInvoiceAmount,
|
||||
])
|
||||
);
|
||||
this.form.settlements = rows.map(item => ({
|
||||
...item,
|
||||
formalSettlementId: item.id,
|
||||
settlementId: item.id,
|
||||
allocatedInvoiceAmount: rows.length === 1 ? Number(item.settlementAmount || 0) : 0,
|
||||
allocatedInvoiceAmount: previousAmount.has(String(item.id))
|
||||
? Number(previousAmount.get(String(item.id)) || 0)
|
||||
: rows.length === 1
|
||||
? Number(item.settlementAmount || 0)
|
||||
: 0,
|
||||
}));
|
||||
this.form.projectName = first.projectName;
|
||||
this.form.deptName = first.deptName;
|
||||
@@ -482,9 +572,8 @@ export default {
|
||||
await this.loadReferenceInformation();
|
||||
this.$refs.formRef?.validateField('settlementIds').catch(() => {});
|
||||
},
|
||||
async selectSettlement(row) {
|
||||
this.settlementDialog.selection = [row];
|
||||
await this.confirmSettlements();
|
||||
selectSettlement(row) {
|
||||
this.$refs.settlementTable?.toggleRowSelection(row);
|
||||
},
|
||||
async loadReferenceInformation() {
|
||||
const data = this.unwrapData(await api.getReferenceInformation(this.settlementIds.join(',')));
|
||||
@@ -571,6 +660,7 @@ export default {
|
||||
bizId: this.form.id,
|
||||
subjectName: this.form.invoiceNo || '',
|
||||
approvalStatus: previousApprovalStatus,
|
||||
mkEnabled: await loadMkEnabled().catch(() => false),
|
||||
});
|
||||
this.$message.success('提交成功');
|
||||
this.goBack();
|
||||
@@ -616,6 +706,15 @@ export default {
|
||||
.receipt-form-page__form :deep(.el-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
.receipt-form-page__overflow-trigger {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
.receipt-form-page__form :deep(.el-tooltip__trigger:not(.el-select__wrapper)) {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
.receipt-form-page__remark :deep(.el-form-item__content) {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
@@ -341,6 +341,7 @@ export default {
|
||||
bizId: row.id,
|
||||
subjectName: row.invoiceNo || '',
|
||||
approvalStatus: previousApprovalStatus,
|
||||
mkEnabled: this.mkEnabled,
|
||||
});
|
||||
this.$message.success('提交成功');
|
||||
this.loadTable();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -152,6 +152,9 @@ import organizationSearch from '@/mixins/organization-search';
|
||||
import { getMKApprovalUrl } from '@/api/system/business-process';
|
||||
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
|
||||
const paymentApplicationListRoute = '/payment/payment-application';
|
||||
const paymentApplicationListRefreshKey = 'payment-application-list-refresh';
|
||||
|
||||
export default {
|
||||
name: 'PaymentApplication',
|
||||
mixins: [organizationSearch],
|
||||
@@ -160,6 +163,7 @@ export default {
|
||||
rows: [],
|
||||
selection: [],
|
||||
loading: false,
|
||||
approveLoading: false,
|
||||
syncLoading: false,
|
||||
resultSyncing: false,
|
||||
query: {},
|
||||
@@ -193,7 +197,28 @@ export default {
|
||||
this.mkEnabled = false;
|
||||
});
|
||||
},
|
||||
activated() {
|
||||
this.consumeListRefreshFlag();
|
||||
},
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
if (
|
||||
to.path === paymentApplicationListRoute &&
|
||||
from?.path?.includes('/payment-application/form')
|
||||
) {
|
||||
this.consumeListRefreshFlag();
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/** 表单提交成功后带标记返回时,重新拉取列表 */
|
||||
consumeListRefreshFlag() {
|
||||
if (!sessionStorage.getItem(paymentApplicationListRefreshKey)) {
|
||||
return;
|
||||
}
|
||||
sessionStorage.removeItem(paymentApplicationListRefreshKey);
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
hasPermission(code) {
|
||||
return this.permission?.[code] !== false;
|
||||
},
|
||||
@@ -296,19 +321,28 @@ export default {
|
||||
bizId: row.id,
|
||||
subjectName: row.paymentNo || '',
|
||||
approvalStatus: previousApprovalStatus,
|
||||
mkEnabled: this.mkEnabled,
|
||||
});
|
||||
this.$message.closeAll?.();
|
||||
this.$message.success('提交成功');
|
||||
this.refreshChange();
|
||||
},
|
||||
async handleApprove(row) {
|
||||
const res = await api.approve({ id: row.id });
|
||||
// data=false 表示审批已通过但自动同步金蝶失败,msg 带具体原因
|
||||
if (res.data.data === false) {
|
||||
this.$message.warning(res.data.msg);
|
||||
} else {
|
||||
this.$message.success(res.data.msg || '审批通过');
|
||||
// 防止重复点击:请求进行中忽略后续点击
|
||||
if (this.approveLoading) return;
|
||||
this.approveLoading = true;
|
||||
try {
|
||||
const res = await api.approve({ id: row.id });
|
||||
// data=false 表示审批已通过但自动同步金蝶失败,msg 带具体原因
|
||||
if (res.data.data === false) {
|
||||
this.$message.warning(res.data.msg);
|
||||
} else {
|
||||
this.$message.success(res.data.msg || '审批通过');
|
||||
}
|
||||
this.refreshChange();
|
||||
} finally {
|
||||
this.approveLoading = false;
|
||||
}
|
||||
this.refreshChange();
|
||||
},
|
||||
handleMkAudit(row) {
|
||||
if (!row?.id) {
|
||||
@@ -441,6 +475,16 @@ export default {
|
||||
tip: row.kingdeeLockFailReason || '系统将自动补偿重锁',
|
||||
};
|
||||
}
|
||||
// 金蝶解锁终态标识:后端按 unlocked 锁记录回填(付款申请不作废,仅此标识可区分金蝶删单与推送失败)
|
||||
if (row.kingdeeUnlockTime) {
|
||||
const isDelete = row.kingdeeUnlockOperationName === '金蝶删单';
|
||||
return {
|
||||
show: true,
|
||||
type: isDelete ? 'danger' : 'warning',
|
||||
label: row.kingdeeUnlockOperationName || '金蝶解锁',
|
||||
tip: `${row.kingdeeUnlockOperator || '-'} 于 ${this.$dayjs(row.kingdeeUnlockTime).format('YYYY-MM-DD HH:mm:ss')} 解锁`,
|
||||
};
|
||||
}
|
||||
return { show: false };
|
||||
},
|
||||
displayValue(value) {
|
||||
|
||||
@@ -46,6 +46,9 @@
|
||||
<el-table-column label="金蝶未认领金额" min-width="140" align="right">
|
||||
<template #default="{ row }">{{ formatMoney(row.unclaimedAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="剩余可认领金额" min-width="140" align="right">
|
||||
<template #default="{ row }">{{ formatMoney(flowRemaining(row)) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="summary" label="摘要" min-width="180" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<el-row :gutter="32" class="receipt-claim-batch-form-page__claim-info">
|
||||
@@ -298,10 +301,24 @@ export default {
|
||||
0
|
||||
);
|
||||
},
|
||||
flowRemaining(flow) {
|
||||
const unclaimed = Number(flow.unclaimedAmount || 0);
|
||||
const receipt = Number(flow.receiptAmount || 0);
|
||||
const ceiling = unclaimed > 0 && receipt > 0 ? Math.min(unclaimed, receipt) : unclaimed || receipt;
|
||||
return Math.max(ceiling - Number(flow.claimedAmount || 0), 0);
|
||||
},
|
||||
maxAllocation(row) {
|
||||
const current = Number(row.settlement.allocations?.[row.flow.id] || 0);
|
||||
const otherTotal = this.settlementAllocatedTotal(row.settlement) - current;
|
||||
return Math.max(this.settlementRemaining(row.settlement) - otherTotal, 0);
|
||||
// 流水维度:该流水其余分摊已占用部分同样挤占剩余可认领金额
|
||||
const flowOtherTotal = this.flowAllocatedTotal(row.flow.id) - current;
|
||||
return Math.max(
|
||||
Math.min(
|
||||
this.settlementRemaining(row.settlement) - otherTotal,
|
||||
this.flowRemaining(row.flow) - flowOtherTotal
|
||||
),
|
||||
0
|
||||
);
|
||||
},
|
||||
handleAllocationChange(settlement) {
|
||||
const total = this.settlementAllocatedTotal(settlement);
|
||||
|
||||
@@ -252,10 +252,11 @@ export default {
|
||||
);
|
||||
},
|
||||
claimableAmount() {
|
||||
return Math.max(
|
||||
Number(this.form.unclaimedAmount || 0) - Number(this.form.claimedAmount || 0),
|
||||
0
|
||||
);
|
||||
const unclaimed = Number(this.form.unclaimedAmount || 0);
|
||||
const receipt = Number(this.form.receiptAmount || 0);
|
||||
const ceiling =
|
||||
unclaimed > 0 && receipt > 0 ? Math.min(unclaimed, receipt) : unclaimed || receipt;
|
||||
return Math.max(ceiling - Number(this.form.claimedAmount || 0), 0);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
@@ -274,14 +275,21 @@ export default {
|
||||
}
|
||||
const data = this.unwrapData(await api.getDetail(this.flowId));
|
||||
const userInfo = this.$store.getters.userInfo || {};
|
||||
// 部分认领继续认领:预填本流水历史关联且仍有剩余可认领金额的结算单
|
||||
const relatedSettlements = (data?.relatedSettlements || []).map(item => ({
|
||||
...item,
|
||||
formalSettlementId: item.id,
|
||||
settlementId: item.id,
|
||||
allocatedReceiptAmount: 0,
|
||||
}));
|
||||
this.form = {
|
||||
...emptyForm(),
|
||||
...data,
|
||||
claimerName: userInfo.realName || userInfo.userName || data.claimerName || '',
|
||||
claimerDeptName: userInfo.deptName || userInfo.dept_name || data.claimerDeptName || '',
|
||||
claimDate: this.$dayjs().format('YYYY-MM-DD'),
|
||||
settlementIds: [],
|
||||
settlements: [],
|
||||
settlementIds: relatedSettlements.map(item => item.formalSettlementId),
|
||||
settlements: relatedSettlements,
|
||||
attachments: [],
|
||||
};
|
||||
},
|
||||
@@ -347,7 +355,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
if (this.allocatedTotal > this.claimableAmount + 0.001) {
|
||||
this.$message.warning('累计认领金额不能超过公告未认领金额(剩余可认领金额)');
|
||||
this.$message.warning('累计认领金额不能超过剩余可认领金额');
|
||||
return;
|
||||
}
|
||||
for (const row of this.form.settlements)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,219 +1,140 @@
|
||||
<template>
|
||||
<div class="fs-table-panel">
|
||||
<div class="fs-table-panel__toolbar">
|
||||
<div>
|
||||
<el-button
|
||||
v-if="hasPermission('formal_settlement_add')"
|
||||
type="primary"
|
||||
@click="$emit('create')"
|
||||
>新增</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="hasPermission('formal_settlement_payment')"
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!selection.length"
|
||||
@click="$emit('payment')"
|
||||
>付款申请</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="hasPermission('formal_settlement_sync')"
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="selection.length !== 1"
|
||||
:loading="syncLoading"
|
||||
@click="$emit('sync')"
|
||||
>同步金蝶</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="hasPermission('formal_settlement_print')"
|
||||
type="primary"
|
||||
plain
|
||||
@click="emitSingle('print')"
|
||||
>打印结算单</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="hasPermission('formal_settlement_export')"
|
||||
type="primary"
|
||||
plain
|
||||
@click="$emit('export')"
|
||||
>导出</el-button
|
||||
>
|
||||
</div>
|
||||
<settlement-table-tools
|
||||
:columns="columnSettingOptions"
|
||||
v-model:visible-column-keys="visibleColumnKeys"
|
||||
v-model:table-size="tableSize"
|
||||
:search-visible="searchVisible"
|
||||
@update:search-visible="$emit('update:searchVisible', $event)"
|
||||
@refresh="$emit('refresh')"
|
||||
/>
|
||||
</div>
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
:data="rows"
|
||||
:size="tableSize"
|
||||
border
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentChange"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
|
||||
<el-table-column type="selection" width="52" fixed="left" align="center" />
|
||||
<el-table-column
|
||||
v-for="column in visibleColumns"
|
||||
:key="column.prop"
|
||||
v-bind="column"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
<avue-crud
|
||||
ref="crud"
|
||||
:option="option"
|
||||
:table-loading="loading"
|
||||
:data="rows"
|
||||
v-model:page="crudPage"
|
||||
@search-change="(params, done) => $emit('search-change', params, done)"
|
||||
@search-reset="$emit('search-reset')"
|
||||
@selection-change="handleSelectionChange"
|
||||
@refresh-change="$emit('refresh')"
|
||||
@on-load="page => $emit('load', page)"
|
||||
>
|
||||
<template #menu-left>
|
||||
<el-button v-if="hasPermission('add')" type="primary" @click="$emit('create')"
|
||||
>新增</el-button
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link
|
||||
v-if="column.link && row[column.prop]"
|
||||
type="primary"
|
||||
@click="emitAction('view', row)"
|
||||
>{{ row[column.prop] }}</el-link
|
||||
>
|
||||
<el-tag
|
||||
v-else-if="column.status"
|
||||
:type="statusType(row.approvalStatus)"
|
||||
class="status-text"
|
||||
>{{ displayValue(row[column.prop]) }}</el-tag
|
||||
>
|
||||
<span v-else-if="column.money">{{ formatMoney(row[column.prop], row.currency) }}</span>
|
||||
<span
|
||||
v-else-if="column.prop === 'invoiceStatusName'"
|
||||
:class="['fs-table-panel__invoice-status', `is-${row.invoiceStatus || 'unreceived'}`]"
|
||||
>{{ invoiceName(row.invoiceStatus, row.settlementType) }}</span>
|
||||
<span v-else-if="column.prop === 'paymentStatusName'">{{
|
||||
paymentName(row.paymentStatus)
|
||||
}}</span>
|
||||
<span v-else-if="column.prop === 'kingdeeSyncStatus'">{{
|
||||
kingdeeSyncName(row.kingdeeSyncStatus)
|
||||
}}</span>
|
||||
<template v-else-if="column.prop === 'kingdeeLockStatus'">
|
||||
<el-tooltip v-if="lockTag(row).show" :content="lockTag(row).tip" placement="top">
|
||||
<el-tag :type="lockTag(row).type" class="status-text">{{ lockTag(row).label }}</el-tag>
|
||||
</el-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<span v-else>{{ displayValue(row[column.prop]) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="320" fixed="right" align="center">
|
||||
<template #default="{ row }"
|
||||
><div class="fs-table-panel__links">
|
||||
<el-link
|
||||
v-for="action in rowActions(row)"
|
||||
:key="action.type"
|
||||
:type="action.danger ? 'danger' : 'primary'"
|
||||
@click="emitAction(action.type, row)"
|
||||
>{{ action.label }}</el-link
|
||||
>
|
||||
</div></template
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="fs-table-panel__pagination">
|
||||
<el-pagination
|
||||
:current-page="page.current"
|
||||
:page-size="page.size"
|
||||
:total="page.total"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="current => $emit('page-change', { current, size: page.size })"
|
||||
@size-change="size => $emit('page-change', { current: 1, size })"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
v-if="showPaymentAction && hasPermission('payment')"
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!selection.length"
|
||||
@click="$emit('payment')"
|
||||
>付款申请</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="hasPermission('sync')"
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!selection.length"
|
||||
:loading="syncLoading"
|
||||
@click="$emit('sync')"
|
||||
>同步金蝶</el-button
|
||||
>
|
||||
<el-button v-if="hasPermission('print')" type="primary" plain @click="emitSingle('print')"
|
||||
>打印结算单</el-button
|
||||
>
|
||||
<el-button v-if="hasPermission('export')" type="primary" plain @click="$emit('export')"
|
||||
>导出</el-button
|
||||
>
|
||||
</template>
|
||||
|
||||
<template #formalSettlementNo="{ row }">
|
||||
<el-link type="primary" @click="emitAction('view', row)">{{
|
||||
row.formalSettlementNo || '-'
|
||||
}}</el-link>
|
||||
</template>
|
||||
|
||||
<template #invoiceStatusName="{ row }">
|
||||
<span :class="['fs-invoice-status', `is-${row.invoiceStatus || 'unreceived'}`]">{{
|
||||
invoiceName(row.invoiceStatus, row.settlementType)
|
||||
}}</span>
|
||||
</template>
|
||||
|
||||
<template #paymentStatusName="{ row }">{{ paymentName(row.paymentStatus) }}</template>
|
||||
|
||||
<template #approvalStatusName="{ row }">
|
||||
<el-tag :type="statusType(row.approvalStatus)" class="status-text">{{
|
||||
row.approvalStatusName || '-'
|
||||
}}</el-tag>
|
||||
</template>
|
||||
|
||||
<template #kingdeeSyncStatus="{ row }">{{ kingdeeSyncName(row.kingdeeSyncStatus) }}</template>
|
||||
|
||||
<template #kingdeeLockStatus="{ row }">
|
||||
<el-tooltip v-if="lockTag(row).show" :content="lockTag(row).tip" placement="top">
|
||||
<el-tag :type="lockTag(row).type" class="status-text">{{ lockTag(row).label }}</el-tag>
|
||||
</el-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
|
||||
<template #menu="{ row }">
|
||||
<el-link
|
||||
v-for="action in rowActions(row)"
|
||||
:key="action.type"
|
||||
:type="action.danger ? 'danger' : 'primary'"
|
||||
@click="emitAction(action.type, row)"
|
||||
>{{ action.label }}</el-link
|
||||
>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
invoiceStatusName,
|
||||
kingdeeSyncStatusOptions,
|
||||
paymentStatusOptions,
|
||||
} from '@/option/settlement/formalSettlementSearch';
|
||||
import SettlementTableTools from './settlement-table-tools.vue';
|
||||
import { invoiceStatusName } from '@/option/settlement/formalSettlementSearch';
|
||||
import { kingdeeSyncName, paymentStatusName } from '@/option/settlement/formalSettlement';
|
||||
|
||||
export default {
|
||||
name: 'FormalSettlementTablePanel',
|
||||
components: { SettlementTableTools },
|
||||
props: {
|
||||
option: { type: Object, required: true },
|
||||
rows: { type: Array, default: () => [] },
|
||||
columns: { type: Array, default: () => [] },
|
||||
loading: { type: Boolean, default: false },
|
||||
syncLoading: { type: Boolean, default: false },
|
||||
page: { type: Object, required: true },
|
||||
hasPermission: { type: Function, required: true },
|
||||
mkEnabled: { type: Boolean, default: false },
|
||||
searchVisible: { type: Boolean, default: true },
|
||||
/** 是否展示付款申请按钮(仅付款结算单) */
|
||||
showPaymentAction: { type: Boolean, default: true },
|
||||
billLabel: { type: String, default: '结算单' },
|
||||
},
|
||||
emits: [
|
||||
'create',
|
||||
'payment',
|
||||
'sync',
|
||||
'print',
|
||||
'export',
|
||||
'refresh',
|
||||
'page-change',
|
||||
'load',
|
||||
'action',
|
||||
'update:selection',
|
||||
'update:searchVisible',
|
||||
'search-change',
|
||||
'search-reset',
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
selection: [],
|
||||
tableSize: 'default',
|
||||
visibleColumnKeys: [],
|
||||
knownColumnProps: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
columnSettingOptions() {
|
||||
return this.columns.map(column => ({
|
||||
prop: column.prop,
|
||||
label: column.label,
|
||||
}));
|
||||
},
|
||||
visibleColumns() {
|
||||
if (!this.visibleColumnKeys.length) return this.columns;
|
||||
return this.columns.filter(column => this.visibleColumnKeys.includes(column.prop));
|
||||
// 分页对象由父级持有,avue 内部翻页时同步回写同一个对象
|
||||
crudPage: {
|
||||
get() {
|
||||
return this.page;
|
||||
},
|
||||
set(value) {
|
||||
Object.assign(this.page, value || {});
|
||||
},
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
columns: {
|
||||
immediate: true,
|
||||
handler(columns) {
|
||||
const props = columns.map(column => column.prop);
|
||||
if (!this.visibleColumnKeys.length) {
|
||||
this.visibleColumnKeys = props;
|
||||
this.knownColumnProps = props;
|
||||
return;
|
||||
}
|
||||
const visible = new Set(this.visibleColumnKeys);
|
||||
const known = new Set(this.knownColumnProps || []);
|
||||
props.forEach(prop => {
|
||||
if (!known.has(prop)) visible.add(prop);
|
||||
});
|
||||
this.knownColumnProps = props;
|
||||
this.visibleColumnKeys = props.filter(prop => visible.has(prop));
|
||||
},
|
||||
},
|
||||
rows() {
|
||||
this.selection = [];
|
||||
this.$refs.tableRef?.clearSelection();
|
||||
this.$refs.crud?.toggleSelection?.();
|
||||
this.$emit('update:selection', this.selection);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleCurrentChange(row) {
|
||||
if (!row && this.selection.length === 1) {
|
||||
this.selection = [];
|
||||
this.$emit('update:selection', this.selection);
|
||||
}
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
this.selection = selection;
|
||||
this.$emit('update:selection', selection);
|
||||
@@ -223,7 +144,7 @@ export default {
|
||||
},
|
||||
emitSingle(type) {
|
||||
if (this.selection.length !== 1) {
|
||||
this.$message.warning(`${type === 'print' ? '打印' : '操作'}需选择一条正式结算单`);
|
||||
this.$message.warning(`${type === 'print' ? '打印' : '操作'}需选择一条${this.billLabel}`);
|
||||
return;
|
||||
}
|
||||
this.$emit('action', { type, row: this.selection[0] });
|
||||
@@ -233,27 +154,26 @@ export default {
|
||||
},
|
||||
rowActions(row) {
|
||||
const actions = [];
|
||||
if (this.hasPermission('formal_settlement_view'))
|
||||
actions.push({ type: 'view', label: '查看' });
|
||||
if (this.hasPermission('formal_settlement_edit') && this.isEditable(row))
|
||||
if (this.hasPermission('view')) actions.push({ type: 'view', label: '查看' });
|
||||
if (this.hasPermission('edit') && this.isEditable(row))
|
||||
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 });
|
||||
if (this.hasPermission('formal_settlement_submit') && this.isEditable(row))
|
||||
if (this.hasPermission('submit') && this.isEditable(row))
|
||||
actions.push({ type: 'submit', label: '提交' });
|
||||
if (
|
||||
this.mkEnabled &&
|
||||
this.hasPermission('formal_settlement_approve') &&
|
||||
this.hasPermission('approve') &&
|
||||
['reviewing', 'approved'].includes(row.approvalStatus)
|
||||
) {
|
||||
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: 'return', label: '驳回', danger: true });
|
||||
}
|
||||
if (
|
||||
this.hasPermission('formal_settlement_void') &&
|
||||
this.hasPermission('void') &&
|
||||
row.approvalStatus === 'approved' &&
|
||||
row.kingdeeSyncStatus !== 'synced'
|
||||
)
|
||||
@@ -270,14 +190,19 @@ export default {
|
||||
return invoiceStatusName(value, settlementType);
|
||||
},
|
||||
paymentName(value) {
|
||||
return paymentStatusOptions.find(item => item.value === value)?.label || value || '-';
|
||||
return paymentStatusName(value);
|
||||
},
|
||||
kingdeeSyncName(value) {
|
||||
return kingdeeSyncStatusOptions.find(item => item.value === value)?.label || value || '-';
|
||||
return kingdeeSyncName(value);
|
||||
},
|
||||
lockTag(row) {
|
||||
if (row.kingdeeLockStatus === 'locked') {
|
||||
return { show: true, type: 'danger', label: '金蝶锁定中', tip: '该单据已被金蝶锁定,不可编辑/作废' };
|
||||
return {
|
||||
show: true,
|
||||
type: 'danger',
|
||||
label: '金蝶锁定中',
|
||||
tip: '该单据已被金蝶锁定,不可编辑/作废',
|
||||
};
|
||||
}
|
||||
if (row.kingdeeLockStatus === 'failed') {
|
||||
if ((row.kingdeeTryCount || 0) >= 5) {
|
||||
@@ -295,32 +220,24 @@ export default {
|
||||
tip: row.kingdeeLockFailReason || '系统将自动补偿重锁',
|
||||
};
|
||||
}
|
||||
// 金蝶解锁终态标识:删单解锁的源单已作废,此标签用于区分人工作废与金蝶删单
|
||||
if (row.kingdeeUnlockTime) {
|
||||
const isDelete = row.kingdeeUnlockOperationName === '金蝶删单';
|
||||
return {
|
||||
show: true,
|
||||
type: isDelete ? 'danger' : 'warning',
|
||||
label: row.kingdeeUnlockOperationName || '金蝶解锁',
|
||||
tip: `${row.kingdeeUnlockOperator || '-'} 于 ${this.$dayjs(row.kingdeeUnlockTime).format('YYYY-MM-DD HH:mm:ss')} 解锁`,
|
||||
};
|
||||
}
|
||||
return { show: false };
|
||||
},
|
||||
displayValue(value) {
|
||||
return value === null || value === undefined || value === '' ? '-' : value;
|
||||
},
|
||||
formatMoney(value, currency = 'RMB') {
|
||||
return `${Number(value || 0).toFixed(2)} ${currency || 'RMB'}`;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.fs-table-panel__toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 0;
|
||||
}
|
||||
.fs-table-panel__links {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.fs-table-panel__invoice-status {
|
||||
.fs-invoice-status {
|
||||
&.is-unreceived {
|
||||
color: #f56c6c;
|
||||
}
|
||||
@@ -328,12 +245,7 @@ export default {
|
||||
color: #e6a23c;
|
||||
}
|
||||
&.is-completed {
|
||||
color: #67c23a;
|
||||
color: #67c23c;
|
||||
}
|
||||
}
|
||||
.fs-table-panel__pagination {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,300 @@
|
||||
<template>
|
||||
<section-card title="项目预付核销">
|
||||
<template v-if="editable" #extra>
|
||||
<el-button type="primary" :disabled="!contractId" @click="openSelectDialog">选择</el-button>
|
||||
</template>
|
||||
<el-table :data="rows" border>
|
||||
<el-table-column type="index" label="序号" width="64" align="center" />
|
||||
<el-table-column
|
||||
prop="paymentNo"
|
||||
label="预付单号"
|
||||
min-width="160"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="项目预付金额" min-width="140" align="center">
|
||||
<template #default="{ row }">{{ formatMoney(row.projectAdvanceAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="可核销金额" min-width="140" align="center">
|
||||
<template #default="{ row }">{{ formatMoney(row.availableWriteOffAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="本次核销金额" min-width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-if="editable"
|
||||
v-model="row.writeOffAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
class="project-advance-write-off__amount"
|
||||
@change="handleAmountChange(row)"
|
||||
/>
|
||||
<span v-else>{{ formatMoney(row.writeOffAmount) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="kingdeeBillNo"
|
||||
label="金蝶预付单号"
|
||||
min-width="160"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">{{ row.kingdeeBillNo || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createUserName"
|
||||
label="创建人"
|
||||
min-width="120"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">{{ row.createUserName || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center">
|
||||
<template #default="{ row }">{{ formatDateTime(row.createTime || row.paymentCreateTime) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="editable" label="操作" width="90" align="center" fixed="right">
|
||||
<template #default="{ $index }">
|
||||
<el-link type="danger" @click="removeRow($index)">删除</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog
|
||||
v-model="dialog.visible"
|
||||
title="选择项目预付单"
|
||||
width="960px"
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
class="dialog-form-title"
|
||||
@closed="handleDialogClosed"
|
||||
>
|
||||
<el-table
|
||||
v-loading="dialog.loading"
|
||||
:data="dialog.rows"
|
||||
border
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" :selectable="rowSelectable" />
|
||||
<el-table-column type="index" label="序号" width="64" align="center" />
|
||||
<el-table-column
|
||||
prop="paymentNo"
|
||||
label="预付单号"
|
||||
min-width="160"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="项目预付金额" min-width="140" align="center">
|
||||
<template #default="{ row }">{{ formatMoney(row.projectAdvanceAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="可核销金额" min-width="140" align="center">
|
||||
<template #default="{ row }">{{ formatMoney(row.availableWriteOffAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="kingdeeBillNo"
|
||||
label="金蝶预付单号"
|
||||
min-width="160"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">{{ row.kingdeeBillNo || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createUserName"
|
||||
label="创建人"
|
||||
min-width="120"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">{{ row.createUserName || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center">
|
||||
<template #default="{ row }">{{ formatDateTime(row.createTime) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<el-button @click="dialog.visible = false">取消</el-button>
|
||||
<el-button type="primary" :disabled="!dialog.selection.length" @click="confirmSelect">
|
||||
确定
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</section-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getProjectAdvanceWriteOffOptions } from '@/api/payment/paymentApplication';
|
||||
|
||||
export default {
|
||||
name: 'ProjectAdvanceWriteOff',
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
editable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
contractId: {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
settlementAmount: {
|
||||
type: [String, Number],
|
||||
default: 0,
|
||||
},
|
||||
settlementType: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
settlementId: {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
data() {
|
||||
return {
|
||||
dialog: {
|
||||
visible: false,
|
||||
loading: false,
|
||||
rows: [],
|
||||
selection: [],
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
rows: {
|
||||
get() {
|
||||
return Array.isArray(this.modelValue) ? this.modelValue : [];
|
||||
},
|
||||
set(value) {
|
||||
this.$emit('update:modelValue', value);
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
formatMoney(value) {
|
||||
const amount = Number(value);
|
||||
return Number.isFinite(amount) ? amount.toFixed(2) : '0.00';
|
||||
},
|
||||
formatDateTime(value) {
|
||||
if (!value) return '-';
|
||||
return this.$dayjs(value).format('YYYY-MM-DD HH:mm:ss');
|
||||
},
|
||||
money(value) {
|
||||
const amount = Number(value);
|
||||
return Number.isFinite(amount) ? Number(amount.toFixed(2)) : 0;
|
||||
},
|
||||
openSelectDialog() {
|
||||
if (!this.contractId) {
|
||||
this.$message.warning('请先选择合同');
|
||||
return;
|
||||
}
|
||||
this.dialog.visible = true;
|
||||
this.loadOptions();
|
||||
},
|
||||
async loadOptions() {
|
||||
this.dialog.loading = true;
|
||||
try {
|
||||
const res = await getProjectAdvanceWriteOffOptions({
|
||||
contractId: this.contractId,
|
||||
excludeSettlementType: this.settlementType,
|
||||
excludeSettlementId: this.settlementId || undefined,
|
||||
});
|
||||
this.dialog.rows = res?.data?.data || [];
|
||||
} finally {
|
||||
this.dialog.loading = false;
|
||||
}
|
||||
},
|
||||
rowSelectable(row) {
|
||||
const selectedIds = new Set(this.rows.map(item => String(item.paymentApplicationId)));
|
||||
return !selectedIds.has(String(row.paymentApplicationId));
|
||||
},
|
||||
handleSelectionChange(list) {
|
||||
this.dialog.selection = list || [];
|
||||
},
|
||||
confirmSelect() {
|
||||
const nextRows = [...this.rows];
|
||||
const existed = new Set(nextRows.map(item => String(item.paymentApplicationId)));
|
||||
this.dialog.selection.forEach(item => {
|
||||
const id = String(item.paymentApplicationId);
|
||||
if (existed.has(id)) return;
|
||||
nextRows.push({
|
||||
paymentApplicationId: item.paymentApplicationId,
|
||||
paymentNo: item.paymentNo,
|
||||
projectAdvanceAmount: this.money(item.projectAdvanceAmount),
|
||||
availableWriteOffAmount: this.money(item.availableWriteOffAmount),
|
||||
writeOffAmount: this.money(item.availableWriteOffAmount),
|
||||
kingdeeBillNo: item.kingdeeBillNo || '',
|
||||
createUserName: item.createUserName || '',
|
||||
createTime: item.createTime,
|
||||
paymentCreateTime: item.createTime,
|
||||
});
|
||||
});
|
||||
this.rows = nextRows;
|
||||
this.dialog.visible = false;
|
||||
this.validateTotal();
|
||||
},
|
||||
handleDialogClosed() {
|
||||
this.dialog.rows = [];
|
||||
this.dialog.selection = [];
|
||||
},
|
||||
handleAmountChange(row) {
|
||||
const available = this.money(row.availableWriteOffAmount);
|
||||
let amount = this.money(row.writeOffAmount);
|
||||
if (amount < 0) amount = 0;
|
||||
if (amount > available) {
|
||||
amount = available;
|
||||
this.$message.warning('本次核销金额不能超过可核销金额');
|
||||
}
|
||||
row.writeOffAmount = amount;
|
||||
this.validateTotal();
|
||||
},
|
||||
validateTotal() {
|
||||
const total = this.rows.reduce((sum, row) => sum + this.money(row.writeOffAmount), 0);
|
||||
const settlementAmount = this.money(this.settlementAmount);
|
||||
if (settlementAmount > 0 && total > settlementAmount) {
|
||||
this.$message.warning('项目预付核销合计不能超过结算单金额');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
validateBeforeSave() {
|
||||
for (const row of this.rows) {
|
||||
const amount = this.money(row.writeOffAmount);
|
||||
if (amount <= 0) {
|
||||
this.$message.warning(`预付单${row.paymentNo || ''}本次核销金额必须大于0`);
|
||||
return false;
|
||||
}
|
||||
if (amount > this.money(row.availableWriteOffAmount)) {
|
||||
this.$message.warning(`预付单${row.paymentNo || ''}本次核销金额不能超过可核销金额`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return this.validateTotal();
|
||||
},
|
||||
removeRow(index) {
|
||||
const nextRows = [...this.rows];
|
||||
nextRows.splice(index, 1);
|
||||
this.rows = nextRows;
|
||||
},
|
||||
toSavePayload() {
|
||||
return this.rows.map(row => ({
|
||||
paymentApplicationId: row.paymentApplicationId,
|
||||
writeOffAmount: this.money(row.writeOffAmount),
|
||||
}));
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.project-advance-write-off__amount {
|
||||
width: 100%;
|
||||
}
|
||||
:deep(.project-advance-write-off__amount .el-input__inner) {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
@@ -414,6 +414,8 @@ export default {
|
||||
});
|
||||
this.details = [];
|
||||
this.recalculate();
|
||||
// 金蝶冲销预检:软提示,不阻断建单(金蝶不可用时静默降级)
|
||||
this.precheckWriteOff(formalSettlementId);
|
||||
this.loading = true;
|
||||
try {
|
||||
const { data } = await api.getFormalDetails(formalSettlementId);
|
||||
@@ -431,6 +433,19 @@ export default {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
async precheckWriteOff(formalSettlementId) {
|
||||
try {
|
||||
const { data } = await api.kingdeeWriteOffPrecheck(formalSettlementId);
|
||||
if (String(this.form.formalSettlementId) !== String(formalSettlementId)) return;
|
||||
const result = data?.data || data || {};
|
||||
if (!result.message) return;
|
||||
if (result.syncStatus === 'synced' && result.writtenOff === false)
|
||||
this.$message.warning(result.message);
|
||||
else this.$message.info(result.message);
|
||||
} catch (error) {
|
||||
// 预检软提示:金蝶查询失败静默降级,不阻断建单
|
||||
}
|
||||
},
|
||||
addFeeRow() {
|
||||
this.details.push({
|
||||
formalSettlementDetailId: null,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -263,7 +263,7 @@
|
||||
<template v-else-if="isExternalRowEditing(row) && isExternalEditableColumn(column.prop)">
|
||||
<el-input-number
|
||||
v-if="column.feeItemName"
|
||||
v-model="row.feeItems[column.feeItemName]"
|
||||
v-model="externalEditTarget(row).feeItems[column.feeItemName]"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
@@ -271,7 +271,7 @@
|
||||
/>
|
||||
<el-date-picker
|
||||
v-else-if="isExternalDateColumn(column.prop)"
|
||||
v-model="row[column.prop]"
|
||||
v-model="externalEditTarget(row)[column.prop]"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
format="YYYY-MM-DD"
|
||||
@@ -280,7 +280,7 @@
|
||||
/>
|
||||
<el-input-number
|
||||
v-else-if="isExternalNumberColumn(column.prop)"
|
||||
v-model="row[column.prop]"
|
||||
v-model="externalEditTarget(row)[column.prop]"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
@@ -288,7 +288,7 @@
|
||||
/>
|
||||
<el-select
|
||||
v-else-if="column.prop === 'transportType'"
|
||||
v-model="row[column.prop]"
|
||||
v-model="externalEditTarget(row)[column.prop]"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
@@ -300,7 +300,7 @@
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input v-else v-model="row[column.prop]" size="small" />
|
||||
<el-input v-else v-model="externalEditTarget(row)[column.prop]" size="small" />
|
||||
</template>
|
||||
<span v-else-if="column.prop === 'transportType'">
|
||||
{{ transportTypeLabel(row.transportType) }}
|
||||
@@ -508,7 +508,7 @@
|
||||
<span class="completion-dialog__value">{{ displayValue(form.reconciliationNo) }}</span>
|
||||
</div>
|
||||
<div class="completion-dialog__field">
|
||||
<span class="completion-dialog__label">预结算单号</span>
|
||||
<span class="completion-dialog__label">预付结算单号</span>
|
||||
<span class="completion-dialog__value">{{
|
||||
displayValue(form.preSettlementNo || form.formalSettlementNo)
|
||||
}}</span>
|
||||
@@ -630,6 +630,7 @@ import { getDictionary } from '@/api/system/dictbiz';
|
||||
import { Search } from '@element-plus/icons-vue';
|
||||
import { h } from 'vue';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { isExcelResponse, parseBlobJson } from '@/utils/import-excel';
|
||||
import { transportReconciliationFormFields } from '@/option/settlement/transportReconciliationForm';
|
||||
import {
|
||||
internalColumns,
|
||||
@@ -676,6 +677,8 @@ export default {
|
||||
completionDialog: { visible: false, loading: false },
|
||||
completionSummaryRowsData: null,
|
||||
externalEditing: {},
|
||||
// 调整中的草稿,输入只改草稿,点「完成」才写回列表
|
||||
externalEditDrafts: {},
|
||||
externalEditSnapshots: {},
|
||||
matchingStarted: false,
|
||||
rules: {
|
||||
@@ -932,6 +935,7 @@ export default {
|
||||
this.internalDetails = [];
|
||||
this.externalDetails = [];
|
||||
this.externalEditing = {};
|
||||
this.externalEditDrafts = {};
|
||||
this.externalEditSnapshots = {};
|
||||
this.completionSummaryRowsData = null;
|
||||
this.matchingStarted = false;
|
||||
@@ -1278,10 +1282,13 @@ export default {
|
||||
delete snapshot._externalKey;
|
||||
delete snapshot.feeItems;
|
||||
snapshot.feeItemsJson = row.feeItemsJson || JSON.stringify(row.feeItems || {});
|
||||
snapshot.actualDepartureTime = this.normalizeExternalDateTime(row.actualDepartureTime);
|
||||
snapshot.actualCompletionTime = this.normalizeExternalDateTime(row.actualCompletionTime);
|
||||
return snapshot;
|
||||
});
|
||||
},
|
||||
serializeExternalRows() {
|
||||
const duplicateIds = new Set(this.duplicateRows.map(row => String(row.id)));
|
||||
return this.externalDetails.map(row => {
|
||||
const snapshot = { ...row };
|
||||
delete snapshot._sourceRows;
|
||||
@@ -1290,6 +1297,7 @@ export default {
|
||||
snapshot.feeItemsJson = row.feeItemsJson || JSON.stringify(row.feeItems || {});
|
||||
snapshot.actualDepartureTime = this.normalizeExternalDateTime(row.actualDepartureTime);
|
||||
snapshot.actualCompletionTime = this.normalizeExternalDateTime(row.actualCompletionTime);
|
||||
snapshot.suspectedDuplicate = duplicateIds.has(String(row.id));
|
||||
return snapshot;
|
||||
});
|
||||
},
|
||||
@@ -1336,6 +1344,11 @@ export default {
|
||||
}
|
||||
},
|
||||
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 (
|
||||
Number(this.form.differenceCount || 0) !== 0 ||
|
||||
Number(this.form.differenceQuantity || 0) !== 0 ||
|
||||
@@ -1494,16 +1507,16 @@ export default {
|
||||
this.form.reconciliationMode === 'cargo'
|
||||
? await api.importCargo(this.currentId, file)
|
||||
: await api.importVehicle(this.currentId, file);
|
||||
const contentType = response.headers?.['content-type'] || response.data?.type || '';
|
||||
if (contentType.includes('spreadsheetml') || contentType.includes('ms-excel')) {
|
||||
// 成功时 axios 拦截器可能已把 JSON Blob 解析成对象,不能再调 .text()
|
||||
if (isExcelResponse(response)) {
|
||||
downloadXls(
|
||||
response.data,
|
||||
`运输对账导入失败明细${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`
|
||||
);
|
||||
this.$message.warning('部分数据导入失败,已下载失败明细');
|
||||
} else {
|
||||
const result = JSON.parse(await response.data.text());
|
||||
if (result.code !== 200) throw new Error(result.msg || '导入失败');
|
||||
const result = await parseBlobJson(response.data);
|
||||
if (Number(result.code) !== 200) throw new Error(result.msg || '导入失败');
|
||||
this.$message.success('外部账单导入成功');
|
||||
}
|
||||
this.matchingStarted = false;
|
||||
@@ -1652,6 +1665,28 @@ export default {
|
||||
isExternalRowEditing(row) {
|
||||
return Boolean(this.externalEditing[this.externalRowKey(row)]);
|
||||
},
|
||||
cloneExternalEditRow(row) {
|
||||
return {
|
||||
...row,
|
||||
feeItems: { ...(row.feeItems || this.parseFeeItems(row.feeItemsJson)) },
|
||||
};
|
||||
},
|
||||
/** 编辑态绑定草稿,避免输入时实时改写列表导致疑似重复 Tab 刷新 */
|
||||
externalEditTarget(row) {
|
||||
const key = this.externalRowKey(row);
|
||||
return this.externalEditDrafts[key] || row;
|
||||
},
|
||||
clearExternalEditState(key) {
|
||||
const editing = { ...this.externalEditing };
|
||||
const drafts = { ...this.externalEditDrafts };
|
||||
const snapshots = { ...this.externalEditSnapshots };
|
||||
delete editing[key];
|
||||
delete drafts[key];
|
||||
delete snapshots[key];
|
||||
this.externalEditing = editing;
|
||||
this.externalEditDrafts = drafts;
|
||||
this.externalEditSnapshots = snapshots;
|
||||
},
|
||||
isExternalEditableColumn(prop) {
|
||||
return !['externalLineNo', 'matchStatus'].includes(prop);
|
||||
},
|
||||
@@ -1663,39 +1698,38 @@ export default {
|
||||
},
|
||||
openExternalAdjust(row) {
|
||||
const key = this.externalRowKey(row);
|
||||
const draft = this.cloneExternalEditRow(row);
|
||||
this.externalEditSnapshots = {
|
||||
...this.externalEditSnapshots,
|
||||
[key]: { ...row },
|
||||
[key]: this.cloneExternalEditRow(row),
|
||||
};
|
||||
this.externalEditDrafts = { ...this.externalEditDrafts, [key]: draft };
|
||||
this.externalEditing = { ...this.externalEditing, [key]: true };
|
||||
},
|
||||
cancelExternalAdjust(row) {
|
||||
const key = this.externalRowKey(row);
|
||||
const snapshot = this.externalEditSnapshots[key];
|
||||
if (snapshot) Object.assign(row, snapshot);
|
||||
const editing = { ...this.externalEditing };
|
||||
const snapshots = { ...this.externalEditSnapshots };
|
||||
delete editing[key];
|
||||
delete snapshots[key];
|
||||
this.externalEditing = editing;
|
||||
this.externalEditSnapshots = snapshots;
|
||||
this.clearExternalEditState(this.externalRowKey(row));
|
||||
},
|
||||
async finishExternalAdjust(row) {
|
||||
row.feeItemsJson = JSON.stringify(row.feeItems || {});
|
||||
const key = this.externalRowKey(row);
|
||||
const editing = { ...this.externalEditing };
|
||||
const snapshots = { ...this.externalEditSnapshots };
|
||||
delete editing[key];
|
||||
delete snapshots[key];
|
||||
this.externalEditing = editing;
|
||||
this.externalEditSnapshots = snapshots;
|
||||
const draft = this.externalEditDrafts[key];
|
||||
if (draft) {
|
||||
const feeItems = { ...(draft.feeItems || {}) };
|
||||
Object.assign(row, draft, { feeItems });
|
||||
row.feeItemsJson = JSON.stringify(feeItems);
|
||||
} else {
|
||||
row.feeItemsJson = JSON.stringify(row.feeItems || {});
|
||||
}
|
||||
this.clearExternalEditState(key);
|
||||
this.refreshLocalStats();
|
||||
this.$message.success('调整已暂存');
|
||||
this.$message.success('调整已暂存,匹配或完成对账后生效');
|
||||
},
|
||||
normalizeExternalDateTime(value) {
|
||||
if (!value) return null;
|
||||
const text = String(value);
|
||||
return text.length === 10 ? `${text}T00:00:00` : text;
|
||||
const text = String(value).trim();
|
||||
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() {
|
||||
const internalQuantity = this.internalDetails.reduce(
|
||||
@@ -1731,7 +1765,8 @@ export default {
|
||||
differenceQuantity: Math.abs(internalQuantity - externalQuantity),
|
||||
differenceAmount: Math.abs(internalAmount - externalAmount),
|
||||
matchedCount,
|
||||
unmatchedCount: internalUnmatched + externalUnmatched,
|
||||
// 无法匹配按内部账单条数统计,不叠加外部未匹配数
|
||||
unmatchedCount: internalUnmatched,
|
||||
matchStatus:
|
||||
this.internalDetails.length > 0 &&
|
||||
this.internalDetails.length === this.externalDetails.length &&
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<script>
|
||||
import FormalSettlementEditor from './components/formal-settlement-editor.vue';
|
||||
import { readSettlementTransfer, removeSettlementTransfer } from '@/utils/settlement-transfer';
|
||||
import { settlementBillLabel, settlementListPath } from '@/utils/settlement-menu';
|
||||
|
||||
const LIST_REFRESH_KEY = 'formal-settlement-list-refresh';
|
||||
|
||||
@@ -35,12 +36,25 @@ export default {
|
||||
readonly() {
|
||||
return this.$route.query.mode === 'view';
|
||||
},
|
||||
settlementType() {
|
||||
return this.$route.query.settlementType || this.transferPayload?.settlementType || 'payable';
|
||||
},
|
||||
billLabel() {
|
||||
return settlementBillLabel(this.settlementType);
|
||||
},
|
||||
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() {
|
||||
const settlementType = this.$route.query.settlementType;
|
||||
if (!this.transferPayload && !settlementType) return null;
|
||||
const settlementType = this.settlementType;
|
||||
if (!this.transferPayload && !this.$route.query.settlementType) return null;
|
||||
return {
|
||||
...(this.transferPayload || {}),
|
||||
...(settlementType ? { settlementType } : {}),
|
||||
@@ -63,7 +77,7 @@ export default {
|
||||
goBack() {
|
||||
removeSettlementTransfer(this.$route.query.transferToken);
|
||||
this.$router.$avueRouter.closeTag();
|
||||
this.$router.push('/settlement/formal-settlement');
|
||||
this.$router.push(this.listPath);
|
||||
},
|
||||
syncTagTitle() {
|
||||
this.$nextTick(() => {
|
||||
|
||||
@@ -1,110 +1,39 @@
|
||||
<template>
|
||||
<basic-container class="formal-page">
|
||||
<section v-show="searchVisible" class="formal-page__search">
|
||||
<el-form :model="query" label-position="right" label-width="88px" @submit.prevent>
|
||||
<div class="formal-page__search-grid">
|
||||
<el-form-item v-for="field in visibleSearchFields" :key="field.prop" :label="field.label">
|
||||
<el-date-picker
|
||||
v-if="field.type === 'daterange'"
|
||||
v-model="query[field.prop]"
|
||||
type="daterange"
|
||||
value-format="YYYY-MM-DD"
|
||||
format="YYYY-MM-DD"
|
||||
range-separator="~"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
/>
|
||||
<el-select
|
||||
v-else-if="field.type === 'select'"
|
||||
v-model="query[field.prop]"
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in field.options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-cascader
|
||||
v-else-if="field.type === 'cascader'"
|
||||
v-model="query[field.prop]"
|
||||
:options="organizationTreeOptions"
|
||||
:props="organizationCascaderProps"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
placeholder="请选择"
|
||||
/>
|
||||
<el-input v-else v-model="query[field.prop]" clearable placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<div class="formal-page__search-actions">
|
||||
<el-button type="primary" @click="handleSearch">查询</el-button>
|
||||
<el-button @click="resetSearch">重置</el-button>
|
||||
<el-button text :icon="searchExpanded ? ArrowUp : ArrowDown" @click="toggleSearch">
|
||||
{{ searchExpanded ? '收起' : '展开' }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</section>
|
||||
|
||||
<section class="formal-page__table-panel">
|
||||
<el-tabs
|
||||
type="border-card"
|
||||
v-model="activeSettlementType"
|
||||
@tab-change="handleSettlementTypeChange"
|
||||
>
|
||||
<el-tab-pane label="应付" name="payable">
|
||||
<formal-settlement-table-panel
|
||||
:key="activeSettlementType"
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
: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 label="应收" name="receivable">
|
||||
<formal-settlement-table-panel
|
||||
:key="activeSettlementType"
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
: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-tabs>
|
||||
</section>
|
||||
<el-tabs
|
||||
v-if="!lockedSettlementType"
|
||||
type="border-card"
|
||||
v-model="activeSettlementType"
|
||||
@tab-change="handleSettlementTypeChange"
|
||||
>
|
||||
<el-tab-pane label="应付" name="payable">
|
||||
<formal-settlement-table-panel
|
||||
v-if="activeSettlementType === 'payable'"
|
||||
key="payable"
|
||||
v-bind="tablePanelProps"
|
||||
v-on="tablePanelListeners"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="应收" name="receivable">
|
||||
<formal-settlement-table-panel
|
||||
v-if="activeSettlementType === 'receivable'"
|
||||
key="receivable"
|
||||
v-bind="tablePanelProps"
|
||||
v-on="tablePanelListeners"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<formal-settlement-table-panel
|
||||
v-else
|
||||
key="locked"
|
||||
v-bind="tablePanelProps"
|
||||
v-on="tablePanelListeners"
|
||||
/>
|
||||
<formal-settlement-editor
|
||||
v-model="editor.visible"
|
||||
:record-id="editor.id"
|
||||
:readonly="editor.readonly"
|
||||
@success="loadTable"
|
||||
@success="onLoad(page)"
|
||||
/>
|
||||
<el-dialog
|
||||
v-model="paymentDialog.visible"
|
||||
@@ -116,7 +45,7 @@
|
||||
<section-card title="付款信息">
|
||||
<template v-if="paymentDialog.rows.length > 1">
|
||||
<div class="formal-payment-dialog__batch-tip">
|
||||
已选择 {{ paymentDialog.rows.length }} 条同合同应付正式结算单,请确认各单申请金额。
|
||||
已选择 {{ paymentDialog.rows.length }} 条同合同付款结算单,请确认各单申请金额。
|
||||
</div>
|
||||
<el-table :data="paymentDialog.rows" border>
|
||||
<el-table-column prop="formalSettlementNo" label="结算单号" min-width="160" />
|
||||
@@ -173,58 +102,46 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
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 * as api from '@/api/settlement/formalSettlement';
|
||||
import * as paymentApi from '@/api/payment/paymentApplication';
|
||||
import {
|
||||
invoiceStatusName,
|
||||
formalSettlementSearchFields,
|
||||
paymentStatusOptions,
|
||||
} from '@/option/settlement/formalSettlementSearch';
|
||||
import { formalSettlementOption } from '@/option/settlement/formalSettlement';
|
||||
import organizationSearch from '@/mixins/organization-search';
|
||||
import { formalSettlementTableColumns } from '@/option/settlement/formalSettlementTable';
|
||||
import FormalSettlementEditor from './components/formal-settlement-editor.vue';
|
||||
import FormalSettlementTablePanel from './components/formal-settlement-table-panel.vue';
|
||||
import { submitMkApprovalFlow, loadMkEnabled } from '@/utils/mk-approval';
|
||||
import { getMKApprovalUrl } from '@/api/system/business-process';
|
||||
|
||||
const emptyQuery = () => ({
|
||||
formalSettlementNo: '',
|
||||
preSettlementNo: '',
|
||||
projectName: '',
|
||||
deptName: [],
|
||||
contractNo: '',
|
||||
payerName: '',
|
||||
payeeName: '',
|
||||
invoiceStatus: '',
|
||||
paymentStatus: '',
|
||||
approvalStatus: '',
|
||||
kingdeeSyncStatus: '',
|
||||
createDateRange: [],
|
||||
});
|
||||
|
||||
export default {
|
||||
name: 'FormalSettlement',
|
||||
components: { FormalSettlementEditor, FormalSettlementTablePanel },
|
||||
mixins: [organizationSearch],
|
||||
props: {
|
||||
/** 菜单拆分后锁定结算类型:payable=付款结算单,receivable=收款结算单 */
|
||||
lockedSettlementType: {
|
||||
type: String,
|
||||
default: '',
|
||||
validator: value => ['', 'payable', 'receivable'].includes(value),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ArrowDown,
|
||||
ArrowUp,
|
||||
query: emptyQuery(),
|
||||
searchExpanded: false,
|
||||
searchVisible: true,
|
||||
option: formalSettlementOption(),
|
||||
query: {},
|
||||
activeSettlementType: 'payable',
|
||||
searchFields: formalSettlementSearchFields,
|
||||
columns: formalSettlementTableColumns,
|
||||
rows: [],
|
||||
selection: [],
|
||||
loading: false,
|
||||
syncLoading: false,
|
||||
page: { current: 1, size: 10, total: 0 },
|
||||
page: { currentPage: 1, pageSize: 10, pageSizes: [10, 20, 50, 100], total: 0 },
|
||||
editor: { visible: false, id: null, readonly: false },
|
||||
paymentDialog: {
|
||||
visible: false,
|
||||
@@ -237,25 +154,78 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['permission']),
|
||||
hasPermissionFn() {
|
||||
return code => this.permission?.[code] !== false;
|
||||
...mapGetters(['permission', 'userInfo']),
|
||||
isAdmin() {
|
||||
return isAdministrator(this.userInfo);
|
||||
},
|
||||
visibleSearchFields() {
|
||||
return this.searchExpanded ? this.searchFields : this.searchFields.slice(0, 4);
|
||||
billLabel() {
|
||||
return settlementBillLabel(this.activeSettlementType);
|
||||
},
|
||||
hasPermissionFn() {
|
||||
return actionOrCode => {
|
||||
const action = String(actionOrCode || '').replace(
|
||||
/^(payment_settlement_|receipt_settlement_|formal_settlement_)/,
|
||||
''
|
||||
);
|
||||
return hasSettlementPermission(this, this.activeSettlementType, action);
|
||||
};
|
||||
},
|
||||
tablePanelProps() {
|
||||
return {
|
||||
option: this.option,
|
||||
rows: this.rows,
|
||||
loading: this.loading,
|
||||
page: this.page,
|
||||
hasPermission: this.hasPermissionFn,
|
||||
syncLoading: this.syncLoading,
|
||||
mkEnabled: this.mkEnabled,
|
||||
showPaymentAction: this.activeSettlementType === 'payable',
|
||||
billLabel: this.billLabel,
|
||||
};
|
||||
},
|
||||
tablePanelListeners() {
|
||||
return {
|
||||
create: this.openCreate,
|
||||
payment: this.openPaymentDialog,
|
||||
sync: this.handleSync,
|
||||
export: this.handleExport,
|
||||
refresh: () => this.onLoad(this.page),
|
||||
load: this.onLoad,
|
||||
action: this.onAction,
|
||||
'search-change': this.searchChange,
|
||||
'search-reset': this.searchReset,
|
||||
'update:selection': selection => {
|
||||
this.selection = selection;
|
||||
},
|
||||
};
|
||||
},
|
||||
paymentAvailable() {
|
||||
return this.paymentRemaining(this.paymentDialog.row);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
lockedSettlementType: {
|
||||
immediate: true,
|
||||
handler(value) {
|
||||
if (value === 'payable' || value === 'receivable') {
|
||||
this.activeSettlementType = value;
|
||||
}
|
||||
},
|
||||
},
|
||||
activeSettlementType() {
|
||||
// 切换结算类型后由新挂载的 avue-crud 触发 on-load,此处只重置分页,避免重复请求
|
||||
this.page.currentPage = 1;
|
||||
},
|
||||
'$route.query.detailNo'(detailNo) {
|
||||
if (detailNo) this.openRouteDetail(detailNo);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
// 标签机制按 fullPath 缓存同页多实例:仅当前路由实例应响应 detailNo 跳转,防止缓存旧实例也弹窗
|
||||
this.ownFullPath = this.$route.fullPath;
|
||||
this.loadOrganizationOptions();
|
||||
this.loadTable();
|
||||
},
|
||||
mounted() {
|
||||
this.openRouteDetail();
|
||||
loadMkEnabled()
|
||||
.then(enabled => {
|
||||
@@ -268,18 +238,18 @@ export default {
|
||||
activated() {
|
||||
if (sessionStorage.getItem('formal-settlement-list-refresh') === '1') {
|
||||
sessionStorage.removeItem('formal-settlement-list-refresh');
|
||||
this.loadTable();
|
||||
this.onLoad(this.page);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
hasPermission(code) {
|
||||
return this.permission?.[code] !== false;
|
||||
hasPermission(actionOrCode) {
|
||||
return this.hasPermissionFn(actionOrCode);
|
||||
},
|
||||
async loadTable() {
|
||||
async onLoad(page) {
|
||||
this.loading = true;
|
||||
try {
|
||||
const params = this.buildQueryParams();
|
||||
const response = await api.getList(this.page.current, this.page.size, params);
|
||||
const response = await api.getList(page.currentPage, page.pageSize, params);
|
||||
const data = this.unwrapData(response);
|
||||
this.rows = data.records || [];
|
||||
this.page.total = data.total || 0;
|
||||
@@ -287,25 +257,24 @@ export default {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
handleSearch() {
|
||||
this.page.current = 1;
|
||||
this.loadTable();
|
||||
searchChange(params, done) {
|
||||
// 所属组织级联返回 id 路径,转成组织名称传给后端
|
||||
this.normalizeOrganizationSearch(params, 'deptName');
|
||||
const range = params.createDateRange || [];
|
||||
delete params.createDateRange;
|
||||
this.query = {
|
||||
...params,
|
||||
createStartDate: range[0] || '',
|
||||
createEndDate: range[1] || '',
|
||||
};
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page);
|
||||
done();
|
||||
},
|
||||
resetSearch() {
|
||||
this.query = emptyQuery();
|
||||
this.handleSearch();
|
||||
},
|
||||
toggleSearch() {
|
||||
this.searchExpanded = !this.searchExpanded;
|
||||
},
|
||||
handleSizeChange() {
|
||||
this.page.current = 1;
|
||||
this.loadTable();
|
||||
},
|
||||
onPageChange({ current, size }) {
|
||||
this.page.current = current;
|
||||
this.page.size = size;
|
||||
this.loadTable();
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
onAction({ type, row }) {
|
||||
const handlers = {
|
||||
@@ -326,15 +295,23 @@ export default {
|
||||
path: '/settlement/formal-settlement/form',
|
||||
query: {
|
||||
mode: 'add',
|
||||
name: '新增正式结算',
|
||||
name: `新增${this.billLabel}`,
|
||||
settlementType: this.activeSettlementType,
|
||||
listPath: settlementListPath(this.activeSettlementType),
|
||||
},
|
||||
});
|
||||
},
|
||||
openEdit(row) {
|
||||
const settlementType = row.settlementType || this.activeSettlementType;
|
||||
this.$router.push({
|
||||
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) {
|
||||
@@ -342,25 +319,27 @@ export default {
|
||||
},
|
||||
async openRouteDetail(detailNo = this.$route.query.detailNo) {
|
||||
const formalSettlementNo = String(detailNo || '').trim();
|
||||
if (!formalSettlementNo) return;
|
||||
if (!formalSettlementNo || this.ownFullPath !== this.$route.fullPath) return;
|
||||
const response = await api.getList(1, 10, { formalSettlementNo });
|
||||
const data = this.unwrapData(response);
|
||||
const row = (data.records || []).find(item => item.formalSettlementNo === formalSettlementNo);
|
||||
if (!row) {
|
||||
this.$message.warning('未找到对应的正式结算单');
|
||||
this.$message.warning(`未找到对应的${this.billLabel}`);
|
||||
return;
|
||||
}
|
||||
this.activeSettlementType = row.settlementType || this.activeSettlementType;
|
||||
if (!this.lockedSettlementType) {
|
||||
this.activeSettlementType = row.settlementType || this.activeSettlementType;
|
||||
}
|
||||
this.openView(row);
|
||||
},
|
||||
async handleDelete(row) {
|
||||
await this.$confirm('确认删除该正式结算草稿?', '提示', { type: 'warning' });
|
||||
await this.$confirm(`确认删除该${this.billLabel}草稿?`, '提示', { type: 'warning' });
|
||||
await api.remove(row.id);
|
||||
this.$message.success('删除成功');
|
||||
this.loadTable();
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
async handleSubmit(row) {
|
||||
await this.$confirm('提交后来源预结算将保持锁定,确认提交?', '提示', { type: 'warning' });
|
||||
await this.$confirm('提交后来源预付结算单将保持锁定,确认提交?', '提示', { type: 'warning' });
|
||||
const previousApprovalStatus = row.approvalStatus || '';
|
||||
await api.submit({ id: row.id });
|
||||
await submitMkApprovalFlow({
|
||||
@@ -368,13 +347,14 @@ export default {
|
||||
bizId: row.id,
|
||||
subjectName: row.formalSettlementNo || '',
|
||||
approvalStatus: previousApprovalStatus,
|
||||
mkEnabled: this.mkEnabled,
|
||||
});
|
||||
this.$message.success('提交成功');
|
||||
this.loadTable();
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
handleMkAudit(row) {
|
||||
if (!row?.id) {
|
||||
this.$message.warning('正式结算单ID为空,无法打开审核页');
|
||||
this.$message.warning(`${this.billLabel}ID为空,无法打开审核页`);
|
||||
return;
|
||||
}
|
||||
getMKApprovalUrl({ bizId: String(row.id) })
|
||||
@@ -392,7 +372,7 @@ export default {
|
||||
},
|
||||
async handleApprove(row) {
|
||||
await this.$confirm(
|
||||
'审核通过后正式结算生效,金额只能通过结算调整单处理,确认通过?',
|
||||
`审核通过后${this.billLabel}生效,金额只能通过结算调整单处理,确认通过?`,
|
||||
'提示',
|
||||
{ type: 'warning' }
|
||||
);
|
||||
@@ -403,7 +383,7 @@ export default {
|
||||
} else {
|
||||
this.$message.success(res.data.msg || '审批通过');
|
||||
}
|
||||
this.loadTable();
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
async handleReturn(row) {
|
||||
const { value } = await this.$prompt('请输入驳回原因', '审批驳回', {
|
||||
@@ -411,58 +391,92 @@ export default {
|
||||
});
|
||||
await api.returnBill({ id: row.id, reason: value });
|
||||
this.$message.success('已驳回');
|
||||
this.loadTable();
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
async handleVoid(row) {
|
||||
const { value } = await this.$prompt('请输入作废原因', '作废正式结算单', {
|
||||
const { value } = await this.$prompt('请输入作废原因', `作废${this.billLabel}`, {
|
||||
inputValidator: value => Boolean(value?.trim()) || '请输入作废原因',
|
||||
});
|
||||
await api.voidBill({ id: row.id, reason: value });
|
||||
this.$message.success('已作废');
|
||||
this.loadTable();
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
selectedOne(action) {
|
||||
if (this.selection.length !== 1) {
|
||||
this.$message.warning(`${action}需选择一条正式结算单`);
|
||||
this.$message.warning(`${action}需选择一条${this.billLabel}`);
|
||||
return null;
|
||||
}
|
||||
return this.selection[0];
|
||||
},
|
||||
async handleSync() {
|
||||
if (this.syncLoading) return;
|
||||
const row = this.selectedOne('同步金蝶');
|
||||
if (!row) return;
|
||||
|
||||
const rows = (this.selection || []).filter(row => row.approvalStatus === 'approved');
|
||||
if (!rows.length) {
|
||||
this.$message.warning(`请选择至少一条审批通过的${this.billLabel}`);
|
||||
return;
|
||||
}
|
||||
this.syncLoading = true;
|
||||
try {
|
||||
const response = await api.syncKingdee(row.id);
|
||||
const data = this.unwrapData(response);
|
||||
this.$message.success(`同步成功,金蝶单据号:${data}`);
|
||||
await this.loadTable();
|
||||
// 附件联带同步提示:同步成功但附件未全部上传时追加 warning,重推即自动补传
|
||||
const freshRow = (this.rows || []).find(item => String(item.id) === String(row.id));
|
||||
if (freshRow && ['pending', 'partial'].includes(freshRow.attachmentSyncStatus)) {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '该单附件未全部上传,可重推补传',
|
||||
duration: 8000,
|
||||
});
|
||||
let successCount = 0;
|
||||
let failCount = 0;
|
||||
let lastFailReason = '';
|
||||
for (const row of rows) {
|
||||
try {
|
||||
await api.syncKingdee(row.id, { meta: { suppressErrorMessage: true } });
|
||||
successCount += 1;
|
||||
} catch (error) {
|
||||
failCount += 1;
|
||||
lastFailReason = String(error?.message || error || '未知错误').trim() || '未知错误';
|
||||
}
|
||||
}
|
||||
await this.onLoad(this.page);
|
||||
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 {
|
||||
this.syncLoading = false;
|
||||
}
|
||||
},
|
||||
async openPaymentDialog() {
|
||||
if (!this.selection.length) return this.$message.warning('请至少选择一条正式结算单');
|
||||
if (!this.selection.length) return this.$message.warning(`请至少选择一条${this.billLabel}`);
|
||||
const rows = this.selection;
|
||||
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 || '')));
|
||||
if (contractIds.size !== 1 || contractIds.has(''))
|
||||
return this.$message.warning('付款申请必须选择同一个合同的正式结算单');
|
||||
return this.$message.warning('付款申请必须选择同一个合同的付款结算单');
|
||||
const paymentRows = rows.map(row => ({ ...row, appliedAmount: this.paymentRemaining(row) }));
|
||||
if (paymentRows.some(row => row.appliedAmount <= 0))
|
||||
return this.$message.warning('所选正式结算单均须存在剩余可申请金额');
|
||||
return this.$message.warning('所选付款结算单均须存在剩余可申请金额');
|
||||
try {
|
||||
const sourceFormalSettlements = await Promise.all(
|
||||
paymentRows.map(async row => {
|
||||
@@ -498,7 +512,7 @@ export default {
|
||||
})
|
||||
);
|
||||
if (sourceFormalSettlements.some(row => row.appliedAmount <= 0)) {
|
||||
this.$message.warning('所选正式结算单均须存在剩余可申请金额');
|
||||
this.$message.warning('所选付款结算单均须存在剩余可申请金额');
|
||||
return;
|
||||
}
|
||||
const transferToken = createSettlementTransfer({
|
||||
@@ -518,7 +532,7 @@ export default {
|
||||
const paymentRows = this.paymentDialog.rows;
|
||||
if (paymentRows.length > 1) {
|
||||
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)))
|
||||
return this.$message.warning('申请付款金额不能超过剩余可申请金额');
|
||||
} else if (Number(this.paymentDialog.form.appliedAmount || 0) <= 0) {
|
||||
@@ -539,7 +553,7 @@ export default {
|
||||
);
|
||||
this.paymentDialog.visible = false;
|
||||
this.selection = [];
|
||||
this.loadTable();
|
||||
this.onLoad(this.page);
|
||||
} finally {
|
||||
this.paymentDialog.loading = false;
|
||||
}
|
||||
@@ -554,9 +568,11 @@ export default {
|
||||
win.document.write(
|
||||
`<!doctype html><html><head><title>${
|
||||
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
|
||||
)}</div><div class="item">预结算单号:${this.escapeHtml(
|
||||
)}</div><div class="item">预付结算单号:${this.escapeHtml(
|
||||
row.preSettlementNos
|
||||
)}</div><div class="item">项目:${this.escapeHtml(
|
||||
row.projectName
|
||||
@@ -581,18 +597,14 @@ export default {
|
||||
const params = this.buildQueryParams();
|
||||
if (this.selection.length) params.ids = this.selection.map(item => item.id).join(',');
|
||||
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() {
|
||||
// 所属组织级联返回 id 路径,转成组织名称传给后端(用副本,避免污染搜索框回显)
|
||||
const params = this.normalizeOrganizationSearch({ ...this.query }, 'deptName');
|
||||
params.settlementType = this.activeSettlementType;
|
||||
const range = params.createDateRange || [];
|
||||
delete params.createDateRange;
|
||||
if (range.length === 2) {
|
||||
params.createStartDate = range[0];
|
||||
params.createEndDate = range[1];
|
||||
}
|
||||
const params = { ...this.query };
|
||||
params.settlementType = this.lockedSettlementType || this.activeSettlementType;
|
||||
return params;
|
||||
},
|
||||
unwrapData(response) {
|
||||
@@ -600,8 +612,8 @@ export default {
|
||||
return body?.data || body;
|
||||
},
|
||||
handleSettlementTypeChange() {
|
||||
this.page.current = 1;
|
||||
this.loadTable();
|
||||
// 分页重置与数据加载由 activeSettlementType watcher + 新挂载 crud 的 on-load 完成
|
||||
this.selection = [];
|
||||
},
|
||||
escapeHtml(value) {
|
||||
return String(value || '-').replace(
|
||||
@@ -609,24 +621,6 @@ export default {
|
||||
char => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[char])
|
||||
);
|
||||
},
|
||||
isEditable(row) {
|
||||
return ['draft', 'returned'].includes(row.approvalStatus);
|
||||
},
|
||||
statusType(status) {
|
||||
return (
|
||||
{ approved: 'success', reviewing: 'warning', returned: 'danger', voided: 'info' }[status] ||
|
||||
''
|
||||
);
|
||||
},
|
||||
invoiceName(value, settlementType) {
|
||||
return invoiceStatusName(value, settlementType);
|
||||
},
|
||||
paymentName(value) {
|
||||
return paymentStatusOptions.find(item => item.value === value)?.label || value || '-';
|
||||
},
|
||||
displayValue(value) {
|
||||
return value === null || value === undefined || value === '' ? '-' : value;
|
||||
},
|
||||
formatMoney(value, currency = 'RMB') {
|
||||
return `${Number(value || 0).toFixed(2)} ${currency || 'RMB'}`;
|
||||
},
|
||||
@@ -639,62 +633,21 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.formal-page__search {
|
||||
padding: 12px 12px 4px;
|
||||
background: #fff;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.formal-page__search-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 8px 24px;
|
||||
align-items: start;
|
||||
}
|
||||
.formal-page__search :deep(.el-form-item) {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.formal-page__search :deep(.el-form-item__label) {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.formal-page__search :deep(.el-input),
|
||||
.formal-page__search :deep(.el-select),
|
||||
.formal-page__search :deep(.el-date-editor) {
|
||||
width: 100%;
|
||||
}
|
||||
.formal-page__search-actions {
|
||||
grid-column: 1 / -1;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.formal-page__table-panel {
|
||||
margin-top: 8px;
|
||||
.formal-page {
|
||||
:deep(.el-table) {
|
||||
--el-table-border-color: #eff1f7;
|
||||
}
|
||||
:deep(.el-table__body tr:nth-child(even) > td.el-table__cell),
|
||||
:deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--left),
|
||||
:deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--right) {
|
||||
background: #fafafa;
|
||||
}
|
||||
}
|
||||
.formal-payment-dialog__batch-tip {
|
||||
margin-bottom: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
.formal-page :deep(.el-table) {
|
||||
--el-table-border-color: #eff1f7;
|
||||
}
|
||||
.formal-page :deep(.el-table__body tr:nth-child(even) > td.el-table__cell),
|
||||
.formal-page :deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--left),
|
||||
.formal-page :deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--right) {
|
||||
background: #fafafa;
|
||||
}
|
||||
:deep(.formal-page.basic-container .basic-container__card > .el-card__body) {
|
||||
padding: 0;
|
||||
}
|
||||
@media (max-width: 1200px) {
|
||||
.formal-page__search-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
.formal-page__search-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -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>
|
||||
<basic-container class="pre-settlement-form-page">
|
||||
<div class="pre-settlement-form-page__title">{{ pageTitle }}</div>
|
||||
<!-- 新增来源明细可直接调整:计费试算走独立接口,调整结果先暂存,保存预结算单时再落库。 -->
|
||||
<!-- 新增来源明细可直接调整:计费试算走独立接口,调整结果先暂存,保存预付结算单时再落库。 -->
|
||||
<pre-settlement-editor
|
||||
v-model="editorVisible"
|
||||
page-mode
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
return this.$route.query.id || '';
|
||||
},
|
||||
pageTitle() {
|
||||
return this.recordId || this.savedRecordId ? '编辑预结算' : '新增预结算';
|
||||
return this.recordId || this.savedRecordId ? '编辑预付结算单' : '新增预付结算单';
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<mk-public-shell biz-type="pre-settlement" :get-form="getForm">
|
||||
<basic-container>
|
||||
<div class="mk-public-form-title">查看预结算</div>
|
||||
<div class="mk-public-form-title">查看预付结算单</div>
|
||||
<pre-settlement-editor
|
||||
ref="page"
|
||||
:model-value="true"
|
||||
|
||||
@@ -446,13 +446,13 @@ export default {
|
||||
openCreate() {
|
||||
this.$router.push({
|
||||
path: '/settlement/pre-settlement/form',
|
||||
query: { mode: 'add', name: '新增预结算' },
|
||||
query: { mode: 'add', name: '新增预付结算单' },
|
||||
});
|
||||
},
|
||||
openEdit(row) {
|
||||
this.$router.push({
|
||||
path: '/settlement/pre-settlement/form',
|
||||
query: { mode: 'edit', id: row.id, name: '编辑预结算' },
|
||||
query: { mode: 'edit', id: row.id, name: '编辑预付结算单' },
|
||||
});
|
||||
},
|
||||
openView(row) {
|
||||
@@ -465,7 +465,7 @@ export default {
|
||||
const records = data?.data?.records || [];
|
||||
const row = records.find(item => item.preSettlementNo === preSettlementNo);
|
||||
if (!row) {
|
||||
this.$message.warning('未找到对应的预结算单');
|
||||
this.$message.warning('未找到对应的预付结算单');
|
||||
return;
|
||||
}
|
||||
this.openView(row);
|
||||
@@ -474,30 +474,30 @@ export default {
|
||||
return ['draft', 'returned'].includes(row.approvalStatus);
|
||||
},
|
||||
async handleDelete(row) {
|
||||
await this.$confirm('确认删除该预结算草稿?', '提示', { type: 'warning' });
|
||||
await this.$confirm('确认删除该预付结算单草稿?', '提示', { type: 'warning' });
|
||||
await remove(row.id);
|
||||
this.$message.success('删除成功');
|
||||
this.loadTable();
|
||||
},
|
||||
selectedOne(operationName) {
|
||||
if (this.selection.length !== 1) {
|
||||
this.$message.warning(`${operationName}需选择一条预结算单`);
|
||||
this.$message.warning(`${operationName}需选择一条预付结算单`);
|
||||
return null;
|
||||
}
|
||||
return this.selection[0];
|
||||
},
|
||||
handleAdvanceApplication() {
|
||||
if (!this.selection.length) {
|
||||
this.$message.warning('请选择需要发起预付申请的预结算单');
|
||||
this.$message.warning('请选择需要发起预付申请的预付结算单');
|
||||
return;
|
||||
}
|
||||
if (this.selection.some(row => !row.contractId)) {
|
||||
this.$message.warning('所选预结算单缺少合同ID,无法发起预付申请');
|
||||
this.$message.warning('所选预付结算单缺少合同ID,无法发起预付申请');
|
||||
return;
|
||||
}
|
||||
const contractIds = new Set(this.selection.map(row => String(row.contractId)));
|
||||
if (contractIds.size > 1) {
|
||||
this.$message.warning('预付申请只能选择同一合同下的预结算单');
|
||||
this.$message.warning('预付申请只能选择同一合同下的预付结算单');
|
||||
return;
|
||||
}
|
||||
if (
|
||||
@@ -508,7 +508,7 @@ export default {
|
||||
row.formalSettlementNo
|
||||
)
|
||||
) {
|
||||
this.$message.warning('仅审批通过、未转正式结算的应付预结算单可发起预付');
|
||||
this.$message.warning('仅审批通过、未转付款结算的应付预付结算单可发起预付');
|
||||
return;
|
||||
}
|
||||
const sourcePreSettlements = this.selection.map(row => ({
|
||||
@@ -533,11 +533,11 @@ export default {
|
||||
},
|
||||
handleFormalSettlement() {
|
||||
if (!this.selection.length) {
|
||||
this.$message.warning('请选择需要转正式结算的预结算单');
|
||||
this.$message.warning('请选择需要转付款结算的预付结算单');
|
||||
return;
|
||||
}
|
||||
if (this.selection.some(row => row.approvalStatus !== 'approved')) {
|
||||
this.$message.warning('仅审核通过的预结算单可转正式结算');
|
||||
this.$message.warning('仅审核通过的预付结算单可转付款结算');
|
||||
return;
|
||||
}
|
||||
const hasCompleteProjectIds = this.selection.every(
|
||||
@@ -549,7 +549,7 @@ export default {
|
||||
)
|
||||
);
|
||||
if (projectKeys.size > 1) {
|
||||
this.$message.warning('尾款结算只能选择同一项目下的预结算单');
|
||||
this.$message.warning('尾款结算只能选择同一项目下的预付结算单');
|
||||
return;
|
||||
}
|
||||
const transferToken = createSettlementTransfer({
|
||||
@@ -560,14 +560,20 @@ export default {
|
||||
});
|
||||
this.$router.push({
|
||||
path: '/settlement/formal-settlement/form',
|
||||
query: { mode: 'add', name: '新增正式结算', transferToken },
|
||||
query: {
|
||||
mode: 'add',
|
||||
name: '新增付款结算单',
|
||||
settlementType: 'payable',
|
||||
listPath: '/settlement/payment-settlement',
|
||||
transferToken,
|
||||
},
|
||||
});
|
||||
},
|
||||
async openPrintDialog() {
|
||||
const row = this.selectedOne('打印结算单');
|
||||
if (!row) return;
|
||||
if (row.approvalStatus === 'voided') {
|
||||
this.$message.warning('已作废的预结算单不能打印');
|
||||
this.$message.warning('已作废的预付结算单不能打印');
|
||||
return;
|
||||
}
|
||||
this.printDialog.row = row;
|
||||
@@ -622,8 +628,8 @@ export default {
|
||||
)
|
||||
.join('');
|
||||
return `<!doctype html><html><head><meta charset="utf-8"><title>${this.escapeHtml(
|
||||
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(
|
||||
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(
|
||||
detail.preSettlementNo
|
||||
)}</div><div>项目名称:${this.escapeHtml(
|
||||
detail.projectName
|
||||
@@ -651,7 +657,7 @@ export default {
|
||||
const params = this.buildQuery();
|
||||
if (this.selection.length) params.ids = this.selection.map(item => item.id).join(',');
|
||||
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) {
|
||||
const previousApprovalStatus = row.approvalStatus || '';
|
||||
@@ -661,13 +667,14 @@ export default {
|
||||
bizId: row.id,
|
||||
subjectName: row.preSettlementNo || '',
|
||||
approvalStatus: previousApprovalStatus,
|
||||
mkEnabled: this.mkEnabled,
|
||||
});
|
||||
this.$message.success('提交成功');
|
||||
this.loadTable();
|
||||
},
|
||||
handleMkAudit(row) {
|
||||
if (!row?.id) {
|
||||
this.$message.warning('预结算单ID为空,无法打开审核页');
|
||||
this.$message.warning('预付结算单ID为空,无法打开审核页');
|
||||
return;
|
||||
}
|
||||
getMKApprovalUrl({ bizId: String(row.id) })
|
||||
@@ -684,7 +691,7 @@ export default {
|
||||
});
|
||||
},
|
||||
async handleApprove(row) {
|
||||
await this.$confirm('确认审批通过该预结算单?', '提示', { type: 'warning' });
|
||||
await this.$confirm('确认审批通过该预付结算单?', '提示', { type: 'warning' });
|
||||
await approve({ id: row.id });
|
||||
this.$message.success('审批通过');
|
||||
this.loadTable();
|
||||
@@ -699,7 +706,7 @@ export default {
|
||||
this.loadTable();
|
||||
},
|
||||
async handleVoid(row) {
|
||||
const { value } = await this.$prompt('请输入作废原因', '作废预结算单', {
|
||||
const { value } = await this.$prompt('请输入作废原因', '作废预付结算单', {
|
||||
inputType: 'textarea',
|
||||
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>
|
||||
|
||||
<el-table
|
||||
ref="mainTableRef"
|
||||
v-loading="loading"
|
||||
:data="rows"
|
||||
:size="tableSize"
|
||||
:height="listTableHeight"
|
||||
border
|
||||
class="settlement-detail-page__table"
|
||||
@selection-change="selectionChange"
|
||||
@@ -146,7 +148,21 @@
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatFeeDetailCell(row, column.prop) }}
|
||||
<div
|
||||
v-if="isChargeFeeColumn(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, chargeFeeName(column))"
|
||||
>
|
||||
<InfoFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
<span v-else>{{ formatFeeDetailCell(row, column.prop) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -225,7 +241,12 @@
|
||||
<div
|
||||
class="settlement-detail-page__detail-panel-body settlement-detail-page__adjust-panel-body"
|
||||
>
|
||||
<el-table v-loading="adjustDialog.loading" :data="adjustRows" border>
|
||||
<el-table
|
||||
v-loading="adjustDialog.loading"
|
||||
:data="adjustRows"
|
||||
:max-height="adjustTableMaxHeight"
|
||||
border
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="64" align="center" />
|
||||
<el-table-column label="来源" width="110" align="center">
|
||||
<template #default="{ row }">{{ feeSourceLabel(row.dataSource) }}</template>
|
||||
@@ -360,12 +381,14 @@
|
||||
inputmode="decimal"
|
||||
@input="value => handleAdjustDecimalInput(row, 'transportQuantity', value)"
|
||||
/>
|
||||
<span v-else-if="column.prop === 'unitPrice' && isTierUnitPrice(row)">-</span>
|
||||
<el-input
|
||||
v-else-if="column.prop === 'unitPrice'"
|
||||
class="settlement-detail-page__adjust-input"
|
||||
:model-value="row.unitPrice"
|
||||
:disabled="!isUnitPriceAdjustable(row)"
|
||||
inputmode="decimal"
|
||||
@input="value => handleAdjustDecimalInput(row, 'unitPrice', value)"
|
||||
@input="value => handleAdjustDecimalInput(row, 'unitPrice', value, 'unitPrice')"
|
||||
/>
|
||||
<el-input
|
||||
v-else-if="column.prop === 'mileage'"
|
||||
@@ -428,36 +451,52 @@
|
||||
:model="updateFeeForm"
|
||||
:rules="updateFeeRules"
|
||||
label-position="right"
|
||||
label-width="auto"
|
||||
label-width="120px"
|
||||
class="settlement-detail-page__dialog-form"
|
||||
>
|
||||
<el-form-item label="更新范围" prop="contractId">
|
||||
<el-input
|
||||
:model-value="updateContractName"
|
||||
class="settlement-detail-page__generate-select"
|
||||
readonly
|
||||
placeholder="请选择合同"
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="openUpdateContractDialog">选择</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<div class="settlement-detail-page__update-fee-field">
|
||||
<el-tooltip
|
||||
:content="updateContractName"
|
||||
:disabled="!updateContractName"
|
||||
placement="top"
|
||||
:show-after="200"
|
||||
>
|
||||
<div class="settlement-detail-page__update-fee-trigger">
|
||||
<el-input
|
||||
:model-value="updateContractName"
|
||||
class="settlement-detail-page__update-fee-control"
|
||||
readonly
|
||||
placeholder="请选择合同"
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="openUpdateContractDialog">选择</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同计费方案" prop="billingPlanId">
|
||||
<el-select
|
||||
v-model="updateFeeForm.billingPlanId"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="!updateFeeForm.contractId"
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in billingPlanOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<div class="settlement-detail-page__update-fee-field">
|
||||
<el-select
|
||||
v-model="updateFeeForm.billingPlanId"
|
||||
class="settlement-detail-page__update-fee-control"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="!updateFeeForm.contractId"
|
||||
:placeholder="updateFeeForm.contractId ? '请选择' : '请先选择合同'"
|
||||
:title="updateBillingPlanName || undefined"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in billingPlanOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:title="item.name"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -520,7 +559,7 @@
|
||||
:index="transferIndexMethod"
|
||||
/>
|
||||
<el-table-column
|
||||
v-for="column in tableColumns.slice(0, 13)"
|
||||
v-for="column in transferTableColumns"
|
||||
:key="column.prop"
|
||||
:prop="column.prop"
|
||||
:label="column.label"
|
||||
@@ -934,11 +973,70 @@
|
||||
</el-button>
|
||||
</template>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ArrowDown, ArrowUp, Close } from '@element-plus/icons-vue';
|
||||
import { ArrowDown, ArrowUp, Close, InfoFilled } from '@element-plus/icons-vue';
|
||||
import {
|
||||
changeRecordColumns,
|
||||
feeDetailBaseColumns,
|
||||
@@ -959,6 +1057,7 @@ import { getList as getCargoTypeList } from '@/api/base/cargo-type';
|
||||
import { exportBlob } from '@/api/common';
|
||||
import { getDictionary } from '@/api/system/dictbiz';
|
||||
import { formatContractOptionLabel } from '@/utils/contract';
|
||||
import { isTierUnitPrice, isUnitPriceAdjustable } from '@/utils/settlement-adjust-rule';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { createSettlementTransfer } from '@/utils/settlement-transfer';
|
||||
import {
|
||||
@@ -990,7 +1089,7 @@ const ADJUST_BILLING_TYPE_MAP = {
|
||||
};
|
||||
|
||||
export default {
|
||||
components: { SettlementTableTools },
|
||||
components: { SettlementTableTools, InfoFilled },
|
||||
props: {
|
||||
settlementType: {
|
||||
type: String,
|
||||
@@ -1002,6 +1101,7 @@ export default {
|
||||
ArrowDown,
|
||||
ArrowUp,
|
||||
Close,
|
||||
InfoFilled,
|
||||
searchFields,
|
||||
tableColumns,
|
||||
tableFeeItemNames: [],
|
||||
@@ -1018,6 +1118,10 @@ export default {
|
||||
rows: [],
|
||||
selection: [],
|
||||
page: { current: 1, size: 10, total: 0 },
|
||||
// 底部详情/调整面板打开时压缩主表高度,露出表格滚动条
|
||||
listTableHeight: undefined,
|
||||
savedListTableHeight: null,
|
||||
listTableLayoutToken: 0,
|
||||
detailDialog: {
|
||||
visible: false,
|
||||
title: '费用明细',
|
||||
@@ -1027,7 +1131,13 @@ export default {
|
||||
},
|
||||
feeRows: [],
|
||||
dynamicFeeColumns: [],
|
||||
billingRuleDialog: {
|
||||
visible: false,
|
||||
rule: null,
|
||||
},
|
||||
adjustDialog: { visible: false, loading: false, submitting: false, row: null },
|
||||
// 表头 + 最多 3 行费用 + 横向滚动条,超出后表体上下滚动
|
||||
adjustTableMaxHeight: 40 + 49 * 3 + 16,
|
||||
adjustRows: [],
|
||||
adjustDynamicFeeColumns: [],
|
||||
adjustTextProps: ['specification', 'model', 'billingFactor', 'billingType'],
|
||||
@@ -1118,6 +1228,14 @@ export default {
|
||||
);
|
||||
return formatContractOptionLabel(contract);
|
||||
},
|
||||
updateBillingPlanName() {
|
||||
const billingPlanId = this.updateFeeForm.billingPlanId;
|
||||
if (!billingPlanId) return '';
|
||||
const plan = this.billingPlanOptions.find(
|
||||
item => String(item.id) === String(billingPlanId)
|
||||
);
|
||||
return plan?.name || '';
|
||||
},
|
||||
generateContractCategory() {
|
||||
return this.settlementType === 'payable' ? '承运商合同' : '客户合同';
|
||||
},
|
||||
@@ -1139,7 +1257,9 @@ export default {
|
||||
return this.searchExpanded ? this.searchFields : this.searchFields.slice(0, 4);
|
||||
},
|
||||
feeDetailColumns() {
|
||||
const baseColumns = feeDetailBaseColumns.filter(column => column.prop !== 'freightAmount');
|
||||
const baseColumns = feeDetailBaseColumns.filter(
|
||||
column => !['freightAmount', 'billingFactor', 'billingType'].includes(column.prop)
|
||||
);
|
||||
const hasAdjustment = this.feeRows.some(row => Number(row.adjustAmount || 0) !== 0);
|
||||
const tailColumns = feeDetailTailColumns.map(col =>
|
||||
col.prop === 'originalAmountText' && hasAdjustment
|
||||
@@ -1174,6 +1294,13 @@ export default {
|
||||
columns.splice(totalIndex, 0, ...dynamicColumns);
|
||||
return columns;
|
||||
},
|
||||
// 批量转结算弹窗只展示前 13 列。预结算单号、正式结算单号正是本操作要生成的单号,
|
||||
// 候选行上必为空,故不占列
|
||||
transferTableColumns() {
|
||||
return this.tableColumns
|
||||
.filter(column => !['preSettlementNo', 'formalSettlementNo'].includes(column.prop))
|
||||
.slice(0, 13);
|
||||
},
|
||||
columnSettingOptions() {
|
||||
return this.displayTableColumns.map(column => ({
|
||||
prop: column.prop,
|
||||
@@ -1203,11 +1330,27 @@ export default {
|
||||
transportCargoTypeOptions() {
|
||||
return this.cargoTypeOptions.filter(item => item.children?.length);
|
||||
},
|
||||
/** 底部单据详情或调整面板是否展开(与 teleport 面板显示条件一致) */
|
||||
isBottomPanelOpen() {
|
||||
return Boolean(this.detailDialog.visible || this.adjustDialog.visible);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'$route.fullPath'() {
|
||||
this.openRouteDetail();
|
||||
},
|
||||
isBottomPanelOpen: {
|
||||
flush: 'post',
|
||||
handler() {
|
||||
this.updateListTableHeight();
|
||||
},
|
||||
},
|
||||
searchVisible() {
|
||||
this.updateListTableHeight();
|
||||
},
|
||||
searchExpanded() {
|
||||
this.updateListTableHeight();
|
||||
},
|
||||
displayTableColumns: {
|
||||
immediate: true,
|
||||
handler(columns) {
|
||||
@@ -1231,20 +1374,28 @@ export default {
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
window.addEventListener('resize', this.updateListTableHeight);
|
||||
this.loadTransportTypeOptions();
|
||||
this.loadCargoTypeOptions();
|
||||
this.loadPriceUnitOptions();
|
||||
await this.loadTable();
|
||||
await this.openRouteDetail();
|
||||
this.updateListTableHeight();
|
||||
},
|
||||
activated() {
|
||||
this.updateListTableHeight();
|
||||
},
|
||||
// 标签切走(keep-alive 缓存)或销毁时,收起 teleport/append-to-body 弹层,避免残留盖住其它页面
|
||||
deactivated() {
|
||||
this.closeInnerDialogs();
|
||||
},
|
||||
beforeUnmount() {
|
||||
window.removeEventListener('resize', this.updateListTableHeight);
|
||||
this.closeInnerDialogs();
|
||||
},
|
||||
methods: {
|
||||
isTierUnitPrice,
|
||||
isUnitPriceAdjustable,
|
||||
closeInnerDialogs() {
|
||||
this.closeDetailPanel();
|
||||
this.closeAdjustPanel();
|
||||
@@ -1255,6 +1406,66 @@ export default {
|
||||
this.previewDialog.visible = false;
|
||||
this.generateContractDialog.visible = false;
|
||||
},
|
||||
/** 表格和分页撑满剩余可视区域;单据详情展开时贴住详情面板,关闭后恢复 */
|
||||
updateListTableHeight() {
|
||||
this.listTableLayoutToken = (this.listTableLayoutToken || 0) + 1;
|
||||
const token = this.listTableLayoutToken;
|
||||
this.$nextTick(() => {
|
||||
window.requestAnimationFrame(() => {
|
||||
if (token !== this.listTableLayoutToken) return;
|
||||
this.applyListTableHeight(token);
|
||||
window.requestAnimationFrame(() => {
|
||||
if (token !== this.listTableLayoutToken) return;
|
||||
this.applyListTableHeight(token);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
applyListTableHeight(token = this.listTableLayoutToken) {
|
||||
if (token !== this.listTableLayoutToken) return;
|
||||
const tableElement = this.$refs.mainTableRef?.$el;
|
||||
if (!tableElement) return;
|
||||
const pagination = this.$el?.querySelector?.(
|
||||
'.settlement-detail-page__table-panel .settlement-detail-page__pagination'
|
||||
);
|
||||
const paginationHeight = pagination?.offsetHeight || 0;
|
||||
const tableTop = tableElement.getBoundingClientRect().top;
|
||||
const view = this.$el?.closest?.('#avue-view');
|
||||
const viewRect = view?.getBoundingClientRect?.();
|
||||
// 用滚动容器的可视高度,避免表格被压矮后按内容底部把高度锁死
|
||||
let bottomEdge = view
|
||||
? viewRect.top + view.clientHeight - 12
|
||||
: window.innerHeight;
|
||||
const panelOpen = this.isBottomPanelOpen;
|
||||
if (panelOpen) {
|
||||
if (!this.savedListTableHeight) {
|
||||
this.savedListTableHeight = this.listTableHeight || null;
|
||||
}
|
||||
const panelRect = document
|
||||
.querySelector('.settlement-detail-page__detail-panel')
|
||||
?.getBoundingClientRect?.();
|
||||
if (panelRect && panelRect.height > 0) {
|
||||
bottomEdge = Math.min(bottomEdge, panelRect.top);
|
||||
this.listTableHeightRetry = 0;
|
||||
} else if ((this.listTableHeightRetry || 0) < 5) {
|
||||
this.listTableHeightRetry = (this.listTableHeightRetry || 0) + 1;
|
||||
window.requestAnimationFrame(() => this.applyListTableHeight(token));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
this.listTableHeightRetry = 0;
|
||||
}
|
||||
const gap = panelOpen ? 8 : 0;
|
||||
let nextHeight = Math.max(180, Math.floor(bottomEdge - tableTop - paginationHeight - gap));
|
||||
if (!panelOpen && this.savedListTableHeight) {
|
||||
if (nextHeight + 24 < this.savedListTableHeight) {
|
||||
nextHeight = this.savedListTableHeight;
|
||||
}
|
||||
this.savedListTableHeight = null;
|
||||
}
|
||||
this.listTableHeight = nextHeight;
|
||||
this.$nextTick(() => this.$refs.mainTableRef?.doLayout?.());
|
||||
},
|
||||
contractCategoryName(value) {
|
||||
return (
|
||||
this.contractCategoryOptions.find(item => String(item.value) === String(value))?.label ||
|
||||
@@ -1683,11 +1894,15 @@ export default {
|
||||
this.detailDialog.visible = false;
|
||||
this.detailDialog.row = null;
|
||||
this.changeRecordsDialog.visible = false;
|
||||
this.billingRuleDialog.visible = false;
|
||||
this.billingRuleDialog.rule = null;
|
||||
this.updateListTableHeight();
|
||||
},
|
||||
closeAdjustPanel() {
|
||||
this.clearAdjustCalculations();
|
||||
this.adjustDialog.visible = false;
|
||||
this.adjustDialog.row = null;
|
||||
this.updateListTableHeight();
|
||||
},
|
||||
handleTableLink(row, column) {
|
||||
if (column.prop === 'waybillNo') {
|
||||
@@ -1712,11 +1927,12 @@ export default {
|
||||
this.$router.push({ path, query: { detailNo } });
|
||||
},
|
||||
async openRouteDetail(detailId = this.$route.query.detailId) {
|
||||
if (
|
||||
!detailId ||
|
||||
this.settlementType !== 'payable' ||
|
||||
this.$route.path !== '/settlement/payable-detail'
|
||||
) {
|
||||
// 结算明细点「单据号」会带 detailId 跳到本页;只有当前停在应收/应付明细页时才自动展开详情
|
||||
const routePath =
|
||||
this.settlementType === 'payable'
|
||||
? '/settlement/payable-detail'
|
||||
: '/settlement/receivable-detail';
|
||||
if (!detailId || this.$route.path !== routePath) {
|
||||
return;
|
||||
}
|
||||
let row = this.rows.find(item => String(item.id) === String(detailId));
|
||||
@@ -1729,7 +1945,9 @@ export default {
|
||||
if (data.records?.[0]) row = this.decorateRow(data.records[0]);
|
||||
}
|
||||
if (!row) {
|
||||
this.$message.info('当前记录未找到对应的应付明细');
|
||||
this.$message.info(
|
||||
`当前记录未找到对应的${this.settlementType === 'payable' ? '应付' : '应收'}明细`
|
||||
);
|
||||
return;
|
||||
}
|
||||
await this.openDetailDialog(row);
|
||||
@@ -1849,8 +2067,9 @@ export default {
|
||||
},
|
||||
handleAdjustDecimalInput(row, prop, value, changedField) {
|
||||
row[prop] = this.normalizeAdjustDecimal(value);
|
||||
if (!row.manualFee && row.id && ['transportQuantity', 'mileage'].includes(prop)) {
|
||||
this.scheduleAdjustFeeCalculation(row);
|
||||
if (!row.manualFee && row.id && ['transportQuantity', 'mileage', 'unitPrice'].includes(prop)) {
|
||||
if (prop === 'unitPrice' && !isUnitPriceAdjustable(row)) return;
|
||||
this.scheduleAdjustFeeCalculation(row, prop);
|
||||
return;
|
||||
}
|
||||
this.recalculateAdjustRow(row, changedField);
|
||||
@@ -1877,23 +2096,25 @@ export default {
|
||||
);
|
||||
row.adjustAmount = Number((row.afterAmount - Number(row.originalAmount || 0)).toFixed(2));
|
||||
},
|
||||
scheduleAdjustFeeCalculation(row) {
|
||||
scheduleAdjustFeeCalculation(row, changedField) {
|
||||
if (row.adjustCalculateTimer) clearTimeout(row.adjustCalculateTimer);
|
||||
row.adjustCalculateVersion += 1;
|
||||
row.calculating = true;
|
||||
const version = row.adjustCalculateVersion;
|
||||
row.adjustCalculateTimer = setTimeout(() => {
|
||||
row.adjustCalculateTimer = null;
|
||||
this.calculateAdjustRow(row, version);
|
||||
this.calculateAdjustRow(row, version, changedField);
|
||||
}, 300);
|
||||
},
|
||||
async calculateAdjustRow(row, version) {
|
||||
async calculateAdjustRow(row, version, changedField) {
|
||||
try {
|
||||
const res = await api.calculateAdjustedFee({
|
||||
detailId: this.adjustDialog.row?.id,
|
||||
feeId: row.id,
|
||||
transportQuantity: Number(row.transportQuantity || 0),
|
||||
mileage: Number(row.mileage || 0),
|
||||
unitPrice: row.unitPrice === null || row.unitPrice === '' ? null : Number(row.unitPrice),
|
||||
changedField,
|
||||
freightAmount: Number(row.freightAmount || 0),
|
||||
feeItems: Object.fromEntries(
|
||||
Object.entries(row.feeItems || {}).map(([name, amount]) => [name, Number(amount || 0)])
|
||||
@@ -1901,18 +2122,24 @@ export default {
|
||||
});
|
||||
if (version !== row.adjustCalculateVersion || !this.adjustDialog.visible) return;
|
||||
const data = res.data?.data || res.data || res || {};
|
||||
row.freightAmount = Number(data.freightAmount || 0);
|
||||
row.feeItems = Object.fromEntries(
|
||||
Object.entries(data.feeItems || {}).map(([name, amount]) => [name, Number(amount || 0)])
|
||||
);
|
||||
row.adjustAmount = Number(data.adjustAmount || 0);
|
||||
row.afterAmount = Number(data.afterAmount || 0);
|
||||
this.applyCalculatedAdjustRow(row, data);
|
||||
} catch (error) {
|
||||
row.calculateError = error.message;
|
||||
} finally {
|
||||
if (version === row.adjustCalculateVersion) row.calculating = false;
|
||||
}
|
||||
},
|
||||
applyCalculatedAdjustRow(row, data) {
|
||||
row.freightAmount = Number(data.freightAmount || 0);
|
||||
row.feeItems = Object.fromEntries(
|
||||
Object.entries(data.feeItems || {}).map(([name, amount]) => [name, Number(amount || 0)])
|
||||
);
|
||||
if (!isTierUnitPrice(row) && data.unitPrice !== undefined && data.unitPrice !== null) {
|
||||
row.unitPrice = Number(data.unitPrice);
|
||||
}
|
||||
row.adjustAmount = Number(data.adjustAmount || 0);
|
||||
row.afterAmount = Number(data.afterAmount || 0);
|
||||
},
|
||||
clearAdjustCalculations() {
|
||||
this.adjustRows.forEach(row => {
|
||||
if (row.adjustCalculateTimer) clearTimeout(row.adjustCalculateTimer);
|
||||
@@ -1924,6 +2151,140 @@ export default {
|
||||
isFreightFeeItem(name) {
|
||||
return String(name || '').includes('运费') || String(name || '').includes('运输费');
|
||||
},
|
||||
isChargeFeeColumn(column = {}) {
|
||||
if (column.prop === 'priceUnit') return false;
|
||||
if (column.prop === 'freightAmount') return true;
|
||||
return String(column.prop || '').startsWith('feeItem');
|
||||
},
|
||||
chargeFeeName(column = {}) {
|
||||
if (column.prop === 'freightAmount') return column.label || '运输费';
|
||||
return column.label || '';
|
||||
},
|
||||
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, feeName = '') {
|
||||
this.billingRuleDialog.rule = this.normalizeBillingRule(row, feeName);
|
||||
this.billingRuleDialog.visible = true;
|
||||
},
|
||||
ruleFeeName(rule = {}) {
|
||||
return String(rule.feeItem || rule.feeItemName || rule.name || '').trim();
|
||||
},
|
||||
feeNamesMatch(left, right) {
|
||||
const source = String(left || '').trim();
|
||||
const target = String(right || '').trim();
|
||||
if (!source || !target) return false;
|
||||
if (source === target) return true;
|
||||
return this.isFreightFeeItem(source) && this.isFreightFeeItem(target);
|
||||
},
|
||||
normalizeBillingRule(row, feeName = '') {
|
||||
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 parsedRules = Array.isArray(parsedNested)
|
||||
? parsedNested.filter(item => item && typeof item === 'object')
|
||||
: [];
|
||||
const requestedFeeName = String(feeName || '').trim();
|
||||
const matchedRules = requestedFeeName
|
||||
? parsedRules.filter(item => this.feeNamesMatch(this.ruleFeeName(item), requestedFeeName))
|
||||
: parsedRules;
|
||||
const sharedRule =
|
||||
parsedRules.length === 1 && !this.ruleFeeName(parsedRules[0]) ? parsedRules[0] : null;
|
||||
const ruleSource =
|
||||
matchedRules[0] || sharedRule || (!requestedFeeName ? parsedNested || nested : null);
|
||||
let rule = this.parseObject(ruleSource);
|
||||
if (!Object.keys(rule).length && typeof nested === 'string' && !requestedFeeName) {
|
||||
rule = { name: nested };
|
||||
}
|
||||
const matchCondition = this.parseObject(
|
||||
requestedFeeName
|
||||
? (rule.matchCondition ?? source.matchCondition ?? source.billingMatchCondition)
|
||||
: (source.matchCondition ?? source.billingMatchCondition ?? rule.matchCondition)
|
||||
);
|
||||
return {
|
||||
...rule,
|
||||
feeItem: requestedFeeName || source.billingFeeItem || source.feeItem || rule.feeItem,
|
||||
billingElement: requestedFeeName
|
||||
? rule.billingElement || rule.billingFactor || ''
|
||||
: source.billingElement ||
|
||||
source.billingFactor ||
|
||||
rule.billingElement ||
|
||||
rule.billingFactor,
|
||||
billingType: requestedFeeName ? rule.billingType || '' : source.billingType || rule.billingType,
|
||||
billingUnit: requestedFeeName
|
||||
? rule.billingUnit || rule.priceUnit || ''
|
||||
: source.billingUnit || source.priceUnit || rule.billingUnit || rule.priceUnit,
|
||||
unitPrice: requestedFeeName
|
||||
? (rule.unitPrice ?? '')
|
||||
: (source.billingUnitPrice ?? source.unitPrice ?? rule.unitPrice),
|
||||
minimumBillingWeight: requestedFeeName
|
||||
? (rule.minimumBillingWeight ?? rule.lowerLimit ?? '')
|
||||
: (source.minimumBillingWeight ?? rule.minimumBillingWeight ?? rule.lowerLimit),
|
||||
remark: requestedFeeName
|
||||
? rule.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() {
|
||||
if (!this.adjustRows.length || !this.adjustDialog.row) {
|
||||
this.$message.warning('没有可调整的费用明细');
|
||||
@@ -2125,7 +2486,8 @@ export default {
|
||||
return;
|
||||
}
|
||||
const options = this.syncBillingPlanOptions(contractId);
|
||||
const selected = options.find(item => item.defaultPlan) || options[0];
|
||||
const defaultOptions = options.filter(item => item.defaultPlan);
|
||||
const selected = defaultOptions[defaultOptions.length - 1] || options[options.length - 1];
|
||||
this.updateFeeForm.billingPlanId = selected?.id || '';
|
||||
},
|
||||
async confirmUpdateFee() {
|
||||
@@ -2681,12 +3043,12 @@ export default {
|
||||
return `${Number(value).toFixed(2)} ${currency}`;
|
||||
},
|
||||
formatDetailCell(row, prop) {
|
||||
if (prop === 'mileage' && Number(row?.[prop]) === -1) {
|
||||
return '-';
|
||||
}
|
||||
if (
|
||||
prop === 'mileage' &&
|
||||
(row?.[prop] === null ||
|
||||
row?.[prop] === undefined ||
|
||||
row?.[prop] === '' ||
|
||||
Number(row[prop]) === -1)
|
||||
(row?.[prop] === null || row?.[prop] === undefined || row?.[prop] === '')
|
||||
) {
|
||||
return '';
|
||||
}
|
||||
@@ -2847,11 +3209,37 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-form-item__content) {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
// 仅作用于外层 tooltip 触发器,排除 el-select 内部下拉用的 .el-select__wrapper
|
||||
// (后者也带 el-tooltip__trigger;若设为 block 会打断 flex,导致「请选择」与箭头叠在左上角)
|
||||
:deep(.el-tooltip__trigger:not(.el-select__wrapper)) {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.el-select) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.settlement-detail-page__update-fee-field,
|
||||
.settlement-detail-page__update-fee-trigger {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.settlement-detail-page__update-fee-control {
|
||||
width: 100%;
|
||||
|
||||
:deep(.el-input-group) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.settlement-detail-page__adjust-input {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
@@ -2999,6 +3387,29 @@ export default {
|
||||
|
||||
.settlement-detail-page__adjust-panel-body {
|
||||
padding-top: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.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) {
|
||||
|
||||
@@ -88,16 +88,21 @@
|
||||
><el-link
|
||||
v-if="column.link && row[column.prop]"
|
||||
type="primary"
|
||||
@click="openView(row)"
|
||||
@click="handleTableLink(row, column)"
|
||||
>{{ row[column.prop] }}</el-link
|
||||
><el-tag v-else-if="column.status" :type="statusType(row.approvalStatus)" class="status-text">{{
|
||||
row[column.prop] || '-'
|
||||
}}</el-tag
|
||||
><el-tag
|
||||
v-else-if="column.kingdee"
|
||||
:type="kingdeeStatusType(row.kingdeeSyncStatus)"
|
||||
class="status-text"
|
||||
>{{ kingdeeSyncName(row.kingdeeSyncStatus) }}</el-tag
|
||||
><span v-else-if="column.money">{{ formatMoney(row[column.prop]) }}</span
|
||||
><span v-else>{{ displayValue(row[column.prop]) }}</span></template
|
||||
></el-table-column
|
||||
>
|
||||
<el-table-column label="操作" width="120" fixed="right" align="center"
|
||||
<el-table-column label="操作" width="320" fixed="right" align="center"
|
||||
><template #default="{ row }"
|
||||
><div class="settlement-adjustment-page__links">
|
||||
<el-link
|
||||
@@ -139,14 +144,10 @@
|
||||
@click="handleReturn(row)"
|
||||
>驳回</el-link
|
||||
><el-link
|
||||
v-if="
|
||||
hasPermission('settlement_adjustment_repush') &&
|
||||
row.approvalStatus === 'approved' &&
|
||||
row.kingdeeSyncStatus === 'synced'
|
||||
"
|
||||
type="danger"
|
||||
@click="handleRepush(row)"
|
||||
>重新推送(高危)</el-link
|
||||
v-if="hasPermission('settlement_adjustment_repush') && row.approvalStatus === 'approved'"
|
||||
:type="row.kingdeeSyncStatus === 'synced' ? 'danger' : 'primary'"
|
||||
@click="handleKingdee(row)"
|
||||
>{{ row.kingdeeSyncStatus === 'synced' ? '重新推送(高危)' : '推送金蝶' }}</el-link
|
||||
>
|
||||
</div></template
|
||||
></el-table-column
|
||||
@@ -180,6 +181,7 @@ import * as api from '@/api/settlement/settlementAdjustment';
|
||||
import { settlementAdjustmentSearchFields } from '@/option/settlement/settlementAdjustmentSearch';
|
||||
import organizationSearch from '@/mixins/organization-search';
|
||||
import { settlementAdjustmentTableColumns } from '@/option/settlement/settlementAdjustmentTable';
|
||||
import { kingdeeSyncStatusOptions } from '@/option/settlement/formalSettlementSearch';
|
||||
import SettlementAdjustmentEditor from './components/settlement-adjustment-editor.vue';
|
||||
import SettlementTableTools from './components/settlement-table-tools.vue';
|
||||
import { isAdministrator } from '@/utils/auth';
|
||||
@@ -283,6 +285,21 @@ export default {
|
||||
openView(row) {
|
||||
this.editor = { visible: true, id: row.id, readonly: true };
|
||||
},
|
||||
// 单据号→本单查看弹窗;结算单号→跳正式结算列表页并自动打开该单详情(页面支持 ?detailNo=)
|
||||
handleTableLink(row, column) {
|
||||
if (column.prop === 'formalSettlementNo') {
|
||||
this.openSettlementDetail(row.formalSettlementNo);
|
||||
return;
|
||||
}
|
||||
this.openView(row);
|
||||
},
|
||||
openSettlementDetail(detailNo) {
|
||||
if (!detailNo) {
|
||||
this.$message.info('当前记录未关联结算单详情');
|
||||
return;
|
||||
}
|
||||
this.$router.push({ path: '/settlement/formal-settlement', query: { detailNo } });
|
||||
},
|
||||
isEditable(row) {
|
||||
return ['draft', 'returned'].includes(row.approvalStatus);
|
||||
},
|
||||
@@ -300,12 +317,10 @@ export default {
|
||||
},
|
||||
async handleApprove(row) {
|
||||
await this.$confirm('审批通过后将更新关联正式结算单,确认继续?', '提示');
|
||||
await api.approve(row.id);
|
||||
if (row.kingdeeSyncStatus === 'synced')
|
||||
this.$message.warning(
|
||||
'调整已生效,本地已更新;原结算单已推送金蝶,请财务先手工冲销旧应付单后再重新推送。'
|
||||
);
|
||||
else this.$message.success('审批通过');
|
||||
const res = await api.approve(row.id);
|
||||
// data=false:自动同步金蝶失败;data=true 且 msg 带已推送场景的手工冲销提示
|
||||
if (res.data.data === true || res.data.data === false) this.$message.warning(res.data.msg);
|
||||
else this.$message.success(res.data.msg || '审批通过');
|
||||
this.loadTable();
|
||||
},
|
||||
async handleReturn(row) {
|
||||
@@ -317,14 +332,24 @@ export default {
|
||||
this.$message.success('已驳回');
|
||||
this.loadTable();
|
||||
},
|
||||
// 单一入口按状态分流:未同步/失败→推送原结算单;已同步→冲销后重推新单(高危)
|
||||
async handleKingdee(row) {
|
||||
if (row.kingdeeSyncStatus === 'synced') return this.handleRepush(row);
|
||||
return this.handleSyncKingdee(row);
|
||||
},
|
||||
async handleSyncKingdee(row) {
|
||||
const res = await api.syncKingdee(row.id);
|
||||
this.$message.success(`已推送金蝶:${res.data.data || '-'}`);
|
||||
this.loadTable();
|
||||
},
|
||||
async handleRepush(row) {
|
||||
await this.$confirm(
|
||||
'请确认金蝶旧应付单已由财务手工冲销,继续将生成全新财务应付单。',
|
||||
'请确认金蝶旧应付/应收单已由财务手工冲销,继续将生成全新财务应付/应收单。',
|
||||
'高危操作确认',
|
||||
{ type: 'warning', confirmButtonText: '确认重新推送' }
|
||||
);
|
||||
const { data } = await api.repush(row.id);
|
||||
this.$message.success(`已生成新金蝶应付单:${data?.data || data || '-'}`);
|
||||
this.$message.success(`已生成新金蝶单据:${data?.data || data || '-'}`);
|
||||
this.loadTable();
|
||||
},
|
||||
statusType(status) {
|
||||
@@ -333,6 +358,12 @@ export default {
|
||||
'info'
|
||||
);
|
||||
},
|
||||
kingdeeStatusType(status) {
|
||||
return { synced: 'success', failed: 'danger' }[status] || 'info';
|
||||
},
|
||||
kingdeeSyncName(value) {
|
||||
return kingdeeSyncStatusOptions.find(item => item.value === value)?.label || value || '-';
|
||||
},
|
||||
displayValue(value) {
|
||||
return value === null || value === undefined || value === '' ? '-' : value;
|
||||
},
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<basic-container class="settlement-import-form-page">
|
||||
<div class="settlement-import-form-page__title">{{ pageTitle }}</div>
|
||||
<settlement-import-page />
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import SettlementImportPage from './components/settlement-import-page.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const pageTitle = computed(() => {
|
||||
if (route.query.mode === 'view') return '查看导入结算单';
|
||||
return route.query.id ? '编辑导入结算单' : '新增导入结算单';
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.settlement-import-form-page {
|
||||
:deep(.basic-container__card) {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
:deep(.basic-container__card > .el-card__body) {
|
||||
padding: 0;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.settlement-import-form-page__title {
|
||||
position: relative;
|
||||
padding: 16px 24px 12px 36px;
|
||||
border-bottom: 1px solid #eff1f7;
|
||||
background: #fff;
|
||||
color: #303133;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 16px;
|
||||
left: 24px;
|
||||
width: 4px;
|
||||
height: 22px;
|
||||
border-radius: 2px;
|
||||
background: #409eff;
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,312 @@
|
||||
<template>
|
||||
<basic-container class="settlement-import-page">
|
||||
<avue-crud
|
||||
ref="crud"
|
||||
:option="option"
|
||||
:table-loading="loading"
|
||||
:data="rows"
|
||||
v-model:page="page"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad"
|
||||
>
|
||||
<template #menu-left>
|
||||
<el-button
|
||||
v-if="hasPermission('settlement_import_add')"
|
||||
type="primary"
|
||||
@click="openCreate"
|
||||
>新增</el-button
|
||||
>
|
||||
</template>
|
||||
|
||||
<template #batchNo="{ row }">
|
||||
<el-link type="primary" @click="openDetail(row)">{{ row.batchNo || '-' }}</el-link>
|
||||
</template>
|
||||
|
||||
<template #importStatusName="{ row }">
|
||||
<el-tag :type="statusTagType(row.importStatus)" effect="plain">{{
|
||||
row.importStatusName || importStatusLabel(row.importStatus)
|
||||
}}</el-tag>
|
||||
</template>
|
||||
|
||||
<template #menu="{ row }">
|
||||
<el-link type="primary" @click="openDetail(row)">查看</el-link>
|
||||
<el-link v-if="row.importStatus === 'draft'" type="primary" @click="editDraft(row)"
|
||||
>编辑</el-link
|
||||
>
|
||||
<el-link
|
||||
v-if="row.importStatus === 'draft' && hasPermission('settlement_import_delete')"
|
||||
type="danger"
|
||||
@click="handleDelete(row)"
|
||||
>删除</el-link
|
||||
>
|
||||
<el-link
|
||||
v-if="row.importStatus === 'completed' && hasPermission('settlement_import_void')"
|
||||
type="danger"
|
||||
@click="openVoid(row)"
|
||||
>作废</el-link
|
||||
>
|
||||
</template>
|
||||
</avue-crud>
|
||||
|
||||
<el-dialog v-model="voidVisible" title="作废导入结算单" width="480px" append-to-body>
|
||||
<el-form
|
||||
ref="voidFormRef"
|
||||
:model="voidForm"
|
||||
:rules="voidRules"
|
||||
label-position="right"
|
||||
label-width="auto"
|
||||
>
|
||||
<el-form-item label="作废原因" prop="reason">
|
||||
<el-input
|
||||
v-model="voidForm.reason"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
placeholder="请输入作废原因"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="voidVisible = false">取消</el-button>
|
||||
<el-button type="danger" :loading="voidLoading" @click="submitVoid">确认作废</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { h } from 'vue';
|
||||
import { ElOption, ElSelect } from 'element-plus';
|
||||
import { mapGetters } from 'vuex';
|
||||
import * as api from '@/api/settlement/settlementImport';
|
||||
import { settlementImportOption, importStatusLabel } from '@/option/settlement/settlementImport';
|
||||
|
||||
const SETTLEMENT_IMPORT_LIST_REFRESH_KEY = 'settlement-import-list-refresh';
|
||||
|
||||
export default {
|
||||
name: 'SettlementImport',
|
||||
data() {
|
||||
return {
|
||||
rows: [],
|
||||
loading: false,
|
||||
query: {},
|
||||
option: settlementImportOption(),
|
||||
page: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
pageSizes: [10, 20, 50, 100],
|
||||
total: 0,
|
||||
},
|
||||
batchNoOptions: [],
|
||||
voidVisible: false,
|
||||
voidLoading: false,
|
||||
voidForm: { id: null, reason: '' },
|
||||
voidRules: {
|
||||
reason: [
|
||||
{ required: true, message: '请输入作废原因', trigger: 'blur' },
|
||||
{ max: 200, message: '作废原因不能超过200个字', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['permission', 'userInfo']),
|
||||
isAdmin() {
|
||||
const authority = this.userInfo?.authority || '';
|
||||
return String(authority).includes('admin');
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.setBatchNoSearchRender();
|
||||
this.loadOptions();
|
||||
},
|
||||
activated() {
|
||||
this.consumeListRefresh();
|
||||
},
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
if (
|
||||
to.path === '/settlement/settlement-import' &&
|
||||
from?.path === '/settlement/settlement-import/form'
|
||||
) {
|
||||
this.consumeListRefresh();
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
consumeListRefresh() {
|
||||
if (sessionStorage.getItem(SETTLEMENT_IMPORT_LIST_REFRESH_KEY) !== '1') {
|
||||
return;
|
||||
}
|
||||
sessionStorage.removeItem(SETTLEMENT_IMPORT_LIST_REFRESH_KEY);
|
||||
this.page.currentPage = 1;
|
||||
this.loadOptions();
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
hasPermission(code) {
|
||||
return this.isAdmin || this.validData(this.permission?.[code], false);
|
||||
},
|
||||
importStatusLabel,
|
||||
statusTagType(status) {
|
||||
if (status === 'draft') return 'info';
|
||||
if (status === 'completed') return 'success';
|
||||
if (status === 'voided') return 'danger';
|
||||
return '';
|
||||
},
|
||||
unwrapData(response) {
|
||||
const body = response?.data || response || {};
|
||||
return body?.data !== undefined ? body.data : body;
|
||||
},
|
||||
/** 批次号搜索控件:可搜索 + 可手输,选项来自已导入批次 */
|
||||
setBatchNoSearchRender() {
|
||||
const column = this.findColumn(this.option.column, 'batchNo');
|
||||
if (!column) return;
|
||||
column.renderSearch = scope =>
|
||||
h(
|
||||
ElSelect,
|
||||
{
|
||||
modelValue: scope.row?.batchNo ?? '',
|
||||
'onUpdate:modelValue': value => {
|
||||
if (scope.row) scope.row.batchNo = value ?? '';
|
||||
},
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
allowCreate: true,
|
||||
defaultFirstOption: true,
|
||||
placeholder: '请选择',
|
||||
style: 'width: 100%',
|
||||
},
|
||||
() =>
|
||||
this.batchNoOptions.map(item =>
|
||||
h(ElOption, { key: item.value, label: item.label, value: item.value })
|
||||
)
|
||||
);
|
||||
},
|
||||
async loadOptions() {
|
||||
try {
|
||||
const response = await api.getOptions();
|
||||
const options = this.unwrapData(response) || {};
|
||||
const batchNos = Array.isArray(options.batchNos) ? options.batchNos : [];
|
||||
this.batchNoOptions = batchNos.map(item => {
|
||||
if (typeof item === 'string') {
|
||||
return { label: item, value: item };
|
||||
}
|
||||
const value = item.id ?? item.value ?? item.name ?? item.batchNo ?? '';
|
||||
const label = item.name ?? item.label ?? item.batchNo ?? value;
|
||||
return { label: String(label || ''), value: String(value || '') };
|
||||
});
|
||||
} catch (error) {
|
||||
this.batchNoOptions = [];
|
||||
}
|
||||
},
|
||||
onLoad(page) {
|
||||
this.loading = true;
|
||||
api
|
||||
.getList(page.currentPage, page.pageSize, { ...this.query })
|
||||
.then(response => {
|
||||
const data = this.unwrapData(response) || {};
|
||||
this.rows = data.records || [];
|
||||
this.page.total = Number(data.total || 0);
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = { ...params };
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page);
|
||||
done();
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
currentChange(currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.loadOptions();
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
openCreate() {
|
||||
this.$router.push({ path: '/settlement/settlement-import/form' });
|
||||
},
|
||||
openDetail(row) {
|
||||
if (!row?.id) return;
|
||||
this.$router.push({
|
||||
path: '/settlement/settlement-import/form',
|
||||
query: { id: row.id, mode: 'view' },
|
||||
});
|
||||
},
|
||||
editDraft(row) {
|
||||
this.$router.push({
|
||||
path: '/settlement/settlement-import/form',
|
||||
query: { id: row.id },
|
||||
});
|
||||
},
|
||||
async handleDelete(row) {
|
||||
if (!row?.id) return;
|
||||
try {
|
||||
await this.$confirm('确认删除该草稿批次?删除后不可恢复。', '提示', {
|
||||
type: 'warning',
|
||||
});
|
||||
await api.removeDraft(row.id);
|
||||
this.$message.success('删除成功');
|
||||
this.refreshChange();
|
||||
} catch (error) {
|
||||
if (error === 'cancel' || error === 'close') return;
|
||||
this.$message.error(error?.message || '删除失败');
|
||||
}
|
||||
},
|
||||
openVoid(row) {
|
||||
this.voidForm = { id: row.id, reason: '' };
|
||||
this.voidVisible = true;
|
||||
this.$nextTick(() => this.$refs.voidFormRef?.clearValidate());
|
||||
},
|
||||
async submitVoid() {
|
||||
await this.$refs.voidFormRef?.validate();
|
||||
this.voidLoading = true;
|
||||
try {
|
||||
await api.voidBatch({
|
||||
id: this.voidForm.id,
|
||||
reason: String(this.voidForm.reason || '').trim(),
|
||||
});
|
||||
this.$message.success('作废成功');
|
||||
this.voidVisible = false;
|
||||
this.onLoad(this.page);
|
||||
this.loadOptions();
|
||||
} finally {
|
||||
this.voidLoading = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.settlement-import-page :deep(.el-table) {
|
||||
--el-table-border-color: #eff1f7;
|
||||
}
|
||||
|
||||
.settlement-import-page :deep(.el-table__body tr:nth-child(even) > td.el-table__cell),
|
||||
.settlement-import-page
|
||||
:deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--left),
|
||||
.settlement-import-page
|
||||
:deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--right) {
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
:deep(.settlement-import-page.basic-container .basic-container__card > .el-card__body) {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
+170
-32
@@ -153,7 +153,12 @@
|
||||
/>
|
||||
<div class="oa-sync-meta" v-if="oaSyncStage === 'clear'">当前阶段:{{ oaSyncStageLabel }}</div>
|
||||
<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 class="oa-sync-stats">
|
||||
<div class="oa-sync-stat">
|
||||
@@ -165,6 +170,9 @@
|
||||
<span class="oa-sync-stat__value oa-sync-stat__value--skip">{{ oaSyncProgress.skipped }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="oaSyncProgress.dumpFilePath" class="oa-sync-meta">
|
||||
原始数据 JSON:{{ oaSyncProgress.dumpFilePath }}
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
@@ -253,6 +261,10 @@ export default {
|
||||
total: 0,
|
||||
synced: 0,
|
||||
skipped: 0,
|
||||
dumpFilePath: '',
|
||||
companyOaId: '',
|
||||
companyIndex: 0,
|
||||
companyTotal: 0,
|
||||
},
|
||||
parentId: 0,
|
||||
page: {
|
||||
@@ -286,7 +298,9 @@ export default {
|
||||
{
|
||||
label: '组织名称',
|
||||
prop: 'deptName',
|
||||
minWidth: 160,
|
||||
minWidth: 320,
|
||||
align: 'left',
|
||||
headerAlign: 'left',
|
||||
order: 80,
|
||||
search: true,
|
||||
searchOrder: 2,
|
||||
@@ -404,6 +418,43 @@ export default {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '合同初始流水号',
|
||||
prop: 'contractInitialSerial',
|
||||
type: 'input',
|
||||
minWidth: 140,
|
||||
order: 61,
|
||||
placeholder: '如 1',
|
||||
tip: '该部门当年首个合同时从此流水号起编,后续递增;范围1-999,不填默认从1开始',
|
||||
rules: [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
// -1 为空占位,不填时按空处理
|
||||
if (
|
||||
value === undefined ||
|
||||
value === null ||
|
||||
value === '' ||
|
||||
Number(value) === -1
|
||||
) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
const text = String(value).trim();
|
||||
if (!/^\d+$/.test(text)) {
|
||||
callback(new Error('合同初始流水号只能输入正整数'));
|
||||
return;
|
||||
}
|
||||
const serial = Number(text);
|
||||
if (serial < 1 || serial > 999) {
|
||||
callback(new Error('合同初始流水号范围为1到999'));
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '组织简称',
|
||||
prop: 'shortName',
|
||||
@@ -638,12 +689,18 @@ export default {
|
||||
}
|
||||
const totalPage = this.oaSyncTotalPage;
|
||||
const current = Number(this.oaSyncProgress.current) || 0;
|
||||
const stageBase = this.oaSyncStage === 'department' ? 50 : 0;
|
||||
if (totalPage <= 0) {
|
||||
return stageBase;
|
||||
if (this.oaSyncStage === 'department') {
|
||||
const companyTotal = Math.max(1, Number(this.oaSyncProgress.companyTotal) || 1);
|
||||
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));
|
||||
return Math.min(99, stageBase + stagePercent);
|
||||
if (totalPage <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return Math.min(49, Math.round((current / totalPage) * 50));
|
||||
},
|
||||
oaSyncProgressStatus() {
|
||||
if (this.oaSyncStatus === 'done') {
|
||||
@@ -657,25 +714,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleOaOrgFullSync() {
|
||||
this.$confirm(
|
||||
'全量同步将拉取 OA 全部公司/部门;已存在且 OA 更新时间一致的记录会跳过。是否清除后同步?选择“是”将保留顶级「外部组织」与集团锚点(id=135/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 });
|
||||
}
|
||||
});
|
||||
this.startOaOrgSync({ clearNonTop: false, incremental: false });
|
||||
},
|
||||
handleOaOrgIncrementalSync() {
|
||||
this.$confirm(
|
||||
@@ -709,6 +748,10 @@ export default {
|
||||
total: 0,
|
||||
synced: 0,
|
||||
skipped: 0,
|
||||
dumpFilePath: '',
|
||||
companyOaId: '',
|
||||
companyIndex: 0,
|
||||
companyTotal: 0,
|
||||
};
|
||||
this.runOaOrgSyncPages();
|
||||
},
|
||||
@@ -720,6 +763,25 @@ export default {
|
||||
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) {
|
||||
const size = 20;
|
||||
const incremental = this.oaSyncMode === 'incremental';
|
||||
@@ -737,17 +799,57 @@ export default {
|
||||
if (!modifiedSince && page.modifiedSince) {
|
||||
modifiedSince = page.modifiedSince;
|
||||
}
|
||||
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;
|
||||
this.applyOaOrgSyncPage(page, current, size);
|
||||
if (page.finished) {
|
||||
break;
|
||||
}
|
||||
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() {
|
||||
try {
|
||||
if (this.oaSyncClearNonTop) {
|
||||
@@ -767,7 +869,10 @@ export default {
|
||||
this.oaSyncStage = 'department';
|
||||
this.oaSyncProgress.current = 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) {
|
||||
this.oaSyncStatus = 'cancelled';
|
||||
return;
|
||||
@@ -1088,6 +1193,29 @@ export default {
|
||||
row.parentId = 0;
|
||||
}
|
||||
},
|
||||
normalizeContractInitialSerial(value) {
|
||||
// -1 为空占位,不填时不落库、不回显
|
||||
if (
|
||||
value === undefined ||
|
||||
value === null ||
|
||||
value === '' ||
|
||||
Number(value) === -1
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
const text = String(value).trim();
|
||||
if (!text) {
|
||||
return null;
|
||||
}
|
||||
const serial = Number(text);
|
||||
return Number.isInteger(serial) ? serial : value;
|
||||
},
|
||||
clearEmptyContractInitialSerial(form = this.form) {
|
||||
if (!form) return;
|
||||
if (Number(form.contractInitialSerial) === -1) {
|
||||
form.contractInitialSerial = '';
|
||||
}
|
||||
},
|
||||
isRootDept(row) {
|
||||
return row && (row.parentId === 0 || String(row.parentId) === '0');
|
||||
},
|
||||
@@ -1234,6 +1362,7 @@ export default {
|
||||
row.deptCode = String(row.deptCode || '').trim();
|
||||
row.kingdeeDeptCode = String(row.kingdeeDeptCode || '').trim();
|
||||
row.contractCodePrefix = String(row.contractCodePrefix || '').trim();
|
||||
row.contractInitialSerial = this.normalizeContractInitialSerial(row.contractInitialSerial);
|
||||
row.leaderId = func.join(row.leaderId);
|
||||
this.normalizeTopParent(row);
|
||||
if (!this.prepareDeptSubmitRow(row)) {
|
||||
@@ -1281,6 +1410,7 @@ export default {
|
||||
row.deptCode = String(row.deptCode || '').trim();
|
||||
row.kingdeeDeptCode = String(row.kingdeeDeptCode || '').trim();
|
||||
row.contractCodePrefix = String(row.contractCodePrefix || '').trim();
|
||||
row.contractInitialSerial = this.normalizeContractInitialSerial(row.contractInitialSerial);
|
||||
row.leaderId = func.join(row.leaderId);
|
||||
this.normalizeTopParent(row);
|
||||
if (!this.prepareDeptSubmitRow(row)) {
|
||||
@@ -1390,6 +1520,7 @@ export default {
|
||||
if (this.form.isPlatformCompany === undefined || this.form.isPlatformCompany === null) {
|
||||
this.form.isPlatformCompany = 0;
|
||||
}
|
||||
this.clearEmptyContractInitialSerial(this.form);
|
||||
this.initData(this.form.tenantId);
|
||||
this.loadParentDeptCode(this.form.parentId);
|
||||
}
|
||||
@@ -1404,6 +1535,7 @@ export default {
|
||||
if (this.form.parentId === '0') {
|
||||
this.form.parentId = '';
|
||||
}
|
||||
this.clearEmptyContractInitialSerial(this.form);
|
||||
this.loadParentDeptCode(this.form.parentId);
|
||||
if (this.form.hasOwnProperty('leaderId')) {
|
||||
const splitResult = func.split(this.form.leaderId);
|
||||
@@ -1452,6 +1584,12 @@ export default {
|
||||
</script>
|
||||
|
||||
<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 {
|
||||
padding: 12px 12px 4px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="box">
|
||||
<el-scrollbar>
|
||||
<basic-container>
|
||||
<avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" />
|
||||
<avue-tree ref="deptTree" :option="treeOption" :data="treeData" @node-click="nodeClick" />
|
||||
</basic-container>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
@@ -172,6 +172,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6"><el-form-item label="工号"><el-input v-model="form.code" :disabled="isUserViewMode" /></el-form-item></el-col>
|
||||
<el-col :span="6"><el-form-item label="OA登录名"><el-input v-model="form.oaLoginId" :disabled="isUserViewMode" maxlength="128" placeholder="请输入OA登录名" /></el-form-item></el-col>
|
||||
<el-col :span="6"><el-form-item label="人员类别"><el-select v-model="form.personCategory" :disabled="isUserViewMode"><el-option label="内部员工" :value="1" /><el-option label="承运商" :value="2" /></el-select></el-form-item></el-col>
|
||||
<el-col :span="18"><el-form-item label="数据权限范围"><el-radio-group v-model="form.dataScopeRange" :disabled="isUserViewMode"><el-radio :value="1">仅所属组织</el-radio><el-radio :value="2">全部组织</el-radio><el-radio :value="3">自定义</el-radio></el-radio-group></el-form-item></el-col>
|
||||
<el-col :span="18"><el-form-item label="数据层级范围"><el-radio-group v-model="form.dataLevelRange" :disabled="isUserViewMode"><el-radio :value="1">包含下级</el-radio><el-radio :value="2">仅本级</el-radio></el-radio-group></el-form-item></el-col>
|
||||
@@ -363,6 +364,13 @@
|
||||
<span class="oa-sync-stat__label">跳过</span>
|
||||
<span class="oa-sync-stat__value oa-sync-stat__value--skip">{{ oaSyncProgress.skipped }}</span>
|
||||
</div>
|
||||
<div class="oa-sync-stat">
|
||||
<span class="oa-sync-stat__label">删除</span>
|
||||
<span class="oa-sync-stat__value oa-sync-stat__value--remove">{{ oaSyncProgress.removed }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="oaSyncProgress.dumpFilePath" class="oa-sync-meta">
|
||||
原始数据 JSON:{{ oaSyncProgress.dumpFilePath }}
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
@@ -450,6 +458,8 @@ export default {
|
||||
total: 0,
|
||||
synced: 0,
|
||||
skipped: 0,
|
||||
removed: 0,
|
||||
dumpFilePath: '',
|
||||
},
|
||||
page: {
|
||||
pageSize: 10,
|
||||
@@ -642,7 +652,17 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
nodeClick(data) {
|
||||
this.treeDeptId = data.id;
|
||||
const deptId = data?.id;
|
||||
if (deptId != null && String(this.treeDeptId) === String(deptId)) {
|
||||
this.treeDeptId = '';
|
||||
this.page.currentPage = 1;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.deptTree?.setCurrentKey?.(null);
|
||||
});
|
||||
this.onLoad(this.page);
|
||||
return;
|
||||
}
|
||||
this.treeDeptId = deptId;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
@@ -677,17 +697,21 @@ export default {
|
||||
});
|
||||
},
|
||||
handleOaPersonFullSync() {
|
||||
this.$confirm('全量同步将拉取 OA 全部人员及组织;已存在且 OA 更新时间一致的记录会跳过。是否继续?', '全量同步', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
this.$confirm(
|
||||
'全量同步将按 OA 对齐人员:有登录名的按登录名更新且不修改密码,没有登录名但有工号的也会入库且不回填登录名,部门按 OA 当前部门重绑,OA 中已不存在或已离职的删除。是否继续?',
|
||||
'全量同步',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(() => {
|
||||
this.startOaSync(false);
|
||||
});
|
||||
},
|
||||
handleOaPersonIncrementalSync() {
|
||||
this.$confirm(
|
||||
'增量同步仅拉取本地最大 OA 更新时间之后有变更的人员;不存在的新增,已存在且更新时间不一致的修改,一致的跳过。是否继续?',
|
||||
'增量同步仅拉取本地最大 OA 更新时间之后有变更的人员:已有的更新且不修改密码,没有的新增,部门按 OA 当前部门重绑,离职人员直接删除。是否继续?',
|
||||
'增量同步',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
@@ -712,6 +736,8 @@ export default {
|
||||
total: 0,
|
||||
synced: 0,
|
||||
skipped: 0,
|
||||
removed: 0,
|
||||
dumpFilePath: '',
|
||||
};
|
||||
this.runOaSyncPages();
|
||||
},
|
||||
@@ -746,6 +772,10 @@ export default {
|
||||
this.oaSyncProgress.total = page.total || 0;
|
||||
this.oaSyncProgress.synced += page.syncedCount || 0;
|
||||
this.oaSyncProgress.skipped += page.skippedCount || 0;
|
||||
this.oaSyncProgress.removed += page.removedCount || 0;
|
||||
if (page.dumpFilePath) {
|
||||
this.oaSyncProgress.dumpFilePath = page.dumpFilePath;
|
||||
}
|
||||
if (page.finished) {
|
||||
this.oaSyncStatus = 'done';
|
||||
break;
|
||||
@@ -1066,6 +1096,9 @@ export default {
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.treeDeptId = '';
|
||||
this.$nextTick(() => {
|
||||
this.$refs.deptTree?.setCurrentKey?.(null);
|
||||
});
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange(params, done) {
|
||||
@@ -1470,6 +1503,10 @@ export default {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.oa-sync-stat__value--remove {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.user-edit-dialog .el-form-item {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ import { exportBlob } from '@/api/common';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import { applyIncomingSearch, normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { excelOption, exportColumns, option } from '@/option/vehicle/accident-record';
|
||||
@@ -550,7 +550,7 @@ export default {
|
||||
};
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
return normalizeSearchRangeParams({ ...params, ...this.query }, createTimeRangeMap);
|
||||
return normalizeSearchRangeParams(applyIncomingSearch(this.query, params), createTimeRangeMap);
|
||||
},
|
||||
handleTemplate() {
|
||||
exportBlob(
|
||||
|
||||
@@ -468,7 +468,11 @@ import {
|
||||
publish,
|
||||
changeStatus,
|
||||
} from '@/api/vehicle/credit-score-quantification';
|
||||
import { normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import {
|
||||
applyIncomingSearch,
|
||||
normalizeSearchRangeParams,
|
||||
omitInvalidListStatus,
|
||||
} from '@/utils/search-range';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { isAdministrator } from '@/utils/auth';
|
||||
|
||||
@@ -1324,7 +1328,9 @@ export default {
|
||||
});
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
return normalizeSearchRangeParams({ ...params, ...this.query }, createTimeRangeMap);
|
||||
return omitInvalidListStatus(
|
||||
normalizeSearchRangeParams(applyIncomingSearch(this.query, params), createTimeRangeMap)
|
||||
);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
v-if="
|
||||
hasPermission('customer_archive_sync') &&
|
||||
row.approvalStatus === 'approved' &&
|
||||
row.kingdeeStatus === 'failed'
|
||||
!['synced', 'exist'].includes(row.kingdeeStatus)
|
||||
"
|
||||
@click="handleSyncKingdee(row)"
|
||||
>
|
||||
@@ -521,7 +521,7 @@
|
||||
:options="deptTree"
|
||||
:props="deptCascaderProps"
|
||||
disabled
|
||||
placeholder="桂物物流集团"
|
||||
placeholder="广西现代物流集团有限公司"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -1624,7 +1624,7 @@ const customerArchiveListRoute = '/vehicle/customer-archive';
|
||||
const customerArchiveFormRoute = '/vehicle/customer-archive/form';
|
||||
const customerArchiveListRefreshKey = 'customer-archive-list-refresh';
|
||||
/** 客商所属组织固定为顶层组织 */
|
||||
const FIXED_OWNER_DEPT_NAME = '桂物物流集团';
|
||||
const FIXED_OWNER_DEPT_NAME = '广西现代物流集团有限公司';
|
||||
|
||||
const createTimeRangeMap = {
|
||||
createTimeRange: ['createTimeStart', 'createTimeEnd'],
|
||||
@@ -1830,6 +1830,8 @@ export default {
|
||||
},
|
||||
/** 业务字典 mk_template「开启MK」=1 */
|
||||
mkEnabled: false,
|
||||
/** 是否已完成 MK 开关加载,避免提交时误判 */
|
||||
_mkEnabledResolved: false,
|
||||
formRules: {
|
||||
customerCode: [{ max: 20, message: '客商编号最多20个字符', trigger: 'blur' }],
|
||||
fullName: [{ required: true, message: '请输入客商名称', trigger: 'blur' }],
|
||||
@@ -1910,7 +1912,7 @@ export default {
|
||||
editBtn: false,
|
||||
selection: true,
|
||||
dialogClickModal: false,
|
||||
menuWidth: 320,
|
||||
menuWidth: 400,
|
||||
column: [
|
||||
{
|
||||
label: '客商编号',
|
||||
@@ -2086,7 +2088,6 @@ export default {
|
||||
search: true,
|
||||
searchOrder: 6,
|
||||
searchValue: '',
|
||||
dataType: 'number',
|
||||
minWidth: 100,
|
||||
dicData: [
|
||||
{ label: '全部', value: '' },
|
||||
@@ -2385,7 +2386,13 @@ export default {
|
||||
sessionStorage.setItem(customerArchiveListRefreshKey, '1');
|
||||
},
|
||||
hasPermission(code) {
|
||||
return this.isAdmin || this.validData(this.permission[code], false);
|
||||
if (this.isAdmin) {
|
||||
return true;
|
||||
}
|
||||
const permission = this.permission || {};
|
||||
const value = permission[code];
|
||||
// 不依赖 Avue validData,避免权限值为 true 以外的真值时被误判
|
||||
return value === true || value === 'true' || value === 1 || value === '1';
|
||||
},
|
||||
mergeSelectOptions(target, values) {
|
||||
const list = Array.isArray(values) ? values : values ? [values] : [];
|
||||
@@ -3146,12 +3153,15 @@ export default {
|
||||
});
|
||||
},
|
||||
initMkEnabled() {
|
||||
this._mkEnabledResolved = false;
|
||||
loadMkEnabled()
|
||||
.then(enabled => {
|
||||
this.mkEnabled = !!enabled;
|
||||
this._mkEnabledResolved = true;
|
||||
})
|
||||
.catch(() => {
|
||||
this.mkEnabled = false;
|
||||
this._mkEnabledResolved = true;
|
||||
});
|
||||
},
|
||||
initScoreQuantificationOptions() {
|
||||
@@ -3251,7 +3261,7 @@ export default {
|
||||
);
|
||||
},
|
||||
/**
|
||||
* 客商所属组织固定为顶层「桂物物流集团」,表单不可编辑。
|
||||
* 客商所属组织固定为顶层「广西现代物流集团有限公司」,表单不可编辑。
|
||||
*/
|
||||
applyFixedOwnerDept() {
|
||||
if (!this.isArchivePage || this.readonly) {
|
||||
@@ -4530,15 +4540,34 @@ export default {
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 列表 / 新增 / 编辑提交共用:开启 MK 时提交审核流,并更新客商审批状态
|
||||
* 列表 / 新增 / 编辑提交共用:
|
||||
* 未开启 MK 时仅走本地提交审批(与新增一致,不请求 MK 流程);
|
||||
* 开启 MK 时先提交审核流,再更新客商审批状态。
|
||||
*/
|
||||
submitCustomerApproval(id, fullName = '', approvalStatus = '') {
|
||||
return submitMkApprovalFlow({
|
||||
bizType: 'customer-archive',
|
||||
bizId: id,
|
||||
subjectName: fullName,
|
||||
approvalStatus,
|
||||
}).then(() => submitApproval(id));
|
||||
const submitLocal = () => submitApproval(id);
|
||||
const run = enabled => {
|
||||
this.mkEnabled = !!enabled;
|
||||
this._mkEnabledResolved = true;
|
||||
if (!this.mkEnabled) {
|
||||
return submitLocal();
|
||||
}
|
||||
return submitMkApprovalFlow({
|
||||
bizType: 'customer-archive',
|
||||
bizId: id,
|
||||
subjectName: fullName,
|
||||
approvalStatus,
|
||||
mkEnabled: true,
|
||||
}).then(submitLocal);
|
||||
};
|
||||
|
||||
// 与列表按钮一致:以页面 mkEnabled 为准,未开启时不请求 MK
|
||||
if (this._mkEnabledResolved) {
|
||||
return run(this.mkEnabled);
|
||||
}
|
||||
return loadMkEnabled()
|
||||
.then(enabled => run(enabled))
|
||||
.catch(() => run(false));
|
||||
},
|
||||
openReviewScore() {
|
||||
const scores = this.archiveForm.scores || [];
|
||||
@@ -5316,19 +5345,9 @@ export default {
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange(params, done) {
|
||||
// 搜索区所属组织级联返回的是 ID 路径数组,取末级 ID 转成部门名称传给后端(与列表接口 deptName 字段一致)
|
||||
if (Array.isArray(params.deptName)) {
|
||||
const path = params.deptName.filter(
|
||||
item => item !== undefined && item !== null && item !== ''
|
||||
);
|
||||
const deptId = path.length ? path[path.length - 1] : '';
|
||||
params.deptName = deptId
|
||||
? this.deptOptions.find(item => String(item.value) === String(deptId))?.rawLabel || ''
|
||||
: '';
|
||||
}
|
||||
this.query = this.buildQuery(params);
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page);
|
||||
this.onLoad(this.page, this.query);
|
||||
done();
|
||||
},
|
||||
selectionChange(list) {
|
||||
@@ -5429,7 +5448,38 @@ export default {
|
||||
};
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
return normalizeSearchRangeParams({ ...params, ...this.query }, createTimeRangeMap);
|
||||
// 新条件覆盖旧条件;本次显式清空的字段必须从查询里去掉,避免第二次搜索仍带着上一次的客商名称。
|
||||
const merged = { ...this.query, ...params };
|
||||
Object.keys(params).forEach(key => {
|
||||
const value = params[key];
|
||||
if (
|
||||
value === '' ||
|
||||
value === null ||
|
||||
value === undefined ||
|
||||
(Array.isArray(value) && value.length === 0)
|
||||
) {
|
||||
delete merged[key];
|
||||
}
|
||||
});
|
||||
if (Array.isArray(merged.deptName)) {
|
||||
const path = merged.deptName.filter(
|
||||
item => item !== undefined && item !== null && item !== ''
|
||||
);
|
||||
const deptId = path.length ? path[path.length - 1] : '';
|
||||
merged.deptName = deptId
|
||||
? this.deptOptions.find(item => String(item.value) === String(deptId))?.rawLabel || ''
|
||||
: '';
|
||||
if (!merged.deptName) {
|
||||
delete merged.deptName;
|
||||
}
|
||||
}
|
||||
const values = normalizeSearchRangeParams(merged, createTimeRangeMap);
|
||||
// 状态下拉「全部」会被数字类型转成 0/-1,二次搜索会把列表滤空。
|
||||
const status = values.status;
|
||||
if (status === 0 || status === '0' || status === -1 || status === '-1') {
|
||||
delete values.status;
|
||||
}
|
||||
return values;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -220,7 +220,7 @@ import { downloadXls } from '@/utils/util';
|
||||
import { handleImportExcel } from '@/utils/import-excel';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { getUploadHeaders } from '@/utils/upload';
|
||||
import { normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import { applyIncomingSearch, normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { ElLoading } from 'element-plus';
|
||||
import { excelOption, exportColumns, option } from '@/option/vehicle/insurance-record';
|
||||
@@ -409,7 +409,7 @@ export default {
|
||||
: integerPart;
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
return normalizeSearchRangeParams({ ...params, ...this.query }, createTimeRangeMap);
|
||||
return normalizeSearchRangeParams(applyIncomingSearch(this.query, params), createTimeRangeMap);
|
||||
},
|
||||
validateRow(row) {
|
||||
if (row.startDate && row.endDate && row.endDate < row.startDate) {
|
||||
|
||||
@@ -195,7 +195,7 @@ import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { formatUpdateUserName } from '@/utils/audit';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import { applyIncomingSearch, normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import AddressMapPicker from '@/components/address-map-picker/main.vue';
|
||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
@@ -903,7 +903,7 @@ export default {
|
||||
};
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
return normalizeSearchRangeParams({ ...params, ...this.query }, createTimeRangeMap);
|
||||
return normalizeSearchRangeParams(applyIncomingSearch(this.query, params), createTimeRangeMap);
|
||||
},
|
||||
handleTemplate() {
|
||||
exportBlob(
|
||||
|
||||
@@ -168,7 +168,7 @@ import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { formatUpdateUserName } from '@/utils/audit';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import { applyIncomingSearch, normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import AddressMapPicker from '@/components/address-map-picker/main.vue';
|
||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
@@ -371,9 +371,8 @@ export default {
|
||||
placeholder: '日期时间选择器',
|
||||
},
|
||||
{
|
||||
label: '里程/航程数(公里)',
|
||||
label: '里程/航程数',
|
||||
prop: 'mileage',
|
||||
renderHeader: () => '里程/航程数',
|
||||
type: 'input',
|
||||
minWidth: 130,
|
||||
slot: true,
|
||||
@@ -391,6 +390,7 @@ export default {
|
||||
],
|
||||
value: '公里',
|
||||
hide: true,
|
||||
display: false,
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
@@ -565,12 +565,10 @@ export default {
|
||||
const mileageUnit = vehicleType === '船舶' ? '海里' : '公里';
|
||||
const vehicleTypeColumn = this.findColumn(this.option.column, 'vehicleType');
|
||||
const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo');
|
||||
const mileageColumn = this.findColumn(this.option.column, 'mileage');
|
||||
const mileageUnitColumn = this.findColumn(this.option.column, 'mileageUnit');
|
||||
vehicleNoColumn.placeholder =
|
||||
vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
|
||||
vehicleTypeColumn.disabled = Boolean(this.form.id);
|
||||
mileageColumn.label = `里程/航程数(${mileageUnit})`;
|
||||
mileageUnitColumn.value = mileageUnit;
|
||||
this.form.mileageUnit = mileageUnit;
|
||||
if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) {
|
||||
@@ -833,7 +831,7 @@ export default {
|
||||
};
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
return normalizeSearchRangeParams({ ...params, ...this.query }, createTimeRangeMap);
|
||||
return normalizeSearchRangeParams(applyIncomingSearch(this.query, params), createTimeRangeMap);
|
||||
},
|
||||
handleTemplate() {
|
||||
exportBlob(
|
||||
|
||||
@@ -210,7 +210,7 @@ import { exportBlob } from '@/api/common';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import { applyIncomingSearch, normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { excelOption, exportColumns, option } from '@/option/vehicle/mileage-record';
|
||||
@@ -607,7 +607,7 @@ export default {
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
return normalizeSearchRangeParams(
|
||||
{ ...params, ...this.query, vehicleType: '车辆' },
|
||||
{ ...applyIncomingSearch(this.query, params), vehicleType: '车辆' },
|
||||
createTimeRangeMap
|
||||
);
|
||||
},
|
||||
|
||||
@@ -155,7 +155,7 @@ import { exportBlob } from '@/api/common';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import { applyIncomingSearch, normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { excelOption, exportColumns, option } from '@/option/vehicle/tire-replacement-record';
|
||||
@@ -500,7 +500,7 @@ export default {
|
||||
};
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
return normalizeSearchRangeParams({ ...params, ...this.query }, createTimeRangeMap);
|
||||
return normalizeSearchRangeParams(applyIncomingSearch(this.query, params), createTimeRangeMap);
|
||||
},
|
||||
handleTemplate() {
|
||||
exportBlob(
|
||||
|
||||
@@ -130,7 +130,7 @@ import { exportBlob } from '@/api/common';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import { applyIncomingSearch, normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { excelOption, exportColumns, option } from '@/option/vehicle/transport-change-record';
|
||||
@@ -478,7 +478,7 @@ export default {
|
||||
};
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
return normalizeSearchRangeParams({ ...params, ...this.query }, createTimeRangeMap);
|
||||
return normalizeSearchRangeParams(applyIncomingSearch(this.query, params), createTimeRangeMap);
|
||||
},
|
||||
handleTemplate() {
|
||||
exportBlob(
|
||||
|
||||
@@ -197,7 +197,7 @@ import { exportBlob } from '@/api/common';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import { applyIncomingSearch, normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import AddressMapPicker from '@/components/address-map-picker/main.vue';
|
||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
@@ -673,7 +673,7 @@ export default {
|
||||
};
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
return normalizeSearchRangeParams({ ...params, ...this.query }, createTimeRangeMap);
|
||||
return normalizeSearchRangeParams(applyIncomingSearch(this.query, params), createTimeRangeMap);
|
||||
},
|
||||
handleTemplate() {
|
||||
exportBlob(
|
||||
|
||||
@@ -42,5 +42,5 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../dashboard.scss';
|
||||
@use '../dashboard.scss';
|
||||
</style>
|
||||
|
||||
@@ -156,7 +156,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../dashboard.scss';
|
||||
@use '../dashboard.scss';
|
||||
|
||||
.business-panel {
|
||||
margin-bottom: 16px;
|
||||
|
||||
@@ -60,7 +60,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../dashboard.scss';
|
||||
@use '../dashboard.scss';
|
||||
|
||||
.finance-panel {
|
||||
margin-bottom: 16px;
|
||||
|
||||
@@ -67,7 +67,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../dashboard.scss';
|
||||
@use '../dashboard.scss';
|
||||
|
||||
.fleet-panel {
|
||||
margin-bottom: 16px;
|
||||
|
||||
@@ -92,7 +92,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../dashboard.scss';
|
||||
@use '../dashboard.scss';
|
||||
|
||||
.kpi-card {
|
||||
background: #ffffff;
|
||||
|
||||
@@ -62,7 +62,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../dashboard.scss';
|
||||
@use '../dashboard.scss';
|
||||
|
||||
.project-panel {
|
||||
margin-bottom: 16px;
|
||||
|
||||
@@ -102,7 +102,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../dashboard.scss';
|
||||
@use '../dashboard.scss';
|
||||
|
||||
.structure-cards__item {
|
||||
margin-bottom: 16px;
|
||||
|
||||
@@ -59,7 +59,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../dashboard.scss';
|
||||
@use '../dashboard.scss';
|
||||
|
||||
.summary-panel {
|
||||
margin-bottom: 16px;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user