config.js 2.7 KB

//组件参数数据
export const componentsData = {
};

// 搜索model
export const tshjSearchModel = {
    'bookIdList': null,
    'createdBy': null
};


// 表格展示配置
export const tableColumns = function() {
    return [
        {
            text: '图书',
            field: 'bookId',
            minWidth: 200,
            render: (h, param) => {

                if(param.row.bookId && param.row.bookIdEntity){
                    const text = param.row.bookIdEntity.code;
                    return h('elLink', {
                        props: {
                            type: 'primary'
                        },
                        on: {
                            click: () => {
                                this.handleOpt('VIEW', param.row);
                            }
                        }
                    }, text);
                }
                return '--';
            },
            align: 'left'
        },
        {
            text: '归还时间',
            field: 'returnTime',
            width: 160,
            sortable: true,
            render: (h, param) => {
                if(param.row.returnTime){
                    const text = param.row.returnTime.substr(0,10);
                    return text;
                }
                return '--';
            },
            align: 'left'
        },
        {
            text: '创建人',
            field: 'createdByName',
            align: 'left',
            width: 100
        },
        {
            text: '创建时间',
            field: 'createdAt',
            width: 160,
            sortable: true,
            render: (h, param) => {
                if(param.row.createdAt){
                    const text = param.row.createdAt.substr(0,16);
                    return text;
                }
                return '--';
            },
            align: 'left'
        },
        {
            field: 'opt',
            fixed: 'right',
            text: '操作',
            width: 100,
            render: (h, param) => {
                const row = param.row;
                const optArr = [];
                const deleteBtn = h('QgButton', {
                    props: {
                        toolTip: '还书',
                        type: 'text',
                        icon: 'el-icon-delete'
                    },
                    on: {
                        click: () => {
                            this.handleOpt('DELETE', row);
                        }
                    }
                });
                optArr.push(deleteBtn);

                return h('div', optArr, '');
            }
        }
    ];
};

// 表单对象
export const tshjModel = {
    bookId:null,
    returnTime:null
};