@sy-common/organize-select-help 1.0.0-beta.42 → 1.0.0-beta.46
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 +72 -41
package/package.json
CHANGED
package/src/index.vue
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Modal
|
|
3
|
+
v-if="isNameValid"
|
|
3
4
|
title=""
|
|
4
5
|
v-model="modal"
|
|
5
6
|
@on-ok="confirm"
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
<div slot="header" class="header-text"><Icon type="md-information" class="icon-tip" />人员选择</div>
|
|
12
13
|
<div class="content-container">
|
|
13
14
|
<div class="tree-orig">
|
|
14
|
-
<div class="tab-content"
|
|
15
|
+
<div class="tab-content-pro">`
|
|
15
16
|
<Tabs v-if="computedTabName" v-model="activeTabName" @input="handleTabChange" >
|
|
16
17
|
<TabPane label="组织选择" name="org" v-if="name.includes('org')">
|
|
17
18
|
<div class="tab">
|
|
@@ -297,30 +298,32 @@ export default {
|
|
|
297
298
|
}
|
|
298
299
|
},
|
|
299
300
|
created() {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
301
|
+
if (this.isNameValid) {
|
|
302
|
+
console.log("this.name", this.name);
|
|
303
|
+
this.activeTabName = this.computedTabName;
|
|
304
|
+
console.log("this.activeTabName", this.activeTabName);
|
|
305
|
+
this.$nextTick(() => {
|
|
306
|
+
this.$forceUpdate();
|
|
307
|
+
});
|
|
308
|
+
}
|
|
307
309
|
},
|
|
308
310
|
mounted() {
|
|
309
|
-
|
|
310
|
-
this.
|
|
311
|
-
|
|
311
|
+
// 优化:仅当name有效时才执行初始化逻辑
|
|
312
|
+
if (this.isNameValid) {
|
|
313
|
+
this.queryTagList()
|
|
314
|
+
this.queryPositionList()
|
|
315
|
+
this.initStaffOrgTree()
|
|
312
316
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
console.log("最终激活的 Tab:", this.activeTabName);
|
|
317
|
+
this.$nextTick(() => {
|
|
318
|
+
this.activeTabName = this.computedTabName;
|
|
319
|
+
if (this.activeTabName === 'org' || this.activeTabName === 'post' || this.activeTabName === 'staff') {
|
|
320
|
+
this.handleTabChange(this.activeTabName);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
console.log("传入的 name 数组:", this.name);
|
|
324
|
+
console.log("是否包含 staff:", this.name.includes('staff'));
|
|
325
|
+
console.log("最终激活的 Tab:", this.activeTabName);
|
|
326
|
+
}
|
|
324
327
|
},
|
|
325
328
|
methods:{
|
|
326
329
|
async initStaffOrgTree() {
|
|
@@ -954,22 +957,26 @@ export default {
|
|
|
954
957
|
this.staffList.splice(index,1)
|
|
955
958
|
},
|
|
956
959
|
confirm(){
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
960
|
+
if (this.isNameValid) {
|
|
961
|
+
const v = {
|
|
962
|
+
orgList:this.orgList,
|
|
963
|
+
postList:this.postList,
|
|
964
|
+
staffList:this.staffList
|
|
965
|
+
}
|
|
966
|
+
this.$emit('confirm',deepCopy(v))
|
|
961
967
|
}
|
|
962
|
-
this.$emit('confirm',deepCopy(v))
|
|
963
968
|
},
|
|
964
969
|
visibleChange(val) {
|
|
965
|
-
this
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
970
|
+
if (this.isNameValid) {
|
|
971
|
+
this.$emit('input', val);
|
|
972
|
+
if (val) {
|
|
973
|
+
this.initStaffList()
|
|
974
|
+
} else {
|
|
975
|
+
this.staffEnding = false;
|
|
976
|
+
this.offset = 0;
|
|
977
|
+
this.staffAllList = [];
|
|
978
|
+
this.$set(this, 'selectedStaffOrgId', '');
|
|
979
|
+
}
|
|
973
980
|
}
|
|
974
981
|
},
|
|
975
982
|
initStaffList() {
|
|
@@ -1527,8 +1534,13 @@ export default {
|
|
|
1527
1534
|
|
|
1528
1535
|
},
|
|
1529
1536
|
computed:{
|
|
1537
|
+
isNameValid() {
|
|
1538
|
+
return Array.isArray(this.name) && this.name.length > 0;
|
|
1539
|
+
},
|
|
1530
1540
|
computedTabName() {
|
|
1531
|
-
|
|
1541
|
+
// 优化:基于isNameValid做边界判断
|
|
1542
|
+
if (!this.isNameValid) return '';
|
|
1543
|
+
const validTabNames = this.name.filter(name => ['org', 'post', 'staff'].includes(name));
|
|
1532
1544
|
return validTabNames.length > 0 ? validTabNames[0] : '';
|
|
1533
1545
|
},
|
|
1534
1546
|
getCheckedStaff(){
|
|
@@ -1543,10 +1555,10 @@ export default {
|
|
|
1543
1555
|
},
|
|
1544
1556
|
watch:{
|
|
1545
1557
|
computedTabName(newVal) {
|
|
1546
|
-
|
|
1558
|
+
// 优化:增加name有效性判断
|
|
1559
|
+
if (this.isNameValid && newVal && this.name.includes(newVal)) {
|
|
1547
1560
|
this.activeTabName = newVal;
|
|
1548
1561
|
this.$nextTick(() => {
|
|
1549
|
-
// 确保 Tab 组件已渲染后再强制更新
|
|
1550
1562
|
if (this.$refs.tabs) {
|
|
1551
1563
|
this.$refs.tabs.$forceUpdate();
|
|
1552
1564
|
}
|
|
@@ -1556,12 +1568,31 @@ export default {
|
|
|
1556
1568
|
});
|
|
1557
1569
|
}
|
|
1558
1570
|
},
|
|
1571
|
+
name: {
|
|
1572
|
+
handler(newVal) {
|
|
1573
|
+
if (this.isNameValid) {
|
|
1574
|
+
this.activeTabName = this.computedTabName;
|
|
1575
|
+
this.$nextTick(() => {
|
|
1576
|
+
this.$forceUpdate();
|
|
1577
|
+
if (newVal === 'org' || newVal === 'post' || newVal === 'staff') {
|
|
1578
|
+
this.handleTabChange(newVal);
|
|
1579
|
+
}
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
},
|
|
1583
|
+
deep: true,
|
|
1584
|
+
immediate: true
|
|
1585
|
+
},
|
|
1559
1586
|
value(val){
|
|
1560
|
-
this.
|
|
1587
|
+
if (this.isNameValid) {
|
|
1588
|
+
this.modal = val
|
|
1589
|
+
}
|
|
1561
1590
|
},
|
|
1562
1591
|
data:{
|
|
1563
1592
|
handler(val){
|
|
1564
|
-
|
|
1593
|
+
// 优化:增加边界判断
|
|
1594
|
+
if(!this.isNameValid || !val) return
|
|
1595
|
+
// 原有逻辑保持不变
|
|
1565
1596
|
let map = deepCopy(val)
|
|
1566
1597
|
let orgList = map.orgList || []
|
|
1567
1598
|
orgList.forEach(item=>{
|
|
@@ -1874,7 +1905,7 @@ export default {
|
|
|
1874
1905
|
flex:1;
|
|
1875
1906
|
text-align: center;
|
|
1876
1907
|
}
|
|
1877
|
-
.tab-content{
|
|
1908
|
+
.tab-content-pro{
|
|
1878
1909
|
width: 720px;
|
|
1879
1910
|
border-radius: 8px;
|
|
1880
1911
|
border: 1px solid #EAECF0;
|