|
@@ -4,6 +4,7 @@ export default {
|
|
|
return {
|
|
|
sortFilterModal:false,
|
|
|
checkboxValue:[],
|
|
|
+ columnsCopy:[],
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
@@ -87,7 +88,11 @@ export default {
|
|
|
return (
|
|
|
<elTable data={this.data}>
|
|
|
{
|
|
|
- this.columns.map(item => {
|
|
|
+ this.columnsCopy.map(item => {
|
|
|
+ //是否显示判断
|
|
|
+ if(!item.isShow) {
|
|
|
+ return
|
|
|
+ }
|
|
|
if (item.actions) {
|
|
|
return this.renderActionColumn(h, item)
|
|
|
} else if (item.render) {
|
|
@@ -227,11 +232,34 @@ export default {
|
|
|
</el-dialog>
|
|
|
},
|
|
|
sortFilterSubmit(){
|
|
|
- console.log(this.checkboxValue)
|
|
|
+ this.columnsCopy.map(items => {
|
|
|
+ items.isShow = false
|
|
|
+ this.checkboxValue.map(j => {
|
|
|
+ if(items.label === j){
|
|
|
+ items.isShow = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取列配置和初始化
|
|
|
+ getSortFilterConfig(){
|
|
|
+ const v = this
|
|
|
+ if(!v.columns){
|
|
|
+ console.log('请配置columns')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.checkboxValue = []
|
|
|
+ v.columns.map(items => {
|
|
|
+ items.isShow = true,
|
|
|
+ this.checkboxValue.push(items.label)
|
|
|
+ })
|
|
|
+ v.columnsCopy = JSON.parse(JSON.stringify(this.columns))
|
|
|
+
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
this.renderSearchInit()
|
|
|
+ this.getSortFilterConfig()
|
|
|
},
|
|
|
name: 'by-table',
|
|
|
render(h) {
|