let-index=“index” 是循环中的自定义变量 ,从0开始计数,正好用于取出绑定的数据和下拉框 绑定
<st #st [data]="noticedata" [columns]="columns" (change)="change($event)" >
<ng-template st-row="custom" let-item let-index="index" let-column="column">
<nz-select disabled nz-input [ngModel]="noticedata[index].userId" nzPlaceHolder="选择用户" name="userId" >
<nz-option *ngFor="let data of TeacherData" nzLabel="{{data.userName}}" [nzValue]="data.userId"></nz-option>
</nz-select>
</ng-template>
</st>
reder :自定html输入到这个列表中
columns: STColumn[] = [
{ title: 'ID', index: 'noticeId' },
{ title: '标题', index: 'noticeTitle' },
// { title: '内容', index: 'noticeInfo.substr(0,100)' },
{ title: '类型', index: 'noticeType' },
{ title: '发布状态', index: 'status' },
{ title: '发布用户', index: 'userId',render:'custom' },
{
title: '内容',
buttons: [
{
// text: ' 点击查看',
format: item => item.noticeInfo ? '点击查看' : '无内容',
click: (item: any) => item.noticeInfo ? this.view(item.noticeInfo) : '',
}],
},
{ title: '创建时间', index: 'createTime', type: 'date' },
{
title: '操作',
width: '180px',
buttons: [
{
text: '编辑',
type: 'modal',
component: NoticeDetailComponent,
paramName: 'i',
// click: item => this.router.navigateByUrl(`coursesDetail?courseId=${item.materialId}`),
click: () => this.st.reload(),
},
{ text: '删除', click: (item: any) => this.del(item.noticeId) },
],
},
];
this.noticedata = Array(res.data.length).fill({}).map((item: any, i: number) => {
return {
ID: [i + 1],
noticeId: res.data[i].noticeId,
noticeTitle: res.data[i].noticeTitle,
noticeInfo: res.data[i].noticeInfo,
noticeType: res.data[i].noticeType,
status: res.data[i].status,
userId: res.data[i].userId,
projectId: res.data[i].projectId,
createTime: res.data[i].createTime,
updateTime: res.data[i].updateTime,
};
});