1. 修改真机运行车辆信息不回显的问题
parent
466cd0c874
commit
0fa01e3826
|
@ -213,48 +213,64 @@ export default {
|
||||||
this.VEHICLE_TYPE_LIST = TYPE_LIST;
|
this.VEHICLE_TYPE_LIST = TYPE_LIST;
|
||||||
},
|
},
|
||||||
async getData() {
|
async getData() {
|
||||||
const resData = await getVehiclemessageView({VEHICLE_ID: this.$route.query.VEHICLE_ID});
|
const resData = await getVehiclemessageView({VEHICLE_ID: this.VEHICLE_ID});
|
||||||
this.form = resData.pd;
|
// 使用 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());
|
const matchedItem = this.VEHICLE_LICENSE_PLATE_TYPE_LIST.find(item => item.id === resData.pd.LICENCE_TYPE.toString());
|
||||||
if (matchedItem) {
|
if (matchedItem) {
|
||||||
this.form.LICENCE_TYPE_NAME = matchedItem.name;
|
this.$set(this.form, 'LICENCE_TYPE_NAME', matchedItem.name);
|
||||||
this.form.LICENCE_TYPE = resData.pd.LICENCE_TYPE.toString();
|
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());
|
const vehicleType = this.VEHICLE_TYPE_LIST.find(item => item.id === resData.pd.VEHICLE_TYPE.toString());
|
||||||
if (vehicleType) {
|
if (vehicleType) {
|
||||||
this.form.VEHICLE_TYPE_NAME = vehicleType.name;
|
this.$set(this.form, 'VEHICLE_TYPE_NAME', vehicleType.name);
|
||||||
this.form.VEHICLE_TYPE = resData.pd.VEHICLE_TYPE.toString();
|
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());
|
const vehiclePort = this.VEHICLE_PORT_LIST.find(item => item.id === resData.pd.portId.toString());
|
||||||
if (vehiclePort) {
|
if (vehiclePort) {
|
||||||
this.form.portName = vehiclePort.name;
|
this.$set(this.form, 'portName', vehiclePort.name);
|
||||||
this.form.portId = resData.pd.portId.toString();
|
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());
|
const vehicleOwnership = this.VEHICLE_BELONG_TYPE_LIST.find(item => item.id === resData.pd.VEHICLE_BELONG_TYPE.toString());
|
||||||
if (vehicleOwnership) {
|
if (vehicleOwnership) {
|
||||||
this.form.VEHICLE_BELONG_TYPE = vehicleOwnership.id;
|
this.$set(this.form, 'VEHICLE_BELONG_TYPE', vehicleOwnership.id);
|
||||||
this.form.VEHICLE_BELONG_TYPE_NAME = vehicleOwnership.name;
|
this.$set(this.form, 'VEHICLE_BELONG_TYPE_NAME', vehicleOwnership.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理审批人
|
||||||
const auditor = this.userList.find(item => item.userId === resData.pd.QY_AUDITOR);
|
const auditor = this.userList.find(item => item.userId === resData.pd.QY_AUDITOR);
|
||||||
if (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.$set(this.form, 'drivingImgFiles', []);
|
||||||
}
|
if (resData.pd.drivingImgs && Array.isArray(resData.pd.drivingImgs)) {
|
||||||
this.form.drivingImgFiles.push({
|
resData.pd.drivingImgs.forEach((img, index) => {
|
||||||
url: this.$store.state.filePath + resData.pd.drivingImgs[i].filepath,
|
this.$set(this.form.drivingImgFiles, index, {
|
||||||
...resData.pd.drivingImgs[i],
|
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.$set(this.form, 'vehicleImgFiles', []);
|
||||||
}
|
if (resData.pd.vehicleImgs && Array.isArray(resData.pd.vehicleImgs)) {
|
||||||
this.form.vehicleImgFiles.push({
|
resData.pd.vehicleImgs.forEach((img, index) => {
|
||||||
url: this.$store.state.filePath + resData.pd.vehicleImgs[i].filepath,
|
this.$set(this.form.vehicleImgFiles, index, {
|
||||||
...resData.pd.vehicleImgs[i],
|
url: this.$store.state.filePath + img.filepath,
|
||||||
|
...img,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -297,8 +313,8 @@ export default {
|
||||||
const params = {
|
const params = {
|
||||||
...this.form,
|
...this.form,
|
||||||
DEPARTMENT_ID: this.userInfo.DEPARTMENT_ID,
|
DEPARTMENT_ID: this.userInfo.DEPARTMENT_ID,
|
||||||
USER_ID: this.form.VEHICLE_BELONG_TYPE == 1 ? '' : this.userInfo.USER_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_NAME: this.form.VEHICLE_BELONG_TYPE === 1 ? '' : this.userInfo.NAME,
|
||||||
VEHICLE_DEPARTMENT_ID: this.userInfo.DEPARTMENT_ID,
|
VEHICLE_DEPARTMENT_ID: this.userInfo.DEPARTMENT_ID,
|
||||||
VEHICLE_DEPARTMENT_NAME: this.userInfo.DEPARTMENT_NAME,
|
VEHICLE_DEPARTMENT_NAME: this.userInfo.DEPARTMENT_NAME,
|
||||||
vehicleImgs: JSON.stringify(vehicleImgs),
|
vehicleImgs: JSON.stringify(vehicleImgs),
|
||||||
|
|
|
@ -158,8 +158,7 @@ export default {
|
||||||
}
|
}
|
||||||
const TYPE_MAP = new Map(TYPE_LIST.map(item => [item.id, item.name]));
|
const TYPE_MAP = new Map(TYPE_LIST.map(item => [item.id, item.name]));
|
||||||
// 如果你需要将 Map 转换为普通对象
|
// 如果你需要将 Map 转换为普通对象
|
||||||
const TYPE_OBJECT_MAP = Object.fromEntries(TYPE_MAP);
|
this.VEHICLE_TYPE_MAP = Object.fromEntries(TYPE_MAP);
|
||||||
this.VEHICLE_TYPE_MAP = TYPE_OBJECT_MAP;
|
|
||||||
console.log(this.VEHICLE_TYPE_MAP);
|
console.log(this.VEHICLE_TYPE_MAP);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue