From 68f0af62296dc88702367e1d10d851ed64c5accc Mon Sep 17 00:00:00 2001 From: ko1234 Date: Fri, 18 Oct 2024 09:17:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A8=AD=E5=82=99=E7=AE=A1=E7=90=86=E9=BB=9E?= =?UTF-8?q?=E4=BD=8D=E6=96=B0=E5=A2=9E=20|=20=E5=AF=86=E7=A2=BC=E6=AC=84?= =?UTF-8?q?=E4=BD=8D=E5=8F=AF=E8=A6=96=20|=20=E8=83=BD=E6=BA=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E8=8B=B1=E6=96=87=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/asset/api.js | 1 + src/apis/asset/index.js | 22 ++- src/assets/index.css | 2 +- src/components/customUI/DateGroup.vue | 9 +- src/components/customUI/Pagination.vue | 18 +- src/components/navbar/NavbarItem.vue | 27 ++- src/config/cn.json | 1 + src/config/tw.json | 1 + src/config/us.json | 1 + src/fontawsomeIconRegister.js | 8 +- .../components/AssetSubList.vue | 4 +- .../AssetManagement/components/AssetTable.vue | 5 +- .../components/AssetTableModalLeftInfoIoT.vue | 182 +++++++++++++----- .../components/AccountModal.vue | 19 +- .../components/AccountPasswordModal.vue | 22 ++- .../components/DashboardElecChart.vue | 43 ++++- .../components/BillingDegreeChart.vue | 34 ++-- .../components/CarbonEmissionChart.vue | 32 +-- .../components/ImmediateDemandChart.vue | 8 +- .../components/IntervalBillChart.vue | 12 +- .../components/MonthlyElecBillChart.vue | 38 ++-- src/views/login/Login.vue | 13 +- 22 files changed, 355 insertions(+), 147 deletions(-) diff --git a/src/apis/asset/api.js b/src/apis/asset/api.js index 4e2e7b5..51b9bb0 100644 --- a/src/apis/asset/api.js +++ b/src/apis/asset/api.js @@ -13,3 +13,4 @@ export const GET_ASSET_FLOOR_LIST_API = `/AssetManage/GetFloorList`; export const POST_ASSET_FLOOR_API = `/AssetManage/SaveFloor`; export const GET_ASSET_IOT_LIST_API = `/AssetManage/GetIOTList`; +export const GET_ASSET_SUB_POINT_API = `/AssetManage/GetSubPoint`; diff --git a/src/apis/asset/index.js b/src/apis/asset/index.js index 8f1bb10..61bc0f2 100644 --- a/src/apis/asset/index.js +++ b/src/apis/asset/index.js @@ -10,6 +10,7 @@ import { GET_ASSET_IOT_LIST_API, DELETE_ASSET_ITEM_API, POST_ASSET_SINGLE_API, + GET_ASSET_SUB_POINT_API, } from "./api"; import instance from "@/util/request"; import apihandler from "@/util/apihandler"; @@ -98,7 +99,8 @@ export const postAssetSingle = async (data) => { }); } else { value.forEach((element, index) => { - formData.append(`${key}[${index}].device_guid`, element); + formData.append(`sub_device[${index}].device_number`, element.device_number); + formData.append(`sub_device[${index}].points`, element.points); }); } } else { @@ -141,8 +143,22 @@ export const postAssetFloor = async (formData) => { }); }; -export const getAssetIOTList = async () => { - const res = await instance.post(GET_ASSET_IOT_LIST_API); +export const getAssetIOTList = async (sub_system_tag, points) => { + const res = await instance.post(GET_ASSET_IOT_LIST_API, { + sub_system_tag, + points, + }); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; + +export const getAssetSubPoint = async (sub_system_tag) => { + const res = await instance.post(GET_ASSET_SUB_POINT_API, { + sub_system_tag, + }); return apihandler(res.code, res.data, { msg: res.msg, diff --git a/src/assets/index.css b/src/assets/index.css index 781725f..b6ae254 100644 --- a/src/assets/index.css +++ b/src/assets/index.css @@ -37,7 +37,7 @@ @layer utilities { .btn{ - @apply px-6 py-1; + @apply px-4 py-1; text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.9); box-shadow: 0px 0px 5px rgba(255, 255, 255, 0.8); } diff --git a/src/components/customUI/DateGroup.vue b/src/components/customUI/DateGroup.vue index 20653f0..de479dc 100644 --- a/src/components/customUI/DateGroup.vue +++ b/src/components/customUI/DateGroup.vue @@ -3,9 +3,9 @@ import { defineProps, computed } from "vue"; import VueDatePicker from "@vuepic/vue-datepicker"; import "@vuepic/vue-datepicker/dist/main.css"; import { zhTW } from "date-fns/locale"; - import { twMerge } from "tailwind-merge"; - +import { useI18n } from "vue-i18n"; +const { t } = useI18n(); const props = defineProps({ items: Array, withLine: Boolean, @@ -62,13 +62,12 @@ const curWidth = computed(() => { showPreview: false, }" v-model="item.value" - locale="zh-TW" - :day-names="['一', '二', '三', '四', '五', '六', '日']" + locale='en-US' :format="item.dateFormat" :enable-time-picker="false" :time-picker="Boolean(item.timePicker)" :placeholder="item.placeholder" - selectText="確定" + :selectText="t('button.submit')" :input-class-name=" twMerge('dp-custom-input', 'btn border', inputClass) " diff --git a/src/components/customUI/Pagination.vue b/src/components/customUI/Pagination.vue index e075d4e..c7cb3fb 100644 --- a/src/components/customUI/Pagination.vue +++ b/src/components/customUI/Pagination.vue @@ -52,13 +52,19 @@ const changePageData = (currentPage) => { watch( () => [props.dataSource, props.sort], ([newVal, newVal2]) => { - // console.log(props.dataSource, newVal); - currentPage.value = 1; - totalPage.value = + const totalPageNumber = props.totalPages || Math.ceil(props.dataSource.length / props.pageSize); + if (currentPage.value > totalPageNumber) { + currentPage.value = 1; + } else { + // 若頁數在範圍內,則保持當前頁面 + currentPage.value = currentPage.value; + } + + totalPage.value = totalPageNumber; props.onPageChange ? current_table_data.updateDataSource(props.dataSource) - : changePageData(1); + : changePageData(currentPage.value || 1); }, { deep: true, @@ -99,7 +105,7 @@ const pageInput = computed(() => { :key="`page${page}`" :class=" twMerge( - 'w-10 h-10 mx-1 border-2 border-sub-success rounded-full flex items-center justify-center', + 'w-10 h-10 mx-1 border-2 border-sub-success rounded-full flex items-center justify-center cursor-pointer', currentPage === page ? 'bg-sub-success' : 'bg-transparent' ) " @@ -145,7 +151,7 @@ const pageInput = computed(() => { - {{ totalItems || dataSource.length }} {{ $t("table.in_otal") }}