eoss-ui 0.7.51 → 0.7.53
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/button-group.js +290 -279
- package/lib/button.js +290 -280
- package/lib/calendar.js +2 -2
- package/lib/calogin.js +523 -512
- package/lib/card.js +2 -2
- package/lib/cascader.js +2 -2
- package/lib/checkbox-group.js +294 -283
- package/lib/clients.js +2 -2
- package/lib/config/api.js +3 -1
- package/lib/data-table-form.js +293 -282
- package/lib/data-table.js +292 -281
- package/lib/date-picker.js +290 -280
- package/lib/dialog.js +293 -282
- package/lib/enable-drag.js +2 -2
- package/lib/enterprise.js +2 -2
- package/lib/eoss-ui.common.js +5515 -5675
- package/lib/error-page.js +2 -2
- package/lib/flow-group.js +354 -362
- package/lib/flow-list.js +435 -412
- package/lib/flow.js +608 -599
- package/lib/form.js +295 -284
- package/lib/handle-user.js +384 -392
- package/lib/handler.js +290 -280
- package/lib/icon.js +291 -281
- package/lib/icons.js +5 -5
- package/lib/index.js +1 -1
- package/lib/input-number.js +290 -280
- package/lib/input.js +294 -284
- package/lib/label.js +2 -2
- package/lib/layout.js +4 -4
- package/lib/login.js +303 -292
- package/lib/main.js +466 -455
- package/lib/menu.js +4 -4
- package/lib/nav.js +292 -282
- package/lib/notify.js +74 -71
- package/lib/page.js +290 -280
- package/lib/pagination.js +290 -280
- package/lib/player.js +373 -385
- package/lib/qr-code.js +305 -295
- package/lib/radio-group.js +301 -291
- package/lib/retrial-auth.js +294 -284
- package/lib/select-ganged.js +292 -282
- package/lib/select.js +299 -289
- package/lib/selector-panel.js +295 -284
- package/lib/selector.js +292 -282
- package/lib/sizer.js +290 -280
- package/lib/steps.js +292 -282
- package/lib/switch.js +290 -280
- package/lib/table-form.js +297 -287
- package/lib/tabs-panel.js +2 -2
- package/lib/tabs.js +290 -280
- package/lib/theme-chalk/base.css +1 -1
- package/lib/theme-chalk/data-table.css +1 -1
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/icon.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/main.css +1 -1
- package/lib/theme-chalk/menu.css +1 -1
- package/lib/theme-chalk/simplicity.css +1 -1
- package/lib/theme-chalk/sizer.css +1 -1
- package/lib/theme-chalk/upload.css +1 -1
- package/lib/tips.js +292 -282
- package/lib/toolbar.js +2 -2
- package/lib/tree-group.js +290 -280
- package/lib/tree.js +292 -282
- package/lib/upload.js +304 -293
- package/lib/utils/util.js +8 -12
- package/lib/wujie.js +290 -280
- package/lib/wxlogin.js +290 -280
- package/package.json +160 -160
- package/packages/button/index.js +5 -5
- package/packages/button/src/main.vue +418 -418
- package/packages/button-group/index.js +5 -5
- package/packages/button-group/src/main.vue +346 -346
- package/packages/calendar/index.js +5 -5
- package/packages/calogin/index.js +5 -5
- package/packages/calogin/src/main.vue +412 -412
- package/packages/calogin/src/plugin.js +915 -915
- package/packages/card/index.js +5 -5
- package/packages/card/src/main.vue +156 -156
- package/packages/cascader/index.js +5 -5
- package/packages/cascader/src/main.vue +168 -168
- package/packages/checkbox-group/index.js +5 -5
- package/packages/checkbox-group/src/main.vue +333 -333
- package/packages/clients/index.js +5 -5
- package/packages/clients/src/main.vue +151 -151
- package/packages/data-table/index.js +5 -5
- package/packages/data-table/src/children.vue +39 -39
- package/packages/data-table/src/column.vue +992 -992
- package/packages/data-table/src/main.vue +1840 -1840
- package/packages/data-table/src/sizer.vue +195 -195
- package/packages/data-table-form/index.js +5 -5
- package/packages/data-table-form/src/checkbox.vue +101 -101
- package/packages/data-table-form/src/colgroup.vue +17 -17
- package/packages/data-table-form/src/main.vue +181 -181
- package/packages/data-table-form/src/radio.vue +65 -65
- package/packages/data-table-form/src/table.vue +233 -233
- package/packages/data-table-form/src/tbody.vue +336 -336
- package/packages/data-table-form/src/thead.vue +68 -68
- package/packages/date-picker/index.js +5 -5
- package/packages/date-picker/src/main.vue +236 -236
- package/packages/dialog/index.js +5 -5
- package/packages/enable-drag/index.js +5 -5
- package/packages/enterprise/index.js +5 -5
- package/packages/enterprise/src/main.vue +66 -66
- package/packages/error-page/index.js +5 -5
- package/packages/error-page/src/main.vue +44 -44
- package/packages/flow/index.js +5 -5
- package/packages/flow/src/component/Circulate.vue +413 -413
- package/packages/flow/src/component/CommonOpinions.vue +373 -373
- package/packages/flow/src/component/CustomPreset.vue +322 -322
- package/packages/flow/src/component/FileList.vue +97 -97
- package/packages/flow/src/component/FreeCirculation.vue +240 -240
- package/packages/flow/src/component/Preset.vue +255 -255
- package/packages/flow/src/component/SendMsg.vue +242 -242
- package/packages/flow/src/component/TimeLimit.vue +190 -190
- package/packages/flow/src/component/taskUnionExamine.vue +756 -756
- package/packages/flow/src/form.vue +121 -121
- package/packages/flow/src/freeStartFlow.vue +2846 -2846
- package/packages/flow/src/main.vue +3878 -3879
- package/packages/flow/src/processForm.vue +1365 -1365
- package/packages/flow/src/processReject.vue +309 -309
- package/packages/flow/src/reset.vue +942 -942
- package/packages/flow/src/startTaskRead.vue +692 -692
- package/packages/flow/src/supervise.vue +159 -159
- package/packages/flow/src/table.vue +58 -58
- package/packages/flow-group/index.js +5 -5
- package/packages/flow-group/src/main.vue +717 -717
- package/packages/flow-list/index.js +5 -5
- package/packages/flow-list/src/main.vue +1801 -1787
- package/packages/form/index.js +5 -5
- package/packages/form/src/main.vue +3901 -3901
- package/packages/form/src/table.vue +1512 -1512
- package/packages/handle-user/index.js +5 -5
- package/packages/handle-user/src/main.vue +137 -137
- package/packages/handler/index.js +5 -5
- package/packages/handler/src/main.vue +496 -496
- package/packages/icon/index.js +5 -5
- package/packages/icon/src/main.vue +104 -104
- package/packages/icons/index.js +5 -5
- package/packages/icons/src/icon.json +1 -1
- package/packages/icons/src/main.vue +81 -81
- package/packages/input/index.js +5 -5
- package/packages/input/src/main.vue +356 -356
- package/packages/input-number/index.js +5 -5
- package/packages/input-number/src/main.vue +106 -106
- package/packages/label/index.js +5 -5
- package/packages/label/src/main.vue +457 -457
- package/packages/layout/index.js +5 -5
- package/packages/layout/src/item.vue +152 -152
- package/packages/layout/src/main.vue +31 -31
- package/packages/login/index.js +5 -5
- package/packages/login/src/main.vue +2082 -2082
- package/packages/login/src/resetPassword.vue +557 -557
- package/packages/main/index.js +5 -5
- package/packages/main/src/default/message.vue +249 -249
- package/packages/main/src/default/notice.vue +157 -157
- package/packages/main/src/default/userinfo.vue +503 -503
- package/packages/main/src/public/online.vue +89 -89
- package/packages/main/src/public/search.vue +464 -464
- package/packages/main/src/public/settings.vue +227 -227
- package/packages/main/src/simplicity/apps.vue +388 -388
- package/packages/main/src/simplicity/avatar.vue +82 -82
- package/packages/main/src/simplicity/handler.vue +160 -160
- package/packages/main/src/simplicity/index.vue +2277 -2277
- package/packages/main/src/simplicity/lists.vue +84 -84
- package/packages/main/src/simplicity/menu-list.vue +135 -135
- package/packages/main/src/simplicity/message.vue +293 -293
- package/packages/main/src/simplicity/notice.vue +222 -222
- package/packages/main/src/simplicity/router-page.vue +45 -45
- package/packages/main/src/simplicity/sub-menu.vue +274 -274
- package/packages/main/src/simplicity/user.vue +259 -259
- package/packages/main/src/simplicity/userinfo.vue +401 -401
- package/packages/menu/index.js +5 -5
- package/packages/menu/src/main.vue +595 -595
- package/packages/nav/index.js +5 -5
- package/packages/nav/src/main.vue +351 -351
- package/packages/notify/index.js +5 -5
- package/packages/notify/src/main.vue +538 -538
- package/packages/page/index.js +5 -5
- package/packages/page/src/main.vue +167 -167
- package/packages/pagination/index.js +5 -5
- package/packages/pagination/src/main.vue +96 -96
- package/packages/player/index.js +5 -5
- package/packages/player/src/main.vue +194 -194
- package/packages/qr-code/index.js +5 -5
- package/packages/qr-code/src/main.vue +170 -170
- package/packages/radio-group/index.js +6 -6
- package/packages/radio-group/src/main.vue +319 -319
- package/packages/retrial-auth/index.js +5 -5
- package/packages/retrial-auth/src/main.vue +280 -280
- package/packages/select/index.js +5 -5
- package/packages/select/src/main.vue +782 -782
- package/packages/select-ganged/index.js +5 -5
- package/packages/select-ganged/src/main.vue +724 -724
- package/packages/selector/index.js +5 -5
- package/packages/selector/src/main.vue +761 -761
- package/packages/selector-panel/index.js +5 -5
- package/packages/selector-panel/src/main.vue +1027 -1027
- package/packages/selector-panel/src/selection.vue +170 -170
- package/packages/selector-panel/src/tree.vue +129 -129
- package/packages/sizer/index.js +5 -5
- package/packages/sizer/src/main.vue +254 -254
- package/packages/steps/index.js +5 -5
- package/packages/steps/src/main.vue +181 -181
- package/packages/switch/index.js +5 -5
- package/packages/switch/src/main.vue +170 -170
- package/packages/table-form/index.js +5 -5
- package/packages/tabs/index.js +5 -5
- package/packages/tabs/src/main.vue +788 -788
- package/packages/tabs-panel/index.js +5 -5
- package/packages/tabs-panel/src/main.vue +29 -29
- package/packages/theme-chalk/lib/base.css +1 -1
- package/packages/theme-chalk/lib/data-table.css +1 -1
- package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/lib/icon.css +1 -1
- package/packages/theme-chalk/lib/index.css +1 -1
- package/packages/theme-chalk/lib/main.css +1 -1
- package/packages/theme-chalk/lib/menu.css +1 -1
- package/packages/theme-chalk/lib/simplicity.css +1 -1
- package/packages/theme-chalk/lib/sizer.css +1 -1
- package/packages/theme-chalk/lib/upload.css +1 -1
- package/packages/theme-chalk/src/base.scss +261 -261
- package/packages/theme-chalk/src/button-group.scss +176 -176
- package/packages/theme-chalk/src/button.scss +24 -24
- package/packages/theme-chalk/src/calendar.scss +113 -113
- package/packages/theme-chalk/src/card.scss +99 -99
- package/packages/theme-chalk/src/checkbox-group.scss +8 -8
- package/packages/theme-chalk/src/clients.scss +87 -87
- package/packages/theme-chalk/src/data-table-form.scss +67 -67
- package/packages/theme-chalk/src/data-table.scss +297 -293
- package/packages/theme-chalk/src/date-picker.scss +7 -7
- package/packages/theme-chalk/src/dialog.scss +77 -77
- package/packages/theme-chalk/src/enable-drag.scss +181 -181
- package/packages/theme-chalk/src/enterprise.scss +5 -5
- package/packages/theme-chalk/src/error-page.scss +18 -18
- package/packages/theme-chalk/src/flow-group.scss +110 -110
- package/packages/theme-chalk/src/flow-list.scss +39 -39
- package/packages/theme-chalk/src/flow.scss +351 -351
- package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/src/form.scss +501 -501
- package/packages/theme-chalk/src/handle-user.scss +40 -40
- package/packages/theme-chalk/src/handler.scss +148 -148
- package/packages/theme-chalk/src/icon.scss +1540 -1456
- package/packages/theme-chalk/src/icons.scss +99 -99
- package/packages/theme-chalk/src/input.scss +9 -9
- package/packages/theme-chalk/src/label.scss +24 -24
- package/packages/theme-chalk/src/layout.scss +46 -46
- package/packages/theme-chalk/src/login.scss +1006 -1006
- package/packages/theme-chalk/src/main.scss +663 -663
- package/packages/theme-chalk/src/menu.scss +224 -224
- package/packages/theme-chalk/src/mixins/color.scss +117 -117
- package/packages/theme-chalk/src/nav.scss +111 -111
- package/packages/theme-chalk/src/page.scss +3 -3
- package/packages/theme-chalk/src/pagination.scss +29 -29
- package/packages/theme-chalk/src/player.scss +9 -9
- package/packages/theme-chalk/src/qr-code.scss +17 -17
- package/packages/theme-chalk/src/radio-group.scss +9 -9
- package/packages/theme-chalk/src/retrial-auth.scss +38 -38
- package/packages/theme-chalk/src/select-ganged.scss +8 -8
- package/packages/theme-chalk/src/select.scss +8 -8
- package/packages/theme-chalk/src/selector-panel.scss +204 -204
- package/packages/theme-chalk/src/selector.scss +114 -114
- package/packages/theme-chalk/src/simplicity.scss +1395 -1395
- package/packages/theme-chalk/src/sizer.scss +36 -36
- package/packages/theme-chalk/src/steps.scss +88 -88
- package/packages/theme-chalk/src/switch.scss +3 -3
- package/packages/theme-chalk/src/table-form.scss +1 -1
- package/packages/theme-chalk/src/tabs.scss +87 -87
- package/packages/theme-chalk/src/tips.scss +7 -7
- package/packages/theme-chalk/src/toolbar.scss +179 -179
- package/packages/theme-chalk/src/tree-group.scss +72 -72
- package/packages/theme-chalk/src/tree.scss +165 -165
- package/packages/theme-chalk/src/upload.scss +172 -172
- package/packages/theme-chalk/src/wxlogin.scss +3 -3
- package/packages/tips/index.js +5 -5
- package/packages/tips/src/main.vue +141 -141
- package/packages/toolbar/index.js +5 -5
- package/packages/toolbar/src/main.vue +430 -430
- package/packages/tree/index.js +5 -5
- package/packages/tree-group/index.js +5 -5
- package/packages/upload/index.js +5 -5
- package/packages/upload/src/main.vue +1344 -1344
- package/packages/upload/src/picture.js +15 -15
- package/packages/wujie/index.js +5 -5
- package/packages/wujie/src/main.vue +145 -145
- package/packages/wxlogin/index.js +5 -5
- package/packages/wxlogin/src/main.vue +128 -128
- package/src/config/api.js +317 -315
- package/src/config/image.js +2 -2
- package/src/index.js +163 -163
- package/src/utils/bus.js +3 -3
- package/src/utils/date-util.js +312 -312
- package/src/utils/http.js +50 -50
- package/src/utils/rules.js +18 -18
- package/src/utils/store.js +21 -21
- package/src/utils/util.js +7 -10
- package/src/utils/webSocket.js +107 -107
- package/packages/.DS_Store +0 -0
- package/packages/calogin/.DS_Store +0 -0
- package/packages/date-picker/.DS_Store +0 -0
- package/packages/date-picker/src/.DS_Store +0 -0
- package/packages/dialog/.DS_Store +0 -0
- package/packages/flow/.DS_Store +0 -0
- package/packages/flow/src/.DS_Store +0 -0
- package/packages/flow-list/.DS_Store +0 -0
- package/packages/form/.DS_Store +0 -0
- package/packages/icon/.DS_Store +0 -0
- package/packages/login/.DS_Store +0 -0
- package/packages/main/.DS_Store +0 -0
- package/packages/main/src/.DS_Store +0 -0
- package/packages/menu/.DS_Store +0 -0
- package/packages/select/.DS_Store +0 -0
- package/packages/selector/.DS_Store +0 -0
- package/packages/selector-panel/.DS_Store +0 -0
- package/packages/theme-chalk/src/.DS_Store +0 -0
- package/packages/upload/.DS_Store +0 -0
- package/src/.DS_Store +0 -0
- package/src/utils/.DS_Store +0 -0
|
@@ -1,1027 +1,1027 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<es-tabs
|
|
3
|
-
v-model="activeName"
|
|
4
|
-
class="es-selector-panel"
|
|
5
|
-
mold="border-card"
|
|
6
|
-
:style="styles"
|
|
7
|
-
@tab-click="handleClick"
|
|
8
|
-
>
|
|
9
|
-
<el-tab-pane
|
|
10
|
-
v-for="items in trees"
|
|
11
|
-
:key="items.label"
|
|
12
|
-
:label="items.label"
|
|
13
|
-
:name="items.name"
|
|
14
|
-
class="es-selector-content"
|
|
15
|
-
>
|
|
16
|
-
<div class="es-selector-view">
|
|
17
|
-
<tree
|
|
18
|
-
v-if="isShowTree"
|
|
19
|
-
:data="items.data"
|
|
20
|
-
:loading="loading"
|
|
21
|
-
@loadsub="loadsub"
|
|
22
|
-
@search="searchTree"
|
|
23
|
-
></tree>
|
|
24
|
-
<div class="es-selector-selection">
|
|
25
|
-
<el-form
|
|
26
|
-
ref="form"
|
|
27
|
-
@submit.native.prevent
|
|
28
|
-
:inline="true"
|
|
29
|
-
:model="form"
|
|
30
|
-
class="es-selector-selection-toolbar"
|
|
31
|
-
v-if="multiple || isShowTree"
|
|
32
|
-
>
|
|
33
|
-
<el-form-item>
|
|
34
|
-
<es-switch v-model="showDisabled" :data="options"></es-switch>
|
|
35
|
-
</el-form-item>
|
|
36
|
-
<el-form-item>
|
|
37
|
-
<el-checkbox
|
|
38
|
-
v-show="multiple && !max"
|
|
39
|
-
v-model="checkAll"
|
|
40
|
-
@change="handleCheckAll"
|
|
41
|
-
>
|
|
42
|
-
全选
|
|
43
|
-
</el-checkbox>
|
|
44
|
-
</el-form-item>
|
|
45
|
-
<div class="es-float-right" v-if="isShowTree">
|
|
46
|
-
<el-form-item v-if="showSelect && activeName == 'enterprise'">
|
|
47
|
-
<es-select
|
|
48
|
-
v-model="selectValue"
|
|
49
|
-
placeholder="请选择"
|
|
50
|
-
@change="handleSelect"
|
|
51
|
-
>
|
|
52
|
-
<el-option
|
|
53
|
-
v-for="item in filtrate.options"
|
|
54
|
-
:key="item.value"
|
|
55
|
-
:label="item.name"
|
|
56
|
-
:value="item.value"
|
|
57
|
-
></el-option>
|
|
58
|
-
</es-select>
|
|
59
|
-
</el-form-item>
|
|
60
|
-
<el-form-item>
|
|
61
|
-
<el-input
|
|
62
|
-
v-model="search"
|
|
63
|
-
placeholder="请输入搜索关键字"
|
|
64
|
-
@change="handleChangeSearch"
|
|
65
|
-
>
|
|
66
|
-
<template slot="append">
|
|
67
|
-
<el-button
|
|
68
|
-
icon="el-icon-search"
|
|
69
|
-
type="primary"
|
|
70
|
-
@click="handleSearch"
|
|
71
|
-
></el-button>
|
|
72
|
-
</template>
|
|
73
|
-
</el-input>
|
|
74
|
-
</el-form-item>
|
|
75
|
-
</div>
|
|
76
|
-
</el-form>
|
|
77
|
-
<selection
|
|
78
|
-
v-model="checkeds"
|
|
79
|
-
:data="checkboxs"
|
|
80
|
-
:value-key="valueKey"
|
|
81
|
-
:label-key="labelKey"
|
|
82
|
-
:multiple="mix ? mix : multiple"
|
|
83
|
-
:max="max"
|
|
84
|
-
:showDisabled="showDisabled"
|
|
85
|
-
:disableds="disableds"
|
|
86
|
-
></selection>
|
|
87
|
-
<selection
|
|
88
|
-
v-model="checkeds"
|
|
89
|
-
genre="delete"
|
|
90
|
-
:data="Array.isArray(checkeds) ? checkeds : [checkeds]"
|
|
91
|
-
:value-key="valueKey"
|
|
92
|
-
:label-key="labelKey"
|
|
93
|
-
:multiple="multiple"
|
|
94
|
-
:max="max"
|
|
95
|
-
:mix="mix"
|
|
96
|
-
:isSort="true"
|
|
97
|
-
@sort="handleSort"
|
|
98
|
-
></selection>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
<div class="es-selector-handle">
|
|
102
|
-
<el-button type="primary" size="small" @click="handleConfirm"
|
|
103
|
-
>确定</el-button
|
|
104
|
-
>
|
|
105
|
-
<el-button size="small" @click="handleCancel">取消</el-button>
|
|
106
|
-
</div>
|
|
107
|
-
</el-tab-pane>
|
|
108
|
-
</es-tabs>
|
|
109
|
-
</template>
|
|
110
|
-
<script>
|
|
111
|
-
import tree from './tree.vue';
|
|
112
|
-
import selection from './selection.vue';
|
|
113
|
-
import {
|
|
114
|
-
getSelectorOrgTree,
|
|
115
|
-
getSelectorOrgDetail
|
|
116
|
-
} from 'eoss-ui/src/config/api.js';
|
|
117
|
-
import { debounce } from 'throttle-debounce';
|
|
118
|
-
import util from 'eoss-ui/src/utils/util.js';
|
|
119
|
-
export default {
|
|
120
|
-
name: 'EsSelectorPanel',
|
|
121
|
-
inheritAttrs: false,
|
|
122
|
-
components: {
|
|
123
|
-
tree,
|
|
124
|
-
selection
|
|
125
|
-
},
|
|
126
|
-
props: {
|
|
127
|
-
isShowLevel3: {
|
|
128
|
-
type: Boolean,
|
|
129
|
-
default: true
|
|
130
|
-
},
|
|
131
|
-
method: {
|
|
132
|
-
type: String,
|
|
133
|
-
default: 'get'
|
|
134
|
-
},
|
|
135
|
-
host: {
|
|
136
|
-
type: String,
|
|
137
|
-
default: ''
|
|
138
|
-
},
|
|
139
|
-
value: [Array, Object, String],
|
|
140
|
-
width: {
|
|
141
|
-
type: String,
|
|
142
|
-
default: '900px'
|
|
143
|
-
},
|
|
144
|
-
height: {
|
|
145
|
-
type: String,
|
|
146
|
-
default: '560px'
|
|
147
|
-
},
|
|
148
|
-
//树结构
|
|
149
|
-
tree: {
|
|
150
|
-
type: Boolean,
|
|
151
|
-
default: true
|
|
152
|
-
},
|
|
153
|
-
type: {
|
|
154
|
-
type: Array,
|
|
155
|
-
default() {
|
|
156
|
-
return ['enterprise', 'person'];
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
active: String,
|
|
160
|
-
//是否替换页签
|
|
161
|
-
replace: {
|
|
162
|
-
type: Boolean,
|
|
163
|
-
default: false
|
|
164
|
-
},
|
|
165
|
-
//页签
|
|
166
|
-
tabs: Object,
|
|
167
|
-
filtrate: {
|
|
168
|
-
type: [Boolean, Object],
|
|
169
|
-
default() {
|
|
170
|
-
return {
|
|
171
|
-
show: true,
|
|
172
|
-
value: '1',
|
|
173
|
-
options: [
|
|
174
|
-
{
|
|
175
|
-
value: '1',
|
|
176
|
-
name: '直接下级'
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
value: '2',
|
|
180
|
-
name: '所有下级'
|
|
181
|
-
}
|
|
182
|
-
]
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
selection: {
|
|
187
|
-
type: [String, Array],
|
|
188
|
-
default: getSelectorOrgDetail
|
|
189
|
-
},
|
|
190
|
-
param: {
|
|
191
|
-
type: Object,
|
|
192
|
-
default() {
|
|
193
|
-
return {};
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
valueKey: {
|
|
197
|
-
type: String,
|
|
198
|
-
default: 'showid'
|
|
199
|
-
},
|
|
200
|
-
labelKey: {
|
|
201
|
-
type: String,
|
|
202
|
-
default: 'showname'
|
|
203
|
-
},
|
|
204
|
-
form: {
|
|
205
|
-
type: Object,
|
|
206
|
-
default() {
|
|
207
|
-
return {};
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
multiple: {
|
|
211
|
-
type: Boolean,
|
|
212
|
-
default: true
|
|
213
|
-
},
|
|
214
|
-
max: Number,
|
|
215
|
-
mix: Boolean,
|
|
216
|
-
disableds: {
|
|
217
|
-
type: Array,
|
|
218
|
-
default() {
|
|
219
|
-
return [];
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
data() {
|
|
224
|
-
return {
|
|
225
|
-
styles: { width: this.width, height: this.height },
|
|
226
|
-
loading: true,
|
|
227
|
-
search: '',
|
|
228
|
-
defaults: '',
|
|
229
|
-
trees: '',
|
|
230
|
-
checkAll: false,
|
|
231
|
-
selectValue: this.filtrate.value,
|
|
232
|
-
orgpath: false,
|
|
233
|
-
nodeData: '',
|
|
234
|
-
activeName: '',
|
|
235
|
-
selections: [],
|
|
236
|
-
checkboxs: [],
|
|
237
|
-
checkeds: null,
|
|
238
|
-
showDisabled: true,
|
|
239
|
-
options: [
|
|
240
|
-
{
|
|
241
|
-
value: true,
|
|
242
|
-
name: '展示'
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
value: false,
|
|
246
|
-
name: '过滤'
|
|
247
|
-
}
|
|
248
|
-
]
|
|
249
|
-
};
|
|
250
|
-
},
|
|
251
|
-
computed: {
|
|
252
|
-
//是否显示树结构
|
|
253
|
-
isShowTree() {
|
|
254
|
-
if (typeof this.selection === 'object' && Array.isArray(this.selection)) {
|
|
255
|
-
return false;
|
|
256
|
-
} else {
|
|
257
|
-
return this.tree;
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
showSelect() {
|
|
261
|
-
if (typeof this.filtrate === 'object') {
|
|
262
|
-
return this.filtrate.show;
|
|
263
|
-
} else {
|
|
264
|
-
return false;
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
actived: {
|
|
268
|
-
get() {
|
|
269
|
-
return this.active ? this.active : this.type[0];
|
|
270
|
-
},
|
|
271
|
-
set(val) {
|
|
272
|
-
return val;
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
newTabs() {
|
|
276
|
-
const orgId = util.getStorage('orgId');
|
|
277
|
-
const tabs = {
|
|
278
|
-
enterprise: {
|
|
279
|
-
label: '选择单位',
|
|
280
|
-
name: 'enterprise',
|
|
281
|
-
url: getSelectorOrgTree,
|
|
282
|
-
data: [],
|
|
283
|
-
nodeData: '',
|
|
284
|
-
selection: [],
|
|
285
|
-
value: [],
|
|
286
|
-
param: {
|
|
287
|
-
showarea: 1,
|
|
288
|
-
id: 0,
|
|
289
|
-
filid: 'all'
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
department: {
|
|
293
|
-
label: '选择部门',
|
|
294
|
-
name: 'department',
|
|
295
|
-
url: getSelectorOrgTree,
|
|
296
|
-
data: [],
|
|
297
|
-
nodeData: '',
|
|
298
|
-
selection: [],
|
|
299
|
-
value: [],
|
|
300
|
-
param: {
|
|
301
|
-
showarea: 0,
|
|
302
|
-
id: 0,
|
|
303
|
-
filid: 'all'
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
employee: {
|
|
307
|
-
label: '选择用户',
|
|
308
|
-
name: 'employee',
|
|
309
|
-
url: getSelectorOrgTree,
|
|
310
|
-
data: [],
|
|
311
|
-
nodeData: '',
|
|
312
|
-
selection: [],
|
|
313
|
-
value: [],
|
|
314
|
-
param: {
|
|
315
|
-
showarea: 0,
|
|
316
|
-
id: 0,
|
|
317
|
-
filid: 'all'
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
myemployee: {
|
|
321
|
-
label: '本单位用户',
|
|
322
|
-
name: 'myemployee',
|
|
323
|
-
url: getSelectorOrgTree,
|
|
324
|
-
data: [],
|
|
325
|
-
nodeData: '',
|
|
326
|
-
selection: [],
|
|
327
|
-
value: [],
|
|
328
|
-
param: {
|
|
329
|
-
showarea: 2,
|
|
330
|
-
id: 0,
|
|
331
|
-
filid: orgId
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
otheremployee: {
|
|
335
|
-
label: '外单位用户',
|
|
336
|
-
name: 'otheremployee',
|
|
337
|
-
url: getSelectorOrgTree,
|
|
338
|
-
data: [],
|
|
339
|
-
nodeData: '',
|
|
340
|
-
selection: [],
|
|
341
|
-
value: [],
|
|
342
|
-
param: {
|
|
343
|
-
showarea: 0,
|
|
344
|
-
id: 0,
|
|
345
|
-
filid: 'all'
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
person: {
|
|
349
|
-
label: '选择人员',
|
|
350
|
-
name: 'person',
|
|
351
|
-
url: getSelectorOrgTree,
|
|
352
|
-
data: [],
|
|
353
|
-
nodeData: '',
|
|
354
|
-
selection: [],
|
|
355
|
-
value: [],
|
|
356
|
-
param: {
|
|
357
|
-
showarea: 0,
|
|
358
|
-
id: 0,
|
|
359
|
-
filid: 'all'
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
otherperson: {
|
|
363
|
-
label: '外单位人员',
|
|
364
|
-
name: 'otherperson',
|
|
365
|
-
url: getSelectorOrgTree,
|
|
366
|
-
data: [],
|
|
367
|
-
nodeData: '',
|
|
368
|
-
selection: [],
|
|
369
|
-
value: [],
|
|
370
|
-
param: {
|
|
371
|
-
showarea: 0,
|
|
372
|
-
id: 0,
|
|
373
|
-
filid: 'all'
|
|
374
|
-
}
|
|
375
|
-
},
|
|
376
|
-
persongroup: {
|
|
377
|
-
label: '选择群组成员',
|
|
378
|
-
name: 'persongroup',
|
|
379
|
-
url: getSelectorOrgTree,
|
|
380
|
-
data: [],
|
|
381
|
-
nodeData: '',
|
|
382
|
-
selection: [],
|
|
383
|
-
value: [],
|
|
384
|
-
param: {
|
|
385
|
-
showarea: 3,
|
|
386
|
-
id: 0,
|
|
387
|
-
filid: 'all'
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
filgroup: {
|
|
391
|
-
label: '单位群组成员',
|
|
392
|
-
data: [],
|
|
393
|
-
nodeData: '',
|
|
394
|
-
selection: [],
|
|
395
|
-
value: [],
|
|
396
|
-
name: 'filgroup',
|
|
397
|
-
url: getSelectorOrgTree,
|
|
398
|
-
param: {
|
|
399
|
-
showarea: 4,
|
|
400
|
-
id: 0,
|
|
401
|
-
filid: 'all'
|
|
402
|
-
}
|
|
403
|
-
},
|
|
404
|
-
depgroup: {
|
|
405
|
-
label: '部门群组成员',
|
|
406
|
-
name: 'depgroup',
|
|
407
|
-
url: getSelectorOrgTree,
|
|
408
|
-
data: [],
|
|
409
|
-
nodeData: '',
|
|
410
|
-
selection: [],
|
|
411
|
-
value: [],
|
|
412
|
-
param: {
|
|
413
|
-
showarea: 5,
|
|
414
|
-
id: 0,
|
|
415
|
-
filid: 'all'
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
persongroupobj: {
|
|
419
|
-
label: '人员群组',
|
|
420
|
-
name: 'persongroupobj',
|
|
421
|
-
url: getSelectorOrgTree,
|
|
422
|
-
data: [],
|
|
423
|
-
nodeData: '',
|
|
424
|
-
selection: [],
|
|
425
|
-
value: [],
|
|
426
|
-
param: {
|
|
427
|
-
showarea: 11,
|
|
428
|
-
id: 0,
|
|
429
|
-
filid: 'all'
|
|
430
|
-
}
|
|
431
|
-
},
|
|
432
|
-
filgroupobj: {
|
|
433
|
-
label: '单位群组',
|
|
434
|
-
name: 'filgroupobj',
|
|
435
|
-
url: getSelectorOrgTree,
|
|
436
|
-
data: [],
|
|
437
|
-
nodeData: '',
|
|
438
|
-
selection: [],
|
|
439
|
-
value: [],
|
|
440
|
-
param: {
|
|
441
|
-
showarea: 13,
|
|
442
|
-
id: 0,
|
|
443
|
-
filid: 'all'
|
|
444
|
-
}
|
|
445
|
-
},
|
|
446
|
-
depgroupobj: {
|
|
447
|
-
label: '部门群组',
|
|
448
|
-
name: 'depgroupobj',
|
|
449
|
-
url: getSelectorOrgTree,
|
|
450
|
-
data: [],
|
|
451
|
-
nodeData: '',
|
|
452
|
-
selection: [],
|
|
453
|
-
value: [],
|
|
454
|
-
param: {
|
|
455
|
-
showarea: 14,
|
|
456
|
-
id: 0,
|
|
457
|
-
filid: 'all'
|
|
458
|
-
}
|
|
459
|
-
},
|
|
460
|
-
role: {
|
|
461
|
-
label: '选择角色',
|
|
462
|
-
name: 'role',
|
|
463
|
-
url: getSelectorOrgTree,
|
|
464
|
-
data: [],
|
|
465
|
-
nodeData: '',
|
|
466
|
-
selection: [],
|
|
467
|
-
value: [],
|
|
468
|
-
param: {
|
|
469
|
-
showarea: 6,
|
|
470
|
-
id: 0,
|
|
471
|
-
filid: 'all'
|
|
472
|
-
}
|
|
473
|
-
},
|
|
474
|
-
post: {
|
|
475
|
-
label: '选择岗位',
|
|
476
|
-
name: 'post',
|
|
477
|
-
url: getSelectorOrgTree,
|
|
478
|
-
data: [],
|
|
479
|
-
nodeData: '',
|
|
480
|
-
selection: [],
|
|
481
|
-
value: [],
|
|
482
|
-
param: {
|
|
483
|
-
showarea: 8,
|
|
484
|
-
id: 0,
|
|
485
|
-
filid: 'all'
|
|
486
|
-
}
|
|
487
|
-
},
|
|
488
|
-
codetable: {
|
|
489
|
-
label: '代码表',
|
|
490
|
-
name: 'codetable',
|
|
491
|
-
url: getSelectorOrgTree,
|
|
492
|
-
data: [],
|
|
493
|
-
nodeData: '',
|
|
494
|
-
selection: [],
|
|
495
|
-
value: [],
|
|
496
|
-
param: {
|
|
497
|
-
showarea: 10,
|
|
498
|
-
id: 0,
|
|
499
|
-
filid: 'all'
|
|
500
|
-
}
|
|
501
|
-
},
|
|
502
|
-
topcontacts: {
|
|
503
|
-
label: '常用联系人',
|
|
504
|
-
name: 'topcontacts',
|
|
505
|
-
url: getSelectorOrgTree,
|
|
506
|
-
data: [],
|
|
507
|
-
nodeData: '',
|
|
508
|
-
selection: [],
|
|
509
|
-
value: [],
|
|
510
|
-
param: {
|
|
511
|
-
showarea: 9,
|
|
512
|
-
id: 0,
|
|
513
|
-
filid: 'all'
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
|
-
if (this.tabs) {
|
|
518
|
-
if (this.replace) {
|
|
519
|
-
return this.tabs;
|
|
520
|
-
} else {
|
|
521
|
-
return util.extend(true, tabs, this.tabs);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
return tabs;
|
|
525
|
-
}
|
|
526
|
-
},
|
|
527
|
-
watch: {
|
|
528
|
-
type: {
|
|
529
|
-
immediate: true,
|
|
530
|
-
deep: true,
|
|
531
|
-
handler(val, old) {
|
|
532
|
-
if (
|
|
533
|
-
old === undefined ||
|
|
534
|
-
new Set([...val, ...old]).size !== val.length
|
|
535
|
-
) {
|
|
536
|
-
var obj = {};
|
|
537
|
-
this.activeName = this.actived;
|
|
538
|
-
if (this.isShowTree) {
|
|
539
|
-
for (let i in val) {
|
|
540
|
-
obj[val[i]] = this.newTabs[val[i]];
|
|
541
|
-
}
|
|
542
|
-
} else {
|
|
543
|
-
obj[this.activeName] = this.newTabs[this.activeName];
|
|
544
|
-
}
|
|
545
|
-
this.trees = obj;
|
|
546
|
-
this.defaults = JSON.parse(JSON.stringify(obj));
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
},
|
|
550
|
-
activeName: {
|
|
551
|
-
handler(val) {
|
|
552
|
-
this.ajaxActive(val);
|
|
553
|
-
}
|
|
554
|
-
},
|
|
555
|
-
tabs: {
|
|
556
|
-
deep: true,
|
|
557
|
-
handler() {
|
|
558
|
-
this.loading = true;
|
|
559
|
-
this.getTreeData(
|
|
560
|
-
this.host + this.newTabs[this.activeName].url,
|
|
561
|
-
this.newTabs[this.activeName].param
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
},
|
|
565
|
-
value: {
|
|
566
|
-
immediate: true,
|
|
567
|
-
handler(val) {
|
|
568
|
-
if (val !== undefined) {
|
|
569
|
-
this.trees[this.activeName].value = JSON.parse(JSON.stringify(val));
|
|
570
|
-
} else {
|
|
571
|
-
this.trees[this.activeName].value = '';
|
|
572
|
-
}
|
|
573
|
-
this.checkeds = this.trees[this.activeName].value || [];
|
|
574
|
-
}
|
|
575
|
-
},
|
|
576
|
-
checkboxs(val) {
|
|
577
|
-
let flag = this.checkboxs.length ? true : false;
|
|
578
|
-
this.checkboxs.forEach((item) => {
|
|
579
|
-
if (util.isObject(item)) {
|
|
580
|
-
if (util.indexOfObj(this.checkeds, item) === -1) {
|
|
581
|
-
flag = false;
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
} else {
|
|
585
|
-
if (this.checkeds.indexOf(item) === -1) {
|
|
586
|
-
flag = false;
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
});
|
|
591
|
-
this.checkAll = flag;
|
|
592
|
-
},
|
|
593
|
-
checkeds(res, old) {
|
|
594
|
-
let val = res;
|
|
595
|
-
// if (!Array.isArray(val)) {
|
|
596
|
-
// this.checkeds = [res];
|
|
597
|
-
// return;
|
|
598
|
-
// }
|
|
599
|
-
if (old.length > 0) {
|
|
600
|
-
if (val.length < old.length) {
|
|
601
|
-
this.checkAll = false;
|
|
602
|
-
} else {
|
|
603
|
-
let flag = true;
|
|
604
|
-
this.checkboxs.forEach((item) => {
|
|
605
|
-
if (util.isObject(item)) {
|
|
606
|
-
if (util.indexOfObj(val, item) === -1) {
|
|
607
|
-
flag = false;
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
} else {
|
|
611
|
-
if (val.indexOf(item) === -1) {
|
|
612
|
-
flag = false;
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
this.checkAll = flag;
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
this.trees[this.activeName].value = val;
|
|
621
|
-
}
|
|
622
|
-
},
|
|
623
|
-
beforeCreate() {
|
|
624
|
-
this.ajaxActive = debounce(500, (active) => {
|
|
625
|
-
this.getAjaxActive(active);
|
|
626
|
-
});
|
|
627
|
-
},
|
|
628
|
-
created() {},
|
|
629
|
-
mounted() {
|
|
630
|
-
this.ajaxActive(this.activeName);
|
|
631
|
-
},
|
|
632
|
-
methods: {
|
|
633
|
-
getAjaxActive(active) {
|
|
634
|
-
if (this.isShowTree) {
|
|
635
|
-
if (
|
|
636
|
-
(!this.trees[active].data ||
|
|
637
|
-
(this.trees[active].data &&
|
|
638
|
-
this.trees[active].data.length === 0)) &&
|
|
639
|
-
this.newTabs[active].url
|
|
640
|
-
) {
|
|
641
|
-
this.loading = true;
|
|
642
|
-
this.getTreeData(
|
|
643
|
-
this.host + this.newTabs[active].url,
|
|
644
|
-
this.newTabs[active].param
|
|
645
|
-
);
|
|
646
|
-
}
|
|
647
|
-
if (
|
|
648
|
-
!this.trees[active].value ||
|
|
649
|
-
(this.trees[active].value && this.trees[active].value.length === 0)
|
|
650
|
-
) {
|
|
651
|
-
if (this.value !== undefined) {
|
|
652
|
-
this.trees[active].value = JSON.parse(JSON.stringify(this.value));
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
this.checkboxs = this.trees[active].selection || [];
|
|
656
|
-
if (!this.mix) {
|
|
657
|
-
this.checkeds = this.trees[active].value || [];
|
|
658
|
-
}
|
|
659
|
-
this.nodeData = this.trees[active].nodeData;
|
|
660
|
-
} else {
|
|
661
|
-
if (typeof this.selection === 'string') {
|
|
662
|
-
let params = this.param[this.activeName]
|
|
663
|
-
? this.param[this.activeName]
|
|
664
|
-
: this.param;
|
|
665
|
-
util
|
|
666
|
-
.ajax({
|
|
667
|
-
method: this.method,
|
|
668
|
-
url: this.host + this.selection,
|
|
669
|
-
params: params,
|
|
670
|
-
data: params
|
|
671
|
-
})
|
|
672
|
-
.then((res) => {
|
|
673
|
-
if (res.rCode === 0) {
|
|
674
|
-
this.selections = JSON.parse(JSON.stringify(res.results));
|
|
675
|
-
this.checkboxs = JSON.parse(JSON.stringify(res.results)) || [];
|
|
676
|
-
}
|
|
677
|
-
})
|
|
678
|
-
.catch((err) => {
|
|
679
|
-
if (err.message && err.message !== 'canceled') {
|
|
680
|
-
this.$message.error(err.message);
|
|
681
|
-
}
|
|
682
|
-
});
|
|
683
|
-
} else {
|
|
684
|
-
this.selections = this.selection;
|
|
685
|
-
this.checkboxs = this.selection || [];
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
},
|
|
689
|
-
getTreeData(url, params, id) {
|
|
690
|
-
let data = util.extend(
|
|
691
|
-
{},
|
|
692
|
-
params,
|
|
693
|
-
this.param[this.activeName] ? this.param[this.activeName] : this.param
|
|
694
|
-
);
|
|
695
|
-
if (id !== undefined) {
|
|
696
|
-
data.id = id;
|
|
697
|
-
}
|
|
698
|
-
util
|
|
699
|
-
.ajax({ method: this.method, url: url, params: data, data: data })
|
|
700
|
-
.then((res) => {
|
|
701
|
-
if (res.rCode === 0) {
|
|
702
|
-
this.loading = false;
|
|
703
|
-
if (!Object.prototype.hasOwnProperty.call(params, 'seachkey')) {
|
|
704
|
-
this.$set(
|
|
705
|
-
this.defaults[this.activeName],
|
|
706
|
-
'data',
|
|
707
|
-
JSON.parse(JSON.stringify(res.results))
|
|
708
|
-
);
|
|
709
|
-
}
|
|
710
|
-
if (res.results.length && res.results[0].name === '无搜索数据') {
|
|
711
|
-
this.$set(this.trees[this.activeName], 'data', null);
|
|
712
|
-
} else {
|
|
713
|
-
this.$set(
|
|
714
|
-
this.trees[this.activeName],
|
|
715
|
-
'data',
|
|
716
|
-
JSON.parse(JSON.stringify(res.results))
|
|
717
|
-
);
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
})
|
|
721
|
-
.catch((err) => {
|
|
722
|
-
if (err.message && err.message !== 'canceled') {
|
|
723
|
-
this.$message.error(err.message);
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
},
|
|
727
|
-
loadsub(data, node, flag) {
|
|
728
|
-
node;
|
|
729
|
-
if (flag) {
|
|
730
|
-
if (data.selection === undefined || data.selection.length === 0) {
|
|
731
|
-
this.checkAll = false;
|
|
732
|
-
let params = util.extend(
|
|
733
|
-
{},
|
|
734
|
-
this.param[this.activeName]
|
|
735
|
-
? this.param[this.activeName]
|
|
736
|
-
: this.param
|
|
737
|
-
);
|
|
738
|
-
params.type = this.activeName;
|
|
739
|
-
params.mid = data.id;
|
|
740
|
-
if (this.activeName === 'enterprise') {
|
|
741
|
-
params.querymode = this.selectValue;
|
|
742
|
-
if (this.selectValue === '2' || this.selectValue === 2) {
|
|
743
|
-
params.orgpath =
|
|
744
|
-
data.attributes && data.attributes.orgpath
|
|
745
|
-
? data.attributes.orgpath
|
|
746
|
-
: '';
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
// if (this.activeName === 'department') {
|
|
750
|
-
// params.querymode = 0;
|
|
751
|
-
// }
|
|
752
|
-
util
|
|
753
|
-
.ajax({
|
|
754
|
-
method: this.method,
|
|
755
|
-
url: this.host + this.selection,
|
|
756
|
-
params: params,
|
|
757
|
-
data: params
|
|
758
|
-
})
|
|
759
|
-
.then((res) => {
|
|
760
|
-
if (res.rCode === 0) {
|
|
761
|
-
data.selection = JSON.parse(JSON.stringify(res.results));
|
|
762
|
-
this.$set(
|
|
763
|
-
this.trees[this.activeName],
|
|
764
|
-
'selection',
|
|
765
|
-
JSON.parse(JSON.stringify(res.results))
|
|
766
|
-
);
|
|
767
|
-
this.$set(this.trees[this.activeName], 'nodeData', data);
|
|
768
|
-
this.nodeData = this.trees[this.activeName].nodeData;
|
|
769
|
-
this.checkboxs = this.trees[this.activeName].selection;
|
|
770
|
-
}
|
|
771
|
-
})
|
|
772
|
-
.catch((err) => {
|
|
773
|
-
if (err.message && err.message !== 'canceled') {
|
|
774
|
-
this.$message.error(err.message);
|
|
775
|
-
}
|
|
776
|
-
});
|
|
777
|
-
} else {
|
|
778
|
-
this.trees[this.activeName].selection = data.selection;
|
|
779
|
-
this.trees[this.activeName].nodeData = data;
|
|
780
|
-
this.nodeData = this.trees[this.activeName].nodeData;
|
|
781
|
-
this.checkboxs = this.trees[this.activeName].selection;
|
|
782
|
-
}
|
|
783
|
-
} else {
|
|
784
|
-
if (!this.isShowLevel3) {
|
|
785
|
-
data.state = '';
|
|
786
|
-
}
|
|
787
|
-
if (
|
|
788
|
-
data.state !== '' &&
|
|
789
|
-
(!data.children || data.children.length === 0)
|
|
790
|
-
) {
|
|
791
|
-
let params = util.extend(
|
|
792
|
-
{},
|
|
793
|
-
this.newTabs[this.activeName].param,
|
|
794
|
-
this.param[this.activeName]
|
|
795
|
-
? this.param[this.activeName]
|
|
796
|
-
: this.param
|
|
797
|
-
);
|
|
798
|
-
params.id = data.id;
|
|
799
|
-
util
|
|
800
|
-
.ajax({
|
|
801
|
-
method: this.method,
|
|
802
|
-
url: this.host + this.newTabs[this.activeName].url,
|
|
803
|
-
data: params,
|
|
804
|
-
params: params
|
|
805
|
-
})
|
|
806
|
-
.then((res) => {
|
|
807
|
-
if (res.rCode === 0) {
|
|
808
|
-
this.loading = false;
|
|
809
|
-
this.$set(
|
|
810
|
-
data,
|
|
811
|
-
'children',
|
|
812
|
-
JSON.parse(JSON.stringify(res.results))
|
|
813
|
-
);
|
|
814
|
-
this.$set(
|
|
815
|
-
this.defaults[this.activeName],
|
|
816
|
-
'data',
|
|
817
|
-
JSON.parse(JSON.stringify(this.trees[this.activeName].data))
|
|
818
|
-
);
|
|
819
|
-
}
|
|
820
|
-
})
|
|
821
|
-
.catch((err) => {
|
|
822
|
-
if (err.message && err.message !== 'canceled') {
|
|
823
|
-
this.$message.error(err.message);
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
},
|
|
829
|
-
searchTree(res) {
|
|
830
|
-
if (res) {
|
|
831
|
-
this.loading = true;
|
|
832
|
-
let params = util.extend({}, this.newTabs[this.activeName].param, {
|
|
833
|
-
seachkey: res
|
|
834
|
-
});
|
|
835
|
-
this.getTreeData(this.host + this.newTabs[this.activeName].url, params);
|
|
836
|
-
} else {
|
|
837
|
-
this.$set(
|
|
838
|
-
this.trees[this.activeName],
|
|
839
|
-
'data',
|
|
840
|
-
this.defaults[this.activeName].data
|
|
841
|
-
);
|
|
842
|
-
}
|
|
843
|
-
},
|
|
844
|
-
handleCheckAll(res) {
|
|
845
|
-
if (this.checkboxs.length > 0) {
|
|
846
|
-
let isObject = util.isObject(this.checkboxs[0]);
|
|
847
|
-
if (res) {
|
|
848
|
-
if (this.isShowTree) {
|
|
849
|
-
this.nodeData.checkAll = true;
|
|
850
|
-
let checkeds = this.checkeds.concat(
|
|
851
|
-
this.checkboxs.filter((item) => {
|
|
852
|
-
return item.disabled !== true;
|
|
853
|
-
})
|
|
854
|
-
);
|
|
855
|
-
if (checkeds.length > 0) {
|
|
856
|
-
this.checkeds = util.arrUnique(
|
|
857
|
-
checkeds,
|
|
858
|
-
isObject ? this.valueKey : undefined
|
|
859
|
-
);
|
|
860
|
-
}
|
|
861
|
-
} else {
|
|
862
|
-
this.checkeds = this.checkboxs;
|
|
863
|
-
}
|
|
864
|
-
} else {
|
|
865
|
-
if (this.isShowTree) {
|
|
866
|
-
this.nodeData.checkAll = false;
|
|
867
|
-
this.checkboxs.forEach((element) => {
|
|
868
|
-
for (let i in this.checkeds) {
|
|
869
|
-
if (
|
|
870
|
-
(isObject &&
|
|
871
|
-
this.checkeds[i][this.valueKey] ===
|
|
872
|
-
element[this.valueKey]) ||
|
|
873
|
-
this.checkeds[i] === element
|
|
874
|
-
) {
|
|
875
|
-
this.checkeds.splice(i, 1);
|
|
876
|
-
break;
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
});
|
|
880
|
-
} else {
|
|
881
|
-
this.checkeds = [];
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
},
|
|
886
|
-
handleSelect(res) {
|
|
887
|
-
if (this.nodeData) {
|
|
888
|
-
this.nodeData.selection = '';
|
|
889
|
-
this.loadsub(this.nodeData, '', true);
|
|
890
|
-
}
|
|
891
|
-
this.$emit('filtratechage', this.trees, this.activeName);
|
|
892
|
-
},
|
|
893
|
-
handleChangeSearch() {
|
|
894
|
-
if (this.search === '') {
|
|
895
|
-
if (this.isShowTree) {
|
|
896
|
-
this.checkboxs = this.nodeData.selection;
|
|
897
|
-
} else {
|
|
898
|
-
this.checkboxs = this.selections;
|
|
899
|
-
}
|
|
900
|
-
} else {
|
|
901
|
-
if (this.isShowTree) {
|
|
902
|
-
if (this.nodeData && this.nodeData.selection) {
|
|
903
|
-
let arry = [];
|
|
904
|
-
this.nodeData.selection.forEach((item) => {
|
|
905
|
-
if (util.isObject(item)) {
|
|
906
|
-
if (item[this.labelKey].indexOf(this.search) > -1) {
|
|
907
|
-
arry.push(item);
|
|
908
|
-
}
|
|
909
|
-
} else {
|
|
910
|
-
if (item.indexOf(this.search) > -1) {
|
|
911
|
-
arry.push(item);
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
});
|
|
915
|
-
this.checkboxs = arry;
|
|
916
|
-
}
|
|
917
|
-
} else {
|
|
918
|
-
let arry = [];
|
|
919
|
-
this.selections.forEach((item) => {
|
|
920
|
-
if (util.isObject(item)) {
|
|
921
|
-
if (item[this.labelKey].indexOf(this.search) > -1) {
|
|
922
|
-
arry.push(item);
|
|
923
|
-
}
|
|
924
|
-
} else {
|
|
925
|
-
if (item.indexOf(this.search) > -1) {
|
|
926
|
-
arry.push(item);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
});
|
|
930
|
-
this.checkboxs = arry;
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
},
|
|
934
|
-
handleSearch() {
|
|
935
|
-
if (this.isShowTree) {
|
|
936
|
-
if (this.nodeData && this.nodeData.selection) {
|
|
937
|
-
if (this.search !== '') {
|
|
938
|
-
let arry = [];
|
|
939
|
-
this.nodeData.selection.forEach((item) => {
|
|
940
|
-
if (util.isObject(item)) {
|
|
941
|
-
if (item[this.labelKey].indexOf(this.search) > -1) {
|
|
942
|
-
arry.push(item);
|
|
943
|
-
}
|
|
944
|
-
} else {
|
|
945
|
-
if (item.indexOf(this.search) > -1) {
|
|
946
|
-
arry.push(item);
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
});
|
|
950
|
-
this.checkboxs = arry;
|
|
951
|
-
}
|
|
952
|
-
} else {
|
|
953
|
-
let mid = '0-0-0-0-0';
|
|
954
|
-
if (this.nodeData) {
|
|
955
|
-
mid = this.nodeData.id;
|
|
956
|
-
}
|
|
957
|
-
util
|
|
958
|
-
.ajax({
|
|
959
|
-
url: this.selection,
|
|
960
|
-
params: {
|
|
961
|
-
mid: mid,
|
|
962
|
-
querymode: this.selectValue,
|
|
963
|
-
type: this.activeName,
|
|
964
|
-
namelike: this.search
|
|
965
|
-
}
|
|
966
|
-
})
|
|
967
|
-
.then((res) => {
|
|
968
|
-
if (res.rCode === 0) {
|
|
969
|
-
this.checkboxs = JSON.parse(JSON.stringify(res.results));
|
|
970
|
-
}
|
|
971
|
-
})
|
|
972
|
-
.catch((err) => {
|
|
973
|
-
if (err.message && err.message !== 'canceled') {
|
|
974
|
-
this.$message.error(err.message);
|
|
975
|
-
}
|
|
976
|
-
});
|
|
977
|
-
}
|
|
978
|
-
} else {
|
|
979
|
-
if (this.search !== '') {
|
|
980
|
-
let arry = [];
|
|
981
|
-
this.selections.forEach((item) => {
|
|
982
|
-
if (util.isObject(item)) {
|
|
983
|
-
if (item[this.labelKey].indexOf(this.search) > -1) {
|
|
984
|
-
arry.push(item);
|
|
985
|
-
}
|
|
986
|
-
} else {
|
|
987
|
-
if (item.indexOf(this.search) > -1) {
|
|
988
|
-
arry.push(item);
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
});
|
|
992
|
-
this.checkboxs = arry;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
},
|
|
996
|
-
handleClick() {
|
|
997
|
-
this.$emit('tabschage', this.trees, this.activeName);
|
|
998
|
-
},
|
|
999
|
-
handleChange() {},
|
|
1000
|
-
handleConfirm() {
|
|
1001
|
-
if (!this.checkeds || (this.multiple && this.checkeds.length === 0)) {
|
|
1002
|
-
this.$message({
|
|
1003
|
-
message: '请选择',
|
|
1004
|
-
type: 'warning'
|
|
1005
|
-
});
|
|
1006
|
-
} else {
|
|
1007
|
-
this.$emit('input', this.checkeds);
|
|
1008
|
-
this.$emit('confirm', this.checkeds);
|
|
1009
|
-
}
|
|
1010
|
-
},
|
|
1011
|
-
handleCancel() {
|
|
1012
|
-
this.$emit('cancel', false);
|
|
1013
|
-
},
|
|
1014
|
-
handleSort(res) {
|
|
1015
|
-
let oldIndex = res.oldIndex;
|
|
1016
|
-
let newIndex = res.newIndex;
|
|
1017
|
-
|
|
1018
|
-
this.checkeds.splice(newIndex, 0, this.checkeds[oldIndex]);
|
|
1019
|
-
if (oldIndex > newIndex) {
|
|
1020
|
-
this.checkeds.splice(oldIndex + 1, 1);
|
|
1021
|
-
} else {
|
|
1022
|
-
this.checkeds.splice(oldIndex, 1);
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<es-tabs
|
|
3
|
+
v-model="activeName"
|
|
4
|
+
class="es-selector-panel"
|
|
5
|
+
mold="border-card"
|
|
6
|
+
:style="styles"
|
|
7
|
+
@tab-click="handleClick"
|
|
8
|
+
>
|
|
9
|
+
<el-tab-pane
|
|
10
|
+
v-for="items in trees"
|
|
11
|
+
:key="items.label"
|
|
12
|
+
:label="items.label"
|
|
13
|
+
:name="items.name"
|
|
14
|
+
class="es-selector-content"
|
|
15
|
+
>
|
|
16
|
+
<div class="es-selector-view">
|
|
17
|
+
<tree
|
|
18
|
+
v-if="isShowTree"
|
|
19
|
+
:data="items.data"
|
|
20
|
+
:loading="loading"
|
|
21
|
+
@loadsub="loadsub"
|
|
22
|
+
@search="searchTree"
|
|
23
|
+
></tree>
|
|
24
|
+
<div class="es-selector-selection">
|
|
25
|
+
<el-form
|
|
26
|
+
ref="form"
|
|
27
|
+
@submit.native.prevent
|
|
28
|
+
:inline="true"
|
|
29
|
+
:model="form"
|
|
30
|
+
class="es-selector-selection-toolbar"
|
|
31
|
+
v-if="multiple || isShowTree"
|
|
32
|
+
>
|
|
33
|
+
<el-form-item>
|
|
34
|
+
<es-switch v-model="showDisabled" :data="options"></es-switch>
|
|
35
|
+
</el-form-item>
|
|
36
|
+
<el-form-item>
|
|
37
|
+
<el-checkbox
|
|
38
|
+
v-show="multiple && !max"
|
|
39
|
+
v-model="checkAll"
|
|
40
|
+
@change="handleCheckAll"
|
|
41
|
+
>
|
|
42
|
+
全选
|
|
43
|
+
</el-checkbox>
|
|
44
|
+
</el-form-item>
|
|
45
|
+
<div class="es-float-right" v-if="isShowTree">
|
|
46
|
+
<el-form-item v-if="showSelect && activeName == 'enterprise'">
|
|
47
|
+
<es-select
|
|
48
|
+
v-model="selectValue"
|
|
49
|
+
placeholder="请选择"
|
|
50
|
+
@change="handleSelect"
|
|
51
|
+
>
|
|
52
|
+
<el-option
|
|
53
|
+
v-for="item in filtrate.options"
|
|
54
|
+
:key="item.value"
|
|
55
|
+
:label="item.name"
|
|
56
|
+
:value="item.value"
|
|
57
|
+
></el-option>
|
|
58
|
+
</es-select>
|
|
59
|
+
</el-form-item>
|
|
60
|
+
<el-form-item>
|
|
61
|
+
<el-input
|
|
62
|
+
v-model="search"
|
|
63
|
+
placeholder="请输入搜索关键字"
|
|
64
|
+
@change="handleChangeSearch"
|
|
65
|
+
>
|
|
66
|
+
<template slot="append">
|
|
67
|
+
<el-button
|
|
68
|
+
icon="el-icon-search"
|
|
69
|
+
type="primary"
|
|
70
|
+
@click="handleSearch"
|
|
71
|
+
></el-button>
|
|
72
|
+
</template>
|
|
73
|
+
</el-input>
|
|
74
|
+
</el-form-item>
|
|
75
|
+
</div>
|
|
76
|
+
</el-form>
|
|
77
|
+
<selection
|
|
78
|
+
v-model="checkeds"
|
|
79
|
+
:data="checkboxs"
|
|
80
|
+
:value-key="valueKey"
|
|
81
|
+
:label-key="labelKey"
|
|
82
|
+
:multiple="mix ? mix : multiple"
|
|
83
|
+
:max="max"
|
|
84
|
+
:showDisabled="showDisabled"
|
|
85
|
+
:disableds="disableds"
|
|
86
|
+
></selection>
|
|
87
|
+
<selection
|
|
88
|
+
v-model="checkeds"
|
|
89
|
+
genre="delete"
|
|
90
|
+
:data="Array.isArray(checkeds) ? checkeds : [checkeds]"
|
|
91
|
+
:value-key="valueKey"
|
|
92
|
+
:label-key="labelKey"
|
|
93
|
+
:multiple="multiple"
|
|
94
|
+
:max="max"
|
|
95
|
+
:mix="mix"
|
|
96
|
+
:isSort="true"
|
|
97
|
+
@sort="handleSort"
|
|
98
|
+
></selection>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
<div class="es-selector-handle">
|
|
102
|
+
<el-button type="primary" size="small" @click="handleConfirm"
|
|
103
|
+
>确定</el-button
|
|
104
|
+
>
|
|
105
|
+
<el-button size="small" @click="handleCancel">取消</el-button>
|
|
106
|
+
</div>
|
|
107
|
+
</el-tab-pane>
|
|
108
|
+
</es-tabs>
|
|
109
|
+
</template>
|
|
110
|
+
<script>
|
|
111
|
+
import tree from './tree.vue';
|
|
112
|
+
import selection from './selection.vue';
|
|
113
|
+
import {
|
|
114
|
+
getSelectorOrgTree,
|
|
115
|
+
getSelectorOrgDetail
|
|
116
|
+
} from 'eoss-ui/src/config/api.js';
|
|
117
|
+
import { debounce } from 'throttle-debounce';
|
|
118
|
+
import util from 'eoss-ui/src/utils/util.js';
|
|
119
|
+
export default {
|
|
120
|
+
name: 'EsSelectorPanel',
|
|
121
|
+
inheritAttrs: false,
|
|
122
|
+
components: {
|
|
123
|
+
tree,
|
|
124
|
+
selection
|
|
125
|
+
},
|
|
126
|
+
props: {
|
|
127
|
+
isShowLevel3: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: true
|
|
130
|
+
},
|
|
131
|
+
method: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: 'get'
|
|
134
|
+
},
|
|
135
|
+
host: {
|
|
136
|
+
type: String,
|
|
137
|
+
default: ''
|
|
138
|
+
},
|
|
139
|
+
value: [Array, Object, String],
|
|
140
|
+
width: {
|
|
141
|
+
type: String,
|
|
142
|
+
default: '900px'
|
|
143
|
+
},
|
|
144
|
+
height: {
|
|
145
|
+
type: String,
|
|
146
|
+
default: '560px'
|
|
147
|
+
},
|
|
148
|
+
//树结构
|
|
149
|
+
tree: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
default: true
|
|
152
|
+
},
|
|
153
|
+
type: {
|
|
154
|
+
type: Array,
|
|
155
|
+
default() {
|
|
156
|
+
return ['enterprise', 'person'];
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
active: String,
|
|
160
|
+
//是否替换页签
|
|
161
|
+
replace: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
default: false
|
|
164
|
+
},
|
|
165
|
+
//页签
|
|
166
|
+
tabs: Object,
|
|
167
|
+
filtrate: {
|
|
168
|
+
type: [Boolean, Object],
|
|
169
|
+
default() {
|
|
170
|
+
return {
|
|
171
|
+
show: true,
|
|
172
|
+
value: '1',
|
|
173
|
+
options: [
|
|
174
|
+
{
|
|
175
|
+
value: '1',
|
|
176
|
+
name: '直接下级'
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
value: '2',
|
|
180
|
+
name: '所有下级'
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
selection: {
|
|
187
|
+
type: [String, Array],
|
|
188
|
+
default: getSelectorOrgDetail
|
|
189
|
+
},
|
|
190
|
+
param: {
|
|
191
|
+
type: Object,
|
|
192
|
+
default() {
|
|
193
|
+
return {};
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
valueKey: {
|
|
197
|
+
type: String,
|
|
198
|
+
default: 'showid'
|
|
199
|
+
},
|
|
200
|
+
labelKey: {
|
|
201
|
+
type: String,
|
|
202
|
+
default: 'showname'
|
|
203
|
+
},
|
|
204
|
+
form: {
|
|
205
|
+
type: Object,
|
|
206
|
+
default() {
|
|
207
|
+
return {};
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
multiple: {
|
|
211
|
+
type: Boolean,
|
|
212
|
+
default: true
|
|
213
|
+
},
|
|
214
|
+
max: Number,
|
|
215
|
+
mix: Boolean,
|
|
216
|
+
disableds: {
|
|
217
|
+
type: Array,
|
|
218
|
+
default() {
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
data() {
|
|
224
|
+
return {
|
|
225
|
+
styles: { width: this.width, height: this.height },
|
|
226
|
+
loading: true,
|
|
227
|
+
search: '',
|
|
228
|
+
defaults: '',
|
|
229
|
+
trees: '',
|
|
230
|
+
checkAll: false,
|
|
231
|
+
selectValue: this.filtrate.value,
|
|
232
|
+
orgpath: false,
|
|
233
|
+
nodeData: '',
|
|
234
|
+
activeName: '',
|
|
235
|
+
selections: [],
|
|
236
|
+
checkboxs: [],
|
|
237
|
+
checkeds: null,
|
|
238
|
+
showDisabled: true,
|
|
239
|
+
options: [
|
|
240
|
+
{
|
|
241
|
+
value: true,
|
|
242
|
+
name: '展示'
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
value: false,
|
|
246
|
+
name: '过滤'
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
};
|
|
250
|
+
},
|
|
251
|
+
computed: {
|
|
252
|
+
//是否显示树结构
|
|
253
|
+
isShowTree() {
|
|
254
|
+
if (typeof this.selection === 'object' && Array.isArray(this.selection)) {
|
|
255
|
+
return false;
|
|
256
|
+
} else {
|
|
257
|
+
return this.tree;
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
showSelect() {
|
|
261
|
+
if (typeof this.filtrate === 'object') {
|
|
262
|
+
return this.filtrate.show;
|
|
263
|
+
} else {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
actived: {
|
|
268
|
+
get() {
|
|
269
|
+
return this.active ? this.active : this.type[0];
|
|
270
|
+
},
|
|
271
|
+
set(val) {
|
|
272
|
+
return val;
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
newTabs() {
|
|
276
|
+
const orgId = util.getStorage('orgId');
|
|
277
|
+
const tabs = {
|
|
278
|
+
enterprise: {
|
|
279
|
+
label: '选择单位',
|
|
280
|
+
name: 'enterprise',
|
|
281
|
+
url: getSelectorOrgTree,
|
|
282
|
+
data: [],
|
|
283
|
+
nodeData: '',
|
|
284
|
+
selection: [],
|
|
285
|
+
value: [],
|
|
286
|
+
param: {
|
|
287
|
+
showarea: 1,
|
|
288
|
+
id: 0,
|
|
289
|
+
filid: 'all'
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
department: {
|
|
293
|
+
label: '选择部门',
|
|
294
|
+
name: 'department',
|
|
295
|
+
url: getSelectorOrgTree,
|
|
296
|
+
data: [],
|
|
297
|
+
nodeData: '',
|
|
298
|
+
selection: [],
|
|
299
|
+
value: [],
|
|
300
|
+
param: {
|
|
301
|
+
showarea: 0,
|
|
302
|
+
id: 0,
|
|
303
|
+
filid: 'all'
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
employee: {
|
|
307
|
+
label: '选择用户',
|
|
308
|
+
name: 'employee',
|
|
309
|
+
url: getSelectorOrgTree,
|
|
310
|
+
data: [],
|
|
311
|
+
nodeData: '',
|
|
312
|
+
selection: [],
|
|
313
|
+
value: [],
|
|
314
|
+
param: {
|
|
315
|
+
showarea: 0,
|
|
316
|
+
id: 0,
|
|
317
|
+
filid: 'all'
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
myemployee: {
|
|
321
|
+
label: '本单位用户',
|
|
322
|
+
name: 'myemployee',
|
|
323
|
+
url: getSelectorOrgTree,
|
|
324
|
+
data: [],
|
|
325
|
+
nodeData: '',
|
|
326
|
+
selection: [],
|
|
327
|
+
value: [],
|
|
328
|
+
param: {
|
|
329
|
+
showarea: 2,
|
|
330
|
+
id: 0,
|
|
331
|
+
filid: orgId
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
otheremployee: {
|
|
335
|
+
label: '外单位用户',
|
|
336
|
+
name: 'otheremployee',
|
|
337
|
+
url: getSelectorOrgTree,
|
|
338
|
+
data: [],
|
|
339
|
+
nodeData: '',
|
|
340
|
+
selection: [],
|
|
341
|
+
value: [],
|
|
342
|
+
param: {
|
|
343
|
+
showarea: 0,
|
|
344
|
+
id: 0,
|
|
345
|
+
filid: 'all'
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
person: {
|
|
349
|
+
label: '选择人员',
|
|
350
|
+
name: 'person',
|
|
351
|
+
url: getSelectorOrgTree,
|
|
352
|
+
data: [],
|
|
353
|
+
nodeData: '',
|
|
354
|
+
selection: [],
|
|
355
|
+
value: [],
|
|
356
|
+
param: {
|
|
357
|
+
showarea: 0,
|
|
358
|
+
id: 0,
|
|
359
|
+
filid: 'all'
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
otherperson: {
|
|
363
|
+
label: '外单位人员',
|
|
364
|
+
name: 'otherperson',
|
|
365
|
+
url: getSelectorOrgTree,
|
|
366
|
+
data: [],
|
|
367
|
+
nodeData: '',
|
|
368
|
+
selection: [],
|
|
369
|
+
value: [],
|
|
370
|
+
param: {
|
|
371
|
+
showarea: 0,
|
|
372
|
+
id: 0,
|
|
373
|
+
filid: 'all'
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
persongroup: {
|
|
377
|
+
label: '选择群组成员',
|
|
378
|
+
name: 'persongroup',
|
|
379
|
+
url: getSelectorOrgTree,
|
|
380
|
+
data: [],
|
|
381
|
+
nodeData: '',
|
|
382
|
+
selection: [],
|
|
383
|
+
value: [],
|
|
384
|
+
param: {
|
|
385
|
+
showarea: 3,
|
|
386
|
+
id: 0,
|
|
387
|
+
filid: 'all'
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
filgroup: {
|
|
391
|
+
label: '单位群组成员',
|
|
392
|
+
data: [],
|
|
393
|
+
nodeData: '',
|
|
394
|
+
selection: [],
|
|
395
|
+
value: [],
|
|
396
|
+
name: 'filgroup',
|
|
397
|
+
url: getSelectorOrgTree,
|
|
398
|
+
param: {
|
|
399
|
+
showarea: 4,
|
|
400
|
+
id: 0,
|
|
401
|
+
filid: 'all'
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
depgroup: {
|
|
405
|
+
label: '部门群组成员',
|
|
406
|
+
name: 'depgroup',
|
|
407
|
+
url: getSelectorOrgTree,
|
|
408
|
+
data: [],
|
|
409
|
+
nodeData: '',
|
|
410
|
+
selection: [],
|
|
411
|
+
value: [],
|
|
412
|
+
param: {
|
|
413
|
+
showarea: 5,
|
|
414
|
+
id: 0,
|
|
415
|
+
filid: 'all'
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
persongroupobj: {
|
|
419
|
+
label: '人员群组',
|
|
420
|
+
name: 'persongroupobj',
|
|
421
|
+
url: getSelectorOrgTree,
|
|
422
|
+
data: [],
|
|
423
|
+
nodeData: '',
|
|
424
|
+
selection: [],
|
|
425
|
+
value: [],
|
|
426
|
+
param: {
|
|
427
|
+
showarea: 11,
|
|
428
|
+
id: 0,
|
|
429
|
+
filid: 'all'
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
filgroupobj: {
|
|
433
|
+
label: '单位群组',
|
|
434
|
+
name: 'filgroupobj',
|
|
435
|
+
url: getSelectorOrgTree,
|
|
436
|
+
data: [],
|
|
437
|
+
nodeData: '',
|
|
438
|
+
selection: [],
|
|
439
|
+
value: [],
|
|
440
|
+
param: {
|
|
441
|
+
showarea: 13,
|
|
442
|
+
id: 0,
|
|
443
|
+
filid: 'all'
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
depgroupobj: {
|
|
447
|
+
label: '部门群组',
|
|
448
|
+
name: 'depgroupobj',
|
|
449
|
+
url: getSelectorOrgTree,
|
|
450
|
+
data: [],
|
|
451
|
+
nodeData: '',
|
|
452
|
+
selection: [],
|
|
453
|
+
value: [],
|
|
454
|
+
param: {
|
|
455
|
+
showarea: 14,
|
|
456
|
+
id: 0,
|
|
457
|
+
filid: 'all'
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
role: {
|
|
461
|
+
label: '选择角色',
|
|
462
|
+
name: 'role',
|
|
463
|
+
url: getSelectorOrgTree,
|
|
464
|
+
data: [],
|
|
465
|
+
nodeData: '',
|
|
466
|
+
selection: [],
|
|
467
|
+
value: [],
|
|
468
|
+
param: {
|
|
469
|
+
showarea: 6,
|
|
470
|
+
id: 0,
|
|
471
|
+
filid: 'all'
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
post: {
|
|
475
|
+
label: '选择岗位',
|
|
476
|
+
name: 'post',
|
|
477
|
+
url: getSelectorOrgTree,
|
|
478
|
+
data: [],
|
|
479
|
+
nodeData: '',
|
|
480
|
+
selection: [],
|
|
481
|
+
value: [],
|
|
482
|
+
param: {
|
|
483
|
+
showarea: 8,
|
|
484
|
+
id: 0,
|
|
485
|
+
filid: 'all'
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
codetable: {
|
|
489
|
+
label: '代码表',
|
|
490
|
+
name: 'codetable',
|
|
491
|
+
url: getSelectorOrgTree,
|
|
492
|
+
data: [],
|
|
493
|
+
nodeData: '',
|
|
494
|
+
selection: [],
|
|
495
|
+
value: [],
|
|
496
|
+
param: {
|
|
497
|
+
showarea: 10,
|
|
498
|
+
id: 0,
|
|
499
|
+
filid: 'all'
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
topcontacts: {
|
|
503
|
+
label: '常用联系人',
|
|
504
|
+
name: 'topcontacts',
|
|
505
|
+
url: getSelectorOrgTree,
|
|
506
|
+
data: [],
|
|
507
|
+
nodeData: '',
|
|
508
|
+
selection: [],
|
|
509
|
+
value: [],
|
|
510
|
+
param: {
|
|
511
|
+
showarea: 9,
|
|
512
|
+
id: 0,
|
|
513
|
+
filid: 'all'
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
if (this.tabs) {
|
|
518
|
+
if (this.replace) {
|
|
519
|
+
return this.tabs;
|
|
520
|
+
} else {
|
|
521
|
+
return util.extend(true, tabs, this.tabs);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
return tabs;
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
watch: {
|
|
528
|
+
type: {
|
|
529
|
+
immediate: true,
|
|
530
|
+
deep: true,
|
|
531
|
+
handler(val, old) {
|
|
532
|
+
if (
|
|
533
|
+
old === undefined ||
|
|
534
|
+
new Set([...val, ...old]).size !== val.length
|
|
535
|
+
) {
|
|
536
|
+
var obj = {};
|
|
537
|
+
this.activeName = this.actived;
|
|
538
|
+
if (this.isShowTree) {
|
|
539
|
+
for (let i in val) {
|
|
540
|
+
obj[val[i]] = this.newTabs[val[i]];
|
|
541
|
+
}
|
|
542
|
+
} else {
|
|
543
|
+
obj[this.activeName] = this.newTabs[this.activeName];
|
|
544
|
+
}
|
|
545
|
+
this.trees = obj;
|
|
546
|
+
this.defaults = JSON.parse(JSON.stringify(obj));
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
activeName: {
|
|
551
|
+
handler(val) {
|
|
552
|
+
this.ajaxActive(val);
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
tabs: {
|
|
556
|
+
deep: true,
|
|
557
|
+
handler() {
|
|
558
|
+
this.loading = true;
|
|
559
|
+
this.getTreeData(
|
|
560
|
+
this.host + this.newTabs[this.activeName].url,
|
|
561
|
+
this.newTabs[this.activeName].param
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
value: {
|
|
566
|
+
immediate: true,
|
|
567
|
+
handler(val) {
|
|
568
|
+
if (val !== undefined) {
|
|
569
|
+
this.trees[this.activeName].value = JSON.parse(JSON.stringify(val));
|
|
570
|
+
} else {
|
|
571
|
+
this.trees[this.activeName].value = '';
|
|
572
|
+
}
|
|
573
|
+
this.checkeds = this.trees[this.activeName].value || [];
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
checkboxs(val) {
|
|
577
|
+
let flag = this.checkboxs.length ? true : false;
|
|
578
|
+
this.checkboxs.forEach((item) => {
|
|
579
|
+
if (util.isObject(item)) {
|
|
580
|
+
if (util.indexOfObj(this.checkeds, item) === -1) {
|
|
581
|
+
flag = false;
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
} else {
|
|
585
|
+
if (this.checkeds.indexOf(item) === -1) {
|
|
586
|
+
flag = false;
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
this.checkAll = flag;
|
|
592
|
+
},
|
|
593
|
+
checkeds(res, old) {
|
|
594
|
+
let val = res;
|
|
595
|
+
// if (!Array.isArray(val)) {
|
|
596
|
+
// this.checkeds = [res];
|
|
597
|
+
// return;
|
|
598
|
+
// }
|
|
599
|
+
if (old.length > 0) {
|
|
600
|
+
if (val.length < old.length) {
|
|
601
|
+
this.checkAll = false;
|
|
602
|
+
} else {
|
|
603
|
+
let flag = true;
|
|
604
|
+
this.checkboxs.forEach((item) => {
|
|
605
|
+
if (util.isObject(item)) {
|
|
606
|
+
if (util.indexOfObj(val, item) === -1) {
|
|
607
|
+
flag = false;
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
} else {
|
|
611
|
+
if (val.indexOf(item) === -1) {
|
|
612
|
+
flag = false;
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
this.checkAll = flag;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
this.trees[this.activeName].value = val;
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
beforeCreate() {
|
|
624
|
+
this.ajaxActive = debounce(500, (active) => {
|
|
625
|
+
this.getAjaxActive(active);
|
|
626
|
+
});
|
|
627
|
+
},
|
|
628
|
+
created() {},
|
|
629
|
+
mounted() {
|
|
630
|
+
this.ajaxActive(this.activeName);
|
|
631
|
+
},
|
|
632
|
+
methods: {
|
|
633
|
+
getAjaxActive(active) {
|
|
634
|
+
if (this.isShowTree) {
|
|
635
|
+
if (
|
|
636
|
+
(!this.trees[active].data ||
|
|
637
|
+
(this.trees[active].data &&
|
|
638
|
+
this.trees[active].data.length === 0)) &&
|
|
639
|
+
this.newTabs[active].url
|
|
640
|
+
) {
|
|
641
|
+
this.loading = true;
|
|
642
|
+
this.getTreeData(
|
|
643
|
+
this.host + this.newTabs[active].url,
|
|
644
|
+
this.newTabs[active].param
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
if (
|
|
648
|
+
!this.trees[active].value ||
|
|
649
|
+
(this.trees[active].value && this.trees[active].value.length === 0)
|
|
650
|
+
) {
|
|
651
|
+
if (this.value !== undefined) {
|
|
652
|
+
this.trees[active].value = JSON.parse(JSON.stringify(this.value));
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
this.checkboxs = this.trees[active].selection || [];
|
|
656
|
+
if (!this.mix) {
|
|
657
|
+
this.checkeds = this.trees[active].value || [];
|
|
658
|
+
}
|
|
659
|
+
this.nodeData = this.trees[active].nodeData;
|
|
660
|
+
} else {
|
|
661
|
+
if (typeof this.selection === 'string') {
|
|
662
|
+
let params = this.param[this.activeName]
|
|
663
|
+
? this.param[this.activeName]
|
|
664
|
+
: this.param;
|
|
665
|
+
util
|
|
666
|
+
.ajax({
|
|
667
|
+
method: this.method,
|
|
668
|
+
url: this.host + this.selection,
|
|
669
|
+
params: params,
|
|
670
|
+
data: params
|
|
671
|
+
})
|
|
672
|
+
.then((res) => {
|
|
673
|
+
if (res.rCode === 0) {
|
|
674
|
+
this.selections = JSON.parse(JSON.stringify(res.results));
|
|
675
|
+
this.checkboxs = JSON.parse(JSON.stringify(res.results)) || [];
|
|
676
|
+
}
|
|
677
|
+
})
|
|
678
|
+
.catch((err) => {
|
|
679
|
+
if (err.message && err.message !== 'canceled') {
|
|
680
|
+
this.$message.error(err.message);
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
} else {
|
|
684
|
+
this.selections = this.selection;
|
|
685
|
+
this.checkboxs = this.selection || [];
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
getTreeData(url, params, id) {
|
|
690
|
+
let data = util.extend(
|
|
691
|
+
{},
|
|
692
|
+
params,
|
|
693
|
+
this.param[this.activeName] ? this.param[this.activeName] : this.param
|
|
694
|
+
);
|
|
695
|
+
if (id !== undefined) {
|
|
696
|
+
data.id = id;
|
|
697
|
+
}
|
|
698
|
+
util
|
|
699
|
+
.ajax({ method: this.method, url: url, params: data, data: data })
|
|
700
|
+
.then((res) => {
|
|
701
|
+
if (res.rCode === 0) {
|
|
702
|
+
this.loading = false;
|
|
703
|
+
if (!Object.prototype.hasOwnProperty.call(params, 'seachkey')) {
|
|
704
|
+
this.$set(
|
|
705
|
+
this.defaults[this.activeName],
|
|
706
|
+
'data',
|
|
707
|
+
JSON.parse(JSON.stringify(res.results))
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
if (res.results.length && res.results[0].name === '无搜索数据') {
|
|
711
|
+
this.$set(this.trees[this.activeName], 'data', null);
|
|
712
|
+
} else {
|
|
713
|
+
this.$set(
|
|
714
|
+
this.trees[this.activeName],
|
|
715
|
+
'data',
|
|
716
|
+
JSON.parse(JSON.stringify(res.results))
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
})
|
|
721
|
+
.catch((err) => {
|
|
722
|
+
if (err.message && err.message !== 'canceled') {
|
|
723
|
+
this.$message.error(err.message);
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
},
|
|
727
|
+
loadsub(data, node, flag) {
|
|
728
|
+
node;
|
|
729
|
+
if (flag) {
|
|
730
|
+
if (data.selection === undefined || data.selection.length === 0) {
|
|
731
|
+
this.checkAll = false;
|
|
732
|
+
let params = util.extend(
|
|
733
|
+
{},
|
|
734
|
+
this.param[this.activeName]
|
|
735
|
+
? this.param[this.activeName]
|
|
736
|
+
: this.param
|
|
737
|
+
);
|
|
738
|
+
params.type = this.activeName;
|
|
739
|
+
params.mid = data.id;
|
|
740
|
+
if (this.activeName === 'enterprise') {
|
|
741
|
+
params.querymode = this.selectValue;
|
|
742
|
+
if (this.selectValue === '2' || this.selectValue === 2) {
|
|
743
|
+
params.orgpath =
|
|
744
|
+
data.attributes && data.attributes.orgpath
|
|
745
|
+
? data.attributes.orgpath
|
|
746
|
+
: '';
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
// if (this.activeName === 'department') {
|
|
750
|
+
// params.querymode = 0;
|
|
751
|
+
// }
|
|
752
|
+
util
|
|
753
|
+
.ajax({
|
|
754
|
+
method: this.method,
|
|
755
|
+
url: this.host + this.selection,
|
|
756
|
+
params: params,
|
|
757
|
+
data: params
|
|
758
|
+
})
|
|
759
|
+
.then((res) => {
|
|
760
|
+
if (res.rCode === 0) {
|
|
761
|
+
data.selection = JSON.parse(JSON.stringify(res.results));
|
|
762
|
+
this.$set(
|
|
763
|
+
this.trees[this.activeName],
|
|
764
|
+
'selection',
|
|
765
|
+
JSON.parse(JSON.stringify(res.results))
|
|
766
|
+
);
|
|
767
|
+
this.$set(this.trees[this.activeName], 'nodeData', data);
|
|
768
|
+
this.nodeData = this.trees[this.activeName].nodeData;
|
|
769
|
+
this.checkboxs = this.trees[this.activeName].selection;
|
|
770
|
+
}
|
|
771
|
+
})
|
|
772
|
+
.catch((err) => {
|
|
773
|
+
if (err.message && err.message !== 'canceled') {
|
|
774
|
+
this.$message.error(err.message);
|
|
775
|
+
}
|
|
776
|
+
});
|
|
777
|
+
} else {
|
|
778
|
+
this.trees[this.activeName].selection = data.selection;
|
|
779
|
+
this.trees[this.activeName].nodeData = data;
|
|
780
|
+
this.nodeData = this.trees[this.activeName].nodeData;
|
|
781
|
+
this.checkboxs = this.trees[this.activeName].selection;
|
|
782
|
+
}
|
|
783
|
+
} else {
|
|
784
|
+
if (!this.isShowLevel3) {
|
|
785
|
+
data.state = '';
|
|
786
|
+
}
|
|
787
|
+
if (
|
|
788
|
+
data.state !== '' &&
|
|
789
|
+
(!data.children || data.children.length === 0)
|
|
790
|
+
) {
|
|
791
|
+
let params = util.extend(
|
|
792
|
+
{},
|
|
793
|
+
this.newTabs[this.activeName].param,
|
|
794
|
+
this.param[this.activeName]
|
|
795
|
+
? this.param[this.activeName]
|
|
796
|
+
: this.param
|
|
797
|
+
);
|
|
798
|
+
params.id = data.id;
|
|
799
|
+
util
|
|
800
|
+
.ajax({
|
|
801
|
+
method: this.method,
|
|
802
|
+
url: this.host + this.newTabs[this.activeName].url,
|
|
803
|
+
data: params,
|
|
804
|
+
params: params
|
|
805
|
+
})
|
|
806
|
+
.then((res) => {
|
|
807
|
+
if (res.rCode === 0) {
|
|
808
|
+
this.loading = false;
|
|
809
|
+
this.$set(
|
|
810
|
+
data,
|
|
811
|
+
'children',
|
|
812
|
+
JSON.parse(JSON.stringify(res.results))
|
|
813
|
+
);
|
|
814
|
+
this.$set(
|
|
815
|
+
this.defaults[this.activeName],
|
|
816
|
+
'data',
|
|
817
|
+
JSON.parse(JSON.stringify(this.trees[this.activeName].data))
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
})
|
|
821
|
+
.catch((err) => {
|
|
822
|
+
if (err.message && err.message !== 'canceled') {
|
|
823
|
+
this.$message.error(err.message);
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
searchTree(res) {
|
|
830
|
+
if (res) {
|
|
831
|
+
this.loading = true;
|
|
832
|
+
let params = util.extend({}, this.newTabs[this.activeName].param, {
|
|
833
|
+
seachkey: res
|
|
834
|
+
});
|
|
835
|
+
this.getTreeData(this.host + this.newTabs[this.activeName].url, params);
|
|
836
|
+
} else {
|
|
837
|
+
this.$set(
|
|
838
|
+
this.trees[this.activeName],
|
|
839
|
+
'data',
|
|
840
|
+
this.defaults[this.activeName].data
|
|
841
|
+
);
|
|
842
|
+
}
|
|
843
|
+
},
|
|
844
|
+
handleCheckAll(res) {
|
|
845
|
+
if (this.checkboxs.length > 0) {
|
|
846
|
+
let isObject = util.isObject(this.checkboxs[0]);
|
|
847
|
+
if (res) {
|
|
848
|
+
if (this.isShowTree) {
|
|
849
|
+
this.nodeData.checkAll = true;
|
|
850
|
+
let checkeds = this.checkeds.concat(
|
|
851
|
+
this.checkboxs.filter((item) => {
|
|
852
|
+
return item.disabled !== true;
|
|
853
|
+
})
|
|
854
|
+
);
|
|
855
|
+
if (checkeds.length > 0) {
|
|
856
|
+
this.checkeds = util.arrUnique(
|
|
857
|
+
checkeds,
|
|
858
|
+
isObject ? this.valueKey : undefined
|
|
859
|
+
);
|
|
860
|
+
}
|
|
861
|
+
} else {
|
|
862
|
+
this.checkeds = this.checkboxs;
|
|
863
|
+
}
|
|
864
|
+
} else {
|
|
865
|
+
if (this.isShowTree) {
|
|
866
|
+
this.nodeData.checkAll = false;
|
|
867
|
+
this.checkboxs.forEach((element) => {
|
|
868
|
+
for (let i in this.checkeds) {
|
|
869
|
+
if (
|
|
870
|
+
(isObject &&
|
|
871
|
+
this.checkeds[i][this.valueKey] ===
|
|
872
|
+
element[this.valueKey]) ||
|
|
873
|
+
this.checkeds[i] === element
|
|
874
|
+
) {
|
|
875
|
+
this.checkeds.splice(i, 1);
|
|
876
|
+
break;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
});
|
|
880
|
+
} else {
|
|
881
|
+
this.checkeds = [];
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
handleSelect(res) {
|
|
887
|
+
if (this.nodeData) {
|
|
888
|
+
this.nodeData.selection = '';
|
|
889
|
+
this.loadsub(this.nodeData, '', true);
|
|
890
|
+
}
|
|
891
|
+
this.$emit('filtratechage', this.trees, this.activeName);
|
|
892
|
+
},
|
|
893
|
+
handleChangeSearch() {
|
|
894
|
+
if (this.search === '') {
|
|
895
|
+
if (this.isShowTree) {
|
|
896
|
+
this.checkboxs = this.nodeData.selection;
|
|
897
|
+
} else {
|
|
898
|
+
this.checkboxs = this.selections;
|
|
899
|
+
}
|
|
900
|
+
} else {
|
|
901
|
+
if (this.isShowTree) {
|
|
902
|
+
if (this.nodeData && this.nodeData.selection) {
|
|
903
|
+
let arry = [];
|
|
904
|
+
this.nodeData.selection.forEach((item) => {
|
|
905
|
+
if (util.isObject(item)) {
|
|
906
|
+
if (item[this.labelKey].indexOf(this.search) > -1) {
|
|
907
|
+
arry.push(item);
|
|
908
|
+
}
|
|
909
|
+
} else {
|
|
910
|
+
if (item.indexOf(this.search) > -1) {
|
|
911
|
+
arry.push(item);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
this.checkboxs = arry;
|
|
916
|
+
}
|
|
917
|
+
} else {
|
|
918
|
+
let arry = [];
|
|
919
|
+
this.selections.forEach((item) => {
|
|
920
|
+
if (util.isObject(item)) {
|
|
921
|
+
if (item[this.labelKey].indexOf(this.search) > -1) {
|
|
922
|
+
arry.push(item);
|
|
923
|
+
}
|
|
924
|
+
} else {
|
|
925
|
+
if (item.indexOf(this.search) > -1) {
|
|
926
|
+
arry.push(item);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
this.checkboxs = arry;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
},
|
|
934
|
+
handleSearch() {
|
|
935
|
+
if (this.isShowTree) {
|
|
936
|
+
if (this.nodeData && this.nodeData.selection) {
|
|
937
|
+
if (this.search !== '') {
|
|
938
|
+
let arry = [];
|
|
939
|
+
this.nodeData.selection.forEach((item) => {
|
|
940
|
+
if (util.isObject(item)) {
|
|
941
|
+
if (item[this.labelKey].indexOf(this.search) > -1) {
|
|
942
|
+
arry.push(item);
|
|
943
|
+
}
|
|
944
|
+
} else {
|
|
945
|
+
if (item.indexOf(this.search) > -1) {
|
|
946
|
+
arry.push(item);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
this.checkboxs = arry;
|
|
951
|
+
}
|
|
952
|
+
} else {
|
|
953
|
+
let mid = '0-0-0-0-0';
|
|
954
|
+
if (this.nodeData) {
|
|
955
|
+
mid = this.nodeData.id;
|
|
956
|
+
}
|
|
957
|
+
util
|
|
958
|
+
.ajax({
|
|
959
|
+
url: this.selection,
|
|
960
|
+
params: {
|
|
961
|
+
mid: mid,
|
|
962
|
+
querymode: this.selectValue,
|
|
963
|
+
type: this.activeName,
|
|
964
|
+
namelike: this.search
|
|
965
|
+
}
|
|
966
|
+
})
|
|
967
|
+
.then((res) => {
|
|
968
|
+
if (res.rCode === 0) {
|
|
969
|
+
this.checkboxs = JSON.parse(JSON.stringify(res.results));
|
|
970
|
+
}
|
|
971
|
+
})
|
|
972
|
+
.catch((err) => {
|
|
973
|
+
if (err.message && err.message !== 'canceled') {
|
|
974
|
+
this.$message.error(err.message);
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
} else {
|
|
979
|
+
if (this.search !== '') {
|
|
980
|
+
let arry = [];
|
|
981
|
+
this.selections.forEach((item) => {
|
|
982
|
+
if (util.isObject(item)) {
|
|
983
|
+
if (item[this.labelKey].indexOf(this.search) > -1) {
|
|
984
|
+
arry.push(item);
|
|
985
|
+
}
|
|
986
|
+
} else {
|
|
987
|
+
if (item.indexOf(this.search) > -1) {
|
|
988
|
+
arry.push(item);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
this.checkboxs = arry;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
},
|
|
996
|
+
handleClick() {
|
|
997
|
+
this.$emit('tabschage', this.trees, this.activeName);
|
|
998
|
+
},
|
|
999
|
+
handleChange() {},
|
|
1000
|
+
handleConfirm() {
|
|
1001
|
+
if (!this.checkeds || (this.multiple && this.checkeds.length === 0)) {
|
|
1002
|
+
this.$message({
|
|
1003
|
+
message: '请选择',
|
|
1004
|
+
type: 'warning'
|
|
1005
|
+
});
|
|
1006
|
+
} else {
|
|
1007
|
+
this.$emit('input', this.checkeds);
|
|
1008
|
+
this.$emit('confirm', this.checkeds);
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
handleCancel() {
|
|
1012
|
+
this.$emit('cancel', false);
|
|
1013
|
+
},
|
|
1014
|
+
handleSort(res) {
|
|
1015
|
+
let oldIndex = res.oldIndex;
|
|
1016
|
+
let newIndex = res.newIndex;
|
|
1017
|
+
|
|
1018
|
+
this.checkeds.splice(newIndex, 0, this.checkeds[oldIndex]);
|
|
1019
|
+
if (oldIndex > newIndex) {
|
|
1020
|
+
this.checkeds.splice(oldIndex + 1, 1);
|
|
1021
|
+
} else {
|
|
1022
|
+
this.checkeds.splice(oldIndex, 1);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
</script>
|