告警: 維修項目代碼正確顯示、告警欄位調整 | 設備管理: 小類更新時機優化、檔案上傳圖片換行 | 圖資管理:刪除與重新命名功能bug修正 | 維運管理:檔案上傳圖片換行 | 系統監控: 新增的設備正確顯示、系統小卡的資料Loading效果與顯示更新時間

This commit is contained in:
koko 2024-12-17 11:34:59 +08:00
parent b0d0194fe6
commit d19c7fd240
11 changed files with 95 additions and 71 deletions

View File

@ -34,12 +34,13 @@ export default function useForgeHeatmap() {
const { flatSubData } = useSystemShowData();
const data = computed(() =>
flatSubData.value?.map((d) => ({
...d,
...Object.fromEntries(
d.points.map(({ point, value }) => [point, 0]) || []
),
}))
flatSubData.value?.map((d) => {
const pointsMap = d.points ? Object.fromEntries(d.points.map(({ point, value }) => [point, 0])) : {};
return {
...d,
...pointsMap,
};
})
);
watch(

View File

@ -37,7 +37,7 @@ watch(selectedBtn, (newValue) => {
watch(
() => searchParams,
(newValue) => {
if (newValue.value.mainSys_id) {
if (newValue.value.mainSys_id && !newValue.value.subSys_id) {
getSubSystems(parseInt(newValue.value.mainSys_id));
}
},

View File

@ -203,7 +203,7 @@ provide("asset_table_data", {
<template v-else-if="column.key === 'oriFile'">
<span v-if="record.oriFile.length === 0"></span>
<template v-else>
<span class="flex">
<span class="flex flex-wrap gap-1">
<a
v-for="file in record.oriFile"
:href="`${FILE_BASEURL}/${file?.file_url}`"

View File

@ -228,12 +228,12 @@ watch(
class="my-2"
selectClass="border-info focus-within:border-info"
name="fix_do_code"
Attribute="device_name"
Attribute="full_name"
:options="model_data.model_devList"
:required="true"
:disabled="true"
>
<template #topLeft>{{ $t("repair_item_code") }}</template>
<template #topLeft>{{ $t("alert.repair_item_code") }}</template>
<template #bottomLeft
><span class="text-error text-base">
{{ formErrorMsg.fix_do_code }}
@ -249,7 +249,7 @@ watch(
:options="model_data.model_companyList"
:required="true"
>
<template #topLeft>{{ $t("responsible_vendor") }}</template>
<template #topLeft>{{ $t("alert.responsible_vendor") }}</template>
<template #bottomLeft
><span class="text-error text-base">
{{ formErrorMsg.fix_firm }}

View File

@ -201,38 +201,42 @@ const closeModal = () => {
>
<template #topLeft>{{ $t("alert.qualifications") }}</template>
</Select>
<InputNumber
:value="formState"
class="my-2"
name="highLimit"
v-if="!isBool"
>
<template #topLeft>{{ $t("alert.upper_limit") }}(>=)</template>
</InputNumber>
<InputNumber
:value="formState"
class="my-2"
name="lowLimit"
v-if="!isBool"
>
<template #topLeft>{{ $t("alert.lower_limit") }}(&lt;=)</template>
</InputNumber>
<InputNumber
:value="formState"
class="my-2"
name="highDelay"
v-if="!isBool"
>
<template #topLeft>{{ $t("alert.highDelay") }}</template>
</InputNumber>
<InputNumber
:value="formState"
class="my-2"
name="lowDelay"
v-if="!isBool"
>
<template #topLeft>{{ $t("alert.lowDelay") }}</template>
</InputNumber>
<div class="flex gap-4 w-full">
<InputNumber
:value="formState"
class="my-2"
name="highLimit"
v-if="!isBool"
>
<template #topLeft>{{ $t("alert.upper_limit") }}(>=)</template>
</InputNumber>
<InputNumber
:value="formState"
class="my-2"
name="lowLimit"
v-if="!isBool"
>
<template #topLeft>{{ $t("alert.lower_limit") }}(&lt;=)</template>
</InputNumber>
</div>
<div class="flex gap-4 w-full">
<InputNumber
:value="formState"
class="my-2"
name="highDelay"
v-if="!isBool"
>
<template #topLeft>{{ $t("alert.highDelay") }}</template>
</InputNumber>
<InputNumber
:value="formState"
class="my-2"
name="lowDelay"
v-if="!isBool"
>
<template #topLeft>{{ $t("alert.lowDelay") }}</template>
</InputNumber>
</div>
<div class="w-full mt-5">
<p class="text-light text-lg ml-1">
{{ $t("alert.warning_method") }}

View File

@ -48,7 +48,10 @@ const graphData = computed(() => {
const getData = async (id = "") => {
const res = await getSideBar();
raw_data.value = res.data;
id && updateCurrentDir(data.find((d) => parseInt(id) === d.id));
if (id) {
const currentDir = raw_data.value.find((d) => parseInt(id) === d.id);
updateCurrentDir(currentDir);
}
cancelDropdownAndInput();
};
@ -132,6 +135,7 @@ const getNewFilename = async (e) => {
});
getData(res);
} else if (
e &&
e?.target.value !== "" &&
e?.target.value !== selectedItem.value?.title
) {
@ -178,21 +182,19 @@ const addFilename = (root = false) => {
}
selectedItem.value = newItem;
editFilename();
// editFilename();
};
// filename
const deleteFilename = async () => {
openToast("warning", t("msg.sure_to_delete"), "body", async () => {
await cancelToastOpen();
const filterData = raw_data.value.filter(({ id }) => id !== selectedItem.value.id)
const res = await removeSideBarTreeName(selectedItem.value.id);
if (res.isSuccess) {
raw_data.value = raw_data.value.filter(
({ id }) => id !== selectedItem.value.id
);
raw_data.value = filterData;
cancelOpen();
openToast("success", t("msg.delete_success"));
getData();
} else {
openToast("error", res.msg);
}

View File

@ -50,7 +50,7 @@ const props = defineProps({
class="btn-ghost text-white no-underline border-0 py-3 hover:rounded-lg"
@click.stop.prevent="
(e) => {
remove(props.selectedItem.key);
remove();
}
"
>

View File

@ -50,7 +50,7 @@ const deleteItem = async (id) => {
<template v-if="column.key === 'lorf'">
<span v-if="record.lorf?.length === 0"></span>
<template v-else>
<span class="flex">
<span class="flex flex-wrap gap-1">
<a
v-for="file in record.lorf"
:href="`${FILE_BASEURL}/upload/operation/${

View File

@ -68,7 +68,7 @@ const getData = async () => {
is_show: true,
currentColor: dev.device_normal_point_color,
spriteDbId: 10 + dev.main_id,
sensorTypes: dev.points.map(({ points }) => points),
sensorTypes: dev.points ? dev.points.map(({ points }) => points) : [],
floor_guid: d.floor_guid,
is2DActive: false
})),
@ -108,12 +108,15 @@ const updateDataByGas = (gas) => {
if (gas === "all") {
update_values = raw_data.value
} else {
update_values = raw_data.value.map((d) => (
{
update_values = raw_data.value.map((d) => ({
...d,
device_list: d.device_list.filter(({ points }) => points.some(({ points: p }) => p === gas))
}
))
device_list: d.device_list.filter(({ points }) => {
if (points) {
return points.some(({ points: p }) => p === gas)
}
return false
})
}))
}
data.value = update_values
subscribeData.value = getSubData(update_values);

View File

@ -25,7 +25,7 @@ const getFloors = async () => {
title: d.full_name,
key: d.floor_guid,
active: route.params.floor_id === d.floor_guid,
map_url: d.floor_map_url + ".svg"
map_url: d.floor_map_url ? d.floor_map_url + ".svg" : null
}))
]
setItems(data);

View File

@ -1,32 +1,46 @@
<script setup>
import { computed, inject } from "vue";
import { ref, computed, inject, watch } from "vue";
import { useI18n } from "vue-i18n";
import dayjs from 'dayjs';
const { t, locale } = useI18n();
const { selectedDevice, selectedDeviceRealtime } = inject("system_selectedDevice");
const loading = ref(true);
const updatedTime = ref(null);
const data = computed(() => {
return selectedDevice.value?.value?.points?.map((d) => ({
...d,
...d,
value: selectedDeviceRealtime?.value?.find(({ point }) => point === d.points)?.value || "No Data"
})) || []
})
})) || []
});
watch(selectedDeviceRealtime, (newValue) => {
if (newValue) {
loading.value = false;
updatedTime.value = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss");
}
});
const columns = [{
title: t("system.attribute"),
key: "full_name"
},
{
title: t("system.value"),
key: "value"
title: t("system.attribute"),
key: "full_name"
},
{
title: t("system.value"),
key: "value"
}]
</script>
<template>
<Table :loading="loading" :columns="columns" :dataSource="data || []" :withStyle="false">
<span v-if="updatedTime" class="mt-5 text-info">{{$t("operation.updated_time")}} : {{ updatedTime }}</span>
<Table
:loading="loading"
:columns="columns"
:dataSource="data || []"
:withStyle="false"
>
</Table>
</template>