@sy-common/organize-select-help 1.0.0-beta.3 → 1.0.0-beta.35

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