@sy-common/organize-select-help 1.0.0-beta.5 → 1.0.0-beta.52

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/src/index.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Modal
2
+ <Modal
3
3
  title=""
4
4
  v-model="modal"
5
5
  @on-ok="confirm"
@@ -7,132 +7,222 @@
7
7
  width="1180"
8
8
  :mask-closable="false"
9
9
  class="modal-tree"
10
- >
11
- <div slot="header" class="header-text"><Icon type="md-information" class="icon-tip" />人员选择</div>
12
- <div class="content-container">
13
- <div class="tree-orig">
14
- <div class="tab-content">
15
- <Tabs :value="name">
16
- <TabPane label="选择组织节点" name="name1">
17
- <div class="tab">
18
- <Input v-model="orgSearch" placeholder="搜索组织节点"/>
19
- <div class="tag-content">
10
+ >
11
+ <div slot="header" class="header-text"><Icon type="md-information" class="icon-tip" />人员选择</div>
12
+ <div class="content-container">
13
+ <div class="tree-orig">
14
+ <div class="tab-content-pro">
15
+ <Tabs :value="tabName" @input="handleTabChange">
16
+ <TabPane label="组织选择" name="org" v-if="name.includes('org')">
17
+ <div class="tab">
18
+ <span>组织搜索:</span>
19
+ <Select v-model="orgSearch" filterable :remote-method="getOrgListBySearch" @on-change="getOrgOption" :loading="loadingOrg" placeholder="请输入组织名称" style="width: 600px;" clearable>
20
+ <Option v-for="(option, index) in orgSearchList" :value="option.orgUnitId" :key="index">{{option.name}}</Option>
21
+ </Select>
22
+ <div class="tag-content" v-if="isQuickOpen && orgTagList.length > 0">
23
+ <span>快捷选择:</span>
24
+ <div class="custom-select-wrapper">
25
+ <Select
26
+ v-model="selectedOrgTagKey"
27
+ placeholder="请选择快捷标签"
28
+ transfer
29
+ clearable
30
+ @on-change="handleOrgTagSelect"
31
+ @on-clear="handleOrgTagClear"
32
+ style="width: 600px;"
33
+ :disabled="!orgTagList.length"
34
+ >
35
+ <Option
36
+ v-for="item in orgTagList"
37
+ :value="item.quickPickKey"
38
+ :key="item.quickPickKey"
39
+ :class="{ 'active-option': item.checked }"
40
+ >
41
+ {{ item.quickPickName }}
42
+ </Option>
43
+ <!-- 无数据提示 -->
44
+ <Option value="" v-if="!postTagList.length" disabled>
45
+ 暂无快捷标签
46
+ </Option>
47
+ </Select>
48
+ </div>
49
+ </div>
50
+ <div class="tree">
51
+ <organizeTree @handleChange="getOrgList" ref="orgTree" :treeList="orgTree"></organizeTree>
52
+ </div>
53
+ <div class="bottom-select">
54
+ <CheckboxGroup v-model="includeLevelOrg">
55
+ <Checkbox label="01">
56
+ <span>包含下级组织节点</span>
57
+ </Checkbox>
58
+ </CheckboxGroup>
59
+ <Button type="primary" icon="md-add" @click="addOrgList">添加节点</Button>
60
+ </div>
61
+ </div>
62
+ </TabPane>
63
+ <TabPane label="岗位选择" name="post" v-if="name.includes('post')">
64
+ <div class="tab post">
65
+ <div class="left" style="height: 450px; overflow: hidden; position: relative; z-index: 1;">
66
+ <div class="scroll-container">
67
+ <div class="position-item"
68
+ v-for="item in positiontList"
69
+ :class="[selectedPositionId === item.positionId ? 'active' : '']"
70
+ :key="item.positionId"
71
+ @click="getPosionId(item)">
72
+ {{ item.positionName }} <!-- 无需修改模板,仅通过样式实现自动换行 -->
73
+ </div>
74
+ </div>
75
+ </div>
76
+ <div class="right">
77
+ <span>组织搜索:</span>
78
+ <Select v-model="postSearch" filterable :remote-method="getPostListBySearch" @on-change="getPostOption" placeholder="组织选择" :loading="loadingPost" clearable @on-clear="handlePostSearchClear" style="width: 365px;">
79
+ <Option v-for="(option, index) in postSearchList" :value="option.orgUnitId" :key="index">{{option.name}}</Option>
80
+ </Select>
81
+ <div class="tag-content" v-if="isQuickOpen && postTagList.length > 0">
20
82
  <span>快捷选择:</span>
21
- <div class="tag-list">
22
- <span class="tag" v-for="item in tagList" :key="item.key">{{item.v}}</span>
83
+ <div class="custom-select-wrapper">
84
+ <Select
85
+ v-model="selectedPostTagKey"
86
+ placeholder="请选择快捷标签"
87
+ transfer
88
+ clearable
89
+ @on-change="handlePostTagSelect"
90
+ @on-clear="handlePostTagClear"
91
+ style="width: 365px;"
92
+ :disabled="!postTagList.length"
93
+ >
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>
106
+ </Select>
23
107
  </div>
24
108
  </div>
25
109
  <div class="tree">
26
- <organizeTree @handleChange="getOrgList" ref="organizeTree"></organizeTree>
110
+ <organizeTree @handleChange="getPostList" ref="postTree" :treeList="postTree"></organizeTree>
27
111
  </div>
28
112
  <div class="bottom-select">
29
- <CheckboxGroup v-model="includeLevelOrg">
113
+ <CheckboxGroup v-model="includeLevelPost">
30
114
  <Checkbox label="01">
31
115
  <span>包含下级组织节点</span>
32
116
  </Checkbox>
33
117
  </CheckboxGroup>
34
- <Button type="primary" icon="md-add" @click="addOrgList">添加节点</Button>
118
+ <Button type="primary" icon="md-add" @click="addPostList">添加节点</Button>
35
119
  </div>
36
120
  </div>
37
- </TabPane>
38
- <TabPane label="选择组织节点和岗位" name="name2">
39
- <div class="tab post">
40
- <div class="left">
41
- <div v-for="item in positiontList" :class="[item.checked&&'active']" :key="item.positionId" @click="getPosionId(item)">{{ item.positionName }}</div>
42
- </div>
43
- <div class="right">
44
- <Input v-model="orgSearch" placeholder="搜索组织节点"/>
45
- <div class="tag-content">
46
- <span>快捷选择:</span>
47
- <div class="tag-list">
48
- <span class="tag" v-for="item in tagList" :key="item.key">{{item.v}}</span>
49
- </div>
50
- </div>
51
- <div class="tree">
52
- <organizeTree @handleChange="getPostList" ref="postTree"></organizeTree>
53
- </div>
54
- <div class="bottom-select">
55
- <CheckboxGroup v-model="includeLevelPost">
56
- <Checkbox label="01">
57
- <span>包含下级组织节点</span>
58
- </Checkbox>
59
- </CheckboxGroup>
60
- <Button type="primary" icon="md-add" @click="addPostList">添加节点</Button>
121
+ </div>
122
+ </TabPane>
123
+ <TabPane label="选择人员" name="staff" v-if="name.includes('staff')">
124
+ <div class="tab staff-left-right-layout">
125
+ <!-- 左侧:组织选择区域(限制高度) -->
126
+ <div class="staff-left-panel">
127
+ <div class="panel-title">组织选择</div>
128
+ <div class="tree staff-org-tree">
129
+ <div class="tree-scroll-force">
130
+ <organizeTree
131
+ @handleChange="getStaffList"
132
+ ref="staffTree"
133
+ :treeList="staffTree"
134
+ :showCheckbox="true"
135
+ :checkStrictly="true"
136
+ :autoExpandParent="true"
137
+ :isSingleSelect="true"
138
+ ></organizeTree>
61
139
  </div>
62
140
  </div>
63
141
  </div>
64
- </TabPane>
65
- <TabPane label="直接选择人员" name="name3">
66
- <div class="tab">
67
- <Input v-model="staffSearch" @on-blur="queryAllStaffList" placeholder="搜索组织节点"/>
68
- <div class="tree staff-content">
69
- <div :class="['gust-item',item.checked && 'staff-active']" v-for="item in staffAllList" :key="item.id" @click="handlestaff(item)">
70
- <div class="left-panel">{{item.name && item.name.slice(0,1) || ''}}</div>
71
- <div class="right-panel">
72
- <p>{{item.name}}</p>
73
- <p>{{item.orgNodeName}}</p>
142
+
143
+ <div class="staff-right-panel">
144
+ <Input v-model="staffSearch" @on-enter="searchStaff" @on-search="searchStaff" search placeholder="搜索人员"/>
145
+ <div style="position:relative;">
146
+ <div class="tree staff-content" @scroll="handleScroll">
147
+ <div :class="['gust-item',item.checked && 'staff-active']"
148
+ v-for="(item, index) in staffAllList"
149
+ :key="`staff_${index}_${item.id}`"
150
+ @click="handlestaff(item)">
151
+ <Checkbox
152
+ v-model="item.checked"
153
+ class="staff-checkbox"
154
+ @click.stop="() => handlestaff(item)"
155
+ ></Checkbox>
156
+ <div class="left-panel-pro">{{item.name && item.name.slice(0,1) || ''}}</div>
157
+ <div class="right-panel-pro">
158
+ <p>{{item.name}}</p>
159
+ <p>{{item.orgNodeName || item.orgUnitName}}</p>
160
+ </div>
161
+ <!-- <div class="checked-icon" v-show="item.checked">✔</div>-->
74
162
  </div>
75
- <div class="checked-icon" v-show="item.checked">✔</div>
163
+ <p v-if="staffEnding" style="color:#CCCCCC;text-align: center">---我也是有底线的---</p>
76
164
  </div>
165
+ <Spin v-if="loadingStaff" size="large" fix />
77
166
  </div>
78
167
  <div class="bottom-select">
79
168
  <div>当前已选择 <span class="num">{{getCheckedStaff}}</span>人</div>
80
169
  <Button type="primary" icon="md-add" @click="addStaffList">添加人员</Button>
81
170
  </div>
82
171
  </div>
83
- </TabPane>
84
- </Tabs>
85
- </div>
86
- <div class="form-content">
87
- <p>已选择条件 <span class="num">({{getCheckTypenum}})</span></p>
88
- <div class="node-list">
89
- <!-- 组织节点条件:-->
90
- <div>
91
- <div class="group-box flex-r-bt">
92
- <div>组织节点条件:</div>
93
- <div class="clear-btn" @click="clearGroup">清除全部</div>
94
- </div>
95
- <div class="group-list-content">
96
- <p class="list-item flex-r-bt" v-for="(item,index) in orgList" :ket="index">
97
- <span>{{ item.title }}</span>
98
- <img class="clear-icon" src="./assets/delete.png" alt="" @click="clearOrgByIndex(index)">
99
- </p>
100
- <p style="color:#CCCCCC" class="list-item" v-if="!orgList.length">未选择组织节点</p>
101
- </div>
102
172
  </div>
