widget.qw 1.0.21 → 1.0.23
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 +67 -94
- package/build/widget.qw.umd.js +67 -94
- package/package.json +1 -1
- package/src/components/CascaderPicker.vue +5 -28
- package/src/components/CascaderPop.vue +58 -67
- package/src/views/cascaderpicker/index.vue +0 -0
package/build/style.css
CHANGED
|
@@ -709,25 +709,25 @@
|
|
|
709
709
|
margin:3px;
|
|
710
710
|
}
|
|
711
711
|
|
|
712
|
-
.cascader-pop[data-v-
|
|
712
|
+
.cascader-pop[data-v-c97110e4] {
|
|
713
713
|
width: 100%;
|
|
714
714
|
overflow: hidden;
|
|
715
715
|
}
|
|
716
|
-
.cascader-selector[data-v-
|
|
716
|
+
.cascader-selector[data-v-c97110e4] {
|
|
717
717
|
padding: 10px;
|
|
718
718
|
}
|
|
719
|
-
.search-buttons[data-v-
|
|
719
|
+
.search-buttons[data-v-c97110e4] {
|
|
720
720
|
display: flex;
|
|
721
721
|
gap: 10px;
|
|
722
722
|
}
|
|
723
|
-
.clear-btn[data-v-
|
|
723
|
+
.clear-btn[data-v-c97110e4] {
|
|
724
724
|
background-color: #f2f3f5;
|
|
725
725
|
border: none;
|
|
726
726
|
border-radius: 4px;
|
|
727
727
|
padding: 4px 8px;
|
|
728
728
|
font-size: 14px;
|
|
729
729
|
}
|
|
730
|
-
.confirm-btn[data-v-
|
|
730
|
+
.confirm-btn[data-v-c97110e4] {
|
|
731
731
|
background-color: #1989fa;
|
|
732
732
|
color: white;
|
|
733
733
|
border: none;
|
|
@@ -735,19 +735,19 @@
|
|
|
735
735
|
padding: 4px 8px;
|
|
736
736
|
font-size: 14px;
|
|
737
737
|
}
|
|
738
|
-
.no-results[data-v-
|
|
738
|
+
.no-results[data-v-c97110e4] {
|
|
739
739
|
text-align: center;
|
|
740
740
|
padding: 20px;
|
|
741
741
|
color: #969799;
|
|
742
742
|
}
|
|
743
|
-
.cascader-header[data-v-
|
|
743
|
+
.cascader-header[data-v-c97110e4] {
|
|
744
744
|
padding: 10px;
|
|
745
745
|
border-bottom: 1px solid #ebedf0;
|
|
746
746
|
display: flex;
|
|
747
747
|
justify-content: space-between;
|
|
748
748
|
align-items: center;
|
|
749
749
|
}
|
|
750
|
-
.current-path[data-v-
|
|
750
|
+
.current-path[data-v-c97110e4] {
|
|
751
751
|
flex: 1;
|
|
752
752
|
font-size: 14px;
|
|
753
753
|
color: #323233;
|
|
@@ -755,25 +755,25 @@
|
|
|
755
755
|
overflow: hidden;
|
|
756
756
|
text-overflow: ellipsis;
|
|
757
757
|
}
|
|
758
|
-
.header-right[data-v-
|
|
758
|
+
.header-right[data-v-c97110e4] {
|
|
759
759
|
display: flex;
|
|
760
760
|
gap: 8px;
|
|
761
761
|
margin-left: auto;
|
|
762
762
|
}
|
|
763
|
-
.cancel-btn[data-v-
|
|
763
|
+
.cancel-btn[data-v-c97110e4] {
|
|
764
764
|
color: #969799;
|
|
765
765
|
margin-right: 5px;
|
|
766
766
|
}
|
|
767
|
-
.scroll-container[data-v-
|
|
767
|
+
.scroll-container[data-v-c97110e4] {
|
|
768
768
|
height: calc(80vh - 150px);
|
|
769
769
|
overflow-y: auto;
|
|
770
770
|
}
|
|
771
|
-
.cell-content[data-v-
|
|
771
|
+
.cell-content[data-v-c97110e4] {
|
|
772
772
|
display: flex;
|
|
773
773
|
align-items: center;
|
|
774
774
|
gap: 12px;
|
|
775
775
|
}
|
|
776
|
-
.circle-selector[data-v-
|
|
776
|
+
.circle-selector[data-v-c97110e4] {
|
|
777
777
|
width: 20px;
|
|
778
778
|
height: 20px;
|
|
779
779
|
border-radius: 50%;
|
|
@@ -783,29 +783,29 @@
|
|
|
783
783
|
transition: all 0.2s;
|
|
784
784
|
flex-shrink: 0;
|
|
785
785
|
}
|
|
786
|
-
.circle-selector.selected[data-v-
|
|
786
|
+
.circle-selector.selected[data-v-c97110e4] {
|
|
787
787
|
background-color: #1989fa;
|
|
788
788
|
border-color: #1989fa;
|
|
789
789
|
}
|
|
790
|
-
.circle-selector.selected .van-icon[data-v-
|
|
790
|
+
.circle-selector.selected .van-icon[data-v-c97110e4] {
|
|
791
791
|
color: white;
|
|
792
792
|
font-size: 14px;
|
|
793
793
|
}
|
|
794
|
-
.van-cell__right-icon[data-v-
|
|
794
|
+
.van-cell__right-icon[data-v-c97110e4] {
|
|
795
795
|
color: #969799;
|
|
796
796
|
font-size: 16px;
|
|
797
797
|
margin-left: 8px;
|
|
798
798
|
}
|
|
799
|
-
.name[data-v-
|
|
799
|
+
.name[data-v-c97110e4] {
|
|
800
800
|
flex: 1;
|
|
801
801
|
overflow: hidden;
|
|
802
802
|
text-overflow: ellipsis;
|
|
803
803
|
white-space: nowrap;
|
|
804
804
|
}
|
|
805
|
-
.cancel-btn[data-v-
|
|
805
|
+
.cancel-btn[data-v-c97110e4] {
|
|
806
806
|
color: #969799;
|
|
807
807
|
}
|
|
808
|
-
.search-field[data-v-
|
|
808
|
+
.search-field[data-v-c97110e4] {
|
|
809
809
|
background: #fff;
|
|
810
810
|
padding: 10px 16px;
|
|
811
811
|
border-bottom: 1px solid #ebedf0;
|
package/build/widget.qw.es.js
CHANGED
|
@@ -20279,7 +20279,7 @@ const _sfc_main$3 = {
|
|
|
20279
20279
|
}
|
|
20280
20280
|
};
|
|
20281
20281
|
var TreePicker = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-6744b874"]]);
|
|
20282
|
-
var CascaderPop_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.cascader-pop[data-v-
|
|
20282
|
+
var CascaderPop_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.cascader-pop[data-v-c97110e4] {\r\n width: 100%;\r\n overflow: hidden;\n}\n.cascader-selector[data-v-c97110e4] {\r\n padding: 10px;\n}\n.search-buttons[data-v-c97110e4] {\r\n display: flex;\r\n gap: 10px;\n}\n.clear-btn[data-v-c97110e4] {\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-c97110e4] {\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-c97110e4] {\r\n text-align: center;\r\n padding: 20px;\r\n color: #969799;\n}\n.cascader-header[data-v-c97110e4] {\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-c97110e4] {\r\n flex: 1;\r\n font-size: 14px;\r\n color: #323233;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\n}\n.header-right[data-v-c97110e4] {\r\n display: flex;\r\n gap: 8px;\r\n margin-left: auto;\n}\n.cancel-btn[data-v-c97110e4] {\r\n color: #969799;\r\n margin-right: 5px;\n}\n.scroll-container[data-v-c97110e4] {\r\n height: calc(80vh - 150px);\r\n overflow-y: auto;\n}\n.cell-content[data-v-c97110e4] {\r\n display: flex;\r\n align-items: center;\r\n gap: 12px;\n}\n.circle-selector[data-v-c97110e4] {\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-c97110e4] {\r\n background-color: #1989fa;\r\n border-color: #1989fa;\n}\n.circle-selector.selected .van-icon[data-v-c97110e4] {\r\n color: white;\r\n font-size: 14px;\n}\n.van-cell__right-icon[data-v-c97110e4] {\r\n color: #969799;\r\n font-size: 16px;\r\n margin-left: 8px;\n}\n.name[data-v-c97110e4] {\r\n flex: 1;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\n}\n.cancel-btn[data-v-c97110e4] {\r\n color: #969799;\n}\n.search-field[data-v-c97110e4] {\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")();
|
|
20283
20283
|
const _hoisted_1$1 = {
|
|
20284
20284
|
class: "cascader-selector"
|
|
20285
20285
|
};
|
|
@@ -20322,26 +20322,18 @@ const _sfc_main$2 = {
|
|
|
20322
20322
|
type: String,
|
|
20323
20323
|
default: ""
|
|
20324
20324
|
},
|
|
20325
|
-
|
|
20325
|
+
keywordQueryNode: {
|
|
20326
20326
|
type: Function,
|
|
20327
20327
|
default: () => {
|
|
20328
20328
|
}
|
|
20329
20329
|
},
|
|
20330
|
-
|
|
20330
|
+
idQueryNode: {
|
|
20331
20331
|
type: Function,
|
|
20332
20332
|
default: () => {
|
|
20333
20333
|
}
|
|
20334
|
-
},
|
|
20335
|
-
minLevel: {
|
|
20336
|
-
type: Number,
|
|
20337
|
-
default: 0
|
|
20338
|
-
},
|
|
20339
|
-
maxLevel: {
|
|
20340
|
-
type: Number,
|
|
20341
|
-
default: 9999
|
|
20342
20334
|
}
|
|
20343
20335
|
},
|
|
20344
|
-
emits: ["update:show", "select"],
|
|
20336
|
+
emits: ["update:modelValue", "update:show", "select"],
|
|
20345
20337
|
setup(__props, {
|
|
20346
20338
|
emit
|
|
20347
20339
|
}) {
|
|
@@ -20349,57 +20341,52 @@ const _sfc_main$2 = {
|
|
|
20349
20341
|
const show = useVModel(props, "show", emit);
|
|
20350
20342
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
20351
20343
|
const data2 = reactive({
|
|
20352
|
-
|
|
20344
|
+
parentNode: null,
|
|
20353
20345
|
keyword: "",
|
|
20354
|
-
currentNode: null,
|
|
20355
20346
|
selectedNodeId: ""
|
|
20356
20347
|
});
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20348
|
+
onMounted(() => {
|
|
20349
|
+
props.idQueryNode({
|
|
20350
|
+
id: "",
|
|
20351
|
+
isReturnParent: true
|
|
20352
|
+
}, (node) => {
|
|
20353
|
+
data2.parentNode = node;
|
|
20354
|
+
});
|
|
20355
|
+
});
|
|
20360
20356
|
const optionNodes = computed(() => {
|
|
20361
20357
|
var _a;
|
|
20362
|
-
|
|
20363
|
-
return ((_a = data2.currentNode) == null ? void 0 : _a.children) ? data2.currentNode.children : [];
|
|
20364
|
-
else
|
|
20365
|
-
return data2.totalNodes ? data2.totalNodes : [];
|
|
20358
|
+
return ((_a = data2.parentNode) == null ? void 0 : _a.children) ? data2.parentNode.children : [];
|
|
20366
20359
|
});
|
|
20367
20360
|
const pathsLabel = computed(() => {
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
let paths = util.findPaths(data2.currentNode.id, data2.totalNodes);
|
|
20371
|
-
console.log("paths", paths);
|
|
20372
|
-
let res = paths.map((item) => item.label).join("/");
|
|
20373
|
-
return res;
|
|
20361
|
+
var _a;
|
|
20362
|
+
return ((_a = data2.parentNode) == null ? void 0 : _a.path) ? data2.parentNode.path : "";
|
|
20374
20363
|
});
|
|
20375
|
-
const
|
|
20376
|
-
|
|
20364
|
+
const keywordQueryNode = () => {
|
|
20365
|
+
props.keywordQueryNode({
|
|
20377
20366
|
keyword: data2.keyword,
|
|
20378
|
-
|
|
20379
|
-
}, (
|
|
20380
|
-
data2.
|
|
20367
|
+
isReturnParent: true
|
|
20368
|
+
}, (node) => {
|
|
20369
|
+
data2.parentNode = node;
|
|
20381
20370
|
});
|
|
20382
|
-
}
|
|
20383
|
-
const onSearch = () =>
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
parentId: ""
|
|
20387
|
-
}, (nodes) => {
|
|
20388
|
-
data2.totalNodes = nodes;
|
|
20389
|
-
data2.currentNode = null;
|
|
20390
|
-
});
|
|
20391
|
-
});
|
|
20371
|
+
};
|
|
20372
|
+
const onSearch = () => {
|
|
20373
|
+
keywordQueryNode();
|
|
20374
|
+
};
|
|
20392
20375
|
const onBack = () => {
|
|
20393
|
-
if (!data2.
|
|
20376
|
+
if (!data2.parentNode || !data2.parentNode.parentId)
|
|
20394
20377
|
return;
|
|
20395
20378
|
data2.keyword = "";
|
|
20396
|
-
|
|
20379
|
+
props.idQueryNode({
|
|
20380
|
+
id: data2.parentNode.parentId,
|
|
20381
|
+
isReturnParent: true
|
|
20382
|
+
}, (node) => {
|
|
20383
|
+
data2.parentNode = node;
|
|
20384
|
+
});
|
|
20397
20385
|
};
|
|
20398
20386
|
const onClear = () => {
|
|
20399
20387
|
data2.keyword = "";
|
|
20400
20388
|
};
|
|
20401
20389
|
const reset = () => {
|
|
20402
|
-
data2.currentNode = null;
|
|
20403
20390
|
data2.keyword = "";
|
|
20404
20391
|
};
|
|
20405
20392
|
const onSubmit = () => {
|
|
@@ -20407,9 +20394,7 @@ const _sfc_main$2 = {
|
|
|
20407
20394
|
util.warnToast("\u8BF7\u9009\u62E9");
|
|
20408
20395
|
return;
|
|
20409
20396
|
}
|
|
20410
|
-
|
|
20411
|
-
modelValue.value = selectedNode.id;
|
|
20412
|
-
emit("select", selectedNode);
|
|
20397
|
+
modelValue.value = data2.selectedNodeId;
|
|
20413
20398
|
show.value = false;
|
|
20414
20399
|
reset();
|
|
20415
20400
|
};
|
|
@@ -20424,27 +20409,37 @@ const _sfc_main$2 = {
|
|
|
20424
20409
|
data2.selectedNodeId = node.id;
|
|
20425
20410
|
};
|
|
20426
20411
|
const onNextLevel = (node) => {
|
|
20427
|
-
props.
|
|
20428
|
-
|
|
20429
|
-
|
|
20430
|
-
}, (
|
|
20431
|
-
|
|
20432
|
-
data2.currentNode = node;
|
|
20412
|
+
props.idQueryNode({
|
|
20413
|
+
id: node.id,
|
|
20414
|
+
isReturnParent: false
|
|
20415
|
+
}, (node2) => {
|
|
20416
|
+
data2.parentNode = node2;
|
|
20433
20417
|
});
|
|
20434
20418
|
};
|
|
20435
20419
|
onMounted(() => __async(this, null, function* () {
|
|
20436
|
-
|
|
20420
|
+
props.idQueryNode({
|
|
20421
|
+
id: "",
|
|
20422
|
+
isReturnParent: true
|
|
20423
|
+
}, (node) => {
|
|
20424
|
+
data2.parentNode = node;
|
|
20425
|
+
});
|
|
20437
20426
|
}));
|
|
20438
|
-
watch(() =>
|
|
20439
|
-
data2.
|
|
20440
|
-
|
|
20427
|
+
watch(() => modelValue.value, (n, o) => __async(this, null, function* () {
|
|
20428
|
+
data2.selectedNodeId = modelValue.value;
|
|
20429
|
+
let params = {};
|
|
20430
|
+
params.id = modelValue.value;
|
|
20431
|
+
params.isReturnParent = true;
|
|
20432
|
+
params.hasChildren = true;
|
|
20433
|
+
yield props.idQueryNode(params, (node) => {
|
|
20434
|
+
data2.parentNode = node;
|
|
20435
|
+
if (!modelValue.value)
|
|
20436
|
+
return;
|
|
20437
|
+
let childNode = util.findNode(modelValue.value, data2.parentNode.children);
|
|
20438
|
+
emit("select", childNode);
|
|
20439
|
+
});
|
|
20440
|
+
}), {
|
|
20441
20441
|
immediate: true
|
|
20442
20442
|
});
|
|
20443
|
-
watch(() => props.show, () => {
|
|
20444
|
-
if (!props.show)
|
|
20445
|
-
return;
|
|
20446
|
-
queryTotalNodes();
|
|
20447
|
-
});
|
|
20448
20443
|
return (_ctx, _cache) => {
|
|
20449
20444
|
const _component_van_button = resolveComponent("van-button");
|
|
20450
20445
|
const _component_van_search = resolveComponent("van-search");
|
|
@@ -20496,7 +20491,7 @@ const _sfc_main$2 = {
|
|
|
20496
20491
|
return openBlock(), createBlock(_component_van_cell, {
|
|
20497
20492
|
key: i
|
|
20498
20493
|
}, createSlots({
|
|
20499
|
-
title: withCtx(() => [createElementVNode("div", _hoisted_9, [
|
|
20494
|
+
title: withCtx(() => [createElementVNode("div", _hoisted_9, [item.canCheck ? (openBlock(), createElementBlock("div", {
|
|
20500
20495
|
key: 0,
|
|
20501
20496
|
class: "circle-selector",
|
|
20502
20497
|
onClick: withModifiers(($event) => onToggle(item), ["stop"])
|
|
@@ -20512,7 +20507,7 @@ const _sfc_main$2 = {
|
|
|
20512
20507
|
color: "#e0e0e0"
|
|
20513
20508
|
})) : createCommentVNode("", true)], 8, _hoisted_10)) : createCommentVNode("", true), createElementVNode("span", _hoisted_11, toDisplayString(item.label), 1)])]),
|
|
20514
20509
|
_: 2
|
|
20515
|
-
}, [item.hasChildren && item.
|
|
20510
|
+
}, [item.hasChildren && item.canExpand ? {
|
|
20516
20511
|
name: "right-icon",
|
|
20517
20512
|
fn: withCtx(() => [createVNode(_component_van_icon, {
|
|
20518
20513
|
name: "arrow",
|
|
@@ -20527,7 +20522,7 @@ const _sfc_main$2 = {
|
|
|
20527
20522
|
};
|
|
20528
20523
|
}
|
|
20529
20524
|
};
|
|
20530
|
-
var CascaderPop = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
20525
|
+
var CascaderPop = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-c97110e4"]]);
|
|
20531
20526
|
const _sfc_main$1 = {
|
|
20532
20527
|
__name: "CascaderPicker",
|
|
20533
20528
|
props: {
|
|
@@ -20559,23 +20554,15 @@ const _sfc_main$1 = {
|
|
|
20559
20554
|
type: String,
|
|
20560
20555
|
default: ""
|
|
20561
20556
|
},
|
|
20562
|
-
|
|
20557
|
+
keywordQueryNode: {
|
|
20563
20558
|
type: Function,
|
|
20564
20559
|
default: () => {
|
|
20565
20560
|
}
|
|
20566
20561
|
},
|
|
20567
|
-
|
|
20562
|
+
idQueryNode: {
|
|
20568
20563
|
type: Function,
|
|
20569
20564
|
default: () => {
|
|
20570
20565
|
}
|
|
20571
|
-
},
|
|
20572
|
-
minLevel: {
|
|
20573
|
-
type: Number,
|
|
20574
|
-
default: 1
|
|
20575
|
-
},
|
|
20576
|
-
maxLevel: {
|
|
20577
|
-
type: Number,
|
|
20578
|
-
default: 9999
|
|
20579
20566
|
}
|
|
20580
20567
|
},
|
|
20581
20568
|
emits: ["update:modelValue", "select"],
|
|
@@ -20604,18 +20591,6 @@ const _sfc_main$1 = {
|
|
|
20604
20591
|
data2.selectedNode = {};
|
|
20605
20592
|
modelValue.value = null;
|
|
20606
20593
|
};
|
|
20607
|
-
watch(() => modelValue.value, (n, o) => __async(this, null, function* () {
|
|
20608
|
-
if (!n) {
|
|
20609
|
-
data2.selectedNode = {};
|
|
20610
|
-
return;
|
|
20611
|
-
}
|
|
20612
|
-
props.queryNode((node) => {
|
|
20613
|
-
data2.selectedNode = node;
|
|
20614
|
-
emit("select", data2.selectedNode);
|
|
20615
|
-
});
|
|
20616
|
-
}), {
|
|
20617
|
-
immediate: true
|
|
20618
|
-
});
|
|
20619
20594
|
return (_ctx, _cache) => {
|
|
20620
20595
|
const _component_van_tag = resolveComponent("van-tag");
|
|
20621
20596
|
const _component_van_field = resolveComponent("van-field");
|
|
@@ -20643,7 +20618,7 @@ const _sfc_main$1 = {
|
|
|
20643
20618
|
size: "medium",
|
|
20644
20619
|
onClose: withModifiers(onDelete, ["stop"])
|
|
20645
20620
|
}, {
|
|
20646
|
-
default: withCtx(() => [createTextVNode(toDisplayString(data2.selectedNode.
|
|
20621
|
+
default: withCtx(() => [createTextVNode(toDisplayString(data2.selectedNode.path), 1)]),
|
|
20647
20622
|
_: 1
|
|
20648
20623
|
}, 8, ["closeable", "onClose"])) : createCommentVNode("", true)])
|
|
20649
20624
|
} : void 0]), 1032, ["label", "required", "rules", "disabled", "placeholder", "is-link"])) : createCommentVNode("", true), createVNode(CascaderPop, {
|
|
@@ -20653,11 +20628,9 @@ const _sfc_main$1 = {
|
|
|
20653
20628
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
|
|
20654
20629
|
placeholder: props.placeholder,
|
|
20655
20630
|
onSelect,
|
|
20656
|
-
|
|
20657
|
-
|
|
20658
|
-
|
|
20659
|
-
maxLevel: props.maxLevel
|
|
20660
|
-
}, null, 8, ["show", "modelValue", "placeholder", "queryNodes", "queryNode", "minLevel", "maxLevel"])], 64);
|
|
20631
|
+
keywordQueryNode: props.keywordQueryNode,
|
|
20632
|
+
idQueryNode: props.idQueryNode
|
|
20633
|
+
}, null, 8, ["show", "modelValue", "placeholder", "keywordQueryNode", "idQueryNode"])], 64);
|
|
20661
20634
|
};
|
|
20662
20635
|
}
|
|
20663
20636
|
};
|
package/build/widget.qw.umd.js
CHANGED
|
@@ -20282,7 +20282,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20282
20282
|
}
|
|
20283
20283
|
};
|
|
20284
20284
|
var TreePicker = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-6744b874"]]);
|
|
20285
|
-
var CascaderPop_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.cascader-pop[data-v-
|
|
20285
|
+
var CascaderPop_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.cascader-pop[data-v-c97110e4] {\r\n width: 100%;\r\n overflow: hidden;\n}\n.cascader-selector[data-v-c97110e4] {\r\n padding: 10px;\n}\n.search-buttons[data-v-c97110e4] {\r\n display: flex;\r\n gap: 10px;\n}\n.clear-btn[data-v-c97110e4] {\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-c97110e4] {\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-c97110e4] {\r\n text-align: center;\r\n padding: 20px;\r\n color: #969799;\n}\n.cascader-header[data-v-c97110e4] {\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-c97110e4] {\r\n flex: 1;\r\n font-size: 14px;\r\n color: #323233;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\n}\n.header-right[data-v-c97110e4] {\r\n display: flex;\r\n gap: 8px;\r\n margin-left: auto;\n}\n.cancel-btn[data-v-c97110e4] {\r\n color: #969799;\r\n margin-right: 5px;\n}\n.scroll-container[data-v-c97110e4] {\r\n height: calc(80vh - 150px);\r\n overflow-y: auto;\n}\n.cell-content[data-v-c97110e4] {\r\n display: flex;\r\n align-items: center;\r\n gap: 12px;\n}\n.circle-selector[data-v-c97110e4] {\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-c97110e4] {\r\n background-color: #1989fa;\r\n border-color: #1989fa;\n}\n.circle-selector.selected .van-icon[data-v-c97110e4] {\r\n color: white;\r\n font-size: 14px;\n}\n.van-cell__right-icon[data-v-c97110e4] {\r\n color: #969799;\r\n font-size: 16px;\r\n margin-left: 8px;\n}\n.name[data-v-c97110e4] {\r\n flex: 1;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\n}\n.cancel-btn[data-v-c97110e4] {\r\n color: #969799;\n}\n.search-field[data-v-c97110e4] {\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")();
|
|
20286
20286
|
const _hoisted_1$1 = {
|
|
20287
20287
|
class: "cascader-selector"
|
|
20288
20288
|
};
|
|
@@ -20325,26 +20325,18 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20325
20325
|
type: String,
|
|
20326
20326
|
default: ""
|
|
20327
20327
|
},
|
|
20328
|
-
|
|
20328
|
+
keywordQueryNode: {
|
|
20329
20329
|
type: Function,
|
|
20330
20330
|
default: () => {
|
|
20331
20331
|
}
|
|
20332
20332
|
},
|
|
20333
|
-
|
|
20333
|
+
idQueryNode: {
|
|
20334
20334
|
type: Function,
|
|
20335
20335
|
default: () => {
|
|
20336
20336
|
}
|
|
20337
|
-
},
|
|
20338
|
-
minLevel: {
|
|
20339
|
-
type: Number,
|
|
20340
|
-
default: 0
|
|
20341
|
-
},
|
|
20342
|
-
maxLevel: {
|
|
20343
|
-
type: Number,
|
|
20344
|
-
default: 9999
|
|
20345
20337
|
}
|
|
20346
20338
|
},
|
|
20347
|
-
emits: ["update:show", "select"],
|
|
20339
|
+
emits: ["update:modelValue", "update:show", "select"],
|
|
20348
20340
|
setup(__props, {
|
|
20349
20341
|
emit
|
|
20350
20342
|
}) {
|
|
@@ -20352,57 +20344,52 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20352
20344
|
const show = useVModel(props, "show", emit);
|
|
20353
20345
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
20354
20346
|
const data2 = vue.reactive({
|
|
20355
|
-
|
|
20347
|
+
parentNode: null,
|
|
20356
20348
|
keyword: "",
|
|
20357
|
-
currentNode: null,
|
|
20358
20349
|
selectedNodeId: ""
|
|
20359
20350
|
});
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
|
|
20351
|
+
vue.onMounted(() => {
|
|
20352
|
+
props.idQueryNode({
|
|
20353
|
+
id: "",
|
|
20354
|
+
isReturnParent: true
|
|
20355
|
+
}, (node) => {
|
|
20356
|
+
data2.parentNode = node;
|
|
20357
|
+
});
|
|
20358
|
+
});
|
|
20363
20359
|
const optionNodes = vue.computed(() => {
|
|
20364
20360
|
var _a;
|
|
20365
|
-
|
|
20366
|
-
return ((_a = data2.currentNode) == null ? void 0 : _a.children) ? data2.currentNode.children : [];
|
|
20367
|
-
else
|
|
20368
|
-
return data2.totalNodes ? data2.totalNodes : [];
|
|
20361
|
+
return ((_a = data2.parentNode) == null ? void 0 : _a.children) ? data2.parentNode.children : [];
|
|
20369
20362
|
});
|
|
20370
20363
|
const pathsLabel = vue.computed(() => {
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
let paths = util.findPaths(data2.currentNode.id, data2.totalNodes);
|
|
20374
|
-
console.log("paths", paths);
|
|
20375
|
-
let res = paths.map((item) => item.label).join("/");
|
|
20376
|
-
return res;
|
|
20364
|
+
var _a;
|
|
20365
|
+
return ((_a = data2.parentNode) == null ? void 0 : _a.path) ? data2.parentNode.path : "";
|
|
20377
20366
|
});
|
|
20378
|
-
const
|
|
20379
|
-
|
|
20367
|
+
const keywordQueryNode = () => {
|
|
20368
|
+
props.keywordQueryNode({
|
|
20380
20369
|
keyword: data2.keyword,
|
|
20381
|
-
|
|
20382
|
-
}, (
|
|
20383
|
-
data2.
|
|
20370
|
+
isReturnParent: true
|
|
20371
|
+
}, (node) => {
|
|
20372
|
+
data2.parentNode = node;
|
|
20384
20373
|
});
|
|
20385
|
-
}
|
|
20386
|
-
const onSearch = () =>
|
|
20387
|
-
|
|
20388
|
-
|
|
20389
|
-
parentId: ""
|
|
20390
|
-
}, (nodes) => {
|
|
20391
|
-
data2.totalNodes = nodes;
|
|
20392
|
-
data2.currentNode = null;
|
|
20393
|
-
});
|
|
20394
|
-
});
|
|
20374
|
+
};
|
|
20375
|
+
const onSearch = () => {
|
|
20376
|
+
keywordQueryNode();
|
|
20377
|
+
};
|
|
20395
20378
|
const onBack = () => {
|
|
20396
|
-
if (!data2.
|
|
20379
|
+
if (!data2.parentNode || !data2.parentNode.parentId)
|
|
20397
20380
|
return;
|
|
20398
20381
|
data2.keyword = "";
|
|
20399
|
-
|
|
20382
|
+
props.idQueryNode({
|
|
20383
|
+
id: data2.parentNode.parentId,
|
|
20384
|
+
isReturnParent: true
|
|
20385
|
+
}, (node) => {
|
|
20386
|
+
data2.parentNode = node;
|
|
20387
|
+
});
|
|
20400
20388
|
};
|
|
20401
20389
|
const onClear = () => {
|
|
20402
20390
|
data2.keyword = "";
|
|
20403
20391
|
};
|
|
20404
20392
|
const reset = () => {
|
|
20405
|
-
data2.currentNode = null;
|
|
20406
20393
|
data2.keyword = "";
|
|
20407
20394
|
};
|
|
20408
20395
|
const onSubmit = () => {
|
|
@@ -20410,9 +20397,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20410
20397
|
util.warnToast("\u8BF7\u9009\u62E9");
|
|
20411
20398
|
return;
|
|
20412
20399
|
}
|
|
20413
|
-
|
|
20414
|
-
modelValue.value = selectedNode.id;
|
|
20415
|
-
emit("select", selectedNode);
|
|
20400
|
+
modelValue.value = data2.selectedNodeId;
|
|
20416
20401
|
show.value = false;
|
|
20417
20402
|
reset();
|
|
20418
20403
|
};
|
|
@@ -20427,27 +20412,37 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20427
20412
|
data2.selectedNodeId = node.id;
|
|
20428
20413
|
};
|
|
20429
20414
|
const onNextLevel = (node) => {
|
|
20430
|
-
props.
|
|
20431
|
-
|
|
20432
|
-
|
|
20433
|
-
}, (
|
|
20434
|
-
|
|
20435
|
-
data2.currentNode = node;
|
|
20415
|
+
props.idQueryNode({
|
|
20416
|
+
id: node.id,
|
|
20417
|
+
isReturnParent: false
|
|
20418
|
+
}, (node2) => {
|
|
20419
|
+
data2.parentNode = node2;
|
|
20436
20420
|
});
|
|
20437
20421
|
};
|
|
20438
20422
|
vue.onMounted(() => __async(this, null, function* () {
|
|
20439
|
-
|
|
20423
|
+
props.idQueryNode({
|
|
20424
|
+
id: "",
|
|
20425
|
+
isReturnParent: true
|
|
20426
|
+
}, (node) => {
|
|
20427
|
+
data2.parentNode = node;
|
|
20428
|
+
});
|
|
20440
20429
|
}));
|
|
20441
|
-
vue.watch(() =>
|
|
20442
|
-
data2.
|
|
20443
|
-
|
|
20430
|
+
vue.watch(() => modelValue.value, (n, o) => __async(this, null, function* () {
|
|
20431
|
+
data2.selectedNodeId = modelValue.value;
|
|
20432
|
+
let params = {};
|
|
20433
|
+
params.id = modelValue.value;
|
|
20434
|
+
params.isReturnParent = true;
|
|
20435
|
+
params.hasChildren = true;
|
|
20436
|
+
yield props.idQueryNode(params, (node) => {
|
|
20437
|
+
data2.parentNode = node;
|
|
20438
|
+
if (!modelValue.value)
|
|
20439
|
+
return;
|
|
20440
|
+
let childNode = util.findNode(modelValue.value, data2.parentNode.children);
|
|
20441
|
+
emit("select", childNode);
|
|
20442
|
+
});
|
|
20443
|
+
}), {
|
|
20444
20444
|
immediate: true
|
|
20445
20445
|
});
|
|
20446
|
-
vue.watch(() => props.show, () => {
|
|
20447
|
-
if (!props.show)
|
|
20448
|
-
return;
|
|
20449
|
-
queryTotalNodes();
|
|
20450
|
-
});
|
|
20451
20446
|
return (_ctx, _cache) => {
|
|
20452
20447
|
const _component_van_button = vue.resolveComponent("van-button");
|
|
20453
20448
|
const _component_van_search = vue.resolveComponent("van-search");
|
|
@@ -20499,7 +20494,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20499
20494
|
return vue.openBlock(), vue.createBlock(_component_van_cell, {
|
|
20500
20495
|
key: i
|
|
20501
20496
|
}, vue.createSlots({
|
|
20502
|
-
title: vue.withCtx(() => [vue.createElementVNode("div", _hoisted_9, [
|
|
20497
|
+
title: vue.withCtx(() => [vue.createElementVNode("div", _hoisted_9, [item.canCheck ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
20503
20498
|
key: 0,
|
|
20504
20499
|
class: "circle-selector",
|
|
20505
20500
|
onClick: vue.withModifiers(($event) => onToggle(item), ["stop"])
|
|
@@ -20515,7 +20510,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20515
20510
|
color: "#e0e0e0"
|
|
20516
20511
|
})) : vue.createCommentVNode("", true)], 8, _hoisted_10)) : vue.createCommentVNode("", true), vue.createElementVNode("span", _hoisted_11, vue.toDisplayString(item.label), 1)])]),
|
|
20517
20512
|
_: 2
|
|
20518
|
-
}, [item.hasChildren && item.
|
|
20513
|
+
}, [item.hasChildren && item.canExpand ? {
|
|
20519
20514
|
name: "right-icon",
|
|
20520
20515
|
fn: vue.withCtx(() => [vue.createVNode(_component_van_icon, {
|
|
20521
20516
|
name: "arrow",
|
|
@@ -20530,7 +20525,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20530
20525
|
};
|
|
20531
20526
|
}
|
|
20532
20527
|
};
|
|
20533
|
-
var CascaderPop = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
20528
|
+
var CascaderPop = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-c97110e4"]]);
|
|
20534
20529
|
const _sfc_main$1 = {
|
|
20535
20530
|
__name: "CascaderPicker",
|
|
20536
20531
|
props: {
|
|
@@ -20562,23 +20557,15 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20562
20557
|
type: String,
|
|
20563
20558
|
default: ""
|
|
20564
20559
|
},
|
|
20565
|
-
|
|
20560
|
+
keywordQueryNode: {
|
|
20566
20561
|
type: Function,
|
|
20567
20562
|
default: () => {
|
|
20568
20563
|
}
|
|
20569
20564
|
},
|
|
20570
|
-
|
|
20565
|
+
idQueryNode: {
|
|
20571
20566
|
type: Function,
|
|
20572
20567
|
default: () => {
|
|
20573
20568
|
}
|
|
20574
|
-
},
|
|
20575
|
-
minLevel: {
|
|
20576
|
-
type: Number,
|
|
20577
|
-
default: 1
|
|
20578
|
-
},
|
|
20579
|
-
maxLevel: {
|
|
20580
|
-
type: Number,
|
|
20581
|
-
default: 9999
|
|
20582
20569
|
}
|
|
20583
20570
|
},
|
|
20584
20571
|
emits: ["update:modelValue", "select"],
|
|
@@ -20607,18 +20594,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20607
20594
|
data2.selectedNode = {};
|
|
20608
20595
|
modelValue.value = null;
|
|
20609
20596
|
};
|
|
20610
|
-
vue.watch(() => modelValue.value, (n, o) => __async(this, null, function* () {
|
|
20611
|
-
if (!n) {
|
|
20612
|
-
data2.selectedNode = {};
|
|
20613
|
-
return;
|
|
20614
|
-
}
|
|
20615
|
-
props.queryNode((node) => {
|
|
20616
|
-
data2.selectedNode = node;
|
|
20617
|
-
emit("select", data2.selectedNode);
|
|
20618
|
-
});
|
|
20619
|
-
}), {
|
|
20620
|
-
immediate: true
|
|
20621
|
-
});
|
|
20622
20597
|
return (_ctx, _cache) => {
|
|
20623
20598
|
const _component_van_tag = vue.resolveComponent("van-tag");
|
|
20624
20599
|
const _component_van_field = vue.resolveComponent("van-field");
|
|
@@ -20646,7 +20621,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20646
20621
|
size: "medium",
|
|
20647
20622
|
onClose: vue.withModifiers(onDelete, ["stop"])
|
|
20648
20623
|
}, {
|
|
20649
|
-
default: vue.withCtx(() => [vue.createTextVNode(vue.toDisplayString(data2.selectedNode.
|
|
20624
|
+
default: vue.withCtx(() => [vue.createTextVNode(vue.toDisplayString(data2.selectedNode.path), 1)]),
|
|
20650
20625
|
_: 1
|
|
20651
20626
|
}, 8, ["closeable", "onClose"])) : vue.createCommentVNode("", true)])
|
|
20652
20627
|
} : void 0]), 1032, ["label", "required", "rules", "disabled", "placeholder", "is-link"])) : vue.createCommentVNode("", true), vue.createVNode(CascaderPop, {
|
|
@@ -20656,11 +20631,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20656
20631
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null),
|
|
20657
20632
|
placeholder: props.placeholder,
|
|
20658
20633
|
onSelect,
|
|
20659
|
-
|
|
20660
|
-
|
|
20661
|
-
|
|
20662
|
-
maxLevel: props.maxLevel
|
|
20663
|
-
}, null, 8, ["show", "modelValue", "placeholder", "queryNodes", "queryNode", "minLevel", "maxLevel"])], 64);
|
|
20634
|
+
keywordQueryNode: props.keywordQueryNode,
|
|
20635
|
+
idQueryNode: props.idQueryNode
|
|
20636
|
+
}, null, 8, ["show", "modelValue", "placeholder", "keywordQueryNode", "idQueryNode"])], 64);
|
|
20664
20637
|
};
|
|
20665
20638
|
}
|
|
20666
20639
|
};
|
package/package.json
CHANGED
|
@@ -5,16 +5,15 @@
|
|
|
5
5
|
<template #input v-if="modelValue">
|
|
6
6
|
<van-tag class="selected-node" v-if="modelValue" :closeable="!isDisabled" color="#fff" text-color="#333"
|
|
7
7
|
size="medium" @close.stop="onDelete">
|
|
8
|
-
{{ data.selectedNode.
|
|
8
|
+
{{ data.selectedNode.path }}
|
|
9
9
|
</van-tag>
|
|
10
10
|
</template>
|
|
11
11
|
</van-field>
|
|
12
12
|
|
|
13
13
|
<CascaderPop v-model:show="data.isShowPop" v-model="modelValue" :placeholder="props.placeholder" @select="onSelect"
|
|
14
|
-
:
|
|
15
|
-
:maxLevel="props.maxLevel" />
|
|
16
|
-
|
|
14
|
+
:keywordQueryNode="props.keywordQueryNode" :idQueryNode="props.idQueryNode" />
|
|
17
15
|
</template>
|
|
16
|
+
|
|
18
17
|
<script setup>
|
|
19
18
|
import { reactive, onMounted, watch } from "vue";
|
|
20
19
|
import util from "@/util"
|
|
@@ -50,22 +49,14 @@ const props = defineProps({
|
|
|
50
49
|
type: String,
|
|
51
50
|
default: "",
|
|
52
51
|
},
|
|
53
|
-
|
|
52
|
+
keywordQueryNode: {
|
|
54
53
|
type: Function,
|
|
55
54
|
default: () => { }
|
|
56
55
|
},
|
|
57
|
-
|
|
56
|
+
idQueryNode: {
|
|
58
57
|
type: Function,
|
|
59
58
|
default: () => { }
|
|
60
59
|
},
|
|
61
|
-
minLevel: {
|
|
62
|
-
type: Number,
|
|
63
|
-
default: 1
|
|
64
|
-
},
|
|
65
|
-
maxLevel: {
|
|
66
|
-
type: Number,
|
|
67
|
-
default: 9999
|
|
68
|
-
}
|
|
69
60
|
});
|
|
70
61
|
|
|
71
62
|
// 弹出层
|
|
@@ -92,20 +83,6 @@ const onDelete = () => {
|
|
|
92
83
|
data.selectedNode = {}
|
|
93
84
|
modelValue.value = null
|
|
94
85
|
}
|
|
95
|
-
|
|
96
|
-
watch(() => modelValue.value, async (n, o) => {
|
|
97
|
-
if (!n) {
|
|
98
|
-
data.selectedNode = {}
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
props.queryNode((node) => {
|
|
103
|
-
data.selectedNode = node
|
|
104
|
-
emit('select', data.selectedNode)
|
|
105
|
-
})
|
|
106
|
-
}, {
|
|
107
|
-
immediate: true
|
|
108
|
-
})
|
|
109
86
|
</script>
|
|
110
87
|
|
|
111
88
|
<style scoped></style>
|
|
@@ -27,18 +27,20 @@
|
|
|
27
27
|
<div class="scroll-container">
|
|
28
28
|
<!-- 遍历子节点列表 -->
|
|
29
29
|
<van-cell-group>
|
|
30
|
-
<van-cell v-for="(item, i) in optionNodes" :key="i"
|
|
30
|
+
<van-cell v-for="(item, i) in optionNodes" :key="i">
|
|
31
31
|
<template #title>
|
|
32
32
|
<div class="cell-content">
|
|
33
|
-
<div class="circle-selector" v-if="
|
|
34
|
-
<van-icon v-if="data.selectedNodeId === item.id" name="success" size="20"
|
|
35
|
-
|
|
33
|
+
<div class="circle-selector" v-if="item.canCheck" @click.stop="onToggle(item)">
|
|
34
|
+
<van-icon v-if="data.selectedNodeId === item.id" name="success" size="20"
|
|
35
|
+
color="#409eff" />
|
|
36
|
+
<van-icon v-if="data.selectedNodeId != item.id" name="circle" size="20"
|
|
37
|
+
color="#e0e0e0" />
|
|
36
38
|
</div>
|
|
37
39
|
<span class="name">{{ item.label }}</span>
|
|
38
40
|
</div>
|
|
39
41
|
</template>
|
|
40
|
-
<template #right-icon v-if="item.hasChildren && item.
|
|
41
|
-
<van-icon name="arrow" @click.stop="onNextLevel(item)"/>
|
|
42
|
+
<template #right-icon v-if="item.hasChildren && item.canExpand">
|
|
43
|
+
<van-icon name="arrow" @click.stop="onNextLevel(item)" />
|
|
42
44
|
</template>
|
|
43
45
|
</van-cell>
|
|
44
46
|
</van-cell-group>
|
|
@@ -65,94 +67,75 @@ const props = defineProps({
|
|
|
65
67
|
type: String,
|
|
66
68
|
default: ''
|
|
67
69
|
},
|
|
68
|
-
|
|
70
|
+
keywordQueryNode: {
|
|
69
71
|
type: Function,
|
|
70
72
|
default: () => { }
|
|
71
73
|
},
|
|
72
|
-
|
|
74
|
+
idQueryNode: {
|
|
73
75
|
type: Function,
|
|
74
76
|
default: () => { }
|
|
75
77
|
},
|
|
76
|
-
minLevel:{
|
|
77
|
-
type:Number,
|
|
78
|
-
default: 0
|
|
79
|
-
},
|
|
80
|
-
maxLevel:{
|
|
81
|
-
type:Number,
|
|
82
|
-
default: 9999
|
|
83
|
-
}
|
|
84
78
|
});
|
|
85
79
|
// 定义emit
|
|
86
|
-
const emit = defineEmits(["update:show", "select"]);
|
|
80
|
+
const emit = defineEmits(["update:modelValue", "update:show", "select"]);
|
|
87
81
|
// 弹出?
|
|
88
82
|
const show = useVModel(props, 'show', emit)
|
|
89
83
|
const modelValue = useVModel(props, 'modelValue', emit)
|
|
90
84
|
const data = reactive({
|
|
91
|
-
|
|
92
|
-
|
|
85
|
+
//当前父节点
|
|
86
|
+
parentNode: null,
|
|
93
87
|
// 搜索关键字
|
|
94
88
|
keyword: "",
|
|
95
|
-
|
|
96
|
-
currentNode: null,
|
|
97
|
-
//勾选的节点id
|
|
89
|
+
//勾选的子节点id
|
|
98
90
|
selectedNodeId: ''
|
|
99
91
|
})
|
|
100
92
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
93
|
+
onMounted(() => {
|
|
94
|
+
//查询根节点
|
|
95
|
+
props.idQueryNode({ id: '', isReturnParent: true }, (node) => {
|
|
96
|
+
data.parentNode = node
|
|
97
|
+
})
|
|
98
|
+
})
|
|
104
99
|
|
|
105
100
|
// 待选节点列表
|
|
106
101
|
const optionNodes = computed(() => {
|
|
107
|
-
|
|
108
|
-
return data.currentNode?.children ? data.currentNode.children : []
|
|
109
|
-
else
|
|
110
|
-
return data.totalNodes ? data.totalNodes : []
|
|
102
|
+
return data.parentNode?.children ? data.parentNode.children : []
|
|
111
103
|
})
|
|
112
104
|
|
|
113
105
|
//选中节点的路径:父/子/孙
|
|
114
106
|
const pathsLabel = computed(() => {
|
|
115
|
-
|
|
116
|
-
return ''
|
|
117
|
-
|
|
118
|
-
let paths = util.findPaths(data.currentNode.id, data.totalNodes)
|
|
119
|
-
console.log("paths", paths);
|
|
120
|
-
let res = paths.map(item => item.label).join('/')
|
|
121
|
-
return res
|
|
107
|
+
return data.parentNode?.path ? data.parentNode.path : ''
|
|
122
108
|
})
|
|
123
109
|
|
|
124
|
-
//
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
data.
|
|
110
|
+
// 关键字查询节点列表
|
|
111
|
+
const keywordQueryNode = () => {
|
|
112
|
+
props.keywordQueryNode({ keyword: data.keyword, isReturnParent: true }, (node) => {
|
|
113
|
+
data.parentNode = node
|
|
128
114
|
})
|
|
129
115
|
}
|
|
130
116
|
|
|
131
117
|
// 关键字查询
|
|
132
|
-
const onSearch =
|
|
133
|
-
|
|
134
|
-
data.totalNodes = nodes
|
|
135
|
-
data.currentNode = null
|
|
136
|
-
})
|
|
118
|
+
const onSearch = () => {
|
|
119
|
+
keywordQueryNode()
|
|
137
120
|
}
|
|
138
121
|
|
|
139
122
|
// 返回上一级
|
|
140
123
|
const onBack = () => {
|
|
141
|
-
if (!data.
|
|
124
|
+
if (!data.parentNode || !data.parentNode.parentId)
|
|
142
125
|
return
|
|
143
126
|
|
|
144
127
|
data.keyword = ""
|
|
145
|
-
|
|
128
|
+
props.idQueryNode({ id: data.parentNode.parentId, isReturnParent: true }, (node) => {
|
|
129
|
+
data.parentNode = node
|
|
130
|
+
})
|
|
146
131
|
}
|
|
147
132
|
|
|
148
|
-
const onClear=()=>{
|
|
133
|
+
const onClear = () => {
|
|
149
134
|
data.keyword = ''
|
|
150
135
|
}
|
|
151
136
|
|
|
152
137
|
// 清除掉选中节点
|
|
153
138
|
const reset = () => {
|
|
154
|
-
// 当前节点
|
|
155
|
-
data.currentNode = null
|
|
156
139
|
// 搜索关键字
|
|
157
140
|
data.keyword = ""
|
|
158
141
|
}
|
|
@@ -164,9 +147,7 @@ const onSubmit = () => {
|
|
|
164
147
|
return
|
|
165
148
|
}
|
|
166
149
|
|
|
167
|
-
|
|
168
|
-
modelValue.value = selectedNode.id
|
|
169
|
-
emit('select', selectedNode)
|
|
150
|
+
modelValue.value = data.selectedNodeId
|
|
170
151
|
show.value = false
|
|
171
152
|
|
|
172
153
|
reset()
|
|
@@ -179,34 +160,44 @@ const onCancel = () => {
|
|
|
179
160
|
}
|
|
180
161
|
|
|
181
162
|
const onToggle = (node) => {
|
|
182
|
-
if(data.selectedNodeId == node.id)
|
|
163
|
+
if (data.selectedNodeId == node.id)
|
|
183
164
|
data.selectedNodeId = ''
|
|
184
165
|
else
|
|
185
166
|
data.selectedNodeId = node.id
|
|
186
|
-
}
|
|
167
|
+
}
|
|
187
168
|
|
|
188
169
|
const onNextLevel = (node) => {
|
|
189
|
-
props.
|
|
190
|
-
|
|
191
|
-
data.currentNode = node
|
|
170
|
+
props.idQueryNode({ id: node.id, isReturnParent: false }, (node) => {
|
|
171
|
+
data.parentNode = node
|
|
192
172
|
})
|
|
193
173
|
}
|
|
194
174
|
|
|
195
175
|
//首页加载
|
|
196
176
|
onMounted(async () => {
|
|
197
|
-
|
|
177
|
+
props.idQueryNode({ id: '', isReturnParent: true }, (node) => {
|
|
178
|
+
data.parentNode = node
|
|
179
|
+
})
|
|
198
180
|
})
|
|
199
181
|
|
|
200
|
-
watch(() =>
|
|
201
|
-
|
|
202
|
-
data.currentNode = util.findParent(props.modelValue, data.totalNodes)
|
|
203
|
-
}, { immediate: true })
|
|
182
|
+
watch(() => modelValue.value, async (n, o) => {
|
|
183
|
+
data.selectedNodeId = modelValue.value
|
|
204
184
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
185
|
+
let params = {}
|
|
186
|
+
params.id = modelValue.value
|
|
187
|
+
params.isReturnParent = true
|
|
188
|
+
params.hasChildren = true
|
|
208
189
|
|
|
209
|
-
|
|
190
|
+
await props.idQueryNode(params, (node) => {
|
|
191
|
+
data.parentNode = node
|
|
192
|
+
|
|
193
|
+
if (!modelValue.value)
|
|
194
|
+
return
|
|
195
|
+
|
|
196
|
+
let childNode = util.findNode(modelValue.value, data.parentNode.children)
|
|
197
|
+
emit('select', childNode)
|
|
198
|
+
})
|
|
199
|
+
}, {
|
|
200
|
+
immediate: true
|
|
210
201
|
})
|
|
211
202
|
</script>
|
|
212
203
|
|
|
Binary file
|