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,516 +1,516 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<el-container style="height: 395px">
|
|
4
|
-
<el-aside width="430px">
|
|
5
|
-
<el-container style="height: 390px">
|
|
6
|
-
<el-header style="text-align: right; font-size: 12px">
|
|
7
|
-
<el-autocomplete
|
|
8
|
-
v-model="filterText"
|
|
9
|
-
select-when-unmatched
|
|
10
|
-
class="inline-input inline-input-custom"
|
|
11
|
-
:fetch-suggestions="querySearch"
|
|
12
|
-
:placeholder="$t('imatrixUIMessage.pleaseEnterTeamName')"
|
|
13
|
-
:trigger-on-focus="false"
|
|
14
|
-
@select="handleSelect"
|
|
15
|
-
@keyup.enter="clickSearch"
|
|
16
|
-
>
|
|
17
|
-
<template v-slot:append>
|
|
18
|
-
<el-button :icon="ElIconSearch" @click="clickSearch" />
|
|
19
|
-
</template>
|
|
20
|
-
</el-autocomplete>
|
|
21
|
-
</el-header>
|
|
22
|
-
<el-main>
|
|
23
|
-
<div
|
|
24
|
-
v-if="!searchValue"
|
|
25
|
-
style="
|
|
26
|
-
padding-top: 5px;
|
|
27
|
-
overflow: auto;
|
|
28
|
-
width: auto;
|
|
29
|
-
display: inline-block !important;
|
|
30
|
-
"
|
|
31
|
-
>
|
|
32
|
-
<el-tree
|
|
33
|
-
ref="workgroupTree"
|
|
34
|
-
:props="defaultProps"
|
|
35
|
-
:load="loadNode"
|
|
36
|
-
lazy
|
|
37
|
-
:show-checkbox="multiple"
|
|
38
|
-
node-key="id"
|
|
39
|
-
:render-content="renderContent"
|
|
40
|
-
:filter-node-method="filterNode"
|
|
41
|
-
@check="handleCheckNode"
|
|
42
|
-
@node-click="handleNodeClick"
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
|
-
<div
|
|
46
|
-
v-if="searchValue && searchValue.length > 0"
|
|
47
|
-
style="height: 100%; overflow: hidden"
|
|
48
|
-
>
|
|
49
|
-
<workgroup-result
|
|
50
|
-
ref="workgroupResult"
|
|
51
|
-
:grid-data="searchResult"
|
|
52
|
-
:select-result="selectResult"
|
|
53
|
-
:height="height"
|
|
54
|
-
:multiple="multiple"
|
|
55
|
-
:is-search-result="true"
|
|
56
|
-
@selectResult="getSelectWorkgroup"
|
|
57
|
-
@resultRowDblclick="resultRowDblclick"
|
|
58
|
-
@addWorkgroup="addWorkgroup"
|
|
59
|
-
/>
|
|
60
|
-
</div>
|
|
61
|
-
</el-main>
|
|
62
|
-
</el-container>
|
|
63
|
-
</el-aside>
|
|
64
|
-
<el-container v-if="multiple">
|
|
65
|
-
<el-aside width="2px">
|
|
66
|
-
<table
|
|
67
|
-
border="1px"
|
|
68
|
-
cellpadding="0"
|
|
69
|
-
cellspacing="0"
|
|
70
|
-
style="
|
|
71
|
-
height: 100%;
|
|
72
|
-
border-left-style: solid;
|
|
73
|
-
border-bottom-style: none;
|
|
74
|
-
border-right-style: none;
|
|
75
|
-
border-top-style: none;
|
|
76
|
-
border-left-color: #cccccc;
|
|
77
|
-
"
|
|
78
|
-
/>
|
|
79
|
-
</el-aside>
|
|
80
|
-
<el-main style="padding: 10px">
|
|
81
|
-
<div style="text-align: left; font-size: 16px">
|
|
82
|
-
{{ $t('imatrixUIMessage.selectedWorkingGroup') }}:
|
|
83
|
-
</div>
|
|
84
|
-
<div :style="'padding-top: 5px;height:90%;overflow: hidden;'">
|
|
85
|
-
<workgroup-result
|
|
86
|
-
:grid-data="selectResult"
|
|
87
|
-
:height="height"
|
|
88
|
-
:multiple="multiple"
|
|
89
|
-
:is-search-result="false"
|
|
90
|
-
@selectResult="getSelectWorkgroup"
|
|
91
|
-
@resultRowDblclick="resultRowDblclick"
|
|
92
|
-
@removeWorkgroup="removeWorkgroup"
|
|
93
|
-
/>
|
|
94
|
-
</div>
|
|
95
|
-
</el-main>
|
|
96
|
-
</el-container>
|
|
97
|
-
</el-container>
|
|
98
|
-
</div>
|
|
99
|
-
</template>
|
|
100
|
-
|
|
101
|
-
<script>
|
|
102
|
-
import { Search as ElIconSearch } from '@element-plus/icons-vue'
|
|
103
|
-
import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
|
|
104
|
-
import localStorage from '../../../src/utils/local-storage'
|
|
105
|
-
import utils from '../../utils/utils'
|
|
106
|
-
import workgroupTreeService from './workgroup-tree-service'
|
|
107
|
-
import WorkgroupResult from './search-result.vue'
|
|
108
|
-
export default {
|
|
109
|
-
data() {
|
|
110
|
-
return {
|
|
111
|
-
filterText: '',
|
|
112
|
-
defaultProps: {
|
|
113
|
-
id: 'id',
|
|
114
|
-
label: 'name',
|
|
115
|
-
children: 'children',
|
|
116
|
-
isLeaf: 'leaf',
|
|
117
|
-
},
|
|
118
|
-
// 当前租户内是否包含分支机构。获得当前选中部门名称时,如果有分支,则需要将分支名称返回给工作组,例如:部门1(分支1)
|
|
119
|
-
containBranch: false,
|
|
120
|
-
// 公司节点的id
|
|
121
|
-
tenantNodeId: -1,
|
|
122
|
-
// 查询的备选值
|
|
123
|
-
restaurants: [],
|
|
124
|
-
// 查询条件
|
|
125
|
-
searchValue: null,
|
|
126
|
-
// 工作组的查询结果
|
|
127
|
-
searchResult: [],
|
|
128
|
-
// 工作组的选中结果
|
|
129
|
-
selectResult: [],
|
|
130
|
-
searchStoreKey: 'searchWorkgroup',
|
|
131
|
-
// 单选时,选择的工作组信息
|
|
132
|
-
selectNodeInfo: null,
|
|
133
|
-
selectWorkgroupData: null,
|
|
134
|
-
// 公司根节点信息
|
|
135
|
-
tenantInfo: {},
|
|
136
|
-
ElIconSearch,
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
name: 'InlineWorkgroupTree',
|
|
140
|
-
components: {
|
|
141
|
-
WorkgroupResult,
|
|
142
|
-
},
|
|
143
|
-
props: {
|
|
144
|
-
// 是否是多选树,默认是true
|
|
145
|
-
multiple: {
|
|
146
|
-
type: Boolean,
|
|
147
|
-
default: true,
|
|
148
|
-
},
|
|
149
|
-
// 显示指定部门节点及其子节点,不传该属性,表示显示整个组织结构树
|
|
150
|
-
branchInfo: {
|
|
151
|
-
type: Array,
|
|
152
|
-
default: null,
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
computed: {},
|
|
156
|
-
watch: {
|
|
157
|
-
filterText(val) {
|
|
158
|
-
if (!val) {
|
|
159
|
-
this.searchValue = val
|
|
160
|
-
// 清空查询内容时,重新加载整个树
|
|
161
|
-
this.loadWorkgroup(this.tenantNodeId)
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
mounted() {
|
|
166
|
-
var searchWorkgroup = localStorage.getObject(this.searchStoreKey)
|
|
167
|
-
if (searchWorkgroup) {
|
|
168
|
-
this.restaurants = searchWorkgroup
|
|
169
|
-
} else {
|
|
170
|
-
this.restaurants = []
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
methods: {
|
|
174
|
-
...utils,
|
|
175
|
-
...workgroupTreeService,
|
|
176
|
-
// 将查询结果中指定工作组添加到已选择工作组集合中
|
|
177
|
-
addWorkgroup(index, workgroup) {
|
|
178
|
-
const containWorkgroups = this.selectResult.filter(
|
|
179
|
-
this.filterWorkgroup(workgroup)
|
|
180
|
-
)
|
|
181
|
-
if (containWorkgroups && containWorkgroups.length === 0) {
|
|
182
|
-
this.selectResult.push(workgroup)
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
filterWorkgroup(queryWorkgroup) {
|
|
186
|
-
return (workgroup) => {
|
|
187
|
-
return workgroup.id === queryWorkgroup.id
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
removeWorkgroup(index, workgroup) {
|
|
191
|
-
if (this.$refs.workgroupTree) {
|
|
192
|
-
// 通过查询结果添加的工作组,在返回到组织结构树时,也选中了该工作组,在移除该工作组时,需要去掉复选框的选中状态
|
|
193
|
-
const checkedKeys = this.$refs.workgroupTree.getCheckedKeys()
|
|
194
|
-
const currentCheckedWorkgroupNodeIds = checkedKeys.filter(
|
|
195
|
-
this.filterWorkgroupNode(workgroup)
|
|
196
|
-
)
|
|
197
|
-
if (currentCheckedWorkgroupNodeIds.length > 0) {
|
|
198
|
-
// 表示当前工作组是选中的状态,需要去掉
|
|
199
|
-
currentCheckedWorkgroupNodeIds.forEach((workgroupNodeId) => {
|
|
200
|
-
this.$refs.workgroupTree.setChecked(workgroupNodeId, false)
|
|
201
|
-
})
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
this.selectResult = this.removeRow(this.selectResult, workgroup)
|
|
205
|
-
if (!this.selectResult || this.selectResult.length === 0) {
|
|
206
|
-
// 已选结果面板没有内容,则左侧树节点也不要有选中节点了
|
|
207
|
-
if (this.$refs.workgroupTree) {
|
|
208
|
-
this.$refs.workgroupTree.setCheckedKeys([])
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
filterWorkgroupNode(queryWorkgroup) {
|
|
213
|
-
return (workgroupNodeId) => {
|
|
214
|
-
return workgroupNodeId === queryWorkgroup.id
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
getSelectWorkgroup(workgroup) {
|
|
218
|
-
this.packageSelectResult(workgroup)
|
|
219
|
-
},
|
|
220
|
-
resultRowDblclick(workgroup) {
|
|
221
|
-
this.packageSelectResult(workgroup)
|
|
222
|
-
$emit(this, 'result', this.selectNodeInfo)
|
|
223
|
-
},
|
|
224
|
-
packageSelectResult(workgroup) {
|
|
225
|
-
workgroup.tenantCode = this.tenantInfo.code
|
|
226
|
-
workgroup.tenantName = this.tenantInfo.tenantName
|
|
227
|
-
const selectNodeInfo = {
|
|
228
|
-
id: workgroup.id,
|
|
229
|
-
name: workgroup.name,
|
|
230
|
-
code: workgroup.code,
|
|
231
|
-
subCompanyName: workgroup.subCompanyName,
|
|
232
|
-
workgroup: workgroup,
|
|
233
|
-
}
|
|
234
|
-
// 表示是勾选单选按钮或 选中树节点
|
|
235
|
-
this.selectNodeInfo = selectNodeInfo
|
|
236
|
-
},
|
|
237
|
-
handleSelect(item) {
|
|
238
|
-
this.handleSelectUtil(item, localStorage)
|
|
239
|
-
},
|
|
240
|
-
search(value) {
|
|
241
|
-
this.searchValue = value
|
|
242
|
-
this.$refs.workgroupTree.filter(value)
|
|
243
|
-
},
|
|
244
|
-
// 点击查询按钮调用的方法
|
|
245
|
-
clickSearch() {
|
|
246
|
-
this.storeSeachValue(localStorage, this.searchStoreKey, this.filterText)
|
|
247
|
-
this.search(this.filterText)
|
|
248
|
-
},
|
|
249
|
-
filterNode(value, data, node) {
|
|
250
|
-
if (!value) {
|
|
251
|
-
return true
|
|
252
|
-
} else {
|
|
253
|
-
var workgroupName = data.name
|
|
254
|
-
if (data.id === this.tenantNodeId) {
|
|
255
|
-
// 表示是根节点公司节点
|
|
256
|
-
return false
|
|
257
|
-
} else if (this.containBranch) {
|
|
258
|
-
// 如果包含分支,工作组节点显示的格式为:工作组名称(分支名称)
|
|
259
|
-
workgroupName = workgroupName.substring(
|
|
260
|
-
0,
|
|
261
|
-
workgroupName.lastIndexOf('(')
|
|
262
|
-
)
|
|
263
|
-
}
|
|
264
|
-
return workgroupName.indexOf(value) !== -1
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
// 点击复选框时处理
|
|
268
|
-
handleCheckNode(data, checkObj) {
|
|
269
|
-
if (checkObj.checkedKeys.indexOf(data.id) > -1) {
|
|
270
|
-
// 表示正选中data节点
|
|
271
|
-
if (data.id === this.tenantNodeId) {
|
|
272
|
-
// 表示选中了公司节点
|
|
273
|
-
this.checkedAllWorkgroups(data)
|
|
274
|
-
} else {
|
|
275
|
-
this.selectResult.push(JSON.parse(data.data))
|
|
276
|
-
}
|
|
277
|
-
} else {
|
|
278
|
-
// 表示正取消选中data节点,同时要取消其子节点的选中状态
|
|
279
|
-
if (data.id === this.tenantNodeId) {
|
|
280
|
-
// 表示取消公司节点的选中状态,即取消所有节点的勾选状态
|
|
281
|
-
this.$refs.workgroupTree.setCheckedKeys([])
|
|
282
|
-
} else {
|
|
283
|
-
this.selectResult = this.removeRow(
|
|
284
|
-
this.selectResult,
|
|
285
|
-
JSON.parse(data.data)
|
|
286
|
-
)
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
// 选中了根节点公司节点时,选中所有工作组
|
|
291
|
-
checkedAllWorkgroups(root) {
|
|
292
|
-
const children = root.children
|
|
293
|
-
if (children) {
|
|
294
|
-
children.forEach((workgroupNode) => {
|
|
295
|
-
this.$refs.workgroupTree.setChecked(workgroupNode.id, true)
|
|
296
|
-
})
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
handleNodeClick(data, node, nodeTree) {
|
|
300
|
-
if (this.multiple) {
|
|
301
|
-
// 多选部门树时,处理点击节点事件
|
|
302
|
-
this.clickNodeWhenMultiple(data)
|
|
303
|
-
}
|
|
304
|
-
this.selectSingleNode(data, false)
|
|
305
|
-
},
|
|
306
|
-
selectSingleNode(data, isClickOkBtn) {
|
|
307
|
-
if (this.isWorkgroupNode(data) && !this.multiple) {
|
|
308
|
-
// 点击的是工作组节点,并且是单选树时,点击部门节点直接关闭弹框
|
|
309
|
-
const workgroup = JSON.parse(data.data)
|
|
310
|
-
workgroup.tenantCode = this.tenantInfo.code
|
|
311
|
-
workgroup.tenantName = this.tenantInfo.tenantName
|
|
312
|
-
var selectNodeInfo = {
|
|
313
|
-
id: data.id,
|
|
314
|
-
name: data.name,
|
|
315
|
-
code: workgroup.code,
|
|
316
|
-
containBranch: this.containBranch,
|
|
317
|
-
workgroup: workgroup,
|
|
318
|
-
}
|
|
319
|
-
this.selectNodeInfo = selectNodeInfo
|
|
320
|
-
if (isClickOkBtn === true) {
|
|
321
|
-
// 点击确定按钮时才需要调result回调事件,关闭弹框
|
|
322
|
-
$emit(this, 'result', selectNodeInfo)
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
// 多选树时,点击节点处理复选框的选中状态
|
|
327
|
-
clickNodeWhenMultiple(data) {
|
|
328
|
-
var checkedKeys = []
|
|
329
|
-
if (this.$refs.workgroupTree) {
|
|
330
|
-
checkedKeys = this.$refs.workgroupTree.getCheckedKeys()
|
|
331
|
-
}
|
|
332
|
-
// 取消选中状态时,保持节点是展开的状态,不要折叠
|
|
333
|
-
this.$refs.workgroupTree.store.nodesMap[data.id].expanded = true
|
|
334
|
-
if (checkedKeys.indexOf(data.id) > -1) {
|
|
335
|
-
// 表示当前节点是选中状态,则需要取消其选中状态
|
|
336
|
-
// 取消当前节点的勾选状态
|
|
337
|
-
this.$refs.workgroupTree.setChecked(data.id, false)
|
|
338
|
-
if (data.id === this.tenantNodeId) {
|
|
339
|
-
// 表示取消公司节点的选中状态,即取消所有节点的勾选状态
|
|
340
|
-
this.$refs.workgroupTree.setCheckedKeys([])
|
|
341
|
-
} else {
|
|
342
|
-
this.selectResult = this.removeRow(
|
|
343
|
-
this.selectResult,
|
|
344
|
-
JSON.parse(data.data)
|
|
345
|
-
)
|
|
346
|
-
}
|
|
347
|
-
} else {
|
|
348
|
-
// 表示当前节点不是选中的状态,需要勾选该节点
|
|
349
|
-
this.$refs.workgroupTree.setChecked(data.id, true)
|
|
350
|
-
if (data.id === this.tenantNodeId) {
|
|
351
|
-
// 表示当前正选中根节点公司节点,则需要勾选所有节点的选中状态
|
|
352
|
-
this.checkedAllWorkgroups(data)
|
|
353
|
-
} else {
|
|
354
|
-
this.selectResult.push(JSON.parse(data.data))
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
},
|
|
358
|
-
isWorkgroupNode(data) {
|
|
359
|
-
// 当前节点不是公司节点,也不是分支机构节点,表示是部门节点
|
|
360
|
-
return (
|
|
361
|
-
data.id !== this.tenantNodeId &&
|
|
362
|
-
data.nodeType &&
|
|
363
|
-
data.nodeType === 'WORKGROUP'
|
|
364
|
-
)
|
|
365
|
-
},
|
|
366
|
-
singleSetValue() {
|
|
367
|
-
let showTip = false
|
|
368
|
-
if (this.searchValue) {
|
|
369
|
-
if (this.selectNodeInfo) {
|
|
370
|
-
$emit(this, 'result', this.selectNodeInfo)
|
|
371
|
-
} else {
|
|
372
|
-
showTip = true
|
|
373
|
-
}
|
|
374
|
-
} else {
|
|
375
|
-
const data = this.$refs.workgroupTree.getCurrentNode()
|
|
376
|
-
if (data && data !== null && this.isWorkgroupNode(data)) {
|
|
377
|
-
this.selectSingleNode(data, true)
|
|
378
|
-
} else {
|
|
379
|
-
showTip = true
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
this.showTip(showTip)
|
|
383
|
-
},
|
|
384
|
-
multipleSetValue() {
|
|
385
|
-
let showTip = false
|
|
386
|
-
var selectNodeInfo = {
|
|
387
|
-
ids: [],
|
|
388
|
-
names: [],
|
|
389
|
-
codes: [],
|
|
390
|
-
workgroups: [],
|
|
391
|
-
}
|
|
392
|
-
if (this.searchValue) {
|
|
393
|
-
if (this.selectResult.length > 0) {
|
|
394
|
-
this.selectResult.forEach((workgroupData) => {
|
|
395
|
-
const node = {
|
|
396
|
-
id: workgroupData.id,
|
|
397
|
-
name: workgroupData.name,
|
|
398
|
-
code: workgroupData.code,
|
|
399
|
-
}
|
|
400
|
-
this.addSelectedWorkgroupInfo(selectNodeInfo, node, workgroupData)
|
|
401
|
-
})
|
|
402
|
-
$emit(this, 'result', selectNodeInfo)
|
|
403
|
-
} else {
|
|
404
|
-
showTip = true
|
|
405
|
-
}
|
|
406
|
-
} else {
|
|
407
|
-
var nodes = this.$refs.workgroupTree.getCheckedNodes()
|
|
408
|
-
if (nodes) {
|
|
409
|
-
if (nodes.length === 0) {
|
|
410
|
-
// 没有选择任何节点
|
|
411
|
-
showTip = true
|
|
412
|
-
} else {
|
|
413
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
414
|
-
var node = nodes[i]
|
|
415
|
-
if (node.id !== this.tenantNodeId) {
|
|
416
|
-
// 不是公司根节点,表示是工作组节点,直接存到结果集合中
|
|
417
|
-
// node.data是部门对象的json字符串信息,通过JSON.parse(node.data)将json字符串转为对象
|
|
418
|
-
const workgroupData = JSON.parse(node.data)
|
|
419
|
-
this.addSelectedWorkgroupInfo(
|
|
420
|
-
selectNodeInfo,
|
|
421
|
-
node,
|
|
422
|
-
workgroupData
|
|
423
|
-
)
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
if (selectNodeInfo.ids.length > 0) {
|
|
427
|
-
$emit(this, 'result', selectNodeInfo)
|
|
428
|
-
} else {
|
|
429
|
-
showTip = true
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
} else {
|
|
433
|
-
showTip = true
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
this.showTip(showTip)
|
|
437
|
-
},
|
|
438
|
-
selectWorkgroup() {
|
|
439
|
-
if (this.multiple) {
|
|
440
|
-
this.multipleSetValue()
|
|
441
|
-
} else {
|
|
442
|
-
this.singleSetValue()
|
|
443
|
-
}
|
|
444
|
-
},
|
|
445
|
-
showTip(showTip) {
|
|
446
|
-
// 是否需要显示提示框,默认不显示
|
|
447
|
-
if (showTip) {
|
|
448
|
-
this.$alert(
|
|
449
|
-
this.$t('imatrixUIMessage.pleaseSelectATeam'),
|
|
450
|
-
this.$t('imatrixUIMessage.tips'),
|
|
451
|
-
{
|
|
452
|
-
confirmButtonText: this.$t('imatrixUIPublicModel.sure'),
|
|
453
|
-
}
|
|
454
|
-
)
|
|
455
|
-
}
|
|
456
|
-
},
|
|
457
|
-
// 将选中的部门节点添加到结果集合中
|
|
458
|
-
addSelectedWorkgroupInfo(result, node, workgroup) {
|
|
459
|
-
workgroup.tenantCode = this.tenantInfo.code
|
|
460
|
-
workgroup.tenantName = this.tenantInfo.tenantName
|
|
461
|
-
result.containBranch = this.containBranch
|
|
462
|
-
result.ids.push(node.id)
|
|
463
|
-
result.workgroups.push(workgroup)
|
|
464
|
-
result.codes.push(workgroup.code)
|
|
465
|
-
result.names.push(node.name)
|
|
466
|
-
},
|
|
467
|
-
// 初始化树 或 点击三角展开节点时动态加载子节点
|
|
468
|
-
loadNode(node, resolve) {
|
|
469
|
-
var parentId = 0
|
|
470
|
-
if (node.level === 0) {
|
|
471
|
-
// 表示初始化树
|
|
472
|
-
parentId = 0
|
|
473
|
-
} else {
|
|
474
|
-
parentId = node.data.id
|
|
475
|
-
}
|
|
476
|
-
var checkedKeys = []
|
|
477
|
-
if (this.$refs.workgroupTree) {
|
|
478
|
-
checkedKeys = this.$refs.workgroupTree.getCheckedKeys()
|
|
479
|
-
}
|
|
480
|
-
// 初始化部门树
|
|
481
|
-
this.initLoad(parentId, node, resolve, checkedKeys)
|
|
482
|
-
},
|
|
483
|
-
// 给节点添加自定义图标
|
|
484
|
-
renderContent(h, { node, data, store }) {
|
|
485
|
-
var className
|
|
486
|
-
if (node.data.id === -1) {
|
|
487
|
-
// node.id ===-1表示公司节点,node.branch表示是分支机构节点
|
|
488
|
-
className = 'el-icon-menu'
|
|
489
|
-
} else {
|
|
490
|
-
// 表示是工作组节点
|
|
491
|
-
className = 'el-icon-date'
|
|
492
|
-
}
|
|
493
|
-
if (
|
|
494
|
-
data.nodeType &&
|
|
495
|
-
data.nodeType === 'WORKGROUP' &&
|
|
496
|
-
this.searchValue &&
|
|
497
|
-
data.name.indexOf(this.searchValue) > -1
|
|
498
|
-
) {
|
|
499
|
-
// 如果是查询条件
|
|
500
|
-
return `<span><i class={className}></i><span class="searchResult" title={node.label}>{node.label}</span></span>`
|
|
501
|
-
}
|
|
502
|
-
return `<span><i class={className}></i><span title={node.label}>{node.label}</span></span>`
|
|
503
|
-
},
|
|
504
|
-
},
|
|
505
|
-
emits: ['result'],
|
|
506
|
-
}
|
|
507
|
-
</script>
|
|
508
|
-
|
|
509
|
-
<style>
|
|
510
|
-
.searchResult {
|
|
511
|
-
color: red;
|
|
512
|
-
}
|
|
513
|
-
.inline-input-custom {
|
|
514
|
-
width: 90%;
|
|
515
|
-
}
|
|
516
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-container style="height: 395px">
|
|
4
|
+
<el-aside width="430px">
|
|
5
|
+
<el-container style="height: 390px">
|
|
6
|
+
<el-header style="text-align: right; font-size: 12px">
|
|
7
|
+
<el-autocomplete
|
|
8
|
+
v-model="filterText"
|
|
9
|
+
select-when-unmatched
|
|
10
|
+
class="inline-input inline-input-custom"
|
|
11
|
+
:fetch-suggestions="querySearch"
|
|
12
|
+
:placeholder="$t('imatrixUIMessage.pleaseEnterTeamName')"
|
|
13
|
+
:trigger-on-focus="false"
|
|
14
|
+
@select="handleSelect"
|
|
15
|
+
@keyup.enter="clickSearch"
|
|
16
|
+
>
|
|
17
|
+
<template v-slot:append>
|
|
18
|
+
<el-button :icon="ElIconSearch" @click="clickSearch" />
|
|
19
|
+
</template>
|
|
20
|
+
</el-autocomplete>
|
|
21
|
+
</el-header>
|
|
22
|
+
<el-main>
|
|
23
|
+
<div
|
|
24
|
+
v-if="!searchValue"
|
|
25
|
+
style="
|
|
26
|
+
padding-top: 5px;
|
|
27
|
+
overflow: auto;
|
|
28
|
+
width: auto;
|
|
29
|
+
display: inline-block !important;
|
|
30
|
+
"
|
|
31
|
+
>
|
|
32
|
+
<el-tree
|
|
33
|
+
ref="workgroupTree"
|
|
34
|
+
:props="defaultProps"
|
|
35
|
+
:load="loadNode"
|
|
36
|
+
lazy
|
|
37
|
+
:show-checkbox="multiple"
|
|
38
|
+
node-key="id"
|
|
39
|
+
:render-content="renderContent"
|
|
40
|
+
:filter-node-method="filterNode"
|
|
41
|
+
@check="handleCheckNode"
|
|
42
|
+
@node-click="handleNodeClick"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
<div
|
|
46
|
+
v-if="searchValue && searchValue.length > 0"
|
|
47
|
+
style="height: 100%; overflow: hidden"
|
|
48
|
+
>
|
|
49
|
+
<workgroup-result
|
|
50
|
+
ref="workgroupResult"
|
|
51
|
+
:grid-data="searchResult"
|
|
52
|
+
:select-result="selectResult"
|
|
53
|
+
:height="height"
|
|
54
|
+
:multiple="multiple"
|
|
55
|
+
:is-search-result="true"
|
|
56
|
+
@selectResult="getSelectWorkgroup"
|
|
57
|
+
@resultRowDblclick="resultRowDblclick"
|
|
58
|
+
@addWorkgroup="addWorkgroup"
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
</el-main>
|
|
62
|
+
</el-container>
|
|
63
|
+
</el-aside>
|
|
64
|
+
<el-container v-if="multiple">
|
|
65
|
+
<el-aside width="2px">
|
|
66
|
+
<table
|
|
67
|
+
border="1px"
|
|
68
|
+
cellpadding="0"
|
|
69
|
+
cellspacing="0"
|
|
70
|
+
style="
|
|
71
|
+
height: 100%;
|
|
72
|
+
border-left-style: solid;
|
|
73
|
+
border-bottom-style: none;
|
|
74
|
+
border-right-style: none;
|
|
75
|
+
border-top-style: none;
|
|
76
|
+
border-left-color: #cccccc;
|
|
77
|
+
"
|
|
78
|
+
/>
|
|
79
|
+
</el-aside>
|
|
80
|
+
<el-main style="padding: 10px">
|
|
81
|
+
<div style="text-align: left; font-size: 16px">
|
|
82
|
+
{{ $t('imatrixUIMessage.selectedWorkingGroup') }}:
|
|
83
|
+
</div>
|
|
84
|
+
<div :style="'padding-top: 5px;height:90%;overflow: hidden;'">
|
|
85
|
+
<workgroup-result
|
|
86
|
+
:grid-data="selectResult"
|
|
87
|
+
:height="height"
|
|
88
|
+
:multiple="multiple"
|
|
89
|
+
:is-search-result="false"
|
|
90
|
+
@selectResult="getSelectWorkgroup"
|
|
91
|
+
@resultRowDblclick="resultRowDblclick"
|
|
92
|
+
@removeWorkgroup="removeWorkgroup"
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
</el-main>
|
|
96
|
+
</el-container>
|
|
97
|
+
</el-container>
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script>
|
|
102
|
+
import { Search as ElIconSearch } from '@element-plus/icons-vue'
|
|
103
|
+
import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
|
|
104
|
+
import localStorage from '../../../src/utils/local-storage'
|
|
105
|
+
import utils from '../../utils/utils'
|
|
106
|
+
import workgroupTreeService from './workgroup-tree-service'
|
|
107
|
+
import WorkgroupResult from './search-result.vue'
|
|
108
|
+
export default {
|
|
109
|
+
data() {
|
|
110
|
+
return {
|
|
111
|
+
filterText: '',
|
|
112
|
+
defaultProps: {
|
|
113
|
+
id: 'id',
|
|
114
|
+
label: 'name',
|
|
115
|
+
children: 'children',
|
|
116
|
+
isLeaf: 'leaf',
|
|
117
|
+
},
|
|
118
|
+
// 当前租户内是否包含分支机构。获得当前选中部门名称时,如果有分支,则需要将分支名称返回给工作组,例如:部门1(分支1)
|
|
119
|
+
containBranch: false,
|
|
120
|
+
// 公司节点的id
|
|
121
|
+
tenantNodeId: -1,
|
|
122
|
+
// 查询的备选值
|
|
123
|
+
restaurants: [],
|
|
124
|
+
// 查询条件
|
|
125
|
+
searchValue: null,
|
|
126
|
+
// 工作组的查询结果
|
|
127
|
+
searchResult: [],
|
|
128
|
+
// 工作组的选中结果
|
|
129
|
+
selectResult: [],
|
|
130
|
+
searchStoreKey: 'searchWorkgroup',
|
|
131
|
+
// 单选时,选择的工作组信息
|
|
132
|
+
selectNodeInfo: null,
|
|
133
|
+
selectWorkgroupData: null,
|
|
134
|
+
// 公司根节点信息
|
|
135
|
+
tenantInfo: {},
|
|
136
|
+
ElIconSearch,
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
name: 'InlineWorkgroupTree',
|
|
140
|
+
components: {
|
|
141
|
+
WorkgroupResult,
|
|
142
|
+
},
|
|
143
|
+
props: {
|
|
144
|
+
// 是否是多选树,默认是true
|
|
145
|
+
multiple: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
default: true,
|
|
148
|
+
},
|
|
149
|
+
// 显示指定部门节点及其子节点,不传该属性,表示显示整个组织结构树
|
|
150
|
+
branchInfo: {
|
|
151
|
+
type: Array,
|
|
152
|
+
default: null,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
computed: {},
|
|
156
|
+
watch: {
|
|
157
|
+
filterText(val) {
|
|
158
|
+
if (!val) {
|
|
159
|
+
this.searchValue = val
|
|
160
|
+
// 清空查询内容时,重新加载整个树
|
|
161
|
+
this.loadWorkgroup(this.tenantNodeId)
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
mounted() {
|
|
166
|
+
var searchWorkgroup = localStorage.getObject(this.searchStoreKey)
|
|
167
|
+
if (searchWorkgroup) {
|
|
168
|
+
this.restaurants = searchWorkgroup
|
|
169
|
+
} else {
|
|
170
|
+
this.restaurants = []
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
methods: {
|
|
174
|
+
...utils,
|
|
175
|
+
...workgroupTreeService,
|
|
176
|
+
// 将查询结果中指定工作组添加到已选择工作组集合中
|
|
177
|
+
addWorkgroup(index, workgroup) {
|
|
178
|
+
const containWorkgroups = this.selectResult.filter(
|
|
179
|
+
this.filterWorkgroup(workgroup)
|
|
180
|
+
)
|
|
181
|
+
if (containWorkgroups && containWorkgroups.length === 0) {
|
|
182
|
+
this.selectResult.push(workgroup)
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
filterWorkgroup(queryWorkgroup) {
|
|
186
|
+
return (workgroup) => {
|
|
187
|
+
return workgroup.id === queryWorkgroup.id
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
removeWorkgroup(index, workgroup) {
|
|
191
|
+
if (this.$refs.workgroupTree) {
|
|
192
|
+
// 通过查询结果添加的工作组,在返回到组织结构树时,也选中了该工作组,在移除该工作组时,需要去掉复选框的选中状态
|
|
193
|
+
const checkedKeys = this.$refs.workgroupTree.getCheckedKeys()
|
|
194
|
+
const currentCheckedWorkgroupNodeIds = checkedKeys.filter(
|
|
195
|
+
this.filterWorkgroupNode(workgroup)
|
|
196
|
+
)
|
|
197
|
+
if (currentCheckedWorkgroupNodeIds.length > 0) {
|
|
198
|
+
// 表示当前工作组是选中的状态,需要去掉
|
|
199
|
+
currentCheckedWorkgroupNodeIds.forEach((workgroupNodeId) => {
|
|
200
|
+
this.$refs.workgroupTree.setChecked(workgroupNodeId, false)
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
this.selectResult = this.removeRow(this.selectResult, workgroup)
|
|
205
|
+
if (!this.selectResult || this.selectResult.length === 0) {
|
|
206
|
+
// 已选结果面板没有内容,则左侧树节点也不要有选中节点了
|
|
207
|
+
if (this.$refs.workgroupTree) {
|
|
208
|
+
this.$refs.workgroupTree.setCheckedKeys([])
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
filterWorkgroupNode(queryWorkgroup) {
|
|
213
|
+
return (workgroupNodeId) => {
|
|
214
|
+
return workgroupNodeId === queryWorkgroup.id
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
getSelectWorkgroup(workgroup) {
|
|
218
|
+
this.packageSelectResult(workgroup)
|
|
219
|
+
},
|
|
220
|
+
resultRowDblclick(workgroup) {
|
|
221
|
+
this.packageSelectResult(workgroup)
|
|
222
|
+
$emit(this, 'result', this.selectNodeInfo)
|
|
223
|
+
},
|
|
224
|
+
packageSelectResult(workgroup) {
|
|
225
|
+
workgroup.tenantCode = this.tenantInfo.code
|
|
226
|
+
workgroup.tenantName = this.tenantInfo.tenantName
|
|
227
|
+
const selectNodeInfo = {
|
|
228
|
+
id: workgroup.id,
|
|
229
|
+
name: workgroup.name,
|
|
230
|
+
code: workgroup.code,
|
|
231
|
+
subCompanyName: workgroup.subCompanyName,
|
|
232
|
+
workgroup: workgroup,
|
|
233
|
+
}
|
|
234
|
+
// 表示是勾选单选按钮或 选中树节点
|
|
235
|
+
this.selectNodeInfo = selectNodeInfo
|
|
236
|
+
},
|
|
237
|
+
handleSelect(item) {
|
|
238
|
+
this.handleSelectUtil(item, localStorage)
|
|
239
|
+
},
|
|
240
|
+
search(value) {
|
|
241
|
+
this.searchValue = value
|
|
242
|
+
this.$refs.workgroupTree.filter(value)
|
|
243
|
+
},
|
|
244
|
+
// 点击查询按钮调用的方法
|
|
245
|
+
clickSearch() {
|
|
246
|
+
this.storeSeachValue(localStorage, this.searchStoreKey, this.filterText)
|
|
247
|
+
this.search(this.filterText)
|
|
248
|
+
},
|
|
249
|
+
filterNode(value, data, node) {
|
|
250
|
+
if (!value) {
|
|
251
|
+
return true
|
|
252
|
+
} else {
|
|
253
|
+
var workgroupName = data.name
|
|
254
|
+
if (data.id === this.tenantNodeId) {
|
|
255
|
+
// 表示是根节点公司节点
|
|
256
|
+
return false
|
|
257
|
+
} else if (this.containBranch) {
|
|
258
|
+
// 如果包含分支,工作组节点显示的格式为:工作组名称(分支名称)
|
|
259
|
+
workgroupName = workgroupName.substring(
|
|
260
|
+
0,
|
|
261
|
+
workgroupName.lastIndexOf('(')
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
return workgroupName.indexOf(value) !== -1
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
// 点击复选框时处理
|
|
268
|
+
handleCheckNode(data, checkObj) {
|
|
269
|
+
if (checkObj.checkedKeys.indexOf(data.id) > -1) {
|
|
270
|
+
// 表示正选中data节点
|
|
271
|
+
if (data.id === this.tenantNodeId) {
|
|
272
|
+
// 表示选中了公司节点
|
|
273
|
+
this.checkedAllWorkgroups(data)
|
|
274
|
+
} else {
|
|
275
|
+
this.selectResult.push(JSON.parse(data.data))
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
// 表示正取消选中data节点,同时要取消其子节点的选中状态
|
|
279
|
+
if (data.id === this.tenantNodeId) {
|
|
280
|
+
// 表示取消公司节点的选中状态,即取消所有节点的勾选状态
|
|
281
|
+
this.$refs.workgroupTree.setCheckedKeys([])
|
|
282
|
+
} else {
|
|
283
|
+
this.selectResult = this.removeRow(
|
|
284
|
+
this.selectResult,
|
|
285
|
+
JSON.parse(data.data)
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
// 选中了根节点公司节点时,选中所有工作组
|
|
291
|
+
checkedAllWorkgroups(root) {
|
|
292
|
+
const children = root.children
|
|
293
|
+
if (children) {
|
|
294
|
+
children.forEach((workgroupNode) => {
|
|
295
|
+
this.$refs.workgroupTree.setChecked(workgroupNode.id, true)
|
|
296
|
+
})
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
handleNodeClick(data, node, nodeTree) {
|
|
300
|
+
if (this.multiple) {
|
|
301
|
+
// 多选部门树时,处理点击节点事件
|
|
302
|
+
this.clickNodeWhenMultiple(data)
|
|
303
|
+
}
|
|
304
|
+
this.selectSingleNode(data, false)
|
|
305
|
+
},
|
|
306
|
+
selectSingleNode(data, isClickOkBtn) {
|
|
307
|
+
if (this.isWorkgroupNode(data) && !this.multiple) {
|
|
308
|
+
// 点击的是工作组节点,并且是单选树时,点击部门节点直接关闭弹框
|
|
309
|
+
const workgroup = JSON.parse(data.data)
|
|
310
|
+
workgroup.tenantCode = this.tenantInfo.code
|
|
311
|
+
workgroup.tenantName = this.tenantInfo.tenantName
|
|
312
|
+
var selectNodeInfo = {
|
|
313
|
+
id: data.id,
|
|
314
|
+
name: data.name,
|
|
315
|
+
code: workgroup.code,
|
|
316
|
+
containBranch: this.containBranch,
|
|
317
|
+
workgroup: workgroup,
|
|
318
|
+
}
|
|
319
|
+
this.selectNodeInfo = selectNodeInfo
|
|
320
|
+
if (isClickOkBtn === true) {
|
|
321
|
+
// 点击确定按钮时才需要调result回调事件,关闭弹框
|
|
322
|
+
$emit(this, 'result', selectNodeInfo)
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
// 多选树时,点击节点处理复选框的选中状态
|
|
327
|
+
clickNodeWhenMultiple(data) {
|
|
328
|
+
var checkedKeys = []
|
|
329
|
+
if (this.$refs.workgroupTree) {
|
|
330
|
+
checkedKeys = this.$refs.workgroupTree.getCheckedKeys()
|
|
331
|
+
}
|
|
332
|
+
// 取消选中状态时,保持节点是展开的状态,不要折叠
|
|
333
|
+
this.$refs.workgroupTree.store.nodesMap[data.id].expanded = true
|
|
334
|
+
if (checkedKeys.indexOf(data.id) > -1) {
|
|
335
|
+
// 表示当前节点是选中状态,则需要取消其选中状态
|
|
336
|
+
// 取消当前节点的勾选状态
|
|
337
|
+
this.$refs.workgroupTree.setChecked(data.id, false)
|
|
338
|
+
if (data.id === this.tenantNodeId) {
|
|
339
|
+
// 表示取消公司节点的选中状态,即取消所有节点的勾选状态
|
|
340
|
+
this.$refs.workgroupTree.setCheckedKeys([])
|
|
341
|
+
} else {
|
|
342
|
+
this.selectResult = this.removeRow(
|
|
343
|
+
this.selectResult,
|
|
344
|
+
JSON.parse(data.data)
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
} else {
|
|
348
|
+
// 表示当前节点不是选中的状态,需要勾选该节点
|
|
349
|
+
this.$refs.workgroupTree.setChecked(data.id, true)
|
|
350
|
+
if (data.id === this.tenantNodeId) {
|
|
351
|
+
// 表示当前正选中根节点公司节点,则需要勾选所有节点的选中状态
|
|
352
|
+
this.checkedAllWorkgroups(data)
|
|
353
|
+
} else {
|
|
354
|
+
this.selectResult.push(JSON.parse(data.data))
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
isWorkgroupNode(data) {
|
|
359
|
+
// 当前节点不是公司节点,也不是分支机构节点,表示是部门节点
|
|
360
|
+
return (
|
|
361
|
+
data.id !== this.tenantNodeId &&
|
|
362
|
+
data.nodeType &&
|
|
363
|
+
data.nodeType === 'WORKGROUP'
|
|
364
|
+
)
|
|
365
|
+
},
|
|
366
|
+
singleSetValue() {
|
|
367
|
+
let showTip = false
|
|
368
|
+
if (this.searchValue) {
|
|
369
|
+
if (this.selectNodeInfo) {
|
|
370
|
+
$emit(this, 'result', this.selectNodeInfo)
|
|
371
|
+
} else {
|
|
372
|
+
showTip = true
|
|
373
|
+
}
|
|
374
|
+
} else {
|
|
375
|
+
const data = this.$refs.workgroupTree.getCurrentNode()
|
|
376
|
+
if (data && data !== null && this.isWorkgroupNode(data)) {
|
|
377
|
+
this.selectSingleNode(data, true)
|
|
378
|
+
} else {
|
|
379
|
+
showTip = true
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
this.showTip(showTip)
|
|
383
|
+
},
|
|
384
|
+
multipleSetValue() {
|
|
385
|
+
let showTip = false
|
|
386
|
+
var selectNodeInfo = {
|
|
387
|
+
ids: [],
|
|
388
|
+
names: [],
|
|
389
|
+
codes: [],
|
|
390
|
+
workgroups: [],
|
|
391
|
+
}
|
|
392
|
+
if (this.searchValue) {
|
|
393
|
+
if (this.selectResult.length > 0) {
|
|
394
|
+
this.selectResult.forEach((workgroupData) => {
|
|
395
|
+
const node = {
|
|
396
|
+
id: workgroupData.id,
|
|
397
|
+
name: workgroupData.name,
|
|
398
|
+
code: workgroupData.code,
|
|
399
|
+
}
|
|
400
|
+
this.addSelectedWorkgroupInfo(selectNodeInfo, node, workgroupData)
|
|
401
|
+
})
|
|
402
|
+
$emit(this, 'result', selectNodeInfo)
|
|
403
|
+
} else {
|
|
404
|
+
showTip = true
|
|
405
|
+
}
|
|
406
|
+
} else {
|
|
407
|
+
var nodes = this.$refs.workgroupTree.getCheckedNodes()
|
|
408
|
+
if (nodes) {
|
|
409
|
+
if (nodes.length === 0) {
|
|
410
|
+
// 没有选择任何节点
|
|
411
|
+
showTip = true
|
|
412
|
+
} else {
|
|
413
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
414
|
+
var node = nodes[i]
|
|
415
|
+
if (node.id !== this.tenantNodeId) {
|
|
416
|
+
// 不是公司根节点,表示是工作组节点,直接存到结果集合中
|
|
417
|
+
// node.data是部门对象的json字符串信息,通过JSON.parse(node.data)将json字符串转为对象
|
|
418
|
+
const workgroupData = JSON.parse(node.data)
|
|
419
|
+
this.addSelectedWorkgroupInfo(
|
|
420
|
+
selectNodeInfo,
|
|
421
|
+
node,
|
|
422
|
+
workgroupData
|
|
423
|
+
)
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
if (selectNodeInfo.ids.length > 0) {
|
|
427
|
+
$emit(this, 'result', selectNodeInfo)
|
|
428
|
+
} else {
|
|
429
|
+
showTip = true
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
} else {
|
|
433
|
+
showTip = true
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
this.showTip(showTip)
|
|
437
|
+
},
|
|
438
|
+
selectWorkgroup() {
|
|
439
|
+
if (this.multiple) {
|
|
440
|
+
this.multipleSetValue()
|
|
441
|
+
} else {
|
|
442
|
+
this.singleSetValue()
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
showTip(showTip) {
|
|
446
|
+
// 是否需要显示提示框,默认不显示
|
|
447
|
+
if (showTip) {
|
|
448
|
+
this.$alert(
|
|
449
|
+
this.$t('imatrixUIMessage.pleaseSelectATeam'),
|
|
450
|
+
this.$t('imatrixUIMessage.tips'),
|
|
451
|
+
{
|
|
452
|
+
confirmButtonText: this.$t('imatrixUIPublicModel.sure'),
|
|
453
|
+
}
|
|
454
|
+
)
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
// 将选中的部门节点添加到结果集合中
|
|
458
|
+
addSelectedWorkgroupInfo(result, node, workgroup) {
|
|
459
|
+
workgroup.tenantCode = this.tenantInfo.code
|
|
460
|
+
workgroup.tenantName = this.tenantInfo.tenantName
|
|
461
|
+
result.containBranch = this.containBranch
|
|
462
|
+
result.ids.push(node.id)
|
|
463
|
+
result.workgroups.push(workgroup)
|
|
464
|
+
result.codes.push(workgroup.code)
|
|
465
|
+
result.names.push(node.name)
|
|
466
|
+
},
|
|
467
|
+
// 初始化树 或 点击三角展开节点时动态加载子节点
|
|
468
|
+
loadNode(node, resolve) {
|
|
469
|
+
var parentId = 0
|
|
470
|
+
if (node.level === 0) {
|
|
471
|
+
// 表示初始化树
|
|
472
|
+
parentId = 0
|
|
473
|
+
} else {
|
|
474
|
+
parentId = node.data.id
|
|
475
|
+
}
|
|
476
|
+
var checkedKeys = []
|
|
477
|
+
if (this.$refs.workgroupTree) {
|
|
478
|
+
checkedKeys = this.$refs.workgroupTree.getCheckedKeys()
|
|
479
|
+
}
|
|
480
|
+
// 初始化部门树
|
|
481
|
+
this.initLoad(parentId, node, resolve, checkedKeys)
|
|
482
|
+
},
|
|
483
|
+
// 给节点添加自定义图标
|
|
484
|
+
renderContent(h, { node, data, store }) {
|
|
485
|
+
var className
|
|
486
|
+
if (node.data.id === -1) {
|
|
487
|
+
// node.id ===-1表示公司节点,node.branch表示是分支机构节点
|
|
488
|
+
className = 'el-icon-menu'
|
|
489
|
+
} else {
|
|
490
|
+
// 表示是工作组节点
|
|
491
|
+
className = 'el-icon-date'
|
|
492
|
+
}
|
|
493
|
+
if (
|
|
494
|
+
data.nodeType &&
|
|
495
|
+
data.nodeType === 'WORKGROUP' &&
|
|
496
|
+
this.searchValue &&
|
|
497
|
+
data.name.indexOf(this.searchValue) > -1
|
|
498
|
+
) {
|
|
499
|
+
// 如果是查询条件
|
|
500
|
+
return `<span><i class={className}></i><span class="searchResult" title={node.label}>{node.label}</span></span>`
|
|
501
|
+
}
|
|
502
|
+
return `<span><i class={className}></i><span title={node.label}>{node.label}</span></span>`
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
emits: ['result'],
|
|
506
|
+
}
|
|
507
|
+
</script>
|
|
508
|
+
|
|
509
|
+
<style>
|
|
510
|
+
.searchResult {
|
|
511
|
+
color: red;
|
|
512
|
+
}
|
|
513
|
+
.inline-input-custom {
|
|
514
|
+
width: 90%;
|
|
515
|
+
}
|
|
516
|
+
</style>
|