|
|
@@ -109,7 +109,7 @@
|
|
|
const { data: id } = await tableColsConfigApi.save({
|
|
|
id: this.id,
|
|
|
table: this.tableType,
|
|
|
- columns: JSON.stringify(newValue),
|
|
|
+ columns: JSON.stringify(list.map((item) => item.label)),
|
|
|
})
|
|
|
this.id = id
|
|
|
}
|
|
|
@@ -128,7 +128,14 @@
|
|
|
if (data) {
|
|
|
this.id = data.id
|
|
|
if (data.columns !== '' && data.columns !== '[]') {
|
|
|
- list = this.columns.filter((item) => JSON.parse(data.columns).includes(item.label))
|
|
|
+ const arr = JSON.parse(data.columns)
|
|
|
+ for (const item of list) {
|
|
|
+ const idx = arr.findIndex((it) => item.label == it)
|
|
|
+ item.sort = idx > -1 ? idx : 0
|
|
|
+ }
|
|
|
+ list.sort((pre, cur) => {
|
|
|
+ return pre.sort - cur.sort
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
this.checkColumns = list.map((item) => item.label)
|