bm-admin-ui 1.2.55-alpha → 1.2.56-alpha
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/es/components/staffs-selector/index.d.ts +1 -0
- package/es/components/staffs-selector/index.js +22 -3
- package/es/components/staffs-selector/src/staffs-selector.vue.d.ts +1 -0
- package/lib/components/staffs-selector/index.d.ts +1 -0
- package/lib/components/staffs-selector/index.js +22 -3
- package/lib/components/staffs-selector/src/staffs-selector.vue.d.ts +1 -0
- package/package.json +1 -1
- package/types/components/staffs-selector/index.d.ts +1 -0
- package/types/components/staffs-selector/src/staffs-selector.vue.d.ts +1 -0
|
@@ -116,6 +116,7 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
|
|
|
116
116
|
findDataByKey: (key: string) => any;
|
|
117
117
|
summitSelect: () => void;
|
|
118
118
|
getOptionName: (key: any) => any;
|
|
119
|
+
findParentNode: (tree: any, targetId: any, parent?: null) => any;
|
|
119
120
|
deleteOptions: (key: any) => void;
|
|
120
121
|
onLoadData: (treeNode: any, list: any) => any;
|
|
121
122
|
AModal: {
|
|
@@ -701,16 +701,35 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
701
701
|
);
|
|
702
702
|
return had?.title ? `${had.title}` : had;
|
|
703
703
|
}
|
|
704
|
+
function findParentNode(tree, targetId, parent = null) {
|
|
705
|
+
for (const node of tree) {
|
|
706
|
+
if (node.id === targetId) {
|
|
707
|
+
return parent;
|
|
708
|
+
}
|
|
709
|
+
if (node.children && Array.isArray(node.children)) {
|
|
710
|
+
const found = findParentNode(node.children, targetId, node);
|
|
711
|
+
if (found !== null) {
|
|
712
|
+
return found;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
return null;
|
|
717
|
+
}
|
|
704
718
|
function deleteOptions(key) {
|
|
705
719
|
if (props.mode === MODE.MULTIPLE) {
|
|
706
720
|
if (selectState.multipleChecked[String(key)]) {
|
|
707
721
|
selectState.multipleChecked[String(key)] = false;
|
|
708
722
|
}
|
|
709
723
|
} else if (props.mode === MODE.DEPARTMENT) {
|
|
710
|
-
|
|
711
|
-
|
|
724
|
+
const keyStr = String(key);
|
|
725
|
+
const parentNode = findParentNode(list.value, key);
|
|
726
|
+
const parentKeyStr = parentNode ? String(parentNode.id) : null;
|
|
727
|
+
selectState.multipDepartment = selectState.multipDepartment.filter(
|
|
728
|
+
(item) => {
|
|
729
|
+
const itemStr = String(item);
|
|
730
|
+
return itemStr !== keyStr && itemStr !== parentKeyStr;
|
|
731
|
+
}
|
|
712
732
|
);
|
|
713
|
-
index > -1 && selectState.multipDepartment.splice(index, 1);
|
|
714
733
|
}
|
|
715
734
|
}
|
|
716
735
|
function onLoadData(treeNode, list2) {
|
|
@@ -116,6 +116,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
116
116
|
findDataByKey: (key: string) => any;
|
|
117
117
|
summitSelect: () => void;
|
|
118
118
|
getOptionName: (key: any) => any;
|
|
119
|
+
findParentNode: (tree: any, targetId: any, parent?: null) => any;
|
|
119
120
|
deleteOptions: (key: any) => void;
|
|
120
121
|
onLoadData: (treeNode: any, list: any) => any;
|
|
121
122
|
AModal: {
|
|
@@ -116,6 +116,7 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
|
|
|
116
116
|
findDataByKey: (key: string) => any;
|
|
117
117
|
summitSelect: () => void;
|
|
118
118
|
getOptionName: (key: any) => any;
|
|
119
|
+
findParentNode: (tree: any, targetId: any, parent?: null) => any;
|
|
119
120
|
deleteOptions: (key: any) => void;
|
|
120
121
|
onLoadData: (treeNode: any, list: any) => any;
|
|
121
122
|
AModal: {
|
|
@@ -705,16 +705,35 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
705
705
|
);
|
|
706
706
|
return had?.title ? `${had.title}` : had;
|
|
707
707
|
}
|
|
708
|
+
function findParentNode(tree, targetId, parent = null) {
|
|
709
|
+
for (const node of tree) {
|
|
710
|
+
if (node.id === targetId) {
|
|
711
|
+
return parent;
|
|
712
|
+
}
|
|
713
|
+
if (node.children && Array.isArray(node.children)) {
|
|
714
|
+
const found = findParentNode(node.children, targetId, node);
|
|
715
|
+
if (found !== null) {
|
|
716
|
+
return found;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
return null;
|
|
721
|
+
}
|
|
708
722
|
function deleteOptions(key) {
|
|
709
723
|
if (props.mode === MODE.MULTIPLE) {
|
|
710
724
|
if (selectState.multipleChecked[String(key)]) {
|
|
711
725
|
selectState.multipleChecked[String(key)] = false;
|
|
712
726
|
}
|
|
713
727
|
} else if (props.mode === MODE.DEPARTMENT) {
|
|
714
|
-
|
|
715
|
-
|
|
728
|
+
const keyStr = String(key);
|
|
729
|
+
const parentNode = findParentNode(list.value, key);
|
|
730
|
+
const parentKeyStr = parentNode ? String(parentNode.id) : null;
|
|
731
|
+
selectState.multipDepartment = selectState.multipDepartment.filter(
|
|
732
|
+
(item) => {
|
|
733
|
+
const itemStr = String(item);
|
|
734
|
+
return itemStr !== keyStr && itemStr !== parentKeyStr;
|
|
735
|
+
}
|
|
716
736
|
);
|
|
717
|
-
index > -1 && selectState.multipDepartment.splice(index, 1);
|
|
718
737
|
}
|
|
719
738
|
}
|
|
720
739
|
function onLoadData(treeNode, list2) {
|
|
@@ -116,6 +116,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
116
116
|
findDataByKey: (key: string) => any;
|
|
117
117
|
summitSelect: () => void;
|
|
118
118
|
getOptionName: (key: any) => any;
|
|
119
|
+
findParentNode: (tree: any, targetId: any, parent?: null) => any;
|
|
119
120
|
deleteOptions: (key: any) => void;
|
|
120
121
|
onLoadData: (treeNode: any, list: any) => any;
|
|
121
122
|
AModal: {
|
package/package.json
CHANGED
|
@@ -116,6 +116,7 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
|
|
|
116
116
|
findDataByKey: (key: string) => any;
|
|
117
117
|
summitSelect: () => void;
|
|
118
118
|
getOptionName: (key: any) => any;
|
|
119
|
+
findParentNode: (tree: any, targetId: any, parent?: null) => any;
|
|
119
120
|
deleteOptions: (key: any) => void;
|
|
120
121
|
onLoadData: (treeNode: any, list: any) => any;
|
|
121
122
|
AModal: {
|
|
@@ -116,6 +116,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
116
116
|
findDataByKey: (key: string) => any;
|
|
117
117
|
summitSelect: () => void;
|
|
118
118
|
getOptionName: (key: any) => any;
|
|
119
|
+
findParentNode: (tree: any, targetId: any, parent?: null) => any;
|
|
119
120
|
deleteOptions: (key: any) => void;
|
|
120
121
|
onLoadData: (treeNode: any, list: any) => any;
|
|
121
122
|
AModal: {
|