Layui 列表根据不同数据展示不同内容,并展示对应颜色
let cols = [[{title: '模板编码', field: 'templateCode', align: 'center'},{title: '消息内容', field: 'messageContent', align: 'center'},{title: '消息状态', field: 'messageStatus', align: 'center', templet: function (d) {if (d.messageStatus === 'NEW') {return '<span style="color: #ffca1e">新建</span>'}if (d.messageStatus === 'SENT') {return '<span style="color: #228018">已发送</span>'}if (d.messageStatus === 'FAILED') {return '<span style="color: #ff371e">失败</span>'}}},{title: '接收人', field: 'receiver', align: 'center'},{title: '失败信息', field: 'failedInfo', align: 'center'},{title: '发送时间', field: 'sendDate', align: 'center'},{title: '接收时间', field: 'receiveDate', align: 'center'},{title: '创建时间', field: 'createdTime', align: 'center'}]]