fix: 修正告警影片路徑沒有顯示在維修單 modal 欄位中問題
This commit is contained in:
parent
5ff030dc40
commit
f990c302e5
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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>
|
||||
|
@ -248,7 +248,8 @@
|
||||
"saturday": "星期六",
|
||||
"schedule_name": "时段名称",
|
||||
"schedule_content": "时段内容",
|
||||
"reorganization": "MQTT 告警重整"
|
||||
"reorganization": "MQTT 告警重整",
|
||||
"maintenance": "保养"
|
||||
},
|
||||
"operation": {
|
||||
"title": "运维管理",
|
||||
@ -428,6 +429,6 @@
|
||||
|
||||
"selectPath": "选择存储位置",
|
||||
"selectDevice": "选择设备",
|
||||
"normalQuery":"已复归查询"
|
||||
"normalQuery": "已复归查询"
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,8 @@
|
||||
"saturday": "星期六",
|
||||
"schedule_name": "時段名稱",
|
||||
"schedule_content": "時段內容",
|
||||
"reorganization": "MQTT 告警重整"
|
||||
"reorganization": "MQTT 告警重整",
|
||||
"maintenance": "保養"
|
||||
},
|
||||
"operation": {
|
||||
"title": "運維管理",
|
||||
|
@ -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",
|
||||
|
@ -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({
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user