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

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