Skip to content

Commit f7b139a

Browse files
committed
优化 cl-column-custom 组件
1 parent 95a638f commit f7b139a

File tree

1 file changed

+15
-7
lines changed
  • src/modules/base/components/column-custom

1 file changed

+15
-7
lines changed

src/modules/base/components/column-custom/index.vue

+15-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import { defineComponent, ref, PropType, nextTick, watch } from "vue";
3030
import store from "store";
3131
import Draggable from "vuedraggable/src/vuedraggable";
32-
import { orderBy } from "lodash";
32+
import { isBoolean, orderBy } from "lodash-es";
3333
3434
export default defineComponent({
3535
name: "cl-column-custom",
@@ -96,15 +96,23 @@ export default defineComponent({
9696
val
9797
.filter((e) => !e.type && e.prop)
9898
.map((e) => {
99+
let checked = true;
100+
let orderNum = e.orderNum || 0;
101+
102+
if (isBoolean(e.hidden)) {
103+
checked = !e.hidden;
104+
}
105+
106+
if (selection) {
107+
checked = selection.find((a) => a.prop == e.prop)?.checked;
108+
orderNum = selection.findIndex((a) => a.prop == e.prop);
109+
}
110+
99111
return {
100112
label: e.label,
101113
prop: e.prop,
102-
checked: selection
103-
? selection.find((a) => a.prop == e.prop)?.checked
104-
: true,
105-
orderNum: selection
106-
? selection.findIndex((a) => a.prop == e.prop)
107-
: e.orderNum || 0
114+
checked,
115+
orderNum
108116
};
109117
}),
110118
"orderNum",

0 commit comments

Comments
 (0)