DetectionInspectorView.vue 7.25 KB
<template>
    <div>
        <div class="titleBox">
            检测师详情
            <a-button style="float: right;" @click="handleBack()">返回列表</a-button>
        </div>
        <div class="inspectorDetail">
            <a-descriptions :column="5" size="small" layout="vertical">
                <template #title>
                    基本信息
                    <a-button @click="handleEdit()" type="primary" style="float: right;">编辑</a-button>
                </template>
                <a-descriptions-item label="姓名">
                    {{ pageData?.account?.name || '-' }}
                </a-descriptions-item>
                <a-descriptions-item label="手机号">{{ pageData?.account?.phone || '-' }}</a-descriptions-item>
                <a-descriptions-item label="所在城市">{{ pageData?.account?.regionName || '-' }}</a-descriptions-item>
                <a-descriptions-item label="账号状态">
                    <a-tag v-if="pageData?.account?.status == 1" color="#E8F8F2" :style="{ color: '#00AD74' }"
                        :bordered="false">启用</a-tag>
                    <a-tag v-if="pageData?.account?.status == 0" color="#F0F2F5" :style="{ color: '#777C85' }"
                        :bordered="false">禁用</a-tag>
                </a-descriptions-item>
                <a-descriptions-item label="账号创建时间">{{ pageData?.account?.createTime || '-' }}</a-descriptions-item>
            </a-descriptions>
        </div>

        <div style="width: 100%;float: left;margin-top: 24px;">
            <a-row :gutter="24">
                <a-col :span="12">
                    <a-card class="stat-card">
                        <img src="@/assets/detection/inspectorCount.png" class="stat-img">
                        <a-statistic class="stat-data" title="累计已检"
                            :value="pageData?.inspectorSimpleSummary?.inspectCount || 0"></a-statistic>
                    </a-card>
                </a-col>
                <a-col :span="12">
                    <a-card class="stat-card">
                        <img src="@/assets/detection/countInspect.png" class="stat-img">
                        <a-statistic class="stat-data" title="平均检测耗时"
                            :value="convertToHourMinuteSecond(pageData?.inspectorSimpleSummary?.avgInspectCost || 0)">
                        </a-statistic>
                    </a-card>
                </a-col>
            </a-row>
        </div>

        <!-- 关联工单列表 -->
        <div style="width: 100%;float: left;margin-top: 16px;">
            <a-descriptions :column="1" size="small" layout="vertical">
                <template #title>
                    <title-tip-icon></title-tip-icon>
                    关联工单列表
                    <div class="title-line"></div>
                </template>
            </a-descriptions>
            <div style="width: 100%;float: left;">
                <TicketList ref="ticketListRef" :ticketListData="pageData" />
            </div>
        </div>

        <!-- 操作日志 -->
        <div style="width: 100%;float: left;">
            <a-descriptions :column="1" size="small" layout="vertical">
                <template #title>
                    <div>
                        <div>
                            <title-tip-icon></title-tip-icon>
                            操作日志
                        </div>
                        <div @click="handleFold(false)" v-if="isShowFold" class="foldBox">收起
                            <DoubleLeftOutlined color="#666666" font-size="13px;" style="transform: rotate(90deg);" />
                        </div>
                        <div @click="handleFold(true)" v-else class="foldBox">展开
                            <DoubleLeftOutlined color="#666666" font-size="13px;" style="transform: rotate(270deg);" />
                        </div>
                    </div>
                    <div class="title-line"></div>
                </template>
                <a-descriptions-item v-if="isShowFold" label="">
                    <OperationLog ref="operationLogRef" :operationLogData="pageData" />
                </a-descriptions-item>
            </a-descriptions>
        </div>

        <!--编辑检测师弹窗-->
        <InspectorAddForm ref="inspectorAddFormRef" @emitOk="getDetailData" />

    </div>
</template>

<script lang="ts">
import { Component } from 'vue-facing-decorator';
import { PaginationComponent } from "@/components/PaginationComponent";
import { Vehicle } from "lib/src/entity/vehicle/entity/Vehicle";

import { DetectionController } from "@/api/DetectionController";
import TitleDivider from "@/components/TitleDivider.vue";
import TitleTipIcon from "@/components/icons/TitleTipIcon.vue";

import InspectorAddForm from "@/views/detection/inspector/components/InspectorAddForm.vue";
import OperationLog from "@/views/detection/inspector/components/OperationLog.vue";
import TicketList from "@/views/detection/inspector/components/ticketList.vue";
import { DoubleLeftOutlined } from '@ant-design/icons-vue';


@Component({
    components: { TitleDivider, TitleTipIcon, InspectorAddForm, OperationLog, TicketList, DoubleLeftOutlined }
})


export default class DetectionInspectorView extends PaginationComponent<Vehicle> {

    routeData: any = {
        id: '',
        action: ''
    };

    pageData: any = {};

    isShowFold: boolean = true;

    created(): void {
        this.routeData = this.$route.query;
        this.getDetailData();
    }

    getDetailData() {
        DetectionController.inspectDetail(this.axios, { id: this.routeData.id }).then(response => {
            this.pageData = response.data.data || {};
        });
    }

    handleEdit() {
        this.$refs.inspectorAddFormRef.init(this.pageData.account || {});
    }

    handleBack() {
        this.$router.back();
    }

    handleFold(isFold: boolean) {
        this.isShowFold = isFold;
    }

    //秒转换为时分秒
    convertToHourMinuteSecond(seconds: number) {
        const hours = Math.floor(seconds / 3600);
        const minutes = Math.floor((seconds % 3600) / 60);
        return `${hours}小时${minutes}分`;
    }

}
</script>
<style scoped lang="less">
.titleBox {
    width: -webkit-calc(100% - 24px);
    width: -moz-calc(100% - 24px);
    width: calc(100% - 24px);
    height: 32px;
    line-height: 32px;
    margin-left: 12px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.inspectorDetail {
    padding: 16px;
    width: 100%;
    border-radius: 8px;
    float: left;
    margin-top: 12px;
    background: linear-gradient(56.9deg, #e6f6ff 0%, #f0f6ff 28.999999999999996%, #f0f6ff 60%, #e3f1ff 100%);
}

.ant-card .ant-card-body {
    padding: 0 !important;
}

.ant-card-bordered {
    border: none;
}

.stat-card ::v-deep(.ant-card-body) {
    display: flex;
    padding: 0 16px;
    height: 100px;
    border-radius: 8px;
    background: linear-gradient(180deg, #e3f0ff 0%, #f9fbfe 100%);
}

.stat-img {
    width: 36px;
    height: 36px;
    margin-right: 16px;
    margin-top: 32px;
}

.stat-data {
    margin-top: 24px;
}

.title-line {
    width: 100%;
    height: 1px;
    background-color: #F2F4F7;
    margin-top: 10px;
}

.foldBox {
    float: right;
    color: #666666;
    font-size: 13px;
    font-weight: 400;
    margin-top: -16px;
    cursor: pointer;
}

</style>