@sy-common/organize-select-help 1.0.0-beta.53 → 1.0.0-beta.54
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 +55 -22
package/package.json
CHANGED
package/src/index.vue
CHANGED
|
@@ -701,11 +701,10 @@ export default {
|
|
|
701
701
|
}
|
|
702
702
|
},
|
|
703
703
|
async loadMore(){
|
|
704
|
-
|
|
705
|
-
if (this.loadingStaff || this.staffEnding || (nowTime - this.lastLoadingTime < 1000)) return
|
|
704
|
+
if (this.loadingStaff || this.staffEnding) return
|
|
706
705
|
this.loadingStaff = true
|
|
707
706
|
try {
|
|
708
|
-
console.log("
|
|
707
|
+
console.log("--触底加载/强制加载---", new Date().getTime()); // 调试日志,确认方法执行
|
|
709
708
|
let res = await this.queryAllStaffList()
|
|
710
709
|
let list = res.rows;
|
|
711
710
|
list.map((item)=>item.checked=false)
|
|
@@ -944,27 +943,57 @@ export default {
|
|
|
944
943
|
},
|
|
945
944
|
visibleChange(val) {
|
|
946
945
|
this.$emit('input', val);
|
|
947
|
-
// val 为 true 时表示帮助框打开,此时发起请求
|
|
948
946
|
if (val) {
|
|
949
|
-
this.
|
|
947
|
+
this.resetStaffTreeChecked();
|
|
948
|
+
this.staffEnding = false;
|
|
949
|
+
this.offset = 0;
|
|
950
|
+
this.staffAllList = [];
|
|
951
|
+
this.loadingStaff = false;
|
|
952
|
+
if (this.tabName === 'staff') {
|
|
953
|
+
this.loadMore().catch(err => console.log("弹窗打开加载失败:", err));
|
|
954
|
+
this.$nextTick(() => {
|
|
955
|
+
setTimeout(() => {
|
|
956
|
+
this.loadMore();
|
|
957
|
+
}, 100);
|
|
958
|
+
});
|
|
959
|
+
}
|
|
950
960
|
} else {
|
|
951
|
-
// 可选:关闭帮助框时重置人员列表相关状态,避免下次打开残留旧数据
|
|
952
961
|
this.staffEnding = false;
|
|
953
962
|
this.offset = 0;
|
|
954
963
|
this.staffAllList = [];
|
|
955
|
-
// 关闭时重置选中状态
|
|
956
964
|
this.$set(this, 'selectedStaffOrgId', '');
|
|
965
|
+
if (this.$refs.staffTree) {
|
|
966
|
+
this.$refs.staffTree.clearAllChecked(this.$refs.staffTree.data);
|
|
967
|
+
this.$refs.staffTree.$emit('handleChange', []);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
resetStaffTreeChecked() {
|
|
972
|
+
this.$set(this, 'selectedStaffOrgId', '');
|
|
973
|
+
this.proStaffOrgList = [];
|
|
974
|
+
if (this.$refs.staffTree) {
|
|
975
|
+
this.$refs.staffTree.clearAllChecked(this.$refs.staffTree.data);
|
|
976
|
+
this.$refs.staffTree.$emit('handleChange', []);
|
|
977
|
+
if (this.$refs.staffTree.initData) {
|
|
978
|
+
this.$refs.staffTree.initData();
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
if (this.tabName === 'staff') {
|
|
982
|
+
this.$nextTick(() => {
|
|
983
|
+
this.loadMore();
|
|
984
|
+
});
|
|
957
985
|
}
|
|
958
986
|
},
|
|
959
987
|
initStaffList() {
|
|
960
988
|
this.staffEnding = false;
|
|
961
989
|
this.offset = 0;
|
|
962
990
|
this.staffAllList = [];
|
|
963
|
-
//
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
991
|
+
// 小幅延迟,确保树重置完成后再发起查询(避免时序差)
|
|
992
|
+
this.$nextTick(() => {
|
|
993
|
+
setTimeout(() => {
|
|
994
|
+
this.loadMore();
|
|
995
|
+
}, 50); // 50ms足够,可根据实际情况调整
|
|
996
|
+
});
|
|
968
997
|
},
|
|
969
998
|
// 处理Tab切换,同步更新tabName
|
|
970
999
|
handleTabChange(tabName) {
|
|
@@ -972,16 +1001,20 @@ export default {
|
|
|
972
1001
|
|
|
973
1002
|
// 仅修改人员Tab相关逻辑,不影响其他Tab
|
|
974
1003
|
if (tabName === 'staff') {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
this.
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
//
|
|
984
|
-
this.$nextTick(() =>
|
|
1004
|
+
this.resetStaffTreeChecked();
|
|
1005
|
+
// 第一步:同步重置查询参数(确保参数干净)
|
|
1006
|
+
this.staffEnding = false;
|
|
1007
|
+
this.offset = 0;
|
|
1008
|
+
this.staffAllList = [];
|
|
1009
|
+
this.loadingStaff = false; // 强制解除加载中状态
|
|
1010
|
+
// 第二步:立即同步调用(优先执行)
|
|
1011
|
+
this.loadMore().catch(err => console.log("同步加载失败:", err));
|
|
1012
|
+
// 第三步:异步兜底调用(防止同步调用被阻塞)
|
|
1013
|
+
this.$nextTick(() => {
|
|
1014
|
+
setTimeout(() => {
|
|
1015
|
+
this.loadMore();
|
|
1016
|
+
}, 100);
|
|
1017
|
+
});
|
|
985
1018
|
} else if (tabName === 'post' && this.$refs.postTree && this.proPostList.length === 0) {
|
|
986
1019
|
// 保留原有岗位Tab逻辑,不修改
|
|
987
1020
|
this.proPostList = [];
|