diff --git a/src/components/customUI/RadioGroup.vue b/src/components/customUI/RadioGroup.vue index f0ed74a..a8362e6 100644 --- a/src/components/customUI/RadioGroup.vue +++ b/src/components/customUI/RadioGroup.vue @@ -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, diff --git a/src/components/customUI/Select.vue b/src/components/customUI/Select.vue index 41166bc..7549296 100644 --- a/src/components/customUI/Select.vue +++ b/src/components/customUI/Select.vue @@ -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, diff --git a/src/components/customUI/Textarea.vue b/src/components/customUI/Textarea.vue index e14f010..f1ca8eb 100644 --- a/src/components/customUI/Textarea.vue +++ b/src/components/customUI/Textarea.vue @@ -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, }); diff --git a/src/config/cn.json b/src/config/cn.json index 1023571..035889b 100644 --- a/src/config/cn.json +++ b/src/config/cn.json @@ -248,7 +248,8 @@ "saturday": "星期六", "schedule_name": "时段名称", "schedule_content": "时段内容", - "reorganization": "MQTT 告警重整" + "reorganization": "MQTT 告警重整", + "maintenance": "保养" }, "operation": { "title": "运维管理", @@ -428,6 +429,6 @@ "selectPath": "选择存储位置", "selectDevice": "选择设备", - "normalQuery":"已复归查询" + "normalQuery": "已复归查询" } } diff --git a/src/config/tw.json b/src/config/tw.json index 5b9f612..0f539d8 100644 --- a/src/config/tw.json +++ b/src/config/tw.json @@ -248,7 +248,8 @@ "saturday": "星期六", "schedule_name": "時段名稱", "schedule_content": "時段內容", - "reorganization": "MQTT 告警重整" + "reorganization": "MQTT 告警重整", + "maintenance": "保養" }, "operation": { "title": "運維管理", diff --git a/src/config/us.json b/src/config/us.json index fea78e0..30a51ed 100644 --- a/src/config/us.json +++ b/src/config/us.json @@ -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", diff --git a/src/directives/draggable.js b/src/directives/draggable.js index 3121b18..1c8f3a0 100644 --- a/src/directives/draggable.js +++ b/src/directives/draggable.js @@ -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({ diff --git a/src/views/alert/components/AlertQuery/AlertQuery.vue b/src/views/alert/components/AlertQuery/AlertQuery.vue index b10a832..b86f323 100644 --- a/src/views/alert/components/AlertQuery/AlertQuery.vue +++ b/src/views/alert/components/AlertQuery/AlertQuery.vue @@ -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); diff --git a/src/views/alert/components/AlertQuery/AlertTableModal.vue b/src/views/alert/components/AlertQuery/AlertTableModal.vue index 777b737..f9f210f 100644 --- a/src/views/alert/components/AlertQuery/AlertTableModal.vue +++ b/src/views/alert/components/AlertQuery/AlertTableModal.vue @@ -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 ---------------------- -// 重要:你的 會從 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" >