feat(assets): refine inventory presentation and abnormal vehicle details
This commit is contained in:
@@ -27,3 +27,11 @@ test('completed movement retains its actual time and missing records stay distin
|
||||
assert.equal(completed.abnormalMove?.work, null);
|
||||
assert.equal(transformRow(row).abnormalMove, null);
|
||||
});
|
||||
|
||||
|
||||
test('applicant comes from the movement creator name and never falls back to contract manager', () => {
|
||||
const base = { ...row, abnormal_move_id: 'move-1' };
|
||||
assert.equal(transformRow({ ...base, abnormal_move_applicant: ' 测试申请人 ' }).abnormalMove?.applicant, '测试申请人');
|
||||
assert.equal(transformRow({ ...base, abnormal_move_applicant: ' ' }).abnormalMove?.applicant, null);
|
||||
assert.equal(transformRow(base).abnormalMove?.applicant, null);
|
||||
});
|
||||
|
||||
@@ -221,6 +221,7 @@ export function transformRow(row: VehicleRow): Vehicle {
|
||||
type: ({ 1: '维修', 2: '保养', 3: '年审', 4: '其他' } as Record<number, string>)[Number(row.abnormal_move_type)] || '未提供',
|
||||
status: Number(row.abnormal_move_status) === 5 ? '已完成' : '待结束',
|
||||
work: row.abnormal_move_work?.trim() || null,
|
||||
applicant: row.abnormal_move_applicant?.trim() || null,
|
||||
targetCompletionTime: row.abnormal_move_target_time || null,
|
||||
actualCompletionTime: row.abnormal_move_actual_time || null,
|
||||
// The source has no confirmed department, assignee or operating-driver fields.
|
||||
|
||||
@@ -39,6 +39,7 @@ export const MAIN_SQL = `SELECT
|
||||
CAST(vi.id AS CHAR) AS id,
|
||||
CAST(am.id AS CHAR) AS abnormal_move_id,
|
||||
am.move_type AS abnormal_move_type,
|
||||
NULLIF(TRIM(am_applicant.nick_name), '') AS abnormal_move_applicant,
|
||||
CAST(pdv.id AS CHAR) AS pending_delivery_id,
|
||||
pdts.contract_code AS pending_contract_no,
|
||||
pdts.customer_name AS pending_customer_name,
|
||||
@@ -147,6 +148,7 @@ LEFT JOIN vehicle_abnormal_move_record amr ON amr.id = (
|
||||
LIMIT 1
|
||||
)
|
||||
LEFT JOIN vehicle_abnormal_move am ON am.id = amr.move_id
|
||||
LEFT JOIN \`ry-cloud\`.sys_user am_applicant ON am_applicant.user_id = am.create_by
|
||||
${LATEST_VEHICLE_LEASE_JOIN_SQL}
|
||||
WHERE vi.del_flag = '0'
|
||||
AND COALESCE(vs.operation_status, '') <> '5'`;
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface VehicleRow {
|
||||
abnormal_move_type?: number | null;
|
||||
abnormal_move_status?: number | null;
|
||||
abnormal_move_work?: string | null;
|
||||
abnormal_move_applicant?: string | null;
|
||||
abnormal_move_target_time?: string | null;
|
||||
abnormal_move_actual_time?: string | null;
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user