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