showallDialog.vue 2.86 KB
<template>
    <el-dialog
      :visible.sync="isShow"
      class="manage-dialog xy-dialog track-dialog"
      :close-on-click-modal="false"
      :title="$t('dialog.showAllPic')"
      :before-close="closeDialog">
        <div>
            <el-scrollbar class="track-list-scrollbar" wrap-class="list-scrollbar" :native="false" style="height: 100%; height: 600px; max-height: 600px;">
                <ul class="img-container">
                    <li v-for="(item, index) in imgList" :key="index" class="catch-item">
                        <img :src="item.catchpic" class="catch-img" :onerror="defaultImg" />
                        <p>{{ item.catchtime }}</p>
                    </li>
                    <li v-if="imgList.length == 0" class="nodata-item">{{ noData }}</li>
                </ul>
            </el-scrollbar>
        </div>
    </el-dialog>
</template>

<script>
import defaultImg from '@/assets/img/behavior/default.png'
export default {
    data() {
        return {
            isShow: false,
            imgList: [],
            noData: '',
            defaultImg: 'this.src="' + defaultImg + '"',
        }
    },
    methods: {
        dialogInit(personUnid, param) {
            this.isShow = true;
            this.noData = 'loading...';
            this.imgList = [];
            this.$api.flowReport.captureRecord({
                mallId: param.asis_org,// param.asis_org
                // orgType: 'mall',
                personUnid: personUnid,
                countdate: param.asis_time
            })
                .then(res => {
                    let result = res.data;
                    result.data.forEach(item => {
                        const dateStr = item.counttime.replace(/^(\d{4})-(\d{2})-(\d{2}).*$/, '$1$2$3')
                        this.imgList.unshift({
                            catchtime: item.counttime,
                            catchpic: `${window._vionConfig.picUrl}/picture/face/${dateStr}/${item.channelSerialnum}/${item.facePic}`
                        })
                    })
                    this.noData = this.imgList.length === 0 ? '已开启隐私模式,无图片' : '';
                })
                .catch(err => {
                    this.catchErrorHandle(err)
                })
        },
        closeDialog() {
            this.isShow = false;
            this.imgList = [];
        }
    }
}
</script>

<style scoped>
    .img-container:after
    .img-container:before {
        content: '';
        display: table;
    }
    
    .img-container:after {
        clear: both;
    }

    .img-container {
        /* max-height: 400px;
        overflow-x: hidden;
        overflow-y: auto; */
    }

    .catch-item {
        float: left;
        padding: 14px;
        text-align: center;
    }

    .nodata-item {
        text-align: center;
        font-size: 16px;
    }

    .catch-img {
        height: 120px;
    }
</style>