master
lion 4 days ago
parent 2932df86ac
commit 2b925b5af8

@ -419,6 +419,7 @@ export default {
visitShow: false, visitShow: false,
visitData: null, visitData: null,
vehicleImages: [], // vehicleImages: [], //
originalVehicleImageIds: [], // ID
remarkValue: "", // remarkValue: "", //
personNoValue: "", // personNoValue: "", //
uploading: false, // uploading: false, //
@ -713,6 +714,11 @@ export default {
}); });
}); });
this.vehicleImages = arr; this.vehicleImages = arr;
// ID
this.originalVehicleImageIds = arr.map((item) => item.id);
} else {
this.vehicleImages = [];
this.originalVehicleImageIds = [];
} }
// //
this.codeForm.code = visitor.code; this.codeForm.code = visitor.code;
@ -814,6 +820,7 @@ export default {
this.visitData = null; this.visitData = null;
// //
this.vehicleImages = []; this.vehicleImages = [];
this.originalVehicleImageIds = [];
this.remarkValue = ""; this.remarkValue = "";
this.personNoValue = ""; this.personNoValue = "";
this.uploading = false; this.uploading = false;
@ -950,43 +957,69 @@ export default {
// - action // - action
this.updating = true; //
console.log("this.visitData", this.visitData); const performUpdate = async (alsoCancel) => {
// return this.updating = true;
try { try {
const updateParams = { const updateParams = {
...this.visitData, ...this.visitData,
id: this.visitData.id, id: this.visitData.id,
remark: this.remarkValue, remark: this.remarkValue,
person_no: this.personNoValue, person_no: this.personNoValue,
// follw_people follw_people_person_no // follw_people follw_people_person_no
}; };
// type==3
if (this.visitData.type == 3) {
updateParams.vehicle_images = (this.vehicleImages || [])
.filter((img) => img && img.id)
.map((img) => img.id);
}
await this.$u.api.visitUpdate(updateParams);
uni.showToast({
title: "更新成功",
icon: "success",
});
// type==3 if (alsoCancel) {
if (this.visitData.type == 3) { //
updateParams.vehicle_images = this.vehicleImages.map((img) => img.id); this.cancelCode();
setTimeout(() => {
this.closeVisitModal();
}, 800);
}
} catch (error) {
console.error("更新失败:", error);
uni.showToast({
title: "更新失败",
icon: "none",
});
} finally {
this.updating = false;
} }
};
const res = await this.$u.api.visitUpdate(updateParams); //
const isVehicleType = this.visitData.type == 3; //
uni.showToast({ uni.showModal({
title: "更新成功", title: "提示",
icon: "success", content: "是否立即核销?",
}); cancelText: isVehicleType ? "仅提交照片" : "取消",
// confirmText: "提交并核销",
this.cancelCode(); success: async (res) => {
setTimeout(() => { if (res.confirm) {
this.closeVisitModal(); //
}, 800); await performUpdate(true);
} catch (error) { } else if (res.cancel && isVehicleType) {
console.error("更新失败:", error); //
uni.showToast({ await performUpdate(false);
title: "更新失败", }
icon: "none", //
}); },
} finally { });
this.updating = false;
}
}, },
// 访 // 访
@ -1427,7 +1460,7 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
z-index: 1000; z-index: 10; // uni.showModal
} }
.modal-content { .modal-content {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.
Loading…
Cancel
Save