103
- <!-- 组织节点+岗位条件://-->
104
- <div>
105
- <div class="group-box flex-r-bt">
106
- <div>组织节点+岗位条件:</div>
107
- <div class="clear-btn" @click="clearPost">清除全部</div>
108
- </div>
109
- <div class="group-list-content">
110
- <p class="list-item flex-r-bt" v-for="(item,index) in postList">
111
- <span>{{item.positionName}}-{{item.title}}</span>
112
- <img class="clear-icon" src="./assets/delete.png" alt="" @click="clearPostByIndex(index)">
113
- </p>
114
- <p style="color:#CCCCCC" class="list-item" v-if="!postList.length">未选择组织节点+岗位条件</p>
115
- </div>
173
+ </TabPane>
174
+ </Tabs>
175
+ </div>
176
+ <div class="form-content">
177
+ <p v-if="name.length > 1">已选择条件 <span class="num">({{getCheckTypenum}})</span></p>
178
+ <div class="node-list">
179
+ <!-- 组织节点条件:-->
180
+ <div v-if="name.includes('org')">
181
+ <div class="group-box flex-r-bt">
182
+ <div>组织节点条件:</div>
183
+ <div class="clear-btn" @click="clearGroup">清除全部</div>
116
184
  </div>
117
- <!-- 直接选择人员:-->
118
- <div>
119
- <div class="group-box flex-r-bt">
120
- <div>直接选择人员:</div>
121
- <div class="clear-btn" @click="clearStaff">清除全部</div>
122
- </div>
123
- <div class="group-list-content">
124
- <p class="list-item flex-r-bt" v-for="(item,index) in staffList" :key="item.id">
125
- <span>{{item.name}}</span>
126
- <img class="clear-icon" src="./assets/delete.png" alt="" @click="clearStaffByIndex(index)">
127
- </p>
128
- <p style="color:#CCCCCC" class="list-item" v-if="!staffList.length">未选择直接选择人员</p>
129
- </div>
185
+ <div class="group-list-content">
186
+ <p class="list-item flex-r-bt" v-for="(item,index) in orgList" :ket="index">
187
+ <span>{{ item.title }}</span>
188
+ <img class="clear-icon" src="./assets/delete.png" alt="" @click="clearOrgByIndex(index)">
189
+ </p>
190
+ <p style="color:#CCCCCC" class="list-item" v-if="!orgList.length">未选择组织节点</p>
191
+ </div>
192
+ </div>
193
+ <!-- 组织节点+岗位条件://-->
194
+ <div v-if="name.includes('post')">
195
+ <div class="group-box flex-r-bt">
196
+ <div>岗位条件+组织节点:</div>
197
+ <div class="clear-btn" @click="clearPost">清除全部</div>
198
+ </div>
199
+ <div class="group-list-content">
200
+ <p class="list-item flex-r-bt" v-for="(item,index) in postList">
201
+ <span>{{item.positionName}}-{{item.title}}</span>
202
+ <img class="clear-icon" src="./assets/delete.png" alt="" @click="clearPostByIndex(index)">
203
+ </p>
204
+ <p style="color:#CCCCCC" class="list-item" v-if="!postList.length">未选择岗位条件+组织节点</p>
205
+ </div>
206
+ </div>
207
+ <!-- 直接选择人员:-->
208
+ <div v-if="name.includes('staff')">
209
+ <div class="group-box flex-r-bt">
210
+ <div>直接选择人员:</div>
211
+ <div class="clear-btn" @click="clearStaff">清除全部</div>
212
+ </div>
213
+ <div class="group-list-content">
214
+ <p class="list-item flex-r-bt" v-for="(item,index) in staffList" :key="item.userId">
215
+ <span>{{item.name}}</span>
216
+ <img class="clear-icon" src="./assets/delete.png" alt="" @click="clearStaffByIndex(index)">
217
+ </p>
218
+ <p style="color:#CCCCCC" class="list-item" v-if="!staffList.length">未选择直接选择人员</p>
130
219
  </div>
131
220
  </div>
132
221
  </div>
133
222
  </div>
134
223
  </div>
135
- </Modal>
224
+ </div>
225
+ </Modal>
136
226
  </template>
137
227
  <script>
138
228
  import organizeTree from './organize-tree.vue'
@@ -147,44 +237,209 @@ export default {
147
237
  },
148
238
  data:{
149
239
  type:Object,
150
- default:{}
240
+ default:()=>{}
241
+ },
242
+ name:{
243
+ type:Array ,
244
+ default(){return ['org','post','staff']}
245
+ },
246
+ isQuickOpen:{
247
+ type: Boolean,
248
+ default: false
249
+ },
250
+ defaultOrgUnitId:{
251
+ type: String,
252
+ default: ''
151
253
  }
152
254
  },
153
255
  data(){
154
256
  return {
257
+ tabName:this.name[0],
155
258
  modal:false,
156
- name:'name1',
157
259
  dialogOpen:false,
158
260
  orgSearch:'',
159
261
  //组织--right-form
160
262
  proOrgList:[],
161
263
  includeLevelOrg:[],
162
264
  orgList:[],
265
+ loadingOrg:false,
266
+ orgSearchList:[],
267
+ orgTree:[],
163
268
  //岗位--form
269
+ postSearch:'',
164
270
  proPostList:[],
165
271
  postList:[],
272
+ loadingPost:false,
273
+ postSearchList:[],
166
274
  includeLevelPost:[],
167
275
  positiontList:[],
276
+ postTree:[],
168
277
  //直接人员
169
278
  staffSearch:'',
170
279
  staffAllList:[],
171
280
  staffList:[],
172
- tagList:[{
173
- v:'所选市公司所有部门',
174
- on:false,
175
- key:'07'
176
- },{
177
- v:'所有市公司',
178
- on:false,
179
- key:'08'
180
- }],
281
+ loadingStaff:false,
282
+ lastLoadingTime:0,
283
+ offset:0,
284
+ staffEnding:false,
285
+ parentOrgList: [],
286
+ orgTagList:[],
287
+ postTagList:[],
288
+ selectedPositionId: null, // 新增:岗位单选的选中状态存储
289
+ selectedOrgTagKey: '', // 存储选中标签的唯一标识
290
+ selectedPostTagKey: '', // 存储选中标签的唯一标识
291
+ //人员选择
292
+ staffTree:[],
293
+ staffTagList:[],
294
+ staffOrgList:[],
295
+ staffSearchList:[],
296
+ selectedStaffOrgId: '', // 新增:选中的组织节点ID
297
+ proStaffOrgList: [] // 新增:暂存选中的组织节点
181
298
  }
182
299
  },
183
300
  mounted() {
301
+ this.queryTagList()
184
302
  this.queryPositionList()
185
- this.queryAllStaffList()
303
+ // this.loadMore()
304
+ this.initStaffOrgTree()
186
305
  },
