@sy-common/organize-select-help 1.0.0-beta.37 → 1.0.0-beta.39

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.vue +43 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sy-common/organize-select-help",
3
- "version": "1.0.0-beta.37",
3
+ "version": "1.0.0-beta.39",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
package/src/index.vue CHANGED
@@ -297,13 +297,26 @@ export default {
297
297
  }
298
298
  },
299
299
  created() {
300
- this.activeTabName = this.tabName || this.computedTabName;
300
+ this.activeTabName = this.computedTabName;
301
+ console.log("this.activeTabName", this.activeTabName);
302
+ // 新增:初始化时强制触发一次Tab更新,确保DOM渲染
303
+ this.$nextTick(() => {
304
+ this.$forceUpdate();
305
+ });
301
306
  },
302
307
  mounted() {
303
308
  this.queryTagList()
304
309
  this.queryPositionList()
305
- // this.loadMore()
306
310
  this.initStaffOrgTree()
311
+
312
+ // 新增:mounted阶段再次确认activeTabName,确保Tab激活
313
+ this.$nextTick(() => {
314
+ this.activeTabName = this.computedTabName;
315
+ // 如果是staff Tab,主动触发初始化
316
+ if (this.activeTabName === 'staff') {
317
+ this.handleTabChange('staff');
318
+ }
319
+ });
307
320
  },
308
321
  methods:{
309
322
  async initStaffOrgTree() {
@@ -967,20 +980,23 @@ export default {
967
980
  },
968
981
  // 处理Tab切换,同步更新tabName
969
982
  handleTabChange(tabName) {
970
- this.activeTabName = tabName;
971
- this.$nextTick(() => this.$forceUpdate());
972
- if (tabName === 'staff') {
973
- this.$set(this, 'selectedStaffOrgId', '');
974
- this.proStaffOrgList = [];
975
- if (this.$refs.staffTree) {
976
- this.$refs.staffTree.clearAllChecked(this.$refs.staffTree.data);
977
- this.$refs.staffTree.$emit('handleChange', []);
983
+ // 修复:先强制更新activeTabName,再触发nextTick
984
+ this.$set(this, 'activeTabName', tabName);
985
+ this.$nextTick(() => {
986
+ this.$forceUpdate();
987
+ if (tabName === 'staff') {
988
+ this.$set(this, 'selectedStaffOrgId', '');
989
+ this.proStaffOrgList = [];
990
+ if (this.$refs.staffTree) {
991
+ this.$refs.staffTree.clearAllChecked(this.$refs.staffTree.data);
992
+ this.$refs.staffTree.$emit('handleChange', []);
993
+ }
994
+ this.$nextTick(() => this.searchStaff());
995
+ } else if (tabName === 'post' && this.$refs.postTree && this.proPostList.length === 0) {
996
+ this.proPostList = [];
997
+ this.$refs.postTree.initData();
978
998
  }
979
- this.$nextTick(() => this.searchStaff());
980
- } else if (tabName === 'post' && this.$refs.postTree && this.proPostList.length === 0) {
981
- this.proPostList = [];
982
- this.$refs.postTree.initData();
983
- }
999
+ });
984
1000
  },
985
1001
  async fastChedkOrg(item) {
986
1002
  // 1. 改用组织 Tab 专属标签列表判断
@@ -1521,6 +1537,18 @@ export default {
1521
1537
  }
1522
1538
  },
1523
1539
  watch:{
1540
+ computedTabName(newVal) {
1541
+ if (newVal) {
1542
+ this.activeTabName = newVal;
1543
+ this.$nextTick(() => {
1544
+ this.$forceUpdate();
1545
+ // 如果是staff,主动触发初始化
1546
+ if (newVal === 'staff') {
1547
+ this.handleTabChange('staff');
1548
+ }
1549
+ });
1550
+ }
1551
+ },
1524
1552
  value(val){
1525
1553
  this.modal = val
1526
1554
  },