mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-15 07:27:54 +00:00
优化 cl-column-custom 组件
This commit is contained in:
parent
95a638f40c
commit
f7b139abdf
@ -29,7 +29,7 @@
|
|||||||
import { defineComponent, ref, PropType, nextTick, watch } from "vue";
|
import { defineComponent, ref, PropType, nextTick, watch } from "vue";
|
||||||
import store from "store";
|
import store from "store";
|
||||||
import Draggable from "vuedraggable/src/vuedraggable";
|
import Draggable from "vuedraggable/src/vuedraggable";
|
||||||
import { orderBy } from "lodash";
|
import { isBoolean, orderBy } from "lodash-es";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "cl-column-custom",
|
name: "cl-column-custom",
|
||||||
@ -96,15 +96,23 @@ export default defineComponent({
|
|||||||
val
|
val
|
||||||
.filter((e) => !e.type && e.prop)
|
.filter((e) => !e.type && e.prop)
|
||||||
.map((e) => {
|
.map((e) => {
|
||||||
|
let checked = true;
|
||||||
|
let orderNum = e.orderNum || 0;
|
||||||
|
|
||||||
|
if (isBoolean(e.hidden)) {
|
||||||
|
checked = !e.hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selection) {
|
||||||
|
checked = selection.find((a) => a.prop == e.prop)?.checked;
|
||||||
|
orderNum = selection.findIndex((a) => a.prop == e.prop);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: e.label,
|
label: e.label,
|
||||||
prop: e.prop,
|
prop: e.prop,
|
||||||
checked: selection
|
checked,
|
||||||
? selection.find((a) => a.prop == e.prop)?.checked
|
orderNum
|
||||||
: true,
|
|
||||||
orderNum: selection
|
|
||||||
? selection.findIndex((a) => a.prop == e.prop)
|
|
||||||
: e.orderNum || 0
|
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
"orderNum",
|
"orderNum",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user