@rrc-materials/tree-table-block
Version:
rrc materials block for tree-table
52 lines (51 loc) • 1.17 kB
JavaScript
export const COLUMNS = function () {
const self = this
return [
{
fixed: 'left',
type: 'selection',
width: 40
},
{
prop: 'position',
label: '部门',
'min-width': 145,
render (h, { row, $index }) {
const level = row.$$level
const hasChild = row.children && row.children.length > 0
const className = hasChild ? row.$$expanded ? 'el-icon-arrow-down' : 'el-icon-arrow-right' : ''
return (
<span class="rc-tree-table__node"
style={{ marginLeft: `${24 * level}px` }}
onClick={() => { self.toggle($index) }}>
<i class={className}/>
<span>{row.position}</span>
</span>
)
}
},
{
prop: 'name',
label: '负责人',
'min-width': 80
},
{
prop: 'created_at',
label: '创建时间',
'min-width': 100
},
{
prop: 'years',
label: '工作经验',
'min-width': 100
},
{
prop: 'time',
label: '发布时间',
'min-width': 100,
render (h, scope) {
return `${scope.row.time}天`
}
}
]
}