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