imatrix-ui 0.2.6-up → 0.2.7-up
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/README.md +7 -7
- package/index.html +13 -13
- package/lib/super-ui.css +1 -1
- package/lib/super-ui.js +2724 -1932
- package/lib/super-ui.umd.cjs +24 -24
- package/package.json +1 -1
- package/packages/IntervalSelection/index.js +6 -6
- package/packages/IntervalSelection/src/quarterScope.vue +405 -405
- package/packages/IntervalSelection/src/sectionDate.vue +475 -475
- package/packages/breadcrumb/index.js +6 -6
- package/packages/breadcrumb/src/breadcrumb.vue +81 -81
- package/packages/department-tree/index.js +6 -6
- package/packages/department-tree/src/department-tree.vue +113 -113
- package/packages/department-tree-inline/index.js +6 -6
- package/packages/department-tree-inline/src/department-multi-tree-inline.vue +472 -472
- package/packages/department-tree-inline/src/department-single-tree-inline.vue +340 -340
- package/packages/department-tree-inline/src/department-tree-inline.vue +86 -86
- package/packages/department-tree-inline/src/department-tree-service.js +344 -344
- package/packages/department-tree-inline/src/search-result.vue +235 -235
- package/packages/department-user-tree/index.js +6 -6
- package/packages/department-user-tree/src/department-user-multiple-tree.vue +129 -129
- package/packages/department-user-tree/src/department-user-single-tree.vue +94 -94
- package/packages/department-user-tree/src/department-user-tree.vue +114 -114
- package/packages/department-user-tree-inline/index.js +9 -9
- package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +731 -731
- package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +334 -334
- package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +87 -87
- package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +309 -309
- package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +179 -179
- package/packages/department-user-tree-inline/src/search-result.vue +273 -273
- package/packages/directives/prevent-reclick.js +22 -22
- package/packages/dynamic-source-select/index.js +6 -6
- package/packages/dynamic-source-select/src/dynamic-source-select-service.js +106 -106
- package/packages/dynamic-source-select/src/dynamic-source-select.vue +675 -675
- package/packages/dynamic-source-select/src/events.js +78 -78
- package/packages/fs-preview/index.js +6 -6
- package/packages/fs-preview/src/fs-preview.vue +287 -287
- package/packages/fs-upload/index.js +6 -6
- package/packages/fs-upload/src/fs-upload-multi.vue +443 -443
- package/packages/fs-upload/src/fs-upload-single.vue +353 -353
- package/packages/fs-upload/src/fs-upload.vue +191 -191
- package/packages/fs-upload/src/see-big-picture.vue +67 -67
- package/packages/fs-upload-list/index.js +6 -6
- package/packages/fs-upload-list/src/fs-upload-list.vue +372 -372
- package/packages/hamburger/index.js +6 -6
- package/packages/hamburger/src/hamburger.vue +40 -40
- package/packages/index.js +123 -123
- package/packages/multipart-upload/index.js +6 -6
- package/packages/multipart-upload/src/index.vue +66 -66
- package/packages/multipart-upload/src/multipart-upload-form.vue +377 -377
- package/packages/multipart-upload/src/multipart-upload-list.vue +517 -517
- package/packages/organization-input/index.js +6 -6
- package/packages/organization-input/src/organization-input.vue +583 -583
- package/packages/plugins/export-data-new.js +623 -623
- package/packages/plugins/export-data.js +431 -431
- package/packages/plugins/index.js +15 -15
- package/packages/plugins/public-method.js +47 -47
- package/packages/remove-department/index.js +6 -6
- package/packages/remove-department/src/remove-department.vue +200 -200
- package/packages/remove-department/src/remove-dept-service.js +31 -31
- package/packages/remove-user/index.js +6 -6
- package/packages/remove-user/src/remove-user-service.js +31 -31
- package/packages/remove-user/src/remove-user.vue +226 -226
- package/packages/remove-workgroup/index.js +6 -6
- package/packages/remove-workgroup/src/remove-workgroup-service.js +31 -31
- package/packages/remove-workgroup/src/remove-workgroup.vue +183 -183
- package/packages/rich-editor/index.js +7 -7
- package/packages/rich-editor/index.vue +297 -297
- package/packages/rich-editor/langs/zh-Hans.js +438 -438
- package/packages/rich-editor/viewer.vue +105 -105
- package/packages/scan-code-input/index.js +6 -6
- package/packages/scan-code-input/src/events.js +34 -34
- package/packages/scan-code-input/src/scan-code-input-colse.vue +140 -140
- package/packages/scan-code-input/src/scan-code-input.vue +132 -132
- package/packages/secret-info/index.js +7 -7
- package/packages/secret-info/index.vue +100 -100
- package/packages/super-grid/index.js +7 -7
- package/packages/super-grid/src/apis.js +1092 -1092
- package/packages/super-grid/src/columns-config.vue +427 -427
- package/packages/super-grid/src/custom-formatter.js +394 -394
- package/packages/super-grid/src/eventBus.js +2 -2
- package/packages/super-grid/src/events.js +56 -56
- package/packages/super-grid/src/formValidatorUtil.js +300 -300
- package/packages/super-grid/src/formatter.js +196 -196
- package/packages/super-grid/src/group-column.vue +99 -99
- package/packages/super-grid/src/header-context-menu.vue +82 -82
- package/packages/super-grid/src/index-column.vue +69 -69
- package/packages/super-grid/src/public-methods.js +30 -30
- package/packages/super-grid/src/row-operation.vue +193 -193
- package/packages/super-grid/src/search-button.vue +74 -74
- package/packages/super-grid/src/search-condition-input.vue +73 -73
- package/packages/super-grid/src/search-condition-list.vue +68 -68
- package/packages/super-grid/src/search-form-advancedQuery.vue +819 -819
- package/packages/super-grid/src/search-form-dialog.vue +77 -77
- package/packages/super-grid/src/search-form-item.vue +495 -495
- package/packages/super-grid/src/search-form-number.vue +111 -111
- package/packages/super-grid/src/search-form-ordinarySearch.vue +239 -239
- package/packages/super-grid/src/search-form.vue +762 -762
- package/packages/super-grid/src/search-methods.js +592 -592
- package/packages/super-grid/src/selection-column.vue +46 -46
- package/packages/super-grid/src/store.js +3 -3
- package/packages/super-grid/src/super-grid-service.js +728 -728
- package/packages/super-grid/src/super-grid.vue +3011 -3011
- package/packages/super-grid/src/utils.js +880 -880
- package/packages/super-grid/src/view-image-dialog.vue +176 -176
- package/packages/super-nine-grid/index.js +7 -7
- package/packages/super-nine-grid/src/apis.js +108 -108
- package/packages/super-nine-grid/src/custom-formatter.js +73 -73
- package/packages/super-nine-grid/src/formatter.js +134 -134
- package/packages/super-nine-grid/src/search-form-number.vue +35 -35
- package/packages/super-nine-grid/src/search-form.vue +700 -700
- package/packages/super-nine-grid/src/search-methods.js +151 -151
- package/packages/super-nine-grid/src/store.js +3 -3
- package/packages/super-nine-grid/src/super-grid-service.js +107 -107
- package/packages/svg-icon/index.js +6 -6
- package/packages/svg-icon/src/svg-icon.vue +43 -43
- package/packages/utils/date-util.js +292 -292
- package/packages/utils/dom.js +227 -227
- package/packages/utils/gogocodeTransfer.js +59 -59
- package/packages/utils/memory-cache-utils.js +117 -117
- package/packages/utils/utils.js +180 -180
- package/packages/utils/value-set.js +97 -97
- package/packages/valid-code/index.js +7 -7
- package/packages/valid-code/src/valid-code.vue +104 -104
- package/packages/workflow-button/index.js +6 -6
- package/packages/workflow-button/src/workflow-button.vue +550 -550
- package/packages/workflow-history-list/index.js +6 -6
- package/packages/workflow-history-list/src/api.js +7 -7
- package/packages/workflow-history-list/src/workflow-history-list.vue +291 -291
- package/packages/workgroup-tree/index.js +6 -6
- package/packages/workgroup-tree/src/workgroup-tree.vue +86 -86
- package/packages/workgroup-tree-inline/index.js +6 -6
- package/packages/workgroup-tree-inline/src/search-result.vue +222 -222
- package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +516 -516
- package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +93 -93
- package/packages/workgroup-user-tree/index.js +6 -6
- package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +103 -103
- package/packages/workgroup-user-tree-inline/index.js +9 -9
- package/packages/workgroup-user-tree-inline/src/search-result.vue +266 -266
- package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +239 -239
- package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +657 -657
- package/packages/year-range-picker/index.js +6 -6
- package/packages/year-range-picker/src/year-range-picker.vue +53 -53
- package/src/api/sso-service.js +172 -172
- package/src/api/tab.js +36 -36
- package/src/api/user-service.js +11 -11
- package/src/directives/permission/index.js +13 -13
- package/src/directives/permission/permission.js +20 -20
- package/src/i18n/langs/cn.js +259 -259
- package/src/i18n/langs/en.js +269 -269
- package/src/index.js +93 -93
- package/src/plugins.js +18 -18
- package/src/router/index.js +8 -26
- package/src/store/getters.js +15 -15
- package/src/store/index.js +19 -19
- package/src/store/modules/app.js +54 -54
- package/src/store/modules/tab-content.js +36 -36
- package/src/store/modules/user.js +285 -285
- package/src/utils/auth.js +61 -61
- package/src/utils/calculator/calculator-factory-wf.js +558 -558
- package/src/utils/calculator/calculator-factory.js +145 -145
- package/src/utils/calculator/calculator-util.js +166 -166
- package/src/utils/eventBus.js +2 -2
- package/src/utils/iconUtils.js +28 -28
- package/src/utils/index.js +102 -102
- package/src/utils/jump-page-utils.js +824 -824
- package/src/utils/menu.js +19 -19
- package/src/utils/permission.js +31 -31
- package/src/utils/permissionAuth.js +96 -96
- package/src/utils/range-selector.js +188 -188
- package/src/utils/request.js +269 -269
- package/src/utils/restful-interface-utils.js +57 -57
- package/src/utils/util.js +703 -703
- package/src/utils/validate.js +34 -34
- package/src/utils/watermark.js +108 -108
- package/src/utils/workflow-util.js +93 -93
- package/src/views/404.vue +248 -248
- package/src/views/dsc-component/Sidebar/Item.vue +84 -84
- package/src/views/dsc-component/Sidebar/Link.vue +38 -38
- package/src/views/dsc-component/Sidebar/SidebarItem.vue +198 -198
- package/src/views/dsc-component/Sidebar/index.vue +229 -229
- package/src/views/dsc-component/tabs/tab-content.vue +203 -203
- package/src/views/error-page/401.vue +106 -106
- package/src/views/error-page/404.vue +248 -248
- package/src/views/layout/EmptyLayout.vue +3 -3
- package/src/views/layout/Layout.vue +81 -81
- package/src/views/layout/NewLayout.vue +18 -18
- package/src/views/layout/components/AppMain.vue +39 -39
- package/src/views/layout/components/Breadcrumb/index.vue +158 -158
- package/src/views/layout/components/Menubar/Item.vue +79 -79
- package/src/views/layout/components/Menubar/Link.vue +38 -38
- package/src/views/layout/components/Menubar/index.vue +210 -210
- package/src/views/layout/components/Sidebar/Item.vue +53 -53
- package/src/views/layout/components/Sidebar/Link.vue +38 -38
- package/src/views/layout/components/Sidebar/index.vue +141 -141
- package/src/views/layout/components/iframe-page.vue +38 -38
- package/src/views/layout/components/index.js +4 -4
- package/src/views/layout/components/tabs/tab-content.vue +207 -207
- package/src/views/layout/mixin/ResizeHandler.js +41 -41
- package/src/views/layout/tab-content-iframe-index.vue +38 -38
- package/src/views/layout/tab-content-index.vue +93 -93
- package/src/views/login/authredirect.vue +10 -10
- package/src/views/login/index.vue +296 -296
- package/src/views/login/update-password.vue +243 -243
- package/src/views/redirect/index.vue +14 -14
- package/src/views/wf-history/tache-subprocess-history.vue +45 -45
|
@@ -1,472 +1,472 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<el-container style="height: 395px">
|
|
4
|
-
<el-aside width="350px">
|
|
5
|
-
<el-container style="height: 390px">
|
|
6
|
-
<el-header style="text-align: right; font-size: 12px; height: 35px">
|
|
7
|
-
<el-autocomplete
|
|
8
|
-
v-model="filterText"
|
|
9
|
-
size="small"
|
|
10
|
-
class="inline-input inline-input-custom"
|
|
11
|
-
:fetch-suggestions="querySearch"
|
|
12
|
-
:placeholder="
|
|
13
|
-
$t('departmentTreeInline.pleaseEnterDepartmentName')
|
|
14
|
-
"
|
|
15
|
-
@keyup.enter="clickSearch"
|
|
16
|
-
@select="handleSelect"
|
|
17
|
-
>
|
|
18
|
-
<template v-slot:append>
|
|
19
|
-
<el-button
|
|
20
|
-
size="small"
|
|
21
|
-
:icon="ElIconSearch"
|
|
22
|
-
@click="clickSearch"
|
|
23
|
-
/>
|
|
24
|
-
</template>
|
|
25
|
-
</el-autocomplete>
|
|
26
|
-
</el-header>
|
|
27
|
-
<el-main style="padding: 10px">
|
|
28
|
-
<div
|
|
29
|
-
v-if="!searchValue"
|
|
30
|
-
style="
|
|
31
|
-
padding-top: 5px;
|
|
32
|
-
overflow: auto;
|
|
33
|
-
width: 100%;
|
|
34
|
-
display: inline-block !important;
|
|
35
|
-
"
|
|
36
|
-
>
|
|
37
|
-
<el-tree
|
|
38
|
-
ref="deparmentTree"
|
|
39
|
-
:props="defaultProps"
|
|
40
|
-
:load="loadNode"
|
|
41
|
-
lazy
|
|
42
|
-
:show-checkbox="true"
|
|
43
|
-
node-key="id"
|
|
44
|
-
check-strictly
|
|
45
|
-
:render-content="renderContent"
|
|
46
|
-
:filter-node-method="filterNode"
|
|
47
|
-
@check-change="handleCheckChange"
|
|
48
|
-
@node-expand="handleNodeExpand"
|
|
49
|
-
@check="handleCheckNode"
|
|
50
|
-
@node-click="handleNodeClick"
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<div
|
|
55
|
-
v-if="searchValue && searchValue.length > 0"
|
|
56
|
-
style="height: 100%; overflow: hidden"
|
|
57
|
-
>
|
|
58
|
-
<user-result
|
|
59
|
-
:grid-data="searchResult"
|
|
60
|
-
:select-result="selectResult"
|
|
61
|
-
:height="height"
|
|
62
|
-
:multiple="true"
|
|
63
|
-
:is-search-result="true"
|
|
64
|
-
@addUser="selectUser"
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
</el-main>
|
|
68
|
-
</el-container>
|
|
69
|
-
</el-aside>
|
|
70
|
-
|
|
71
|
-
<el-container>
|
|
72
|
-
<!-- <el-aside width="2px">
|
|
73
|
-
<table border="1px" cellpadding="0" cellspacing="0" style="height:100%;border-left-style:solid; border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-color: #cccccc" />
|
|
74
|
-
</el-aside> -->
|
|
75
|
-
<el-main style="padding: 10px">
|
|
76
|
-
<div style="text-align: left; font-size: 16px">
|
|
77
|
-
{{ $t('departmentTreeInline.selectedDept') }}:
|
|
78
|
-
</div>
|
|
79
|
-
<div :style="'padding-top: 5px;height:90%;overflow: hidden;'">
|
|
80
|
-
<user-result
|
|
81
|
-
v-loading="isloading"
|
|
82
|
-
:grid-data="selectResult"
|
|
83
|
-
:height="height"
|
|
84
|
-
:multiple="true"
|
|
85
|
-
:is-search-result="false"
|
|
86
|
-
@removeUser="removeUser"
|
|
87
|
-
/>
|
|
88
|
-
</div>
|
|
89
|
-
</el-main>
|
|
90
|
-
</el-container>
|
|
91
|
-
</el-container>
|
|
92
|
-
</div>
|
|
93
|
-
</template>
|
|
94
|
-
|
|
95
|
-
<script>
|
|
96
|
-
import { Search as ElIconSearch } from '@element-plus/icons-vue'
|
|
97
|
-
import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
|
|
98
|
-
import localStorage from '../../../src/utils/local-storage'
|
|
99
|
-
import utils from '../../utils/utils'
|
|
100
|
-
import departmentTreeService from './department-tree-service'
|
|
101
|
-
import UserResult from './search-result.vue'
|
|
102
|
-
import memoryCacheUtils from '../../utils/memory-cache-utils'
|
|
103
|
-
export default {
|
|
104
|
-
data() {
|
|
105
|
-
return {
|
|
106
|
-
filterText: '',
|
|
107
|
-
defaultProps: {
|
|
108
|
-
id: 'id',
|
|
109
|
-
label: 'showName',
|
|
110
|
-
children: 'childDepartments',
|
|
111
|
-
isLeaf: 'leaf',
|
|
112
|
-
},
|
|
113
|
-
searchParam: {
|
|
114
|
-
searchValue: null,
|
|
115
|
-
treeType: 'DEPARTMENT_TREE',
|
|
116
|
-
departmentInfo: null,
|
|
117
|
-
},
|
|
118
|
-
count: 0,
|
|
119
|
-
// 当前租户内是否包含分支机构。获得当前选中部门名称时,如果有分支,则需要将分支名称返回给用户,例如:部门1(分支1)
|
|
120
|
-
containBranch: false,
|
|
121
|
-
// 公司节点的id
|
|
122
|
-
tenantNodeId: -1,
|
|
123
|
-
// 用于保存所有查询出的节点id
|
|
124
|
-
allSearchNodeIds: [],
|
|
125
|
-
// 用于保存allSearchNodeIds中所有已加载子节点的id集合
|
|
126
|
-
allExpandNodeIds: [],
|
|
127
|
-
isClickNode: false,
|
|
128
|
-
// 查询的备选值
|
|
129
|
-
restaurants: [],
|
|
130
|
-
// 查询条件
|
|
131
|
-
searchValue: null,
|
|
132
|
-
searchStoreKey: 'searchDepartment',
|
|
133
|
-
// 单选时,选择的部门信息
|
|
134
|
-
selectNodeInfo: null,
|
|
135
|
-
// 公司根节点信息
|
|
136
|
-
tenantInfo: {},
|
|
137
|
-
searchResult: [],
|
|
138
|
-
selectResult: [],
|
|
139
|
-
// 控制右侧选择区的loading状态
|
|
140
|
-
isloading: false,
|
|
141
|
-
multiple: true,
|
|
142
|
-
memoryCacheKey: 'DEPARTMENT_MEMORY_KEY',
|
|
143
|
-
// 记忆选择数据, 搜索框获得焦点后,下拉显示最近选中的10个人,倒序排列,最后选中的在最上面显示。
|
|
144
|
-
memoryCacheData: [],
|
|
145
|
-
ElIconSearch,
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
name: 'InlineDepartmentMultiTree',
|
|
149
|
-
components: {
|
|
150
|
-
UserResult,
|
|
151
|
-
},
|
|
152
|
-
props: {
|
|
153
|
-
checkStrictly: {
|
|
154
|
-
type: Boolean,
|
|
155
|
-
default: false,
|
|
156
|
-
},
|
|
157
|
-
// 显示指定部门节点及其子节点,不传该属性,表示显示整个组织结构树
|
|
158
|
-
departmentInfo: {
|
|
159
|
-
type: Array,
|
|
160
|
-
default: null,
|
|
161
|
-
},
|
|
162
|
-
// 弹框的高度
|
|
163
|
-
height: {
|
|
164
|
-
type: String,
|
|
165
|
-
default: '300px',
|
|
166
|
-
},
|
|
167
|
-
// 多选部门树时,已选择部门id或部门名称或编码集合,多个之间以逗号隔开
|
|
168
|
-
selectDepartmentInfo: {
|
|
169
|
-
type: [String, Number],
|
|
170
|
-
default: null,
|
|
171
|
-
},
|
|
172
|
-
// 移除部门时,部门属性名称:id、name、code,默认是id
|
|
173
|
-
searchField: {
|
|
174
|
-
type: String,
|
|
175
|
-
default: 'id',
|
|
176
|
-
},
|
|
177
|
-
// 多选树时结果之间的分隔符,默认是逗号分隔
|
|
178
|
-
separator: {
|
|
179
|
-
type: String,
|
|
180
|
-
default: ',',
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
computed: {},
|
|
184
|
-
watch: {
|
|
185
|
-
filterText(val) {
|
|
186
|
-
if (!val) {
|
|
187
|
-
this.searchValue = val
|
|
188
|
-
// 清空查询内容时,重新加载整个树
|
|
189
|
-
if (this.departmentInfo && this.departmentInfo.length > 0) {
|
|
190
|
-
// 加载指定部门时,展开公司节点
|
|
191
|
-
this.loadPointDepartments()
|
|
192
|
-
} else {
|
|
193
|
-
// 加载整个组织结构树时,展开公司节点
|
|
194
|
-
this.loadDepartment(this.tenantNodeId)
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
created() {
|
|
200
|
-
this.initSelectDepts(
|
|
201
|
-
this.searchField,
|
|
202
|
-
this.selectDepartmentInfo,
|
|
203
|
-
this.separator
|
|
204
|
-
).then((selectUsers) => {
|
|
205
|
-
if (selectUsers) {
|
|
206
|
-
this.selectResult = selectUsers
|
|
207
|
-
}
|
|
208
|
-
})
|
|
209
|
-
},
|
|
210
|
-
mounted() {
|
|
211
|
-
var searchDepartment = localStorage.getObject(this.searchStoreKey)
|
|
212
|
-
if (searchDepartment) {
|
|
213
|
-
this.restaurants = searchDepartment
|
|
214
|
-
} else {
|
|
215
|
-
this.restaurants = []
|
|
216
|
-
}
|
|
217
|
-
this.getMemoryCacheData('department')
|
|
218
|
-
},
|
|
219
|
-
methods: {
|
|
220
|
-
...utils,
|
|
221
|
-
...departmentTreeService,
|
|
222
|
-
...memoryCacheUtils,
|
|
223
|
-
filterNode(value, data, node) {
|
|
224
|
-
if (!value) {
|
|
225
|
-
return true
|
|
226
|
-
} else {
|
|
227
|
-
return data.name.indexOf(value) !== -1
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
// 选中当前节点及其子节点
|
|
231
|
-
checkedNodeAndChildren(data) {
|
|
232
|
-
// 取消选中状态时,保持节点是展开的状态,不要折叠
|
|
233
|
-
// this.$refs.deparmentTree.store.nodesMap[data.id].expanded = true
|
|
234
|
-
let department = data
|
|
235
|
-
if (data.data) {
|
|
236
|
-
department = JSON.parse(data.data)
|
|
237
|
-
}
|
|
238
|
-
this.selectUser(null, department)
|
|
239
|
-
// 获得所有应该选中的节点
|
|
240
|
-
this.$refs.deparmentTree.setChecked(data.id, true)
|
|
241
|
-
const childDepartments = data.childDepartments
|
|
242
|
-
if (childDepartments && !this.checkStrictly) {
|
|
243
|
-
// 递归设置子子节点的选中状态
|
|
244
|
-
childDepartments.forEach((nodeData) => {
|
|
245
|
-
this.checkedNodeAndChildren(nodeData)
|
|
246
|
-
})
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
// 取消当前节点的子节点的选中状态
|
|
250
|
-
cancelChildCheckedNodes(data) {
|
|
251
|
-
const department = JSON.parse(data.data)
|
|
252
|
-
this.selectResult = this.removeRow(this.selectResult, department)
|
|
253
|
-
if (data.id !== this.tenantNodeId) {
|
|
254
|
-
// 如果当前节点不是公司节点,需要将公司节点的选中状态去掉
|
|
255
|
-
this.$refs.deparmentTree.setChecked(this.tenantNodeId, false)
|
|
256
|
-
}
|
|
257
|
-
const childDepartments = data.childDepartments
|
|
258
|
-
if (childDepartments && !this.checkStrictly) {
|
|
259
|
-
childDepartments.forEach((nodeData) => {
|
|
260
|
-
// 取消节点的选中状态
|
|
261
|
-
this.$refs.deparmentTree.setChecked(nodeData.id, false)
|
|
262
|
-
// 递归取消子子节点的选中状态
|
|
263
|
-
this.cancelChildCheckedNodes(nodeData)
|
|
264
|
-
})
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
handleCheckChange(data, checked, indeterminate) {},
|
|
268
|
-
handleNodeExpand(data, node, nodeTree) {},
|
|
269
|
-
handleNodeClick(data, node, nodeTree) {
|
|
270
|
-
// 多选部门树时,处理点击节点事件
|
|
271
|
-
this.clickNodeWhenMultiple(data)
|
|
272
|
-
},
|
|
273
|
-
// 多选树时,点击节点处理复选框的选中状态
|
|
274
|
-
clickNodeWhenMultiple(data) {
|
|
275
|
-
var checkedKeys = []
|
|
276
|
-
if (this.$refs.deparmentTree) {
|
|
277
|
-
checkedKeys = this.$refs.deparmentTree.getCheckedKeys()
|
|
278
|
-
}
|
|
279
|
-
if (checkedKeys && checkedKeys.indexOf(data.id) > -1) {
|
|
280
|
-
// 表示当前节点是选中状态,则需要取消其选中状态
|
|
281
|
-
// 取消当前节点的勾选状态
|
|
282
|
-
this.$refs.deparmentTree.setChecked(data.id, false)
|
|
283
|
-
// 取消当前节点的子节点的勾选状态
|
|
284
|
-
if (!this.checkStrictly) {
|
|
285
|
-
this.cancelChildCheckedNodes(data)
|
|
286
|
-
}
|
|
287
|
-
// 取消选中状态时,保持节点是展开的状态,不要折叠
|
|
288
|
-
this.$refs.deparmentTree.store.nodesMap[data.id].expanded = true
|
|
289
|
-
} else {
|
|
290
|
-
// 表示当前节点不是选中的状态,需要勾选该节点
|
|
291
|
-
if (data.nodeType && data.nodeType === 'DEPARTMENT' && data.data) {
|
|
292
|
-
// 表示当前选中的节点是部门
|
|
293
|
-
const department = JSON.parse(data.data)
|
|
294
|
-
this.selectUser(null, department)
|
|
295
|
-
}
|
|
296
|
-
this.$refs.deparmentTree.setChecked(data.id, true)
|
|
297
|
-
// 点击树节点时添加并展开节点会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
|
|
298
|
-
const children = data.childDepartments
|
|
299
|
-
if (children && children.length > 0) {
|
|
300
|
-
// 表示加载过该节点,直接选中即可
|
|
301
|
-
if (!this.checkStrictly) {
|
|
302
|
-
this.checkedNodeAndChildren(data)
|
|
303
|
-
}
|
|
304
|
-
} else {
|
|
305
|
-
// 表示没有加载过该节点,是首次加载,需要走后台
|
|
306
|
-
// 会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
|
|
307
|
-
this.isClickNode = true
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
},
|
|
311
|
-
isDepartmentNode(data) {
|
|
312
|
-
// 当前节点不是公司节点,也不是分支机构节点,表示是部门节点
|
|
313
|
-
return (
|
|
314
|
-
data.id !== this.tenantNodeId &&
|
|
315
|
-
data.nodeType &&
|
|
316
|
-
data.nodeType === 'DEPARTMENT' &&
|
|
317
|
-
!data.branch
|
|
318
|
-
)
|
|
319
|
-
},
|
|
320
|
-
selectDepartment() {
|
|
321
|
-
// 是否需要显示提示框,默认不显示
|
|
322
|
-
var showTip = false
|
|
323
|
-
var leafSelectNodeInfo = {
|
|
324
|
-
ids: [],
|
|
325
|
-
names: [],
|
|
326
|
-
codes: [],
|
|
327
|
-
zhNames: [],
|
|
328
|
-
enNames: [],
|
|
329
|
-
departments: [],
|
|
330
|
-
}
|
|
331
|
-
if (this.selectResult.length === 0) {
|
|
332
|
-
// 没有选择任何节点
|
|
333
|
-
showTip = true
|
|
334
|
-
} else {
|
|
335
|
-
for (var i = 0; i < this.selectResult.length; i++) {
|
|
336
|
-
var userData = this.selectResult[i]
|
|
337
|
-
// 不存在该用户则放到结果集合中,去掉重复使用
|
|
338
|
-
leafSelectNodeInfo.ids.push(userData.id)
|
|
339
|
-
leafSelectNodeInfo.codes.push(userData.code)
|
|
340
|
-
if (userData.enName) {
|
|
341
|
-
leafSelectNodeInfo.enNames.push(userData.enName)
|
|
342
|
-
} else {
|
|
343
|
-
leafSelectNodeInfo.enNames.push('')
|
|
344
|
-
}
|
|
345
|
-
if (userData.department) {
|
|
346
|
-
leafSelectNodeInfo.departments.push(userData.department)
|
|
347
|
-
} else {
|
|
348
|
-
leafSelectNodeInfo.departments.push(userData)
|
|
349
|
-
}
|
|
350
|
-
const name = userData.showName
|
|
351
|
-
leafSelectNodeInfo.names.push(name)
|
|
352
|
-
leafSelectNodeInfo.zhNames.push(userData.name)
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
if (leafSelectNodeInfo.ids.length > 0) {
|
|
356
|
-
leafSelectNodeInfo.containBranch = this.containBranch
|
|
357
|
-
$emit(this, 'result', leafSelectNodeInfo)
|
|
358
|
-
} else {
|
|
359
|
-
showTip = true
|
|
360
|
-
}
|
|
361
|
-
if (showTip) {
|
|
362
|
-
this.$alert(
|
|
363
|
-
this.$t('imatrixUIMessage.pleaseSelectDepartment'),
|
|
364
|
-
this.$t('imatrixUIMessage.tips'),
|
|
365
|
-
{
|
|
366
|
-
confirmButtonText: this.$t('imatrixUIPublicModel.sure'),
|
|
367
|
-
}
|
|
368
|
-
)
|
|
369
|
-
}
|
|
370
|
-
},
|
|
371
|
-
// 是否选中了公司节点
|
|
372
|
-
isSelectTenantNode(dataId) {
|
|
373
|
-
return (
|
|
374
|
-
dataId === this.tenantNodeId &&
|
|
375
|
-
(!this.departmentInfo || this.departmentInfo.length === 0)
|
|
376
|
-
)
|
|
377
|
-
},
|
|
378
|
-
// 给节点添加自定义图标
|
|
379
|
-
renderContent(h, { node, data, store }) {
|
|
380
|
-
var className
|
|
381
|
-
if (node.data.id === -1 || node.data.branch) {
|
|
382
|
-
// node.id ===-1表示公司节点,node.branch表示是分支机构节点
|
|
383
|
-
className = 'el-icon-menu'
|
|
384
|
-
} else if (node.data.id === -2 || node.data.id === -3) {
|
|
385
|
-
// node.id ===-2表示集团公司无部门用户节点,node.id ===-3表示是分支机构无部门用户节点
|
|
386
|
-
className = 'el-icon-tickets'
|
|
387
|
-
} else {
|
|
388
|
-
// 表示是部门节点
|
|
389
|
-
className = 'el-icon-date'
|
|
390
|
-
}
|
|
391
|
-
return (
|
|
392
|
-
`<span>
|
|
393
|
-
<i class={className}></i>
|
|
394
|
-
<span title={node.label}>{node.label}</span>
|
|
395
|
-
</span>`
|
|
396
|
-
)
|
|
397
|
-
},
|
|
398
|
-
// 将查询结果中指定用户添加到已选择用户集合中
|
|
399
|
-
selectUser(index, dept) {
|
|
400
|
-
// if (!this.isContainAllUser()) {
|
|
401
|
-
const containUsers = this.selectResult.filter(this.filterDept(dept))
|
|
402
|
-
if (containUsers && containUsers.length === 0) {
|
|
403
|
-
// 如果已选结果中不包含当前用户,则添加
|
|
404
|
-
// 将查询结果中的用户复制到已选择用户集合中
|
|
405
|
-
dept.tenantCode = this.tenantInfo.code
|
|
406
|
-
dept.tenantName = this.tenantInfo.tenantName
|
|
407
|
-
this.selectResult.push(dept)
|
|
408
|
-
// 搜索选中记忆
|
|
409
|
-
this.setMemoryCacheData(dept, 'department')
|
|
410
|
-
}
|
|
411
|
-
// } else {
|
|
412
|
-
// this.alertByAllUser()
|
|
413
|
-
// }
|
|
414
|
-
},
|
|
415
|
-
// 判断用户是否存在的过滤器
|
|
416
|
-
filterDept(queryDept) {
|
|
417
|
-
return (dept) => {
|
|
418
|
-
return dept.id === queryDept.id
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
filterDeptNode(queryDept) {
|
|
422
|
-
return (deptNodeId) => {
|
|
423
|
-
return deptNodeId + '' === queryDept.id + ''
|
|
424
|
-
}
|
|
425
|
-
},
|
|
426
|
-
// 从已选择用户集合中移除指定用户,并添加到查询结果集合中
|
|
427
|
-
removeUser(index, dept) {
|
|
428
|
-
// 表示是在组织结构树页面,需要将树的人员节点的选中状态去掉
|
|
429
|
-
if (dept.nodeId) {
|
|
430
|
-
const nodeId = dept.nodeId
|
|
431
|
-
if (this.$refs.deparmentTree && nodeId) {
|
|
432
|
-
this.$refs.deparmentTree.setChecked(nodeId, false)
|
|
433
|
-
}
|
|
434
|
-
} else {
|
|
435
|
-
if (this.$refs.deparmentTree) {
|
|
436
|
-
// 通过查询结果添加的用户,在返回到组织结构树时,也选中了该用户,在移除该用户时,需要去掉复选框的选中状态
|
|
437
|
-
const checkedKeys = this.$refs.deparmentTree.getCheckedKeys()
|
|
438
|
-
const currentCheckedUserNodeIds = checkedKeys.filter(
|
|
439
|
-
this.filterDeptNode(dept)
|
|
440
|
-
)
|
|
441
|
-
if (currentCheckedUserNodeIds.length > 0) {
|
|
442
|
-
// 表示当前用户是选中的状态,需要去掉
|
|
443
|
-
currentCheckedUserNodeIds.forEach((userNodeId) => {
|
|
444
|
-
this.$refs.deparmentTree.setChecked(userNodeId, false)
|
|
445
|
-
})
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
this.selectResult = this.removeRow(this.selectResult, dept)
|
|
450
|
-
if (!this.selectResult || this.selectResult.length === 0) {
|
|
451
|
-
// 已选结果面板没有内容,则左侧树节点也不要有选中节点了
|
|
452
|
-
if (this.$refs.deparmentTree) {
|
|
453
|
-
this.$refs.deparmentTree.setCheckedKeys([])
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
},
|
|
457
|
-
},
|
|
458
|
-
emits: ['result'],
|
|
459
|
-
}
|
|
460
|
-
</script>
|
|
461
|
-
|
|
462
|
-
<style>
|
|
463
|
-
.searchResult {
|
|
464
|
-
color: red;
|
|
465
|
-
}
|
|
466
|
-
.inline-input-custom {
|
|
467
|
-
width: 90%;
|
|
468
|
-
}
|
|
469
|
-
.el-autocomplete-suggestion.el-popper {
|
|
470
|
-
min-width: 300px;
|
|
471
|
-
}
|
|
472
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-container style="height: 395px">
|
|
4
|
+
<el-aside width="350px">
|
|
5
|
+
<el-container style="height: 390px">
|
|
6
|
+
<el-header style="text-align: right; font-size: 12px; height: 35px">
|
|
7
|
+
<el-autocomplete
|
|
8
|
+
v-model="filterText"
|
|
9
|
+
size="small"
|
|
10
|
+
class="inline-input inline-input-custom"
|
|
11
|
+
:fetch-suggestions="querySearch"
|
|
12
|
+
:placeholder="
|
|
13
|
+
$t('departmentTreeInline.pleaseEnterDepartmentName')
|
|
14
|
+
"
|
|
15
|
+
@keyup.enter="clickSearch"
|
|
16
|
+
@select="handleSelect"
|
|
17
|
+
>
|
|
18
|
+
<template v-slot:append>
|
|
19
|
+
<el-button
|
|
20
|
+
size="small"
|
|
21
|
+
:icon="ElIconSearch"
|
|
22
|
+
@click="clickSearch"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
</el-autocomplete>
|
|
26
|
+
</el-header>
|
|
27
|
+
<el-main style="padding: 10px">
|
|
28
|
+
<div
|
|
29
|
+
v-if="!searchValue"
|
|
30
|
+
style="
|
|
31
|
+
padding-top: 5px;
|
|
32
|
+
overflow: auto;
|
|
33
|
+
width: 100%;
|
|
34
|
+
display: inline-block !important;
|
|
35
|
+
"
|
|
36
|
+
>
|
|
37
|
+
<el-tree
|
|
38
|
+
ref="deparmentTree"
|
|
39
|
+
:props="defaultProps"
|
|
40
|
+
:load="loadNode"
|
|
41
|
+
lazy
|
|
42
|
+
:show-checkbox="true"
|
|
43
|
+
node-key="id"
|
|
44
|
+
check-strictly
|
|
45
|
+
:render-content="renderContent"
|
|
46
|
+
:filter-node-method="filterNode"
|
|
47
|
+
@check-change="handleCheckChange"
|
|
48
|
+
@node-expand="handleNodeExpand"
|
|
49
|
+
@check="handleCheckNode"
|
|
50
|
+
@node-click="handleNodeClick"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div
|
|
55
|
+
v-if="searchValue && searchValue.length > 0"
|
|
56
|
+
style="height: 100%; overflow: hidden"
|
|
57
|
+
>
|
|
58
|
+
<user-result
|
|
59
|
+
:grid-data="searchResult"
|
|
60
|
+
:select-result="selectResult"
|
|
61
|
+
:height="height"
|
|
62
|
+
:multiple="true"
|
|
63
|
+
:is-search-result="true"
|
|
64
|
+
@addUser="selectUser"
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
</el-main>
|
|
68
|
+
</el-container>
|
|
69
|
+
</el-aside>
|
|
70
|
+
|
|
71
|
+
<el-container>
|
|
72
|
+
<!-- <el-aside width="2px">
|
|
73
|
+
<table border="1px" cellpadding="0" cellspacing="0" style="height:100%;border-left-style:solid; border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-color: #cccccc" />
|
|
74
|
+
</el-aside> -->
|
|
75
|
+
<el-main style="padding: 10px">
|
|
76
|
+
<div style="text-align: left; font-size: 16px">
|
|
77
|
+
{{ $t('departmentTreeInline.selectedDept') }}:
|
|
78
|
+
</div>
|
|
79
|
+
<div :style="'padding-top: 5px;height:90%;overflow: hidden;'">
|
|
80
|
+
<user-result
|
|
81
|
+
v-loading="isloading"
|
|
82
|
+
:grid-data="selectResult"
|
|
83
|
+
:height="height"
|
|
84
|
+
:multiple="true"
|
|
85
|
+
:is-search-result="false"
|
|
86
|
+
@removeUser="removeUser"
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
</el-main>
|
|
90
|
+
</el-container>
|
|
91
|
+
</el-container>
|
|
92
|
+
</div>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script>
|
|
96
|
+
import { Search as ElIconSearch } from '@element-plus/icons-vue'
|
|
97
|
+
import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
|
|
98
|
+
import localStorage from '../../../src/utils/local-storage'
|
|
99
|
+
import utils from '../../utils/utils'
|
|
100
|
+
import departmentTreeService from './department-tree-service'
|
|
101
|
+
import UserResult from './search-result.vue'
|
|
102
|
+
import memoryCacheUtils from '../../utils/memory-cache-utils'
|
|
103
|
+
export default {
|
|
104
|
+
data() {
|
|
105
|
+
return {
|
|
106
|
+
filterText: '',
|
|
107
|
+
defaultProps: {
|
|
108
|
+
id: 'id',
|
|
109
|
+
label: 'showName',
|
|
110
|
+
children: 'childDepartments',
|
|
111
|
+
isLeaf: 'leaf',
|
|
112
|
+
},
|
|
113
|
+
searchParam: {
|
|
114
|
+
searchValue: null,
|
|
115
|
+
treeType: 'DEPARTMENT_TREE',
|
|
116
|
+
departmentInfo: null,
|
|
117
|
+
},
|
|
118
|
+
count: 0,
|
|
119
|
+
// 当前租户内是否包含分支机构。获得当前选中部门名称时,如果有分支,则需要将分支名称返回给用户,例如:部门1(分支1)
|
|
120
|
+
containBranch: false,
|
|
121
|
+
// 公司节点的id
|
|
122
|
+
tenantNodeId: -1,
|
|
123
|
+
// 用于保存所有查询出的节点id
|
|
124
|
+
allSearchNodeIds: [],
|
|
125
|
+
// 用于保存allSearchNodeIds中所有已加载子节点的id集合
|
|
126
|
+
allExpandNodeIds: [],
|
|
127
|
+
isClickNode: false,
|
|
128
|
+
// 查询的备选值
|
|
129
|
+
restaurants: [],
|
|
130
|
+
// 查询条件
|
|
131
|
+
searchValue: null,
|
|
132
|
+
searchStoreKey: 'searchDepartment',
|
|
133
|
+
// 单选时,选择的部门信息
|
|
134
|
+
selectNodeInfo: null,
|
|
135
|
+
// 公司根节点信息
|
|
136
|
+
tenantInfo: {},
|
|
137
|
+
searchResult: [],
|
|
138
|
+
selectResult: [],
|
|
139
|
+
// 控制右侧选择区的loading状态
|
|
140
|
+
isloading: false,
|
|
141
|
+
multiple: true,
|
|
142
|
+
memoryCacheKey: 'DEPARTMENT_MEMORY_KEY',
|
|
143
|
+
// 记忆选择数据, 搜索框获得焦点后,下拉显示最近选中的10个人,倒序排列,最后选中的在最上面显示。
|
|
144
|
+
memoryCacheData: [],
|
|
145
|
+
ElIconSearch,
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
name: 'InlineDepartmentMultiTree',
|
|
149
|
+
components: {
|
|
150
|
+
UserResult,
|
|
151
|
+
},
|
|
152
|
+
props: {
|
|
153
|
+
checkStrictly: {
|
|
154
|
+
type: Boolean,
|
|
155
|
+
default: false,
|
|
156
|
+
},
|
|
157
|
+
// 显示指定部门节点及其子节点,不传该属性,表示显示整个组织结构树
|
|
158
|
+
departmentInfo: {
|
|
159
|
+
type: Array,
|
|
160
|
+
default: null,
|
|
161
|
+
},
|
|
162
|
+
// 弹框的高度
|
|
163
|
+
height: {
|
|
164
|
+
type: String,
|
|
165
|
+
default: '300px',
|
|
166
|
+
},
|
|
167
|
+
// 多选部门树时,已选择部门id或部门名称或编码集合,多个之间以逗号隔开
|
|
168
|
+
selectDepartmentInfo: {
|
|
169
|
+
type: [String, Number],
|
|
170
|
+
default: null,
|
|
171
|
+
},
|
|
172
|
+
// 移除部门时,部门属性名称:id、name、code,默认是id
|
|
173
|
+
searchField: {
|
|
174
|
+
type: String,
|
|
175
|
+
default: 'id',
|
|
176
|
+
},
|
|
177
|
+
// 多选树时结果之间的分隔符,默认是逗号分隔
|
|
178
|
+
separator: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: ',',
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
computed: {},
|
|
184
|
+
watch: {
|
|
185
|
+
filterText(val) {
|
|
186
|
+
if (!val) {
|
|
187
|
+
this.searchValue = val
|
|
188
|
+
// 清空查询内容时,重新加载整个树
|
|
189
|
+
if (this.departmentInfo && this.departmentInfo.length > 0) {
|
|
190
|
+
// 加载指定部门时,展开公司节点
|
|
191
|
+
this.loadPointDepartments()
|
|
192
|
+
} else {
|
|
193
|
+
// 加载整个组织结构树时,展开公司节点
|
|
194
|
+
this.loadDepartment(this.tenantNodeId)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
created() {
|
|
200
|
+
this.initSelectDepts(
|
|
201
|
+
this.searchField,
|
|
202
|
+
this.selectDepartmentInfo,
|
|
203
|
+
this.separator
|
|
204
|
+
).then((selectUsers) => {
|
|
205
|
+
if (selectUsers) {
|
|
206
|
+
this.selectResult = selectUsers
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
},
|
|
210
|
+
mounted() {
|
|
211
|
+
var searchDepartment = localStorage.getObject(this.searchStoreKey)
|
|
212
|
+
if (searchDepartment) {
|
|
213
|
+
this.restaurants = searchDepartment
|
|
214
|
+
} else {
|
|
215
|
+
this.restaurants = []
|
|
216
|
+
}
|
|
217
|
+
this.getMemoryCacheData('department')
|
|
218
|
+
},
|
|
219
|
+
methods: {
|
|
220
|
+
...utils,
|
|
221
|
+
...departmentTreeService,
|
|
222
|
+
...memoryCacheUtils,
|
|
223
|
+
filterNode(value, data, node) {
|
|
224
|
+
if (!value) {
|
|
225
|
+
return true
|
|
226
|
+
} else {
|
|
227
|
+
return data.name.indexOf(value) !== -1
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
// 选中当前节点及其子节点
|
|
231
|
+
checkedNodeAndChildren(data) {
|
|
232
|
+
// 取消选中状态时,保持节点是展开的状态,不要折叠
|
|
233
|
+
// this.$refs.deparmentTree.store.nodesMap[data.id].expanded = true
|
|
234
|
+
let department = data
|
|
235
|
+
if (data.data) {
|
|
236
|
+
department = JSON.parse(data.data)
|
|
237
|
+
}
|
|
238
|
+
this.selectUser(null, department)
|
|
239
|
+
// 获得所有应该选中的节点
|
|
240
|
+
this.$refs.deparmentTree.setChecked(data.id, true)
|
|
241
|
+
const childDepartments = data.childDepartments
|
|
242
|
+
if (childDepartments && !this.checkStrictly) {
|
|
243
|
+
// 递归设置子子节点的选中状态
|
|
244
|
+
childDepartments.forEach((nodeData) => {
|
|
245
|
+
this.checkedNodeAndChildren(nodeData)
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
// 取消当前节点的子节点的选中状态
|
|
250
|
+
cancelChildCheckedNodes(data) {
|
|
251
|
+
const department = JSON.parse(data.data)
|
|
252
|
+
this.selectResult = this.removeRow(this.selectResult, department)
|
|
253
|
+
if (data.id !== this.tenantNodeId) {
|
|
254
|
+
// 如果当前节点不是公司节点,需要将公司节点的选中状态去掉
|
|
255
|
+
this.$refs.deparmentTree.setChecked(this.tenantNodeId, false)
|
|
256
|
+
}
|
|
257
|
+
const childDepartments = data.childDepartments
|
|
258
|
+
if (childDepartments && !this.checkStrictly) {
|
|
259
|
+
childDepartments.forEach((nodeData) => {
|
|
260
|
+
// 取消节点的选中状态
|
|
261
|
+
this.$refs.deparmentTree.setChecked(nodeData.id, false)
|
|
262
|
+
// 递归取消子子节点的选中状态
|
|
263
|
+
this.cancelChildCheckedNodes(nodeData)
|
|
264
|
+
})
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
handleCheckChange(data, checked, indeterminate) {},
|
|
268
|
+
handleNodeExpand(data, node, nodeTree) {},
|
|
269
|
+
handleNodeClick(data, node, nodeTree) {
|
|
270
|
+
// 多选部门树时,处理点击节点事件
|
|
271
|
+
this.clickNodeWhenMultiple(data)
|
|
272
|
+
},
|
|
273
|
+
// 多选树时,点击节点处理复选框的选中状态
|
|
274
|
+
clickNodeWhenMultiple(data) {
|
|
275
|
+
var checkedKeys = []
|
|
276
|
+
if (this.$refs.deparmentTree) {
|
|
277
|
+
checkedKeys = this.$refs.deparmentTree.getCheckedKeys()
|
|
278
|
+
}
|
|
279
|
+
if (checkedKeys && checkedKeys.indexOf(data.id) > -1) {
|
|
280
|
+
// 表示当前节点是选中状态,则需要取消其选中状态
|
|
281
|
+
// 取消当前节点的勾选状态
|
|
282
|
+
this.$refs.deparmentTree.setChecked(data.id, false)
|
|
283
|
+
// 取消当前节点的子节点的勾选状态
|
|
284
|
+
if (!this.checkStrictly) {
|
|
285
|
+
this.cancelChildCheckedNodes(data)
|
|
286
|
+
}
|
|
287
|
+
// 取消选中状态时,保持节点是展开的状态,不要折叠
|
|
288
|
+
this.$refs.deparmentTree.store.nodesMap[data.id].expanded = true
|
|
289
|
+
} else {
|
|
290
|
+
// 表示当前节点不是选中的状态,需要勾选该节点
|
|
291
|
+
if (data.nodeType && data.nodeType === 'DEPARTMENT' && data.data) {
|
|
292
|
+
// 表示当前选中的节点是部门
|
|
293
|
+
const department = JSON.parse(data.data)
|
|
294
|
+
this.selectUser(null, department)
|
|
295
|
+
}
|
|
296
|
+
this.$refs.deparmentTree.setChecked(data.id, true)
|
|
297
|
+
// 点击树节点时添加并展开节点会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
|
|
298
|
+
const children = data.childDepartments
|
|
299
|
+
if (children && children.length > 0) {
|
|
300
|
+
// 表示加载过该节点,直接选中即可
|
|
301
|
+
if (!this.checkStrictly) {
|
|
302
|
+
this.checkedNodeAndChildren(data)
|
|
303
|
+
}
|
|
304
|
+
} else {
|
|
305
|
+
// 表示没有加载过该节点,是首次加载,需要走后台
|
|
306
|
+
// 会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
|
|
307
|
+
this.isClickNode = true
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
isDepartmentNode(data) {
|
|
312
|
+
// 当前节点不是公司节点,也不是分支机构节点,表示是部门节点
|
|
313
|
+
return (
|
|
314
|
+
data.id !== this.tenantNodeId &&
|
|
315
|
+
data.nodeType &&
|
|
316
|
+
data.nodeType === 'DEPARTMENT' &&
|
|
317
|
+
!data.branch
|
|
318
|
+
)
|
|
319
|
+
},
|
|
320
|
+
selectDepartment() {
|
|
321
|
+
// 是否需要显示提示框,默认不显示
|
|
322
|
+
var showTip = false
|
|
323
|
+
var leafSelectNodeInfo = {
|
|
324
|
+
ids: [],
|
|
325
|
+
names: [],
|
|
326
|
+
codes: [],
|
|
327
|
+
zhNames: [],
|
|
328
|
+
enNames: [],
|
|
329
|
+
departments: [],
|
|
330
|
+
}
|
|
331
|
+
if (this.selectResult.length === 0) {
|
|
332
|
+
// 没有选择任何节点
|
|
333
|
+
showTip = true
|
|
334
|
+
} else {
|
|
335
|
+
for (var i = 0; i < this.selectResult.length; i++) {
|
|
336
|
+
var userData = this.selectResult[i]
|
|
337
|
+
// 不存在该用户则放到结果集合中,去掉重复使用
|
|
338
|
+
leafSelectNodeInfo.ids.push(userData.id)
|
|
339
|
+
leafSelectNodeInfo.codes.push(userData.code)
|
|
340
|
+
if (userData.enName) {
|
|
341
|
+
leafSelectNodeInfo.enNames.push(userData.enName)
|
|
342
|
+
} else {
|
|
343
|
+
leafSelectNodeInfo.enNames.push('')
|
|
344
|
+
}
|
|
345
|
+
if (userData.department) {
|
|
346
|
+
leafSelectNodeInfo.departments.push(userData.department)
|
|
347
|
+
} else {
|
|
348
|
+
leafSelectNodeInfo.departments.push(userData)
|
|
349
|
+
}
|
|
350
|
+
const name = userData.showName
|
|
351
|
+
leafSelectNodeInfo.names.push(name)
|
|
352
|
+
leafSelectNodeInfo.zhNames.push(userData.name)
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
if (leafSelectNodeInfo.ids.length > 0) {
|
|
356
|
+
leafSelectNodeInfo.containBranch = this.containBranch
|
|
357
|
+
$emit(this, 'result', leafSelectNodeInfo)
|
|
358
|
+
} else {
|
|
359
|
+
showTip = true
|
|
360
|
+
}
|
|
361
|
+
if (showTip) {
|
|
362
|
+
this.$alert(
|
|
363
|
+
this.$t('imatrixUIMessage.pleaseSelectDepartment'),
|
|
364
|
+
this.$t('imatrixUIMessage.tips'),
|
|
365
|
+
{
|
|
366
|
+
confirmButtonText: this.$t('imatrixUIPublicModel.sure'),
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
// 是否选中了公司节点
|
|
372
|
+
isSelectTenantNode(dataId) {
|
|
373
|
+
return (
|
|
374
|
+
dataId === this.tenantNodeId &&
|
|
375
|
+
(!this.departmentInfo || this.departmentInfo.length === 0)
|
|
376
|
+
)
|
|
377
|
+
},
|
|
378
|
+
// 给节点添加自定义图标
|
|
379
|
+
renderContent(h, { node, data, store }) {
|
|
380
|
+
var className
|
|
381
|
+
if (node.data.id === -1 || node.data.branch) {
|
|
382
|
+
// node.id ===-1表示公司节点,node.branch表示是分支机构节点
|
|
383
|
+
className = 'el-icon-menu'
|
|
384
|
+
} else if (node.data.id === -2 || node.data.id === -3) {
|
|
385
|
+
// node.id ===-2表示集团公司无部门用户节点,node.id ===-3表示是分支机构无部门用户节点
|
|
386
|
+
className = 'el-icon-tickets'
|
|
387
|
+
} else {
|
|
388
|
+
// 表示是部门节点
|
|
389
|
+
className = 'el-icon-date'
|
|
390
|
+
}
|
|
391
|
+
return (
|
|
392
|
+
`<span>
|
|
393
|
+
<i class={className}></i>
|
|
394
|
+
<span title={node.label}>{node.label}</span>
|
|
395
|
+
</span>`
|
|
396
|
+
)
|
|
397
|
+
},
|
|
398
|
+
// 将查询结果中指定用户添加到已选择用户集合中
|
|
399
|
+
selectUser(index, dept) {
|
|
400
|
+
// if (!this.isContainAllUser()) {
|
|
401
|
+
const containUsers = this.selectResult.filter(this.filterDept(dept))
|
|
402
|
+
if (containUsers && containUsers.length === 0) {
|
|
403
|
+
// 如果已选结果中不包含当前用户,则添加
|
|
404
|
+
// 将查询结果中的用户复制到已选择用户集合中
|
|
405
|
+
dept.tenantCode = this.tenantInfo.code
|
|
406
|
+
dept.tenantName = this.tenantInfo.tenantName
|
|
407
|
+
this.selectResult.push(dept)
|
|
408
|
+
// 搜索选中记忆
|
|
409
|
+
this.setMemoryCacheData(dept, 'department')
|
|
410
|
+
}
|
|
411
|
+
// } else {
|
|
412
|
+
// this.alertByAllUser()
|
|
413
|
+
// }
|
|
414
|
+
},
|
|
415
|
+
// 判断用户是否存在的过滤器
|
|
416
|
+
filterDept(queryDept) {
|
|
417
|
+
return (dept) => {
|
|
418
|
+
return dept.id === queryDept.id
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
filterDeptNode(queryDept) {
|
|
422
|
+
return (deptNodeId) => {
|
|
423
|
+
return deptNodeId + '' === queryDept.id + ''
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
// 从已选择用户集合中移除指定用户,并添加到查询结果集合中
|
|
427
|
+
removeUser(index, dept) {
|
|
428
|
+
// 表示是在组织结构树页面,需要将树的人员节点的选中状态去掉
|
|
429
|
+
if (dept.nodeId) {
|
|
430
|
+
const nodeId = dept.nodeId
|
|
431
|
+
if (this.$refs.deparmentTree && nodeId) {
|
|
432
|
+
this.$refs.deparmentTree.setChecked(nodeId, false)
|
|
433
|
+
}
|
|
434
|
+
} else {
|
|
435
|
+
if (this.$refs.deparmentTree) {
|
|
436
|
+
// 通过查询结果添加的用户,在返回到组织结构树时,也选中了该用户,在移除该用户时,需要去掉复选框的选中状态
|
|
437
|
+
const checkedKeys = this.$refs.deparmentTree.getCheckedKeys()
|
|
438
|
+
const currentCheckedUserNodeIds = checkedKeys.filter(
|
|
439
|
+
this.filterDeptNode(dept)
|
|
440
|
+
)
|
|
441
|
+
if (currentCheckedUserNodeIds.length > 0) {
|
|
442
|
+
// 表示当前用户是选中的状态,需要去掉
|
|
443
|
+
currentCheckedUserNodeIds.forEach((userNodeId) => {
|
|
444
|
+
this.$refs.deparmentTree.setChecked(userNodeId, false)
|
|
445
|
+
})
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
this.selectResult = this.removeRow(this.selectResult, dept)
|
|
450
|
+
if (!this.selectResult || this.selectResult.length === 0) {
|
|
451
|
+
// 已选结果面板没有内容,则左侧树节点也不要有选中节点了
|
|
452
|
+
if (this.$refs.deparmentTree) {
|
|
453
|
+
this.$refs.deparmentTree.setCheckedKeys([])
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
emits: ['result'],
|
|
459
|
+
}
|
|
460
|
+
</script>
|
|
461
|
+
|
|
462
|
+
<style>
|
|
463
|
+
.searchResult {
|
|
464
|
+
color: red;
|
|
465
|
+
}
|
|
466
|
+
.inline-input-custom {
|
|
467
|
+
width: 90%;
|
|
468
|
+
}
|
|
469
|
+
.el-autocomplete-suggestion.el-popper {
|
|
470
|
+
min-width: 300px;
|
|
471
|
+
}
|
|
472
|
+
</style>
|