Commit 0e6a4a38 by luyt

add:1.调整分页逻辑显示 2.调整table多行省略算法

1 parent 9b86d51e
This diff could not be displayed because it is too large.
...@@ -537,14 +537,14 @@ export default { ...@@ -537,14 +537,14 @@ export default {
} }
}, },
{ {
// 类型 // 类型 GLButton | el-button
type: 'el-button', type: 'el-button',
// 名字 //自定义内容 可以是html结构 || 或者字符串 // 名字 //自定义内容 可以是html结构 || 或者字符串
// name: row => { // name: row => {
// return '新增3' // return '新增3'
// }, // },
name: '新增3', name: '新增3',
// 条件判断 fn 或者不传,默认显示(todo promise) // 条件判断 fn 或者不传,默认显示(todo promise), 参数 row ,config
condition: row => { condition: row => {
return true return true
}, },
...@@ -557,7 +557,7 @@ export default { ...@@ -557,7 +557,7 @@ export default {
attrs: { attrs: {
type: 'text' type: 'text'
}, },
//click事件 //click事件 参数 row ,config
listeners: { listeners: {
click: this.conditionFn click: this.conditionFn
} }
......
...@@ -2,27 +2,39 @@ ...@@ -2,27 +2,39 @@
// if (!value) return '' // if (!value) return ''
// // 假设一行的宽是字的个数10 160px的宽度 一个汉字16px // // 假设一行的宽是字的个数10 160px的宽度 一个汉字16px
// const strleng = Math.ceil(columnWidth/16) * line - 2 // // 单元格左右的宽为16
// const strleng = Math.ceil((columnWidth-36)/16) * line - 2
// if (value.length > strleng) { // if (value.length > strleng) {
// return value.substring(0, strleng) + '...' // return value.substring(0, strleng) + '...'
// } // }
// } // }
// export default { const lineEllipsis = (str, originLen, line = 1) => {
// lineEllipsis var len = originLen * line
// } var temp
var icount = 0
const lineEllipsis = (value,columnWidth,line = 1) => { var stren = ''
if (!value) return '' //这段正则表示匹配所有汉字以及全角字符
var patrn = /[^\x00-\xff]/
// 假设一行的宽是字的个数10 160px的宽度 一个汉字16px if (len >= str.length) {
// 单元格左右的宽为16 return str
const strleng = Math.ceil((columnWidth-36)/16) * line - 2
if (value.length > strleng) {
return value.substring(0, strleng) + '...'
} }
for (var i = 0; i < str.length; i++) {
if (icount < len - 3) {
temp = str.substr(i, 1)
if (patrn.exec(temp) == null) {
icount = icount + 1
} else {
icount = icount + 2
}
stren += temp
} else {
break
}
}
return stren + '...'
} }
export default { export default {
lineEllipsis lineEllipsis
}
\ No newline at end of file \ No newline at end of file
}
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
comp = createElButton(component) comp = createElButton(component)
} else if (component.type === 'GLButton') { } else if (component.type === 'GLButton') {
if (hasSelect) { if (hasSelect) {
comp = <el-dropdown-item>{createGlButton(component)}</el-dropdown-item> return (comp = <el-dropdown-item>{createGlButton(component)}</el-dropdown-item>)
} }
comp = createGlButton(component) comp = createGlButton(component)
} }
...@@ -121,9 +121,9 @@ export default { ...@@ -121,9 +121,9 @@ export default {
// status = item.condition(this.buttonItem) // status = item.condition(this.buttonItem)
// } // }
// console.log(objectType(status) ) // console.log(objectType(status) )
status = item.condition(this.buttonItem) status = item.condition(this.buttonItem,item)
} else if (item.type == 'GLButton') { } else if (item.type == 'GLButton') {
status = item.condition(this.buttonItem) && hasPermission.call(this, item.attrs.fn) status = item.condition(this.buttonItem,item) && hasPermission.call(this, item.attrs.fn)
} }
if (status) { if (status) {
return item return item
......
...@@ -287,10 +287,13 @@ export default { ...@@ -287,10 +287,13 @@ export default {
if (this.tableTotal && this.tableTotal > this.page[this.pageConf.pageSize]) { if (this.tableTotal && this.tableTotal > this.page[this.pageConf.pageSize]) {
return true return true
} }
//传list api的情况 //传list api的情况 总数 一页多少条
if (this.page[this.pageConf.pageNum] <= 1) { if(this.total <= this.page[this.pageConf.pageSize]){
return false return false
} }
// if (this.page[this.pageConf.pageNum] <= 1) {
// return false
// }
return true return true
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!