187
306
  methods:{
307
+ async initStaffOrgTree() {
308
+ try {
309
+ // 关键修复:初始化时重置选中状态
310
+ this.$set(this, 'selectedStaffOrgId', '');
311
+ this.proStaffOrgList = [];
312
+
313
+ const rootOrgId = this.defaultOrgUnitId || '';
314
+ let rootNode = null;
315
+
316
+ if (rootOrgId) {
317
+ const leafNode = await this.judgeNodeLeafe(rootOrgId);
318
+ const orgDetail = await this.queryOrgNodeDetail(rootOrgId);
319
+ rootNode = this.safeDeepCopy({
320
+ ...orgDetail,
321
+ orgNodeName: orgDetail.orgNodeName || orgDetail.name,
322
+ leafNode,
323
+ expand: true,
324
+ parentOrgUnitId: orgDetail.parentOrgUnitId || orgDetail.parentId
325
+ });
326
+ } else {
327
+ const res = await ajax.get('/pub-manage-server/pub/personHelpBox/q/getOrgUnitList', {
328
+ params: { containsCurLevel: true }
329
+ });
330
+ if (res.data.code === 1) {
331
+ rootNode = res.data.data[0] || null;
332
+ if (rootNode) {
333
+ rootNode.expand = true;
334
+ rootNode.parentOrgUnitId = rootNode.parentId;
335
+ }
336
+ }
337
+ }
338
+
339
+ if (rootNode) {
340
+ let parentsList = await this.getParentOrgNodesByOrgUnitId(rootNode.orgUnitId);
341
+ const safeParents = this.safeDeepCopy(parentsList);
342
+ safeParents.forEach(node => {
343
+ node.expand = true;
344
+ node.parentOrgUnitId = node.parentId;
345
+ });
346
+ const tree = this.buildTree([...safeParents, rootNode]);
347
+ this.staffTree = this.safeDeepCopy(tree);
348
+ }
349
+ } catch (e) {
350
+ this.$Message.error("人员选择组织树初始化失败!");
351
+ console.error(e);
352
+ }
353
+ },
354
+ handlePostTagSelect(quickPickKey) {
355
+ // 清空暂存列表
356
+ this.proPostList = [];
357
+ // 找到选中的标签对象
358
+ const selectedItem = this.postTagList.find(
359
+ item => item.quickPickKey === quickPickKey
360
+ );
361
+
362
+ if (selectedItem) {
363
+ // 重置其他标签的选中状态
364
+ this.postTagList.forEach(tag => tag.checked = false);
365
+ // 触发原有的处理方法
366
+ this.fastChedkPost(selectedItem);
367
+ // 清空搜索框绑定的值
368
+ this.postSearch = '';
369
+ // 清空搜索结果列表
370
+ this.postSearchList = [];
371
+ }
372
+ },
373
+ handleOrgTagSelect(quickPickKey) {
374
+ // 清空暂存列表
375
+ this.proOrgList = [];
376
+ // 找到选中的标签对象
377
+ const selectedItem = this.orgTagList.find(
378
+ item => item.quickPickKey === quickPickKey
379
+ );
380
+
381
+ if (selectedItem) {
382
+ // 重置其他标签的选中状态
383
+ this.orgTagList.forEach(tag => tag.checked = false);
384
+ // 触发原有的处理方法
385
+ this.fastChedkOrg(selectedItem);
386
+ // 清空搜索框绑定的值
387
+ this.orgSearch = '';
388
+ // 清空搜索结果列表
389
+ this.orgSearchList = [];
390
+ }
391
+ },
392
+ handleOrgTagClear() {
393
+ this.selectedOrgTagKey = '';
394
+ // 重置所有标签的选中状态
395
+ this.orgTagList.forEach(tag => {
396
+ tag.checked = false;
397
+ });
398
+
399
+ // 3. 清空树选择状态和暂存列表
400
+ if (this.$refs.orgTree && this.orgSearchList) {
401
+ this.$refs.orgTree.initData();
402
+ }
403
+ // 4. 可选:添加清空提示
404
+ this.$Message.info("已清空快捷标签选择");
405
+ },
406
+ // 修正清空逻辑方法(与事件名称对应)
407
+ handlePostTagClear() {
408
+ // 1. 重置选中的标签key
409
+ this.selectedPostTagKey = '';
410
+
411
+ // 2. 重置所有标签的选中状态
412
+ this.postTagList.forEach(tag => {
413
+ tag.checked = false;
414
+ });
415
+
416
+ // 3. 清空树选择状态和暂存列表
417
+ if (this.$refs.postTree) {
418
+ this.$refs.postTree.initData();
419
+ this.proPostList = [];
420
+ }
421
+
422
+ // 4. 可选:添加清空提示
423
+ this.$Message.info("已清空快捷标签选择");
424
+ },
425
+ handlePostSearchClear() {
426
+ // 清空搜索框绑定的值
427
+ this.postSearch = '';
428
+
429
+ // 清空搜索结果列表
430
+ this.postSearchList = [];
431
+
432
+ // 重置树组件状态(与原有逻辑保持一致)
433
+ if (this.$refs.postTree) {
434
+ this.$refs.postTree.initData();
435
+ }
436
+
437
+ // 清空暂存列表
438
+ this.proPostList = [];
439
+
440
+ // 可选:添加清空提示
441
+ this.$Message.info("已清空组织选择搜索");
442
+ },
188
443
  queryPositionList(){
189
444
  ajax.get('/pub-manage-server/pub/personHelpBox/q/queryPositionList').then((res)=>{
190
445
  if(res.data.code === 1){
@@ -194,38 +449,408 @@ export default {
194
449
  }
195
450
  })
196
451
  },
197
- queryAllStaffList(){
198
- ajax.get('/pub-manage-server/pub/personHelpBox/q/queryAllStaffList?search='+this.staffSearch).then((res)=>{
199
- if(res.data.code === 1){
200
- let staffAllList = res.data.data && res.data.data.rows || []
201
- staffAllList.map((item)=>item.checked=false)
202
- this.staffAllList = staffAllList
452
+ getOrgListBySearch(query){
453
+ if (query !== '') {
454
+ this.loadingOrg = true;
455
+ this.getOrgUnitBySearchTerm(query,(res)=>{
456
+ this.loadingOrg = false
457
+ if(res.data.code === 1){
458
+ let resp = res.data.data?.items??[]
459
+ this.orgSearchList = resp
460
+ }else{
461
+ this.orgSearchList = []
462
+ this.$Message.error("获取组织节点列表失败!")
463
+ }
464
+ })
465
+ }else{
466
+ this.orgSearchList = [];
467
+ }
468
+ },
469
+ getPostListBySearch(query) {
470
+ if (query !== '') {
471
+ this.loadingPost = true;
472
+ this.getOrgUnitBySearchTerm(query, (res) => {
473
+ this.loadingPost = false;
474
+ if (res.data.code === 1) {
475
+ let resp = res.data.data?.items ?? [];
476
+ // 修复:岗位搜索结果深拷贝,避免引用污染
477
+ this.postSearchList = this.safeDeepCopy(resp);
478
+ } else {
479
+ this.postSearchList = [];
480
+ this.$Message.error("获取组织节点列表失败!");
481
+ }
482
+ });
483
+ } else {
484
+ // 修复:清空搜索时,同时清空树数据和暂存列表(与组织Tab一致)
485
+ this.postSearchList = [];
486
+ if (this.$refs.postTree) {
487
+ this.$refs.postTree.initData();
203
488
  }
204
- })
489
+ this.proPostList = []; // 清空岗位暂存列表
490
+ this.$set(this, 'postTree', []); // 清空岗位树数据
491
+ }
492
+ },
493
+ getOrgUnitBySearchTerm(query,callback){
494
+ ajax.get('/pub-manage-server/pub/personHelpBox/q/getOrgUnitBySearchTerm?searchTerm='+query).then((res)=>{callback(res)})
495
+ },
496
+ async getOrgOption(val) {
497
+ this.selectedOrgTagKey = '';
498
+ this.orgTagList.forEach(tag => {
499
+ tag.checked = false;
500
+ });
501
+ this.proOrgList = [];
502
+ if(!val) return this.$refs.orgTree.initData();
503
+ let item = this.orgSearchList.filter((item)=> item.orgUnitId === val).shift();
504
+ if (!item) return;
505
+
506
+ const leafNode = await this.judgeNodeLeafe(item.orgUnitId);
507
+ const ftem = this.safeDeepCopy({
508
+ ...item,
509
+ orgNodeName: item.name,
510
+ parentOrgUnitId: item.parentId,
511
+ leafNode: leafNode
512
+ });
513
+
514
+ try{
515
+ let parentsList = await this.getParentOrgNodesByOrgUnitId(val);
516
+ // 对父节点列表进行安全拷贝
517
+ const safeParents = this.safeDeepCopy(parentsList);
518
+ let tree = this.buildTree([...safeParents, ftem]);
519
+ this.orgTree = this.safeDeepCopy(tree);
520
+ }catch(e){
521
+ this.$Message.error("获取组织节点列表失败!");
522
+ }
205
523
  },
206
- getOrgList(data){
207
- this.proOrgList = data
524
+ async getPostOption(val) {
525
+ // 1. 重置选中的标签key
526
+ this.selectedPostTagKey = '';
527
+
528
+ // 2. 重置所有标签的选中状态
529
+ this.postTagList.forEach(tag => {
530
+ tag.checked = false;
531
+ });
532
+ if (!val) {
533
+ // 修复:岗位树清空时,同时清空暂存列表和搜索框
534
+ if (this.$refs.postTree) {
535
+ this.$refs.postTree.initData();
536
+ }
537
+ this.proPostList = []; // 清空岗位暂存列表(与组织Tab保持一致)
538
+ this.postSearch = ''; // 清空搜索框
539
+ return;
540
+ }
541
+
542
+ let item = this.postSearchList.filter(item => item.orgUnitId === val).shift();
543
+ if (!item) return;
544
+
545
+ const leafNode = await this.judgeNodeLeafe(item.orgUnitId);
546
+ // 修复:岗位节点深拷贝,避免引用污染
547
+ const ftem = this.safeDeepCopy({
548
+ ...item,
549
+ orgNodeName: item.name || `未命名组织(${item.orgUnitId})`,
550
+ parentOrgUnitId: item.parentId,
551
+ leafNode: leafNode
552
+ });
553
+
554
+ try {
555
+ let parentsList = await this.getParentOrgNodesByOrgUnitId(val);
556
+ const safeParents = this.safeDeepCopy(parentsList);
557
+ let tree = this.buildTree([...safeParents, ftem]);
558
+ // 修复:用$set确保岗位树数据响应式更新
559
+ this.$set(this, 'postTree', this.safeDeepCopy(tree));
560
+
561
+ // 修复:设置节点展开和选中(与组织Tab逻辑一致)
562
+ this.$nextTick(() => {
563
+ if (this.$refs.postTree && this.$refs.postTree.setCheckedNodes) {
564
+ this.$refs.postTree.setCheckedNodes([val]); // 选中当前节点
565
+ this.proPostList = [ftem]; // 同步暂存列表
566
+ }
567
+ });
568
+ } catch (e) {
569
+ this.$Message.error("获取组织节点列表失败!");
570
+ }
208
571
  },
209
- getPostList(data){
210
- this.proPostList = data
572
+ async getStaffOption(val) {
573
+ this.staffOrgList = [];
574
+ if(!val) return this.$refs.staffTree.initData();
575
+ let item = this.staffSearchList.filter((item)=> item.orgUnitId === val).shift();
576
+ if (!item) return;
577
+
578
+ const leafNode = await this.judgeNodeLeafe(item.orgUnitId);
579
+ const ftem = this.safeDeepCopy({
580
+ ...item,
581
+ orgNodeName: item.name,
582
+ parentOrgUnitId: item.parentId,
583
+ leafNode: leafNode
584
+ });
585
+
586
+ try{
587
+ let parentsList = await this.getParentOrgNodesByOrgUnitId(val);
588
+ // 对父节点列表进行安全拷贝
589
+ const safeParents = this.safeDeepCopy(parentsList);
590
+ let tree = this.buildTree([...safeParents, ftem]);
591
+ this.staffTree = this.safeDeepCopy(tree);
592
+ }catch(e){
593
+ this.$Message.error("获取组织节点列表失败!");
594
+ }
211
595
  },
212
- addOrgList(){
213
- if(!this.proOrgList.length) return this.$Message.error("请先选择组织节点!")
214
- let proOrgList = deepCopy(this.proOrgList)
215
- proOrgList.forEach(item=>{
216
- item.title = this.includeLevelOrg.includes('01')?`${item.orgNodeName}(包含下级组织节点)`:item.orgNodeName
217
- item.id = this.includeLevelOrg.includes('01')?('01'+'-' + item.orgUnitId):('00'+'-'+item.orgUnitId)
218
- item.includeLevel = this.includeLevelOrg.includes('01')
596
+ getParentOrgNodesByOrgUnitId(val){
597
+ return new Promise((resolve,reject)=>{
598
+ ajax.get('/pub-manage-server/pub/personHelpBox/q/getParentOrgNodesByOrgUnitId?orgUnitId='+val).then((res)=>{
599
+ if(res.data.code === 1){
600
+ let parentsList = res.data?.data?.items??[]
601
+ resolve(parentsList)
602
+ }else{
603
+ reject(false)
604
+ }
605
+ })
606
+ })
607
+ },
608
+ judgeNodeLeafe(orgUnitId){
609
+ return new Promise((resolve,reject)=>{
610
+ ajax.get('/pub-manage-server/pub/personHelpBox/q/getOrgUnitList', { params:{
611
+ containsCurLevel:true,
612
+ orgUnitId:orgUnitId,
613
+ }
614
+ }).then((res)=>{
615
+ if(res.data.code === 1){
616
+ let treeList = res.data.data
617
+ if(treeList && treeList.length){
618
+ resolve(false)
619
+ }else{
620
+ resolve(true)
621
+ }
622
+ }else{
623
+ resolve(false)
624
+ }
625
+ })
219
626
  })
220
- let list = this.orgList.concat(proOrgList)
627
+ },
628
+ buildTree(items) {
629
+ const map = {};
630
+ const roots = [];
631
+ // 对输入数据进行安全拷贝
632
+ const copiedItems = this.safeDeepCopy(items);
633
+
634
+ copiedItems.forEach(item => {
635
+ if (!item.orgUnitId) return; // 过滤无效节点
636
+ map[item.orgUnitId] = this.safeDeepCopy({
637
+ ...item,
638
+ orgChildrenList: []
639
+ });
640
+ });
641
+
642
+ copiedItems.forEach(item => {
643
+ if (!item.orgUnitId || !map[item.orgUnitId]) return;
644
+
645
+ const node = map[item.orgUnitId];
646
+ if (!item.parentOrgUnitId || !map[item.parentOrgUnitId]) {
647
+ roots.push(node);
648
+ } else {
649
+ const parent = map[item.parentOrgUnitId];
650
+ parent.orgChildrenList.push(node);
651
+ }
652
+ });
653
+ return roots;
654
+ },
655
+
656
+ searchStaff(){
657
+ this.staffEnding = false;
658
+ this.offset = 0;
659
+ this.staffAllList = [];
660
+ // 关键修复:50ms延迟,解决极端情况下的异步更新问题
661
+ setTimeout(() => {
662
+ this.loadMore();
663
+ }, 50);
664
+ },
665
+ queryAllStaffList() {
666
+ const params = {
667
+ search: this.staffSearch,
668
+ offset: this.offset,
669
+ limit: 10
670
+ };
671
+
672
+ // 关键优化:实时监测选中状态,未选中时显式传递空字符串(而非不传递)
673
+ if (this.selectedStaffOrgId && typeof this.selectedStaffOrgId === 'string' && this.selectedStaffOrgId.trim()) {
674
+ params.orgUnitId = this.selectedStaffOrgId.trim();
675
+ } else {
676
+ // 未选中任何节点时,显式设置orgUnitId为空字符串
677
+ params.orgUnitId = '';
678
+ }
679
+
680
+ // 调试日志:查看最终传递的参数
681
+ console.log('人员查询接口参数:', params);
682
+
683
+ return new Promise((resolve, reject) => {
684
+ ajax.get('/pub-manage-server/pub/personHelpBox/q/queryAllStaffList', {
685
+ params: params
686
+ }).then((res) => {
687
+ if (res.data.code === 1) {
688
+ resolve(res.data.data);
689
+ } else {
690
+ reject(false);
691
+ }
692
+ }).catch((err) => {
693
+ reject(err);
694
+ });
695
+ });
696
+ },
697
+ handleScroll(e){
698
+ const { scrollTop, clientHeight, scrollHeight } = e.target;
699
+ if (scrollHeight - (scrollTop + clientHeight) < 50) {
700
+ this.loadMore();
701
+ }
702
+ },
703
+ async loadMore(){
704
+ let nowTime = Date.now()
705
+ if (this.loadingStaff || this.staffEnding || (nowTime - this.lastLoadingTime < 1000)) return
706
+ this.loadingStaff = true
707
+ try {
708
+ console.log("--触底加载---")
709
+ let res = await this.queryAllStaffList()
710
+ let list = res.rows;
711
+ list.map((item)=>item.checked=false)
712
+ this.staffAllList = this.staffAllList.concat(list)
713
+ this.offset += 10;
714
+ this.loadingStaff = false
715
+ this.lastLoadingTime = Date.now()
716
+ if(res.total===this.staffAllList.length){
717
+ this.staffEnding = true
718
+ }
719
+ }catch (e){
720
+ this.loadingStaff = false
721
+ this.lastLoadingTime = Date.now()
722
+ console.log(e)
723
+ }
724
+ },
725
+ getOrgList(data) {
726
+ // 过滤有效节点:仅要求orgUnitId(orgNodeName可选,用默认值兜底)
727
+ const validNodes = Array.isArray(data)
728
+ ? data.filter(node => node.orgUnitId) // 仅校验orgUnitId(必选)
729
+ : [];
730
+
731
+ // 去重:基于orgUnitId避免重复
732
+ const uniqueNodes = validNodes.filter((node, index, self) =>
733
+ self.findIndex(item => item.orgUnitId === node.orgUnitId) === index
734
+ );
735
+
736
+ // 补全缺失字段,避免后续处理报错
737
+ const completeNodes = uniqueNodes.map(node => ({
738
+ ...node,
739
+ orgNodeName: node.orgNodeName || node.name || `未命名组织(${node.orgUnitId})`,
740
+ orgUnitName: node.orgNodeName || node.name || `未命名组织(${node.orgUnitId})`
741
+ }));
742
+
743
+ // 安全深拷贝,确保数据响应式
744
+ this.proOrgList = this.safeDeepCopy(completeNodes);
745
+ },
746
+
747
+ getPostList(data) {
748
+ // 过滤有效节点:仅要求orgUnitId
749
+ const validNodes = Array.isArray(data)
750
+ ? data.filter(node => node.orgUnitId)
751
+ : [];
752
+
753
+ // 去重:基于orgUnitId
754
+ const uniqueNodes = validNodes.filter((node, index, self) =>
755
+ self.findIndex(item => item.orgUnitId === node.orgUnitId) === index
756
+ );
757
+
758
+ // 补全缺失字段
759
+ const completeNodes = uniqueNodes.map(node => ({
760
+ ...node,
761
+ orgNodeName: node.orgNodeName || node.name || `未命名组织(${node.orgUnitId})`,
762
+ orgUnitName: node.orgNodeName || node.name || `未命名组织(${node.orgUnitId})`
763
+ }));
764
+
765
+ // 覆盖暂存列表(而非concat,避免累积无效数据)
766
+ this.proPostList = this.safeDeepCopy(completeNodes);
767
+ },
768
+ getStaffList(data) {
769
+ if (!Array.isArray(data) || data.length === 0) {
770
+ this.proStaffOrgList = [];
771
+ // 强制清空并触发响应式更新
772
+ this.$set(this, 'selectedStaffOrgId', '');
773
+ // 立即触发搜索,确保orgUnitId参数实时更新为空
774
+ this.$nextTick(() => this.searchStaff());
775
+ return;
776
+ }
777
+
778
+ // 关键修复1:过滤仅含有效orgUnitId的节点,排除无效数据
779
+ const validNodes = data.filter(node =>
780
+ node.orgUnitId && typeof node.orgUnitId === 'string' // 确保orgUnitId存在且为字符串
781
+ );
782
+
783
+ if (validNodes.length === 0) {
784
+ this.$Message.warning("所选节点无效,请重新选择");
785
+ this.proStaffOrgList = [];
786
+ this.$set(this, 'selectedStaffOrgId', '');
787
+ // 立即触发搜索,更新参数为空
788
+ this.$nextTick(() => this.searchStaff());
789
+ return;
790
+ }
791
+
792
+ // 关键修复2:单选逻辑强化,仅保留最后一个有效选中节点
793
+ const currentNode = validNodes[validNodes.length - 1];
794
+ const currentOrgUnitId = currentNode.orgUnitId.trim(); // 去除空格,避免无效字符串
795
+
796
+ // 补全节点字段,确保orgUnitId绝对存在
797
+ const pureNode = this.safeDeepCopy({
798
+ ...currentNode,
799
+ orgNodeName: currentNode.orgNodeName || currentNode.name || `未命名组织(${currentOrgUnitId})`,
800
+ orgUnitName: currentNode.orgNodeName || currentNode.name || `未命名组织(${currentOrgUnitId})`
801
+ });
802
+
803
+ // 清除子节点引用,避免循环引用导致的更新延迟
804
+ if (pureNode.orgChildrenList) pureNode.orgChildrenList = [];
805
+ if (pureNode.children) pureNode.children = [];
806
+
807
+ // 关键修复3:强制响应式更新,避免Vue数据延迟
808
+ this.$set(this, 'proStaffOrgList', [pureNode]);
809
+ this.$set(this, 'selectedStaffOrgId', currentOrgUnitId);
810
+
811
+ // 关键修复4:双重nextTick确保数据完全更新后再查询
812
+ this.$nextTick(() => {
813
+ if (this.selectedStaffOrgId !== currentOrgUnitId) {
814
+ this.$set(this, 'selectedStaffOrgId', currentOrgUnitId);
815
+ this.$nextTick(() => this.searchStaff());
816
+ } else {
817
+ this.searchStaff();
818
+ }
819
+ console.log('人员选择-当前选中orgUnitId:', this.selectedStaffOrgId); // 调试日志
820
+ });
821
+ },
822
+
823
+ addOrgList() {
824
+ // 过滤空节点(仅校验orgUnitId)
825
+ const validOrgList = this.proOrgList.filter(node => node.orgUnitId);
826
+ if (!validOrgList.length) return this.$Message.error("请先选择组织节点!");
827
+
828
+ let proOrgList = deepCopy(validOrgList);
829
+ proOrgList.forEach(item => {
830
+ // 用补全后的orgNodeName,避免空显示
831
+ item.title = this.includeLevelOrg.includes('01')
832
+ ? `${item.orgNodeName}(包含下级组织节点)`
833
+ : item.orgNodeName;
834
+ item.id = this.includeLevelOrg.includes('01')
835
+ ? (`01-${item.orgUnitId}`)
836
+ : (`00-${item.orgUnitId}`);
837
+ item.includeLevel = this.includeLevelOrg.includes('01');
838
+ });
839
+
840
+ // 去重合并
841
+ let list = this.orgList.concat(proOrgList);
221
842
  let uniqueArray = list.filter((item, index, self) =>
222
- index === self.findIndex(t => (
223
- t.id === item.id // 基于id属性去重
224
- ))
843
+ index === self.findIndex(t => t.id === item.id)
225
844
  );
226
- this.orgList = uniqueArray
227
- this.$refs.organizeTree.upDataTree()
228
- this.proOrgList = []
845
+ this.orgList = uniqueArray;
846
+
847
+ // 清空选中状态
848
+ if (this.$refs.orgTree && this.$refs.orgTree.clearAllChecked) {
849
+ this.$refs.orgTree.clearAllChecked(this.$refs.orgTree.data);
850
+ this.$refs.orgTree.$emit('handleChange', []);
851
+ }
852
+ this.$refs.orgTree.upDataTree();
853
+ this.proOrgList = [];
229
854
  },
230
855
  clearGroup(){
231
856
  this.orgList = []
@@ -235,36 +860,47 @@ export default {
235
860
  },
236
861
  //岗位
237
862
  getPosionId(item){
238
- item.checked = !item.checked;
239
- },
240
- addPostList(){
241
- if(!this.proPostList.length) return this.$Message.error("请选择组织节点!")
242
- let proPostList = deepCopy(this.proPostList)
243
- let checkedPosition = this.positiontList.filter((item)=>item.checked === true)
244
- if(!checkedPosition.length){return this.$Message.error("请选择岗位!!")}
245
- //summary data
246
- let totalList = []
247
- for(let it of checkedPosition){
248
- proPostList.forEach(item=>{
249
- totalList.push({
250
- ...item,
251
- ...it,
252
- title:`${this.includeLevelPost.length?(item.orgNodeName+'(包含下级组织节点)'):item.orgNodeName}`,
253
- includeLevel:this.includeLevelPost.includes('01'),
254
- id:this.includeLevelPost.includes('01')?('01'+'-'+it.positionId + '-' + item.orgUnitId):('00'+'-'+it.positionId + '-' + item.orgUnitId),
255
- })
256
- })
257
- }
258
- let list = this.postList.concat(totalList)
863
+ // item.checked = !item.checked;
864
+ this.selectedPositionId = item.positionId
865
+ },
866
+ addPostList() {
867
+ // 过滤空节点
868
+ const validPostList = this.proPostList.filter(node => node.orgUnitId);
869
+ if (!validPostList.length) return this.$Message.error("请选择组织节点!");
870
+
871
+ let checkedPosition = this.positiontList.find(item => item.positionId === this.selectedPositionId);
872
+ if (!checkedPosition) { return this.$Message.error("请选择岗位!"); }
873
+
874
+ let totalList = [];
875
+ validPostList.forEach(item => {
876
+ totalList.push({
877
+ ...item,
878
+ ...checkedPosition,
879
+ title: `${this.includeLevelPost.length ? (item.orgNodeName + '(包含下级组织节点)') : item.orgNodeName}`,
880
+ includeLevel: this.includeLevelPost.includes('01'),
881
+ id: this.includeLevelPost.includes('01')
882
+ ? (`01-${checkedPosition.positionId}-${item.orgUnitId}`)
883
+ : (`00-${checkedPosition.positionId}-${item.orgUnitId}`),
884
+ });
885
+ });
886
+
887
+ // 去重合并
888
+ let list = this.postList.concat(totalList);
259
889
  let uniqueArray = list.filter((item, index, self) =>
260
- index === self.findIndex(t => (
261
- t.id === item.id // 基于id属性去重
262
- ))
890
+ index === self.findIndex(t => t.id === item.id)
263
891
  );
264
- this.postList = uniqueArray
265
- this.$refs.postTree.upDataTree()
266
- this.proPostList = []
267
- this.positiontList.map((item)=>{item.checked=false})
892
+ this.postList = uniqueArray;
893
+
894
+ // 清空选中状态
895
+ if (this.$refs.postTree && this.$refs.postTree.clearAllChecked) {
896
+ this.$refs.postTree.clearAllChecked(this.$refs.postTree.data);
897
+ this.$refs.postTree.$emit('handleChange', []);
898
+ }
899
+ this.$refs.postTree.upDataTree();
900
+ this.proPostList = [];
901
+ this.selectedPositionId = null;
902
+ // this.$refs.postTree.initData();
903
+ this.selectedPostTagKey = '';
268
904
  },
269
905
  clearPost(){
270
906
  this.postList= []
@@ -274,15 +910,20 @@ export default {
274
910
  },
275
911
  //staff
276
912
  addStaffList(){
277
- let staffList = this.staffAllList.filter((item)=>item.checked=true)
278
- let list = this.staffList.concat(staffList)
279
- let uniqueArray = list.filter((item, index, self) =>
280
- index === self.findIndex(t => (
281
- t.id === item.id // 基于id属性去重
282
- ))
913
+ let staffList = this.staffAllList.filter((item)=>item.checked===true);
914
+ if (!staffList.length) {
915
+ this.$Message.error("请选择人员");
916
+ return;
917
+ }
918
+ // 关键优化:基于item.id去重,不修改原数据字段,仅过滤重复项
919
+ let uniqueStaffList = staffList.filter(newItem =>
920
+ // 检查右侧条件区域(staffList)是否已有该人员,避免重复添加
921
+ !this.staffList.some(existItem => existItem.userId === newItem.userId)
283
922
  );
284
- this.staffList = uniqueArray
285
- this.staffAllList.map((item)=>item.checked=false)
923
+ // 合并去重后的列表
924
+ this.staffList = this.staffList.concat(uniqueStaffList);
925
+ // 清空选中状态
926
+ this.staffAllList.forEach(item => item.checked = false);
286
927
  },
287
928
  handlestaff(item){
288
929
  item.checked=!item.checked
@@ -294,15 +935,582 @@ export default {
294
935
  this.staffList.splice(index,1)
295
936
  },
296
937
  confirm(){
297
- this.$emit('confirm',{
938
+ const v = {
298
939
  orgList:this.orgList,
299
940
  postList:this.postList,
300
941
  staffList:this.staffList
301
- })
942
+ }
943
+ this.$emit('confirm',deepCopy(v))
302
944
  },
303
- visibleChange(val){
304
- this.$emit('input',val);
945
+ visibleChange(val) {
946
+ this.$emit('input', val);
947
+ // val 为 true 时表示帮助框打开,此时发起请求
948
+ if (val) {
949
+ this.initStaffList() // 新增初始化方法,统一处理打开后的请求逻辑
950
+ } else {
951
+ // 可选:关闭帮助框时重置人员列表相关状态,避免下次打开残留旧数据
952
+ this.staffEnding = false;
953
+ this.offset = 0;
954
+ this.staffAllList = [];
955
+ // 关闭时重置选中状态
956
+ this.$set(this, 'selectedStaffOrgId', '');
957
+ }
305
958
  },
959
+ initStaffList() {
960
+ this.staffEnding = false;
961
+ this.offset = 0;
962
+ this.staffAllList = [];
963
+ // 初始化时确保selectedStaffOrgId状态正确
964
+ if (this.tabName === 'staff' && (!this.selectedStaffOrgId || this.selectedStaffOrgId.trim())) {
965
+ this.$set(this, 'selectedStaffOrgId', '');
966
+ }
967
+ this.loadMore(); // 打开帮助框后,再发起第一次请求
968
+ },
969
+ // 处理Tab切换,同步更新tabName
970
+ handleTabChange(tabName) {
971
+ this.tabName = tabName;
972
+
973
+ // 仅修改人员Tab相关逻辑,不影响其他Tab
974
+ if (tabName === 'staff') {
975
+ // 重置人员选择相关状态
976
+ this.$set(this, 'selectedStaffOrgId', '');
977
+ this.proStaffOrgList = [];
978
+ // 清空树组件选中状态
979
+ if (this.$refs.staffTree) {
980
+ this.$refs.staffTree.clearAllChecked(this.$refs.staffTree.data);
981
+ this.$refs.staffTree.$emit('handleChange', []);
982
+ }
983
+ // 切换到人员tab时,立即触发一次搜索,确保orgUnitId参数正确
984
+ this.$nextTick(() => this.searchStaff());
985
+ } else if (tabName === 'post' && this.$refs.postTree && this.proPostList.length === 0) {
986
+ // 保留原有岗位Tab逻辑,不修改
987
+ this.proPostList = [];
988
+ this.$refs.postTree.initData();
989
+ }
990
+ },
991
+ async fastChedkOrg(item) {
992
+ // 1. 改用组织 Tab 专属标签列表判断
993
+ if (!this.orgTagList.length) {
994
+ this.$Message.warning("快捷选择标签正在加载中,请稍后");
995
+ return;
996
+ }
997
+ const treeRef = this.$refs.orgTree;
998
+ const proListKey = 'proOrgList';
999
+ const treeDataKey = 'orgTree';
1000
+ this[proListKey] = [];
1001
+ if (treeRef) await treeRef.initData();
1002
+ if (!treeRef) {
1003
+ this.$Message.error("组织树组件未初始化,请稍后再试");
1004
+ item.checked = !item.checked;
1005
+ return;
1006
+ }
1007
+
1008
+ // 2. 清空组织 Tab 标签选中状态(仅操作 orgTagList)
1009
+ this.orgTagList.forEach(tag => {
1010
+ tag.checked = false;
1011
+ });
1012
+
1013
+ // 3. 后续逻辑保持不变,仅操作当前 item(属于 orgTagList)
1014
+ const isCurrentlyChecked = item.checked;
1015
+ if (!isCurrentlyChecked) {
1016
+ item.checked = true;
1017
+ }
1018
+
1019
+ if (!item.checked) {
1020
+ this.$Message.info("已取消该快捷选择");
1021
+ return;
1022
+ }
1023
+
1024
+ try {
1025
+ await this.querySpecificParam(item, true, treeRef, proListKey, treeDataKey);
1026
+ } catch (error) {
1027
+ this.$Message.error(`快捷选择处理失败:${error.message.slice(0, 50)}`);
1028
+ item.checked = !item.checked;
1029
+ }
1030
+ },
1031
+ async fastChedkPost(item) {
1032
+ // 1. 改用岗位 Tab 专属标签列表判断
1033
+ if (!this.postTagList.length) {
1034
+ this.$Message.warning("快捷选择标签正在加载中,请稍后");
1035
+ return;
1036
+ }
1037
+
1038
+ const isOrgTab = this.tabName === 'org';
1039
+ const treeRef = isOrgTab ? this.$refs.orgTree : this.$refs.postTree;
1040
+ const proListKey = isOrgTab ? 'proOrgList' : 'proPostList';
1041
+ const treeDataKey = isOrgTab ? 'orgTree' : 'postTree';
1042
+
1043
+ this[proListKey] = [];
1044
+ const isCurrentlyChecked = item.checked;
1045
+ if (treeRef) await treeRef.initData();
1046
+
1047
+ // 2. 清空岗位 Tab 标签选中状态(仅操作 postTagList)
1048
+ this.postTagList.forEach(tag => {
1049
+ tag.checked = false;
1050
+ });
1051
+
1052
+ // 3. 后续逻辑保持不变,仅操作当前 item(属于 postTagList)
1053
+ if (!isCurrentlyChecked) {
1054
+ item.checked = true;
1055
+ }
1056
+
1057
+ if (!item.checked) {
1058
+ this.$Message.info("已取消该快捷选择");
1059
+ return;
1060
+ }
1061
+
1062
+ try {
1063
+ await this.querySpecificParam(item, isOrgTab, treeRef, proListKey, treeDataKey);
1064
+ } catch (error) {
1065
+ this.$Message.error(`快捷选择处理失败:${error.message.slice(0, 50)}`);
1066
+ item.checked = !item.checked;
1067
+ }
1068
+ },
1069
+ queryTagList() {
1070
+ ajax.get('/pub-manage-server/pub/helpBoxTag/q/queryQuickPickTags').then((res) => {
1071
+ if (res.data.code === 1) {
1072
+ let baseTagList = res.data.data || [];
1073
+ // 组织 Tab 标签:深拷贝并初始化选中状态
1074
+ this.orgTagList = this.safeDeepCopy(baseTagList).map(item => ({
1075
+ ...item,
1076
+ checked: false // 独立选中状态
1077
+ }));
1078
+ // 岗位 Tab 标签:深拷贝并初始化选中状态(与组织 Tab 完全独立)
1079
+ this.postTagList = this.safeDeepCopy(baseTagList).map(item => ({
1080
+ ...item,
1081
+ checked: false // 独立选中状态
1082
+ }));
1083
+ }
1084
+ });
1085
+ },
1086
+
1087
+ querySpecificParam: function (item, isOrgTab, treeRef, proListKey, treeDataKey) {
1088
+ return new Promise((resolve, reject) => {
1089
+ // 取消选中时处理(仅当手动点击已选中的标签时触发)
1090
+ if (!item.checked) {
1091
+ if (treeRef && treeRef.initData) {
1092
+ treeRef.initData(); // 清空对应树组件
1093
+ }
1094
+ this[proListKey] = []; // 清空对应暂存列表
1095
+ this.$Message.info("已取消该快捷选择");
1096
+ resolve();
1097
+ return;
1098
+ }
1099
+
1100
+ // 请求快捷选择对应的orgUnitId列表
1101
+ ajax.get(`/pub-manage-server/pub/helpBoxTag/q/querySpecificParam?quickPickKey=${item.quickPickKey}`)
1102
+ .then(async (res) => {
1103
+ if (res.data.code !== 1) {
1104
+ this.$Message.error("获取快捷选择配置失败");
1105
+ item.checked = !item.checked;
1106
+ reject(new Error("获取配置失败"));
1107
+ return;
1108
+ }
1109
+
1110
+ const orgUnitIds = res.data.data?.param || [];
1111
+ const safeOrgUnitIds = Array.isArray(orgUnitIds) ? orgUnitIds : [];
1112
+ if (safeOrgUnitIds.length === 0) {
1113
+ this.$Message.warning("该快捷选择未配置任何组织节点");
1114
+ item.checked = !item.checked;
1115
+ reject(new Error("无配置节点"));
1116
+ return;
1117
+ }
1118
+
1119
+ // 校验树组件是否存在(通用校验)
1120
+ if (!treeRef) {
1121
+ this.$Message.error("树组件未初始化");
1122
+ item.checked = !item.checked;
1123
+ reject(new Error("树组件不存在"));
1124
+ return;
1125
+ }
1126
+ const originalTreeData = treeRef.data && treeRef.data.length ? this.safeDeepCopy(treeRef.data) : [];
1127
+ const matchedNodes = [];
1128
+
1129
+ // 批量处理每个orgUnitId(循环逻辑不变,通用处理)
1130
+ for (const orgUnitId of safeOrgUnitIds) {
1131
+ try {
1132
+ // 节点详情查询(复用原有方法)
1133
+ let currentNode = await this.queryOrgNodeDetail(orgUnitId);
1134
+ if (!currentNode || !currentNode.orgUnitId) {
1135
+ this.$Message.warning(`节点【${orgUnitId}】数据异常,跳过处理`);
1136
+ continue;
1137
+ }
1138
+
1139
+ // 循环引用检测与处理(复用原有方法)
1140
+ const cycle = this.detectCircularReferences(currentNode);
1141
+ if (cycle) {
1142
+ this.$Message.warning(`节点【${orgUnitId}】存在循环引用,已自动修复`);
1143
+ currentNode = this.safeDeepCopy(currentNode);
1144
+ }
1145
+
1146
+ // 节点名称默认值处理(复用原有逻辑)
1147
+ currentNode.orgNodeName = currentNode.orgNodeName || currentNode.orgUnitName || `未命名组织(${orgUnitId})`;
1148
+ currentNode.orgUnitName = currentNode.orgNodeName;
1149
+
1150
+ // 节点是否已在树中检测(复用原有方法)
1151
+ const nodeInTree = this.findNodeInTree(originalTreeData, orgUnitId);
1152
+ if (nodeInTree) {
1153
+ if (this.detectCircularReferences(nodeInTree)) {
1154
+ this.$Message.warning(`树中节点【${orgUnitId}】存在循环引用,已跳过`);
1155
+ continue;
1156
+ }
1157
+ matchedNodes.push(nodeInTree);
1158
+ continue;
1159
+ }
1160
+
1161
+ // 父节点追溯与节点链挂载(修复:使用当前Tab的树数据originalTreeData,而非固定orgTree)
1162
+ let targetParent = null;
1163
+ let nodeChain = [currentNode];
1164
+ const MAX_DEPTH = 8;
1165
+ let depth = 0;
1166
+ let lastParentId = '';
1167
+
1168
+ while (!targetParent && depth < MAX_DEPTH) {
1169
+ const parentId = currentNode.parentOrgUnitId;
1170
+ if (!parentId || typeof parentId !== 'string' || parentId === lastParentId) {
1171
+ break;
1172
+ }
1173
+ lastParentId = parentId;
1174
+
1175
+ const parentNode = await this.queryOrgNodeDetail(parentId);
1176
+ if (!parentNode || !parentNode.orgUnitId) {
1177
+ break;
1178
+ }
1179
+
1180
+ if (this.detectCircularReferences(parentNode)) {
1181
+ this.$Message.warning(`父节点【${parentId}】存在循环引用,已跳过`);
1182
+ break;
1183
+ }
1184
+
1185
+ parentNode.orgNodeName = parentNode.orgNodeName || parentNode.orgUnitName || `未命名组织(${parentId})`;
1186
+ // 修复:查询父节点是否在当前Tab的树数据中(originalTreeData),而非固定orgTree
1187
+ const parentInTree = this.findNodeInTree(originalTreeData, parentNode.orgUnitId);
1188
+
1189
+ if (parentInTree) {
1190
+ targetParent = parentInTree;
1191
+ break;
1192
+ }
1193
+
1194
+ nodeChain.unshift(parentNode);
1195
+ currentNode = parentNode;
1196
+ depth++;
1197
+ }
1198
+
1199
+ // 节点链挂载(复用原有方法)
1200
+ if (targetParent) {
1201
+ let currentMountParent = targetParent;
1202
+ for (const node of nodeChain) {
1203
+ const formattedNode = this.safeDeepCopy({
1204
+ ...node,
1205
+ leafNode: await this.judgeNodeLeafe(node.orgUnitId),
1206
+ expand: true,
1207
+ checked: false,
1208
+ orgChildrenList: [],
1209
+ children: []
1210
+ });
1211
+
1212
+ if (!Array.isArray(currentMountParent.orgChildrenList)) {
1213
+ currentMountParent.orgChildrenList = [];
1214
+ currentMountParent.children = [];
1215
+ }
1216
+
1217
+ const isDuplicate = currentMountParent.orgChildrenList.some(
1218
+ child => child.orgUnitId === formattedNode.orgUnitId
1219
+ );
1220
+ if (!isDuplicate) {
1221
+ currentMountParent.orgChildrenList.push(formattedNode);
1222
+ currentMountParent.leafNode = false;
1223
+ }
1224
+
1225
+ currentMountParent = currentMountParent.orgChildrenList.find(
1226
+ child => child.orgUnitId === formattedNode.orgUnitId
1227
+ ) || formattedNode;
1228
+ }
1229
+
1230
+ const mountedTarget = this.findNodeInTree(originalTreeData, orgUnitId);
1231
+ if (mountedTarget) {
1232
+ matchedNodes.push(mountedTarget);
1233
+ }
1234
+ }
1235
+
1236
+ } catch (error) {
1237
+ this.$Message.error(`处理节点【${orgUnitId}】失败:${error.message.slice(0, 50)}`);
1238
+ continue;
1239
+ }
1240
+ }
1241
+
1242
+ // 最终数据赋值(根据Tab类型区分,核心统一逻辑)
1243
+
1244
+ if (matchedNodes.length > 0) {
1245
+ // 同步暂存列表(组织proOrgList/岗位proPostList)
1246
+ this[proListKey] = matchedNodes;
1247
+ const finalTreeData = this.safeDeepCopy(originalTreeData);
1248
+ // 响应式更新对应树数据(组织orgTree/岗位postTree)
1249
+ this.$set(this, treeDataKey, finalTreeData);
1250
+
1251
+ await this.$nextTick(async () => {
1252
+ // 更新树组件数据(通用逻辑)
1253
+ if (treeRef.updateTreeData) {
1254
+ treeRef.updateTreeData(this.safeDeepCopy(finalTreeData));
1255
+ } else {
1256
+ treeRef.data = this.safeDeepCopy(finalTreeData);
1257
+ }
1258
+
1259
+ // 设置树选中状态(通用逻辑)
1260
+ const safeNodeIds = matchedNodes.map(node => node.orgUnitId);
1261
+ if (treeRef.setCheckedNodes) {
1262
+ treeRef.setCheckedNodes([]);
1263
+ treeRef.setCheckedNodes(safeNodeIds);
1264
+ treeRef.handleChange(matchedNodes); // 触发子组件选中事件
1265
+ } else {
1266
+ this.updateTreeNodesStatus(
1267
+ finalTreeData,
1268
+ new Set(safeNodeIds),
1269
+ new Set(safeNodeIds)
1270
+ );
1271
+ treeRef.handleChange(matchedNodes);
1272
+ }
1273
+
1274
+ // 提示信息(通用逻辑)
1275
+ this.$Message.success(`成功选中${matchedNodes.length}个组织节点`);
1276
+ });
1277
+ } else {
1278
+ this.$Message.warning("未找到任何可匹配的组织节点");
1279
+ item.checked = !item.checked;
1280
+ }
1281
+ resolve();
1282
+ })
1283
+ .catch((error) => {
1284
+ const errMsg = error.message || '网络异常';
1285
+ this.$Message.error(`快捷选择失败:${errMsg.slice(0, 50)}`);
1286
+ item.checked = !item.checked;
1287
+ reject(error);
1288
+ });
1289
+ });
1290
+ },
1291
+
1292
+ // 新增:移除树数据中的 parent 引用,避免子组件处理时形成循环
1293
+ removeParentReferences(treeData) {
1294
+ if (!Array.isArray(treeData)) return;
1295
+ treeData.forEach(node => {
1296
+ // 删除可能存在的 parent 引用(如果节点有此属性)
1297
+ if (node.parent) delete node.parent;
1298
+ // 递归处理子节点
1299
+ if (Array.isArray(node.orgChildrenList)) {
1300
+ this.removeParentReferences(node.orgChildrenList);
1301
+ }
1302
+ if (Array.isArray(node.children)) {
1303
+ this.removeParentReferences(node.children);
1304
+ }
1305
+ });
1306
+ },
1307
+ // 在 methods 中添加循环引用检测工具函数
1308
+ detectCircularReferences(obj, path = [], visited = new Map()) {
1309
+ if (obj === null || typeof obj !== 'object') return null;
1310
+
1311
+ if (visited.has(obj)) {
1312
+ return { path: [...path, visited.get(obj)], node: obj };
1313
+ }
1314
+
1315
+ visited.set(obj, Array.isArray(obj) ? 'Array' : `Object(${obj.orgUnitId || 'unknown'})`);
1316
+
1317
+ const keys = Array.isArray(obj) ? obj.map((_, i) => i) : Object.keys(obj);
1318
+ for (const key of keys) {
1319
+ const value = obj[key];
1320
+ const newPath = [...path, key];
1321
+ if (value && typeof value === 'object') {
1322
+ const cycle = this.detectCircularReferences(value, newPath, visited);
1323
+ if (cycle) return cycle;
1324
+ }
1325
+ }
1326
+
1327
+ visited.delete(obj);
1328
+ return null;
1329
+ },
1330
+
1331
+ // 增强安全深拷贝,主动移除循环引用字段
1332
+ safeDeepCopy(obj, hash = new WeakMap()) {
1333
+ if (obj === null || typeof obj !== 'object') {
1334
+ return obj;
1335
+ }
1336
+
1337
+ // 检测到循环引用时,保留核心字段(orgUnitId必选,其他字段尽可能保留)
1338
+ if (hash.has(obj)) {
1339
+ const safeObj = {
1340
+ orgUnitId: obj.orgUnitId,
1341
+ orgNodeName: obj.orgNodeName || obj.name || `未命名组织(${obj.orgUnitId || 'unknown'})`,
1342
+ orgUnitName: obj.orgUnitName || obj.orgNodeName || obj.name || `未命名组织(${obj.orgUnitId || 'unknown'})`,
1343
+ parentOrgUnitId: obj.parentOrgUnitId || obj.parentId || null
1344
+ };
1345
+ hash.set(obj, safeObj);
1346
+ return safeObj;
1347
+ }
1348
+
1349
+ let copy;
1350
+ if (obj instanceof Array) {
1351
+ copy = [];
1352
+ hash.set(obj, copy);
1353
+ for (let i = 0; i < obj.length; i++) {
1354
+ copy[i] = this.safeDeepCopy(obj[i], hash);
1355
+ }
1356
+ } else if (obj instanceof Object) {
1357
+ copy = {};
1358
+ hash.set(obj, copy);
1359
+ for (let key in obj) {
1360
+ if (obj.hasOwnProperty(key)) {
1361
+ // 仅过滤vue内部字段,保留业务字段
1362
+ if (['__vue__', '__ob__', '$parent', '$children'].includes(key)) {
1363
+ continue;
1364
+ }
1365
+ // 子节点数组特殊处理
1366
+ if (['orgChildrenList', 'children'].includes(key) && Array.isArray(obj[key])) {
1367
+ copy[key] = obj[key].map(child => this.safeDeepCopy(child, hash));
1368
+ } else {
1369
+ // 保留所有业务字段,不额外过滤
1370
+ copy[key] = this.safeDeepCopy(obj[key], hash);
1371
+ }
1372
+ }
1373
+ }
1374
+ } else {
1375
+ copy = obj;
1376
+ }
1377
+ return copy;
1378
+ },
1379
+
1380
+ /**
1381
+ * 查询单个节点的原生详情(适配后端接口,返回原生字段)
1382
+ * @param {string} orgUnitId - 节点ID(如11510101)
1383
+ * @returns {Promise<Object|null>} 原生节点详情(无数据返回null)
1384
+ */
1385
+ getOrgNodeDetail(orgUnitId) {
1386
+ return new Promise((resolve) => {
1387
+ ajax.get(`/pub-manage-server/pub/organ/q/queryOrg`, {
1388
+ params: { orgUnitId: orgUnitId }
1389
+ }).then((res) => {
1390
+ if (res.data.code === 1 && res.data.data) {
1391
+ // 仅保留原生树结构必需字段(过滤业务冗余字段)
1392
+ const { orgUnitId, parentOrgUnitId, orgNodeName, orgChildrenList } = res.data.data;
1393
+ resolve({
1394
+ orgUnitId,
1395
+ parentOrgUnitId,
1396
+ orgNodeName,
1397
+ orgChildrenList: orgChildrenList || [] // 兼容接口返回空的情况
1398
+ });
1399
+ } else {
1400
+ resolve(null);
1401
+ }
1402
+ }).catch(() => {
1403
+ this.$Message.error(`查询节点【${orgUnitId}】详情失败`);
1404
+ resolve(null);
1405
+ });
1406
+ });
1407
+ },
1408
+
1409
+ /**
1410
+ * 迭代查找节点(替代递归,避免栈溢出)
1411
+ * @param {Array} treeData - 树形数据
1412
+ * @param {string} targetOrgUnitId - 目标节点ID
1413
+ * @returns {Object|null} 找到的节点
1414
+ */
1415
+ findNodeInTree(treeData, targetOrgUnitId) {
1416
+ if (!Array.isArray(treeData) || !targetOrgUnitId || typeof targetOrgUnitId !== 'string') {
1417
+ return null;
1418
+ }
1419
+
1420
+ const queue = [...treeData];
1421
+ while (queue.length > 0) {
1422
+ const currentNode = queue.shift();
1423
+ // 兼容子组件可能的字段映射(orgUnitId可能存储在id字段)
1424
+ const nodeId = currentNode.orgUnitId || currentNode.id || '';
1425
+ if (nodeId === targetOrgUnitId) {
1426
+ return currentNode;
1427
+ }
1428
+ // 兼容children和orgChildrenList两种子节点字段
1429
+ const childNodes = currentNode.orgChildrenList || currentNode.children || [];
1430
+ if (childNodes.length > 0) {
1431
+ queue.push(...childNodes);
1432
+ }
1433
+ }
1434
+ return null;
1435
+ },
1436
+
1437
+ /**
1438
+ * 辅助方法:查询单个orgUnitId的节点详情
1439
+ * @param {string} orgUnitId - 组织节点ID
1440
+ * @returns {Promise<Object|null>} 节点详情
1441
+ */
1442
+ queryOrgNodeDetail(orgUnitId) {
1443
+ return new Promise((resolve) => {
1444
+ // 前置校验:避免无效请求
1445
+ if (!orgUnitId || typeof orgUnitId !== 'string') {
1446
+ resolve(null);
1447
+ return;
1448
+ }
1449
+
1450
+ ajax.get(`/pub-manage-server/pub/organ/q/queryOrg?orgUnitId=${orgUnitId}`)
1451
+ .then((res) => {
1452
+ if (res.data.code === 1 && res.data.data && res.data.data.orgUnitId) {
1453
+ // 深拷贝并清理无效字段
1454
+ const node = this.safeDeepCopy(res.data.data);
1455
+ // 核心修复:确保节点名称有默认值,避免空显示
1456
+ const nodeName = node.orgNodeName || node.orgUnitName || node.name || `未命名组织(${orgUnitId})`;
1457
+ node.orgNodeName = nodeName;
1458
+ node.orgUnitName = nodeName; // 同步更新orgUnitName,确保所有使用场景都有值
1459
+ // 确保关键字段存在
1460
+ node.parentOrgUnitId = node.parentOrgUnitId || null;
1461
+ node.orgChildrenList = node.orgChildrenList || [];
1462
+ resolve(node);
1463
+ } else {
1464
+ // 接口返回空时,返回默认结构避免报错
1465
+ resolve({
1466
+ orgUnitId,
1467
+ orgNodeName: `未命名组织(${orgUnitId})`,
1468
+ orgUnitName: `未命名组织(${orgUnitId})`,
1469
+ parentOrgUnitId: null,
1470
+ orgChildrenList: []
1471
+ });
1472
+ }
1473
+ })
1474
+ .catch(() => {
1475
+ // 请求失败时,返回默认结构避免报错
1476
+ resolve({
1477
+ orgUnitId,
1478
+ orgNodeName: `未命名组织(${orgUnitId})`,
1479
+ orgUnitName: `未命名组织(${orgUnitId})`,
1480
+ parentOrgUnitId: null,
1481
+ orgChildrenList: []
1482
+ });
1483
+ });
1484
+ });
1485
+ },
1486
+
1487
+
1488
+ /**
1489
+ * 手动更新树节点状态(如果树组件没有提供update方法)
1490
+ * @param {Array} nodeList - 节点列表
1491
+ * @param {Set} expandIds - 需要展开的节点ID集合
1492
+ * @param {Set} checkedIds - 需要选中的节点ID集合
1493
+ */
1494
+ updateTreeNodesStatus(nodeList, expandIds, checkedIds) {
1495
+ nodeList.forEach(node => {
1496
+ // 更新展开状态
1497
+ if (expandIds.has(node.orgUnitId)) {
1498
+ node.expand = true;
1499
+ }
1500
+
1501
+ // 更新选中状态
1502
+ if (checkedIds.has(node.orgUnitId)) {
1503
+ node.checked = true;
1504
+ }
1505
+
1506
+ // 递归处理子节点
1507
+ const children = node.children || node.orgChildrenList;
1508
+ if (children && children.length > 0) {
1509
+ this.updateTreeNodesStatus(children, expandIds, checkedIds);
1510
+ }
1511
+ });
1512
+ }
1513
+
306
1514
  },
307
1515
  computed:{
308
1516
  getCheckedStaff(){
@@ -321,6 +1529,7 @@ export default {
321
1529
  },
322
1530
  data:{
323
1531
  handler(val){
1532
+ if(!val) return
324
1533
  let map = deepCopy(val)
325
1534
  let orgList = map.orgList || []
326
1535
  orgList.forEach(item=>{
@@ -343,6 +1552,266 @@ export default {
343
1552
  }
344
1553
  </script>
345
1554
  <style lang="less" scoped>
1555
+ // 新增checkbox样式
1556
+ .staff-checkbox {
1557
+ margin-right: 12px;
1558
+ flex-shrink: 0;
1559
+
1560
+ /deep/ .ivu-checkbox-wrapper {
1561
+ display: flex;
1562
+ align-items: center;
1563
+ cursor: pointer;
1564
+ }
1565
+
1566
+ /deep/ .ivu-checkbox {
1567
+ width: 18px;
1568
+ height: 18px;
1569
+
1570
+ &:checked {
1571
+ /deep/ .ivu-checkbox-inner {
1572
+ background-color: var(--primary-color);
1573
+ border-color: var(--primary-color);
1574
+ }
1575
+ }
1576
+ }
1577
+ }
1578
+
1579
+ .staff-left-right-layout {
1580
+ display: flex;
1581
+ height: 600px;
1582
+ gap: 15px;
1583
+ padding: 0 5px;
1584
+ width: 100%;
1585
+ box-sizing: border-box;
1586
+
1587
+ .staff-left-panel {
1588
+ min-width: 300px;
1589
+ max-width: 350px;
1590
+ width: 320px;
1591
+ display: flex;
1592
+ flex-direction: column;
1593
+ box-sizing: border-box;
1594
+ flex-shrink: 0;
1595
+
1596
+ .panel-title { /* 原有样式保留 */ }
1597
+
1598
+ .staff-org-tree {
1599
+ height: calc(100% - 38px) !important;
1600
+ border: 1px solid #EAECF0;
1601
+ border-radius: 4px;
1602
+ padding: 8px;
1603
+ box-sizing: border-box;
1604
+ /* 原样式保留,新增:禁止自身滚动,交给内部容器 */
1605
+ overflow: hidden !important;
1606
+ position: relative;
1607
+ }
1608
+
1609
+ /* 新增强制滚动容器样式(关键) */
1610
+ .tree-scroll-force {
1611
+ width: 100%;
1612
+ height: 100%;
1613
+ overflow: auto !important; /* 强制开启滚动 */
1614
+ overflow-x: scroll !important; /* 强制显示横向滚动条 */
1615
+ overflow-y: auto !important;
1616
+ /* 强制最小宽度,确保内容溢出时触发滚动 */
1617
+ min-width: 100%;
1618
+ max-width: none !important;
1619
+ /* 滚动条样式强制显示 */
1620
+ &::-webkit-scrollbar {
1621
+ width: 8px !important;
1622
+ height: 8px !important;
1623
+ display: block !important;
1624
+ background: #f9f9f9 !important;
1625
+ }
1626
+ &::-webkit-scrollbar-thumb {
1627
+ background: #ccc !important;
1628
+ border-radius: 4px !important;
1629
+ }
1630
+ /* 兼容Firefox */
1631
+ scrollbar-width: thin !important;
1632
+ scrollbar-color: #ccc #f9f9f9 !important;
1633
+ }
1634
+
1635
+ /* 强制组织树组件宽度自适应内容 */
1636
+ .tree-scroll-force /deep/ .ivu-tree {
1637
+ width: fit-content !important; /* 宽度跟随内容 */
1638
+ min-width: 100% !important; /* 最小占满容器 */
1639
+ white-space: nowrap !important;
1640
+ display: inline-block !important;
1641
+ }
1642
+ }
1643
+
1644
+ .staff-right-panel {
1645
+ flex: 1 !important;
1646
+ min-width: 350px;
1647
+ width: calc(100% - 335px) !important;
1648
+ display: flex;
1649
+ flex-direction: column;
1650
+ box-sizing: border-box;
1651
+ gap: 8px;
1652
+ padding: 0 5px;
1653
+ flex-shrink: 0;
1654
+
1655
+ // 其他右侧样式保持不变...
1656
+ }
1657
+ }
1658
+
1659
+ // 其他原有样式保持不变
1660
+ /deep/ .ivu-tree {
1661
+ width: 100% !important;
1662
+ box-sizing: border-box;
1663
+ }
1664
+
1665
+ /deep/ .ivu-tree-node-content {
1666
+ width: 100% !important;
1667
+ box-sizing: border-box;
1668
+ }
1669
+
1670
+ .gust-item {
1671
+ display: flex;
1672
+ align-items: center;
1673
+ width: 100% !important;
1674
+ padding: 12px 12px;
1675
+ margin-top: 8px;
1676
+ cursor: pointer;
1677
+ box-sizing: border-box;
1678
+ border: none !important; // 强制移除默认边框
1679
+ }
1680
+
1681
+ // 恢复滚动条样式(确保滚动可见)
1682
+ .staff-content::-webkit-scrollbar {
1683
+ width: 8px !important;
1684
+ height: 8px;
1685
+ display: block !important;
1686
+ }
1687
+
1688
+ .staff-content::-webkit-scrollbar-thumb {
1689
+ background-color: #ccc !important;
1690
+ border-radius: 4px !important;
1691
+ }
1692
+
1693
+ .staff-content::-webkit-scrollbar-track {
1694
+ background-color: #f9f9f9 !important;
1695
+ }
1696
+
1697
+ // 其他原有样式保持不变
1698
+ .tab.post .left {
1699
+ width: 200px;
1700
+ height: 450px !important;
1701
+ overflow: hidden !important;
1702
+ padding-right: 10px;
1703
+ box-sizing: border-box;
1704
+ }
1705
+
1706
+ .scroll-container {
1707
+ height: 100% !important;
1708
+ overflow-y: auto !important;
1709
+ overflow-x: hidden !important;
1710
+ padding: 8px 0;
1711
+ margin: 0;
1712
+ box-sizing: border-box;
1713
+ }
1714
+
1715
+ .scroll-container::-webkit-scrollbar {
1716
+ width: 8px !important;
1717
+ height: 8px;
1718
+ display: block !important;
1719
+ }
1720
+
1721
+ .scroll-container::-webkit-scrollbar-thumb {
1722
+ background-color: #ccc !important;
1723
+ border-radius: 4px !important;
1724
+ transition: background-color 0.2s;
1725
+ }
1726
+
1727
+ .scroll-container::-webkit-scrollbar-thumb:hover {
1728
+ background-color: #999 !important;
1729
+ }
1730
+
1731
+ .scroll-container::-webkit-scrollbar-track {
1732
+ background-color: #f9f9f9 !important;
1733
+ border-radius: 4px !important;
1734
+ }
1735
+
1736
+ .position-item {
1737
+ border: 1px solid #ddd;
1738
+ margin: 5px 0;
1739
+ padding: 8px 10px;
1740
+ border-radius: 2px;
1741
+ cursor: pointer;
1742
+ transition: background-color 0.2s;
1743
+ white-space: normal !important;
1744
+ overflow: visible !important;
1745
+ text-overflow: clip !important;
1746
+ line-height: 1.4;
1747
+ min-height: 40px;
1748
+ word-wrap: break-word;
1749
+ }
1750
+
1751
+ .position-item.active {
1752
+ border-color: #1890ff;
1753
+ background-color: #e6f7ff;
1754
+ }
1755
+
1756
+ .position-item:hover:not(.active) {
1757
+ background-color: #f5f5f5;
1758
+ }
1759
+
1760
+ .custom-select-wrapper {
1761
+ position: relative;
1762
+
1763
+ /deep/ .ivu-select-clear {
1764
+ right: 32px;
1765
+ color: #999;
1766
+ font-size: 16px;
1767
+ opacity: 1 !important;
1768
+ transition: all 0.2s ease;
1769
+
1770
+ &:hover {
1771
+ color: #ff4d4f;
1772
+ transform: scale(1.1);
1773
+ }
1774
+ }
1775
+
1776
+ /deep/ .ivu-select-arrow {
1777
+ right: 12px;
1778
+ }
1779
+
1780
+ /deep/ .ivu-select-input {
1781
+ padding-right: 45px !important;
1782
+ }
1783
+
1784
+ /deep/ .active-option {
1785
+ background-color: #f2f8ff;
1786
+ color: var(--primary-color);
1787
+ }
1788
+
1789
+ /deep/ .ivu-select-option-disabled {
1790
+ color: #ccc !important;
1791
+ background: #f5f5f5 !important;
1792
+ }
1793
+ }
1794
+
1795
+ .tag-select-container {
1796
+ margin-left: 10px;
1797
+
1798
+ /deep/ .ivu-select-dropdown {
1799
+ max-height: 200px;
1800
+ overflow-y: auto;
1801
+ }
1802
+
1803
+ /deep/ .active-option {
1804
+ background-color: #f2f8ff;
1805
+ color: var(--primary-color);
1806
+ }
1807
+
1808
+ /deep/ .ivu-select-selected-value {
1809
+ max-width: 150px;
1810
+ overflow: hidden;
1811
+ text-overflow: ellipsis;
1812
+ }
1813
+ }
1814
+
346
1815
  .modal-tree{
347
1816
  .header-text{
348
1817
  font-weight: bold;
@@ -352,7 +1821,7 @@ export default {
352
1821
  .icon-tip{
353
1822
  width: 16px;
354
1823
  height: 16px;
355
- background: #145DFF;
1824
+ background: var(--primary-color);
356
1825
  border-radius: 50%;
357
1826
  color: #fff;
358
1827
  line-height: 16px;
@@ -376,7 +1845,7 @@ export default {
376
1845
  flex:1;
377
1846
  text-align: center;
378
1847
  }
379
- .tab-content{
1848
+ .tab-content-pro{
380
1849
  width: 720px;
381
1850
  border-radius: 8px;
382
1851
  border: 1px solid #EAECF0;
@@ -419,12 +1888,26 @@ export default {
419
1888
  border: 1px solid #EAECF0;
420
1889
  margin-left:10px;
421
1890
  font-weight: bold;
1891
+ cursor: pointer;
422
1892
  &.active{
423
- background: #145DFF;
1893
+ background: var(--primary-color);
424
1894
  border-radius: 4px;
425
1895
  color: #fff;
426
1896
  }
427
1897
  }
1898
+ .pop-content{
1899
+ display: flex;
1900
+ flex-wrap: wrap;
1901
+ width:500px;
1902
+ .tag{
1903
+ margin-top: 10px;
1904
+ &.active{
1905
+ background: var(--primary-color);
1906
+ border-radius: 4px;
1907
+ color: #fff;
1908
+ }
1909
+ }
1910
+ }
428
1911
  .post{
429
1912
  display: flex;
430
1913
  height: 100%;
@@ -460,7 +1943,7 @@ export default {
460
1943
  padding: 15px 10px;
461
1944
  margin-top:10px;
462
1945
  cursor: pointer;
463
- .left-panel{
1946
+ .left-panel-pro{
464
1947
  background:url("./assets/name-bg.png") no-repeat;
465
1948
  width:30px;
466
1949
  height:30px;
@@ -471,7 +1954,7 @@ export default {
471
1954
  line-height:30px;
472
1955
  text-align:center;
473
1956
  }
474
- .right-panel{
1957
+ .right-panel-pro{
475
1958
  margin-left:10px;
476
1959
  flex:1;
477
1960
  >p:first-child{
@@ -483,14 +1966,19 @@ export default {
483
1966
  }
484
1967
  .checked-icon{
485
1968
  margin-left:auto;
486
- color:#145DFF;
1969
+ color:var(--primary-color);
487
1970
  font-size:18px;
488
1971
  }
489
1972
  }
490
- .staff-active{
491
- background:#E9F4FF;
492
- >p:first-child{
493
- color: var(--primary-color);
1973
+ .staff-active {
1974
+ background: transparent !important; // 彻底移除背景色
1975
+ border: none !important; // 彻底移除边框高亮
1976
+ border-radius: 0 !important; // 移除圆角
1977
+
1978
+ > .right-panel > p:first-child {
1979
+ color: inherit !important; // 可选:也移除文字颜色变化,仅保留Checkbox选中
1980
+ // 如果需要保留文字变色,删除上面这行,保留下面注释的行
1981
+ // color: var(--primary-color);
494
1982
  }
495
1983
  }
496
1984
  }
@@ -559,7 +2047,5 @@ export default {
559
2047
  justify-content: space-between;
560
2048
  }
561
2049
  }
562
- /deep/.ivu-modal-body-no-scrollbar-width :not([class^="ivu-table"])::-webkit-scrollbar{
563
- }
564
2050
  }
565
2051
  </style>