}}}
prop={this.column.prop} label={this.column.label}>
</el-table-column>
}else {
return <el-table-column
{...{style: this.style, scopedSlots: {
default: (scope) => {
let value = scope.row[scope.column.property];
if (/((?=d)|(^总计$)/g.test(this.column.label)) {
let col = scope.column.property;
return <div id={col+scope.$index} >
<p onClick={this.clickHandle}>{value}</p>
</div>;
}else return <p>{value}</p>;
}
}}}
prop={this.column.prop} label={this.column.label}>
</el-table-column>
}
let buildTitles = (childList) => {
let children = [];
childList.map(child => {
if (child.children != undefined && child.children.length > 0) {
children.push(<el-table-column {...{style: this.style}} label={child.label}>
{buildTitles(child.children)}
</el-table-column>)
} else {
children.push(
<el-table-column {...{style: this.style, scopedSlots: scopedSlots}}
label={child.label} prop={child.prop}>
</el-table-column>)
}
});
return children;
};
return <el-table-column
{...{style: this.style}}
label={this.column.label}
prop={this.column.prop}>
{buildTitles(this.column.children)}
</el-table-column>;
},
methods: {
blurHandler(e) {
let parent = e.target.parentNode;
let child = parent.firstElementChild;
let p = document.createElement('p');
let value = child.value.match(/^d*(.{1}d+)?/)[0];
if (value == '' || value == null) {
value = 0;
}
p.innerHTML = value;
p.addEventListener('click', this.clickHandle, false);
child.replaceWith(p);
this.$emit('dataChange', parent.id);
},
clickHandle(e) {
let parent = e.target.parentNode;
let child = parent.firstElementChild;
let input = document.createElement('input');
input.style.lineHeight = '23px';
input.style.textAlign = 'center';
input.style.fontSize = '12px';
input.style.height = '23px'
input.style.width = '100%';
input.value = child.innerHTML;
input.addEventListener('blur', this.blurHandler, true);
input.addEventListener('keyup', this.keyUpHandler, false);










