告警: 維修項目代碼正確顯示、告警欄位調整 | 設備管理: 小類更新時機優化、檔案上傳圖片換行 | 圖資管理:刪除與重新命名功能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 { flatSubData } = useSystemShowData();
const data = computed(() => const data = computed(() =>
flatSubData.value?.map((d) => ({ flatSubData.value?.map((d) => {
...d, const pointsMap = d.points ? Object.fromEntries(d.points.map(({ point, value }) => [point, 0])) : {};
...Object.fromEntries( return {
d.points.map(({ point, value }) => [point, 0]) || [] ...d,
), ...pointsMap,
})) };
})
); );
watch( watch(

View File

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

View File

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

View File

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

View File

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

View File

@ -48,7 +48,10 @@ const graphData = computed(() => {
const getData = async (id = "") => { const getData = async (id = "") => {
const res = await getSideBar(); const res = await getSideBar();
raw_data.value = res.data; 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(); cancelDropdownAndInput();
}; };
@ -132,6 +135,7 @@ const getNewFilename = async (e) => {
}); });
getData(res); getData(res);
} else if ( } else if (
e &&
e?.target.value !== "" && e?.target.value !== "" &&
e?.target.value !== selectedItem.value?.title e?.target.value !== selectedItem.value?.title
) { ) {
@ -178,21 +182,19 @@ const addFilename = (root = false) => {
} }
selectedItem.value = newItem; selectedItem.value = newItem;
editFilename(); // editFilename();
}; };
// filename // filename
const deleteFilename = async () => { const deleteFilename = async () => {
openToast("warning", t("msg.sure_to_delete"), "body", async () => { openToast("warning", t("msg.sure_to_delete"), "body", async () => {
await cancelToastOpen(); await cancelToastOpen();
const filterData = raw_data.value.filter(({ id }) => id !== selectedItem.value.id)
const res = await removeSideBarTreeName(selectedItem.value.id); const res = await removeSideBarTreeName(selectedItem.value.id);
if (res.isSuccess) { if (res.isSuccess) {
raw_data.value = raw_data.value.filter( raw_data.value = filterData;
({ id }) => id !== selectedItem.value.id
);
cancelOpen(); cancelOpen();
openToast("success", t("msg.delete_success")); openToast("success", t("msg.delete_success"));
getData();
} else { } else {
openToast("error", res.msg); 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" class="btn-ghost text-white no-underline border-0 py-3 hover:rounded-lg"
@click.stop.prevent=" @click.stop.prevent="
(e) => { (e) => {
remove(props.selectedItem.key); remove();
} }
" "
> >

View File

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

View File

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

View File

@ -25,7 +25,7 @@ const getFloors = async () => {
title: d.full_name, title: d.full_name,
key: d.floor_guid, key: d.floor_guid,
active: route.params.floor_id === 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); setItems(data);

View File

@ -1,32 +1,46 @@
<script setup> <script setup>
import { computed, inject } from "vue"; import { ref, computed, inject, watch } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import dayjs from 'dayjs';
const { t, locale } = useI18n(); const { t, locale } = useI18n();
const { selectedDevice, selectedDeviceRealtime } = inject("system_selectedDevice"); const { selectedDevice, selectedDeviceRealtime } = inject("system_selectedDevice");
const loading = ref(true);
const updatedTime = ref(null);
const data = computed(() => { const data = computed(() => {
return selectedDevice.value?.value?.points?.map((d) => ({ return selectedDevice.value?.value?.points?.map((d) => ({
...d, ...d,
value: selectedDeviceRealtime?.value?.find(({ point }) => point === d.points)?.value || "No Data" 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 = [{ const columns = [{
title: t("system.attribute"), title: t("system.attribute"),
key: "full_name" key: "full_name"
}, },
{ {
title: t("system.value"), title: t("system.value"),
key: "value" key: "value"
}] }]
</script> </script>
<template> <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> </Table>
</template> </template>