|
|
@@ -10,7 +10,7 @@
|
|
|
添加提醒任务
|
|
|
</a-button>
|
|
|
|
|
|
- <a-alert style="margin-top: 15px;">电费单价:¥0.54/千瓦时。仅保存最近180天的电费变更记录。电费余额每30分钟更新一次,添加任务后开始记录。</a-alert>
|
|
|
+ <a-alert v-if="notice" style="margin-top: 15px;">{{ notice }}</a-alert>
|
|
|
|
|
|
<a-table :data="data" :columns="columns" :bordered="false" hoverable class="table" :loading="loading" :scroll="{
|
|
|
x: 1600
|
|
|
@@ -84,8 +84,14 @@
|
|
|
|
|
|
<!-- 电费变更记录 -->
|
|
|
<a-modal v-model:visible="listVisible" title="电费变更记录" esc-to-close closable width="auto" hide-cancel>
|
|
|
- <a-table :data="changeList" :columns="listColumns" stripe hoverable :loading="listLoading"
|
|
|
- :pagination="{ showPageSize: true, showJumper: true, defaultPageSize: 15 }">
|
|
|
+ <a-table :data="changeList" :columns="listColumns" stripe hoverable :loading="listLoading" :pagination="{
|
|
|
+ showPageSize: true,
|
|
|
+ showJumper: true,
|
|
|
+ showTotal: true,
|
|
|
+ pageSize: pagination.pagesize,
|
|
|
+ current: pagination.current,
|
|
|
+ total: pagination.total
|
|
|
+ }" @page-change="handlePageChange" @page-size-change="handlePageSizeChange">
|
|
|
<template #balance="{ record }">
|
|
|
¥{{ record.balance }}
|
|
|
</template>
|
|
|
@@ -95,7 +101,7 @@
|
|
|
<template #change="{ record }">
|
|
|
<a-tag :color="Number(record.balance) < Number(record.old_balance) ? 'red' : 'green'">¥{{ Number(record.balance
|
|
|
- record.old_balance).toFixed(2)
|
|
|
- }}</a-tag>
|
|
|
+ }}</a-tag>
|
|
|
</template>
|
|
|
<template #time="{ record }">
|
|
|
{{ stramptoTime(record.time) }}
|
|
|
@@ -108,16 +114,44 @@
|
|
|
import { ref, reactive, onMounted, h } from 'vue'
|
|
|
import { getPowerData, addAccount, deleteAccount, getAccount, getChangeRecord } from '@/api/power'
|
|
|
import { Modal, Notification, Message } from '@arco-design/web-vue'
|
|
|
+import { useRoute } from 'vue-router'
|
|
|
+import { getNotice } from '@/utils/util'
|
|
|
+
|
|
|
+const notice = ref('')
|
|
|
+
|
|
|
+const GetNotice = async () => {
|
|
|
+ const { path } = useRoute()
|
|
|
+ const res = await getNotice(path)
|
|
|
+ notice.value = res
|
|
|
+}
|
|
|
|
|
|
const data = ref([])
|
|
|
const loading = ref(false)
|
|
|
|
|
|
const listVisible = ref(false)
|
|
|
+const pagination = reactive({
|
|
|
+ total: 0,
|
|
|
+ current: 1,
|
|
|
+ pagesize: 15
|
|
|
+})
|
|
|
+
|
|
|
+// 分页 - 页码变化
|
|
|
+const handlePageChange = (page) => {
|
|
|
+ pagination.current = page
|
|
|
+}
|
|
|
+
|
|
|
+// 分页 - 每页条数变化
|
|
|
+const handlePageSizeChange = (size) => {
|
|
|
+ pagination.pagesize = size
|
|
|
+ pagination.current = 1 // 页大小变化后回到第一页
|
|
|
+}
|
|
|
+
|
|
|
const changeList = ref([])
|
|
|
const listLoading = ref(false)
|
|
|
const GetChangeRecord = async (id) => {
|
|
|
try {
|
|
|
listLoading.value = true
|
|
|
+ pagination.current = 1
|
|
|
listVisible.value = true
|
|
|
changeList.value = []
|
|
|
const res = await getChangeRecord({ id })
|
|
|
@@ -127,6 +161,7 @@ const GetChangeRecord = async (id) => {
|
|
|
content: res?.msg ?? '请稍后再试'
|
|
|
})
|
|
|
changeList.value = res.data
|
|
|
+ pagination.total = res.data.length
|
|
|
} catch (error) {
|
|
|
Notification.error({
|
|
|
title: '获取电费变更记录失败!',
|
|
|
@@ -397,6 +432,7 @@ const stramptoTime = (time) => {
|
|
|
onMounted(() => {
|
|
|
GetPowerData('buildlist')
|
|
|
getAccounts()
|
|
|
+ GetNotice()
|
|
|
})
|
|
|
|
|
|
</script>
|