Commit 963b386d authored by 杨柠瑞's avatar 杨柠瑞

coding

parent aa396e9c
...@@ -105,11 +105,13 @@ ...@@ -105,11 +105,13 @@
style="width: 100%" @selection-change="handleSelectionChange" @sort-change="sortChange" @current-change="tableCurrentChange"> style="width: 100%" @selection-change="handleSelectionChange" @sort-change="sortChange" @current-change="tableCurrentChange">
<el-table-column type="index" :index="indexMethod" label="序号" width="50px"></el-table-column> <el-table-column type="index" :index="indexMethod" label="序号" width="50px"></el-table-column>
<el-table-column type="selection" width="55" v-if="isShowSelection"></el-table-column> <el-table-column type="selection" width="55" v-if="isShowSelection"></el-table-column>
<el-table-column v-for="(column,index) in showColumns" :key="index" align="center" :label="column.name" :prop="column.codeCamel" :sortable="column.isSort"> <el-table-column v-for="(column,index) in showColumns" :key="index" align="center" :label="column.name"
<template slot-scope="scope"> :prop="column.codeCamel" :sortable="column.isSort" :width="column.width" :show-overflow-tooltip="showOverflowTooltip">
<span v-if="scope.row[column.codeCamel] !== false && scope.row[column.codeCamel] !== true">{{ scope.row[column.codeCamel] }}</span> <template slot-scope="scope">
<el-checkbox v-if="scope.row[column.codeCamel] === false || scope.row[column.codeCamel] === true" v-model="scope.row[column.codeCamel]"></el-checkbox> <span v-if="(scope.row[column.codeCamel] !== false && scope.row[column.codeCamel] !== true )&& !column.render">{{ scope.row[column.codeCamel] }}</span>
</template> <el-checkbox v-if="(scope.row[column.codeCamel] === false || scope.row[column.codeCamel] === true) && !column.render" v-model="scope.row[column.codeCamel]"></el-checkbox>
<span v-if='column.render' v-html="column.render(scope)"></span>
</template>
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="操作" :width="operationWidth" v-if="isShowEditDataButton || isShowDeleteButton || definedOperation.length"> <el-table-column fixed="right" label="操作" :width="operationWidth" v-if="isShowEditDataButton || isShowDeleteButton || definedOperation.length">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -246,6 +248,7 @@ ...@@ -246,6 +248,7 @@
* { * {
* "name": "姓名", * "name": "姓名",
* "codeCamel": "username", * "codeCamel": "username",
* "isSort": false, //是否排序,默认false
* "render": function(value){ * "render": function(value){
* return "<a href='value'></a>" * return "<a href='value'></a>"
* } * }
...@@ -365,6 +368,7 @@ ...@@ -365,6 +368,7 @@
tableId: '', tableId: '',
formTips: '', formTips: '',
formStyle: '', formStyle: '',
showOverflowTooltip: false,
isShowRefresh: false, isShowRefresh: false,
buttonGroup: false, buttonGroup: false,
...@@ -445,7 +449,7 @@ ...@@ -445,7 +449,7 @@
self.showColumns.push(tmp) self.showColumns.push(tmp)
}) })
} else { } else {
self.showColumns = JSON.parse(JSON.stringify(self.columns)) self.showColumns = _.cloneDeep(self.columns)
// 将字符串对象进行替换处理 // 将字符串对象进行替换处理
_.each(self.showColumns, function(column, index) { _.each(self.showColumns, function(column, index) {
if (typeof column === 'string') { if (typeof column === 'string') {
...@@ -777,6 +781,9 @@ ...@@ -777,6 +781,9 @@
if (self.options.showSelection) { // 设置是否显示多选 if (self.options.showSelection) { // 设置是否显示多选
self.isShowSelection = self.options.showSelection self.isShowSelection = self.options.showSelection
} }
if (self.options.showOverflowTooltip) { // 当内容过长被隐藏时显示 tooltip
self.showOverflowTooltip = self.options.showOverflowTooltip
}
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val this.multipleSelection = val
......
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
}, },
data() { data() {
return { return {
showUserColumns: [{ name: '手机号', codeCamel: 'mobile', isSort: true }, { name: '登录ID', codeCamel: 'loginid', isSort: true }, 'username', 'email', { name: '创建时间', codeCamel: 'createTime', isSort: true }], showUserColumns: [
{ name: '手机号', codeCamel: 'mobile', isSort: true },
{ name: '登录ID', codeCamel: 'loginid', isSort: true },
'username', 'email', { name: '创建时间', codeCamel: 'createTime', isSort: true, width: '130px' }
],
userFilters: [ userFilters: [
{ placeholder: '过滤手机号', 'mobile': { 'like': '' }, isShow: true }, { placeholder: '过滤手机号', 'mobile': { 'like': '' }, isShow: true },
{ placeholder: '过滤用户名', 'username': { 'equalTo': '' }, isShow: true }, { placeholder: '过滤用户名', 'username': { 'equalTo': '' }, isShow: true },
...@@ -83,6 +87,7 @@ ...@@ -83,6 +87,7 @@
showDeleteButton: true, showDeleteButton: true,
buttonGroup: false, buttonGroup: false,
showSelection: false, showSelection: false,
showOverflowTooltip: true,
tableCurrentChange(value) {} tableCurrentChange(value) {}
// dataProcessing(value, params, definedOperate) {}, // 处理返回后的数据,必须return 处理后的数据 // dataProcessing(value, params, definedOperate) {}, // 处理返回后的数据,必须return 处理后的数据
// promiseProcessing(value, params, definedOperate) {} // 处理返回后的数据,必须return Promise对象 // promiseProcessing(value, params, definedOperate) {} // 处理返回后的数据,必须return Promise对象
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment