调整 合同、运力、基础配置、客商

This commit is contained in:
2026-09-14 23:43:20 +08:00
parent f1e2313e4c
commit 79aa4f9fae
33 changed files with 1490 additions and 395 deletions
@@ -47,3 +47,11 @@ export const update = row => {
data: row, data: row,
}); });
}; };
export const getExpiryStat = params => {
return request({
url: '/blade-transport/annual-inspection-record/expiry-stat',
method: 'get',
params,
});
};
+14 -8
View File
@@ -19,6 +19,12 @@ const transportTypeDict = {
const isEmpty = value => value === undefined || value === null || value === ''; const isEmpty = value => value === undefined || value === null || value === '';
const normalizeNumericDisplayValue = value => (Number(value) === -1 ? '' : value); const normalizeNumericDisplayValue = value => (Number(value) === -1 ? '' : value);
const formatMoneyDisplay = value => {
if (isEmpty(value) || Number(value) === -1) return '';
const number = Number(value);
if (!Number.isFinite(number)) return '';
return number.toFixed(2);
};
const parseJsonArray = value => { const parseJsonArray = value => {
if (Array.isArray(value)) return value; if (Array.isArray(value)) return value;
@@ -342,10 +348,10 @@ const formatUnitPrice = row => {
return billingUnit ? `${billingPrice}(${billingUnit})` : billingPrice; return billingUnit ? `${billingPrice}(${billingUnit})` : billingPrice;
}; };
const formatAmount = (row, props) => getFirstValue(row, props); const formatAmount = (row, props) => formatMoneyDisplay(getFirstValue(row, props));
const sumAmount = list => const sumAmount = (rows = []) =>
list.reduce((sum, item) => { rows.reduce((sum, item) => {
const value = getFirstValue(item, ['freightAmount', 'amount', 'totalAmount']); const value = getFirstValue(item, ['freightAmount', 'amount', 'totalAmount']);
return isEmpty(value) ? sum : sum + Number(value || 0); return isEmpty(value) ? sum : sum + Number(value || 0);
}, 0); }, 0);
@@ -364,7 +370,7 @@ const calculateFreightTotal = rows => {
return sum + Number(item.unitPrice || 0) * Number(item.quantity || 0); return sum + Number(item.unitPrice || 0) * Number(item.quantity || 0);
}, 0); }, 0);
if (!hasAmountField) return ''; if (!hasAmountField) return '';
return Number.isFinite(total) ? Number(total.toFixed(2)).toString() : ''; return Number.isFinite(total) ? total.toFixed(2) : '';
}; };
const formatFreight = row => { const formatFreight = row => {
@@ -372,9 +378,9 @@ const formatFreight = row => {
if (!isEmpty(value)) return value; if (!isEmpty(value)) return value;
const freight = parseJsonObject(row.freightJson); const freight = parseJsonObject(row.freightJson);
const freightValue = getFirstValue(freight, ['freightAmount', 'transportFee']); const freightValue = getFirstValue(freight, ['freightAmount', 'transportFee']);
if (!isEmpty(freightValue)) return freightValue; if (!isEmpty(freightValue)) return formatMoneyDisplay(freightValue);
const total = sumAmount(Array.isArray(freight.freightItems) ? freight.freightItems : []); const total = sumAmount(Array.isArray(freight.freightItems) ? freight.freightItems : []);
return total ? total : ''; return total ? formatMoneyDisplay(total) : '';
}; };
const formatOtherFeeTotal = row => { const formatOtherFeeTotal = row => {
@@ -391,10 +397,10 @@ const formatFreightTotal = row => {
const otherFeeTotal = !isEmpty(otherFee) ? otherFee : formatOtherFeeTotal(row); const otherFeeTotal = !isEmpty(otherFee) ? otherFee : formatOtherFeeTotal(row);
if (!isEmpty(calculated)) { if (!isEmpty(calculated)) {
const total = Number(calculated || 0) + Number(otherFeeTotal || 0); const total = Number(calculated || 0) + Number(otherFeeTotal || 0);
return Number.isFinite(total) ? Number(total.toFixed(2)).toString() : calculated; return Number.isFinite(total) ? total.toFixed(2) : calculated;
} }
const value = getFirstValue(freight, ['totalFreightAmount', 'totalFreight', 'totalAmount']); const value = getFirstValue(freight, ['totalFreightAmount', 'totalFreight', 'totalAmount']);
if (!isEmpty(value)) return value; if (!isEmpty(value)) return formatMoneyDisplay(value);
return formatAmount(row, ['freightTotal', 'totalFreight', 'totalAmount']); return formatAmount(row, ['freightTotal', 'totalFreight', 'totalAmount']);
}; };
+4 -2
View File
@@ -70,14 +70,16 @@ export const option = {
{ {
label: '车牌号/船号', label: '车牌号/船号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
minWidth: 140, minWidth: 140,
span: 12, span: 12,
placeholder: '输入车牌号/船号查询选择', placeholder: '请选择车牌号/船号',
rules: [ rules: [
{ required: true, message: '请输入车牌号/船号', trigger: 'blur' }, { required: true, message: '请选择车牌号/船号', trigger: 'change' },
{ max: 30, message: '最多 30 个字符', trigger: 'blur' }, { max: 30, message: '最多 30 个字符', trigger: 'blur' },
], ],
}, },
+8 -16
View File
@@ -75,14 +75,16 @@ export const option = {
{ {
label: '车牌号/船号', label: '车牌号/船号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
minWidth: 140, minWidth: 140,
span: 12, span: 12,
placeholder: '输入车牌号/船号查询选择', placeholder: '请选择车牌号/船号',
rules: [ rules: [
{ required: true, message: '请输入车牌号/船号', trigger: 'blur' }, { required: true, message: '请选择车牌号/船号', trigger: 'change' },
{ max: 30, message: '最多 30 个字符', trigger: 'blur' }, { max: 30, message: '最多 30 个字符', trigger: 'blur' },
], ],
}, },
@@ -105,6 +107,7 @@ export const option = {
type: 'date', type: 'date',
format: 'YYYY-MM-DD', format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
slot: true,
minWidth: 140, minWidth: 140,
span: 12, span: 12,
placeholder: '请输入', placeholder: '请输入',
@@ -191,23 +194,12 @@ export const option = {
formslot: true, formslot: true,
}, },
{ {
label: '检测评定开始日期', label: '检测评定日期',
prop: 'inspectionAssessmentDateStart', prop: 'inspectionAssessmentDateRange',
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
search: true,
hide: true,
addDisplay: false,
editDisplay: false,
viewDisplay: false,
},
{
label: '检测评定结束日期',
prop: 'inspectionAssessmentDateEnd',
type: 'date', type: 'date',
format: 'YYYY-MM-DD', format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
searchRange: true,
search: true, search: true,
hide: true, hide: true,
addDisplay: false, addDisplay: false,
+2
View File
@@ -54,9 +54,11 @@ export const option = {
{ {
label: '车牌号/船号', label: '车牌号/船号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
searchOrder: 4, searchOrder: 4,
span: 12, span: 12,
order: 10, order: 10,
+4 -2
View File
@@ -49,14 +49,16 @@ export const option = {
{ {
label: '车牌号', label: '车牌号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
minWidth: 140, minWidth: 140,
span: 12, span: 12,
placeholder: '输入车牌号模糊查询选择', placeholder: '请选择车牌号',
rules: [ rules: [
{ required: true, message: '请输入车牌号', trigger: 'blur' }, { required: true, message: '请选择车牌号', trigger: 'change' },
{ max: 30, message: '最多 30 个字符', trigger: 'blur' }, { max: 30, message: '最多 30 个字符', trigger: 'blur' },
], ],
}, },
+5 -1
View File
@@ -78,17 +78,20 @@ export const option = {
prop: 'policyFile', prop: 'policyFile',
formslot: true, formslot: true,
hide: true, hide: true,
viewDisplay: false,
span: 24, span: 24,
}, },
{ {
label: '车牌号/船号', label: '车牌号/船号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
minWidth: 140, minWidth: 140,
rules: [ rules: [
{ required: true, message: '请输入车牌号/船号', trigger: 'blur' }, { required: true, message: '请选择车牌号/船号', trigger: 'change' },
{ max: 50, message: '最多 50 个字符', trigger: 'blur' }, { max: 50, message: '最多 50 个字符', trigger: 'blur' },
], ],
}, },
@@ -108,6 +111,7 @@ export const option = {
rules: [ rules: [
{ required: true, message: '请输入保单号', trigger: 'blur' }, { required: true, message: '请输入保单号', trigger: 'blur' },
{ max: 80, message: '最多 80 个字符', trigger: 'blur' }, { max: 80, message: '最多 80 个字符', trigger: 'blur' },
{ pattern: /^[a-zA-Z0-9]+$/, message: '保单号只能输入数字、字母', trigger: 'blur' },
], ],
}, },
{ {
+3 -1
View File
@@ -40,13 +40,15 @@ export const option = {
{ {
label: '车牌号', label: '车牌号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
searchSpan: 6, searchSpan: 6,
minWidth: 130, minWidth: 130,
rules: [ rules: [
{ required: true, message: '请输入车牌号', trigger: 'blur' }, { required: true, message: '请选择车牌号', trigger: 'change' },
{ max: 30, message: '最多 30 个字符', trigger: 'blur' }, { max: 30, message: '最多 30 个字符', trigger: 'blur' },
], ],
}, },
+4 -2
View File
@@ -92,13 +92,15 @@ export const option = {
{ {
label: '车牌号/船号', label: '车牌号/船号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
minWidth: 150, minWidth: 150,
placeholder: '输入车牌号/船号查询选择', placeholder: '请选择车牌号/船号',
rules: [ rules: [
{ required: true, message: '请输入车牌号/船号', trigger: 'blur' }, { required: true, message: '请选择车牌号/船号', trigger: 'change' },
{ max: 30, message: '最多 30 个字符', trigger: 'blur' }, { max: 30, message: '最多 30 个字符', trigger: 'blur' },
], ],
}, },
+5 -13
View File
@@ -17,16 +17,6 @@ export const vehicleTypeDic = [
{ label: '船舶', value: '船舶' }, { label: '船舶', value: '船舶' },
]; ];
export const expenseTypeDic = [
{ label: '过路费', value: '过路费' },
{ label: '停车费', value: '停车费' },
{ label: '维修费', value: '维修费' },
{ label: '保险费', value: '保险费' },
{ label: '年检费', value: '年检费' },
{ label: '装卸费', value: '装卸费' },
{ label: '其他', value: '其他' },
];
export const option = { export const option = {
height: 'auto', height: 'auto',
calcHeight: 32, calcHeight: 32,
@@ -68,14 +58,16 @@ export const option = {
{ {
label: '车牌号/船号', label: '车牌号/船号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
minWidth: 150, minWidth: 150,
span: 12, span: 12,
placeholder: '输入车牌号/船号查询选择', placeholder: '请选择车牌号/船号',
rules: [ rules: [
{ required: true, message: '请输入车牌号/船号', trigger: 'blur' }, { required: true, message: '请选择车牌号/船号', trigger: 'change' },
{ max: 30, message: '最多 30 个字符', trigger: 'blur' }, { max: 30, message: '最多 30 个字符', trigger: 'blur' },
], ],
}, },
@@ -95,7 +87,7 @@ export const option = {
label: '费用类型', label: '费用类型',
prop: 'expenseType', prop: 'expenseType',
type: 'select', type: 'select',
dicData: expenseTypeDic, dicData: [],
search: true, search: true,
minWidth: 150, minWidth: 150,
span: 12, span: 12,
@@ -49,14 +49,16 @@ export const option = {
{ {
label: '车牌号', label: '车牌号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
minWidth: 130, minWidth: 130,
span: 12, span: 12,
placeholder: '输入车牌号查询选择', placeholder: '请选择车牌号',
rules: [ rules: [
{ required: true, message: '请输入车牌号', trigger: 'blur' }, { required: true, message: '请选择车牌号', trigger: 'change' },
{ max: 30, message: '最多 30 个字符', trigger: 'blur' }, { max: 30, message: '最多 30 个字符', trigger: 'blur' },
], ],
}, },
@@ -47,11 +47,13 @@ export const option = {
{ {
label: '车牌号/船号', label: '车牌号/船号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
minWidth: 140, minWidth: 140,
placeholder: '输入车牌号/船号模糊查询选择', placeholder: '请选择车牌号/船号',
rules: [{ max: 30, message: '最多 30 个字符', trigger: 'blur' }], rules: [{ max: 30, message: '最多 30 个字符', trigger: 'blur' }],
}, },
{ {
+8 -6
View File
@@ -70,14 +70,16 @@ export const option = {
{ {
label: '车牌号/船号', label: '车牌号/船号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
minWidth: 140, minWidth: 140,
span: 12, span: 12,
placeholder: '输入车牌号/船号查询选择', placeholder: '请选择车牌号/船号',
rules: [ rules: [
{ required: true, message: '请输入车牌号/船号', trigger: 'blur' }, { required: true, message: '请选择车牌号/船号', trigger: 'change' },
{ max: 30, message: '最多 30 个字符', trigger: 'blur' }, { max: 30, message: '最多 30 个字符', trigger: 'blur' },
], ],
}, },
@@ -117,13 +119,13 @@ export const option = {
{ {
label: '日期', label: '日期',
prop: 'violationTime', prop: 'violationTime',
type: 'datetime', type: 'date',
format: 'YYYY-MM-DD HH:mm:ss', format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss',
minWidth: 170, minWidth: 140,
span: 12, span: 12,
placeholder: '请选择', placeholder: '请选择',
rules: [{ required: true, message: '请选择时间', trigger: 'click' }], rules: [{ required: true, message: '请选择日期', trigger: 'click' }],
}, },
{ {
label: '地点', label: '地点',
+30 -5
View File
@@ -20,6 +20,16 @@
批量删除 批量删除
</el-button> </el-button>
<div class="insurance-ocr-template-page__search"> <div class="insurance-ocr-template-page__search">
<el-select
v-model="query.vehicleType"
clearable
placeholder="车船类型"
style="width: 140px"
@change="search"
>
<el-option label="车辆" value="车辆" />
<el-option label="船舶" value="船舶" />
</el-select>
<el-input <el-input
v-model="query.name" v-model="query.name"
clearable clearable
@@ -42,6 +52,7 @@
<el-table-column type="selection" width="48" /> <el-table-column type="selection" width="48" />
<el-table-column type="index" label="序号" width="70" align="center" /> <el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column prop="name" label="模板名称" min-width="220" show-overflow-tooltip /> <el-table-column prop="name" label="模板名称" min-width="220" show-overflow-tooltip />
<el-table-column prop="vehicleType" label="车船类型" min-width="110" />
<el-table-column label="已配置字段" min-width="150"> <el-table-column label="已配置字段" min-width="150">
<template #default="{ row }">{{ getMappingCount(row.mappingConfig) }}</template> <template #default="{ row }">{{ getMappingCount(row.mappingConfig) }}</template>
</el-table-column> </el-table-column>
@@ -94,6 +105,12 @@
<el-form-item label="模板名称" prop="name"> <el-form-item label="模板名称" prop="name">
<el-input v-model="form.name" maxlength="100" show-word-limit /> <el-input v-model="form.name" maxlength="100" show-word-limit />
</el-form-item> </el-form-item>
<el-form-item label="车船类型" prop="vehicleType">
<el-radio-group v-model="form.vehicleType">
<el-radio label="车辆">车辆</el-radio>
<el-radio label="船舶">船舶</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="字段映射" required> <el-form-item label="字段映射" required>
<el-table :data="mappingRows" border class="insurance-ocr-template-page__mapping-table"> <el-table :data="mappingRows" border class="insurance-ocr-template-page__mapping-table">
<el-table-column prop="key" label="键名" width="180" align="center" /> <el-table-column prop="key" label="键名" width="180" align="center" />
@@ -165,8 +182,8 @@ export default {
readonly: false, readonly: false,
data: [], data: [],
selectionList: [], selectionList: [],
query: { name: '' }, query: { name: '', vehicleType: '' },
form: { id: '', name: '' }, form: { id: '', name: '', vehicleType: '车辆' },
mappingRows: createMappingRows(), mappingRows: createMappingRows(),
page: { page: {
pageSize: 10, pageSize: 10,
@@ -176,6 +193,7 @@ export default {
}, },
rules: { rules: {
name: [{ required: true, message: '请输入模板名称', trigger: 'blur' }], name: [{ required: true, message: '请输入模板名称', trigger: 'blur' }],
vehicleType: [{ required: true, message: '请选择车船类型', trigger: 'change' }],
}, },
}; };
}, },
@@ -218,6 +236,7 @@ export default {
}, },
resetSearch() { resetSearch() {
this.query.name = ''; this.query.name = '';
this.query.vehicleType = '';
this.search(); this.search();
}, },
currentChange(currentPage) { currentChange(currentPage) {
@@ -235,18 +254,23 @@ export default {
openDialog(row, readonly = false) { openDialog(row, readonly = false) {
this.readonly = readonly; this.readonly = readonly;
if (!row?.id) { if (!row?.id) {
this.form = { id: '', name: '', vehicleType: '车辆' };
this.dialogVisible = true; this.dialogVisible = true;
return; return;
} }
getDetail(row.id).then(res => { getDetail(row.id).then(res => {
const detail = res.data.data || {}; const detail = res.data.data || {};
this.form = { id: detail.id, name: detail.name || '' }; this.form = {
id: detail.id,
name: detail.name || '',
vehicleType: detail.vehicleType || '车辆',
};
this.mappingRows = createMappingRows(detail.mappingConfig); this.mappingRows = createMappingRows(detail.mappingConfig);
this.dialogVisible = true; this.dialogVisible = true;
}); });
}, },
resetForm() { resetForm() {
this.form = { id: '', name: '' }; this.form = { id: '', name: '', vehicleType: '车辆' };
this.mappingRows = createMappingRows(); this.mappingRows = createMappingRows();
this.readonly = false; this.readonly = false;
this.submitLoading = false; this.submitLoading = false;
@@ -264,6 +288,7 @@ export default {
submit({ submit({
id: this.form.id || undefined, id: this.form.id || undefined,
name: String(this.form.name || '').trim(), name: String(this.form.name || '').trim(),
vehicleType: this.form.vehicleType || '车辆',
mappingConfig: JSON.stringify( mappingConfig: JSON.stringify(
this.mappingRows.map(item => ({ key: item.key, value: String(item.value || '').trim() })) this.mappingRows.map(item => ({ key: item.key, value: String(item.value || '').trim() }))
), ),
@@ -311,7 +336,7 @@ export default {
align-items: center; align-items: center;
gap: 8px; gap: 8px;
margin-left: auto; margin-left: auto;
width: 380px; width: 520px;
} }
&__mapping-table { &__mapping-table {
@@ -7179,7 +7179,9 @@ export default {
waybillAmountWithCurrency(row = {}, prop) { waybillAmountWithCurrency(row = {}, prop) {
const value = this.formatDetailValue(row, prop); const value = this.formatDetailValue(row, prop);
if (value === '-') return { value: '-' }; if (value === '-') return { value: '-' };
return { value: `${this.waybillCurrencyRemark(row)}${value}` }; const number = Number(value);
const display = Number.isFinite(number) ? number.toFixed(2) : value;
return { value: `${this.waybillCurrencyRemark(row)}${display}` };
}, },
normalizeTransportPlanWaybillRow(row = {}, index = 0) { normalizeTransportPlanWaybillRow(row = {}, index = 0) {
const status = row.businessStatus || row.status || row.waybillStatus || ''; const status = row.businessStatus || row.status || row.waybillStatus || '';
@@ -4378,7 +4378,9 @@ export default {
waybillAmountWithCurrency(row = {}, prop) { waybillAmountWithCurrency(row = {}, prop) {
const value = this.formatDetailValue(row, prop); const value = this.formatDetailValue(row, prop);
if (value === '-') return { value: '-' }; if (value === '-') return { value: '-' };
return { value: `${this.waybillCurrencyRemark(row)}${value}` }; const number = Number(value);
const display = Number.isFinite(number) ? number.toFixed(2) : value;
return { value: `${this.waybillCurrencyRemark(row)}${display}` };
}, },
openDetail(row) { openDetail(row) {
if (!this.isStandaloneWaybillDetailPage) { if (!this.isStandaloneWaybillDetailPage) {
+7 -3
View File
@@ -1840,10 +1840,14 @@ export default {
submitEdit() { submitEdit() {
if (this.submitAction || !this.validateBase('edit')) return; if (this.submitAction || !this.validateBase('edit')) return;
this.submitAction = 'edit'; this.submitAction = 'edit';
this.api const isChangeRejected = this.form.approvalStatus === 'change_rejected';
.submit(this.normalizeSubmit()) const payload = this.normalizeSubmit();
const request = isChangeRejected
? this.api.submitChange(payload)
: this.api.submit(payload);
request
.then(() => { .then(() => {
this.$message.success('修改成功'); this.$message.success(isChangeRejected ? '已重新提交变更审批' : '修改成功');
this.closeForm(); this.closeForm();
}) })
.finally(() => { .finally(() => {
+10 -2
View File
@@ -953,7 +953,10 @@ export default {
this.receiverInvoiceOptions = Array.isArray(invoiceInfos) ? invoiceInfos : []; this.receiverInvoiceOptions = Array.isArray(invoiceInfos) ? invoiceInfos : [];
this.contactOptions = data.contacts || []; this.contactOptions = data.contacts || [];
const invoiceInfoEmails = [ const invoiceInfoEmails = [
...this.receiverInvoiceOptions.flatMap(item => this.parseEmails(item.email)), ...this.receiverInvoiceOptions.flatMap(item => [
...this.parseEmails(item.email),
...(item.contacts || []).flatMap(contact => this.parseEmails(contact.email)),
]),
]; ];
this.departmentEmailOptions = invoiceInfoEmails.filter(Boolean).reduce((emails, email) => { this.departmentEmailOptions = invoiceInfoEmails.filter(Boolean).reduce((emails, email) => {
if (!emails.some(item => item.toLowerCase() === email.toLowerCase())) emails.push(email); if (!emails.some(item => item.toLowerCase() === email.toLowerCase())) emails.push(email);
@@ -989,14 +992,19 @@ export default {
handleReceiverChange(id) { handleReceiverChange(id) {
const info = this.receiverInvoiceOptions.find(item => String(item.id) === String(id)); const info = this.receiverInvoiceOptions.find(item => String(item.id) === String(id));
if (!info) return; if (!info) return;
const invoiceContact = (info.contacts || []).find(item => item.contactName || item.email) || {};
Object.assign(this.form, { Object.assign(this.form, {
receiverName: info.invoiceTitle, receiverName: info.invoiceTitle,
taxpayerNo: info.taxNo, taxpayerNo: info.taxNo,
bankName: info.bankName, bankName: info.bankName,
bankAccount: info.bankAccount, bankAccount: info.bankAccount,
registeredAddress: info.registeredAddress, registeredAddress: info.registeredAddress,
email: info.email || '', email: invoiceContact.email || '',
}); });
if (invoiceContact.contactName) {
this.form.contactName = invoiceContact.contactName;
this.form.contactPhone = invoiceContact.contactPhone || '';
}
this.handleInvoiceTypeChange(); this.handleInvoiceTypeChange();
}, },
handleContactChange(name) { handleContactChange(name) {
+37 -10
View File
@@ -402,7 +402,7 @@
v-model="vehicleForm.plateNo" v-model="vehicleForm.plateNo"
maxlength="8" maxlength="8"
show-word-limit show-word-limit
placeholder="如:京A12345" placeholder="请输入"
@input="handlePlateNoInput" @input="handlePlateNoInput"
@blur="validatePlateFormat" @blur="validatePlateFormat"
/> />
@@ -415,6 +415,7 @@
filterable filterable
allow-create allow-create
default-first-option default-first-option
placeholder="请选择"
> >
<el-option <el-option
v-for="item in vehicleTypeOptions" v-for="item in vehicleTypeOptions"
@@ -433,6 +434,7 @@
<el-input <el-input
v-model="vehicleForm.outerLength" v-model="vehicleForm.outerLength"
inputmode="numeric" inputmode="numeric"
placeholder="请输入"
@input="vehicleForm.outerLength = digitsOnly($event)" @input="vehicleForm.outerLength = digitsOnly($event)"
/> />
</div> </div>
@@ -441,6 +443,7 @@
<el-input <el-input
v-model="vehicleForm.outerWidth" v-model="vehicleForm.outerWidth"
inputmode="numeric" inputmode="numeric"
placeholder="请输入"
@input="vehicleForm.outerWidth = digitsOnly($event)" @input="vehicleForm.outerWidth = digitsOnly($event)"
/> />
</div> </div>
@@ -449,6 +452,7 @@
<el-input <el-input
v-model="vehicleForm.outerHeight" v-model="vehicleForm.outerHeight"
inputmode="numeric" inputmode="numeric"
placeholder="请输入"
@input="vehicleForm.outerHeight = digitsOnly($event)" @input="vehicleForm.outerHeight = digitsOnly($event)"
/> />
</div> </div>
@@ -479,7 +483,7 @@
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="业务关系" prop="businessRelation"> <el-form-item label="业务关系" prop="businessRelation">
<el-select v-model="vehicleForm.businessRelation"> <el-select v-model="vehicleForm.businessRelation" placeholder="请选择">
<el-option <el-option
v-for="item in businessRelationOptions" v-for="item in businessRelationOptions"
:key="item" :key="item"
@@ -496,6 +500,7 @@
filterable filterable
allow-create allow-create
default-first-option default-first-option
placeholder="请选择"
> >
<el-option <el-option
v-for="item in energyTypeOptions" v-for="item in energyTypeOptions"
@@ -515,6 +520,7 @@
v-model="vehicleForm.compulsoryScrapDate" v-model="vehicleForm.compulsoryScrapDate"
type="date" type="date"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="请选择"
:disabled="vehicleForm.compulsoryScrapLongTerm === 1" :disabled="vehicleForm.compulsoryScrapLongTerm === 1"
/> />
<el-checkbox <el-checkbox
@@ -530,7 +536,11 @@
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="海关备案号" prop="customsRecordNo"> <el-form-item label="海关备案号" prop="customsRecordNo">
<el-input v-model="vehicleForm.customsRecordNo" maxlength="50" /> <el-input
v-model="vehicleForm.customsRecordNo"
maxlength="50"
placeholder="请输入"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@@ -569,6 +579,7 @@
v-model="vehicleForm.drivingLicenseEndDate" v-model="vehicleForm.drivingLicenseEndDate"
type="date" type="date"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="请选择"
:disabled="vehicleForm.drivingLicenseLongTerm === 1" :disabled="vehicleForm.drivingLicenseLongTerm === 1"
/> />
<el-checkbox <el-checkbox
@@ -584,7 +595,11 @@
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="道路运输证号" prop="roadTransportCertNo"> <el-form-item label="道路运输证号" prop="roadTransportCertNo">
<el-input v-model="vehicleForm.roadTransportCertNo" maxlength="50" /> <el-input
v-model="vehicleForm.roadTransportCertNo"
maxlength="50"
placeholder="请输入"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@@ -594,6 +609,7 @@
v-model="vehicleForm.roadTransportCertEndDate" v-model="vehicleForm.roadTransportCertEndDate"
type="date" type="date"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="请选择"
:disabled="vehicleForm.roadTransportCertLongTerm === 1" :disabled="vehicleForm.roadTransportCertLongTerm === 1"
/> />
<el-checkbox <el-checkbox
@@ -614,6 +630,7 @@
v-model="vehicleForm.annualReviewEndDate" v-model="vehicleForm.annualReviewEndDate"
type="date" type="date"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="请选择"
:disabled="vehicleForm.annualReviewLongTerm === 1" :disabled="vehicleForm.annualReviewLongTerm === 1"
/> />
<el-checkbox <el-checkbox
@@ -631,7 +648,11 @@
<el-row :gutter="18"> <el-row :gutter="18">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="机动车登记编号" prop="registrationNo"> <el-form-item label="机动车登记编号" prop="registrationNo">
<el-input v-model="vehicleForm.registrationNo" maxlength="50" /> <el-input
v-model="vehicleForm.registrationNo"
maxlength="50"
placeholder="请输入"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@@ -640,12 +661,17 @@
v-model="vehicleForm.registrationDate" v-model="vehicleForm.registrationDate"
type="date" type="date"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="请选择"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="行驶证档案编号" prop="drivingLicenseNo"> <el-form-item label="行驶证档案编号" prop="drivingLicenseNo">
<el-input v-model="vehicleForm.drivingLicenseNo" maxlength="50" /> <el-input
v-model="vehicleForm.drivingLicenseNo"
maxlength="50"
placeholder="请输入"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -1780,9 +1806,10 @@ export default {
} }
// 大尺寸证件照:按身份证 1.586:1 比例缩放(约真实尺寸 75%,240×151),左对齐显示 // 证件照上传:宽度与同列表单项(输入框)对齐,高度按身份证 1.586:1 比例自适应
:deep(.vehicle-uploader) { :deep(.vehicle-uploader) {
display: block; display: block;
width: 100%;
} }
:deep(.vehicle-uploader .el-upload), :deep(.vehicle-uploader .el-upload),
@@ -1797,17 +1824,17 @@ export default {
overflow: hidden; overflow: hidden;
} }
// 大尺寸模式:缩成 1.586:1 比例,左对齐(不再 100% 占栏)
:deep(.vehicle-uploader--large) { :deep(.vehicle-uploader--large) {
display: block; display: block;
width: 240px; width: 100%;
margin: 0; margin: 0;
} }
:deep(.vehicle-uploader--large .el-upload), :deep(.vehicle-uploader--large .el-upload),
:deep(.vehicle-uploader--large.el-upload) { :deep(.vehicle-uploader--large.el-upload) {
width: 100%; width: 100%;
height: 151px; height: auto;
aspect-ratio: 1.586 / 1;
} }
:deep(.vehicle-uploader__image) { :deep(.vehicle-uploader__image) {
+70 -20
View File
@@ -60,15 +60,44 @@
</el-button> </el-button>
</template> </template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions"
:disabled="boxType === 'view'" :disabled="boxType === 'view'"
clearable :loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder" :placeholder="vehicleNoPlaceholder"
value-key="value" clearable
class="accident-record-page__input" filterable
/> remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #directEconomicLossForm> <template #directEconomicLossForm>
<el-input <el-input
@@ -162,6 +191,9 @@ export default {
}, },
selectionList: [], selectionList: [],
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
data: [], data: [],
}; };
}, },
@@ -183,7 +215,7 @@ export default {
}; };
}, },
vehicleNoPlaceholder() { vehicleNoPlaceholder() {
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; return this.form.vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
}, },
ids() { ids() {
const ids = []; const ids = [];
@@ -215,27 +247,41 @@ export default {
const vehicleTypeColumn = this.findColumn(this.option.column, 'vehicleType'); const vehicleTypeColumn = this.findColumn(this.option.column, 'vehicleType');
const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo'); const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo');
vehicleNoColumn.placeholder = vehicleNoColumn.placeholder =
vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
vehicleTypeColumn.disabled = Boolean(this.form.id); vehicleTypeColumn.disabled = Boolean(this.form.id);
if (!this.isDetailLoading && oldValue && vehicleType !== oldValue && this.form.vehicleNo) { if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) {
this.form.vehicleNo = ''; this.form.vehicleNo = '';
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const vehicleType = this.form.vehicleType || '车辆'; const vehicleType = this.form.vehicleType || '车辆';
const request = vehicleType === '船舶' ? getShipList : getVehicleList; const isShip = vehicleType === '船舶';
const params = const request = isShip ? getShipList : getVehicleList;
vehicleType === '船舶' ? { shipIdentifierNo: queryString } : { plateNo: queryString }; const params = isShip ? { shipIdentifierNo: queryString } : { plateNo: queryString };
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
request(1, 20, params) request(1, 20, params)
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback( const values = (res.data.data.records || [])
records.map(item => ({ .map(item => (isShip ? item.shipIdentifierNo || item.shipName : item.plateNo))
value: vehicleType === '船舶' ? item.shipIdentifierNo || item.shipName : item.plateNo, .filter(Boolean);
})) this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
); if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
}
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
formatAttachments(value) { formatAttachments(value) {
if (!value) return ''; if (!value) return '';
@@ -392,6 +438,8 @@ export default {
vehicleType: '车辆', vehicleType: '车辆',
}; };
this.updateVehicleTypeDisplays('车辆'); this.updateVehicleTypeDisplays('车辆');
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
this.isDetailLoading = true; this.isDetailLoading = true;
@@ -402,6 +450,8 @@ export default {
detail.vehicleType = detail.vehicleType || '车辆'; detail.vehicleType = detail.vehicleType || '车辆';
this.form = detail; this.form = detail;
this.updateVehicleTypeDisplays(detail.vehicleType); this.updateVehicleTypeDisplays(detail.vehicleType);
this.vehicleOptions = [];
this.loadVehicleOptions(detail.vehicleNo || '');
}) })
.finally(() => { .finally(() => {
this.isDetailLoading = false; this.isDetailLoading = false;
+194 -27
View File
@@ -54,21 +54,70 @@
>批量删除 >批量删除
</el-button> </el-button>
</template> </template>
<template #header>
<el-tabs
v-model="query.expireStatus"
type="card"
class="annual-inspection-record-page__expiry-tabs"
@tab-change="handleExpireChange"
>
<el-tab-pane
v-for="item in expiryTagOptions"
:key="item.value"
:label="`${item.label}${expiryStat[item.statKey] || 0}`"
:name="item.value"
/>
</el-tabs>
</template>
<template #vehicleNo="{ row, index }"> <template #vehicleNo="{ row, index }">
<el-button type="primary" link @click="$refs.crud.rowView(row, index)"> <el-button type="primary" link @click="$refs.crud.rowView(row, index)">
{{ row.vehicleNo }} {{ row.vehicleNo }}
</el-button> </el-button>
</template> </template>
<template #validUntilDate="{ row }">
<span :class="{ 'annual-inspection-record-page__expiring': isValidUntilExpiringSoon(row) }">
{{ row.validUntilDate || '' }}
</span>
</template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions"
:disabled="boxType === 'view'" :disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder"
clearable clearable
placeholder="输入车牌号/船号查询选择" filterable
value-key="value" remote
class="annual-inspection-record-page__input" :remote-method="loadVehicleOptions"
/> @visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #feeForm> <template #feeForm>
<el-input <el-input
@@ -93,7 +142,7 @@
:page="page" :page="page"
@size-change="sizeChange" @size-change="sizeChange"
@current-change="currentChange" @current-change="currentChange"
@load="onLoad(page, query)" @load="onLoad(page, searchForm)"
/> />
<el-dialog title="年检记录数据导入" append-to-body v-model="excelBox" width="555px"> <el-dialog title="年检记录数据导入" append-to-body v-model="excelBox" width="555px">
<avue-form :option="excelOption" v-model="excelForm"> <avue-form :option="excelOption" v-model="excelForm">
@@ -108,7 +157,14 @@
</template> </template>
<script> <script>
import { add, getDetail, getList, remove, update } from '@/api/vehicle/annual-inspection-record'; import {
add,
getDetail,
getExpiryStat,
getList,
remove,
update,
} from '@/api/vehicle/annual-inspection-record';
import { getList as getVehicleList } from '@/api/transportCapacity/transport-vehicle'; import { getList as getVehicleList } from '@/api/transportCapacity/transport-vehicle';
import { getList as getShipList } from '@/api/transportCapacity/transport-ship'; import { getList as getShipList } from '@/api/transportCapacity/transport-ship';
import { getDeptTree } from '@/api/system/dept'; import { getDeptTree } from '@/api/system/dept';
@@ -129,7 +185,8 @@ export default {
data() { data() {
return { return {
form: {}, form: {},
query: {}, query: { expireStatus: 'all' },
searchForm: {},
loading: true, loading: true,
excelBox: false, excelBox: false,
excelForm: {}, excelForm: {},
@@ -143,7 +200,11 @@ export default {
}, },
selectionList: [], selectionList: [],
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
data: [], data: [],
expiryStat: { total: 0, within30: 0, expired: 0 },
}; };
}, },
created() { created() {
@@ -170,6 +231,13 @@ export default {
}); });
return ids.join(','); return ids.join(',');
}, },
expiryTagOptions() {
return [
{ label: '全部', value: 'all', statKey: 'total' },
{ label: '已过期', value: 'expired', statKey: 'expired' },
{ label: '30天内', value: 'within30', statKey: 'within30' },
];
},
}, },
watch: { watch: {
'form.vehicleType': { 'form.vehicleType': {
@@ -183,6 +251,14 @@ export default {
hasPermission(code) { hasPermission(code) {
return this.isAdmin || this.validData(this.permission[code], false); return this.isAdmin || this.validData(this.permission[code], false);
}, },
isValidUntilExpiringSoon(row = {}) {
if (!row.validUntilDate) return false;
const endDate = this.$dayjs(row.validUntilDate);
if (!endDate.isValid()) return false;
const today = this.$dayjs().startOf('day');
const expireSoonDate = today.add(30, 'day');
return !endDate.isAfter(expireSoonDate, 'day');
},
initDeptTree() { initDeptTree() {
getDeptTree(this.userInfo.tenantId).then(res => { getDeptTree(this.userInfo.tenantId).then(res => {
const column = this.findColumn(this.option.column, 'createDept'); const column = this.findColumn(this.option.column, 'createDept');
@@ -204,25 +280,40 @@ export default {
} else { } else {
this.form.shipInspectionType = undefined; this.form.shipInspectionType = undefined;
} }
if (!this.form.id && this.form.vehicleNo) { if (!this.form.id) {
this.form.vehicleNo = ''; this.form.vehicleNo = '';
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const vehicleType = this.form.vehicleType || '车辆'; const vehicleType = this.form.vehicleType || '车辆';
const request = vehicleType === '船舶' ? getShipList : getVehicleList; const isShip = vehicleType === '船舶';
const params = const request = isShip ? getShipList : getVehicleList;
vehicleType === '船舶' ? { shipIdentifierNo: queryString } : { plateNo: queryString }; const params = isShip ? { shipIdentifierNo: queryString } : { plateNo: queryString };
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
request(1, 20, params) request(1, 20, params)
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback( const values = (res.data.data.records || [])
records.map(item => ({ .map(item => (isShip ? item.shipIdentifierNo || item.shipName : item.plateNo))
value: vehicleType === '船舶' ? item.shipIdentifierNo || item.shipName : item.plateNo, .filter(Boolean);
})) this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
); // 编辑回显:确保当前值在选项中
if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
}
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
formatAttachments(value) { formatAttachments(value) {
if (!value) return ''; if (!value) return '';
@@ -365,9 +456,10 @@ export default {
if (type === 'add') { if (type === 'add') {
this.form = { this.form = {
vehicleType: '车辆', vehicleType: '车辆',
inspectionAssessmentDate: this.$dayjs().format('YYYY-MM-DD'),
}; };
this.updateVehicleTypeDisplays('车辆'); this.updateVehicleTypeDisplays('车辆');
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(res => { getDetail(this.form.id).then(res => {
@@ -375,16 +467,33 @@ export default {
detail.attachments = this.parseAttachments(detail.attachments); detail.attachments = this.parseAttachments(detail.attachments);
this.form = detail; this.form = detail;
this.updateVehicleTypeDisplays(detail.vehicleType); this.updateVehicleTypeDisplays(detail.vehicleType);
this.vehicleOptions = [];
this.loadVehicleOptions(detail.vehicleNo || '');
}); });
} }
done(); done();
}, },
handleExpireChange(expireStatus) {
this.query.expireStatus = expireStatus;
this.page.currentPage = 1;
this.onLoad(this.page);
},
refreshStat() {
getExpiryStat(this.buildQuery(false)).then(res => {
this.expiryStat = {
total: res.data.data?.total || 0,
within30: res.data.data?.within30 || 0,
expired: res.data.data?.expired || 0,
};
});
},
searchReset() { searchReset() {
this.query = {}; this.searchForm = {};
this.query = { expireStatus: this.query.expireStatus || 'all' };
this.onLoad(this.page); this.onLoad(this.page);
}, },
searchChange(params, done) { searchChange(params, done) {
this.query = params; this.searchForm = params;
this.page.currentPage = 1; this.page.currentPage = 1;
this.onLoad(this.page, params); this.onLoad(this.page, params);
done(); done();
@@ -403,16 +512,34 @@ export default {
this.page.pageSize = pageSize; this.page.pageSize = pageSize;
}, },
refreshChange() { refreshChange() {
this.onLoad(this.page, this.query); this.onLoad(this.page, this.searchForm);
},
buildQuery(includeExpire = true, params = {}) {
const values = { ...params, ...this.searchForm };
const { inspectionAssessmentDateRange } = values;
if (Array.isArray(inspectionAssessmentDateRange) && inspectionAssessmentDateRange.length === 2) {
values.inspectionAssessmentDateStart = inspectionAssessmentDateRange[0];
values.inspectionAssessmentDateEnd = inspectionAssessmentDateRange[1];
}
values.inspectionAssessmentDateRange = null;
if (
includeExpire &&
this.query.expireStatus &&
this.query.expireStatus !== 'all'
) {
values.expireStatus = this.query.expireStatus;
}
return values;
}, },
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true; this.loading = true;
getList(page.currentPage, page.pageSize, { ...params, ...this.query }) getList(page.currentPage, page.pageSize, this.buildQuery(true, params))
.then(res => { .then(res => {
const data = res.data.data; const data = res.data.data;
this.page.total = data.total; this.page.total = data.total;
this.data = data.records; this.data = data.records;
this.selectionClear(); this.selectionClear();
this.refreshStat();
}) })
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
@@ -443,7 +570,7 @@ export default {
}, },
buildExportParams() { buildExportParams() {
return { return {
...this.query, ...this.buildQuery(true),
ids: this.ids, ids: this.ids,
exportColumns: JSON.stringify(exportColumns), exportColumns: JSON.stringify(exportColumns),
[this.website.tokenHeader]: getToken(), [this.website.tokenHeader]: getToken(),
@@ -464,6 +591,42 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.annual-inspection-record-page { .annual-inspection-record-page {
:deep(.avue-crud__body > .el-card__body) {
display: flex;
flex-direction: column;
> * {
order: 3;
}
> .avue-crud__header {
order: 1;
margin-bottom: 0;
}
> .annual-inspection-record-page__expiry-tabs {
order: 2;
}
}
&__expiry-tabs {
margin-top: 8px;
margin-bottom: 0;
:deep(.el-tabs__header) {
margin: 0;
border-bottom: 0;
}
:deep(.el-tabs__nav) {
border-bottom-color: var(--el-border-color-light);
}
:deep(.el-tabs__content) {
display: none;
}
}
:deep(.el-table th .cell), :deep(.el-table th .cell),
:deep(.el-table td .cell) { :deep(.el-table td .cell) {
white-space: nowrap; white-space: nowrap;
@@ -472,5 +635,9 @@ export default {
&__input { &__input {
width: 100%; width: 100%;
} }
&__expiring {
color: #f56c6c;
}
} }
</style> </style>
+335 -86
View File
@@ -246,6 +246,18 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6">
<el-form-item label="是否广西百强" prop="guangxiTop100">
<el-select v-model="archiveForm.guangxiTop100" placeholder="请选择" clearable>
<el-option
v-for="item in guangxiTop100Options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="统一社会信用代码" prop="unifiedCreditCode"> <el-form-item label="统一社会信用代码" prop="unifiedCreditCode">
<el-input <el-input
@@ -379,6 +391,22 @@
</el-tooltip> </el-tooltip>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6">
<el-form-item label="网络货运平台" prop="networkFreightPlatform">
<el-select
v-model="archiveForm.networkFreightPlatform"
placeholder="请选择"
clearable
>
<el-option
v-for="item in networkFreightPlatformOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row> </el-row>
</section-card> </section-card>
@@ -626,18 +654,20 @@
</div> </div>
<el-table :data="invoiceTableData" border class="invoice-table"> <el-table :data="invoiceTableData" border class="invoice-table">
<el-table-column label="序号" prop="__index" width="90" align="center" /> <el-table-column label="序号" prop="__index" width="90" align="center" />
<el-table-column label="收票方名称" prop="invoiceTitle" min-width="180" /> <el-table-column label="企业全称" prop="invoiceTitle" min-width="180" />
<el-table-column label="发票类型" prop="invoiceType" min-width="150" />
<el-table-column label="纳税人识别号" prop="taxNo" min-width="180" /> <el-table-column label="纳税人识别号" prop="taxNo" min-width="180" />
<el-table-column label="开户行名称" prop="bankName" min-width="180" /> <el-table-column label="开户行名称" prop="bankName" min-width="180" />
<el-table-column label="注册电话" prop="registeredPhone" min-width="150" />
<el-table-column label="银行账号" prop="bankAccount" min-width="180" /> <el-table-column label="银行账号" prop="bankAccount" min-width="180" />
<el-table-column label="注册地址" min-width="220"> <el-table-column label="注册地址" min-width="220">
<template #default="{ row }"> <template #default="{ row }">
<span>{{ formatInvoiceRegisteredAddress(row) || '-' }}</span> <span>{{ formatInvoiceRegisteredAddress(row) || '-' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="邮箱" prop="email" min-width="180" /> <el-table-column label="邮箱" min-width="180">
<template #default="{ row }">
<span>{{ formatInvoiceEmails(row) || '-' }}</span>
</template>
</el-table-column>
<el-table-column <el-table-column
label="操作" label="操作"
width="130" width="130"
@@ -1067,10 +1097,11 @@
<el-row :gutter="34"> <el-row :gutter="34">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="纳税人识别号" prop="taxNo"> <el-form-item label="纳税人识别号" prop="taxNo">
<el-input v-model="invoiceForm.taxNo" maxlength="30" /> <el-input
</el-form-item> v-model="invoiceForm.taxNo"
<el-form-item label="注册电话" prop="registeredPhone"> maxlength="30"
<el-input v-model="invoiceForm.registeredPhone" maxlength="20" /> placeholder="默认客商统一社会信用代码,可编辑"
/>
</el-form-item> </el-form-item>
<el-form-item label="注册地址" prop="registeredRegionName"> <el-form-item label="注册地址" prop="registeredRegionName">
<el-cascader <el-cascader
@@ -1078,12 +1109,24 @@
v-model="invoiceForm.registeredRegionPath" v-model="invoiceForm.registeredRegionPath"
:options="regionOptions" :options="regionOptions"
:props="regionCascaderProps" :props="regionCascaderProps"
:placeholder="invoiceForm.registeredRegionName || '请选择省市区'" :placeholder="invoiceForm.registeredRegionName || '默认客商地址 可编辑'"
clearable clearable
filterable filterable
@change="handleInvoiceRegisteredRegionChange" @change="handleInvoiceRegisteredRegionChange"
/> />
</el-form-item> </el-form-item>
<el-form-item label="开户行名称" prop="bankName">
<el-input v-model="invoiceForm.bankName" maxlength="100" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="企业全称" prop="invoiceTitle">
<el-input
v-model="invoiceForm.invoiceTitle"
maxlength="100"
placeholder="默认客商名称 可编辑"
/>
</el-form-item>
<el-form-item label="详细地址" prop="registeredDetailAddress"> <el-form-item label="详细地址" prop="registeredDetailAddress">
<el-tooltip <el-tooltip
:content="invoiceForm.registeredDetailAddress" :content="invoiceForm.registeredDetailAddress"
@@ -1095,25 +1138,11 @@
ref="invoiceDetailInput" ref="invoiceDetailInput"
v-model="invoiceForm.registeredDetailAddress" v-model="invoiceForm.registeredDetailAddress"
maxlength="255" maxlength="255"
placeholder="请输入详细地址" placeholder="默认客商地址 可编辑"
@input="checkOverflow('invoiceDetailInput', 'invoiceDetailOverflow')" @input="checkOverflow('invoiceDetailInput', 'invoiceDetailOverflow')"
/> />
</el-tooltip> </el-tooltip>
</el-form-item> </el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="收票方名称" prop="invoiceTitle">
<el-input v-model="invoiceForm.invoiceTitle" maxlength="100" />
</el-form-item>
<el-form-item label="发票类型" prop="invoiceType">
<el-select v-model="invoiceForm.invoiceType" clearable placeholder="请选择">
<el-option label="增值税专用发票" value="增值税专用发票" />
<el-option label="普通发票" value="普通发票" />
</el-select>
</el-form-item>
<el-form-item label="开户行名称" prop="bankName">
<el-input v-model="invoiceForm.bankName" maxlength="100" />
</el-form-item>
<el-form-item label="银行账号" prop="bankAccount"> <el-form-item label="银行账号" prop="bankAccount">
<el-input v-model="invoiceForm.bankAccount" maxlength="50" /> <el-input v-model="invoiceForm.bankAccount" maxlength="50" />
</el-form-item> </el-form-item>
@@ -1121,38 +1150,67 @@
</el-row> </el-row>
</section-card> </section-card>
<section-card title="邮寄信息"> <section-card>
<el-row :gutter="34"> <template #title>联系信息</template>
<el-col :span="12"> <template #extra>
<el-form-item label="收件人姓名" prop="receiverName"> <el-button v-if="!readonly" type="primary" @click="addInvoiceContact">添加</el-button>
<el-input v-model="invoiceForm.receiverName" maxlength="30" /> </template>
</el-form-item> <el-table :data="invoiceForm.contacts || []" border class="invoice-contact-table">
<el-form-item label="收件人地址" prop="receiverAddress"> <el-table-column type="index" label="序号" width="70" align="center" />
<el-tooltip <el-table-column label="联系人" min-width="120">
:content="invoiceForm.receiverAddress" <template #default="{ row }">
placement="top" <el-input v-model="row.contactName" maxlength="30" :disabled="readonly" />
:disabled="!invoiceReceiverOverflow" </template>
style="display: block; width: 100%" </el-table-column>
<el-table-column label="联系电话" min-width="140">
<template #default="{ row }">
<el-input v-model="row.contactPhone" maxlength="20" :disabled="readonly" />
</template>
</el-table-column>
<el-table-column label="邮箱地址" min-width="180">
<template #default="{ row }">
<el-input v-model="row.email" maxlength="100" :disabled="readonly" />
</template>
</el-table-column>
<el-table-column label="所属部门" min-width="200">
<template #default="{ row }">
<el-input
v-if="!isInternalCustomer"
:model-value="row.deptNames"
disabled
/>
<el-select
v-else
v-model="row.deptIdList"
multiple
collapse-tags
collapse-tags-tooltip
filterable
clearable
:disabled="readonly"
placeholder="请选择所属部门"
@change="() => handleInvoiceContactDeptChange(row)"
> >
<el-input <el-option
ref="invoiceReceiverInput" v-for="item in invoiceDeptOptions"
v-model="invoiceForm.receiverAddress" :key="item.value"
maxlength="255" :label="item.label"
placeholder="请输入收件人地址" :value="item.value"
@input="checkOverflow('invoiceReceiverInput', 'invoiceReceiverOverflow')"
/> />
</el-tooltip> </el-select>
</el-form-item> </template>
</el-col> </el-table-column>
<el-col :span="12"> <el-table-column label="备注" min-width="160">
<el-form-item label="收件人电话" prop="receiverPhone"> <template #default="{ row }">
<el-input v-model="invoiceForm.receiverPhone" maxlength="20" /> <el-input v-model="row.remark" maxlength="200" :disabled="readonly" />
</el-form-item> </template>
<el-form-item label="邮箱" prop="email"> </el-table-column>
<el-input v-model="invoiceForm.email" maxlength="100" /> <el-table-column v-if="!readonly" label="操作" width="80" align="center" fixed="right">
</el-form-item> <template #default="{ $index }">
</el-col> <el-link type="danger" @click="removeInvoiceContact($index)">删除</el-link>
</el-row> </template>
</el-table-column>
</el-table>
</section-card> </section-card>
</el-form> </el-form>
<template #footer> <template #footer>
@@ -1653,7 +1711,6 @@ export default {
invoiceForm: this.emptyInvoice(), invoiceForm: this.emptyInvoice(),
registeredDetailOverflow: false, registeredDetailOverflow: false,
invoiceDetailOverflow: false, invoiceDetailOverflow: false,
invoiceReceiverOverflow: false,
qualificationFiles: [], qualificationFiles: [],
qualificationUploadFiles: [], qualificationUploadFiles: [],
ocrQualificationUploadFiles: [], ocrQualificationUploadFiles: [],
@@ -1684,6 +1741,14 @@ export default {
external: '外部客商', external: '外部客商',
internal: '内部组织', internal: '内部组织',
}, },
networkFreightPlatformOptions: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
],
guangxiTop100Options: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
],
businessScopeOptions: [], businessScopeOptions: [],
qualificationTypeOptions: [], qualificationTypeOptions: [],
creditLevelOptions: ['A', 'B', 'C', 'D', 'E', 'F'].map(item => ({ creditLevelOptions: ['A', 'B', 'C', 'D', 'E', 'F'].map(item => ({
@@ -1761,9 +1826,7 @@ export default {
}, },
invoiceRules: { invoiceRules: {
taxNo: [{ required: true, message: '请输入纳税人识别号', trigger: 'blur' }], taxNo: [{ required: true, message: '请输入纳税人识别号', trigger: 'blur' }],
invoiceTitle: [{ required: true, message: '请输入收票方名称', trigger: 'blur' }], invoiceTitle: [{ required: true, message: '请输入企业全称', trigger: 'blur' }],
invoiceType: [{ required: true, message: '请选择发票类型', trigger: 'change' }],
registeredPhone: [{ required: true, message: '请输入注册电话', trigger: 'blur' }],
bankName: [{ required: true, message: '请输入开户行名称', trigger: 'blur' }], bankName: [{ required: true, message: '请输入开户行名称', trigger: 'blur' }],
registeredRegionName: [{ required: true, message: '请选择注册地址', trigger: 'change' }], registeredRegionName: [{ required: true, message: '请选择注册地址', trigger: 'change' }],
registeredDetailAddress: [ registeredDetailAddress: [
@@ -1771,8 +1834,6 @@ export default {
{ max: 255, message: '详细地址最多255个字符', trigger: 'blur' }, { max: 255, message: '详细地址最多255个字符', trigger: 'blur' },
], ],
bankAccount: [{ required: true, message: '请输入银行账号', trigger: 'blur' }], bankAccount: [{ required: true, message: '请输入银行账号', trigger: 'blur' }],
receiverAddress: [{ max: 255, message: '收件人地址最多255个字符', trigger: 'blur' }],
email: [{ type: 'email', message: '请输入正确的邮箱', trigger: 'blur' }],
}, },
option: { option: {
height: 'auto', height: 'auto',
@@ -1859,6 +1920,21 @@ export default {
{ label: '个体工商户', value: '个体工商户' }, { label: '个体工商户', value: '个体工商户' },
], ],
}, },
{
label: '是否广西百强',
prop: 'guangxiTop100',
type: 'select',
minWidth: 130,
dicData: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
],
formatter: row => {
if (row.guangxiTop100 === 1) return '是';
if (row.guangxiTop100 === 0) return '否';
return '';
},
},
{ {
label: '统一信用代码', label: '统一信用代码',
prop: 'unifiedCreditCode', prop: 'unifiedCreditCode',
@@ -2046,6 +2122,15 @@ export default {
invoiceDialogTitle() { invoiceDialogTitle() {
return this.invoiceIndex > -1 ? '编辑发票信息' : '新增发票信息'; return this.invoiceIndex > -1 ? '编辑发票信息' : '新增发票信息';
}, },
isInternalCustomer() {
return this.archiveForm.customerKind === 'internal';
},
invoiceDeptOptions() {
return this.flattenDept(this.deptTree).map(item => ({
label: item.rawLabel,
value: String(item.value),
}));
},
isTemporaryToFormal() { isTemporaryToFormal() {
return ( return (
Boolean(this.archiveForm.id) && Boolean(this.archiveForm.id) &&
@@ -2129,9 +2214,6 @@ export default {
'invoiceForm.registeredDetailAddress'() { 'invoiceForm.registeredDetailAddress'() {
this.$nextTick(() => this.checkOverflow('invoiceDetailInput', 'invoiceDetailOverflow')); this.$nextTick(() => this.checkOverflow('invoiceDetailInput', 'invoiceDetailOverflow'));
}, },
'invoiceForm.receiverAddress'() {
this.$nextTick(() => this.checkOverflow('invoiceReceiverInput', 'invoiceReceiverOverflow'));
},
}, },
methods: { methods: {
hasPermission(code) { hasPermission(code) {
@@ -2155,6 +2237,8 @@ export default {
customerType: [], customerType: [],
businessScope: [], businessScope: [],
businessTermType: '固定期限', businessTermType: '固定期限',
networkFreightPlatform: null,
guangxiTop100: null,
registeredRegionPath: [], registeredRegionPath: [],
registeredRegionName: '', registeredRegionName: '',
registeredDetailAddress: '', registeredDetailAddress: '',
@@ -2277,11 +2361,13 @@ export default {
customerType: '客商分类', customerType: '客商分类',
customerKind: '客商类型', customerKind: '客商类型',
customerNature: '客户性质', customerNature: '客户性质',
guangxiTop100: '是否广西百强',
unifiedCreditCode: '统一信用代码', unifiedCreditCode: '统一信用代码',
deptName: '所属组织', deptName: '所属组织',
approvedTime: '审核通过时间', approvedTime: '审核通过时间',
status: '状态', status: '状态',
businessTermType: '营业期限类型', businessTermType: '营业期限类型',
networkFreightPlatform: '网络货运平台',
registeredRegionName: '注册地址', registeredRegionName: '注册地址',
registeredDetailAddress: '详细地址', registeredDetailAddress: '详细地址',
invoiceType: '发票类型', invoiceType: '发票类型',
@@ -2481,6 +2567,7 @@ export default {
状态: 'status', 状态: 'status',
客户类型: 'customerType', 客户类型: 'customerType',
客商材料: 'qualificationAttachments', 客商材料: 'qualificationAttachments',
是否广西百强: 'guangxiTop100',
}[field] || field; }[field] || field;
if (['qualificationAttachments', 'customerAttachments'].includes(normalizedField)) { if (['qualificationAttachments', 'customerAttachments'].includes(normalizedField)) {
return this.formatAttachmentChangeValue(value); return this.formatAttachmentChangeValue(value);
@@ -2498,6 +2585,8 @@ export default {
}, },
status: { 1: '启用', 2: '停用', 0: '停用' }, status: { 1: '启用', 2: '停用', 0: '停用' },
customerKind: { external: '外部客商', internal: '内部组织' }, customerKind: { external: '外部客商', internal: '内部组织' },
networkFreightPlatform: { 1: '是', 0: '否' },
guangxiTop100: { 1: '是', 0: '否' },
}; };
if (Array.isArray(value)) { if (Array.isArray(value)) {
return value.map(item => this.formatChangeFieldValue(normalizedField, item)).join('、'); return value.map(item => this.formatChangeFieldValue(normalizedField, item)).join('、');
@@ -2589,19 +2678,14 @@ export default {
emptyInvoice() { emptyInvoice() {
return { return {
invoiceTitle: '', invoiceTitle: '',
invoiceType: '',
taxNo: '', taxNo: '',
bankName: '', bankName: '',
registeredPhone: '',
bankAccount: '', bankAccount: '',
registeredRegionPath: [], registeredRegionPath: [],
registeredRegionName: '', registeredRegionName: '',
registeredDetailAddress: '', registeredDetailAddress: '',
registeredAddress: '', registeredAddress: '',
email: '', contacts: [],
receiverName: '',
receiverPhone: '',
receiverAddress: '',
isDefault: 0, isDefault: 0,
}; };
}, },
@@ -2977,14 +3061,12 @@ export default {
.join(''); .join('');
return address || row.registeredAddress || ''; return address || row.registeredAddress || '';
}, },
formatInvoiceReceiverAddress(row = {}) { formatInvoiceEmails(row = {}) {
const address = String(row.receiverAddress || '').trim(); const contacts = row.contacts || row.__raw?.contacts || [];
if (address) return address; return (contacts || [])
// 历史数据中收件人地址拆分为行政区划 + 详细地址两个字段 .map(item => String(item.email || '').trim())
return [row.receiverRegionName, row.receiverDetailAddress]
.map(item => String(item || '').trim())
.filter(Boolean) .filter(Boolean)
.join(''); .join('');
}, },
normalizeContact(contact = {}) { normalizeContact(contact = {}) {
const contactAddress = const contactAddress =
@@ -3354,15 +3436,13 @@ export default {
.catch(() => {}); .catch(() => {});
}, },
normalizeInvoice(invoice = {}) { normalizeInvoice(invoice = {}) {
// receiverRegionName / receiverDetailAddress 为历史拆分字段,现已合并为单一的收件人地址
const { receiverRegionName, receiverDetailAddress, ...rest } = invoice;
const registeredDetailAddress = const registeredDetailAddress =
invoice.registeredDetailAddress || invoice.registeredDetailAddress ||
(invoice.registeredRegionName ? '' : invoice.registeredAddress) || (invoice.registeredRegionName ? '' : invoice.registeredAddress) ||
''; '';
return { return {
...this.emptyInvoice(), ...this.emptyInvoice(),
...rest, ...invoice,
registeredRegionPath: Array.isArray(invoice.registeredRegionPath) registeredRegionPath: Array.isArray(invoice.registeredRegionPath)
? invoice.registeredRegionPath ? invoice.registeredRegionPath
: [], : [],
@@ -3371,21 +3451,92 @@ export default {
...invoice, ...invoice,
registeredDetailAddress, registeredDetailAddress,
}), }),
receiverAddress: this.formatInvoiceReceiverAddress({ contacts: (invoice.contacts || []).map(item => this.normalizeInvoiceContact(item)),
receiverRegionName, };
receiverDetailAddress, },
receiverAddress: invoice.receiverAddress, normalizeInvoiceContact(contact = {}) {
}), const deptIds = String(contact.deptIds || '')
.split(/[,,、]/)
.map(item => item.trim())
.filter(Boolean);
const deptIdList = Array.isArray(contact.deptIdList)
? contact.deptIdList.map(item => String(item)).filter(Boolean)
: deptIds;
const contactRow = {
contactName: contact.contactName || '',
contactPhone: contact.contactPhone || '',
email: contact.email || '',
deptIds: contact.deptIds || deptIdList.join(','),
deptNames: contact.deptNames || '',
deptIdList,
remark: contact.remark || '',
};
if (!this.isInternalCustomer) {
contactRow.deptIds = this.externalInvoiceDeptIds();
contactRow.deptNames = this.externalInvoiceDeptName();
contactRow.deptIdList = contactRow.deptIds
? String(contactRow.deptIds)
.split(/[,]/)
.map(item => item.trim())
.filter(Boolean)
: [];
} else if (!contactRow.deptNames && deptIdList.length) {
contactRow.deptNames = deptIdList.map(id => this.findDeptLabel(id)).filter(Boolean).join('、');
}
return contactRow;
},
emptyInvoiceContact() {
const contact = {
contactName: '',
contactPhone: '',
email: '',
deptIds: '',
deptNames: '',
deptIdList: [],
remark: '',
};
if (!this.isInternalCustomer) {
contact.deptIds = this.externalInvoiceDeptIds();
contact.deptNames = this.externalInvoiceDeptName();
contact.deptIdList = contact.deptIds
? String(contact.deptIds)
.split(/[,]/)
.map(item => item.trim())
.filter(Boolean)
: [];
}
return contact;
},
externalInvoiceDeptName() {
return this.archiveForm.fullName || this.archiveForm.deptName || '';
},
externalInvoiceDeptIds() {
if (this.archiveForm.deptIds) return String(this.archiveForm.deptIds);
if (Array.isArray(this.archiveForm.deptId)) return this.archiveForm.deptId.filter(Boolean).join(',');
return this.archiveForm.deptId ? String(this.archiveForm.deptId) : '';
},
defaultInvoice() {
const archive = this.archiveForm || {};
return {
...this.emptyInvoice(),
invoiceTitle: archive.fullName || '',
taxNo: archive.unifiedCreditCode || '',
registeredRegionPath: Array.isArray(archive.registeredRegionPath)
? [...archive.registeredRegionPath]
: [],
registeredRegionName: archive.registeredRegionName || '',
registeredDetailAddress: archive.registeredDetailAddress || '',
registeredAddress: this.formatArchiveAddress(archive),
contacts: [],
}; };
}, },
openInvoice(row, index = -1) { openInvoice(row, index = -1) {
this.invoiceIndex = index; this.invoiceIndex = index;
this.invoiceForm = row ? this.normalizeInvoice(row) : this.emptyInvoice(); this.invoiceForm = row ? this.normalizeInvoice(row) : this.defaultInvoice();
this.invoiceBox = true; this.invoiceBox = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$nextTick(() => { this.$nextTick(() => {
this.checkOverflow('invoiceDetailInput', 'invoiceDetailOverflow'); this.checkOverflow('invoiceDetailInput', 'invoiceDetailOverflow');
this.checkOverflow('invoiceReceiverInput', 'invoiceReceiverOverflow');
}); });
}); });
}, },
@@ -3394,10 +3545,75 @@ export default {
this.invoiceForm = this.emptyInvoice(); this.invoiceForm = this.emptyInvoice();
this.$refs.invoiceForm?.clearValidate(); this.$refs.invoiceForm?.clearValidate();
}, },
addInvoiceContact() {
if (!Array.isArray(this.invoiceForm.contacts)) {
this.invoiceForm.contacts = [];
}
this.invoiceForm.contacts.push(this.emptyInvoiceContact());
},
removeInvoiceContact(index) {
this.invoiceForm.contacts.splice(index, 1);
},
handleInvoiceContactDeptChange(row) {
const ids = Array.isArray(row.deptIdList) ? row.deptIdList.map(item => String(item)) : [];
row.deptIds = ids.join(',');
row.deptNames = ids.map(id => this.findDeptLabel(id)).filter(Boolean).join('、');
},
isBlankInvoiceContact(contact = {}) {
return ![
contact.contactName,
contact.contactPhone,
contact.email,
contact.deptIds,
contact.deptNames,
...(Array.isArray(contact.deptIdList) ? contact.deptIdList : []),
contact.remark,
].some(item => String(item || '').trim());
},
validateInvoiceContacts(contacts = []) {
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
for (let index = 0; index < contacts.length; index += 1) {
const contact = contacts[index];
if (this.isBlankInvoiceContact(contact)) continue;
if (!String(contact.contactName || '').trim()) {
this.$message.warning(`请填写第${index + 1}行联系人`);
return false;
}
if (!String(contact.contactPhone || '').trim()) {
this.$message.warning(`请填写第${index + 1}行联系电话`);
return false;
}
const email = String(contact.email || '').trim();
if (email && !emailPattern.test(email)) {
this.$message.warning(`第${index + 1}行邮箱格式不正确`);
return false;
}
if (String(contact.remark || '').length > 200) {
this.$message.warning(`第${index + 1}行备注最多200个字`);
return false;
}
if (this.isInternalCustomer && !(contact.deptIdList || []).length) {
this.$message.warning(`内部组织客商请选择第${index + 1}行所属部门`);
return false;
}
}
return true;
},
saveInvoice() { saveInvoice() {
this.$refs.invoiceForm.validate(valid => { this.$refs.invoiceForm.validate(valid => {
if (!valid) return; if (!valid) return;
const invoice = this.normalizeInvoice(this.invoiceForm); const invoice = this.normalizeInvoice(this.invoiceForm);
if (!this.validateInvoiceContacts(invoice.contacts)) return;
invoice.contacts = (invoice.contacts || [])
.filter(item => !this.isBlankInvoiceContact(item))
.map(item => {
const contact = { ...item };
if (this.isInternalCustomer) {
this.handleInvoiceContactDeptChange(contact);
}
delete contact.deptIdList;
return contact;
});
if (this.invoiceIndex > -1) { if (this.invoiceIndex > -1) {
this.archiveForm.invoices.splice(this.invoiceIndex, 1, invoice); this.archiveForm.invoices.splice(this.invoiceIndex, 1, invoice);
} else { } else {
@@ -3790,6 +4006,12 @@ export default {
applyCreditLimit: this.normalizeOptionalAmount(detail.applyCreditLimit), applyCreditLimit: this.normalizeOptionalAmount(detail.applyCreditLimit),
businessScope, businessScope,
businessTermType: detail.businessTermType || '固定期限', businessTermType: detail.businessTermType || '固定期限',
networkFreightPlatform:
detail.networkFreightPlatform === 0 || detail.networkFreightPlatform === 1
? detail.networkFreightPlatform
: null,
guangxiTop100:
detail.guangxiTop100 === 0 || detail.guangxiTop100 === 1 ? detail.guangxiTop100 : null,
registeredRegionPath: Array.isArray(detail.registeredRegionPath) registeredRegionPath: Array.isArray(detail.registeredRegionPath)
? detail.registeredRegionPath ? detail.registeredRegionPath
: [], : [],
@@ -3983,6 +4205,12 @@ export default {
archive.businessScope = Array.isArray(archive.businessScope) archive.businessScope = Array.isArray(archive.businessScope)
? archive.businessScope.join(',') ? archive.businessScope.join(',')
: archive.businessScope; : archive.businessScope;
archive.networkFreightPlatform =
archive.networkFreightPlatform === 0 || archive.networkFreightPlatform === 1
? archive.networkFreightPlatform
: null;
archive.guangxiTop100 =
archive.guangxiTop100 === 0 || archive.guangxiTop100 === 1 ? archive.guangxiTop100 : null;
const deptIds = Array.isArray(archive.deptId) const deptIds = Array.isArray(archive.deptId)
? archive.deptId ? archive.deptId
: archive.deptId : archive.deptId
@@ -4012,6 +4240,16 @@ export default {
.map(item => { .map(item => {
const invoice = this.normalizeInvoice(item); const invoice = this.normalizeInvoice(item);
delete invoice.registeredRegionPath; delete invoice.registeredRegionPath;
invoice.contacts = (invoice.contacts || [])
.filter(contact => !this.isBlankInvoiceContact(contact))
.map(contact => {
const row = { ...contact };
if (this.isInternalCustomer) {
this.handleInvoiceContactDeptChange(row);
}
delete row.deptIdList;
return row;
});
return invoice; return invoice;
}) })
.filter(item => item.invoiceTitle || item.taxNo || item.bankAccount); .filter(item => item.invoiceTitle || item.taxNo || item.bankAccount);
@@ -4053,6 +4291,8 @@ export default {
return; return;
} }
const archive = this.normalizeArchive(); const archive = this.normalizeArchive();
// 仅提交时落变更记录;保存不记录
archive.recordChange = true;
if (!this.validateFormalForApproval(archive)) return; if (!this.validateFormalForApproval(archive)) return;
submit(archive).then(res => { submit(archive).then(res => {
const data = res.data.data; const data = res.data.data;
@@ -5168,6 +5408,15 @@ export default {
max-width: none; max-width: none;
} }
.invoice-contact-table {
width: 100%;
:deep(.el-input),
:deep(.el-select) {
width: 100%;
}
}
.contact-form__address { .contact-form__address {
display: flex; display: flex;
gap: 10px; gap: 10px;
+22 -1
View File
@@ -79,6 +79,27 @@
/> />
</el-select> </el-select>
</template> </template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
class="equipment-ledger-page__vehicle-select"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #equipmentCodeForm> <template #equipmentCodeForm>
<el-input v-model="form.equipmentCode" disabled /> <el-input v-model="form.equipmentCode" disabled />
</template> </template>
@@ -167,7 +188,7 @@ export default {
}; };
}, },
vehicleNoPlaceholder() { vehicleNoPlaceholder() {
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; return this.form.vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
}, },
ids() { ids() {
return this.selectionList.map(item => item.id).join(','); return this.selectionList.map(item => item.id).join(',');
+60 -14
View File
@@ -60,15 +60,44 @@
</el-button> </el-button>
</template> </template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions"
:disabled="boxType === 'view'" :disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
placeholder="请选择车牌号"
clearable clearable
placeholder="输入车牌号模糊查询选择" filterable
value-key="value" remote
class="etc-record-page__input" :remote-method="loadVehicleOptions"
/> @visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
placeholder="请选择车牌号"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #transactionAmountForm> <template #transactionAmountForm>
<el-input <el-input
@@ -138,6 +167,9 @@ export default {
}, },
selectionList: [], selectionList: [],
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
data: [], data: [],
}; };
}, },
@@ -176,17 +208,27 @@ export default {
column.dicData = res.data.data; column.dicData = res.data.data;
}); });
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
getVehicleList(1, 20, { plateNo: queryString }) getVehicleList(1, 20, { plateNo: queryString })
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback( const values = (res.data.data.records || []).map(item => item.plateNo).filter(Boolean);
records.map(item => ({ this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
value: item.plateNo, if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
})) this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
); }
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
formatAttachments(value) { formatAttachments(value) {
if (!value) return ''; if (!value) return '';
@@ -341,6 +383,8 @@ export default {
beforeOpen(done, type) { beforeOpen(done, type) {
this.boxType = type; this.boxType = type;
if (type === 'add') { if (type === 'add') {
this.vehicleOptions = [];
this.loadVehicleOptions('');
this.form = { dataSource: '手工录入' }; this.form = { dataSource: '手工录入' };
} }
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
@@ -348,6 +392,8 @@ export default {
const detail = res.data.data; const detail = res.data.data;
detail.attachments = this.parseAttachments(detail.attachments); detail.attachments = this.parseAttachments(detail.attachments);
this.form = detail; this.form = detail;
this.vehicleOptions = [];
this.loadVehicleOptions(this.form.vehicleNo || '');
}); });
} }
done(); done();
+85 -25
View File
@@ -60,14 +60,44 @@
</el-button> </el-button>
</template> </template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions" :disabled="boxType === 'view'"
clearable :loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder" :placeholder="vehicleNoPlaceholder"
value-key="value" clearable
class="insurance-record-page__vehicle-input" filterable
/> remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #insuredAmountForm> <template #insuredAmountForm>
<el-input <el-input
@@ -211,6 +241,9 @@ export default {
excelForm: {}, excelForm: {},
isDetailLoading: false, isDetailLoading: false,
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
option, option,
excelOption, excelOption,
page: { page: {
@@ -226,7 +259,7 @@ export default {
}, },
created() { created() {
this.initDeptTree(); this.initDeptTree();
this.initOcrTemplateOptions(); this.initOcrTemplateOptions('车辆');
}, },
computed: { computed: {
...mapGetters(['permission', 'userInfo']), ...mapGetters(['permission', 'userInfo']),
@@ -243,7 +276,7 @@ export default {
}; };
}, },
vehicleNoPlaceholder() { vehicleNoPlaceholder() {
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; return this.form.vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
}, },
ids() { ids() {
const ids = []; const ids = [];
@@ -271,9 +304,12 @@ export default {
updateVehicleTypeDisplays(vehicleType, oldValue) { updateVehicleTypeDisplays(vehicleType, oldValue) {
const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo'); const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo');
vehicleNoColumn.placeholder = vehicleNoColumn.placeholder =
vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
if (!this.isDetailLoading && oldValue && vehicleType !== oldValue && this.form.vehicleNo) { if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) {
this.form.vehicleNo = ''; this.form.vehicleNo = '';
this.vehicleOptions = [];
this.loadVehicleOptions('');
this.initOcrTemplateOptions(vehicleType, true);
} }
}, },
initDeptTree() { initDeptTree() {
@@ -282,8 +318,9 @@ export default {
column.dicData = res.data.data; column.dicData = res.data.data;
}); });
}, },
initOcrTemplateOptions() { initOcrTemplateOptions(vehicleType = '车辆', resetSelected = false) {
getOcrTemplateList(1, 100, {}) const type = vehicleType || '车辆';
return getOcrTemplateList(1, 100, { vehicleType: type })
.then(res => { .then(res => {
const records = res.data.data?.records || []; const records = res.data.data?.records || [];
this.ocrTemplateOptions = records.map(item => ({ this.ocrTemplateOptions = records.map(item => ({
@@ -293,26 +330,44 @@ export default {
})); }));
const templateColumn = this.findColumn(this.option.column, 'ocrTemplate'); const templateColumn = this.findColumn(this.option.column, 'ocrTemplate');
if (templateColumn) templateColumn.dicData = this.ocrTemplateOptions; if (templateColumn) templateColumn.dicData = this.ocrTemplateOptions;
if (resetSelected || !this.ocrTemplateOptions.some(item => item.value === this.form.ocrTemplate)) {
this.form.ocrTemplate = this.ocrTemplateOptions[0]?.value || '';
}
}) })
.catch(() => { .catch(() => {
this.ocrTemplateOptions = []; this.ocrTemplateOptions = [];
const templateColumn = this.findColumn(this.option.column, 'ocrTemplate');
if (templateColumn) templateColumn.dicData = [];
if (resetSelected) this.form.ocrTemplate = '';
}); });
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const vehicleType = this.form.vehicleType || '车辆'; const vehicleType = this.form.vehicleType || '车辆';
const request = vehicleType === '船舶' ? getShipList : getVehicleList; const isShip = vehicleType === '船舶';
const params = const request = isShip ? getShipList : getVehicleList;
vehicleType === '船舶' ? { shipIdentifierNo: queryString } : { plateNo: queryString }; const params = isShip ? { shipIdentifierNo: queryString } : { plateNo: queryString };
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
request(1, 20, params) request(1, 20, params)
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback( const values = (res.data.data.records || [])
records.map(item => ({ .map(item => (isShip ? item.shipIdentifierNo || item.shipName : item.plateNo))
value: vehicleType === '船舶' ? item.shipIdentifierNo || item.shipName : item.plateNo, .filter(Boolean);
})) this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
); if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
}
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
normalizeRow(row) { normalizeRow(row) {
const values = { ...row }; const values = { ...row };
@@ -421,8 +476,10 @@ export default {
beforeOpen(done, type) { beforeOpen(done, type) {
this.boxType = type; this.boxType = type;
if (type === 'add') { if (type === 'add') {
this.vehicleOptions = [];
this.loadVehicleOptions('');
this.form.vehicleType = '车辆'; this.form.vehicleType = '车辆';
this.form.ocrTemplate = this.ocrTemplateOptions[0]?.value || ''; this.initOcrTemplateOptions('车辆', true);
} }
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
this.isDetailLoading = true; this.isDetailLoading = true;
@@ -432,6 +489,9 @@ export default {
...res.data.data, ...res.data.data,
vehicleType: res.data.data.vehicleType || '车辆', vehicleType: res.data.data.vehicleType || '车辆',
}; };
this.vehicleOptions = [];
this.loadVehicleOptions(this.form.vehicleNo || '');
return this.initOcrTemplateOptions(this.form.vehicleType);
}) })
.finally(() => { .finally(() => {
this.isDetailLoading = false; this.isDetailLoading = false;
@@ -548,7 +608,7 @@ export default {
if (filledCount > 0) { if (filledCount > 0) {
this.$message.success(`保单识别完成,已填充${filledCount}`); this.$message.success(`保单识别完成,已填充${filledCount}`);
} else { } else {
this.$message.warning('保单识别完成,未匹配到模板字段,请手动填写保险信息'); this.$message.warning('未识别到相关字段,请手动填写保险信息');
} }
}) })
.catch(() => { .catch(() => {
+75 -22
View File
@@ -67,15 +67,44 @@
</el-radio-group> </el-radio-group>
</template> </template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions"
:disabled="boxType === 'view'" :disabled="boxType === 'view'"
clearable :loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder" :placeholder="vehicleNoPlaceholder"
value-key="value" clearable
class="maintenance-plan-page__input" filterable
/> remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #address-form> <template #address-form>
<el-input <el-input
@@ -223,6 +252,9 @@ export default {
}, },
selectionList: [], selectionList: [],
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
option: { option: {
height: 'auto', height: 'auto',
calcHeight: 32, calcHeight: 32,
@@ -264,14 +296,17 @@ export default {
{ {
label: '车牌号/船号', label: '车牌号/船号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true,
search: true, search: true,
searchType: 'input',
minWidth: 130, minWidth: 130,
span: 12, span: 12,
placeholder: '输入车牌号/船号查询选择', placeholder: '请选择车牌号/船号',
rules: [ rules: [
{ required: true, message: '请输入车牌号/船号', trigger: 'blur' }, { required: true, message: '请选择车牌号/船号', trigger: 'change' },
{ max: 30, message: '最多 30 个字符', trigger: 'blur' }, { max: 30, message: '最多 30 个字符', trigger: 'change' },
], ],
}, },
{ {
@@ -513,7 +548,7 @@ export default {
}; };
}, },
vehicleNoPlaceholder() { vehicleNoPlaceholder() {
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; return this.form.vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
}, },
ids() { ids() {
let ids = []; let ids = [];
@@ -537,9 +572,11 @@ export default {
}, },
handleVehicleTypeChange(vehicleType) { handleVehicleTypeChange(vehicleType) {
this.updateVehicleType(vehicleType); this.updateVehicleType(vehicleType);
if (!this.form.id && this.form.vehicleNo) { if (!this.form.id) {
this.form.vehicleNo = ''; this.form.vehicleNo = '';
} }
this.vehicleOptions = [];
this.loadVehicleOptions('');
}, },
updateVehicleType(vehicleType) { updateVehicleType(vehicleType) {
const mileageUnit = vehicleType === '船舶' ? '海里' : '公里'; const mileageUnit = vehicleType === '船舶' ? '海里' : '公里';
@@ -554,21 +591,33 @@ export default {
mileageUnitColumn.value = mileageUnit; mileageUnitColumn.value = mileageUnit;
this.form.mileageUnit = mileageUnit; this.form.mileageUnit = mileageUnit;
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const vehicleType = this.form.vehicleType || '车辆'; const vehicleType = this.form.vehicleType || '车辆';
const request = vehicleType === '船舶' ? getShipList : getVehicleList; const isShip = vehicleType === '船舶';
const params = const request = isShip ? getShipList : getVehicleList;
vehicleType === '船舶' ? { shipIdentifierNo: queryString } : { plateNo: queryString }; const params = isShip ? { shipIdentifierNo: queryString } : { plateNo: queryString };
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
request(1, 20, params) request(1, 20, params)
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback( const values = (res.data.data.records || [])
records.map(item => ({ .map(item => (isShip ? item.shipIdentifierNo || item.shipName : item.plateNo))
value: vehicleType === '船舶' ? item.shipIdentifierNo || item.shipName : item.plateNo, .filter(Boolean);
})) this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
); if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
}
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
formatMileage(value, unit) { formatMileage(value, unit) {
if (value === undefined || value === null || value === '') return ''; if (value === undefined || value === null || value === '') return '';
@@ -724,6 +773,8 @@ export default {
this.form.vehicleType = '车辆'; this.form.vehicleType = '车辆';
this.form.mileageUnit = '公里'; this.form.mileageUnit = '公里';
this.updateVehicleType(this.form.vehicleType); this.updateVehicleType(this.form.vehicleType);
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(res => { getDetail(this.form.id).then(res => {
@@ -739,6 +790,8 @@ export default {
} }
this.form = detail; this.form = detail;
this.updateVehicleType(detail.vehicleType); this.updateVehicleType(detail.vehicleType);
this.vehicleOptions = [];
this.loadVehicleOptions(detail.vehicleNo || '');
}); });
} }
done(); done();
+75 -23
View File
@@ -60,15 +60,44 @@
</el-button> </el-button>
</template> </template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions"
:disabled="boxType === 'view'" :disabled="boxType === 'view'"
clearable :loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder" :placeholder="vehicleNoPlaceholder"
value-key="value" clearable
class="maintenance-record-page__input" filterable
/> remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #address-form> <template #address-form>
<el-input <el-input
@@ -197,6 +226,9 @@ export default {
}, },
selectionList: [], selectionList: [],
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
option: { option: {
height: 'auto', height: 'auto',
calcHeight: 32, calcHeight: 32,
@@ -237,15 +269,17 @@ export default {
{ {
label: '车牌号/船号', label: '车牌号/船号',
prop: 'vehicleNo', prop: 'vehicleNo',
type: 'select',
slot: true, slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchType: 'input',
minWidth: 130, minWidth: 130,
span: 12, span: 12,
placeholder: '输入车牌号/船号查询选择', placeholder: '请选择车牌号/船号',
rules: [ rules: [
{ required: true, message: '请输入车牌号/船号', trigger: 'blur' }, { required: true, message: '请选择车牌号/船号', trigger: 'change' },
{ max: 30, message: '最多 30 个字符', trigger: 'blur' }, { max: 30, message: '最多 30 个字符', trigger: 'change' },
], ],
}, },
{ {
@@ -487,7 +521,7 @@ export default {
}; };
}, },
vehicleNoPlaceholder() { vehicleNoPlaceholder() {
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; return this.form.vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
}, },
ids() { ids() {
let ids = []; let ids = [];
@@ -524,30 +558,44 @@ export default {
const mileageColumn = this.findColumn(this.option.column, 'mileage'); const mileageColumn = this.findColumn(this.option.column, 'mileage');
const mileageUnitColumn = this.findColumn(this.option.column, 'mileageUnit'); const mileageUnitColumn = this.findColumn(this.option.column, 'mileageUnit');
vehicleNoColumn.placeholder = vehicleNoColumn.placeholder =
vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
vehicleTypeColumn.disabled = Boolean(this.form.id); vehicleTypeColumn.disabled = Boolean(this.form.id);
mileageColumn.label = `里程/航程数(${mileageUnit}`; mileageColumn.label = `里程/航程数(${mileageUnit}`;
mileageUnitColumn.value = mileageUnit; mileageUnitColumn.value = mileageUnit;
this.form.mileageUnit = mileageUnit; this.form.mileageUnit = mileageUnit;
if (!this.isDetailLoading && oldValue && vehicleType !== oldValue && this.form.vehicleNo) { if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) {
this.form.vehicleNo = ''; this.form.vehicleNo = '';
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const vehicleType = this.form.vehicleType || '车辆'; const vehicleType = this.form.vehicleType || '车辆';
const request = vehicleType === '船舶' ? getShipList : getVehicleList; const isShip = vehicleType === '船舶';
const params = const request = isShip ? getShipList : getVehicleList;
vehicleType === '船舶' ? { shipIdentifierNo: queryString } : { plateNo: queryString }; const params = isShip ? { shipIdentifierNo: queryString } : { plateNo: queryString };
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
request(1, 20, params) request(1, 20, params)
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback( const values = (res.data.data.records || [])
records.map(item => ({ .map(item => (isShip ? item.shipIdentifierNo || item.shipName : item.plateNo))
value: vehicleType === '船舶' ? item.shipIdentifierNo || item.shipName : item.plateNo, .filter(Boolean);
})) this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
); if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
}
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
formatMileage(value, unit) { formatMileage(value, unit) {
if (this.normalizeMileageValue(value) === null) return ''; if (this.normalizeMileageValue(value) === null) return '';
@@ -681,6 +729,8 @@ export default {
mileageUnit: '公里', mileageUnit: '公里',
}; };
this.updateVehicleType('车辆'); this.updateVehicleType('车辆');
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
this.isDetailLoading = true; this.isDetailLoading = true;
@@ -693,6 +743,8 @@ export default {
detail.mileage = this.normalizeMileageValue(detail.mileage); detail.mileage = this.normalizeMileageValue(detail.mileage);
this.form = detail; this.form = detail;
this.updateVehicleType(detail.vehicleType); this.updateVehicleType(detail.vehicleType);
this.vehicleOptions = [];
this.loadVehicleOptions(detail.vehicleNo || '');
}) })
.finally(() => { .finally(() => {
this.isDetailLoading = false; this.isDetailLoading = false;
+61 -11
View File
@@ -72,15 +72,44 @@
<span>{{ formatMileage(row.totalMileage) }}</span> <span>{{ formatMileage(row.totalMileage) }}</span>
</template> </template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions" :disabled="boxType === 'view'"
:disabled="Boolean(form.id)" :loading="vehicleOptionsLoading"
placeholder="请选择车牌号"
clearable clearable
placeholder="输入车牌号模糊查询选择" filterable
value-key="value" remote
class="mileage-record-page__input" :remote-method="loadVehicleOptions"
/> @visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
placeholder="请选择车牌号"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #previousMonthMileageForm> <template #previousMonthMileageForm>
<el-input <el-input
@@ -213,6 +242,9 @@ export default {
}, },
selectionList: [], selectionList: [],
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
data: [], data: [],
}; };
}, },
@@ -251,13 +283,27 @@ export default {
column.dicData = res.data.data; column.dicData = res.data.data;
}); });
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
getVehicleList(1, 20, { plateNo: queryString }) getVehicleList(1, 20, { plateNo: queryString })
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback(records.map(item => ({ value: item.plateNo }))); const values = (res.data.data.records || []).map(item => item.plateNo).filter(Boolean);
this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
}
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
formatMileage(value) { formatMileage(value) {
if (this.isEmpty(value)) { if (this.isEmpty(value)) {
@@ -446,6 +492,8 @@ export default {
const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo'); const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo');
vehicleNoColumn.disabled = type !== 'add'; vehicleNoColumn.disabled = type !== 'add';
if (type === 'add') { if (type === 'add') {
this.vehicleOptions = [];
this.loadVehicleOptions('');
this.form.vehicleType = '车辆'; this.form.vehicleType = '车辆';
this.form.mileageUnit = '公里'; this.form.mileageUnit = '公里';
} }
@@ -456,6 +504,8 @@ export default {
detail.vehicleType = '车辆'; detail.vehicleType = '车辆';
detail.mileageUnit = '公里'; detail.mileageUnit = '公里';
this.form = detail; this.form = detail;
this.vehicleOptions = [];
this.loadVehicleOptions(this.form.vehicleNo || '');
}); });
} }
done(); done();
+70 -20
View File
@@ -60,15 +60,44 @@
</el-button> </el-button>
</template> </template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions"
:disabled="boxType === 'view'" :disabled="boxType === 'view'"
clearable :loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder" :placeholder="vehicleNoPlaceholder"
value-key="value" clearable
class="oil-electric-record-page__input" filterable
/> remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #quantityForm> <template #quantityForm>
<el-input <el-input
@@ -171,6 +200,9 @@ export default {
}, },
selectionList: [], selectionList: [],
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
data: [], data: [],
}; };
}, },
@@ -192,7 +224,7 @@ export default {
}; };
}, },
vehicleNoPlaceholder() { vehicleNoPlaceholder() {
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; return this.form.vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
}, },
ids() { ids() {
const ids = []; const ids = [];
@@ -229,9 +261,11 @@ export default {
updateVehicleType(vehicleType, oldValue) { updateVehicleType(vehicleType, oldValue) {
const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo'); const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo');
vehicleNoColumn.placeholder = vehicleNoColumn.placeholder =
vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
if (!this.isDetailLoading && oldValue && vehicleType !== oldValue && this.form.vehicleNo) { if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) {
this.form.vehicleNo = ''; this.form.vehicleNo = '';
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
}, },
updateFeeType(feeType) { updateFeeType(feeType) {
@@ -241,21 +275,33 @@ export default {
this.form.oilProduct = undefined; this.form.oilProduct = undefined;
} }
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const vehicleType = this.form.vehicleType || '车辆'; const vehicleType = this.form.vehicleType || '车辆';
const request = vehicleType === '船舶' ? getShipList : getVehicleList; const isShip = vehicleType === '船舶';
const params = const request = isShip ? getShipList : getVehicleList;
vehicleType === '船舶' ? { shipIdentifierNo: queryString } : { plateNo: queryString }; const params = isShip ? { shipIdentifierNo: queryString } : { plateNo: queryString };
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
request(1, 20, params) request(1, 20, params)
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback( const values = (res.data.data.records || [])
records.map(item => ({ .map(item => (isShip ? item.shipIdentifierNo || item.shipName : item.plateNo))
value: vehicleType === '船舶' ? item.shipIdentifierNo || item.shipName : item.plateNo, .filter(Boolean);
})) this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
); if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
}
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
formatAttachments(value) { formatAttachments(value) {
if (!value) return ''; if (!value) return '';
@@ -415,6 +461,8 @@ export default {
if (type === 'add') { if (type === 'add') {
this.form = { vehicleType: '车辆', feeType: '加油', dataSource: '手工录入' }; this.form = { vehicleType: '车辆', feeType: '加油', dataSource: '手工录入' };
this.updateVehicleType('车辆'); this.updateVehicleType('车辆');
this.vehicleOptions = [];
this.loadVehicleOptions('');
this.updateFeeType('加油'); this.updateFeeType('加油');
} }
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
@@ -426,6 +474,8 @@ export default {
detail.vehicleType = detail.vehicleType || '车辆'; detail.vehicleType = detail.vehicleType || '车辆';
this.form = detail; this.form = detail;
this.updateVehicleType(detail.vehicleType); this.updateVehicleType(detail.vehicleType);
this.vehicleOptions = [];
this.loadVehicleOptions(detail.vehicleNo || '');
this.updateFeeType(detail.feeType); this.updateFeeType(detail.feeType);
}) })
.finally(() => { .finally(() => {
+81 -20
View File
@@ -60,15 +60,44 @@
</el-button> </el-button>
</template> </template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions"
:disabled="boxType === 'view'" :disabled="boxType === 'view'"
clearable :loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder" :placeholder="vehicleNoPlaceholder"
value-key="value" clearable
class="other-expense-record-page__input" filterable
/> remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #amountForm> <template #amountForm>
<el-input <el-input
@@ -108,6 +137,7 @@ import { add, getDetail, getList, remove, update } from '@/api/vehicle/other-exp
import { getList as getVehicleList } from '@/api/transportCapacity/transport-vehicle'; import { getList as getVehicleList } from '@/api/transportCapacity/transport-vehicle';
import { getList as getShipList } from '@/api/transportCapacity/transport-ship'; import { getList as getShipList } from '@/api/transportCapacity/transport-ship';
import { getDeptTree } from '@/api/system/dept'; import { getDeptTree } from '@/api/system/dept';
import { getDictionary } from '@/api/system/dictbiz';
import { exportBlob } from '@/api/common'; import { exportBlob } from '@/api/common';
import { downloadXls } from '@/utils/util'; import { downloadXls } from '@/utils/util';
import { openImportDialog } from '@/utils/import-excel'; import { openImportDialog } from '@/utils/import-excel';
@@ -140,11 +170,15 @@ export default {
}, },
selectionList: [], selectionList: [],
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
data: [], data: [],
}; };
}, },
created() { created() {
this.initDeptTree(); this.initDeptTree();
this.initExpenseTypeOptions();
}, },
computed: { computed: {
...mapGetters(['permission', 'userInfo']), ...mapGetters(['permission', 'userInfo']),
@@ -161,7 +195,7 @@ export default {
}; };
}, },
vehicleNoPlaceholder() { vehicleNoPlaceholder() {
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; return this.form.vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
}, },
ids() { ids() {
const ids = []; const ids = [];
@@ -189,29 +223,52 @@ export default {
column.dicData = res.data.data; column.dicData = res.data.data;
}); });
}, },
initExpenseTypeOptions() {
getDictionary({ code: 'other_fee_category' }).then(res => {
const column = this.findColumn(this.option.column, 'expenseType');
column.dicData = (res.data.data || []).map(item => ({
label: item.dictValue,
value: item.dictValue,
}));
});
},
updateVehicleType(vehicleType, oldValue) { updateVehicleType(vehicleType, oldValue) {
const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo'); const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo');
vehicleNoColumn.placeholder = vehicleNoColumn.placeholder =
vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
if (!this.isDetailLoading && oldValue && vehicleType !== oldValue && this.form.vehicleNo) { if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) {
this.form.vehicleNo = ''; this.form.vehicleNo = '';
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const vehicleType = this.form.vehicleType || '车辆'; const vehicleType = this.form.vehicleType || '车辆';
const request = vehicleType === '船舶' ? getShipList : getVehicleList; const isShip = vehicleType === '船舶';
const params = const request = isShip ? getShipList : getVehicleList;
vehicleType === '船舶' ? { shipIdentifierNo: queryString } : { plateNo: queryString }; const params = isShip ? { shipIdentifierNo: queryString } : { plateNo: queryString };
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
request(1, 20, params) request(1, 20, params)
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback( const values = (res.data.data.records || [])
records.map(item => ({ .map(item => (isShip ? item.shipIdentifierNo || item.shipName : item.plateNo))
value: vehicleType === '船舶' ? item.shipIdentifierNo || item.shipName : item.plateNo, .filter(Boolean);
})) this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
); if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
}
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
formatAttachments(value) { formatAttachments(value) {
if (!value) return ''; if (!value) return '';
@@ -369,6 +426,8 @@ export default {
dataSource: '手工录入', dataSource: '手工录入',
}; };
this.updateVehicleType('车辆'); this.updateVehicleType('车辆');
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
this.isDetailLoading = true; this.isDetailLoading = true;
@@ -379,6 +438,8 @@ export default {
detail.vehicleType = detail.vehicleType || '车辆'; detail.vehicleType = detail.vehicleType || '车辆';
this.form = detail; this.form = detail;
this.updateVehicleType(detail.vehicleType); this.updateVehicleType(detail.vehicleType);
this.vehicleOptions = [];
this.loadVehicleOptions(detail.vehicleNo || '');
}) })
.finally(() => { .finally(() => {
this.isDetailLoading = false; this.isDetailLoading = false;
+60 -10
View File
@@ -60,15 +60,44 @@
</el-button> </el-button>
</template> </template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions"
:disabled="boxType === 'view'" :disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
placeholder="请选择车牌号"
clearable clearable
placeholder="输入车牌号查询选择" filterable
value-key="value" remote
class="tire-replacement-record-page__input" :remote-method="loadVehicleOptions"
/> @visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
placeholder="请选择车牌号"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #tireQuantityForm> <template #tireQuantityForm>
<el-input <el-input
@@ -158,6 +187,9 @@ export default {
}, },
selectionList: [], selectionList: [],
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
data: [], data: [],
}; };
}, },
@@ -196,13 +228,27 @@ export default {
column.dicData = res.data.data; column.dicData = res.data.data;
}); });
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
getVehicleList(1, 20, { plateNo: queryString }) getVehicleList(1, 20, { plateNo: queryString })
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback(records.map(item => ({ value: item.plateNo }))); const values = (res.data.data.records || []).map(item => item.plateNo).filter(Boolean);
this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
}
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
formatAttachments(value) { formatAttachments(value) {
if (!value) return ''; if (!value) return '';
@@ -339,6 +385,8 @@ export default {
beforeOpen(done, type) { beforeOpen(done, type) {
this.boxType = type; this.boxType = type;
if (type === 'add') { if (type === 'add') {
this.vehicleOptions = [];
this.loadVehicleOptions('');
this.form = {}; this.form = {};
} }
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
@@ -346,6 +394,8 @@ export default {
const detail = res.data.data; const detail = res.data.data;
detail.attachments = this.parseAttachments(detail.attachments); detail.attachments = this.parseAttachments(detail.attachments);
this.form = detail; this.form = detail;
this.vehicleOptions = [];
this.loadVehicleOptions(this.form.vehicleNo || '');
}); });
} }
done(); done();
+70 -20
View File
@@ -60,15 +60,44 @@
</el-button> </el-button>
</template> </template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions"
:disabled="boxType === 'view'" :disabled="boxType === 'view'"
clearable :loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder" :placeholder="vehicleNoPlaceholder"
value-key="value" clearable
class="transport-change-record-page__input" filterable
/> remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #attachments="{ row }"> <template #attachments="{ row }">
<span>{{ formatAttachments(row.attachments) }}</span> <span>{{ formatAttachments(row.attachments) }}</span>
@@ -134,6 +163,9 @@ export default {
}, },
selectionList: [], selectionList: [],
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
data: [], data: [],
}; };
}, },
@@ -155,7 +187,7 @@ export default {
}; };
}, },
vehicleNoPlaceholder() { vehicleNoPlaceholder() {
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; return this.form.vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
}, },
ids() { ids() {
const ids = []; const ids = [];
@@ -186,26 +218,40 @@ export default {
updateVehicleType(vehicleType, oldValue) { updateVehicleType(vehicleType, oldValue) {
const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo'); const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo');
vehicleNoColumn.placeholder = vehicleNoColumn.placeholder =
vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
if (!this.isDetailLoading && oldValue && vehicleType !== oldValue && this.form.vehicleNo) { if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) {
this.form.vehicleNo = ''; this.form.vehicleNo = '';
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const vehicleType = this.form.vehicleType || '车辆'; const vehicleType = this.form.vehicleType || '车辆';
const request = vehicleType === '船舶' ? getShipList : getVehicleList; const isShip = vehicleType === '船舶';
const params = const request = isShip ? getShipList : getVehicleList;
vehicleType === '船舶' ? { shipIdentifierNo: queryString } : { plateNo: queryString }; const params = isShip ? { shipIdentifierNo: queryString } : { plateNo: queryString };
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
request(1, 20, params) request(1, 20, params)
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback( const values = (res.data.data.records || [])
records.map(item => ({ .map(item => (isShip ? item.shipIdentifierNo || item.shipName : item.plateNo))
value: vehicleType === '船舶' ? item.shipIdentifierNo || item.shipName : item.plateNo, .filter(Boolean);
})) this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
); if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
}
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
formatAttachments(value) { formatAttachments(value) {
if (!value) return ''; if (!value) return '';
@@ -333,6 +379,8 @@ export default {
if (type === 'add') { if (type === 'add') {
this.form = { vehicleType: '车辆' }; this.form = { vehicleType: '车辆' };
this.updateVehicleType('车辆'); this.updateVehicleType('车辆');
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
this.isDetailLoading = true; this.isDetailLoading = true;
@@ -343,6 +391,8 @@ export default {
detail.vehicleType = detail.vehicleType || '车辆'; detail.vehicleType = detail.vehicleType || '车辆';
this.form = detail; this.form = detail;
this.updateVehicleType(detail.vehicleType); this.updateVehicleType(detail.vehicleType);
this.vehicleOptions = [];
this.loadVehicleOptions(detail.vehicleNo || '');
}) })
.finally(() => { .finally(() => {
this.isDetailLoading = false; this.isDetailLoading = false;
+70 -20
View File
@@ -60,15 +60,44 @@
</el-button> </el-button>
</template> </template>
<template #vehicleNoForm> <template #vehicleNoForm>
<el-autocomplete <el-select
v-model="form.vehicleNo" v-model="form.vehicleNo"
:fetch-suggestions="fetchVehicleOptions"
:disabled="boxType === 'view'" :disabled="boxType === 'view'"
clearable :loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder" :placeholder="vehicleNoPlaceholder"
value-key="value" clearable
class="violation-record-page__input" filterable
/> remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #vehicleNo-form>
<el-select
v-model="form.vehicleNo"
:disabled="boxType === 'view'"
:loading="vehicleOptionsLoading"
:placeholder="vehicleNoPlaceholder"
clearable
filterable
remote
:remote-method="loadVehicleOptions"
@visible-change="handleVehicleSelectVisible"
>
<el-option
v-for="item in vehicleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
<template #driverNameForm> <template #driverNameForm>
<el-autocomplete <el-autocomplete
@@ -204,6 +233,9 @@ export default {
}, },
selectionList: [], selectionList: [],
boxType: '', boxType: '',
vehicleOptions: [],
vehicleOptionsLoading: false,
vehicleOptionsRequestId: 0,
data: [], data: [],
}; };
}, },
@@ -226,7 +258,7 @@ export default {
}; };
}, },
vehicleNoPlaceholder() { vehicleNoPlaceholder() {
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; return this.form.vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
}, },
ids() { ids() {
const ids = []; const ids = [];
@@ -284,7 +316,7 @@ export default {
const typeColumn = this.findColumn(this.option.column, 'violationType'); const typeColumn = this.findColumn(this.option.column, 'violationType');
const itemColumn = this.findColumn(this.option.column, 'violationItem'); const itemColumn = this.findColumn(this.option.column, 'violationItem');
vehicleNoColumn.placeholder = vehicleNoColumn.placeholder =
vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择'; vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
driverColumn.label = vehicleType === '船舶' ? '船长' : '驾驶人'; driverColumn.label = vehicleType === '船舶' ? '船长' : '驾驶人';
typeColumn.display = vehicleType !== '船舶'; typeColumn.display = vehicleType !== '船舶';
itemColumn.display = vehicleType === '船舶'; itemColumn.display = vehicleType === '船舶';
@@ -303,6 +335,8 @@ export default {
if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) { if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) {
this.form.vehicleNo = ''; this.form.vehicleNo = '';
this.form.driverName = ''; this.form.driverName = '';
this.vehicleOptions = [];
this.loadVehicleOptions('');
} }
if (vehicleType === '船舶') { if (vehicleType === '船舶') {
this.form.violationType = undefined; this.form.violationType = undefined;
@@ -317,21 +351,33 @@ export default {
this.form.processResult = undefined; this.form.processResult = undefined;
} }
}, },
fetchVehicleOptions(queryString, callback) { handleVehicleSelectVisible(visible) {
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
},
loadVehicleOptions(queryString = '') {
const vehicleType = this.form.vehicleType || '车辆'; const vehicleType = this.form.vehicleType || '车辆';
const request = vehicleType === '船舶' ? getShipList : getVehicleList; const isShip = vehicleType === '船舶';
const params = const request = isShip ? getShipList : getVehicleList;
vehicleType === '船舶' ? { shipIdentifierNo: queryString } : { plateNo: queryString }; const params = isShip ? { shipIdentifierNo: queryString } : { plateNo: queryString };
const requestId = ++this.vehicleOptionsRequestId;
this.vehicleOptionsLoading = true;
request(1, 20, params) request(1, 20, params)
.then(res => { .then(res => {
const records = res.data.data.records || []; if (requestId !== this.vehicleOptionsRequestId) return;
callback( const values = (res.data.data.records || [])
records.map(item => ({ .map(item => (isShip ? item.shipIdentifierNo || item.shipName : item.plateNo))
value: vehicleType === '船舶' ? item.shipIdentifierNo || item.shipName : item.plateNo, .filter(Boolean);
})) this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
); if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
}
}) })
.catch(() => callback([])); .catch(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
})
.finally(() => {
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
});
}, },
fetchDriverOptions(queryString, callback) { fetchDriverOptions(queryString, callback) {
getDriverList(1, 20, { driverName: queryString }) getDriverList(1, 20, { driverName: queryString })
@@ -418,7 +464,7 @@ export default {
row.violationTime && row.violationTime &&
new Date(row.violationTime.replace(/-/g, '/')).getTime() > Date.now() new Date(row.violationTime.replace(/-/g, '/')).getTime() > Date.now()
) { ) {
this.$message.warning('时间不能超过当前时间'); this.$message.warning('日期不能超过当前时间');
return false; return false;
} }
if (Number(row.fineAmount) < 0) { if (Number(row.fineAmount) < 0) {
@@ -512,6 +558,8 @@ export default {
attachments: [], attachments: [],
}; };
this.updateVehicleTypeDisplays('车辆'); this.updateVehicleTypeDisplays('车辆');
this.vehicleOptions = [];
this.loadVehicleOptions('');
this.updateProcessResultDisplay('已处理'); this.updateProcessResultDisplay('已处理');
} }
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
@@ -524,6 +572,8 @@ export default {
detail.processStatus = detail.processStatus || '未处理'; detail.processStatus = detail.processStatus || '未处理';
this.form = detail; this.form = detail;
this.updateVehicleTypeDisplays(detail.vehicleType); this.updateVehicleTypeDisplays(detail.vehicleType);
this.vehicleOptions = [];
this.loadVehicleOptions(detail.vehicleNo || '');
this.updateProcessResultDisplay(detail.processStatus); this.updateProcessResultDisplay(detail.processStatus);
}) })
.finally(() => { .finally(() => {