ApproveViewNotice.vue 5.17 KB
<template>
    <a-card title="待办事项" size="default" class="approve-view-notice">
        <template #extra><span style="color: #777485">{{ approveCount }}项</span></template>
        <a-calendar v-model:value="filterDate" :fullscreen="false" @panelChange="onPanelChange" @select="changeDate">
            <template #dateCellRender="{ current }">
                <div class="ant-fullcalendar-date">
                    <div v-if="isSpecialDate(current)" class="calender_icon">{{ isSpecialDate(current) }}</div>
                </div>
            </template>
        </a-calendar>
        <a-list :data-source="approveViews" size="small" :bordered="false">
            <template #renderItem="{ item }">
                <a-list-item>
                    <template #actions>
                        <a-button type="link" size="small" @click="goToDetail(item)">跟进</a-button>
                    </template>
                    <a-list-item-meta>
                        <template #title>
                            <approve-type-tag :approve-type="item.approveType"></approve-type-tag>
                            <span style="font-weight: 400">{{ item.name }}</span>

                        </template>
                        <template #description>
                            <span style="min-width: 140px;display: inline-block;margin-right: 16px">创建人 {{ item.createBy }}</span>
                            时间&nbsp;&nbsp;{{ item.createTime }}
                        </template>
                    </a-list-item-meta>
                </a-list-item>
            </template>
        </a-list>
    </a-card>
</template>
<script lang="ts">
import {Component, Vue} from 'vue-facing-decorator';
import {ApproveView} from "lib/src/entity/track/entity/ApproveView";
import {ApproveController} from "@/api/ApproveController";
import ApproveTypeTag from "@/views/common/ApproveTypeTag.vue";
import dayjs, {Dayjs} from "dayjs";
import {NotificationOutlined} from "@ant-design/icons-vue";
import {DateCount} from "lib/src/entity/analysis/domain/DateCount";

@Component({
    components: {ApproveTypeTag, NotificationOutlined}
})
export default class ApproveViewNotice extends Vue {

    approveCount = 0;

    approveViews: ApproveView[] = [];

    filterDate = null;

    dateCounts: DateCount    [] = [];

    isSpecialDate(current: any) {
        const dateStr = current.format('YYYY-MM-DD')
        const filtered = this.dateCounts.find((item) => item.date === dateStr);
        if (filtered) {
            return filtered.count;
        } else {
            return null;
        }
    }

    created(): void {
        this.filterDate = dayjs();
        ApproveController.getLastApproveViews(this.axios, null).then(res => {
            this.approveViews = res.data;
        });
        ApproveController.getApproveViewCount(this.axios).then(res => {
            this.approveCount = res.data;
        });
        this.loadData(this.filterDate);
    }

    onPanelChange(value: Dayjs, mode: string) {
        this.loadData(value);
    }

    loadData(date: Dayjs): void {
        ApproveController.getApproveViewsCountByDate(this.axios, date).then(res => {
            this.dateCounts = res.data;
        });
    }

    changeDate(): void {
        ApproveController.getLastApproveViews(this.axios, this.filterDate).then(res => {
            this.approveViews = res.data;
        });
    }

    goToDetail(approveView: ApproveView): void {
        switch (approveView.approveType) {
            case "ACCOUNT":
                this.$router.push({path: '/account/accounts'});
                break;
            case "APPRAISE_PRICE":
                this.$router.push({path: '/vehicle/appraise'});
                break;
            case "AUCTION":
                this.$router.push({path: '/auction/approve'});
                break;
            case "AUCTION_VEHICLE":
                this.$router.push({path: '/auction/approve'});
                break;
            case "AUCTION_CHANGE":
                this.$router.push({path: '/auction/change'});
                break;
            case "AUCTION_VEHICLE_CHANGE":
                this.$router.push({path: '/auction/change', query: {type: 'vehicle'}});
                break;
            case "PAYMENT":
                this.$router.push({path: '/finance/order-transaction-audit'});
                break;
            case "TRANSFER":
                this.$router.push({path: '/auction/order'});
                break;
            case "WITHDRAW":
                this.$router.push({path: '/finance/withdraw'});
                break;

        }
    }
}
</script>


<style scoped lang="less">
::v-deep(.ant-list-item .ant-list-item-action) {
    padding-right: 0 !important;
    padding-left: 2px !important;

    > li {
        padding-right: 0;

        button {
            padding-right: 0;
        }
    }
}

.approve-view-notice ::v-deep(.ant-card-body) {
    padding: 0 18px 12px 18px;
}


.ant-fullcalendar-date {
    .calender_icon {
        position: absolute;
        top: -8px;
        right: -8px;
        width: 12px;
        //height: 12px;
        z-index: 100;
        border-radius: 6px;
        background-color: red;
        color: white;
        font-size: 10px;
        line-height: 12px;
    }
}
</style>