設備管理:組合點位-修改組合點位的參數顯示名稱、大類為Electricity System時,新增用電類別(option)、隱藏系統類別的新增與修改功能 | 帳號管理: 角色管理的權限bug | 歷史資料: 查詢時,新增Loading的圖示 | 即時告警: 告警設定要"刪除"功能

This commit is contained in:
koko 2025-02-06 11:41:20 +08:00
parent 5b1ff9749d
commit a91c4397a4
9 changed files with 65 additions and 10 deletions

View File

@ -14,6 +14,7 @@ export const GET_OUTLIERS_LIST_API = `api/Alarm/GetAlarmSetting`;
export const GET_OUTLIERS_DEVLIST_API = `api/Alarm/GetDevList`; // 取得設備 export const GET_OUTLIERS_DEVLIST_API = `api/Alarm/GetDevList`; // 取得設備
export const GET_OUTLIERS_POINTS_API = `api/Alarm/GetAlarmPoints`; // 取得點位 export const GET_OUTLIERS_POINTS_API = `api/Alarm/GetAlarmPoints`; // 取得點位
export const POST_OUTLIERS_SETTING_API = `api/Alarm/SaveAlarmSetting`; // 新增與修改 export const POST_OUTLIERS_SETTING_API = `api/Alarm/SaveAlarmSetting`; // 新增與修改
export const DELETE_OUTLIERS_SETTING_API = `api/Alarm/DeleteAlarmSetting`; // 刪除
export const GET_ALERT_SCHEDULE_LIST_API = `api/Alarm/GetAlarmSchedule`; export const GET_ALERT_SCHEDULE_LIST_API = `api/Alarm/GetAlarmSchedule`;
export const POST_ALERT_SCHEDULE = `api/Alarm/SaveAlarmSchedule`; export const POST_ALERT_SCHEDULE = `api/Alarm/SaveAlarmSchedule`;

View File

