增加表格重置
This commit is contained in:
parent
337ed6fbb0
commit
67f098aa07
@ -285,12 +285,14 @@
|
||||
this.$refs.columnSetting.isSave = false
|
||||
},
|
||||
//自定义列重置
|
||||
async columnSettingBack(){
|
||||
async columnSettingBack(userColumn){
|
||||
this.$refs.columnSetting.isSave = true
|
||||
try {
|
||||
const column = await config.columnSettingReset(this.tableName, this.column)
|
||||
const column = await config.columnSettingReset(this.tableName, userColumn,this.apiObj)
|
||||
if(column){
|
||||
this.userColumn = column
|
||||
this.$refs.columnSetting.usercolumn = JSON.parse(JSON.stringify(this.userColumn||[]))
|
||||
}
|
||||
}catch(error){
|
||||
this.$message.error('重置失败')
|
||||
this.$refs.columnSetting.isSave = false
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//数据表格配置
|
||||
import tool from '@/utils/tool'
|
||||
// import tool from '@/utils/tool'
|
||||
import http from "@/utils/request";
|
||||
|
||||
export default {
|
||||
@ -39,7 +39,9 @@ export default {
|
||||
}
|
||||
let data = {
|
||||
column_config:column,
|
||||
save_column:true
|
||||
save_column:true,
|
||||
page:1,
|
||||
pageSize:this.pageSize
|
||||
}
|
||||
http.post(params.url, data).then(res=>{
|
||||
if(res.code == 200 && res.data.column){
|
||||
@ -63,6 +65,8 @@ export default {
|
||||
}
|
||||
let data = {
|
||||
table_config:config,
|
||||
page:1,
|
||||
pageSize:this.pageSize
|
||||
}
|
||||
http.post(params.url, data).then(res=>{
|
||||
if(res.code == 200 && res.data.column){
|
||||
@ -78,13 +82,36 @@ export default {
|
||||
* @tableName scTable组件的props->tableName
|
||||
* @column 组件接受到的props->column
|
||||
*/
|
||||
columnSettingReset: function (tableName, column) {
|
||||
return new Promise((resolve) => {
|
||||
//这里为了演示使用了session和setTimeout演示,开发时应用数据请求
|
||||
setTimeout(()=>{
|
||||
tool.session.remove(tableName)
|
||||
resolve(column)
|
||||
},1000)
|
||||
columnSettingReset: function (tableName, column ,params) {
|
||||
column.forEach((item,index)=>{
|
||||
item.sort = index+1;
|
||||
})
|
||||
return new Promise((resolve) => {
|
||||
if(!params.url || params.url==''){
|
||||
resolve(false)
|
||||
return
|
||||
}
|
||||
let data = {
|
||||
column_config:column,
|
||||
save_column:false,
|
||||
page:1,
|
||||
pageSize:this.pageSize
|
||||
}
|
||||
http.post(params.url, data).then(res=>{
|
||||
if(res.code == 200 && res.data.columnConfig){
|
||||
resolve(res.data.columnConfig)
|
||||
}else{
|
||||
resolve(false)
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// return new Promise((resolve) => {
|
||||
// //这里为了演示使用了session和setTimeout演示,开发时应用数据请求
|
||||
// setTimeout(()=>{
|
||||
// tool.session.remove(tableName)
|
||||
// resolve(column)
|
||||
// },1000)
|
||||
// })
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,12 +11,11 @@
|
||||
:props="defaultProps"
|
||||
node-key="id"
|
||||
:expand-on-click-node="false"
|
||||
default-expand-all
|
||||
@node-click="getNodes"
|
||||
>
|
||||
<template #default="{ node }">
|
||||
<span class="custom-tree-node">
|
||||
<span><el-icon><sc-icon-Folder/></el-icon> {{ node.data.name }}</span>
|
||||
<span class="treeName"><el-icon><sc-icon-Folder/></el-icon> {{ node.data.name }}</span>
|
||||
</span>
|
||||
</template>
|
||||
</el-tree>
|
||||
@ -131,8 +130,14 @@ export default {
|
||||
}
|
||||
}
|
||||
.treeMain{
|
||||
padding: 5px;
|
||||
padding: 5px 0;
|
||||
border-radius: 4px;
|
||||
border: 1px solid rgba(0,0,0,0.12);
|
||||
.treeName{
|
||||
display: flex;align-items: center;
|
||||
.el-icon{
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user