@sy-common/organize-select-help 1.0.0-beta.43 → 1.0.0-beta.49
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 +60 -125
package/package.json
CHANGED
package/src/index.vue
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Modal
|
|
3
|
-
v-if="isNameValid"
|
|
4
3
|
title=""
|
|
5
4
|
v-model="modal"
|
|
6
5
|
@on-ok="confirm"
|
|
@@ -12,8 +11,8 @@
|
|
|
12
11
|
<div slot="header" class="header-text"><Icon type="md-information" class="icon-tip" />人员选择</div>
|
|
13
12
|
<div class="content-container">
|
|
14
13
|
<div class="tree-orig">
|
|
15
|
-
<div class="tab-content">
|
|
16
|
-
<Tabs
|
|
14
|
+
<div class="tab-content-pro">
|
|
15
|
+
<Tabs :value="tabName" @input="handleTabChange">
|
|
17
16
|
<TabPane label="组织选择" name="org" v-if="name.includes('org')">
|
|
18
17
|
<div class="tab">
|
|
19
18
|
<span>组织搜索:</span>
|
|
@@ -89,21 +88,21 @@
|
|
|
89
88
|
clearable
|
|
90
89
|
@on-change="handlePostTagSelect"
|
|
91
90
|
@on-clear="handlePostTagClear"
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
style="width: 365px;"
|
|
92
|
+
:disabled="!postTagList.length"
|
|
94
93
|
>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
94
|
+
<Option
|
|
95
|
+
v-for="item in postTagList"
|
|
96
|
+
:value="item.quickPickKey"
|
|
97
|
+
:key="item.quickPickKey"
|
|
98
|
+
:class="{ 'active-option': item.checked }"
|
|
99
|
+
>
|
|
100
|
+
{{ item.quickPickName }}
|
|
101
|
+
</Option>
|
|
102
|
+
<!-- 无数据提示 -->
|
|
103
|
+
<Option value="" v-if="!postTagList.length" disabled>
|
|
104
|
+
暂无快捷标签
|
|
105
|
+
</Option>
|
|
107
106
|
</Select>
|
|
108
107
|
</div>
|
|
109
108
|
</div>
|
|
@@ -157,7 +156,7 @@
|
|
|
157
156
|
<p>{{item.name}}</p>
|
|
158
157
|
<p>{{item.orgNodeName || item.orgUnitName}}</p>
|
|
159
158
|
</div>
|
|
160
|
-
<!-- <div class="checked-icon" v-show="item.checked">✔</div>-->
|
|
159
|
+
<!-- <div class="checked-icon" v-show="item.checked">✔</div>-->
|
|
161
160
|
</div>
|
|
162
161
|
<p v-if="staffEnding" style="color:#CCCCCC;text-align: center">---我也是有底线的---</p>
|
|
163
162
|
</div>
|
|
@@ -253,8 +252,7 @@ export default {
|
|
|
253
252
|
},
|
|
254
253
|
data(){
|
|
255
254
|
return {
|
|
256
|
-
|
|
257
|
-
tabName: '',
|
|
255
|
+
tabName:this.name[0],
|
|
258
256
|
modal:false,
|
|
259
257
|
dialogOpen:false,
|
|
260
258
|
orgSearch:'',
|
|
@@ -297,33 +295,11 @@ export default {
|
|
|
297
295
|
proStaffOrgList: [] // 新增:暂存选中的组织节点
|
|
298
296
|
}
|
|
299
297
|
},
|
|
300
|
-
created() {
|
|
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
|
-
}
|
|
309
|
-
},
|
|
310
298
|
mounted() {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
this.initStaffOrgTree()
|
|
316
|
-
|
|
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
|
-
}
|
|
299
|
+
this.queryTagList()
|
|
300
|
+
this.queryPositionList()
|
|
301
|
+
// this.loadMore()
|
|
302
|
+
this.initStaffOrgTree()
|
|
327
303
|
},
|
|
328
304
|
methods:{
|
|
329
305
|
async initStaffOrgTree() {
|
|
@@ -957,26 +933,25 @@ export default {
|
|
|
957
933
|
this.staffList.splice(index,1)
|
|
958
934
|
},
|
|
959
935
|
confirm(){
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
staffList:this.staffList
|
|
965
|
-
}
|
|
966
|
-
this.$emit('confirm',deepCopy(v))
|
|
936
|
+
const v = {
|
|
937
|
+
orgList:this.orgList,
|
|
938
|
+
postList:this.postList,
|
|
939
|
+
staffList:this.staffList
|
|
967
940
|
}
|
|
941
|
+
this.$emit('confirm',deepCopy(v))
|
|
968
942
|
},
|
|
969
943
|
visibleChange(val) {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
944
|
+
this.$emit('input', val);
|
|
945
|
+
// val 为 true 时表示帮助框打开,此时发起请求
|
|
946
|
+
if (val) {
|
|
947
|
+
this.initStaffList() // 新增初始化方法,统一处理打开后的请求逻辑
|
|
948
|
+
} else {
|
|
949
|
+
// 可选:关闭帮助框时重置人员列表相关状态,避免下次打开残留旧数据
|
|
950
|
+
this.staffEnding = false;
|
|
951
|
+
this.offset = 0;
|
|
952
|
+
this.staffAllList = [];
|
|
953
|
+
// 关闭时重置选中状态
|
|
954
|
+
this.$set(this, 'selectedStaffOrgId', '');
|
|
980
955
|
}
|
|
981
956
|
},
|
|
982
957
|
initStaffList() {
|
|
@@ -991,23 +966,25 @@ export default {
|
|
|
991
966
|
},
|
|
992
967
|
// 处理Tab切换,同步更新tabName
|
|
993
968
|
handleTabChange(tabName) {
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
this.$nextTick(() => this.searchStaff());
|
|
1006
|
-
} else if (tabName === 'post' && this.$refs.postTree && this.proPostList.length === 0) {
|
|
1007
|
-
this.proPostList = [];
|
|
1008
|
-
this.$refs.postTree.initData();
|
|
969
|
+
this.tabName = tabName;
|
|
970
|
+
|
|
971
|
+
// 仅修改人员Tab相关逻辑,不影响其他Tab
|
|
972
|
+
if (tabName === 'staff') {
|
|
973
|
+
// 重置人员选择相关状态
|
|
974
|
+
this.$set(this, 'selectedStaffOrgId', '');
|
|
975
|
+
this.proStaffOrgList = [];
|
|
976
|
+
// 清空树组件选中状态
|
|
977
|
+
if (this.$refs.staffTree) {
|
|
978
|
+
this.$refs.staffTree.clearAllChecked(this.$refs.staffTree.data);
|
|
979
|
+
this.$refs.staffTree.$emit('handleChange', []);
|
|
1009
980
|
}
|
|
1010
|
-
|
|
981
|
+
// 切换到人员tab时,立即触发一次搜索,确保orgUnitId参数正确
|
|
982
|
+
this.$nextTick(() => this.searchStaff());
|
|
983
|
+
} else if (tabName === 'post' && this.$refs.postTree && this.proPostList.length === 0) {
|
|
984
|
+
// 保留原有岗位Tab逻辑,不修改
|
|
985
|
+
this.proPostList = [];
|
|
986
|
+
this.$refs.postTree.initData();
|
|
987
|
+
}
|
|
1011
988
|
},
|
|
1012
989
|
async fastChedkOrg(item) {
|
|
1013
990
|
// 1. 改用组织 Tab 专属标签列表判断
|
|
@@ -1507,7 +1484,7 @@ export default {
|
|
|
1507
1484
|
|
|
1508
1485
|
|
|
1509
1486
|
/**
|
|
1510
|
-
*
|
|
1487
|
+
* 手动更新树节点状态(如果树组件没有提供update方法)
|
|
1511
1488
|
* @param {Array} nodeList - 节点列表
|
|
1512
1489
|
* @param {Set} expandIds - 需要展开的节点ID集合
|
|
1513
1490
|
* @param {Set} checkedIds - 需要选中的节点ID集合
|
|
@@ -1534,15 +1511,6 @@ export default {
|
|
|
1534
1511
|
|
|
1535
1512
|
},
|
|
1536
1513
|
computed:{
|
|
1537
|
-
isNameValid() {
|
|
1538
|
-
return Array.isArray(this.name) && this.name.length > 0;
|
|
1539
|
-
},
|
|
1540
|
-
computedTabName() {
|
|
1541
|
-
// 优化:基于isNameValid做边界判断
|
|
1542
|
-
if (!this.isNameValid) return '';
|
|
1543
|
-
const validTabNames = this.name.filter(name => ['org', 'post', 'staff'].includes(name));
|
|
1544
|
-
return validTabNames.length > 0 ? validTabNames[0] : '';
|
|
1545
|
-
},
|
|
1546
1514
|
getCheckedStaff(){
|
|
1547
1515
|
return this.staffAllList.filter((item)=>item.checked===true).length
|
|
1548
1516
|
},
|
|
@@ -1554,45 +1522,12 @@ export default {
|
|
|
1554
1522
|
}
|
|
1555
1523
|
},
|
|
1556
1524
|
watch:{
|
|
1557
|
-
computedTabName(newVal) {
|
|
1558
|
-
// 优化:增加name有效性判断
|
|
1559
|
-
if (this.isNameValid && newVal && this.name.includes(newVal)) {
|
|
1560
|
-
this.activeTabName = newVal;
|
|
1561
|
-
this.$nextTick(() => {
|
|
1562
|
-
if (this.$refs.tabs) {
|
|
1563
|
-
this.$refs.tabs.$forceUpdate();
|
|
1564
|
-
}
|
|
1565
|
-
if (newVal === 'org' || newVal === 'post' || newVal === 'staff') {
|
|
1566
|
-
this.handleTabChange(newVal);
|
|
1567
|
-
}
|
|
1568
|
-
});
|
|
1569
|
-
}
|
|
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
|
-
},
|
|
1586
1525
|
value(val){
|
|
1587
|
-
|
|
1588
|
-
this.modal = val
|
|
1589
|
-
}
|
|
1526
|
+
this.modal = val
|
|
1590
1527
|
},
|
|
1591
1528
|
data:{
|
|
1592
1529
|
handler(val){
|
|
1593
|
-
|
|
1594
|
-
if(!this.isNameValid || !val) return
|
|
1595
|
-
// 原有逻辑保持不变
|
|
1530
|
+
if(!val) return
|
|
1596
1531
|
let map = deepCopy(val)
|
|
1597
1532
|
let orgList = map.orgList || []
|
|
1598
1533
|
orgList.forEach(item=>{
|
|
@@ -1905,7 +1840,7 @@ export default {
|
|
|
1905
1840
|
flex:1;
|
|
1906
1841
|
text-align: center;
|
|
1907
1842
|
}
|
|
1908
|
-
.tab-content{
|
|
1843
|
+
.tab-content-pro{
|
|
1909
1844
|
width: 720px;
|
|
1910
1845
|
border-radius: 8px;
|
|
1911
1846
|
border: 1px solid #EAECF0;
|