widget.qw 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/style.css +19 -19
- package/build/widget.qw.es.js +103 -24
- package/build/widget.qw.umd.js +102 -23
- package/package.json +1 -1
- package/src/components/CascaderPicker.vue +30 -14
- package/src/components/CascaderPop.vue +45 -10
- package/src/util/array_util.js +30 -8
- package/src/views/cascaderpicker/userpicker.vue +2 -2
- package/src/views/userpicker/index.vue +3 -1
package/build/style.css
CHANGED
|
@@ -675,25 +675,25 @@
|
|
|
675
675
|
margin:3px;
|
|
676
676
|
}
|
|
677
677
|
|
|
678
|
-
.cascader-pop[data-v-
|
|
678
|
+
.cascader-pop[data-v-1f4b2244] {
|
|
679
679
|
width: 100%;
|
|
680
680
|
overflow: hidden;
|
|
681
681
|
}
|
|
682
|
-
.cascader-selector[data-v-
|
|
682
|
+
.cascader-selector[data-v-1f4b2244] {
|
|
683
683
|
padding: 10px;
|
|
684
684
|
}
|
|
685
|
-
.search-buttons[data-v-
|
|
685
|
+
.search-buttons[data-v-1f4b2244] {
|
|
686
686
|
display: flex;
|
|
687
687
|
gap: 10px;
|
|
688
688
|
}
|
|
689
|
-
.clear-btn[data-v-
|
|
689
|
+
.clear-btn[data-v-1f4b2244] {
|
|
690
690
|
background-color: #f2f3f5;
|
|
691
691
|
border: none;
|
|
692
692
|
border-radius: 4px;
|
|
693
693
|
padding: 4px 8px;
|
|
694
694
|
font-size: 14px;
|
|
695
695
|
}
|
|
696
|
-
.confirm-btn[data-v-
|
|
696
|
+
.confirm-btn[data-v-1f4b2244] {
|
|
697
697
|
background-color: #1989fa;
|
|
698
698
|
color: white;
|
|
699
699
|
border: none;
|
|
@@ -701,19 +701,19 @@
|
|
|
701
701
|
padding: 4px 8px;
|
|
702
702
|
font-size: 14px;
|
|
703
703
|
}
|
|
704
|
-
.no-results[data-v-
|
|
704
|
+
.no-results[data-v-1f4b2244] {
|
|
705
705
|
text-align: center;
|
|
706
706
|
padding: 20px;
|
|
707
707
|
color: #969799;
|
|
708
708
|
}
|
|
709
|
-
.cascader-header[data-v-
|
|
709
|
+
.cascader-header[data-v-1f4b2244] {
|
|
710
710
|
padding: 10px;
|
|
711
711
|
border-bottom: 1px solid #ebedf0;
|
|
712
712
|
display: flex;
|
|
713
713
|
justify-content: space-between;
|
|
714
714
|
align-items: center;
|
|
715
715
|
}
|
|
716
|
-
.current-path[data-v-
|
|
716
|
+
.current-path[data-v-1f4b2244] {
|
|
717
717
|
flex: 1;
|
|
718
718
|
font-size: 14px;
|
|
719
719
|
margin-left: 5px;
|
|
@@ -722,25 +722,25 @@
|
|
|
722
722
|
overflow: hidden;
|
|
723
723
|
text-overflow: ellipsis;
|
|
724
724
|
}
|
|
725
|
-
.header-right[data-v-
|
|
725
|
+
.header-right[data-v-1f4b2244] {
|
|
726
726
|
display: flex;
|
|
727
727
|
gap: 8px;
|
|
728
728
|
margin-left: auto;
|
|
729
729
|
}
|
|
730
|
-
.cancel-btn[data-v-
|
|
730
|
+
.cancel-btn[data-v-1f4b2244] {
|
|
731
731
|
color: #969799;
|
|
732
732
|
margin-right: 5px;
|
|
733
733
|
}
|
|
734
|
-
.scroll-container[data-v-
|
|
734
|
+
.scroll-container[data-v-1f4b2244] {
|
|
735
735
|
height: calc(80vh - 150px);
|
|
736
736
|
overflow-y: auto;
|
|
737
737
|
}
|
|
738
|
-
.cell-content[data-v-
|
|
738
|
+
.cell-content[data-v-1f4b2244] {
|
|
739
739
|
display: flex;
|
|
740
740
|
align-items: center;
|
|
741
741
|
gap: 12px;
|
|
742
742
|
}
|
|
743
|
-
.circle-selector[data-v-
|
|
743
|
+
.circle-selector[data-v-1f4b2244] {
|
|
744
744
|
width: 20px;
|
|
745
745
|
height: 20px;
|
|
746
746
|
border-radius: 50%;
|
|
@@ -750,29 +750,29 @@
|
|
|
750
750
|
transition: all 0.2s;
|
|
751
751
|
flex-shrink: 0;
|
|
752
752
|
}
|
|
753
|
-
.circle-selector.selected[data-v-
|
|
753
|
+
.circle-selector.selected[data-v-1f4b2244] {
|
|
754
754
|
background-color: #1989fa;
|
|
755
755
|
border-color: #1989fa;
|
|
756
756
|
}
|
|
757
|
-
.circle-selector.selected .van-icon[data-v-
|
|
757
|
+
.circle-selector.selected .van-icon[data-v-1f4b2244] {
|
|
758
758
|
color: white;
|
|
759
759
|
font-size: 14px;
|
|
760
760
|
}
|
|
761
|
-
.van-cell__right-icon[data-v-
|
|
761
|
+
.van-cell__right-icon[data-v-1f4b2244] {
|
|
762
762
|
color: #969799;
|
|
763
763
|
font-size: 16px;
|
|
764
764
|
margin-left: 8px;
|
|
765
765
|
}
|
|
766
|
-
.name[data-v-
|
|
766
|
+
.name[data-v-1f4b2244] {
|
|
767
767
|
flex: 1;
|
|
768
768
|
overflow: hidden;
|
|
769
769
|
text-overflow: ellipsis;
|
|
770
770
|
white-space: nowrap;
|
|
771
771
|
}
|
|
772
|
-
.cancel-btn[data-v-
|
|
772
|
+
.cancel-btn[data-v-1f4b2244] {
|
|
773
773
|
color: #969799;
|
|
774
774
|
}
|
|
775
|
-
.search-field[data-v-
|
|
775
|
+
.search-field[data-v-1f4b2244] {
|
|
776
776
|
background: #fff;
|
|
777
777
|
padding: 10px 16px;
|
|
778
778
|
border-bottom: 1px solid #ebedf0;
|
package/build/widget.qw.es.js
CHANGED
|
@@ -38,7 +38,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
38
38
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
import { computed, resolveComponent, openBlock, createElementBlock, unref, createVNode, createCommentVNode, createElementVNode, toDisplayString, onUnmounted, onDeactivated, isRef, watch, onMounted, nextTick, onActivated, ref, reactive, getCurrentInstance, provide, inject, isVNode, defineComponent, onBeforeUnmount, watchEffect, mergeProps, Transition, Teleport, withDirectives, vShow, Fragment, createApp, resolveDirective, createBlock, withCtx, renderList, createTextVNode, createSlots, withModifiers, onBeforeUpdate, normalizeClass, renderSlot } from "vue";
|
|
41
|
+
import { computed, resolveComponent, openBlock, createElementBlock, unref, createVNode, createCommentVNode, createElementVNode, toDisplayString, onUnmounted, onDeactivated, isRef, watch, onMounted, nextTick, onActivated, ref, reactive, getCurrentInstance, provide, inject, isVNode, defineComponent, onBeforeUnmount, watchEffect, mergeProps, Transition, Teleport, withDirectives, vShow, Fragment, createApp, resolveDirective, createBlock, withCtx, renderList, createTextVNode, createSlots, withModifiers, onBeforeUpdate, normalizeClass, renderSlot, pushScopeId, popScopeId } from "vue";
|
|
42
42
|
var vm = {};
|
|
43
43
|
var HeadBar_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.enterprise-header[data-v-435ecee6] {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n height: 48px;\r\n background-color: #2d8cf0; /* \u4F01\u4E1A\u5FAE\u4FE1\u98CE\u683C\u84DD\u8272 */\r\n background-color: #fff;\r\n color: white;\r\n color: #000;\r\n position: relative;\r\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);\r\n margin-bottom: 4px;\n}\n.header-title[data-v-435ecee6] {\r\n font-size: 14px;\r\n font-weight: 500;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n max-width: 70%;\n}\n.header-btn[data-v-435ecee6] {\r\n position: absolute;\r\n width: 48px;\r\n height: 48px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n background: transparent;\r\n border: none;\r\n color: white;\r\n color: #000;\r\n font-size: 20px;\r\n cursor: pointer;\r\n padding: 0;\n}\n.header-btn[data-v-435ecee6]:disabled {\r\n opacity: 0.5;\r\n cursor: not-allowed;\n}\n.back-btn[data-v-435ecee6] {\r\n left: 0;\n}\n.home-btn[data-v-435ecee6] {\r\n right: 0;\n}\r\n \r\n \r\n ")();
|
|
44
44
|
var _export_sfc = (sfc, props2) => {
|
|
@@ -6255,12 +6255,32 @@ function uniqCode(arr) {
|
|
|
6255
6255
|
}
|
|
6256
6256
|
return Array.from(uniqueMap.values());
|
|
6257
6257
|
}
|
|
6258
|
+
function uniqMerge(arr1, arr2) {
|
|
6259
|
+
let totalArr = [...arr1, ...arr2];
|
|
6260
|
+
return uniq(totalArr);
|
|
6261
|
+
}
|
|
6262
|
+
function substractAry(arr1, arr2) {
|
|
6263
|
+
if (!Array.isArray(arr2) || !arr2 || arr2.length < 1)
|
|
6264
|
+
return arr1;
|
|
6265
|
+
return arr1.filter((item) => !arr2.includes(item));
|
|
6266
|
+
}
|
|
6267
|
+
function isContainAry(arr1, arr2) {
|
|
6268
|
+
if (!Array.isArray(arr1) || !Array.isArray(arr2))
|
|
6269
|
+
return false;
|
|
6270
|
+
if (arr2.length === 0)
|
|
6271
|
+
return true;
|
|
6272
|
+
const set2 = new Set(arr1);
|
|
6273
|
+
return arr2.every((item) => set2.has(item));
|
|
6274
|
+
}
|
|
6258
6275
|
var ArrayUtil = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6259
6276
|
__proto__: null,
|
|
6260
6277
|
arySwapPrev,
|
|
6261
6278
|
arySwapNext,
|
|
6262
6279
|
uniq,
|
|
6263
|
-
uniqCode
|
|
6280
|
+
uniqCode,
|
|
6281
|
+
uniqMerge,
|
|
6282
|
+
substractAry,
|
|
6283
|
+
isContainAry
|
|
6264
6284
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6265
6285
|
function fittingString(str, maxWidth, fontSize) {
|
|
6266
6286
|
var fontWidth = fontSize * 1.3;
|
|
@@ -19521,8 +19541,8 @@ const _hoisted_10$1 = /* @__PURE__ */ createTextVNode(" \u5168\u9009 ");
|
|
|
19521
19541
|
const _hoisted_11$1 = {
|
|
19522
19542
|
class: "search-container"
|
|
19523
19543
|
};
|
|
19524
|
-
const _hoisted_12 = /* @__PURE__ */ createTextVNode("\u641C\u7D22");
|
|
19525
|
-
const _hoisted_13 = {
|
|
19544
|
+
const _hoisted_12$1 = /* @__PURE__ */ createTextVNode("\u641C\u7D22");
|
|
19545
|
+
const _hoisted_13$1 = {
|
|
19526
19546
|
class: "scroll-container"
|
|
19527
19547
|
};
|
|
19528
19548
|
const _sfc_main$h = {
|
|
@@ -19938,9 +19958,9 @@ const _sfc_main$h = {
|
|
|
19938
19958
|
onClick: searchUserById,
|
|
19939
19959
|
class: "search-btn"
|
|
19940
19960
|
}, {
|
|
19941
|
-
default: withCtx(() => [_hoisted_12]),
|
|
19961
|
+
default: withCtx(() => [_hoisted_12$1]),
|
|
19942
19962
|
_: 1
|
|
19943
|
-
})]), createElementVNode("div", _hoisted_13, [!searchUserId.value && currentDepartments.value.length > 0 ? (openBlock(), createBlock(_component_van_cell_group, {
|
|
19963
|
+
})]), createElementVNode("div", _hoisted_13$1, [!searchUserId.value && currentDepartments.value.length > 0 ? (openBlock(), createBlock(_component_van_cell_group, {
|
|
19944
19964
|
key: 0
|
|
19945
19965
|
}, {
|
|
19946
19966
|
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(currentDepartments.value, (dept) => {
|
|
@@ -21615,7 +21635,8 @@ const _sfc_main$4 = {
|
|
|
21615
21635
|
}
|
|
21616
21636
|
};
|
|
21617
21637
|
var TreePicker = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ebc14630"]]);
|
|
21618
|
-
var CascaderPop_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.cascader-pop[data-v-
|
|
21638
|
+
var CascaderPop_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.cascader-pop[data-v-1f4b2244] {\r\n width: 100%;\r\n overflow: hidden;\n}\n.cascader-selector[data-v-1f4b2244] {\r\n padding: 10px;\n}\n.search-buttons[data-v-1f4b2244] {\r\n display: flex;\r\n gap: 10px;\n}\n.clear-btn[data-v-1f4b2244] {\r\n background-color: #f2f3f5;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.confirm-btn[data-v-1f4b2244] {\r\n background-color: #1989fa;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.no-results[data-v-1f4b2244] {\r\n text-align: center;\r\n padding: 20px;\r\n color: #969799;\n}\n.cascader-header[data-v-1f4b2244] {\r\n padding: 10px;\r\n border-bottom: 1px solid #ebedf0;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\n}\n.current-path[data-v-1f4b2244] {\r\n flex: 1;\r\n font-size: 14px;\r\n margin-left: 5px;\r\n color: #323233;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\n}\n.header-right[data-v-1f4b2244] {\r\n display: flex;\r\n gap: 8px;\r\n margin-left: auto;\n}\n.cancel-btn[data-v-1f4b2244] {\r\n color: #969799;\r\n margin-right: 5px;\n}\n.scroll-container[data-v-1f4b2244] {\r\n height: calc(80vh - 150px);\r\n overflow-y: auto;\n}\n.cell-content[data-v-1f4b2244] {\r\n display: flex;\r\n align-items: center;\r\n gap: 12px;\n}\n.circle-selector[data-v-1f4b2244] {\r\n width: 20px;\r\n height: 20px;\r\n border-radius: 50%;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n transition: all 0.2s;\r\n flex-shrink: 0;\n}\n.circle-selector.selected[data-v-1f4b2244] {\r\n background-color: #1989fa;\r\n border-color: #1989fa;\n}\n.circle-selector.selected .van-icon[data-v-1f4b2244] {\r\n color: white;\r\n font-size: 14px;\n}\n.van-cell__right-icon[data-v-1f4b2244] {\r\n color: #969799;\r\n font-size: 16px;\r\n margin-left: 8px;\n}\n.name[data-v-1f4b2244] {\r\n flex: 1;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\n}\n.cancel-btn[data-v-1f4b2244] {\r\n color: #969799;\n}\n.search-field[data-v-1f4b2244] {\r\n background: #fff;\r\n padding: 10px 16px;\r\n border-bottom: 1px solid #ebedf0;\r\n position: sticky;\r\n top: 0;\r\n z-index: 999;\r\n margin-bottom: 10px;\r\n flex-shrink: 0;\r\n /* \u9632\u6B62\u538B\u7F29 */\n}\r\n")();
|
|
21639
|
+
const _withScopeId = (n) => (pushScopeId("data-v-1f4b2244"), n = n(), popScopeId(), n);
|
|
21619
21640
|
const _hoisted_1$3 = {
|
|
21620
21641
|
class: "cascader-selector"
|
|
21621
21642
|
};
|
|
@@ -21640,7 +21661,14 @@ const _hoisted_9$1 = {
|
|
|
21640
21661
|
class: "cell-content"
|
|
21641
21662
|
};
|
|
21642
21663
|
const _hoisted_10 = ["onClick"];
|
|
21643
|
-
const _hoisted_11 = {
|
|
21664
|
+
const _hoisted_11 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", {
|
|
21665
|
+
class: "name"
|
|
21666
|
+
}, "\u5168\u9009", -1));
|
|
21667
|
+
const _hoisted_12 = {
|
|
21668
|
+
class: "cell-content"
|
|
21669
|
+
};
|
|
21670
|
+
const _hoisted_13 = ["onClick"];
|
|
21671
|
+
const _hoisted_14 = {
|
|
21644
21672
|
class: "name"
|
|
21645
21673
|
};
|
|
21646
21674
|
const _sfc_main$3 = {
|
|
@@ -21685,6 +21713,25 @@ const _sfc_main$3 = {
|
|
|
21685
21713
|
keyword: "",
|
|
21686
21714
|
selectedNodeIds: []
|
|
21687
21715
|
});
|
|
21716
|
+
const isSelectAll = computed({
|
|
21717
|
+
get() {
|
|
21718
|
+
let optionIds = optionNodes.value.filter((item) => item.canCheck).map((item) => item.id);
|
|
21719
|
+
if (optionIds.length < 1)
|
|
21720
|
+
return false;
|
|
21721
|
+
return util.isContainAry(data2.selectedNodeIds, optionIds);
|
|
21722
|
+
},
|
|
21723
|
+
set(val) {
|
|
21724
|
+
let optionIds = optionNodes.value.filter((item) => item.canCheck).map((item) => item.id);
|
|
21725
|
+
if (val) {
|
|
21726
|
+
data2.selectedNodeIds = util.uniqMerge(data2.selectedNodeIds, optionIds);
|
|
21727
|
+
} else {
|
|
21728
|
+
data2.selectedNodeIds = util.substractAry(data2.selectedNodeIds, optionIds);
|
|
21729
|
+
}
|
|
21730
|
+
}
|
|
21731
|
+
});
|
|
21732
|
+
const onToggleAll = () => {
|
|
21733
|
+
isSelectAll.value = !isSelectAll.value;
|
|
21734
|
+
};
|
|
21688
21735
|
onMounted(() => {
|
|
21689
21736
|
});
|
|
21690
21737
|
const optionNodes = computed(() => {
|
|
@@ -21717,7 +21764,8 @@ const _sfc_main$3 = {
|
|
|
21717
21764
|
props2.idQueryNode({
|
|
21718
21765
|
id: parentId,
|
|
21719
21766
|
isReturnParent,
|
|
21720
|
-
hasChildren: true
|
|
21767
|
+
hasChildren: true,
|
|
21768
|
+
hasUsers: true
|
|
21721
21769
|
}, (node) => {
|
|
21722
21770
|
data2.parentNode = node;
|
|
21723
21771
|
});
|
|
@@ -21738,6 +21786,7 @@ const _sfc_main$3 = {
|
|
|
21738
21786
|
params.isReturnParent = true;
|
|
21739
21787
|
params.hasChildren = false;
|
|
21740
21788
|
params.hasPaths = true;
|
|
21789
|
+
params.hasUsers = true;
|
|
21741
21790
|
let selectNode = null;
|
|
21742
21791
|
yield props2.idQueryNode(params, (node) => {
|
|
21743
21792
|
data2.parentNode = node;
|
|
@@ -21781,7 +21830,9 @@ const _sfc_main$3 = {
|
|
|
21781
21830
|
props2.idQueryNode({
|
|
21782
21831
|
id: node.id,
|
|
21783
21832
|
isReturnParent: false,
|
|
21784
|
-
hasChildren: true
|
|
21833
|
+
hasChildren: true,
|
|
21834
|
+
hasPaths: true,
|
|
21835
|
+
hasUsers: true
|
|
21785
21836
|
}, (node2) => {
|
|
21786
21837
|
data2.parentNode = node2;
|
|
21787
21838
|
});
|
|
@@ -21793,6 +21844,7 @@ const _sfc_main$3 = {
|
|
|
21793
21844
|
params.isReturnParent = true;
|
|
21794
21845
|
params.hasChildren = true;
|
|
21795
21846
|
params.hasPaths = true;
|
|
21847
|
+
params.hasUsers = true;
|
|
21796
21848
|
yield props2.idQueryNode(params, (node) => {
|
|
21797
21849
|
data2.parentNode = node;
|
|
21798
21850
|
});
|
|
@@ -21859,11 +21911,29 @@ const _sfc_main$3 = {
|
|
|
21859
21911
|
}, "\u641C\u7D22")]),
|
|
21860
21912
|
_: 1
|
|
21861
21913
|
}, 8, ["modelValue", "placeholder"]), createElementVNode("div", _hoisted_8$1, [createVNode(_component_van_cell_group, null, {
|
|
21862
|
-
default: withCtx(() => [
|
|
21914
|
+
default: withCtx(() => [props2.multiple ? (openBlock(), createBlock(_component_van_cell, {
|
|
21915
|
+
key: 0
|
|
21916
|
+
}, {
|
|
21917
|
+
title: withCtx(() => [createElementVNode("div", _hoisted_9$1, [createElementVNode("div", {
|
|
21918
|
+
class: "circle-selector",
|
|
21919
|
+
onClick: withModifiers(onToggleAll, ["stop"])
|
|
21920
|
+
}, [unref(isSelectAll) ? (openBlock(), createBlock(_component_van_icon, {
|
|
21921
|
+
key: 0,
|
|
21922
|
+
name: "success",
|
|
21923
|
+
size: "20",
|
|
21924
|
+
color: "#409eff"
|
|
21925
|
+
})) : createCommentVNode("", true), !unref(isSelectAll) ? (openBlock(), createBlock(_component_van_icon, {
|
|
21926
|
+
key: 1,
|
|
21927
|
+
name: "circle",
|
|
21928
|
+
size: "20",
|
|
21929
|
+
color: "#e0e0e0"
|
|
21930
|
+
})) : createCommentVNode("", true)], 8, _hoisted_10), _hoisted_11])]),
|
|
21931
|
+
_: 1
|
|
21932
|
+
})) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(optionNodes), (item, i) => {
|
|
21863
21933
|
return openBlock(), createBlock(_component_van_cell, {
|
|
21864
21934
|
key: i
|
|
21865
21935
|
}, createSlots({
|
|
21866
|
-
title: withCtx(() => [createElementVNode("div",
|
|
21936
|
+
title: withCtx(() => [createElementVNode("div", _hoisted_12, [item.canCheck ? (openBlock(), createElementBlock("div", {
|
|
21867
21937
|
key: 0,
|
|
21868
21938
|
class: "circle-selector",
|
|
21869
21939
|
onClick: withModifiers(($event) => onToggle(item), ["stop"])
|
|
@@ -21877,7 +21947,7 @@ const _sfc_main$3 = {
|
|
|
21877
21947
|
name: "circle",
|
|
21878
21948
|
size: "20",
|
|
21879
21949
|
color: "#e0e0e0"
|
|
21880
|
-
})) : createCommentVNode("", true)], 8,
|
|
21950
|
+
})) : createCommentVNode("", true)], 8, _hoisted_13)) : createCommentVNode("", true), createElementVNode("span", _hoisted_14, toDisplayString(item.label), 1)])]),
|
|
21881
21951
|
_: 2
|
|
21882
21952
|
}, [item.canExpand ? {
|
|
21883
21953
|
name: "right-icon",
|
|
@@ -21894,7 +21964,7 @@ const _sfc_main$3 = {
|
|
|
21894
21964
|
};
|
|
21895
21965
|
}
|
|
21896
21966
|
};
|
|
21897
|
-
var CascaderPop = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
21967
|
+
var CascaderPop = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-1f4b2244"]]);
|
|
21898
21968
|
const _hoisted_1$2 = {
|
|
21899
21969
|
style: {
|
|
21900
21970
|
"display": "flex",
|
|
@@ -21999,21 +22069,30 @@ const _sfc_main$2 = {
|
|
|
21999
22069
|
ids = modelValue2.value;
|
|
22000
22070
|
if (ids.length < 1)
|
|
22001
22071
|
return [];
|
|
22002
|
-
let
|
|
22072
|
+
let res = [];
|
|
22073
|
+
let receivedNodes = [];
|
|
22074
|
+
for (var i = 0; i < ids.length; i++) {
|
|
22075
|
+
let nodeId = ids[i];
|
|
22076
|
+
let selectNode = null;
|
|
22077
|
+
selectNode = util.findNode(nodeId, receivedNodes);
|
|
22078
|
+
if (selectNode) {
|
|
22079
|
+
res = [...res, selectNode];
|
|
22080
|
+
continue;
|
|
22081
|
+
}
|
|
22003
22082
|
let params = {};
|
|
22004
22083
|
params.id = nodeId;
|
|
22005
|
-
params.isReturnParent =
|
|
22084
|
+
params.isReturnParent = false;
|
|
22006
22085
|
params.hasChildren = false;
|
|
22007
|
-
params.hasPaths =
|
|
22008
|
-
|
|
22086
|
+
params.hasPaths = false;
|
|
22087
|
+
params.hasUsers = true;
|
|
22009
22088
|
yield props2.idQueryNode(params, (node) => {
|
|
22010
|
-
|
|
22011
|
-
selectNode = util.findNode(nodeId,
|
|
22089
|
+
receivedNodes = [...receivedNodes, ...node.children || []];
|
|
22090
|
+
selectNode = util.findNode(nodeId, receivedNodes);
|
|
22012
22091
|
});
|
|
22013
|
-
|
|
22014
|
-
|
|
22015
|
-
|
|
22016
|
-
return
|
|
22092
|
+
if (selectNode)
|
|
22093
|
+
res = [...res, selectNode];
|
|
22094
|
+
}
|
|
22095
|
+
return res;
|
|
22017
22096
|
});
|
|
22018
22097
|
watch(() => JSON.stringify(modelValue2.value), (n, o) => __async(this, null, function* () {
|
|
22019
22098
|
if (!props2.multiple) {
|
package/build/widget.qw.umd.js
CHANGED
|
@@ -6258,12 +6258,32 @@ var __async = (__this, __arguments, generator) => {
|
|
|
6258
6258
|
}
|
|
6259
6259
|
return Array.from(uniqueMap.values());
|
|
6260
6260
|
}
|
|
6261
|
+
function uniqMerge(arr1, arr2) {
|
|
6262
|
+
let totalArr = [...arr1, ...arr2];
|
|
6263
|
+
return uniq(totalArr);
|
|
6264
|
+
}
|
|
6265
|
+
function substractAry(arr1, arr2) {
|
|
6266
|
+
if (!Array.isArray(arr2) || !arr2 || arr2.length < 1)
|
|
6267
|
+
return arr1;
|
|
6268
|
+
return arr1.filter((item) => !arr2.includes(item));
|
|
6269
|
+
}
|
|
6270
|
+
function isContainAry(arr1, arr2) {
|
|
6271
|
+
if (!Array.isArray(arr1) || !Array.isArray(arr2))
|
|
6272
|
+
return false;
|
|
6273
|
+
if (arr2.length === 0)
|
|
6274
|
+
return true;
|
|
6275
|
+
const set2 = new Set(arr1);
|
|
6276
|
+
return arr2.every((item) => set2.has(item));
|
|
6277
|
+
}
|
|
6261
6278
|
var ArrayUtil = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6262
6279
|
__proto__: null,
|
|
6263
6280
|
arySwapPrev,
|
|
6264
6281
|
arySwapNext,
|
|
6265
6282
|
uniq,
|
|
6266
|
-
uniqCode
|
|
6283
|
+
uniqCode,
|
|
6284
|
+
uniqMerge,
|
|
6285
|
+
substractAry,
|
|
6286
|
+
isContainAry
|
|
6267
6287
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6268
6288
|
function fittingString(str, maxWidth, fontSize) {
|
|
6269
6289
|
var fontWidth = fontSize * 1.3;
|
|
@@ -19524,8 +19544,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19524
19544
|
const _hoisted_11$1 = {
|
|
19525
19545
|
class: "search-container"
|
|
19526
19546
|
};
|
|
19527
|
-
const _hoisted_12 = /* @__PURE__ */ vue.createTextVNode("\u641C\u7D22");
|
|
19528
|
-
const _hoisted_13 = {
|
|
19547
|
+
const _hoisted_12$1 = /* @__PURE__ */ vue.createTextVNode("\u641C\u7D22");
|
|
19548
|
+
const _hoisted_13$1 = {
|
|
19529
19549
|
class: "scroll-container"
|
|
19530
19550
|
};
|
|
19531
19551
|
const _sfc_main$h = {
|
|
@@ -19941,9 +19961,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19941
19961
|
onClick: searchUserById,
|
|
19942
19962
|
class: "search-btn"
|
|
19943
19963
|
}, {
|
|
19944
|
-
default: vue.withCtx(() => [_hoisted_12]),
|
|
19964
|
+
default: vue.withCtx(() => [_hoisted_12$1]),
|
|
19945
19965
|
_: 1
|
|
19946
|
-
})]), vue.createElementVNode("div", _hoisted_13, [!searchUserId.value && currentDepartments.value.length > 0 ? (vue.openBlock(), vue.createBlock(_component_van_cell_group, {
|
|
19966
|
+
})]), vue.createElementVNode("div", _hoisted_13$1, [!searchUserId.value && currentDepartments.value.length > 0 ? (vue.openBlock(), vue.createBlock(_component_van_cell_group, {
|
|
19947
19967
|
key: 0
|
|
19948
19968
|
}, {
|
|
19949
19969
|
default: vue.withCtx(() => [(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(currentDepartments.value, (dept) => {
|
|
@@ -21618,7 +21638,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21618
21638
|
}
|
|
21619
21639
|
};
|
|
21620
21640
|
var TreePicker = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ebc14630"]]);
|
|
21621
|
-
var CascaderPop_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.cascader-pop[data-v-
|
|
21641
|
+
var CascaderPop_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.cascader-pop[data-v-1f4b2244] {\r\n width: 100%;\r\n overflow: hidden;\n}\n.cascader-selector[data-v-1f4b2244] {\r\n padding: 10px;\n}\n.search-buttons[data-v-1f4b2244] {\r\n display: flex;\r\n gap: 10px;\n}\n.clear-btn[data-v-1f4b2244] {\r\n background-color: #f2f3f5;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.confirm-btn[data-v-1f4b2244] {\r\n background-color: #1989fa;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.no-results[data-v-1f4b2244] {\r\n text-align: center;\r\n padding: 20px;\r\n color: #969799;\n}\n.cascader-header[data-v-1f4b2244] {\r\n padding: 10px;\r\n border-bottom: 1px solid #ebedf0;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\n}\n.current-path[data-v-1f4b2244] {\r\n flex: 1;\r\n font-size: 14px;\r\n margin-left: 5px;\r\n color: #323233;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\n}\n.header-right[data-v-1f4b2244] {\r\n display: flex;\r\n gap: 8px;\r\n margin-left: auto;\n}\n.cancel-btn[data-v-1f4b2244] {\r\n color: #969799;\r\n margin-right: 5px;\n}\n.scroll-container[data-v-1f4b2244] {\r\n height: calc(80vh - 150px);\r\n overflow-y: auto;\n}\n.cell-content[data-v-1f4b2244] {\r\n display: flex;\r\n align-items: center;\r\n gap: 12px;\n}\n.circle-selector[data-v-1f4b2244] {\r\n width: 20px;\r\n height: 20px;\r\n border-radius: 50%;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n transition: all 0.2s;\r\n flex-shrink: 0;\n}\n.circle-selector.selected[data-v-1f4b2244] {\r\n background-color: #1989fa;\r\n border-color: #1989fa;\n}\n.circle-selector.selected .van-icon[data-v-1f4b2244] {\r\n color: white;\r\n font-size: 14px;\n}\n.van-cell__right-icon[data-v-1f4b2244] {\r\n color: #969799;\r\n font-size: 16px;\r\n margin-left: 8px;\n}\n.name[data-v-1f4b2244] {\r\n flex: 1;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\n}\n.cancel-btn[data-v-1f4b2244] {\r\n color: #969799;\n}\n.search-field[data-v-1f4b2244] {\r\n background: #fff;\r\n padding: 10px 16px;\r\n border-bottom: 1px solid #ebedf0;\r\n position: sticky;\r\n top: 0;\r\n z-index: 999;\r\n margin-bottom: 10px;\r\n flex-shrink: 0;\r\n /* \u9632\u6B62\u538B\u7F29 */\n}\r\n")();
|
|
21642
|
+
const _withScopeId = (n) => (vue.pushScopeId("data-v-1f4b2244"), n = n(), vue.popScopeId(), n);
|
|
21622
21643
|
const _hoisted_1$3 = {
|
|
21623
21644
|
class: "cascader-selector"
|
|
21624
21645
|
};
|
|
@@ -21643,7 +21664,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21643
21664
|
class: "cell-content"
|
|
21644
21665
|
};
|
|
21645
21666
|
const _hoisted_10 = ["onClick"];
|
|
21646
|
-
const _hoisted_11 = {
|
|
21667
|
+
const _hoisted_11 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", {
|
|
21668
|
+
class: "name"
|
|
21669
|
+
}, "\u5168\u9009", -1));
|
|
21670
|
+
const _hoisted_12 = {
|
|
21671
|
+
class: "cell-content"
|
|
21672
|
+
};
|
|
21673
|
+
const _hoisted_13 = ["onClick"];
|
|
21674
|
+
const _hoisted_14 = {
|
|
21647
21675
|
class: "name"
|
|
21648
21676
|
};
|
|
21649
21677
|
const _sfc_main$3 = {
|
|
@@ -21688,6 +21716,25 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21688
21716
|
keyword: "",
|
|
21689
21717
|
selectedNodeIds: []
|
|
21690
21718
|
});
|
|
21719
|
+
const isSelectAll = vue.computed({
|
|
21720
|
+
get() {
|
|
21721
|
+
let optionIds = optionNodes.value.filter((item) => item.canCheck).map((item) => item.id);
|
|
21722
|
+
if (optionIds.length < 1)
|
|
21723
|
+
return false;
|
|
21724
|
+
return util.isContainAry(data2.selectedNodeIds, optionIds);
|
|
21725
|
+
},
|
|
21726
|
+
set(val) {
|
|
21727
|
+
let optionIds = optionNodes.value.filter((item) => item.canCheck).map((item) => item.id);
|
|
21728
|
+
if (val) {
|
|
21729
|
+
data2.selectedNodeIds = util.uniqMerge(data2.selectedNodeIds, optionIds);
|
|
21730
|
+
} else {
|
|
21731
|
+
data2.selectedNodeIds = util.substractAry(data2.selectedNodeIds, optionIds);
|
|
21732
|
+
}
|
|
21733
|
+
}
|
|
21734
|
+
});
|
|
21735
|
+
const onToggleAll = () => {
|
|
21736
|
+
isSelectAll.value = !isSelectAll.value;
|
|
21737
|
+
};
|
|
21691
21738
|
vue.onMounted(() => {
|
|
21692
21739
|
});
|
|
21693
21740
|
const optionNodes = vue.computed(() => {
|
|
@@ -21720,7 +21767,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21720
21767
|
props2.idQueryNode({
|
|
21721
21768
|
id: parentId,
|
|
21722
21769
|
isReturnParent,
|
|
21723
|
-
hasChildren: true
|
|
21770
|
+
hasChildren: true,
|
|
21771
|
+
hasUsers: true
|
|
21724
21772
|
}, (node) => {
|
|
21725
21773
|
data2.parentNode = node;
|
|
21726
21774
|
});
|
|
@@ -21741,6 +21789,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21741
21789
|
params.isReturnParent = true;
|
|
21742
21790
|
params.hasChildren = false;
|
|
21743
21791
|
params.hasPaths = true;
|
|
21792
|
+
params.hasUsers = true;
|
|
21744
21793
|
let selectNode = null;
|
|
21745
21794
|
yield props2.idQueryNode(params, (node) => {
|
|
21746
21795
|
data2.parentNode = node;
|
|
@@ -21784,7 +21833,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21784
21833
|
props2.idQueryNode({
|
|
21785
21834
|
id: node.id,
|
|
21786
21835
|
isReturnParent: false,
|
|
21787
|
-
hasChildren: true
|
|
21836
|
+
hasChildren: true,
|
|
21837
|
+
hasPaths: true,
|
|
21838
|
+
hasUsers: true
|
|
21788
21839
|
}, (node2) => {
|
|
21789
21840
|
data2.parentNode = node2;
|
|
21790
21841
|
});
|
|
@@ -21796,6 +21847,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21796
21847
|
params.isReturnParent = true;
|
|
21797
21848
|
params.hasChildren = true;
|
|
21798
21849
|
params.hasPaths = true;
|
|
21850
|
+
params.hasUsers = true;
|
|
21799
21851
|
yield props2.idQueryNode(params, (node) => {
|
|
21800
21852
|
data2.parentNode = node;
|
|
21801
21853
|
});
|
|
@@ -21862,11 +21914,29 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21862
21914
|
}, "\u641C\u7D22")]),
|
|
21863
21915
|
_: 1
|
|
21864
21916
|
}, 8, ["modelValue", "placeholder"]), vue.createElementVNode("div", _hoisted_8$1, [vue.createVNode(_component_van_cell_group, null, {
|
|
21865
|
-
default: vue.withCtx(() => [(vue.openBlock(
|
|
21917
|
+
default: vue.withCtx(() => [props2.multiple ? (vue.openBlock(), vue.createBlock(_component_van_cell, {
|
|
21918
|
+
key: 0
|
|
21919
|
+
}, {
|
|
21920
|
+
title: vue.withCtx(() => [vue.createElementVNode("div", _hoisted_9$1, [vue.createElementVNode("div", {
|
|
21921
|
+
class: "circle-selector",
|
|
21922
|
+
onClick: vue.withModifiers(onToggleAll, ["stop"])
|
|
21923
|
+
}, [vue.unref(isSelectAll) ? (vue.openBlock(), vue.createBlock(_component_van_icon, {
|
|
21924
|
+
key: 0,
|
|
21925
|
+
name: "success",
|
|
21926
|
+
size: "20",
|
|
21927
|
+
color: "#409eff"
|
|
21928
|
+
})) : vue.createCommentVNode("", true), !vue.unref(isSelectAll) ? (vue.openBlock(), vue.createBlock(_component_van_icon, {
|
|
21929
|
+
key: 1,
|
|
21930
|
+
name: "circle",
|
|
21931
|
+
size: "20",
|
|
21932
|
+
color: "#e0e0e0"
|
|
21933
|
+
})) : vue.createCommentVNode("", true)], 8, _hoisted_10), _hoisted_11])]),
|
|
21934
|
+
_: 1
|
|
21935
|
+
})) : vue.createCommentVNode("", true), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(optionNodes), (item, i) => {
|
|
21866
21936
|
return vue.openBlock(), vue.createBlock(_component_van_cell, {
|
|
21867
21937
|
key: i
|
|
21868
21938
|
}, vue.createSlots({
|
|
21869
|
-
title: vue.withCtx(() => [vue.createElementVNode("div",
|
|
21939
|
+
title: vue.withCtx(() => [vue.createElementVNode("div", _hoisted_12, [item.canCheck ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
21870
21940
|
key: 0,
|
|
21871
21941
|
class: "circle-selector",
|
|
21872
21942
|
onClick: vue.withModifiers(($event) => onToggle(item), ["stop"])
|
|
@@ -21880,7 +21950,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21880
21950
|
name: "circle",
|
|
21881
21951
|
size: "20",
|
|
21882
21952
|
color: "#e0e0e0"
|
|
21883
|
-
})) : vue.createCommentVNode("", true)], 8,
|
|
21953
|
+
})) : vue.createCommentVNode("", true)], 8, _hoisted_13)) : vue.createCommentVNode("", true), vue.createElementVNode("span", _hoisted_14, vue.toDisplayString(item.label), 1)])]),
|
|
21884
21954
|
_: 2
|
|
21885
21955
|
}, [item.canExpand ? {
|
|
21886
21956
|
name: "right-icon",
|
|
@@ -21897,7 +21967,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21897
21967
|
};
|
|
21898
21968
|
}
|
|
21899
21969
|
};
|
|
21900
|
-
var CascaderPop = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
21970
|
+
var CascaderPop = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-1f4b2244"]]);
|
|
21901
21971
|
const _hoisted_1$2 = {
|
|
21902
21972
|
style: {
|
|
21903
21973
|
"display": "flex",
|
|
@@ -22002,21 +22072,30 @@ var __async = (__this, __arguments, generator) => {
|
|
|
22002
22072
|
ids = modelValue2.value;
|
|
22003
22073
|
if (ids.length < 1)
|
|
22004
22074
|
return [];
|
|
22005
|
-
let
|
|
22075
|
+
let res = [];
|
|
22076
|
+
let receivedNodes = [];
|
|
22077
|
+
for (var i = 0; i < ids.length; i++) {
|
|
22078
|
+
let nodeId = ids[i];
|
|
22079
|
+
let selectNode = null;
|
|
22080
|
+
selectNode = util.findNode(nodeId, receivedNodes);
|
|
22081
|
+
if (selectNode) {
|
|
22082
|
+
res = [...res, selectNode];
|
|
22083
|
+
continue;
|
|
22084
|
+
}
|
|
22006
22085
|
let params = {};
|
|
22007
22086
|
params.id = nodeId;
|
|
22008
|
-
params.isReturnParent =
|
|
22087
|
+
params.isReturnParent = false;
|
|
22009
22088
|
params.hasChildren = false;
|
|
22010
|
-
params.hasPaths =
|
|
22011
|
-
|
|
22089
|
+
params.hasPaths = false;
|
|
22090
|
+
params.hasUsers = true;
|
|
22012
22091
|
yield props2.idQueryNode(params, (node) => {
|
|
22013
|
-
|
|
22014
|
-
selectNode = util.findNode(nodeId,
|
|
22092
|
+
receivedNodes = [...receivedNodes, ...node.children || []];
|
|
22093
|
+
selectNode = util.findNode(nodeId, receivedNodes);
|
|
22015
22094
|
});
|
|
22016
|
-
|
|
22017
|
-
|
|
22018
|
-
|
|
22019
|
-
return
|
|
22095
|
+
if (selectNode)
|
|
22096
|
+
res = [...res, selectNode];
|
|
22097
|
+
}
|
|
22098
|
+
return res;
|
|
22020
22099
|
});
|
|
22021
22100
|
vue.watch(() => JSON.stringify(modelValue2.value), (n, o) => __async(this, null, function* () {
|
|
22022
22101
|
if (!props2.multiple) {
|
package/package.json
CHANGED
|
@@ -116,34 +116,50 @@ const onDelete = (idx) => {
|
|
|
116
116
|
|
|
117
117
|
const ids2nodes = async () => {
|
|
118
118
|
let ids = []
|
|
119
|
-
if(!props.multiple){
|
|
120
|
-
if(modelValue.value)
|
|
119
|
+
if (!props.multiple) {
|
|
120
|
+
if (modelValue.value)
|
|
121
121
|
ids = [modelValue.value]
|
|
122
122
|
}
|
|
123
|
-
else if(modelValue.value && modelValue.value.length>0)
|
|
123
|
+
else if (modelValue.value && modelValue.value.length > 0)
|
|
124
124
|
ids = modelValue.value
|
|
125
125
|
|
|
126
126
|
if (ids.length < 1)
|
|
127
127
|
return []
|
|
128
128
|
|
|
129
|
-
let
|
|
129
|
+
let res = []
|
|
130
|
+
|
|
131
|
+
//记录网络请求接收到的所有用户列表
|
|
132
|
+
let receivedNodes = []
|
|
133
|
+
for (var i = 0; i < ids.length; i++) {
|
|
134
|
+
let nodeId = ids[i]
|
|
135
|
+
|
|
136
|
+
let selectNode = null
|
|
137
|
+
|
|
138
|
+
//现在历史用户列表中查找
|
|
139
|
+
//找不到再发网络请求
|
|
140
|
+
selectNode = util.findNode(nodeId, receivedNodes)
|
|
141
|
+
if (selectNode){
|
|
142
|
+
res = [...res, selectNode]
|
|
143
|
+
continue
|
|
144
|
+
}
|
|
145
|
+
|
|
130
146
|
let params = {}
|
|
131
147
|
params.id = nodeId
|
|
132
|
-
params.isReturnParent =
|
|
148
|
+
params.isReturnParent = false
|
|
133
149
|
params.hasChildren = false
|
|
134
|
-
params.hasPaths =
|
|
150
|
+
params.hasPaths = false
|
|
151
|
+
params.hasUsers = true
|
|
135
152
|
|
|
136
|
-
let selectNode = null
|
|
137
153
|
await props.idQueryNode(params, (node) => {
|
|
138
|
-
|
|
139
|
-
selectNode = util.findNode(nodeId,
|
|
154
|
+
receivedNodes = [...receivedNodes, ...(node.children || [])]
|
|
155
|
+
selectNode = util.findNode(nodeId, receivedNodes)
|
|
140
156
|
})
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
157
|
+
|
|
158
|
+
if (selectNode)
|
|
159
|
+
res = [...res, selectNode]
|
|
160
|
+
}
|
|
145
161
|
|
|
146
|
-
return
|
|
162
|
+
return res
|
|
147
163
|
}
|
|
148
164
|
|
|
149
165
|
watch(() => JSON.stringify(modelValue.value), async (n, o) => {
|
|
@@ -27,6 +27,17 @@
|
|
|
27
27
|
<div class="scroll-container">
|
|
28
28
|
<!-- 遍历子节点列表 -->
|
|
29
29
|
<van-cell-group>
|
|
30
|
+
<van-cell v-if="props.multiple">
|
|
31
|
+
<template #title>
|
|
32
|
+
<div class="cell-content">
|
|
33
|
+
<div class="circle-selector" @click.stop="onToggleAll">
|
|
34
|
+
<van-icon v-if="isSelectAll" name="success" size="20" color="#409eff" />
|
|
35
|
+
<van-icon v-if="!isSelectAll" name="circle" size="20" color="#e0e0e0" />
|
|
36
|
+
</div>
|
|
37
|
+
<span class="name">全选</span>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
</van-cell>
|
|
30
41
|
<van-cell v-for="(item, i) in optionNodes" :key="i">
|
|
31
42
|
<template #title>
|
|
32
43
|
<div class="cell-content">
|
|
@@ -94,6 +105,28 @@ const data = reactive({
|
|
|
94
105
|
selectedNodeIds: []
|
|
95
106
|
})
|
|
96
107
|
|
|
108
|
+
const isSelectAll = computed({
|
|
109
|
+
get() {
|
|
110
|
+
let optionIds = optionNodes.value.filter(item => item.canCheck).map(item => item.id)
|
|
111
|
+
if (optionIds.length < 1)
|
|
112
|
+
return false
|
|
113
|
+
|
|
114
|
+
return util.isContainAry(data.selectedNodeIds, optionIds)
|
|
115
|
+
},
|
|
116
|
+
set(val) {
|
|
117
|
+
let optionIds = optionNodes.value.filter(item => item.canCheck).map(item => item.id)
|
|
118
|
+
if (val) {
|
|
119
|
+
data.selectedNodeIds = util.uniqMerge(data.selectedNodeIds, optionIds)
|
|
120
|
+
} else {
|
|
121
|
+
data.selectedNodeIds = util.substractAry(data.selectedNodeIds, optionIds)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const onToggleAll = () => {
|
|
127
|
+
isSelectAll.value = !isSelectAll.value
|
|
128
|
+
}
|
|
129
|
+
|
|
97
130
|
onMounted(() => {
|
|
98
131
|
})
|
|
99
132
|
|
|
@@ -132,7 +165,7 @@ const onBack = () => {
|
|
|
132
165
|
data.keyword = ""
|
|
133
166
|
//查询父节点
|
|
134
167
|
//父节点一定有子节点
|
|
135
|
-
props.idQueryNode({ id: parentId, isReturnParent: isReturnParent, hasChildren: true }, (node) => {
|
|
168
|
+
props.idQueryNode({ id: parentId, isReturnParent: isReturnParent, hasChildren: true,hasUsers:true }, (node) => {
|
|
136
169
|
data.parentNode = node
|
|
137
170
|
})
|
|
138
171
|
}
|
|
@@ -148,16 +181,17 @@ const reset = () => {
|
|
|
148
181
|
data.selectedNodeIds = []
|
|
149
182
|
}
|
|
150
183
|
|
|
151
|
-
const ids2nodes = async() => {
|
|
152
|
-
if(!data.selectedNodeIds || data.selectedNodeIds.length<1)
|
|
184
|
+
const ids2nodes = async () => {
|
|
185
|
+
if (!data.selectedNodeIds || data.selectedNodeIds.length < 1)
|
|
153
186
|
return []
|
|
154
187
|
|
|
155
|
-
let promises = data.selectedNodeIds.map(async(nodeId) => {
|
|
188
|
+
let promises = data.selectedNodeIds.map(async (nodeId) => {
|
|
156
189
|
let params = {}
|
|
157
190
|
params.id = nodeId
|
|
158
191
|
params.isReturnParent = true
|
|
159
192
|
params.hasChildren = false
|
|
160
193
|
params.hasPaths = true
|
|
194
|
+
params.hasUsers = true
|
|
161
195
|
|
|
162
196
|
let selectNode = null
|
|
163
197
|
await props.idQueryNode(params, (node) => {
|
|
@@ -166,14 +200,14 @@ const ids2nodes = async() => {
|
|
|
166
200
|
})
|
|
167
201
|
return selectNode
|
|
168
202
|
})
|
|
169
|
-
|
|
203
|
+
|
|
170
204
|
let selectNodes = await Promise.all(promises)
|
|
171
205
|
|
|
172
206
|
return selectNodes
|
|
173
207
|
}
|
|
174
208
|
|
|
175
209
|
// 确认按钮
|
|
176
|
-
const onSubmit = async() => {
|
|
210
|
+
const onSubmit = async () => {
|
|
177
211
|
if (!data.selectedNodeIds || data.selectedNodeIds.length < 1) {
|
|
178
212
|
util.warnToast("请选择")
|
|
179
213
|
return
|
|
@@ -203,8 +237,8 @@ const onCancel = () => {
|
|
|
203
237
|
const onToggle = (node) => {
|
|
204
238
|
if (data.selectedNodeIds.includes(node.id))
|
|
205
239
|
data.selectedNodeIds = data.selectedNodeIds.filter(item => item != node.id)
|
|
206
|
-
else{
|
|
207
|
-
if(props.multiple)
|
|
240
|
+
else {
|
|
241
|
+
if (props.multiple)
|
|
208
242
|
data.selectedNodeIds.push(node.id)
|
|
209
243
|
else
|
|
210
244
|
data.selectedNodeIds = [node.id]
|
|
@@ -212,7 +246,7 @@ const onToggle = (node) => {
|
|
|
212
246
|
}
|
|
213
247
|
|
|
214
248
|
const onNextLevel = (node) => {
|
|
215
|
-
props.idQueryNode({ id: node.id, isReturnParent: false, hasChildren: true }, (node) => {
|
|
249
|
+
props.idQueryNode({ id: node.id, isReturnParent: false, hasChildren: true,hasPaths:true,hasUsers:true }, (node) => {
|
|
216
250
|
data.parentNode = node
|
|
217
251
|
})
|
|
218
252
|
}
|
|
@@ -224,6 +258,7 @@ const query = async () => {
|
|
|
224
258
|
params.isReturnParent = true
|
|
225
259
|
params.hasChildren = true
|
|
226
260
|
params.hasPaths = true
|
|
261
|
+
params.hasUsers = true
|
|
227
262
|
|
|
228
263
|
await props.idQueryNode(params, (node) => {
|
|
229
264
|
data.parentNode = node
|
|
@@ -232,7 +267,7 @@ const query = async () => {
|
|
|
232
267
|
|
|
233
268
|
//根据id查询详情对象
|
|
234
269
|
watch(() => [props.show], async (n, o) => {
|
|
235
|
-
if(!props.show)
|
|
270
|
+
if (!props.show)
|
|
236
271
|
return
|
|
237
272
|
|
|
238
273
|
if (!props.multiple) {
|
package/src/util/array_util.js
CHANGED
|
@@ -12,21 +12,43 @@ export function arySwapNext(arr, index) {
|
|
|
12
12
|
return arr;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function uniq(ary){
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
export function uniq(ary) {
|
|
16
|
+
// 去重
|
|
17
|
+
let newAry = [...new Set(ary)]
|
|
18
|
+
return newAry
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function uniqCode(arr) {
|
|
22
22
|
const uniqueMap = new Map();
|
|
23
23
|
for (const item of arr) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const key = item.code
|
|
25
|
+
if (!uniqueMap.has(key)) {
|
|
26
|
+
uniqueMap.set(key, item);
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
return Array.from(uniqueMap.values());
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
//合并两个数组,合并后的数组去重
|
|
33
|
+
export function uniqMerge(arr1, arr2) {
|
|
34
|
+
let totalArr = [...arr1, ...arr2]
|
|
35
|
+
return uniq(totalArr)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//数组1减去数组2
|
|
39
|
+
export function substractAry(arr1, arr2) {
|
|
40
|
+
if (!Array.isArray(arr2) || !arr2 || arr2.length<1)
|
|
41
|
+
return arr1
|
|
32
42
|
|
|
43
|
+
return arr1.filter(item => !arr2.includes(item))
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//判断数组1是否包含数组2
|
|
47
|
+
export function isContainAry(arr1, arr2){
|
|
48
|
+
// 非数组直接返回false
|
|
49
|
+
if (!Array.isArray(arr1) || !Array.isArray(arr2)) return false
|
|
50
|
+
// 空数组2默认视为被包含
|
|
51
|
+
if (arr2.length === 0) return true
|
|
52
|
+
const set = new Set(arr1)
|
|
53
|
+
return arr2.every(item => set.has(item))
|
|
54
|
+
}
|
|
@@ -79,8 +79,8 @@ const idQueryNode = async (params, setNode) => {
|
|
|
79
79
|
let p = {
|
|
80
80
|
id: params.id,
|
|
81
81
|
hasChildren: params.hasChildren,
|
|
82
|
-
hasPaths:
|
|
83
|
-
hasUsers:
|
|
82
|
+
hasPaths: params.hasPaths,
|
|
83
|
+
hasUsers: params.hasUsers,
|
|
84
84
|
isReturnParent: params.isReturnParent
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -10,8 +10,10 @@ import UserPicker from '../cascaderpicker/userpicker.vue'
|
|
|
10
10
|
|
|
11
11
|
const data = reactive({
|
|
12
12
|
multiple:true,
|
|
13
|
+
// multiple:false,
|
|
13
14
|
auth: 'require',
|
|
14
|
-
userids: []
|
|
15
|
+
userids: ["YuChao", "LiuShouBo", "KuangLeiLei","HouMu"]
|
|
16
|
+
// userids: "YuChao"
|
|
15
17
|
})
|
|
16
18
|
|
|
17
19
|
onMounted(() => {
|