@ -7,6 +7,7 @@ import {
GET_OUTLIERS_DEVLIST_API, GET_OUTLIERS_DEVLIST_API,
GET_OUTLIERS_POINTS_API, GET_OUTLIERS_POINTS_API,
POST_OUTLIERS_SETTING_API, POST_OUTLIERS_SETTING_API,
DELETE_OUTLIERS_SETTING_API,
GET_ALERT_MEMBER_LIST_API, GET_ALERT_MEMBER_LIST_API,
GET_ALERT_MEMBER, GET_ALERT_MEMBER,
POST_ALERT_MEMBER, POST_ALERT_MEMBER,
@ -160,6 +161,17 @@ export const postOutliersSetting = async (data) => {
}); });
}; };
export const delOutliersSetting = async (Id) => {
const res = await instance.post(DELETE_OUTLIERS_SETTING_API, {
Id,
});
return apihandler(res.code, res.data, {
msg: res.msg,
code: res.code,
});
};
export const getAlarmScheduleList = async () => { export const getAlarmScheduleList = async () => {
const res = await instance.post(GET_ALERT_SCHEDULE_LIST_API, {}); const res = await instance.post(GET_ALERT_SCHEDULE_LIST_API, {});

View File

@ -4,11 +4,12 @@ import AssetMainList from "./components/AssetMainList.vue";
import AssetSubList from "./components/AssetSubList.vue"; import AssetSubList from "./components/AssetSubList.vue";
import AssetTable from "./components/AssetTable.vue"; import AssetTable from "./components/AssetTable.vue";
import { getOperationCompanyList } from "@/apis/operation"; import { getOperationCompanyList } from "@/apis/operation";
import { getIOTSchema } from "@/apis/asset"; import { getIOTSchema, getElecTypeList } from "@/apis/asset";
import useSearchParam from "@/hooks/useSearchParam"; import useSearchParam from "@/hooks/useSearchParam";
const { searchParams, changeParams } = useSearchParam(); const { searchParams, changeParams } = useSearchParam();
const companyOptions = ref([]); const companyOptions = ref([]);
const iotSchemaOptions = ref([]); const iotSchemaOptions = ref([]);
const elecTypeOptions = ref([]);
const getCompany = async () => { const getCompany = async () => {
const res = await getOperationCompanyList(); const res = await getOperationCompanyList();
companyOptions.value = res.data.map((d) => ({ ...d, key: d.id })); companyOptions.value = res.data.map((d) => ({ ...d, key: d.id }));
@ -17,9 +18,14 @@ const getIOTSchemaOptions = async (id) => {
const res = await getIOTSchema(Number(id)); const res = await getIOTSchema(Number(id));
iotSchemaOptions.value = res.data.map((d) => ({ ...d, key: d.id })); iotSchemaOptions.value = res.data.map((d) => ({ ...d, key: d.id }));
}; };
const getElecType = async () => {
const res = await getElecTypeList();
elecTypeOptions.value = res.data.map((d) => ({ ...d, key: d.id }));
};
onMounted(() => { onMounted(() => {
getCompany(); getCompany();
getElecType();
}); });
watch( watch(
@ -37,6 +43,7 @@ watch(
provide("asset_modal_options", { provide("asset_modal_options", {
companyOptions, companyOptions,
iotSchemaOptions, iotSchemaOptions,
elecTypeOptions,
}); });
</script> </script>

View File

@ -83,12 +83,12 @@ watch(selectedBtn, (newValue) => {
:getData="getMainSystems" :getData="getMainSystems"
:formState="formState" :formState="formState"
/> />
<button <!-- <button
@click.stop.prevent="isEditMode = !isEditMode" @click.stop.prevent="isEditMode = !isEditMode"
class="btn btn-sm btn-outline-success" class="btn btn-sm btn-outline-success"
> >
{{ isEditMode ? t("button.stop_edit") : t("button.start_edit") }} {{ isEditMode ? t("button.stop_edit") : t("button.start_edit") }}
</button> </button> -->
</div> </div>
<ButtonConnectedGroup <ButtonConnectedGroup
:items="items" :items="items"

View File

@ -47,9 +47,9 @@ const onReset = () => {
</script> </script>
<template> <template>
<button class="btn btn-sm btn-success" @click.stop.prevent="openModal"> <!-- <button class="btn btn-sm btn-success" @click.stop.prevent="openModal">
<font-awesome-icon :icon="['fas', 'plus']" />{{ $t("button.add") }} <font-awesome-icon :icon="['fas', 'plus']" />{{ $t("button.add") }}
</button> </button> -->
<Modal <Modal
id="asset_add_main_item" id="asset_add_main_item"
:title=" :title="

View File

@ -2,6 +2,7 @@
import { ref, inject, onBeforeMount, onMounted, watch } from "vue"; import { ref, inject, onBeforeMount, onMounted, watch } from "vue";
import * as yup from "yup"; import * as yup from "yup";
import "yup-phone-lite"; import "yup-phone-lite";
import useSearchParam from "@/hooks/useSearchParam";
import AssetTableModalLeftInfoIoT from "./AssetTableModalLeftInfoIoT.vue"; import AssetTableModalLeftInfoIoT from "./AssetTableModalLeftInfoIoT.vue";
import AssetTableModalLeftInfoDept from "./AssetTableModalLeftInfoDept.vue"; import AssetTableModalLeftInfoDept from "./AssetTableModalLeftInfoDept.vue";
import AssetTableModalLeftInfoGraph from "./AssetTableModalLeftInfoGraph.vue"; import AssetTableModalLeftInfoGraph from "./AssetTableModalLeftInfoGraph.vue";
@ -11,11 +12,11 @@ import dayjs from "dayjs";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
const { t } = useI18n(); const { t } = useI18n();
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL; const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const { searchParams, changeParams } = useSearchParam();
const { updateLeftFields, formErrorMsg, formState } = inject( const { updateLeftFields, formErrorMsg, formState } = inject(
"asset_table_modal_form" "asset_table_modal_form"
); );
const { companyOptions, iotSchemaOptions } = inject("asset_modal_options"); const { companyOptions, iotSchemaOptions, elecTypeOptions } = inject("asset_modal_options");
const store = useUserInfoStore(); const store = useUserInfoStore();
let schema = { let schema = {
full_name: yup.string().nullable(true), full_name: yup.string().nullable(true),
@ -52,6 +53,7 @@ onBeforeMount(() => {
operation_id: 0, operation_id: 0,
response_schema_id: 0, response_schema_id: 0,
department_id: 0, department_id: 0,
elec_id: null,
asset_number: "", asset_number: "",
topic: "", topic: "",
sub_device: [], sub_device: [],
@ -141,6 +143,18 @@ watch(
<template #topLeft>IoT</template> <template #topLeft>IoT</template>
</Select> </Select>
</div> </div>
<div class="flex items-center w-72" v-if="searchParams.mainSys_id==26">
<Select
:value="formState"
selectClass="border-info focus-within:border-info"
name="elec_id"
Attribute="name"
:options="elecTypeOptions"
:required="true"
>
<template #topLeft>{{$t("energy.electricity_classification")}}</template>
</Select>
</div>
<Input :value="formState" width="290" name="asset_number"> <Input :value="formState" width="290" name="asset_number">
<template #topLeft>{{ $t("assetManagement.asset_number") }}</template> <template #topLeft>{{ $t("assetManagement.asset_number") }}</template>
<template #bottomLeft <template #bottomLeft

View File

@ -65,7 +65,7 @@ const getPoint = async (sub_system_tag) => {
setPoints( setPoints(
res.data.map((d, index) => ({ res.data.map((d, index) => ({
...d, ...d,
title: d.points, title: d.full_name,
key: d.points, key: d.points,
active: false, active: false,
})) }))

View File

@ -4,6 +4,7 @@ import {
getOutliersList, getOutliersList,
getOutliersDevList, getOutliersDevList,
getOutliersPoints, getOutliersPoints,
delOutliersSetting,
} from "@/apis/alert"; } from "@/apis/alert";
import useSearchParam from "@/hooks/useSearchParam"; import useSearchParam from "@/hooks/useSearchParam";
import AlertOutliersTableAddModal from "./AlertOutliersTableAddModal.vue"; import AlertOutliersTableAddModal from "./AlertOutliersTableAddModal.vue";
@ -11,6 +12,7 @@ import AlertOutliersTableAddModal from "./AlertOutliersTableAddModal.vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
const { t } = useI18n(); const { t } = useI18n();
const { noticeList, timesList } = inject("notify_table"); const { noticeList, timesList } = inject("notify_table");
const { openToast, cancelToastOpen } = inject("app_toast");
const { searchParams, changeParams } = useSearchParam(); const { searchParams, changeParams } = useSearchParam();
const tableData = ref([]); const tableData = ref([]);
@ -70,7 +72,7 @@ const columns = computed(() => [
{ {
title: t("alert.operation"), title: t("alert.operation"),
key: "operation", key: "operation",
width: 150, width: 300,
}, },
]); ]);
@ -162,6 +164,19 @@ const openModal = (record) => {
outliers_add_table_item.showModal(); outliers_add_table_item.showModal();
}; };
const remove = async (Id) => {
openToast("warning", t("msg.sure_to_delete"), "body", async () => {
await cancelToastOpen();
const res = await delOutliersSetting(Id);
if (res.isSuccess) {
getOutliersData();
openToast("success", t("msg.delete_success"));
} else {
openToast("error", res.msg);
}
});
};
const onCancel = () => { const onCancel = () => {
editRecord.value = null; editRecord.value = null;
outliers_add_table_item.close(); outliers_add_table_item.close();
@ -188,6 +203,12 @@ const onCancel = () => {
> >
{{ $t("button.edit") }} {{ $t("button.edit") }}
</button> </button>
<button
class="btn btn-sm btn-error text-white"
@click.stop.prevent="() => remove(record.id)"
>
{{ $t("button.delete") }}
</button>
</template> </template>
<template v-else-if="column.key === 'enable'"> <template v-else-if="column.key === 'enable'">
{{ record.enable === 1 ? t("alert.yes") : t("alert.no") }} {{ record.enable === 1 ? t("alert.yes") : t("alert.no") }}

View File

@ -39,7 +39,7 @@ const { tableData, loading } = inject("history_table_data");
</script> </script>
<template> <template>
<Table :columns="columns" :dataSource="tableData"></Table> <Table :columns="columns" :dataSource="tableData" :loading="loading"></Table>
</template> </template>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>