|
|
@@ -51,6 +51,7 @@
|
|
|
:data="data"
|
|
|
:loading="loading"
|
|
|
:bordered="false"
|
|
|
+ :summary="tableSummary"
|
|
|
:pagination="{
|
|
|
showPageSize: true,
|
|
|
showJumper: true,
|
|
|
@@ -81,6 +82,19 @@
|
|
|
<!-- <a-table-column title="业务单号" data-index="biz_id" :width="220" ellipsis tooltip /> -->
|
|
|
<a-table-column title="备注" data-index="remark" :width="220" ellipsis tooltip />
|
|
|
</template>
|
|
|
+ <template #summary-cell="{ column }">
|
|
|
+ <template v-if="column.title === '时间'">
|
|
|
+ <strong>合计</strong>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="column.title === '变动值'">
|
|
|
+ <a-tag :color="Number(summary.total_delta) >= 0 ? 'green' : 'red'">
|
|
|
+ {{ formatDelta(summary.total_delta) }}
|
|
|
+ </a-tag>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="column.title === '备注'">
|
|
|
+ <span class="summary-muted">共 {{ summary.total_records }} 条</span>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
</a-table>
|
|
|
</a-card>
|
|
|
</div>
|
|
|
@@ -98,8 +112,14 @@ import { getNotice, getSemesterTimestamps } from '@/utils/util'
|
|
|
const loading = ref(false)
|
|
|
const data = ref([])
|
|
|
const summary = ref({
|
|
|
- total_delta: 0
|
|
|
+ total_delta: 0,
|
|
|
+ total_records: 0
|
|
|
})
|
|
|
+const tableSummary = () => [{}]
|
|
|
+const formatDelta = (value) => {
|
|
|
+ const num = Number(value) || 0
|
|
|
+ return num >= 0 ? `+${num}` : `${num}`
|
|
|
+}
|
|
|
const pagination = reactive({
|
|
|
total: 0,
|
|
|
current: 1,
|
|
|
@@ -145,7 +165,7 @@ const fetchData = async () => {
|
|
|
})
|
|
|
}
|
|
|
data.value = res.data || []
|
|
|
- summary.value = res.summary || { total_delta: 0 }
|
|
|
+ summary.value = res.summary || { total_delta: 0, total_records: 0 }
|
|
|
pagination.total = res.pagination?.total || 0
|
|
|
} catch (error) {
|
|
|
Notification.error({
|
|
|
@@ -202,4 +222,9 @@ onMounted(() => {
|
|
|
.queryForm {
|
|
|
margin-bottom: 16px;
|
|
|
}
|
|
|
+
|
|
|
+.summary-muted {
|
|
|
+ color: var(--color-text-3);
|
|
|
+ font-size: 13px;
|
|
|
+}
|
|
|
</style>
|