fix: 修正告警影片路徑沒有顯示在維修單 modal 欄位中問題

This commit is contained in:
MJM_2025_05\polly 2025-09-30 16:42:53 +08:00
parent 5ff030dc40
commit f990c302e5
10 changed files with 41 additions and 41 deletions

View File

@ -3,8 +3,8 @@ import { defineProps } from "vue";
import { twMerge } from "tailwind-merge";
const props = defineProps({
name: String,
value: String,
value: { type: [String, Number, Object, Array, Boolean, null], default: "" },
name: { type: String, required: true },
items: Array,
isLabelExist: {
type: Boolean,

View File

@ -14,11 +14,11 @@ options: [
const props = defineProps({
options: Array,
name: String,
value: { type: [String, Number, Object, Array, Boolean, null], default: "" },
name: { type: String, required: true },
Attribute: String,
onChange: Function,
selectClass: String,
value: String || Number,
isTopLabelExist: {
type: Boolean,
default: true,

View File

@ -2,8 +2,8 @@
import { defineProps } from "vue";
const props = defineProps({
name: String,
value: String,
value: { type: [String, Number, Object, Array, Boolean, null], default: "" },
name: { type: String, required: true },
placeholder: String,
});
</script>

View File

@ -248,7 +248,8 @@
"saturday": "星期六",
"schedule_name": "时段名称",
"schedule_content": "时段内容",
"reorganization": "MQTT 告警重整"
"reorganization": "MQTT 告警重整",
"maintenance": "保养"
},
"operation": {
"title": "运维管理",
@ -428,6 +429,6 @@
"selectPath": "选择存储位置",
"selectDevice": "选择设备",
"normalQuery":"已复归查询"
"normalQuery": "已复归查询"
}
}

View File

@ -248,7 +248,8 @@
"saturday": "星期六",
"schedule_name": "時段名稱",
"schedule_content": "時段內容",
"reorganization": "MQTT 告警重整"
"reorganization": "MQTT 告警重整",
"maintenance": "保養"
},
"operation": {
"title": "運維管理",

View File

@ -248,7 +248,8 @@
"saturday": "Saturday",
"schedule_name": "Time period name",
"schedule_content": "Time period content",
"reorganization": "MQTT Alarm Reorganization"
"reorganization": "MQTT Alarm Reorganization",
"maintenance": "Upkeep"
},
"operation": {
"title": "Operation And Maintenance Management",

View File

@ -51,7 +51,7 @@ export const draggable = {
install(app) {
app.directive("draggable", {
mounted: (el, binding, vnode, prevVnode) => {
console.log("draggable", $(`#${el.id}`).draggable);
// console.log("draggable", $(`#${el.id}`).draggable);
if (binding.value) {
if ($(`#${el.id}`).draggable) {
$(`#${el.id}`).draggable({

View File

@ -75,21 +75,43 @@ const search = async () => {
}
};
const openModal = async (record) => {
try {
if (record.formId) {
const res = await getOperationEditRecord(record.formId);
//
const pickVideo = (obj = {}) =>
obj.video_url ?? obj.videoUrl ?? obj.video_path ?? obj.videoPath ?? "";
const videoFromDetail = pickVideo(res.data);
const videoFromRecord = pickVideo(record);
updateEditRecord({
...res.data,
uuid: res.data.error_code,
device_number: record.device_number,
device_number: record.device_number ?? res.data.device_number ?? "",
//
...(videoFromDetail
? { video_url: videoFromDetail }
: videoFromRecord
? { video_url: videoFromRecord }
: {}),
video_path: res.data.video_path ?? record.video_path ?? undefined,
videoUrl: res.data.videoUrl ?? record.videoUrl ?? undefined,
videoPath: res.data.videoPath ?? record.videoPath ?? undefined,
});
} else {
// formId record video_url
updateEditRecord({
...record,
uuid: record.id,
});
}
alert_action_item.showModal();
} catch (error) {
console.error("Error opening modal:", error);

View File

@ -18,28 +18,7 @@ const { t } = useI18n();
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const props = defineProps({
editRecord: Object,
});
/** ================= Debug Helpers ================= */
const debugLog = (label, payload) => {
try {
console.log(
`[AlertActionItem] ${label}:`,
JSON.parse(JSON.stringify(payload))
);
} catch (e) {
console.log(`[AlertActionItem] ${label}:`, payload);
}
};
// props editRecord
debugLog("props", props);
debugLog("initial props.editRecord", props?.editRecord);
onMounted(() => {
debugLog("onMounted props", props);
debugLog("onMounted props.editRecord", props?.editRecord);
editRecord: { type: Object, default: null },
});
const form = ref(null);
@ -94,8 +73,6 @@ const updateFileList = (files) => {
};
// ---------------------- API video_url ----------------------
// <Input name="videoLocation" :value="..."> value[name]
// videoLocation { videoLocation: string }
const videoLocation = ref({ videoLocation: "" });
const showTooltip = ref(false);
@ -188,7 +165,6 @@ const onCancel = () => {
watch(
() => props.editRecord,
(newVal) => {
debugLog("watch props.editRecord changed", newVal);
if (newVal) {
for (let [key, value] of Object.entries(newVal)) {
if (key in formState.value) {
@ -206,7 +182,6 @@ watch(
// API device_number
videoLocation.value.videoLocation =
newVal?.video_url ?? newVal?.videoUrl ?? newVal?.video_path ?? "";
debugLog("derived videoLocation", videoLocation.value.videoLocation);
}
},
{ immediate: true }
@ -218,7 +193,7 @@ watch(
id="alert_action_item"
:title="t('alert.repair_order')"
:onCancel="onCancel"
width="710"
:width="710"
>
<template #modalContent>
<form

View File

@ -43,7 +43,7 @@ export default {
},
async mounted() {
await this.loadRtspDevices();
// 7
// 7
this.setLast7Days();
if (this.selectedMainId) {
await this.searchLogs();
@ -66,7 +66,7 @@ export default {
.toISOString()
.slice(0, 10);
},
// 7
// 7
setLast7Days() {
const today = new Date();
const start = new Date();