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

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 +13 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sy-common/organize-select-help",
3
- "version": "1.0.0-beta.39",
3
+ "version": "1.0.0-beta.42",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
package/src/index.vue CHANGED
@@ -297,6 +297,7 @@ export default {
297
297
  }
298
298
  },
299
299
  created() {
300
+ console.log("this.name", this.name);
300
301
  this.activeTabName = this.computedTabName;
301
302
  console.log("this.activeTabName", this.activeTabName);
302
303
  // 新增:初始化时强制触发一次Tab更新,确保DOM渲染
@@ -317,6 +318,9 @@ export default {
317
318
  this.handleTabChange('staff');
318
319
  }
319
320
  });
321
+ console.log("传入的 name 数组:", this.name);
322
+ console.log("是否包含 staff:", this.name.includes('staff'));
323
+ console.log("最终激活的 Tab:", this.activeTabName);
320
324
  },
321
325
  methods:{
322
326
  async initStaffOrgTree() {
@@ -1524,7 +1528,8 @@ export default {
1524
1528
  },
1525
1529
  computed:{
1526
1530
  computedTabName() {
1527
- return Array.isArray(this.name) && this.name.length > 0 ? this.name[0] : '';
1531
+ const validTabNames = Array.isArray(this.name) ? this.name : [];
1532
+ return validTabNames.length > 0 ? validTabNames[0] : '';
1528
1533
  },
1529
1534
  getCheckedStaff(){
1530
1535
  return this.staffAllList.filter((item)=>item.checked===true).length
@@ -1538,13 +1543,15 @@ export default {
1538
1543
  },
1539
1544
  watch:{
1540
1545
  computedTabName(newVal) {
1541
- if (newVal) {
1546
+ if (newVal && this.name.includes(newVal)) {
1542
1547
  this.activeTabName = newVal;
1543
1548
  this.$nextTick(() => {
1544
- this.$forceUpdate();
1545
- // 如果是staff,主动触发初始化
1546
- if (newVal === 'staff') {
1547
- this.handleTabChange('staff');
1549
+ // 确保 Tab 组件已渲染后再强制更新
1550
+ if (this.$refs.tabs) {
1551
+ this.$refs.tabs.$forceUpdate();
1552
+ }
1553
+ if (newVal === 'org' || newVal === 'post' || newVal === 'staff') {
1554
+ this.handleTabChange(newVal);
1548
1555
  }
1549
1556
  });
1550
1557
  }