|
@@ -1,223 +1,226 @@
|
|
|
-<template>
|
|
|
- <div class="plan container">
|
|
|
- <h1>Plan</h1>
|
|
|
- <Progress></Progress>
|
|
|
- <div class="block">
|
|
|
- <div class="top">
|
|
|
- <h2>Processing Files Balance</h2>
|
|
|
- <a @click="exportData">
|
|
|
- <picture>
|
|
|
- <source type="image/png" media="(min-width: 430px)" srcset="../../../static/images/dashboard/download@2x.png">
|
|
|
- <source type="image/png" media="(max-width: 429px)" srcset="../../../static/images/dashboard/download.png">
|
|
|
- <img src="../../../static/images/dashboard/download@2x.png" alt="download">
|
|
|
- </picture>
|
|
|
- </a>
|
|
|
- </div>
|
|
|
- <div class="plan-table">
|
|
|
- <el-table :data="tableData" style="width: 100%" :default-sort = "{prop: 'date', order: 'descending'}">
|
|
|
- <el-table-column prop="date" label="Date" sortable :formatter="formatterDate" min-width="120"></el-table-column>
|
|
|
- <el-table-column prop="description" label="Description" min-width="240"></el-table-column>
|
|
|
- <el-table-column prop="balanceChange" label="Balance Change" min-width="120"></el-table-column>
|
|
|
- <el-table-column prop="remainingFiles" label="Remaining Files" min-width="120"></el-table-column>
|
|
|
- </el-table>
|
|
|
- </div>
|
|
|
- <div class="pagination">
|
|
|
- <el-pagination background layout="prev, pager, next" :page-size="pageSize" :total="totalNum" @current-change="handleCurrentChange" class="max-page-btn"></el-pagination>
|
|
|
- <div class="mobile-page-btn">
|
|
|
- <el-button type="primary" plain icon="el-icon-arrow-left" @click="handleCurrentChangeMobile(currentPage - 1)">Previous</el-button>
|
|
|
- <el-button type="primary" plain @click="handleCurrentChangeMobile(currentPage + 1)">Next<i class="el-icon-arrow-right el-icon--right"></i></el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import Progress from '@/components/progress/Progress.vue'
|
|
|
-import { getBalanceRecordList, exportBalanceRecordList } from '@/request/api'
|
|
|
-
|
|
|
-export default {
|
|
|
- components: {
|
|
|
- Progress
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- tableData: [],
|
|
|
- pageSize: 8,
|
|
|
- totalNum: 0,
|
|
|
- currentPage: 1
|
|
|
- }
|
|
|
- },
|
|
|
- created () {
|
|
|
- this.getPlanList(this.currentPage)
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 获取plan列表数据
|
|
|
- getPlanList (page) {
|
|
|
- getBalanceRecordList({
|
|
|
- page: page,
|
|
|
- size: this.pageSize
|
|
|
- }).then(res => {
|
|
|
- if (res.code === '200') {
|
|
|
- this.tableData = []
|
|
|
- for (let i = 0; i < res.data.records.length; i++) {
|
|
|
- this.tableData.push(res.data.records[i])
|
|
|
- this.totalNum = res.data.total
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$message.error('Failed to connect.')
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
- console.log(err)
|
|
|
- this.$message.error('Failed to connect.')
|
|
|
- })
|
|
|
- },
|
|
|
- // 日期自定格式
|
|
|
- formatterDate (row, column) {
|
|
|
- const data = row[column.property]
|
|
|
- if (data === null || data === '') return ''
|
|
|
- const dt = new Date(data)
|
|
|
- let month = ''
|
|
|
- switch (dt.getMonth() + 1) {
|
|
|
- case 1:
|
|
|
- month = 'Jan'
|
|
|
- break
|
|
|
- case 2:
|
|
|
- month = 'Feb'
|
|
|
- break
|
|
|
- case 3:
|
|
|
- month = 'Mar'
|
|
|
- break
|
|
|
- case 4:
|
|
|
- month = 'Apr'
|
|
|
- break
|
|
|
- case 5:
|
|
|
- month = 'May'
|
|
|
- break
|
|
|
- case 6:
|
|
|
- month = 'Jun'
|
|
|
- break
|
|
|
- case 7:
|
|
|
- month = 'Jul'
|
|
|
- break
|
|
|
- case 8:
|
|
|
- month = 'Aug'
|
|
|
- break
|
|
|
- case 9:
|
|
|
- month = 'Sept'
|
|
|
- break
|
|
|
- case 10:
|
|
|
- month = 'Oct'
|
|
|
- break
|
|
|
- case 11:
|
|
|
- month = 'Nov'
|
|
|
- break
|
|
|
- case 12:
|
|
|
- month = 'Dec'
|
|
|
- break
|
|
|
- }
|
|
|
- return month + ' ' + dt.getDate() + ',' + dt.getFullYear()
|
|
|
- },
|
|
|
- handleCurrentChange (page) {
|
|
|
- this.currentPage = page
|
|
|
- this.getPlanList(page)
|
|
|
- },
|
|
|
- handleCurrentChangeMobile (page) {
|
|
|
- const totalPageNum = (this.totalNum + this.totalNum % 8) / 8
|
|
|
- if (page <= 0 || page > totalPageNum) {
|
|
|
- return
|
|
|
- } else {
|
|
|
- this.currentPage = page
|
|
|
- this.getPlanList(page)
|
|
|
- }
|
|
|
- },
|
|
|
- // 账户消费充值记录导出
|
|
|
- exportData () {
|
|
|
- exportBalanceRecordList({}, {
|
|
|
- responseType: 'blob'
|
|
|
- }).then(res => {
|
|
|
- const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
|
|
|
- const downloadElement = document.createElement('a') // 创建a标签
|
|
|
- const href = window.URL.createObjectURL(blob) // 创建下载的链接
|
|
|
- downloadElement.href = href
|
|
|
- downloadElement.download = 'plan.xlsx' // 下载后文件名
|
|
|
- document.body.appendChild(downloadElement)
|
|
|
- downloadElement.click() // 点击下载
|
|
|
- document.body.removeChild(downloadElement) // 下载完成移除元素
|
|
|
- window.URL.revokeObjectURL(href) // 释放掉blob对象
|
|
|
- }).catch(err => {
|
|
|
- console.log(err)
|
|
|
- this.$message.error('Failed to export.')
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="scss" scoped>
|
|
|
-.plan {
|
|
|
- .top {
|
|
|
- display: flex;
|
|
|
- align-items: flex-start;
|
|
|
- justify-content: space-between;
|
|
|
- img {
|
|
|
- width: 28px;
|
|
|
- height: 28px;
|
|
|
- }
|
|
|
- }
|
|
|
- :deep .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
|
|
|
- background-color: #fff;
|
|
|
- }
|
|
|
- .pagination {
|
|
|
- margin-top: 40px;
|
|
|
- text-align: right;
|
|
|
- .mobile-page-btn {
|
|
|
- display: none;
|
|
|
- ::v-deep .el-button {
|
|
|
- width: 114px;
|
|
|
- height: 40px;
|
|
|
- border-radius: 6px;
|
|
|
- font-weight: 700;
|
|
|
- &:first-child {
|
|
|
- padding-left: 11px;
|
|
|
- }
|
|
|
- &:last-child {
|
|
|
- text-align: right;
|
|
|
- padding-left: 13px;
|
|
|
- margin-left: 12px;
|
|
|
- }
|
|
|
- }
|
|
|
- ::v-deep .el-button--primary.is-plain {
|
|
|
- background: #fff;
|
|
|
- border-color: #1460F3;
|
|
|
- }
|
|
|
- ::v-deep [class^=el-icon-] {
|
|
|
- font-weight: 700;
|
|
|
- }
|
|
|
- ::v-deep .el-button--primary.is-plain:hover, .el-button--primary.is-plain:focus {
|
|
|
- color: #1460F3;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-@media screen and (max-width: 767px) {
|
|
|
- .plan .pagination {
|
|
|
- text-align: center;
|
|
|
- .mobile-page-btn {
|
|
|
- display: inline-block;
|
|
|
- }
|
|
|
- .max-page-btn {
|
|
|
- display: none;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-@media screen and (max-width: 320px) {
|
|
|
- .plan .pagination {
|
|
|
- .mobile-page-btn {
|
|
|
- ::v-deep .el-button {
|
|
|
- width: calc(50% - 6px);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</style>
|
|
|
+<template>
|
|
|
+ <div class="plan container">
|
|
|
+ <h1>Plan</h1>
|
|
|
+ <Progress></Progress>
|
|
|
+ <div class="block">
|
|
|
+ <div class="top">
|
|
|
+ <h2>Processing Files Balance</h2>
|
|
|
+ <a @click="exportData">
|
|
|
+ <picture>
|
|
|
+ <source type="image/png" media="(min-width: 430px)" srcset="../../../static/images/dashboard/download@2x.png">
|
|
|
+ <source type="image/png" media="(max-width: 429px)" srcset="../../../static/images/dashboard/download.png">
|
|
|
+ <img src="../../../static/images/dashboard/download@2x.png" alt="download">
|
|
|
+ </picture>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ <div class="plan-table">
|
|
|
+ <el-table :data="tableData" style="width: 100%" :default-sort = "{prop: 'date', order: 'descending'}">
|
|
|
+ <el-table-column columnprop="date" label="Date" sortable :formatter="formatterDate" min-width="120"></el-table-column>
|
|
|
+ <el-table-column prop="description" label="Description" min-width="240"></el-table-column>
|
|
|
+ <el-table-column prop="balanceChange" label="Balance Change" min-width="120"></el-table-column>
|
|
|
+ <el-table-column prop="remainingFiles" label="Remaining Files" min-width="120"></el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div class="pagination">
|
|
|
+ <el-pagination background layout="prev, pager, next" :page-size="pageSize" :total="totalNum" @current-change="handleCurrentChange" class="max-page-btn"></el-pagination>
|
|
|
+ <div class="mobile-page-btn">
|
|
|
+ <el-button type="primary" plain icon="el-icon-arrow-left" @click="handleCurrentChangeMobile(currentPage - 1)">Previous</el-button>
|
|
|
+ <el-button type="primary" plain @click="handleCurrentChangeMobile(currentPage + 1)">Next<i class="el-icon-arrow-right el-icon--right"></i></el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts">
|
|
|
+import { Component, Vue } from 'vue-property-decorator'
|
|
|
+import Progress from '@/components/progress/Progress.vue'
|
|
|
+import { getBalanceRecordList, exportBalanceRecordList } from '@/request/api'
|
|
|
+
|
|
|
+@Component({
|
|
|
+ components: {
|
|
|
+ Progress
|
|
|
+ }
|
|
|
+})
|
|
|
+export default class Plan extends Vue {
|
|
|
+ tableData:any = []
|
|
|
+ pageSize = 8
|
|
|
+ totalNum = 0
|
|
|
+ currentPage = 1
|
|
|
+
|
|
|
+ created () {
|
|
|
+ this.getPlanList(this.currentPage)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取plan列表数据
|
|
|
+ getPlanList (page:number) {
|
|
|
+ getBalanceRecordList({
|
|
|
+ page: page,
|
|
|
+ size: this.pageSize
|
|
|
+ }).then((res:any) => {
|
|
|
+ if (res.code === '200') {
|
|
|
+ this.tableData = []
|
|
|
+ for (let i = 0; i < res.data.records.length; i++) {
|
|
|
+ this.tableData.push(res.data.records[i])
|
|
|
+ this.totalNum = res.data.total
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error('Failed to connect.')
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ this.$message.error('Failed to connect.')
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 日期自定格式
|
|
|
+ formatterDate (row:any, column:any) {
|
|
|
+ const data = row[column.property]
|
|
|
+ if (data === null || data === '') return ''
|
|
|
+ const dt = new Date(data)
|
|
|
+ let month = ''
|
|
|
+ switch (dt.getMonth() + 1) {
|
|
|
+ case 1:
|
|
|
+ month = 'Jan'
|
|
|
+ break
|
|
|
+ case 2:
|
|
|
+ month = 'Feb'
|
|
|
+ break
|
|
|
+ case 3:
|
|
|
+ month = 'Mar'
|
|
|
+ break
|
|
|
+ case 4:
|
|
|
+ month = 'Apr'
|
|
|
+ break
|
|
|
+ case 5:
|
|
|
+ month = 'May'
|
|
|
+ break
|
|
|
+ case 6:
|
|
|
+ month = 'Jun'
|
|
|
+ break
|
|
|
+ case 7:
|
|
|
+ month = 'Jul'
|
|
|
+ break
|
|
|
+ case 8:
|
|
|
+ month = 'Aug'
|
|
|
+ break
|
|
|
+ case 9:
|
|
|
+ month = 'Sept'
|
|
|
+ break
|
|
|
+ case 10:
|
|
|
+ month = 'Oct'
|
|
|
+ break
|
|
|
+ case 11:
|
|
|
+ month = 'Nov'
|
|
|
+ break
|
|
|
+ case 12:
|
|
|
+ month = 'Dec'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ return month + ' ' + dt.getDate() + ',' + dt.getFullYear()
|
|
|
+ }
|
|
|
+
|
|
|
+ handleCurrentChange (page:number):void {
|
|
|
+ this.currentPage = page
|
|
|
+ this.getPlanList(page)
|
|
|
+ }
|
|
|
+
|
|
|
+ handleCurrentChangeMobile (page:number) {
|
|
|
+ const totalPageNum = (this.totalNum + this.totalNum % 8) / 8
|
|
|
+ if (page <= 0 || page > totalPageNum) {
|
|
|
+ return undefined
|
|
|
+ } else {
|
|
|
+ this.currentPage = page
|
|
|
+ this.getPlanList(page)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 账户消费充值记录导出
|
|
|
+ exportData () {
|
|
|
+ exportBalanceRecordList({}, {
|
|
|
+ responseType: 'blob'
|
|
|
+ }).then((res:any) => {
|
|
|
+ const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
|
|
|
+ const downloadElement = document.createElement('a') // 创建a标签
|
|
|
+ const href = window.URL.createObjectURL(blob) // 创建下载的链接
|
|
|
+ downloadElement.href = href
|
|
|
+ downloadElement.download = 'plan.xlsx' // 下载后文件名
|
|
|
+ document.body.appendChild(downloadElement)
|
|
|
+ downloadElement.click() // 点击下载
|
|
|
+ document.body.removeChild(downloadElement) // 下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(href) // 释放掉blob对象
|
|
|
+ }).catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ this.$message.error('Failed to export.')
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.plan {
|
|
|
+ .top {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-start;
|
|
|
+ justify-content: space-between;
|
|
|
+ img {
|
|
|
+ width: 28px;
|
|
|
+ height: 28px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ :deep .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+ .pagination {
|
|
|
+ margin-top: 40px;
|
|
|
+ text-align: right;
|
|
|
+ .mobile-page-btn {
|
|
|
+ display: none;
|
|
|
+ ::v-deep .el-button {
|
|
|
+ width: 114px;
|
|
|
+ height: 40px;
|
|
|
+ border-radius: 6px;
|
|
|
+ font-weight: 700;
|
|
|
+ &:first-child {
|
|
|
+ padding-left: 11px;
|
|
|
+ }
|
|
|
+ &:last-child {
|
|
|
+ text-align: right;
|
|
|
+ padding-left: 13px;
|
|
|
+ margin-left: 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ::v-deep .el-button--primary.is-plain {
|
|
|
+ background: #fff;
|
|
|
+ border-color: #1460F3;
|
|
|
+ }
|
|
|
+ ::v-deep [class^=el-icon-] {
|
|
|
+ font-weight: 700;
|
|
|
+ }
|
|
|
+ ::v-deep .el-button--primary.is-plain:hover, .el-button--primary.is-plain:focus {
|
|
|
+ color: #1460F3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+@media screen and (max-width: 767px) {
|
|
|
+ .plan .pagination {
|
|
|
+ text-align: center;
|
|
|
+ .mobile-page-btn {
|
|
|
+ display: inline-block;
|
|
|
+ }
|
|
|
+ .max-page-btn {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+@media screen and (max-width: 320px) {
|
|
|
+ .plan .pagination {
|
|
|
+ .mobile-page-btn {
|
|
|
+ ::v-deep .el-button {
|
|
|
+ width: calc(50% - 6px);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|