<template>
    <a-card :bordered="false" :body-style="{ padding: '0px 0px 8px' }" >
        <a-table
            :columns="columns"
            :data-source="dataLogs"
            rowKey="id"
            :pagination="{ pageSize: 50 }"
            :scroll="{ y: 240 }"
            :loading = "logLoading"
        />
    </a-card>
</template>
<script>

import { postAction } from '@/api/manage'
import JEllipsis from "@/components/jeecg/JEllipsis"
export default {
    name: 'CustomerInfoLog',
    components: {
      JEllipsis
    },
    data() {
        let ellipsis = (v, l = 60) => (<j-ellipsis value = {v} length = {l}/>)
        return {
            columns: [
            {
                title:'操作时间',
                align:"center",
                width: 180,
                dataIndex: 'createTime'
            },
            {
                title:'操作人',
                align:"center",
                width: 160,
                dataIndex: 'createBy_dictText'
            },
            {
                title:'类型',
                align:"center",
                width: 160,
                dataIndex: 'type_dictText'
            },
            {
                title:'操作内容',
                align:"center",
                dataIndex: 'descType1',
                customRender: (text ,row) => {
                    var textTemp = text;
                    if (row.descComm1 !== null) {
                        textTemp = textTemp + row.descComm1
                    }
                    if (row.descType2 !== null) {
                        textTemp = textTemp + row.descType2
                    }
                    if (row.descComm2 !== null) {
                        textTemp = textTemp + row.descComm2
                    }
                    if (row.descType3 !== null) {
                        textTemp = textTemp + row.descType3
                    }
                    if (row.descComm3 !== null) {
                        textTemp = textTemp + row.descComm3
                    }
                    return ellipsis(textTemp);
                }
            },
            ],
            dataLogs: undefined,
            logLoading: false,
        }
    },
    props: ['infoShow', 'dataPara'],
    created() { //没用watch 用的create 传入不同的key  key不同每次都会调用刷新 尤其应用在tabs上
        this.logLoading = true;
        let para = {
            id: this.dataPara.id
        }
        postAction("/customer/customerLogs/queryByCustomerId", para).then((res) => {
            this.dataLogs = res.result.records;
            this.logLoading = false;
        }); 
    },
    methods: {

    }
}
</script>
  