1. 修改真机运行车辆信息不回显的问题

dev-2.0
Shan Ao 2025-09-15 09:40:54 +08:00
parent 466cd0c874
commit 0fa01e3826
2 changed files with 44 additions and 29 deletions

View File

@ -213,48 +213,64 @@ export default {
this.VEHICLE_TYPE_LIST = TYPE_LIST;
},
async getData() {
const resData = await getVehiclemessageView({VEHICLE_ID: this.$route.query.VEHICLE_ID});
this.form = resData.pd;
const resData = await getVehiclemessageView({VEHICLE_ID: this.VEHICLE_ID});
// 使 this.$set
Object.keys(resData.pd).forEach(key => {
this.$set(this.form, key, resData.pd[key]);
});
//
const matchedItem = this.VEHICLE_LICENSE_PLATE_TYPE_LIST.find(item => item.id === resData.pd.LICENCE_TYPE.toString());
if (matchedItem) {
this.form.LICENCE_TYPE_NAME = matchedItem.name;
this.form.LICENCE_TYPE = resData.pd.LICENCE_TYPE.toString();
this.$set(this.form, 'LICENCE_TYPE_NAME', matchedItem.name);
this.$set(this.form, 'LICENCE_TYPE', resData.pd.LICENCE_TYPE.toString());
}
//
const vehicleType = this.VEHICLE_TYPE_LIST.find(item => item.id === resData.pd.VEHICLE_TYPE.toString());
if (vehicleType) {
this.form.VEHICLE_TYPE_NAME = vehicleType.name;
this.form.VEHICLE_TYPE = resData.pd.VEHICLE_TYPE.toString();
this.$set(this.form, 'VEHICLE_TYPE_NAME', vehicleType.name);
this.$set(this.form, 'VEHICLE_TYPE', resData.pd.VEHICLE_TYPE.toString());
}
//
const vehiclePort = this.VEHICLE_PORT_LIST.find(item => item.id === resData.pd.portId.toString());
if (vehiclePort) {
this.form.portName = vehiclePort.name;
this.form.portId = resData.pd.portId.toString();
this.$set(this.form, 'portName', vehiclePort.name);
this.$set(this.form, 'portId', resData.pd.portId.toString());
}
//
const vehicleOwnership = this.VEHICLE_BELONG_TYPE_LIST.find(item => item.id === resData.pd.VEHICLE_BELONG_TYPE.toString());
if (vehicleOwnership) {
this.form.VEHICLE_BELONG_TYPE = vehicleOwnership.id;
this.form.VEHICLE_BELONG_TYPE_NAME = vehicleOwnership.name;
this.$set(this.form, 'VEHICLE_BELONG_TYPE', vehicleOwnership.id);
this.$set(this.form, 'VEHICLE_BELONG_TYPE_NAME', vehicleOwnership.name);
}
//
const auditor = this.userList.find(item => item.userId === resData.pd.QY_AUDITOR);
if (auditor) {
this.form.QY_AUDITOR_NAME = auditor.name;
this.$set(this.form, 'QY_AUDITOR_NAME', auditor.name);
}
for (let i = 0; i < resData.pd.drivingImgs.length; i++) {
if (!Array.isArray(this.form.drivingImgFiles)) {
this.$set(this.form, "drivingImgFiles", []);
}
this.form.drivingImgFiles.push({
url: this.$store.state.filePath + resData.pd.drivingImgs[i].filepath,
...resData.pd.drivingImgs[i],
//
this.$set(this.form, 'drivingImgFiles', []);
if (resData.pd.drivingImgs && Array.isArray(resData.pd.drivingImgs)) {
resData.pd.drivingImgs.forEach((img, index) => {
this.$set(this.form.drivingImgFiles, index, {
url: this.$store.state.filePath + img.filepath,
...img,
});
});
}
for (let i = 0; i < resData.pd.vehicleImgs.length; i++) {
if (!Array.isArray(this.form.vehicleImgFiles)) {
this.$set(this.form, "vehicleImgFiles", []);
}
this.form.vehicleImgFiles.push({
url: this.$store.state.filePath + resData.pd.vehicleImgs[i].filepath,
...resData.pd.vehicleImgs[i],
//
this.$set(this.form, 'vehicleImgFiles', []);
if (resData.pd.vehicleImgs && Array.isArray(resData.pd.vehicleImgs)) {
resData.pd.vehicleImgs.forEach((img, index) => {
this.$set(this.form.vehicleImgFiles, index, {
url: this.$store.state.filePath + img.filepath,
...img,
});
});
}
},
@ -297,8 +313,8 @@ export default {
const params = {
...this.form,
DEPARTMENT_ID: this.userInfo.DEPARTMENT_ID,
USER_ID: this.form.VEHICLE_BELONG_TYPE == 1 ? '' : this.userInfo.USER_ID,
USER_NAME: this.form.VEHICLE_BELONG_TYPE == 1 ? '' : this.userInfo.NAME,
USER_ID: this.form.VEHICLE_BELONG_TYPE === 1 ? '' : this.userInfo.USER_ID,
USER_NAME: this.form.VEHICLE_BELONG_TYPE === 1 ? '' : this.userInfo.NAME,
VEHICLE_DEPARTMENT_ID: this.userInfo.DEPARTMENT_ID,
VEHICLE_DEPARTMENT_NAME: this.userInfo.DEPARTMENT_NAME,
vehicleImgs: JSON.stringify(vehicleImgs),

View File

@ -158,8 +158,7 @@ export default {
}
const TYPE_MAP = new Map(TYPE_LIST.map(item => [item.id, item.name]));
// Map
const TYPE_OBJECT_MAP = Object.fromEntries(TYPE_MAP);
this.VEHICLE_TYPE_MAP = TYPE_OBJECT_MAP;
this.VEHICLE_TYPE_MAP = Object.fromEntries(TYPE_MAP);
console.log(this.VEHICLE_TYPE_MAP);
},
}