imatrix-ui 2.9.20-dw → 2.9.22-dw
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/lib/super-ui.css +1 -1
- package/lib/super-ui.umd.min.js +5 -5
- package/package.json +1 -1
- package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +1 -1
- package/packages/super-grid/src/apis.js +7 -2
- package/packages/super-grid/src/super-grid.vue +19 -17
- package/packages/workgroup-tree/src/workgroup-tree.vue +3 -2
- package/packages/workgroup-tree-inline/src/search-result.vue +168 -0
- package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +187 -46
- package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +28 -0
- package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +1 -1
- package/packages/workgroup-user-tree-inline/src/search-result.vue +197 -0
- package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +30 -1
- package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +220 -72
- package/src/i18n/langs/cn.js +6 -2
- package/src/i18n/langs/en.js +6 -2
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<!-- @node-click="handleNodeClick" 移除节点点击,不然会造成节点不可选择时,点击也会选择节点 -->
|
|
34
34
|
</div>
|
|
35
35
|
|
|
36
|
-
<div v-if="searchValue && searchValue.length > 0
|
|
36
|
+
<div v-if="searchValue && searchValue.length > 0" style="height:100%;overflow: hidden;">
|
|
37
37
|
<user-result :grid-data="searchResult" :select-result="selectResult" :height="height" :contain-branch="containBranch" :multiple="true" :is-search-result="true" @addUser="selectUser" />
|
|
38
38
|
</div>
|
|
39
39
|
</el-main>
|
|
@@ -18,6 +18,11 @@ import {
|
|
|
18
18
|
import eventBus from './eventBus'
|
|
19
19
|
import { isPromise } from '../../../src/utils/common-util'
|
|
20
20
|
const apis = {
|
|
21
|
+
// 列表工具栏控件刷新列表数据。添加该方法解决工具栏值清空后,列表内容没有还原问题
|
|
22
|
+
toolbarRefresh(parentRowIds, isLineEdit, toolbarFieldParam, isDeleteSubTableData) {
|
|
23
|
+
this.toolbarFieldParam = toolbarFieldParam
|
|
24
|
+
return this.refresh(parentRowIds, isLineEdit, toolbarFieldParam, isDeleteSubTableData)
|
|
25
|
+
},
|
|
21
26
|
// 刷新列表数据
|
|
22
27
|
refresh(parentRowIds, isLineEdit, toolbarFieldParam, isDeleteSubTableData) {
|
|
23
28
|
return new Promise((resolve, reject) => {
|
|
@@ -26,8 +31,8 @@ const apis = {
|
|
|
26
31
|
const gridParams = store.get(this.code)
|
|
27
32
|
this.$set(gridParams.options, 'subTableData', null)
|
|
28
33
|
}
|
|
29
|
-
if (toolbarFieldParam && toolbarFieldParam
|
|
30
|
-
|
|
34
|
+
if (!toolbarFieldParam && this.toolbarFieldParam) {
|
|
35
|
+
toolbarFieldParam = this.toolbarFieldParam
|
|
31
36
|
}
|
|
32
37
|
if (this.$refs) {
|
|
33
38
|
if (typeof (parentRowIds) !== 'undefined' && parentRowIds !== null && parentRowIds instanceof Array && parentRowIds.length > 0) {
|
|
@@ -1835,24 +1835,22 @@ export default {
|
|
|
1835
1835
|
// 修改当前页为第1页
|
|
1836
1836
|
this.currentPage = 1
|
|
1837
1837
|
// 将toolbar 参数和查询表单参数合并
|
|
1838
|
-
if (searchForm) {
|
|
1839
|
-
if (
|
|
1840
|
-
if (
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
searchForm[0].rightBracket = ')'
|
|
1844
|
-
}
|
|
1845
|
-
if (searchForm[searchForm.length - 1].joinSign === 'or') {
|
|
1846
|
-
searchForm[searchForm.length - 1].joinSign = 'and'
|
|
1847
|
-
}
|
|
1848
|
-
// 拼接
|
|
1849
|
-
// param.concat(toolbarFieldParam)
|
|
1850
|
-
Array.prototype.push.apply(searchForm, this.toolbarFieldParam)
|
|
1838
|
+
if (searchForm && searchForm.length > 0) {
|
|
1839
|
+
if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
|
|
1840
|
+
if (searchForm.length === 1) {
|
|
1841
|
+
searchForm[0].leftBracket = '('
|
|
1842
|
+
searchForm[0].rightBracket = ')'
|
|
1851
1843
|
}
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
searchForm = this.toolbarFieldParam
|
|
1844
|
+
if (searchForm[searchForm.length - 1].joinSign === 'or') {
|
|
1845
|
+
searchForm[searchForm.length - 1].joinSign = 'and'
|
|
1855
1846
|
}
|
|
1847
|
+
// 拼接
|
|
1848
|
+
// param.concat(toolbarFieldParam)
|
|
1849
|
+
Array.prototype.push.apply(searchForm, this.toolbarFieldParam)
|
|
1850
|
+
}
|
|
1851
|
+
} else {
|
|
1852
|
+
if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
|
|
1853
|
+
searchForm = this.toolbarFieldParam
|
|
1856
1854
|
}
|
|
1857
1855
|
}
|
|
1858
1856
|
this.search(searchForm, true)
|
|
@@ -2420,9 +2418,13 @@ export default {
|
|
|
2420
2418
|
}
|
|
2421
2419
|
},
|
|
2422
2420
|
resetSearch() {
|
|
2421
|
+
let searchForm = null
|
|
2422
|
+
if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
|
|
2423
|
+
searchForm = this.toolbarFieldParam
|
|
2424
|
+
}
|
|
2423
2425
|
// 修改当前页为第1页
|
|
2424
2426
|
this.currentPage = 1
|
|
2425
|
-
this.search(
|
|
2427
|
+
this.search(searchForm, false)
|
|
2426
2428
|
},
|
|
2427
2429
|
// 获取列信息
|
|
2428
2430
|
getColumnInformation() {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:title="myTitle"
|
|
7
7
|
:close-on-click-modal="false"
|
|
8
8
|
append-to-body
|
|
9
|
-
:width="
|
|
9
|
+
:width="multiple?'60%':'40%'"
|
|
10
10
|
@open="$emit('open')"
|
|
11
11
|
@opend="$emit('opend')"
|
|
12
12
|
@close="$emit('close')"
|
|
@@ -50,7 +50,7 @@ export default {
|
|
|
50
50
|
// 弹框的宽度
|
|
51
51
|
width: {
|
|
52
52
|
type: String,
|
|
53
|
-
default: '
|
|
53
|
+
default: '60%'
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
},
|
|
@@ -64,6 +64,7 @@ export default {
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
methods: {
|
|
67
|
+
// 工作组单选回调
|
|
67
68
|
result(selectNodeInfo) {
|
|
68
69
|
this.$emit('close', selectNodeInfo)
|
|
69
70
|
},
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="height: 100%">
|
|
3
|
+
<el-table
|
|
4
|
+
ref="superGrid"
|
|
5
|
+
:data="gridData"
|
|
6
|
+
row-key="id"
|
|
7
|
+
:row-class-name="tableRowClassName"
|
|
8
|
+
:max-height="myHeight"
|
|
9
|
+
border
|
|
10
|
+
fit
|
|
11
|
+
@row-click="rowClick"
|
|
12
|
+
@row-dblclick="rowDblclick"
|
|
13
|
+
>
|
|
14
|
+
<el-table-column v-if="multiple === false" width="60" fixed>
|
|
15
|
+
<template slot-scope="scope">
|
|
16
|
+
<el-radio v-model="singleWorkgroupIndex" :label="scope.$index" @change="selectWorkgroup">
|
|
17
|
+
{{ scope.$index+1 }}
|
|
18
|
+
</el-radio>
|
|
19
|
+
</template>
|
|
20
|
+
</el-table-column>
|
|
21
|
+
<el-table-column v-if="multiple && isSearchResult" fixed :label="$t('imatrixUIPublicModel.edit')" align="center" width="60px">
|
|
22
|
+
<template slot-scope="scope">
|
|
23
|
+
<div>
|
|
24
|
+
<el-button type="primary" size="mini" icon="el-icon-plus" :disabled="isDisable(scope.row)" circle @click="addWorkgroup(scope.$index, scope.row)" />
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
</el-table-column>
|
|
28
|
+
<el-table-column v-if="multiple && !isSearchResult" fixed :label="$t('imatrixUIPublicModel.edit')" align="center" width="60px">
|
|
29
|
+
<template slot-scope="scope">
|
|
30
|
+
<div>
|
|
31
|
+
<el-button type="danger" size="mini" icon="el-icon-delete" circle @click="removeWorkgroup(scope.$index, scope.row)" />
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
</el-table-column>
|
|
35
|
+
<el-table-column v-if="multiple" :label="$t('superGrid.index')" align="center" width="60px">
|
|
36
|
+
<template slot-scope="scope">
|
|
37
|
+
{{ scope.$index+1 }}
|
|
38
|
+
</template>
|
|
39
|
+
</el-table-column>
|
|
40
|
+
<el-table-column
|
|
41
|
+
:label="$t('workgroupTree.workingGroupName')"
|
|
42
|
+
:width="110"
|
|
43
|
+
prop="name"
|
|
44
|
+
>
|
|
45
|
+
<template slot-scope="scope">
|
|
46
|
+
<span class="ellipsis cell--span" :title="scope.row.name">{{ scope.row.name }}</span>
|
|
47
|
+
</template>
|
|
48
|
+
</el-table-column>
|
|
49
|
+
<el-table-column
|
|
50
|
+
:label="$t('workgroupTree.workingGroupNumber')"
|
|
51
|
+
:width="110"
|
|
52
|
+
prop="code"
|
|
53
|
+
>
|
|
54
|
+
<template slot-scope="scope">
|
|
55
|
+
<span class="ellipsis cell--span" :title="scope.row.code">{{ scope.row.code }}</span>
|
|
56
|
+
</template>
|
|
57
|
+
</el-table-column>
|
|
58
|
+
<el-table-column
|
|
59
|
+
:label="$t('workgroupTree.workgroupDescription')"
|
|
60
|
+
:width="300"
|
|
61
|
+
prop="description"
|
|
62
|
+
>
|
|
63
|
+
<template slot-scope="scope">
|
|
64
|
+
<span class="ellipsis cell--span" :title="scope.row.description">{{ scope.row.description }}</span>
|
|
65
|
+
</template>
|
|
66
|
+
</el-table-column>
|
|
67
|
+
</el-table>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
<style>
|
|
71
|
+
.searchResult {
|
|
72
|
+
color:red
|
|
73
|
+
}
|
|
74
|
+
.inline-select-custom {
|
|
75
|
+
width : 100px
|
|
76
|
+
}
|
|
77
|
+
.inline-input-custom {
|
|
78
|
+
width : 98%
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
81
|
+
<script>
|
|
82
|
+
export default {
|
|
83
|
+
name: 'WorkgroupResult',
|
|
84
|
+
props: {
|
|
85
|
+
gridData: {
|
|
86
|
+
type: Array,
|
|
87
|
+
default: null
|
|
88
|
+
},
|
|
89
|
+
multiple: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: false
|
|
92
|
+
},
|
|
93
|
+
// 多选树时是否是查询结果列表,用于控制“操作”列按钮的显示
|
|
94
|
+
isSearchResult: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: true
|
|
97
|
+
},
|
|
98
|
+
height: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: '300px'
|
|
101
|
+
},
|
|
102
|
+
selectResult: {
|
|
103
|
+
type: Array,
|
|
104
|
+
default: function() {
|
|
105
|
+
return []
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
},
|
|
110
|
+
data() {
|
|
111
|
+
let tableHeight = this.height
|
|
112
|
+
tableHeight = tableHeight.substring(0, tableHeight.indexOf('px'))
|
|
113
|
+
const myHeight = (parseInt(tableHeight) + 30) + 'px'
|
|
114
|
+
return {
|
|
115
|
+
singleWorkgroupIndex: null, // 选中的用户序号
|
|
116
|
+
selectedWorkgroup: null,
|
|
117
|
+
myHeight,
|
|
118
|
+
language: !window.$locale ? 'cn' : window.$locale
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
created() {
|
|
122
|
+
},
|
|
123
|
+
methods: {
|
|
124
|
+
// 移除工作组
|
|
125
|
+
removeWorkgroup(index, row) {
|
|
126
|
+
this.$emit('removeWorkgroup', index, row)
|
|
127
|
+
},
|
|
128
|
+
// 添加工作组
|
|
129
|
+
addWorkgroup(index, row) {
|
|
130
|
+
this.$emit('addWorkgroup', index, row)
|
|
131
|
+
},
|
|
132
|
+
// 选中工作组
|
|
133
|
+
selectWorkgroup(selectVal) {
|
|
134
|
+
this.$emit('selectResult', this.gridData[selectVal])
|
|
135
|
+
},
|
|
136
|
+
rowClick(row, column, event) {
|
|
137
|
+
this.singleWorkgroupIndex = row.row_index
|
|
138
|
+
this.$emit('selectResult', row)
|
|
139
|
+
},
|
|
140
|
+
tableRowClassName({ row, rowIndex }) {
|
|
141
|
+
row.row_index = rowIndex
|
|
142
|
+
},
|
|
143
|
+
// 双击添加工作组
|
|
144
|
+
rowDblclick(row, column, event) {
|
|
145
|
+
if (this.multiple) {
|
|
146
|
+
this.$emit('addWorkgroup', null, row)
|
|
147
|
+
} else {
|
|
148
|
+
this.$emit('resultRowDblclick', row)
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
isDisable(row) {
|
|
152
|
+
if (this.selectResult) {
|
|
153
|
+
const containWorkgroups = this.selectResult.filter(this.filterWorkgroup(row))
|
|
154
|
+
if (containWorkgroups && containWorkgroups.length > 0) {
|
|
155
|
+
return true
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return false
|
|
159
|
+
},
|
|
160
|
+
// 判断工作组是否存在的过滤器
|
|
161
|
+
filterWorkgroup(queryWorkgroup) {
|
|
162
|
+
return (workgroup) => {
|
|
163
|
+
return (workgroup.id === queryWorkgroup.id)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
</script>
|
|
@@ -1,34 +1,74 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<el-container style="height: 395px">
|
|
4
|
-
<el-
|
|
5
|
-
<el-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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.native="clickSearch"
|
|
16
|
+
>
|
|
17
|
+
<el-button slot="append" icon="el-icon-search" @click="clickSearch" />
|
|
18
|
+
</el-autocomplete>
|
|
19
|
+
</el-header>
|
|
20
|
+
<el-main>
|
|
21
|
+
<div v-if="!searchValue" style="padding-top:5px;overflow:auto;width: auto;display: inline-block !important;">
|
|
22
|
+
<el-tree
|
|
23
|
+
ref="workgroupTree"
|
|
24
|
+
:props="defaultProps"
|
|
25
|
+
:load="loadNode"
|
|
26
|
+
lazy
|
|
27
|
+
:show-checkbox="multiple"
|
|
28
|
+
node-key="id"
|
|
29
|
+
:render-content="renderContent"
|
|
30
|
+
:filter-node-method="filterNode"
|
|
31
|
+
@check="handleCheckNode"
|
|
32
|
+
@node-click="handleNodeClick"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
<div v-if="searchValue && searchValue.length > 0" style="height:100%;overflow: hidden;">
|
|
36
|
+
<workgroup-result
|
|
37
|
+
ref="workgroupResult"
|
|
38
|
+
:grid-data="searchResult"
|
|
39
|
+
:select-result="selectResult"
|
|
40
|
+
:height="height"
|
|
41
|
+
:multiple="multiple"
|
|
42
|
+
:is-search-result="true"
|
|
43
|
+
@selectResult="getSelectWorkgroup"
|
|
44
|
+
@resultRowDblclick="resultRowDblclick"
|
|
45
|
+
@addWorkgroup="addWorkgroup"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</el-main>
|
|
49
|
+
</el-container>
|
|
50
|
+
</el-aside>
|
|
51
|
+
<el-container v-if="multiple">
|
|
52
|
+
<el-aside width="2px">
|
|
53
|
+
<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" />
|
|
54
|
+
</el-aside>
|
|
55
|
+
<el-main style="padding: 10px">
|
|
56
|
+
<div style="text-align:left;font-size:16px">
|
|
57
|
+
{{ $t('imatrixUIMessage.selectedWorkingGroup') }}:
|
|
58
|
+
</div>
|
|
59
|
+
<div :style="'padding-top: 5px;height:90%;overflow: hidden;'">
|
|
60
|
+
<workgroup-result
|
|
61
|
+
:grid-data="selectResult"
|
|
62
|
+
:height="height"
|
|
63
|
+
:multiple="multiple"
|
|
64
|
+
:is-search-result="false"
|
|
65
|
+
@selectResult="getSelectWorkgroup"
|
|
66
|
+
@resultRowDblclick="resultRowDblclick"
|
|
67
|
+
@removeWorkgroup="removeWorkgroup"
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
</el-main>
|
|
71
|
+
</el-container>
|
|
32
72
|
</el-container>
|
|
33
73
|
</div>
|
|
34
74
|
</template>
|
|
@@ -45,8 +85,12 @@
|
|
|
45
85
|
import localStorage from '../../../src/utils/local-storage'
|
|
46
86
|
import utils from '../../utils/utils'
|
|
47
87
|
import workgroupTreeService from './workgroup-tree-service'
|
|
88
|
+
import WorkgroupResult from './search-result.vue'
|
|
48
89
|
export default {
|
|
49
90
|
name: 'InlineWorkgroupTree',
|
|
91
|
+
components: {
|
|
92
|
+
WorkgroupResult
|
|
93
|
+
},
|
|
50
94
|
props: {
|
|
51
95
|
// 是否是多选树,默认是true
|
|
52
96
|
multiple: {
|
|
@@ -69,12 +113,15 @@ export default {
|
|
|
69
113
|
children: 'children',
|
|
70
114
|
isLeaf: 'leaf'
|
|
71
115
|
},
|
|
72
|
-
containBranch: false, //
|
|
116
|
+
containBranch: false, // 当前租户内是否包含分支机构。获得当前选中部门名称时,如果有分支,则需要将分支名称返回给工作组,例如:部门1(分支1)
|
|
73
117
|
tenantNodeId: -1, // 公司节点的id
|
|
74
118
|
restaurants: [], // 查询的备选值
|
|
75
119
|
searchValue: null, // 查询条件
|
|
120
|
+
searchResult: [], // 工作组的查询结果
|
|
121
|
+
selectResult: [], // 工作组的选中结果
|
|
76
122
|
searchStoreKey: 'searchWorkgroup',
|
|
77
123
|
selectNodeInfo: null, // 单选时,选择的工作组信息
|
|
124
|
+
selectWorkgroupData: null,
|
|
78
125
|
tenantInfo: {} // 公司根节点信息
|
|
79
126
|
}
|
|
80
127
|
},
|
|
@@ -100,6 +147,63 @@ export default {
|
|
|
100
147
|
methods: {
|
|
101
148
|
...utils,
|
|
102
149
|
...workgroupTreeService,
|
|
150
|
+
// 将查询结果中指定工作组添加到已选择工作组集合中
|
|
151
|
+
addWorkgroup(index, workgroup) {
|
|
152
|
+
const containWorkgroups = this.selectResult.filter(this.filterWorkgroup(workgroup))
|
|
153
|
+
if (containWorkgroups && containWorkgroups.length === 0) {
|
|
154
|
+
this.selectResult.push(workgroup)
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
filterWorkgroup(queryWorkgroup) {
|
|
158
|
+
return (workgroup) => {
|
|
159
|
+
return (workgroup.id === queryWorkgroup.id)
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
removeWorkgroup(index, workgroup) {
|
|
163
|
+
if (this.$refs.workgroupTree) {
|
|
164
|
+
// 通过查询结果添加的工作组,在返回到组织结构树时,也选中了该工作组,在移除该工作组时,需要去掉复选框的选中状态
|
|
165
|
+
const checkedKeys = this.$refs.workgroupTree.getCheckedKeys()
|
|
166
|
+
const currentCheckedWorkgroupNodeIds = checkedKeys.filter(this.filterWorkgroupNode(workgroup))
|
|
167
|
+
if (currentCheckedWorkgroupNodeIds.length > 0) {
|
|
168
|
+
// 表示当前工作组是选中的状态,需要去掉
|
|
169
|
+
currentCheckedWorkgroupNodeIds.forEach(workgroupNodeId => {
|
|
170
|
+
this.$refs.workgroupTree.setChecked(workgroupNodeId, false)
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
this.selectResult = this.removeRow(this.selectResult, workgroup)
|
|
175
|
+
if (!this.selectResult || this.selectResult.length === 0) {
|
|
176
|
+
// 已选结果面板没有内容,则左侧树节点也不要有选中节点了
|
|
177
|
+
if (this.$refs.workgroupTree) {
|
|
178
|
+
this.$refs.workgroupTree.setCheckedKeys([])
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
filterWorkgroupNode(queryWorkgroup) {
|
|
183
|
+
return (workgroupNodeId) => {
|
|
184
|
+
return (workgroupNodeId === queryWorkgroup.id)
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
getSelectWorkgroup(workgroup) {
|
|
188
|
+
this.packageSelectResult(workgroup)
|
|
189
|
+
},
|
|
190
|
+
resultRowDblclick(workgroup) {
|
|
191
|
+
this.packageSelectResult(workgroup)
|
|
192
|
+
this.$emit('result', this.selectNodeInfo)
|
|
193
|
+
},
|
|
194
|
+
packageSelectResult(workgroup) {
|
|
195
|
+
workgroup.tenantCode = this.tenantInfo.code
|
|
196
|
+
workgroup.tenantName = this.tenantInfo.tenantName
|
|
197
|
+
const selectNodeInfo = {
|
|
198
|
+
id: workgroup.id,
|
|
199
|
+
name: workgroup.name,
|
|
200
|
+
code: workgroup.code,
|
|
201
|
+
subCompanyName: workgroup.subCompanyName,
|
|
202
|
+
workgroup: workgroup
|
|
203
|
+
}
|
|
204
|
+
// 表示是勾选单选按钮或 选中树节点
|
|
205
|
+
this.selectNodeInfo = selectNodeInfo
|
|
206
|
+
},
|
|
103
207
|
handleSelect(item) {
|
|
104
208
|
this.handleSelectUtil(item, localStorage)
|
|
105
209
|
},
|
|
@@ -134,12 +238,16 @@ export default {
|
|
|
134
238
|
if (data.id === this.tenantNodeId) {
|
|
135
239
|
// 表示选中了公司节点
|
|
136
240
|
this.checkedAllWorkgroups(data)
|
|
241
|
+
} else {
|
|
242
|
+
this.selectResult.push(JSON.parse(data.data))
|
|
137
243
|
}
|
|
138
244
|
} else {
|
|
139
245
|
// 表示正取消选中data节点,同时要取消其子节点的选中状态
|
|
140
246
|
if (data.id === this.tenantNodeId) {
|
|
141
247
|
// 表示取消公司节点的选中状态,即取消所有节点的勾选状态
|
|
142
248
|
this.$refs.workgroupTree.setCheckedKeys([])
|
|
249
|
+
} else {
|
|
250
|
+
this.selectResult = this.removeRow(this.selectResult, JSON.parse(data.data))
|
|
143
251
|
}
|
|
144
252
|
}
|
|
145
253
|
},
|
|
@@ -194,6 +302,8 @@ export default {
|
|
|
194
302
|
if (data.id === this.tenantNodeId) {
|
|
195
303
|
// 表示取消公司节点的选中状态,即取消所有节点的勾选状态
|
|
196
304
|
this.$refs.workgroupTree.setCheckedKeys([])
|
|
305
|
+
} else {
|
|
306
|
+
this.selectResult = this.removeRow(this.selectResult, JSON.parse(data.data))
|
|
197
307
|
}
|
|
198
308
|
} else {
|
|
199
309
|
// 表示当前节点不是选中的状态,需要勾选该节点
|
|
@@ -201,6 +311,8 @@ export default {
|
|
|
201
311
|
if (data.id === this.tenantNodeId) {
|
|
202
312
|
// 表示当前正选中根节点公司节点,则需要勾选所有节点的选中状态
|
|
203
313
|
this.checkedAllWorkgroups(data)
|
|
314
|
+
} else {
|
|
315
|
+
this.selectResult.push(JSON.parse(data.data))
|
|
204
316
|
}
|
|
205
317
|
}
|
|
206
318
|
},
|
|
@@ -208,17 +320,43 @@ export default {
|
|
|
208
320
|
// 当前节点不是公司节点,也不是分支机构节点,表示是部门节点
|
|
209
321
|
return data.id !== this.tenantNodeId && data.nodeType && data.nodeType === 'WORKGROUP'
|
|
210
322
|
},
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
codes: [],
|
|
219
|
-
workgroups: []
|
|
323
|
+
singleSetValue() {
|
|
324
|
+
let showTip = false
|
|
325
|
+
if (this.searchValue) {
|
|
326
|
+
if (this.selectNodeInfo) {
|
|
327
|
+
this.$emit('result', this.selectNodeInfo)
|
|
328
|
+
} else {
|
|
329
|
+
showTip = true
|
|
220
330
|
}
|
|
221
|
-
|
|
331
|
+
} else {
|
|
332
|
+
const data = this.$refs.workgroupTree.getCurrentNode()
|
|
333
|
+
if ((data && data !== null) && this.isWorkgroupNode(data)) {
|
|
334
|
+
this.selectSingleNode(data, true)
|
|
335
|
+
} else {
|
|
336
|
+
showTip = true
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
this.showTip(showTip)
|
|
340
|
+
},
|
|
341
|
+
multipleSetValue() {
|
|
342
|
+
let showTip = false
|
|
343
|
+
var selectNodeInfo = {
|
|
344
|
+
ids: [],
|
|
345
|
+
names: [],
|
|
346
|
+
codes: [],
|
|
347
|
+
workgroups: []
|
|
348
|
+
}
|
|
349
|
+
if (this.searchValue) {
|
|
350
|
+
if (this.selectResult.length > 0) {
|
|
351
|
+
this.selectResult.forEach(workgroupData => {
|
|
352
|
+
const node = { id: workgroupData.id, name: workgroupData.name, code: workgroupData.code }
|
|
353
|
+
this.addSelectedWorkgroupInfo(selectNodeInfo, node, workgroupData)
|
|
354
|
+
})
|
|
355
|
+
this.$emit('result', selectNodeInfo)
|
|
356
|
+
} else {
|
|
357
|
+
showTip = true
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
222
360
|
var nodes = this.$refs.workgroupTree.getCheckedNodes()
|
|
223
361
|
if (nodes) {
|
|
224
362
|
if (nodes.length === 0) {
|
|
@@ -243,15 +381,18 @@ export default {
|
|
|
243
381
|
} else {
|
|
244
382
|
showTip = true
|
|
245
383
|
}
|
|
384
|
+
}
|
|
385
|
+
this.showTip(showTip)
|
|
386
|
+
},
|
|
387
|
+
selectWorkgroup() {
|
|
388
|
+
if (this.multiple) {
|
|
389
|
+
this.multipleSetValue()
|
|
246
390
|
} else {
|
|
247
|
-
|
|
248
|
-
if (data && data !== null) {
|
|
249
|
-
this.selectSingleNode(data, true)
|
|
250
|
-
} else {
|
|
251
|
-
showTip = true
|
|
252
|
-
}
|
|
391
|
+
this.singleSetValue()
|
|
253
392
|
}
|
|
254
|
-
|
|
393
|
+
},
|
|
394
|
+
showTip(showTip) {
|
|
395
|
+
// 是否需要显示提示框,默认不显示
|
|
255
396
|
if (showTip) {
|
|
256
397
|
this.$alert(this.$t('imatrixUIMessage.pleaseSelectATeam'), this.$t('imatrixUIMessage.tips'), {
|
|
257
398
|
confirmButtonText: this.$t('imatrixUIPublicModel.sure')
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Vue from 'vue'
|
|
2
|
+
import { getI18n } from '../../../src/utils/util'
|
|
2
3
|
const workgroupTreeService = {
|
|
3
4
|
// 初始化部门树
|
|
4
5
|
initLoad(parentId, node, resolve, checkedKeys) {
|
|
@@ -38,6 +39,33 @@ const workgroupTreeService = {
|
|
|
38
39
|
this.$refs.workgroupTree.store.nodesMap[parentId].expanded = true
|
|
39
40
|
}
|
|
40
41
|
})
|
|
42
|
+
},
|
|
43
|
+
querySearch(queryString, cb) {
|
|
44
|
+
this.searchValue = queryString
|
|
45
|
+
this.searchResult = []
|
|
46
|
+
this.selectNodeInfo = null
|
|
47
|
+
if (queryString && queryString.length > 0) {
|
|
48
|
+
this.filterAppendNodes(queryString)
|
|
49
|
+
cb([])
|
|
50
|
+
} else {
|
|
51
|
+
cb([])
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
filterAppendNodes(value) {
|
|
55
|
+
const param = {
|
|
56
|
+
searchValue: value
|
|
57
|
+
}
|
|
58
|
+
this.$http.post(Vue.prototype.baseAPI + '/component/organization-trees/search-workgroups', param).then(result => {
|
|
59
|
+
this.searchResult = result
|
|
60
|
+
if (this.searchResult.length === 0) {
|
|
61
|
+
this.$message({
|
|
62
|
+
showClose: true,
|
|
63
|
+
type: 'error',
|
|
64
|
+
message: getI18n().t('imatrixUIMessage.queryResultIsEmpty')
|
|
65
|
+
})
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
})
|
|
41
69
|
}
|
|
42
70
|
}
|
|
43
71
|
export default workgroupTreeService
|