@sy-common/organize-select-help 1.0.0-beta.67 → 1.0.0-beta.68
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/package.json +1 -1
- package/src/index.vue +37 -9
package/package.json
CHANGED
package/src/index.vue
CHANGED
|
@@ -183,8 +183,8 @@
|
|
|
183
183
|
<div class="org-new-header">
|
|
184
184
|
<Input v-model="orgNewSearch" @on-enter="searchOrgNew" @on-search="searchOrgNew" search placeholder="搜索组织节点名称(如:办公室)" style="width: 100%;"/>
|
|
185
185
|
<div class="org-new-actions">
|
|
186
|
-
<Button type="
|
|
187
|
-
<Button type="
|
|
186
|
+
<Button type="primary" ghost @click="expandAllOrgNew">展开全部</Button>
|
|
187
|
+
<Button type="primary" ghost @click="collapseAllOrgNew">折叠全部</Button>
|
|
188
188
|
<!-- <Button type="default" @click="clearOrgNew">清空</Button>-->
|
|
189
189
|
</div>
|
|
190
190
|
</div>
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
</div>
|
|
198
198
|
<div class="org-card-actions" v-if="province.children && province.children.length > 0">
|
|
199
199
|
<Button type="text" @click.stop="selectAllProvinceOrgNew(province)">全选(包含下级)</Button>
|
|
200
|
-
<Icon :type="province.expand ? 'md-arrow-dropdown' : 'md-arrow-dropright'" style="margin-left: 8px;"/>
|
|
200
|
+
<Icon size="20" :type="province.expand ? 'md-arrow-dropdown' : 'md-arrow-dropright'" style="margin-left: 8px;"/>
|
|
201
201
|
</div>
|
|
202
202
|
</div>
|
|
203
203
|
<div class="org-card-body" v-if="province.expand && province.children && province.children.length > 0">
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
<div class="city-card-actions" v-if="city.children && city.children.length > 0">
|
|
211
211
|
<Button type="text" @click.stop="selectAllCityOrgNew(city)">全选(包含下级)</Button>
|
|
212
212
|
<!-- <Button type="text" @click.stop="selectAllCityLevelOrgNew(city)">全选市本级</Button>-->
|
|
213
|
-
<Icon :type="city.expand ? 'md-arrow-dropdown' : 'md-arrow-dropright'" style="margin-left: 8px;"/>
|
|
213
|
+
<Icon size="20" :type="city.expand ? 'md-arrow-dropdown' : 'md-arrow-dropright'" style="margin-left: 8px;"/>
|
|
214
214
|
</div>
|
|
215
215
|
</div>
|
|
216
216
|
<div class="city-card-body" v-if="city.expand && city.children && city.children.length > 0">
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
</div>
|
|
224
224
|
<div class="district-actions" v-if="district.children && district.children.length > 0">
|
|
225
225
|
<Button type="text" @click.stop="selectAllDistrictOrgNew(district)">全选</Button>
|
|
226
|
-
<Icon :type="district.expand ? 'md-arrow-dropdown' : 'md-arrow-dropright'" style="margin-left: 8px;"/>
|
|
226
|
+
<Icon size="20" :type="district.expand ? 'md-arrow-dropdown' : 'md-arrow-dropright'" style="margin-left: 8px;"/>
|
|
227
227
|
</div>
|
|
228
228
|
</div>
|
|
229
229
|
<div class="district-body" v-if="district.expand && district.children && district.children.length > 0">
|
|
@@ -2033,20 +2033,44 @@ export default {
|
|
|
2033
2033
|
// 只有有子节点时才允许展开/折叠
|
|
2034
2034
|
if (province.children && province.children.length > 0) {
|
|
2035
2035
|
province.expand = !province.expand;
|
|
2036
|
+
// 同步更新原始数据中的节点状态
|
|
2037
|
+
this.updateOriginalNodeExpand(province);
|
|
2036
2038
|
}
|
|
2037
2039
|
},
|
|
2038
2040
|
toggleCityExpand(city) {
|
|
2039
2041
|
// 只有有子节点时才允许展开/折叠
|
|
2040
2042
|
if (city.children && city.children.length > 0) {
|
|
2041
2043
|
city.expand = !city.expand;
|
|
2044
|
+
// 同步更新原始数据中的节点状态
|
|
2045
|
+
this.updateOriginalNodeExpand(city);
|
|
2042
2046
|
}
|
|
2043
2047
|
},
|
|
2044
2048
|
toggleDistrictExpand(district) {
|
|
2045
2049
|
// 只有有子节点时才允许展开/折叠
|
|
2046
2050
|
if (district.children && district.children.length > 0) {
|
|
2047
2051
|
district.expand = !district.expand;
|
|
2052
|
+
// 同步更新原始数据中的节点状态
|
|
2053
|
+
this.updateOriginalNodeExpand(district);
|
|
2048
2054
|
}
|
|
2049
2055
|
},
|
|
2056
|
+
updateOriginalNodeExpand(node) {
|
|
2057
|
+
// 查找并更新原始数据中的节点状态
|
|
2058
|
+
const findAndUpdate = (nodes) => {
|
|
2059
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
2060
|
+
if (nodes[i].orgUnitId === node.orgUnitId) {
|
|
2061
|
+
nodes[i].expand = node.expand;
|
|
2062
|
+
return true;
|
|
2063
|
+
}
|
|
2064
|
+
if (nodes[i].children && nodes[i].children.length > 0) {
|
|
2065
|
+
if (findAndUpdate(nodes[i].children)) {
|
|
2066
|
+
return true;
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
return false;
|
|
2071
|
+
};
|
|
2072
|
+
findAndUpdate(this.orgNewTree);
|
|
2073
|
+
},
|
|
2050
2074
|
selectAllProvinceOrgNew(province) {
|
|
2051
2075
|
// 全选并添加到已选择条件框,包含下级节点
|
|
2052
2076
|
this.addOrgNewItemWithChildren(province, true);
|
|
@@ -2238,9 +2262,9 @@ export default {
|
|
|
2238
2262
|
|
|
2239
2263
|
// 如果当前节点匹配或有匹配的子节点,则保留该节点
|
|
2240
2264
|
if (isMatch || filteredChildren.length > 0) {
|
|
2265
|
+
// 创建一个新对象,保留原始节点的所有属性,包括expand状态
|
|
2241
2266
|
return {
|
|
2242
2267
|
...node,
|
|
2243
|
-
expand: true, // 自动展开匹配的节点
|
|
2244
2268
|
children: filteredChildren
|
|
2245
2269
|
};
|
|
2246
2270
|
}
|
|
@@ -2250,6 +2274,7 @@ export default {
|
|
|
2250
2274
|
}).filter(Boolean); // 过滤掉null值
|
|
2251
2275
|
};
|
|
2252
2276
|
|
|
2277
|
+
// 直接使用原始树数据,不需要深拷贝
|
|
2253
2278
|
return filterTree(this.orgNewTree);
|
|
2254
2279
|
}
|
|
2255
2280
|
},
|
|
@@ -2710,7 +2735,6 @@ export default {
|
|
|
2710
2735
|
align-items: center;
|
|
2711
2736
|
padding: 12px 16px;
|
|
2712
2737
|
background-color: #f9fafb;
|
|
2713
|
-
cursor: pointer;
|
|
2714
2738
|
border-bottom: 1px solid #EAECF0;
|
|
2715
2739
|
|
|
2716
2740
|
&:hover {
|
|
@@ -2721,6 +2745,7 @@ export default {
|
|
|
2721
2745
|
display: flex;
|
|
2722
2746
|
align-items: center;
|
|
2723
2747
|
font-weight: 500;
|
|
2748
|
+
cursor: pointer;
|
|
2724
2749
|
}
|
|
2725
2750
|
|
|
2726
2751
|
.org-card-actions {
|
|
@@ -2732,6 +2757,7 @@ export default {
|
|
|
2732
2757
|
color: #1890ff;
|
|
2733
2758
|
font-weight: 500;
|
|
2734
2759
|
transition: all 0.2s;
|
|
2760
|
+
cursor: pointer;
|
|
2735
2761
|
|
|
2736
2762
|
&:hover {
|
|
2737
2763
|
color: #40a9ff;
|
|
@@ -2764,7 +2790,6 @@ export default {
|
|
|
2764
2790
|
align-items: center;
|
|
2765
2791
|
padding: 10px 14px;
|
|
2766
2792
|
background-color: #f9fafb;
|
|
2767
|
-
cursor: pointer;
|
|
2768
2793
|
border-bottom: 1px solid #EAECF0;
|
|
2769
2794
|
|
|
2770
2795
|
&:hover {
|
|
@@ -2775,6 +2800,7 @@ export default {
|
|
|
2775
2800
|
display: flex;
|
|
2776
2801
|
align-items: center;
|
|
2777
2802
|
font-weight: 500;
|
|
2803
|
+
cursor: pointer;
|
|
2778
2804
|
}
|
|
2779
2805
|
|
|
2780
2806
|
.city-card-actions {
|
|
@@ -2786,6 +2812,7 @@ export default {
|
|
|
2786
2812
|
color: #1890ff;
|
|
2787
2813
|
font-weight: 500;
|
|
2788
2814
|
transition: all 0.2s;
|
|
2815
|
+
cursor: pointer;
|
|
2789
2816
|
|
|
2790
2817
|
&:hover {
|
|
2791
2818
|
color: #40a9ff;
|
|
@@ -2823,7 +2850,6 @@ export default {
|
|
|
2823
2850
|
align-items: center;
|
|
2824
2851
|
padding: 8px 12px;
|
|
2825
2852
|
background-color: #f9fafb;
|
|
2826
|
-
cursor: pointer;
|
|
2827
2853
|
border-bottom: 1px solid #EAECF0;
|
|
2828
2854
|
|
|
2829
2855
|
&:hover {
|
|
@@ -2834,6 +2860,7 @@ export default {
|
|
|
2834
2860
|
display: flex;
|
|
2835
2861
|
align-items: center;
|
|
2836
2862
|
font-weight: 500;
|
|
2863
|
+
cursor: pointer;
|
|
2837
2864
|
}
|
|
2838
2865
|
|
|
2839
2866
|
.district-actions {
|
|
@@ -2845,6 +2872,7 @@ export default {
|
|
|
2845
2872
|
color: #1890ff;
|
|
2846
2873
|
font-weight: 500;
|
|
2847
2874
|
transition: all 0.2s;
|
|
2875
|
+
cursor: pointer;
|
|
2848
2876
|
|
|
2849
2877
|
&:hover {
|
|
2850
2878
|
color: #40a9ff;
|