eoss-ui 0.6.99 → 0.7.11
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 +1 -1
- package/lib/button.js +1 -1
- package/lib/calogin.js +234 -234
- package/lib/checkbox-group.js +1 -1
- package/lib/config/api.js +1 -1
- package/lib/data-table-form.js +1 -1
- package/lib/data-table.js +1 -1
- package/lib/date-picker.js +1 -1
- package/lib/dialog.js +1 -1
- package/lib/eoss-ui.common.js +1247 -1213
- package/lib/flow-group.js +1 -1
- package/lib/flow-list.js +82 -82
- package/lib/flow.js +757 -729
- package/lib/form.js +9 -5
- package/lib/handle-user.js +1 -1
- package/lib/handler.js +1 -1
- package/lib/icon.js +1 -1
- package/lib/index.js +1 -1
- package/lib/input-number.js +1 -1
- package/lib/input.js +1 -1
- package/lib/login.js +1 -1
- package/lib/main.js +142 -140
- package/lib/nav.js +1 -1
- package/lib/notify.js +1 -1
- package/lib/page.js +1 -1
- package/lib/pagination.js +1 -1
- package/lib/player.js +1 -1
- package/lib/qr-code.js +14 -14
- package/lib/radio-group.js +1 -1
- package/lib/retrial-auth.js +1 -1
- package/lib/select-ganged.js +1 -1
- package/lib/select.js +1 -1
- package/lib/selector-panel.js +1 -1
- package/lib/selector.js +1 -1
- package/lib/sizer.js +1 -1
- package/lib/steps.js +1 -1
- package/lib/switch.js +1 -1
- package/lib/table-form.js +1 -1
- package/lib/tabs.js +1 -1
- package/lib/tips.js +1 -1
- package/lib/tree-group.js +1 -1
- package/lib/tree.js +1 -1
- package/lib/upload.js +1 -1
- package/lib/wujie.js +1 -1
- package/lib/wxlogin.js +1 -1
- 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 +298 -298
- 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 +988 -988
- package/packages/data-table/src/main.vue +1831 -1831
- 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 +405 -403
- package/packages/flow/src/component/CommonOpinions.vue +364 -364
- package/packages/flow/src/component/CustomPreset.vue +322 -322
- package/packages/flow/src/component/FileList.vue +99 -99
- 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 +642 -641
- package/packages/flow/src/form.vue +121 -121
- package/packages/flow/src/freeStartFlow.vue +2844 -2844
- package/packages/flow/src/main.vue +3750 -3726
- package/packages/flow/src/processForm.vue +1287 -1287
- package/packages/flow/src/processReject.vue +308 -308
- package/packages/flow/src/reset.vue +941 -941
- package/packages/flow/src/selectUser.vue +5 -1
- package/packages/flow/src/startTaskRead.vue +691 -690
- 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 +692 -692
- package/packages/flow-list/index.js +5 -5
- package/packages/flow-list/src/main.vue +1770 -1770
- package/packages/form/index.js +5 -5
- package/packages/form/src/main.vue +3850 -3846
- package/packages/form/src/table.vue +1508 -1508
- 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 +493 -493
- package/packages/icon/index.js +5 -5
- package/packages/icon/src/main.vue +101 -101
- package/packages/icons/index.js +5 -5
- 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 +1993 -1993
- package/packages/login/src/resetPassword.vue +562 -562
- 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 +502 -502
- 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 +221 -221
- 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 +259 -259
- package/packages/main/src/simplicity/index.vue +2125 -2125
- 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 +259 -259
- package/packages/main/src/simplicity/notice.vue +190 -190
- package/packages/main/src/simplicity/router-page.vue +45 -45
- package/packages/main/src/simplicity/sub-menu.vue +264 -264
- package/packages/main/src/simplicity/user.vue +259 -259
- package/packages/main/src/simplicity/userinfo.vue +398 -397
- package/packages/menu/index.js +5 -5
- package/packages/menu/src/main.vue +584 -584
- 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 +781 -781
- 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 +154 -154
- 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/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 +293 -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 +348 -348
- package/packages/theme-chalk/src/form.scss +499 -499
- package/packages/theme-chalk/src/handle-user.scss +40 -40
- package/packages/theme-chalk/src/handler.scss +143 -143
- package/packages/theme-chalk/src/icon.scss +1817 -1817
- 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 +984 -984
- package/packages/theme-chalk/src/main.scss +663 -663
- package/packages/theme-chalk/src/menu.scss +222 -222
- 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 +92 -92
- package/packages/theme-chalk/src/simplicity.scss +1361 -1361
- 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 +1343 -1343
- 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 +308 -308
- 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/webSocket.js +107 -107
- package/packages/.DS_Store +0 -0
- package/packages/autocomplete/.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/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/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/scrollbar/.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,1831 +1,1831 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component
|
|
3
|
-
v-show="showTable"
|
|
4
|
-
class="es-data-table"
|
|
5
|
-
label-width="0"
|
|
6
|
-
ref="component"
|
|
7
|
-
v-loading="tableLoading"
|
|
8
|
-
element-loading-background="rgba(0, 0, 0, 0.65)"
|
|
9
|
-
:is="tag"
|
|
10
|
-
:model="tag === 'div' ? '' : list"
|
|
11
|
-
:element-loading-text="tableLoadingText"
|
|
12
|
-
>
|
|
13
|
-
<es-toolbar
|
|
14
|
-
v-if="showToolbar"
|
|
15
|
-
ref="toolbar"
|
|
16
|
-
:class="{
|
|
17
|
-
'es-table-toolbar-plus': mode == 'plus'
|
|
18
|
-
}"
|
|
19
|
-
v-bind="{
|
|
20
|
-
contents: toolbars,
|
|
21
|
-
showLabel: showLabel,
|
|
22
|
-
close: close,
|
|
23
|
-
callBack: resetHeight,
|
|
24
|
-
showFormBtn: showFormBtn,
|
|
25
|
-
searchValue: searchValue,
|
|
26
|
-
advanceValue: advanceValue
|
|
27
|
-
}"
|
|
28
|
-
v-on="{
|
|
29
|
-
click: handleClick,
|
|
30
|
-
search: hanleSearch,
|
|
31
|
-
submit: hanleSubmit,
|
|
32
|
-
tabs: handleTabs,
|
|
33
|
-
reset: hanleReset,
|
|
34
|
-
cancel: hanleCancel,
|
|
35
|
-
toolbarChange: toolbarChange,
|
|
36
|
-
...toolbarEvents
|
|
37
|
-
}"
|
|
38
|
-
></es-toolbar>
|
|
39
|
-
<p v-if="title" ref="title" class="es-table-title" v-html="title"></p>
|
|
40
|
-
<div
|
|
41
|
-
v-if="show"
|
|
42
|
-
:style="styles"
|
|
43
|
-
class="es-data-table-content"
|
|
44
|
-
:class="{
|
|
45
|
-
'es-table-border-none': border == 'none',
|
|
46
|
-
'es-table-plus': mode == 'plus'
|
|
47
|
-
}"
|
|
48
|
-
ref="esTableContent"
|
|
49
|
-
>
|
|
50
|
-
<el-table
|
|
51
|
-
ref="oaTable"
|
|
52
|
-
v-bind="{
|
|
53
|
-
...$attrs,
|
|
54
|
-
emptyText: emptyText,
|
|
55
|
-
showSummary: showTotal,
|
|
56
|
-
sumText: sumText || totalText,
|
|
57
|
-
totalRow: restotalRow || totalRow,
|
|
58
|
-
height:
|
|
59
|
-
tableHeight !== 'auto' && tableHeight !== false
|
|
60
|
-
? tableHeight
|
|
61
|
-
: undefined,
|
|
62
|
-
border: _border,
|
|
63
|
-
infiniteScroll: getTableData,
|
|
64
|
-
infiniteScrollDisabled: infiniteDisabled,
|
|
65
|
-
dragSort: dragSort,
|
|
66
|
-
dragSortClass: dragSortIcon
|
|
67
|
-
}"
|
|
68
|
-
:data.sync="list"
|
|
69
|
-
v-on="{
|
|
70
|
-
...$listeners,
|
|
71
|
-
'row-click': rowClick,
|
|
72
|
-
'selection-change': selectionChange,
|
|
73
|
-
'filter-column': handleFilterColumn,
|
|
74
|
-
'sort-change': handleSortChange,
|
|
75
|
-
'update-drag-sort': handleUpdateDragSort
|
|
76
|
-
}"
|
|
77
|
-
:class="
|
|
78
|
-
'es-table' +
|
|
79
|
-
(theadBorder && border != 'none' ? ' es-thead-border' : '')
|
|
80
|
-
"
|
|
81
|
-
>
|
|
82
|
-
<slot name="suffix"></slot>
|
|
83
|
-
<slot></slot>
|
|
84
|
-
<template v-for="(item, index) in theads">
|
|
85
|
-
<template v-if="item.hide !== true">
|
|
86
|
-
<el-table-column
|
|
87
|
-
v-if="item.type === 'sort'"
|
|
88
|
-
width="32"
|
|
89
|
-
prop="id"
|
|
90
|
-
:key="item.key || item.label || item.title || index"
|
|
91
|
-
label=" "
|
|
92
|
-
>
|
|
93
|
-
<template slot-scope="scope">
|
|
94
|
-
<es-icon
|
|
95
|
-
v-if="!scope.row.fixed"
|
|
96
|
-
class="es-move"
|
|
97
|
-
:contents="dragSortIcon"
|
|
98
|
-
></es-icon>
|
|
99
|
-
</template>
|
|
100
|
-
</el-table-column>
|
|
101
|
-
<template
|
|
102
|
-
v-else-if="item.type === 'index' || item.type === 'selection'"
|
|
103
|
-
>
|
|
104
|
-
<el-table-column
|
|
105
|
-
:key="item.key || item.label || item.title || index"
|
|
106
|
-
v-bind="dragSort ? { ...item, fixed: false } : item"
|
|
107
|
-
></el-table-column>
|
|
108
|
-
</template>
|
|
109
|
-
<template v-else>
|
|
110
|
-
<children
|
|
111
|
-
:key="item.key || item.label || item.title || index"
|
|
112
|
-
:tag="item.tag"
|
|
113
|
-
v-bind="{
|
|
114
|
-
mode: mode,
|
|
115
|
-
name: name,
|
|
116
|
-
indexs: index,
|
|
117
|
-
form: form,
|
|
118
|
-
readonly: readonly,
|
|
119
|
-
optionData: optionDatas,
|
|
120
|
-
dragSort: dragSort,
|
|
121
|
-
...(dragSort ? { ...item, fixed: false } : { ...item })
|
|
122
|
-
}"
|
|
123
|
-
v-on="{
|
|
124
|
-
handleClick: handleClick,
|
|
125
|
-
formBlur: formBlur,
|
|
126
|
-
formFocus: formFocus,
|
|
127
|
-
formChange: formChange
|
|
128
|
-
}"
|
|
129
|
-
></children>
|
|
130
|
-
</template>
|
|
131
|
-
</template>
|
|
132
|
-
</template>
|
|
133
|
-
<slot name="prefix"></slot>
|
|
134
|
-
<el-table-column
|
|
135
|
-
v-if="editable && !readonly"
|
|
136
|
-
width="80"
|
|
137
|
-
type="handle"
|
|
138
|
-
align="center"
|
|
139
|
-
label="操作"
|
|
140
|
-
fixed="right"
|
|
141
|
-
class="eoss-ui-eidt-column"
|
|
142
|
-
:button="headButton"
|
|
143
|
-
:total="false"
|
|
144
|
-
>
|
|
145
|
-
<template slot-scope="scope">
|
|
146
|
-
<el-button
|
|
147
|
-
v-if="!scope.row.cantAdd"
|
|
148
|
-
type="text"
|
|
149
|
-
@click="handleClickAddData(scope)"
|
|
150
|
-
>
|
|
151
|
-
<i class="el-icon-circle-plus-outline"></i>
|
|
152
|
-
</el-button>
|
|
153
|
-
<el-button
|
|
154
|
-
v-if="!scope.row.cantDelete && !isLeast"
|
|
155
|
-
type="text"
|
|
156
|
-
@click="handleClickDeleteData(scope)"
|
|
157
|
-
>
|
|
158
|
-
<i class="el-icon-remove-outline"></i>
|
|
159
|
-
</el-button>
|
|
160
|
-
</template>
|
|
161
|
-
</el-table-column>
|
|
162
|
-
<template slot="append"><slot name="append"></slot></template>
|
|
163
|
-
</el-table>
|
|
164
|
-
<div v-if="infiniteScroll" class="es-table-page es-loading-page">
|
|
165
|
-
<span>共{{ config.totalCount }}条,</span>
|
|
166
|
-
<span>已加载{{ list.length }}条</span>
|
|
167
|
-
</div>
|
|
168
|
-
<es-pagination
|
|
169
|
-
v-else-if="page !== false && showPage !== false"
|
|
170
|
-
ref="pagination"
|
|
171
|
-
v-bind="config"
|
|
172
|
-
class="es-table-page"
|
|
173
|
-
:position="page.position"
|
|
174
|
-
:style="{ 'text-align': page.position }"
|
|
175
|
-
v-on="{
|
|
176
|
-
change: sizeChange,
|
|
177
|
-
current: currentChange,
|
|
178
|
-
prev: preClick,
|
|
179
|
-
next: nextClick
|
|
180
|
-
}"
|
|
181
|
-
></es-pagination>
|
|
182
|
-
<slot name="dialog"></slot>
|
|
183
|
-
<slot name="other"></slot>
|
|
184
|
-
</div>
|
|
185
|
-
<es-dialog v-if="theads.length" title="列表设置" :visible.sync="showSizer">
|
|
186
|
-
<sizer
|
|
187
|
-
v-if="showSizer"
|
|
188
|
-
:data="theads"
|
|
189
|
-
:mode="mode"
|
|
190
|
-
@confirm="mergeThead"
|
|
191
|
-
></sizer>
|
|
192
|
-
</es-dialog>
|
|
193
|
-
<i
|
|
194
|
-
class="el-icon-setting es-table-setting"
|
|
195
|
-
title="页面配置"
|
|
196
|
-
v-if="isShow"
|
|
197
|
-
@click="openEditPage"
|
|
198
|
-
></i>
|
|
199
|
-
|
|
200
|
-
<es-dialog title="页面配置" :visible.sync="showEditPage" size="full">
|
|
201
|
-
<iframe
|
|
202
|
-
v-if="showEditPage"
|
|
203
|
-
width="100%"
|
|
204
|
-
height="100%"
|
|
205
|
-
frameborder="0"
|
|
206
|
-
:src="editPage"
|
|
207
|
-
></iframe>
|
|
208
|
-
</es-dialog>
|
|
209
|
-
</component>
|
|
210
|
-
</template>
|
|
211
|
-
<script>
|
|
212
|
-
import {
|
|
213
|
-
findSysCode,
|
|
214
|
-
getDictList,
|
|
215
|
-
formContents
|
|
216
|
-
} from 'eoss-ui/src/config/api.js';
|
|
217
|
-
import { debounce, throttle } from 'throttle-debounce';
|
|
218
|
-
import children from './children.vue';
|
|
219
|
-
import sizer from './sizer.vue';
|
|
220
|
-
import util from 'eoss-ui/src/utils/util';
|
|
221
|
-
import qs from 'qs';
|
|
222
|
-
const systemMode = util.win.top.systemMode || util.win.systemMode || 'default';
|
|
223
|
-
const pageView = util.getParams('pageView');
|
|
224
|
-
export default {
|
|
225
|
-
name: 'EsDataTable',
|
|
226
|
-
inheritAttrs: false,
|
|
227
|
-
components: {
|
|
228
|
-
children,
|
|
229
|
-
sizer
|
|
230
|
-
},
|
|
231
|
-
provide() {
|
|
232
|
-
return {
|
|
233
|
-
table: this,
|
|
234
|
-
tableReload: this.reload
|
|
235
|
-
};
|
|
236
|
-
},
|
|
237
|
-
inject: {
|
|
238
|
-
elForm: {
|
|
239
|
-
default: ''
|
|
240
|
-
},
|
|
241
|
-
injector: {
|
|
242
|
-
default: ''
|
|
243
|
-
},
|
|
244
|
-
scale: {
|
|
245
|
-
default: ''
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
props: {
|
|
249
|
-
viewCode: {
|
|
250
|
-
type: String,
|
|
251
|
-
default: pageView
|
|
252
|
-
},
|
|
253
|
-
contentsUrl: {
|
|
254
|
-
type: String,
|
|
255
|
-
default: formContents
|
|
256
|
-
},
|
|
257
|
-
mode: {
|
|
258
|
-
type: String,
|
|
259
|
-
default: systemMode
|
|
260
|
-
},
|
|
261
|
-
service: String,
|
|
262
|
-
loading: {
|
|
263
|
-
type: Boolean,
|
|
264
|
-
default: false
|
|
265
|
-
},
|
|
266
|
-
readonly: Boolean,
|
|
267
|
-
url: {
|
|
268
|
-
type: String,
|
|
269
|
-
default: ''
|
|
270
|
-
},
|
|
271
|
-
defaults: {
|
|
272
|
-
type: Boolean,
|
|
273
|
-
default: false
|
|
274
|
-
},
|
|
275
|
-
param: {
|
|
276
|
-
type: Object,
|
|
277
|
-
default() {
|
|
278
|
-
return {};
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
method: {
|
|
282
|
-
type: String,
|
|
283
|
-
default: 'get'
|
|
284
|
-
},
|
|
285
|
-
isEncodeURI: Boolean,
|
|
286
|
-
format: {
|
|
287
|
-
type: Boolean,
|
|
288
|
-
default: true
|
|
289
|
-
},
|
|
290
|
-
data: {
|
|
291
|
-
type: Array,
|
|
292
|
-
default() {
|
|
293
|
-
return [];
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
// 表格表单
|
|
297
|
-
form: {
|
|
298
|
-
type: Boolean,
|
|
299
|
-
default: false
|
|
300
|
-
},
|
|
301
|
-
name: String,
|
|
302
|
-
title: {
|
|
303
|
-
type: String,
|
|
304
|
-
default: ''
|
|
305
|
-
},
|
|
306
|
-
// 导出文件名
|
|
307
|
-
fileName: {
|
|
308
|
-
type: String,
|
|
309
|
-
default: ''
|
|
310
|
-
},
|
|
311
|
-
// 工具栏配置
|
|
312
|
-
toolbar: {
|
|
313
|
-
type: [Array, Object, Boolean],
|
|
314
|
-
default: false
|
|
315
|
-
},
|
|
316
|
-
showLabel: Boolean,
|
|
317
|
-
searchValue: Object,
|
|
318
|
-
advanceValue: Object,
|
|
319
|
-
executeSearch: {
|
|
320
|
-
type: Boolean,
|
|
321
|
-
default: true
|
|
322
|
-
},
|
|
323
|
-
executeFilter: {
|
|
324
|
-
type: Boolean,
|
|
325
|
-
default: true
|
|
326
|
-
},
|
|
327
|
-
// 是否开启序号
|
|
328
|
-
numbers: {
|
|
329
|
-
type: Boolean,
|
|
330
|
-
default: false
|
|
331
|
-
},
|
|
332
|
-
orders: {
|
|
333
|
-
type: String,
|
|
334
|
-
default: 'asc'
|
|
335
|
-
},
|
|
336
|
-
// 是否筛选列功能
|
|
337
|
-
filter: {
|
|
338
|
-
type: Boolean,
|
|
339
|
-
default: false
|
|
340
|
-
},
|
|
341
|
-
// 是否开启多选
|
|
342
|
-
checkbox: {
|
|
343
|
-
type: Boolean,
|
|
344
|
-
default: false
|
|
345
|
-
},
|
|
346
|
-
selectable: Function,
|
|
347
|
-
reserveSelection: Boolean,
|
|
348
|
-
// 默认选中,类型为Boolean时默认全(不)选
|
|
349
|
-
checked: {
|
|
350
|
-
type: [Boolean, Array],
|
|
351
|
-
default: false
|
|
352
|
-
},
|
|
353
|
-
checkedKey: {
|
|
354
|
-
type: String,
|
|
355
|
-
default: 'id'
|
|
356
|
-
},
|
|
357
|
-
// 无数据时显示的文本
|
|
358
|
-
emptyText: {
|
|
359
|
-
type: String,
|
|
360
|
-
default: '暂无数据'
|
|
361
|
-
},
|
|
362
|
-
// 是否开启合计行区域
|
|
363
|
-
total: {
|
|
364
|
-
type: Boolean,
|
|
365
|
-
default: false
|
|
366
|
-
},
|
|
367
|
-
//本地数据总条数差值
|
|
368
|
-
lose: {
|
|
369
|
-
type: Number,
|
|
370
|
-
default: 0
|
|
371
|
-
},
|
|
372
|
-
// 合计行显示文本
|
|
373
|
-
totalText: {
|
|
374
|
-
type: String,
|
|
375
|
-
default: ''
|
|
376
|
-
},
|
|
377
|
-
showSummary: {
|
|
378
|
-
type: Boolean,
|
|
379
|
-
default: false
|
|
380
|
-
},
|
|
381
|
-
sumText: {
|
|
382
|
-
type: String,
|
|
383
|
-
default: ''
|
|
384
|
-
},
|
|
385
|
-
// 开启分页
|
|
386
|
-
page: {
|
|
387
|
-
type: [Boolean, Object],
|
|
388
|
-
default() {
|
|
389
|
-
return false;
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
showPage: {
|
|
393
|
-
type: Boolean,
|
|
394
|
-
default: true
|
|
395
|
-
},
|
|
396
|
-
// 渲染树形数据指定field
|
|
397
|
-
treeKey: {
|
|
398
|
-
type: String,
|
|
399
|
-
default: ''
|
|
400
|
-
},
|
|
401
|
-
// 单元格配置
|
|
402
|
-
thead: {
|
|
403
|
-
type: Array,
|
|
404
|
-
default() {
|
|
405
|
-
return [];
|
|
406
|
-
}
|
|
407
|
-
},
|
|
408
|
-
optionData: Object,
|
|
409
|
-
// 开启数据增加删除按钮
|
|
410
|
-
editable: {
|
|
411
|
-
type: Boolean,
|
|
412
|
-
default: false
|
|
413
|
-
},
|
|
414
|
-
theadAdd: {
|
|
415
|
-
type: Boolean,
|
|
416
|
-
default: true
|
|
417
|
-
},
|
|
418
|
-
// 单元格点击事件
|
|
419
|
-
click: {
|
|
420
|
-
type: Boolean,
|
|
421
|
-
default: false
|
|
422
|
-
},
|
|
423
|
-
totalRow: {
|
|
424
|
-
type: Object,
|
|
425
|
-
default() {
|
|
426
|
-
return {};
|
|
427
|
-
}
|
|
428
|
-
},
|
|
429
|
-
parseData: Function,
|
|
430
|
-
close: Boolean,
|
|
431
|
-
full: {
|
|
432
|
-
type: Boolean,
|
|
433
|
-
default: true
|
|
434
|
-
},
|
|
435
|
-
height: [Number, String],
|
|
436
|
-
maxHeight: [Number, String],
|
|
437
|
-
response: Function,
|
|
438
|
-
minWidth: [Number, String],
|
|
439
|
-
border: {
|
|
440
|
-
type: [Boolean, String],
|
|
441
|
-
default: false,
|
|
442
|
-
validator: function (value) {
|
|
443
|
-
return [true, false, 'none'].includes(value);
|
|
444
|
-
}
|
|
445
|
-
},
|
|
446
|
-
theadBorder: {
|
|
447
|
-
type: Boolean,
|
|
448
|
-
default: true
|
|
449
|
-
},
|
|
450
|
-
checkboxParseData: Function,
|
|
451
|
-
checkboxParse: Object,
|
|
452
|
-
display: {
|
|
453
|
-
type: Boolean,
|
|
454
|
-
default: true
|
|
455
|
-
},
|
|
456
|
-
showFormBtn: {
|
|
457
|
-
type: Boolean,
|
|
458
|
-
default: true
|
|
459
|
-
},
|
|
460
|
-
index: {
|
|
461
|
-
type: [Number, Function],
|
|
462
|
-
default: 1
|
|
463
|
-
},
|
|
464
|
-
accumulated: {
|
|
465
|
-
type: Boolean,
|
|
466
|
-
default: true
|
|
467
|
-
},
|
|
468
|
-
immediate: {
|
|
469
|
-
type: Boolean,
|
|
470
|
-
default: true
|
|
471
|
-
},
|
|
472
|
-
zoom: false,
|
|
473
|
-
exportExcludeLabel: {
|
|
474
|
-
type: Array,
|
|
475
|
-
default() {
|
|
476
|
-
return [];
|
|
477
|
-
}
|
|
478
|
-
},
|
|
479
|
-
rowData: [Object, Boolean],
|
|
480
|
-
least: Boolean,
|
|
481
|
-
//保留搜索参数
|
|
482
|
-
retainSearh: Boolean,
|
|
483
|
-
//无线滚动
|
|
484
|
-
infiniteScroll: Boolean,
|
|
485
|
-
isJoin: {
|
|
486
|
-
type: Boolean,
|
|
487
|
-
default: true
|
|
488
|
-
},
|
|
489
|
-
ajaxConfig: {
|
|
490
|
-
type: Object,
|
|
491
|
-
default() {
|
|
492
|
-
return {};
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
dragSort: Boolean,
|
|
496
|
-
dragSortIcon: {
|
|
497
|
-
type: String,
|
|
498
|
-
default: 'es-icon-caidan'
|
|
499
|
-
},
|
|
500
|
-
isFieldsEncryption: Boolean,
|
|
501
|
-
contentSuccess: Function,
|
|
502
|
-
resetScroll: {
|
|
503
|
-
type: Boolean,
|
|
504
|
-
default: true
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
data() {
|
|
508
|
-
return {
|
|
509
|
-
isEncryption: this.isFieldsEncryption,
|
|
510
|
-
requests: [],
|
|
511
|
-
toolbars: [],
|
|
512
|
-
toolbarEvents: {},
|
|
513
|
-
hasThead: false,
|
|
514
|
-
theadData: [],
|
|
515
|
-
list: [],
|
|
516
|
-
tableLoading: this.loading,
|
|
517
|
-
tableLoadingText: '加载中...',
|
|
518
|
-
isFirsetCheck: false,
|
|
519
|
-
// 可修改表单的值
|
|
520
|
-
editValue: {},
|
|
521
|
-
restotalRow: null,
|
|
522
|
-
showTotal: false,
|
|
523
|
-
config: {
|
|
524
|
-
pageNum: 1,
|
|
525
|
-
pageSize: 20,
|
|
526
|
-
totalCount: 0,
|
|
527
|
-
layout:
|
|
528
|
-
this.mode == 'plus'
|
|
529
|
-
? 'total, sizes, prev, pager, next, jumper'
|
|
530
|
-
: undefined
|
|
531
|
-
},
|
|
532
|
-
searchWhere: {},
|
|
533
|
-
advanceWhere: {},
|
|
534
|
-
tableHeight: 'auto',
|
|
535
|
-
styles: {},
|
|
536
|
-
selected: null,
|
|
537
|
-
options: {},
|
|
538
|
-
icon: true,
|
|
539
|
-
sysCodes: [],
|
|
540
|
-
infiniteDisabled: !this.infiniteScroll,
|
|
541
|
-
isReload: false,
|
|
542
|
-
pageView: null,
|
|
543
|
-
showSizer: false,
|
|
544
|
-
show: true,
|
|
545
|
-
isSetHeight: false,
|
|
546
|
-
showTable: false,
|
|
547
|
-
fields: null,
|
|
548
|
-
showEditPage: false,
|
|
549
|
-
editPage: ''
|
|
550
|
-
};
|
|
551
|
-
},
|
|
552
|
-
computed: {
|
|
553
|
-
wheres() {
|
|
554
|
-
return { ...this.searchWhere, ...this.advanceWhere };
|
|
555
|
-
},
|
|
556
|
-
params() {
|
|
557
|
-
return {
|
|
558
|
-
...(this.param || {}),
|
|
559
|
-
...(this.searchValue || {}),
|
|
560
|
-
...(this.advanceValue || {})
|
|
561
|
-
};
|
|
562
|
-
},
|
|
563
|
-
tag() {
|
|
564
|
-
return this.form && this.elForm == '' ? 'el-form' : 'div';
|
|
565
|
-
},
|
|
566
|
-
_border() {
|
|
567
|
-
return this.border === true ? true : false;
|
|
568
|
-
},
|
|
569
|
-
theads: {
|
|
570
|
-
get() {
|
|
571
|
-
let types;
|
|
572
|
-
types = this.theadData
|
|
573
|
-
.filter((item) => {
|
|
574
|
-
return (
|
|
575
|
-
item.type == 'selection' ||
|
|
576
|
-
item.type == 'index' ||
|
|
577
|
-
item.type == 'sort' ||
|
|
578
|
-
item.type == 'handle'
|
|
579
|
-
);
|
|
580
|
-
})
|
|
581
|
-
.map((item) => {
|
|
582
|
-
return item.type;
|
|
583
|
-
});
|
|
584
|
-
let thead = [];
|
|
585
|
-
let addfilter = false;
|
|
586
|
-
if (this.dragSort && !types.includes('sort')) {
|
|
587
|
-
addfilter = true;
|
|
588
|
-
thead.push({
|
|
589
|
-
type: 'sort',
|
|
590
|
-
key: 'es-sort'
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
if (this.checkbox && !types.includes('selection')) {
|
|
594
|
-
thead.push({
|
|
595
|
-
type: 'selection',
|
|
596
|
-
width: '55',
|
|
597
|
-
align: 'center',
|
|
598
|
-
fixed: 'left',
|
|
599
|
-
selectable: this.selectable,
|
|
600
|
-
reserveSelection: this.reserveSelection,
|
|
601
|
-
filterIcon: this.filter && !addfilter ? 'es-icon-biao' : undefined,
|
|
602
|
-
key: 'es-checkbox'
|
|
603
|
-
});
|
|
604
|
-
if (!addfilter) {
|
|
605
|
-
addfilter = true;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
if (this.numbers && !types.includes('index')) {
|
|
609
|
-
let index = 1;
|
|
610
|
-
if (typeof this.index === 'function') {
|
|
611
|
-
index = this.index;
|
|
612
|
-
} else {
|
|
613
|
-
if (this.orders == 'desc') {
|
|
614
|
-
index = (num) => {
|
|
615
|
-
return this.config.totalCount - num;
|
|
616
|
-
};
|
|
617
|
-
} else if (this.accumulated) {
|
|
618
|
-
index =
|
|
619
|
-
(this.config.pageNum - 1) * this.config.pageSize + this.index;
|
|
620
|
-
} else {
|
|
621
|
-
index = this.index;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
thead.push({
|
|
625
|
-
type: 'index',
|
|
626
|
-
label: '序号',
|
|
627
|
-
width: '70',
|
|
628
|
-
align: 'center',
|
|
629
|
-
fixed: 'left',
|
|
630
|
-
index: index,
|
|
631
|
-
filterIcon: this.filter && !addfilter ? 'es-icon-biao' : undefined,
|
|
632
|
-
key: 'es-index'
|
|
633
|
-
});
|
|
634
|
-
if (!addfilter) {
|
|
635
|
-
addfilter = true;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
if (this.theadData.length) {
|
|
639
|
-
let handle = this.thead.filter((item) => {
|
|
640
|
-
return item.type == 'handle';
|
|
641
|
-
});
|
|
642
|
-
thead = [
|
|
643
|
-
...thead,
|
|
644
|
-
...this.theadData,
|
|
645
|
-
...(types.includes('handle') ? [] : handle)
|
|
646
|
-
];
|
|
647
|
-
} else if (this.show) {
|
|
648
|
-
thead = [...thead, ...this.thead];
|
|
649
|
-
}
|
|
650
|
-
return thead;
|
|
651
|
-
},
|
|
652
|
-
set(val) {
|
|
653
|
-
return val;
|
|
654
|
-
}
|
|
655
|
-
},
|
|
656
|
-
datas: {
|
|
657
|
-
get() {
|
|
658
|
-
if (this.list && this.list.length) {
|
|
659
|
-
return this.list;
|
|
660
|
-
}
|
|
661
|
-
if (
|
|
662
|
-
this.page &&
|
|
663
|
-
((typeof this.page === 'object' &&
|
|
664
|
-
(!Object.prototype.hasOwnProperty.call(this.page, 'totalCount') ||
|
|
665
|
-
this.page.totalCount == 0)) ||
|
|
666
|
-
this.page === true)
|
|
667
|
-
) {
|
|
668
|
-
this.config.totalCount = this.data.length - this.lose;
|
|
669
|
-
}
|
|
670
|
-
if (this.page && this.data.length > this.config.pageSize) {
|
|
671
|
-
return this.data.filter((item, index) => {
|
|
672
|
-
return (
|
|
673
|
-
index > (this.config.pageNum - 1) * this.config.pageSize - 1 &&
|
|
674
|
-
index < this.config.pageNum * this.config.pageSize
|
|
675
|
-
);
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
return this.data;
|
|
679
|
-
},
|
|
680
|
-
set(val) {
|
|
681
|
-
if (this.list && this.list.length) {
|
|
682
|
-
this.$nextTick(() => {
|
|
683
|
-
this.list = val;
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
this.$emit('update:data', val);
|
|
687
|
-
return val;
|
|
688
|
-
}
|
|
689
|
-
},
|
|
690
|
-
showToolbar() {
|
|
691
|
-
if (this.readonly) {
|
|
692
|
-
return false;
|
|
693
|
-
}
|
|
694
|
-
if (typeof this.toolbar === 'boolean') {
|
|
695
|
-
if (this.toolbar) {
|
|
696
|
-
this.toolbars = [
|
|
697
|
-
{
|
|
698
|
-
type: 'search',
|
|
699
|
-
contents: [
|
|
700
|
-
{
|
|
701
|
-
type: 'text',
|
|
702
|
-
name: 'keyword',
|
|
703
|
-
placeholder: '请输入关键字'
|
|
704
|
-
}
|
|
705
|
-
]
|
|
706
|
-
}
|
|
707
|
-
];
|
|
708
|
-
}
|
|
709
|
-
return this.toolbar;
|
|
710
|
-
} else if (Array.isArray(this.toolbar)) {
|
|
711
|
-
this.toolbars = this.toolbar;
|
|
712
|
-
return true;
|
|
713
|
-
} else {
|
|
714
|
-
this.toolbars = this.toolbar.contents;
|
|
715
|
-
this.toolbarEvents = this.toolbar.events || {};
|
|
716
|
-
return true;
|
|
717
|
-
}
|
|
718
|
-
},
|
|
719
|
-
optionDatas: {
|
|
720
|
-
get() {
|
|
721
|
-
let data = this.optionData
|
|
722
|
-
? { ...this.optionData, ...this.options }
|
|
723
|
-
: this.options;
|
|
724
|
-
return data;
|
|
725
|
-
},
|
|
726
|
-
set(val) {
|
|
727
|
-
return val;
|
|
728
|
-
}
|
|
729
|
-
},
|
|
730
|
-
headButton() {
|
|
731
|
-
return this.theadAdd && !this.readonly
|
|
732
|
-
? {
|
|
733
|
-
icon: 'el-icon-circle-plus-outline',
|
|
734
|
-
type: 'text',
|
|
735
|
-
event: this.handleClickAddData
|
|
736
|
-
}
|
|
737
|
-
: undefined;
|
|
738
|
-
},
|
|
739
|
-
isLeast() {
|
|
740
|
-
return this.data.length < 2 && this.least;
|
|
741
|
-
},
|
|
742
|
-
findCode() {
|
|
743
|
-
if (this.service) {
|
|
744
|
-
return `/${this.service}${getDictList}`;
|
|
745
|
-
}
|
|
746
|
-
return findSysCode;
|
|
747
|
-
},
|
|
748
|
-
isShow() {
|
|
749
|
-
let useCaseCodes = util.getStorage('useCaseCodes');
|
|
750
|
-
return (
|
|
751
|
-
this.viewCode &&
|
|
752
|
-
useCaseCodes &&
|
|
753
|
-
(useCaseCodes.indexOf('SuperAdminRoleID') > -1 ||
|
|
754
|
-
useCaseCodes.indexOf('OrgAdminRoleID') > -1)
|
|
755
|
-
);
|
|
756
|
-
}
|
|
757
|
-
},
|
|
758
|
-
watch: {
|
|
759
|
-
viewCode: {
|
|
760
|
-
immediate: true,
|
|
761
|
-
handler(val) {
|
|
762
|
-
if (val) {
|
|
763
|
-
this.hasThead = true;
|
|
764
|
-
this.getContents();
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
},
|
|
768
|
-
showToolbar() {
|
|
769
|
-
this.resetHeight();
|
|
770
|
-
this.doLayout();
|
|
771
|
-
},
|
|
772
|
-
data: {
|
|
773
|
-
deep: true,
|
|
774
|
-
handler() {
|
|
775
|
-
this.list = this.setData();
|
|
776
|
-
}
|
|
777
|
-
},
|
|
778
|
-
scale: {
|
|
779
|
-
deep: true,
|
|
780
|
-
handler(val) {
|
|
781
|
-
if (
|
|
782
|
-
this.tableHeight != 'auto' &&
|
|
783
|
-
this.tableHeight !== false &&
|
|
784
|
-
this.display
|
|
785
|
-
) {
|
|
786
|
-
this.resetHeight();
|
|
787
|
-
this.doLayout();
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
},
|
|
791
|
-
zoom: {
|
|
792
|
-
handler() {
|
|
793
|
-
if (
|
|
794
|
-
this.tableHeight != 'auto' &&
|
|
795
|
-
this.tableHeight !== false &&
|
|
796
|
-
this.display
|
|
797
|
-
) {
|
|
798
|
-
this.resetHeight();
|
|
799
|
-
this.doLayout();
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
},
|
|
803
|
-
checked(newVal) {
|
|
804
|
-
this.list.length && this.checkSelect(newVal);
|
|
805
|
-
},
|
|
806
|
-
thead: {
|
|
807
|
-
deep: true,
|
|
808
|
-
handler(val, old) {
|
|
809
|
-
if (!util.isObjectEqual(val, old)) {
|
|
810
|
-
this.getOptions(val);
|
|
811
|
-
this.chekOpenTotalArea();
|
|
812
|
-
if (Array.isArray(val) && val.length && this.datas.length == 0) {
|
|
813
|
-
this.getTableData();
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
},
|
|
818
|
-
theads: {
|
|
819
|
-
deep: true,
|
|
820
|
-
handler() {
|
|
821
|
-
this.chekOpenTotalArea();
|
|
822
|
-
}
|
|
823
|
-
},
|
|
824
|
-
param: {
|
|
825
|
-
handler(val, old) {
|
|
826
|
-
if (!util.isObjectEqual(val, old)) {
|
|
827
|
-
this.getTableData();
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
},
|
|
831
|
-
page: {
|
|
832
|
-
immediate: true,
|
|
833
|
-
deep: true,
|
|
834
|
-
handler(val) {
|
|
835
|
-
if (this.$el) {
|
|
836
|
-
this.resetHeight();
|
|
837
|
-
this.doLayout();
|
|
838
|
-
}
|
|
839
|
-
if (typeof val === 'object') {
|
|
840
|
-
this.config = util.extend({}, this.config, val);
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
},
|
|
844
|
-
'config.pageNum'() {
|
|
845
|
-
if (this.data.length) {
|
|
846
|
-
this.resetScroll &&
|
|
847
|
-
this.$refs.oaTable &&
|
|
848
|
-
this.$refs.oaTable.resetScroll &&
|
|
849
|
-
this.$refs.oaTable.resetScroll(0, 0);
|
|
850
|
-
this.list = this.setData();
|
|
851
|
-
}
|
|
852
|
-
},
|
|
853
|
-
height: {
|
|
854
|
-
immediate: true,
|
|
855
|
-
handler(val) {
|
|
856
|
-
if (val) {
|
|
857
|
-
this.tableHeight = val;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
},
|
|
861
|
-
maxHeight: {
|
|
862
|
-
immediate: true,
|
|
863
|
-
handler(val) {
|
|
864
|
-
if (val && this.height === undefined) {
|
|
865
|
-
this.tableHeight = val;
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
},
|
|
869
|
-
display(val) {
|
|
870
|
-
if (val) {
|
|
871
|
-
this.resetHeight();
|
|
872
|
-
this.doLayout();
|
|
873
|
-
}
|
|
874
|
-
},
|
|
875
|
-
showEditPage(val) {
|
|
876
|
-
if (val === false) {
|
|
877
|
-
util.win.top.refresh();
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
},
|
|
881
|
-
beforeCreate() {
|
|
882
|
-
this.getTableData = debounce(500, (res) => {
|
|
883
|
-
this.getTableDatas(res);
|
|
884
|
-
});
|
|
885
|
-
},
|
|
886
|
-
created() {
|
|
887
|
-
if (Array.isArray(this.thead) && this.thead.length) {
|
|
888
|
-
this.getOptions(this.thead);
|
|
889
|
-
this.immediate && !this.viewCode && this.getTableData();
|
|
890
|
-
}
|
|
891
|
-
this.chekOpenTotalArea();
|
|
892
|
-
},
|
|
893
|
-
mounted() {
|
|
894
|
-
this.showTable = true;
|
|
895
|
-
if (this.data.length) {
|
|
896
|
-
this.list = this.setData();
|
|
897
|
-
}
|
|
898
|
-
this.list.length && this.checkSelect(this.checked);
|
|
899
|
-
this.resetHeight();
|
|
900
|
-
if (util.win.top != util.win.self) {
|
|
901
|
-
util.win.onresize = throttle(500, this.resetHeight);
|
|
902
|
-
}
|
|
903
|
-
},
|
|
904
|
-
methods: {
|
|
905
|
-
setData() {
|
|
906
|
-
if (
|
|
907
|
-
this.page &&
|
|
908
|
-
((typeof this.page === 'object' &&
|
|
909
|
-
(!Object.prototype.hasOwnProperty.call(this.page, 'totalCount') ||
|
|
910
|
-
this.page.totalCount == 0)) ||
|
|
911
|
-
this.page === true)
|
|
912
|
-
) {
|
|
913
|
-
this.config.totalCount = this.data.length - this.lose;
|
|
914
|
-
}
|
|
915
|
-
if (this.page && this.data.length > this.config.pageSize) {
|
|
916
|
-
return this.data.filter((item, index) => {
|
|
917
|
-
return (
|
|
918
|
-
index > (this.config.pageNum - 1) * this.config.pageSize - 1 &&
|
|
919
|
-
index < this.config.pageNum * this.config.pageSize
|
|
920
|
-
);
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
return this.data;
|
|
924
|
-
},
|
|
925
|
-
getRequestKey(config) {
|
|
926
|
-
const { method, url, params, data } = config;
|
|
927
|
-
return [method, url, qs.stringify(params), qs.stringify(data)].join('&');
|
|
928
|
-
},
|
|
929
|
-
getContents() {
|
|
930
|
-
util
|
|
931
|
-
.ajax({
|
|
932
|
-
url: this.contentsUrl,
|
|
933
|
-
params: {
|
|
934
|
-
formId: this.viewCode
|
|
935
|
-
}
|
|
936
|
-
})
|
|
937
|
-
.then((res) => {
|
|
938
|
-
if (res.rCode == 0) {
|
|
939
|
-
if (this.contentSuccess) {
|
|
940
|
-
this.contentSuccess(res.results);
|
|
941
|
-
} else {
|
|
942
|
-
let {
|
|
943
|
-
results: { eossFormJson }
|
|
944
|
-
} = res;
|
|
945
|
-
eossFormJson = JSON.parse(eossFormJson);
|
|
946
|
-
if (eossFormJson && eossFormJson.table) {
|
|
947
|
-
this.isEncryption = true;
|
|
948
|
-
this.theadData = eossFormJson.table.thead;
|
|
949
|
-
this.getTableData();
|
|
950
|
-
} else {
|
|
951
|
-
this.hasThead = false;
|
|
952
|
-
}
|
|
953
|
-
this.$emit('init-contents', res.results);
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
});
|
|
957
|
-
},
|
|
958
|
-
getOptions(res) {
|
|
959
|
-
let sysCodes = [];
|
|
960
|
-
res.forEach((item) => {
|
|
961
|
-
if (item.sysCode || item.url) {
|
|
962
|
-
item.sysCode && sysCodes.push(item.sysCode);
|
|
963
|
-
let params = util.extend(
|
|
964
|
-
{},
|
|
965
|
-
item.sysCode
|
|
966
|
-
? { sysAppCode: item.sysCode, code: item.sysCode }
|
|
967
|
-
: {},
|
|
968
|
-
item.param ? item.param : {}
|
|
969
|
-
);
|
|
970
|
-
let key = this.getRequestKey({
|
|
971
|
-
method: this.method,
|
|
972
|
-
url: item.sysCode ? this.findCode : item.url,
|
|
973
|
-
params: params,
|
|
974
|
-
data: {}
|
|
975
|
-
});
|
|
976
|
-
if (!this.requests.includes(key)) {
|
|
977
|
-
util
|
|
978
|
-
.ajax({
|
|
979
|
-
url: item.sysCode ? this.findCode : item.url,
|
|
980
|
-
method: this.method,
|
|
981
|
-
params: params,
|
|
982
|
-
data: params
|
|
983
|
-
})
|
|
984
|
-
.then((res) => {
|
|
985
|
-
if (res.rCode === 0) {
|
|
986
|
-
if (item.type == 'ganged') {
|
|
987
|
-
this.$set(
|
|
988
|
-
this.options,
|
|
989
|
-
item.sysCode || item.field || item.prop,
|
|
990
|
-
[JSON.parse(JSON.stringify(res.results))]
|
|
991
|
-
);
|
|
992
|
-
if (item.sysCode) {
|
|
993
|
-
const bus = this.bus || this.$root.Bus;
|
|
994
|
-
bus &&
|
|
995
|
-
bus.$emit(
|
|
996
|
-
item.sysCode,
|
|
997
|
-
JSON.parse(JSON.stringify(this.options[item.sysCode]))
|
|
998
|
-
);
|
|
999
|
-
}
|
|
1000
|
-
} else {
|
|
1001
|
-
this.$set(
|
|
1002
|
-
this.options,
|
|
1003
|
-
item.sysCode || item.field || item.prop,
|
|
1004
|
-
JSON.parse(JSON.stringify(res.results))
|
|
1005
|
-
);
|
|
1006
|
-
if (item.sysCode) {
|
|
1007
|
-
const bus = this.bus || this.$root.Bus;
|
|
1008
|
-
bus &&
|
|
1009
|
-
bus.$emit(
|
|
1010
|
-
item.sysCode,
|
|
1011
|
-
JSON.parse(JSON.stringify(res.results))
|
|
1012
|
-
);
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
this.requests.push(key);
|
|
1016
|
-
} else {
|
|
1017
|
-
let msg = res.msg || '系统错误,请联系管理员!';
|
|
1018
|
-
this.$message.error(msg);
|
|
1019
|
-
}
|
|
1020
|
-
})
|
|
1021
|
-
.catch((err) => {
|
|
1022
|
-
if (err.message && err.message !== 'canceled') {
|
|
1023
|
-
this.$message.error(err.message);
|
|
1024
|
-
}
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
1027
|
-
} else {
|
|
1028
|
-
if (item.childHead && item.childHead.length) {
|
|
1029
|
-
this.getOptions(item.childHead);
|
|
1030
|
-
}
|
|
1031
|
-
if (item.children && item.children.length) {
|
|
1032
|
-
this.getOptions(item.children);
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
});
|
|
1036
|
-
this.sysCodes = sysCodes;
|
|
1037
|
-
|
|
1038
|
-
this.bindEventBus();
|
|
1039
|
-
},
|
|
1040
|
-
checkObject(item) {
|
|
1041
|
-
return util.getObjectType(item) === 'object';
|
|
1042
|
-
},
|
|
1043
|
-
chekOpenTotalArea() {
|
|
1044
|
-
if (this.total || this.showSummary) {
|
|
1045
|
-
this.showTotal = true;
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1048
|
-
if (!this.theads) {
|
|
1049
|
-
return;
|
|
1050
|
-
}
|
|
1051
|
-
const arr = JSON.parse(JSON.stringify(this.theads));
|
|
1052
|
-
let flag = false;
|
|
1053
|
-
arr.forEach((item) => {
|
|
1054
|
-
if (item.total) {
|
|
1055
|
-
flag = true;
|
|
1056
|
-
this.showTotal = true;
|
|
1057
|
-
}
|
|
1058
|
-
});
|
|
1059
|
-
if (this.showTotal !== flag) {
|
|
1060
|
-
this.showTotal = flag;
|
|
1061
|
-
}
|
|
1062
|
-
},
|
|
1063
|
-
rowClick(row, column, event) {
|
|
1064
|
-
this.$emit('click', row, column, event);
|
|
1065
|
-
this.$emit('row-click', row, column, event);
|
|
1066
|
-
},
|
|
1067
|
-
handleClickAddData(scope) {
|
|
1068
|
-
if (scope && scope.row) {
|
|
1069
|
-
const data = JSON.parse(JSON.stringify(scope.row));
|
|
1070
|
-
let index = scope.$index + 1;
|
|
1071
|
-
if (this.page) {
|
|
1072
|
-
index += (this.config.pageNum - 1) * this.config.pageSize;
|
|
1073
|
-
}
|
|
1074
|
-
this.data.splice(index, 0, data);
|
|
1075
|
-
this.$emit('dataChange', 'add', data);
|
|
1076
|
-
this.$emit('data-change', 'add', data);
|
|
1077
|
-
this.$emit('btnClick', {
|
|
1078
|
-
event: 'addRow',
|
|
1079
|
-
row: data,
|
|
1080
|
-
index: index,
|
|
1081
|
-
data: this.data
|
|
1082
|
-
});
|
|
1083
|
-
this.$emit('btn-click', {
|
|
1084
|
-
event: 'addRow',
|
|
1085
|
-
row: data,
|
|
1086
|
-
index: index,
|
|
1087
|
-
data: this.data
|
|
1088
|
-
});
|
|
1089
|
-
} else {
|
|
1090
|
-
let index = this.data.length;
|
|
1091
|
-
if (this.page) {
|
|
1092
|
-
index += (this.config.pageNum - 1) * this.config.pageSize;
|
|
1093
|
-
}
|
|
1094
|
-
let rows = {};
|
|
1095
|
-
if (this.rowData && typeof this.rowData == 'object') {
|
|
1096
|
-
rows = this.rowData;
|
|
1097
|
-
} else if (index && this.rowData === true) {
|
|
1098
|
-
rows = JSON.parse(JSON.stringify(this.data[index - 1]));
|
|
1099
|
-
} else {
|
|
1100
|
-
this.getRow(this.thead, rows);
|
|
1101
|
-
}
|
|
1102
|
-
this.data.splice(index, 0, rows);
|
|
1103
|
-
}
|
|
1104
|
-
},
|
|
1105
|
-
getRow(thead, obj) {
|
|
1106
|
-
thead.forEach((item) => {
|
|
1107
|
-
if (item.field) {
|
|
1108
|
-
obj[item['field']] = item.defaultValue || '';
|
|
1109
|
-
} else if (item.children && item.children.length) {
|
|
1110
|
-
this.getRow(item.children, obj);
|
|
1111
|
-
}
|
|
1112
|
-
});
|
|
1113
|
-
},
|
|
1114
|
-
handleClickDeleteData(scope) {
|
|
1115
|
-
const data = JSON.parse(JSON.stringify(scope.row));
|
|
1116
|
-
let index = scope.$index;
|
|
1117
|
-
if (this.page) {
|
|
1118
|
-
index += (this.config.pageNum - 1) * this.config.pageSize;
|
|
1119
|
-
}
|
|
1120
|
-
this.data.splice(index, 1);
|
|
1121
|
-
this.$emit('dataChange', 'delete', data);
|
|
1122
|
-
this.$emit('data-change', 'delete', data);
|
|
1123
|
-
this.$emit('btnClick', {
|
|
1124
|
-
event: 'deleteRow',
|
|
1125
|
-
row: data,
|
|
1126
|
-
index: index,
|
|
1127
|
-
data: this.data
|
|
1128
|
-
});
|
|
1129
|
-
this.$emit('btn-click', {
|
|
1130
|
-
event: 'deleteRow',
|
|
1131
|
-
row: data,
|
|
1132
|
-
index: index,
|
|
1133
|
-
data: this.data
|
|
1134
|
-
});
|
|
1135
|
-
},
|
|
1136
|
-
checkSelect(newVal) {
|
|
1137
|
-
this.$nextTick(() => {
|
|
1138
|
-
if (util.getObjectType(newVal) === 'array') {
|
|
1139
|
-
newVal.forEach((row) => {
|
|
1140
|
-
if (util.isObject(row)) {
|
|
1141
|
-
this.$refs.oaTable.toggleRowSelection(row, true);
|
|
1142
|
-
} else {
|
|
1143
|
-
this.setChecked(this.list, row);
|
|
1144
|
-
}
|
|
1145
|
-
});
|
|
1146
|
-
} else if (newVal === true) {
|
|
1147
|
-
this.toggleAllSelection();
|
|
1148
|
-
}
|
|
1149
|
-
});
|
|
1150
|
-
},
|
|
1151
|
-
setChecked(list, row) {
|
|
1152
|
-
list.forEach((item) => {
|
|
1153
|
-
if (item.children && item.children.length) {
|
|
1154
|
-
this.setChecked(item.children, row);
|
|
1155
|
-
}
|
|
1156
|
-
if (item[this.checkedKey] === row) {
|
|
1157
|
-
this.$refs.oaTable.toggleRowSelection(item, true);
|
|
1158
|
-
return;
|
|
1159
|
-
}
|
|
1160
|
-
});
|
|
1161
|
-
},
|
|
1162
|
-
getTableDatas(res) {
|
|
1163
|
-
let where;
|
|
1164
|
-
let first;
|
|
1165
|
-
if (res) {
|
|
1166
|
-
where = res.where;
|
|
1167
|
-
first = res.first;
|
|
1168
|
-
}
|
|
1169
|
-
if (!this.url) {
|
|
1170
|
-
return;
|
|
1171
|
-
}
|
|
1172
|
-
if (first !== false && !this.infiniteScroll) {
|
|
1173
|
-
this.config.pageNum = 1;
|
|
1174
|
-
}
|
|
1175
|
-
this.tableLoadingText = '加载中...';
|
|
1176
|
-
let reqData = util.extend(
|
|
1177
|
-
{},
|
|
1178
|
-
this.params,
|
|
1179
|
-
this.page
|
|
1180
|
-
? {
|
|
1181
|
-
pageNum: this.config.pageNum,
|
|
1182
|
-
pageSize: this.config.pageSize
|
|
1183
|
-
}
|
|
1184
|
-
: {}
|
|
1185
|
-
);
|
|
1186
|
-
if (where) {
|
|
1187
|
-
reqData = util.extend({}, reqData, where);
|
|
1188
|
-
}
|
|
1189
|
-
//if (this.fields)
|
|
1190
|
-
if (this.retainSearh || first === false) {
|
|
1191
|
-
reqData = util.extend({}, reqData, this.wheres);
|
|
1192
|
-
}
|
|
1193
|
-
if (this.isJoin) {
|
|
1194
|
-
for (let i in reqData) {
|
|
1195
|
-
if (Array.isArray(reqData[i])) {
|
|
1196
|
-
reqData[i] = reqData[i].join(',');
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
if (this.isEncryption) {
|
|
1201
|
-
let fields = [];
|
|
1202
|
-
this.theads.forEach((item) => {
|
|
1203
|
-
if (item.field || item.prop) {
|
|
1204
|
-
fields.push(item.field || item.prop);
|
|
1205
|
-
}
|
|
1206
|
-
});
|
|
1207
|
-
let initLogin = util.getStorage('initLogin');
|
|
1208
|
-
initLogin && (initLogin = JSON.parse(initLogin));
|
|
1209
|
-
reqData['fields'] = initLogin.secret
|
|
1210
|
-
? util.esmEncrypt({
|
|
1211
|
-
data: fields.join(','),
|
|
1212
|
-
key: initLogin.secret
|
|
1213
|
-
})
|
|
1214
|
-
: fields.join(',');
|
|
1215
|
-
}
|
|
1216
|
-
this.tableLoading = true;
|
|
1217
|
-
util
|
|
1218
|
-
.ajax({
|
|
1219
|
-
...this.ajaxConfig,
|
|
1220
|
-
url: this.url,
|
|
1221
|
-
method: this.method,
|
|
1222
|
-
format: this.format,
|
|
1223
|
-
params: reqData,
|
|
1224
|
-
data: reqData
|
|
1225
|
-
})
|
|
1226
|
-
.then((res) => {
|
|
1227
|
-
this.tableLoading = false;
|
|
1228
|
-
if (res.rCode === 0 || res.status === 'success') {
|
|
1229
|
-
if (this.isReload) {
|
|
1230
|
-
this.list = [];
|
|
1231
|
-
this.isReload = false;
|
|
1232
|
-
}
|
|
1233
|
-
let results =
|
|
1234
|
-
this.parseData !== undefined
|
|
1235
|
-
? this.parseData(res.results || res.data || res)
|
|
1236
|
-
: res.results || res.data;
|
|
1237
|
-
if (this.infiniteScroll) {
|
|
1238
|
-
this.list = this.list.concat(
|
|
1239
|
-
results.data || results.records || results.list
|
|
1240
|
-
);
|
|
1241
|
-
this.config.pageNum += 1;
|
|
1242
|
-
} else {
|
|
1243
|
-
this.list = results.data || results.records || results.list;
|
|
1244
|
-
this.$nextTick(() => {
|
|
1245
|
-
this.resetScroll &&
|
|
1246
|
-
this.$refs.oaTable &&
|
|
1247
|
-
this.$refs.oaTable.resetScroll &&
|
|
1248
|
-
this.$refs.oaTable.resetScroll(0, 0);
|
|
1249
|
-
});
|
|
1250
|
-
}
|
|
1251
|
-
this.config.totalCount =
|
|
1252
|
-
results.count || results.total || results.totalCount;
|
|
1253
|
-
this.config.pageCount = results.pageCount;
|
|
1254
|
-
this.checked &&
|
|
1255
|
-
this.$nextTick(() => {
|
|
1256
|
-
this.checkSelect(this.checked);
|
|
1257
|
-
});
|
|
1258
|
-
if (
|
|
1259
|
-
this.infiniteScroll &&
|
|
1260
|
-
this.config.totalCount === this.list.length
|
|
1261
|
-
) {
|
|
1262
|
-
this.infiniteDisabled = true;
|
|
1263
|
-
}
|
|
1264
|
-
} else {
|
|
1265
|
-
this.list = [];
|
|
1266
|
-
//this.tableHeight = false;
|
|
1267
|
-
let msg = res.msg || '系统错误,请联系管理员!';
|
|
1268
|
-
this.$message.error(msg);
|
|
1269
|
-
}
|
|
1270
|
-
this.$emit('success', res);
|
|
1271
|
-
})
|
|
1272
|
-
.catch((err) => {
|
|
1273
|
-
//this.tableHeight = false;
|
|
1274
|
-
if (err.message && err.message !== 'canceled') {
|
|
1275
|
-
this.$message.error(err.message);
|
|
1276
|
-
}
|
|
1277
|
-
this.tableLoading = false;
|
|
1278
|
-
});
|
|
1279
|
-
},
|
|
1280
|
-
selectionChange(data) {
|
|
1281
|
-
this.selected = JSON.parse(JSON.stringify(data));
|
|
1282
|
-
this.$emit('selection-change', data);
|
|
1283
|
-
},
|
|
1284
|
-
clearSelection() {
|
|
1285
|
-
this.$refs.oaTable.clearSelection();
|
|
1286
|
-
},
|
|
1287
|
-
toggleRowSelection(row, selected) {
|
|
1288
|
-
this.$refs.oaTable.toggleRowSelection(row, selected);
|
|
1289
|
-
},
|
|
1290
|
-
toggleAllSelection() {
|
|
1291
|
-
this.$refs.oaTable.toggleAllSelection();
|
|
1292
|
-
},
|
|
1293
|
-
toggleRowExpansion(row, expanded) {
|
|
1294
|
-
this.$refs.oaTable.toggleRowExpansion(row, expanded);
|
|
1295
|
-
},
|
|
1296
|
-
setCurrentRow(row) {
|
|
1297
|
-
this.$refs.oaTable.setCurrentRow(row);
|
|
1298
|
-
},
|
|
1299
|
-
|
|
1300
|
-
clearSort() {
|
|
1301
|
-
this.$refs.oaTable.clearSort();
|
|
1302
|
-
},
|
|
1303
|
-
clearFilter(columnKey) {
|
|
1304
|
-
this.$refs.oaTable.clearFilter(columnKey);
|
|
1305
|
-
},
|
|
1306
|
-
doLayout() {
|
|
1307
|
-
this.$refs.oaTable && this.$refs.oaTable.doLayout();
|
|
1308
|
-
},
|
|
1309
|
-
sort(prop, order) {
|
|
1310
|
-
this.$refs.oaTable.sort(prop, order);
|
|
1311
|
-
},
|
|
1312
|
-
formBlur(data) {
|
|
1313
|
-
this.$emit('blur', data, this.list);
|
|
1314
|
-
},
|
|
1315
|
-
formFocus(data) {
|
|
1316
|
-
this.$emit('focus', data, this.list);
|
|
1317
|
-
},
|
|
1318
|
-
formChange(data) {
|
|
1319
|
-
this.$emit('edit', data, this.list);
|
|
1320
|
-
this.$emit('change', data, this.list);
|
|
1321
|
-
},
|
|
1322
|
-
toolbarChange(...args) {
|
|
1323
|
-
this.$emit('toolbar-change', ...args);
|
|
1324
|
-
},
|
|
1325
|
-
handleAjax(handle, row) {
|
|
1326
|
-
this.changeLoading(true, `${handle.text}中...`);
|
|
1327
|
-
let params = handle.param || {};
|
|
1328
|
-
if (handle.syncKeys) {
|
|
1329
|
-
if (typeof handle.syncKeys === 'string') {
|
|
1330
|
-
params[handle.syncKeys] = row[handle.syncKeys];
|
|
1331
|
-
} else if (Array.isArray(handle.syncKeys)) {
|
|
1332
|
-
for (let i in handle.syncKeys) {
|
|
1333
|
-
if (Array.isArray(row)) {
|
|
1334
|
-
let param = row.map((item) => {
|
|
1335
|
-
return item[handle.syncKeys[i]];
|
|
1336
|
-
});
|
|
1337
|
-
params[handle.syncKeys[i]] = param.join(',');
|
|
1338
|
-
} else {
|
|
1339
|
-
params[handle.syncKeys[i]] = row[handle.syncKeys[i]];
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
} else {
|
|
1343
|
-
for (let i in handle.syncKeys) {
|
|
1344
|
-
if (Array.isArray(row)) {
|
|
1345
|
-
let param = row.map((item) => {
|
|
1346
|
-
return item[handle.syncKeys[i]];
|
|
1347
|
-
});
|
|
1348
|
-
params[i] = param.join(',');
|
|
1349
|
-
} else {
|
|
1350
|
-
params[i] = row[handle.syncKeys[i]];
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
} else {
|
|
1355
|
-
if (Array.isArray(row)) {
|
|
1356
|
-
let param = row.map((item) => {
|
|
1357
|
-
return item.id;
|
|
1358
|
-
});
|
|
1359
|
-
params.id = param.join(',');
|
|
1360
|
-
} else {
|
|
1361
|
-
params.id = row.id;
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
let keys = Object.keys(params);
|
|
1365
|
-
util
|
|
1366
|
-
.ajax({
|
|
1367
|
-
...(handle.ajaxConfig || {}),
|
|
1368
|
-
url: handle.action,
|
|
1369
|
-
data:
|
|
1370
|
-
keys.length == 1 && handle.format === false
|
|
1371
|
-
? params[keys[0]].split(',')
|
|
1372
|
-
: params,
|
|
1373
|
-
params:
|
|
1374
|
-
keys.length == 1 && handle.format === false
|
|
1375
|
-
? params[keys[0]].split(',')
|
|
1376
|
-
: params,
|
|
1377
|
-
method: handle.method,
|
|
1378
|
-
format: handle.format
|
|
1379
|
-
})
|
|
1380
|
-
.then((res) => {
|
|
1381
|
-
this.changeLoading(false);
|
|
1382
|
-
if (res.rCode === 0) {
|
|
1383
|
-
this.$message({
|
|
1384
|
-
message: `${handle.text}成功`,
|
|
1385
|
-
duration: 2000,
|
|
1386
|
-
type: 'success',
|
|
1387
|
-
onClose: () => {
|
|
1388
|
-
let first = Object.prototype.hasOwnProperty.call(
|
|
1389
|
-
handle,
|
|
1390
|
-
'first'
|
|
1391
|
-
)
|
|
1392
|
-
? handle.first
|
|
1393
|
-
: false;
|
|
1394
|
-
let reload = handle.reload || true;
|
|
1395
|
-
if (reload) {
|
|
1396
|
-
this.reload({}, first);
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1399
|
-
});
|
|
1400
|
-
} else {
|
|
1401
|
-
this.$message.error(
|
|
1402
|
-
res.msg || `${handle.text}失败,请联系管理员!`
|
|
1403
|
-
);
|
|
1404
|
-
}
|
|
1405
|
-
})
|
|
1406
|
-
.catch((err) => {
|
|
1407
|
-
this.changeLoading(false);
|
|
1408
|
-
if (err.message && err.message !== 'canceled') {
|
|
1409
|
-
this.$message.error(err.message);
|
|
1410
|
-
}
|
|
1411
|
-
});
|
|
1412
|
-
},
|
|
1413
|
-
checkParse(data, parse) {
|
|
1414
|
-
if (Array.isArray(data)) {
|
|
1415
|
-
return data.map((items) => {
|
|
1416
|
-
let item = JSON.parse(JSON.stringify(items));
|
|
1417
|
-
let obj = {};
|
|
1418
|
-
for (let i in parse) {
|
|
1419
|
-
obj[i] = item[parse[i]];
|
|
1420
|
-
delete item[parse[i]];
|
|
1421
|
-
}
|
|
1422
|
-
return { ...obj, ...item };
|
|
1423
|
-
});
|
|
1424
|
-
}
|
|
1425
|
-
let item = JSON.parse(JSON.stringify(data));
|
|
1426
|
-
let obj = {};
|
|
1427
|
-
for (let i in parse) {
|
|
1428
|
-
obj[i] = item[parse[i]];
|
|
1429
|
-
delete item[parse[i]];
|
|
1430
|
-
}
|
|
1431
|
-
return { ...obj, ...item };
|
|
1432
|
-
},
|
|
1433
|
-
handleClick(res) {
|
|
1434
|
-
let { row, handle } = res;
|
|
1435
|
-
let rows;
|
|
1436
|
-
if (handle.checkbox) {
|
|
1437
|
-
if (!this.selected || !this.selected.length) {
|
|
1438
|
-
this.$alert('请选择数据', '提示', { type: 'warning' });
|
|
1439
|
-
return;
|
|
1440
|
-
} else {
|
|
1441
|
-
row = this.selected;
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
if (this.checkboxParseData) {
|
|
1445
|
-
rows = this.checkboxParseData(JSON.parse(JSON.stringify(row)));
|
|
1446
|
-
} else if (this.checkboxParse) {
|
|
1447
|
-
rows = this.checkParse(row, this.checkboxParse);
|
|
1448
|
-
} else if (handle.checkboxParse) {
|
|
1449
|
-
rows = this.checkParse(row, handle.checkboxParse);
|
|
1450
|
-
} else if (row) {
|
|
1451
|
-
rows = JSON.parse(JSON.stringify(row));
|
|
1452
|
-
}
|
|
1453
|
-
let thead = this.theads;
|
|
1454
|
-
if (this.$refs.oaTable) {
|
|
1455
|
-
thead = this.$refs.oaTable.getThead().thead;
|
|
1456
|
-
}
|
|
1457
|
-
if (handle.action) {
|
|
1458
|
-
let isConfirm = handle.confirm || true;
|
|
1459
|
-
if (isConfirm) {
|
|
1460
|
-
let msg = handle.field ? row[handle.field] : '';
|
|
1461
|
-
this.$confirm(`确定要${handle.text}${msg}吗`, '提示', {
|
|
1462
|
-
confirmButtonText: '确定',
|
|
1463
|
-
cancelButtonText: '取消',
|
|
1464
|
-
type: 'warning'
|
|
1465
|
-
})
|
|
1466
|
-
.then(() => {
|
|
1467
|
-
this.handleAjax(handle, rows);
|
|
1468
|
-
})
|
|
1469
|
-
.catch(() => {});
|
|
1470
|
-
} else {
|
|
1471
|
-
this.handleAjax(handle, rows);
|
|
1472
|
-
}
|
|
1473
|
-
} else if (handle.event) {
|
|
1474
|
-
if (typeof handle.event === 'function') {
|
|
1475
|
-
handle.event({
|
|
1476
|
-
ele: this,
|
|
1477
|
-
thead: thead,
|
|
1478
|
-
data: this.list,
|
|
1479
|
-
selected: rows,
|
|
1480
|
-
...res
|
|
1481
|
-
});
|
|
1482
|
-
} else if (
|
|
1483
|
-
handle.event === 'add' ||
|
|
1484
|
-
handle.event === 'edit' ||
|
|
1485
|
-
handle.event === 'look'
|
|
1486
|
-
) {
|
|
1487
|
-
let changes = {
|
|
1488
|
-
event: handle.event,
|
|
1489
|
-
title: handle.title || handle.text,
|
|
1490
|
-
value: handle.event === 'add' ? {} : rows,
|
|
1491
|
-
readonly: handle.event === 'look',
|
|
1492
|
-
actionType: handle.actionType
|
|
1493
|
-
? handle.actionType
|
|
1494
|
-
: handle.event === 'add'
|
|
1495
|
-
? 'save'
|
|
1496
|
-
: 'update',
|
|
1497
|
-
visible: true
|
|
1498
|
-
};
|
|
1499
|
-
if (handle.dialog) {
|
|
1500
|
-
let dialog;
|
|
1501
|
-
for (let i = 0; i < this.$children.length; i++) {
|
|
1502
|
-
let child = this.$children[i];
|
|
1503
|
-
if (child.$refs[handle.dialog]) {
|
|
1504
|
-
dialog = child.$refs[handle.dialog];
|
|
1505
|
-
break;
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
dialog.setAttrs(changes);
|
|
1509
|
-
}
|
|
1510
|
-
this.injector && this.injector.handleChangeData(changes);
|
|
1511
|
-
if (handle.busEvent) {
|
|
1512
|
-
const bus = this.bus || this.$root.Bus;
|
|
1513
|
-
bus && bus.$emit(handle.busEvent, changes);
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
} else if (handle.changeData) {
|
|
1517
|
-
let changeData = {};
|
|
1518
|
-
if (Array.isArray(handle.changeData)) {
|
|
1519
|
-
handle.changeData.forEach((item) => {
|
|
1520
|
-
if (util.isObject(item)) {
|
|
1521
|
-
for (let i in item) {
|
|
1522
|
-
if (typeof item[i] === 'boolean') {
|
|
1523
|
-
changeData[i] = item[i];
|
|
1524
|
-
} else {
|
|
1525
|
-
changeData[i] = handle[item[i]] || item[i];
|
|
1526
|
-
}
|
|
1527
|
-
}
|
|
1528
|
-
} else {
|
|
1529
|
-
changeData[item] =
|
|
1530
|
-
handle[item] || (Array.isArray(rows) ? rows : rows[item]);
|
|
1531
|
-
}
|
|
1532
|
-
});
|
|
1533
|
-
} else {
|
|
1534
|
-
for (let i in handle.changeData) {
|
|
1535
|
-
let item = handle.changeData[i];
|
|
1536
|
-
if (util.isObject(item)) {
|
|
1537
|
-
let obj = {};
|
|
1538
|
-
for (let e in item) {
|
|
1539
|
-
obj[e] =
|
|
1540
|
-
handle[item[e]] ||
|
|
1541
|
-
(Array.isArray(rows) ? rows : rows[item[e]]);
|
|
1542
|
-
}
|
|
1543
|
-
changeData[i] = obj;
|
|
1544
|
-
} else {
|
|
1545
|
-
if (typeof item === 'boolean') {
|
|
1546
|
-
changeData[i] = item;
|
|
1547
|
-
} else {
|
|
1548
|
-
changeData[i] =
|
|
1549
|
-
handle[item] || (Array.isArray(rows) ? rows : rows[item]);
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
if (handle.actionType) {
|
|
1555
|
-
changeData['actionType'] = handle.actionType;
|
|
1556
|
-
}
|
|
1557
|
-
this.injector && this.injector.handleChangeData(changeData);
|
|
1558
|
-
if (handle.busEvent) {
|
|
1559
|
-
const bus = this.bus || this.$root.Bus;
|
|
1560
|
-
bus && bus.$emit(handle.busEvent, changes);
|
|
1561
|
-
}
|
|
1562
|
-
} else {
|
|
1563
|
-
if (handle.exportXls) {
|
|
1564
|
-
let text = '操作';
|
|
1565
|
-
if (
|
|
1566
|
-
this.theads[this.theads.length - 1] &&
|
|
1567
|
-
this.theads[this.theads.length - 1].type === 'handle'
|
|
1568
|
-
) {
|
|
1569
|
-
text = this.theads[this.theads.length - 1].title;
|
|
1570
|
-
}
|
|
1571
|
-
let type = ['selection', 'index', 'expand'];
|
|
1572
|
-
thead = thead.map((item) => {
|
|
1573
|
-
return item.filter((ele) => {
|
|
1574
|
-
return (
|
|
1575
|
-
!type.includes(ele.type) &&
|
|
1576
|
-
ele.label !== text &&
|
|
1577
|
-
!this.exportExcludeLabel.includes(ele.label)
|
|
1578
|
-
);
|
|
1579
|
-
});
|
|
1580
|
-
});
|
|
1581
|
-
util.exportXls({
|
|
1582
|
-
thead: thead,
|
|
1583
|
-
data: this.list,
|
|
1584
|
-
name: this.fileName,
|
|
1585
|
-
option: this.optionDatas
|
|
1586
|
-
});
|
|
1587
|
-
}
|
|
1588
|
-
this.$emit('btnClick', res, this.list, thead, rows);
|
|
1589
|
-
this.$emit('btn-click', res, this.list, thead, rows);
|
|
1590
|
-
}
|
|
1591
|
-
},
|
|
1592
|
-
sizeChange(res) {
|
|
1593
|
-
this.config.pageSize = res;
|
|
1594
|
-
this.config.pageNum = 1;
|
|
1595
|
-
this.checkSelect(this.checked);
|
|
1596
|
-
this.$emit('page-size-change', res);
|
|
1597
|
-
if (this.url) {
|
|
1598
|
-
this.getTableData({ where: this.wheres, first: false });
|
|
1599
|
-
}
|
|
1600
|
-
},
|
|
1601
|
-
currentChange(res) {
|
|
1602
|
-
this.config.pageNum = res;
|
|
1603
|
-
this.checkSelect(this.checked);
|
|
1604
|
-
this.$emit('page-current-change', res);
|
|
1605
|
-
this.$emit('current', res);
|
|
1606
|
-
if (this.url) {
|
|
1607
|
-
this.getTableData({ where: this.wheres, first: false });
|
|
1608
|
-
}
|
|
1609
|
-
},
|
|
1610
|
-
preClick(res) {
|
|
1611
|
-
this.config.pageNum = res;
|
|
1612
|
-
this.checkSelect(this.checked);
|
|
1613
|
-
this.$emit('prev', res);
|
|
1614
|
-
},
|
|
1615
|
-
nextClick(res) {
|
|
1616
|
-
this.config.pageNum = res;
|
|
1617
|
-
this.checkSelect(this.checked);
|
|
1618
|
-
this.$emit('next', res);
|
|
1619
|
-
},
|
|
1620
|
-
hanleSearch(data) {
|
|
1621
|
-
this.searchWhere =
|
|
1622
|
-
this.response !== undefined
|
|
1623
|
-
? this.response({
|
|
1624
|
-
type: 'search',
|
|
1625
|
-
data: JSON.parse(JSON.stringify(data))
|
|
1626
|
-
})
|
|
1627
|
-
: data;
|
|
1628
|
-
if (this.url && this.executeSearch) {
|
|
1629
|
-
this.getTableData({ where: this.wheres });
|
|
1630
|
-
}
|
|
1631
|
-
this.$emit('search', this.searchWhere);
|
|
1632
|
-
},
|
|
1633
|
-
hanleReset() {
|
|
1634
|
-
this.searchWhere = {};
|
|
1635
|
-
this.advanceWhere = {};
|
|
1636
|
-
if (this.url) {
|
|
1637
|
-
this.getTableData();
|
|
1638
|
-
}
|
|
1639
|
-
this.$emit('reset', this.params);
|
|
1640
|
-
},
|
|
1641
|
-
hanleSubmit({ data, show }) {
|
|
1642
|
-
this.advanceWhere =
|
|
1643
|
-
this.response !== undefined
|
|
1644
|
-
? this.response({
|
|
1645
|
-
type: 'filter',
|
|
1646
|
-
data: JSON.parse(JSON.stringify(data))
|
|
1647
|
-
})
|
|
1648
|
-
: data;
|
|
1649
|
-
|
|
1650
|
-
if (this.url && this.executeFilter) {
|
|
1651
|
-
this.getTableData({ where: this.wheres });
|
|
1652
|
-
}
|
|
1653
|
-
this.$emit('submit', {
|
|
1654
|
-
data: this.advanceWhere,
|
|
1655
|
-
where: this.wheres,
|
|
1656
|
-
show
|
|
1657
|
-
});
|
|
1658
|
-
},
|
|
1659
|
-
hanleCancel() {
|
|
1660
|
-
this.$emit('cancel', this.params);
|
|
1661
|
-
},
|
|
1662
|
-
handleTabs({ item, index }) {
|
|
1663
|
-
if (this.url) {
|
|
1664
|
-
this.getTableData({ where: item });
|
|
1665
|
-
}
|
|
1666
|
-
this.$emit('tabs', { item, index });
|
|
1667
|
-
},
|
|
1668
|
-
reload(obj, first = false) {
|
|
1669
|
-
if (obj && obj.config) {
|
|
1670
|
-
this.config = util.extend({}, this.config, obj.config);
|
|
1671
|
-
}
|
|
1672
|
-
if (this.url) {
|
|
1673
|
-
this.isReload = true;
|
|
1674
|
-
this.getTableData({ where: obj && obj.where ? obj.where : {}, first });
|
|
1675
|
-
}
|
|
1676
|
-
},
|
|
1677
|
-
resetHeight(warn) {
|
|
1678
|
-
this.isSetHeight =
|
|
1679
|
-
util.getStyle(this.$el.parentNode, 'height') == '0px' ? false : true;
|
|
1680
|
-
this.$nextTick(() => {
|
|
1681
|
-
if (this.full && !this.height && !this.maxHeight && this.isSetHeight) {
|
|
1682
|
-
let height = this.$el.parentNode.offsetHeight;
|
|
1683
|
-
if (height) {
|
|
1684
|
-
height = parseInt(
|
|
1685
|
-
util.getStyle(this.$el.parentNode, 'height', '%'),
|
|
1686
|
-
10
|
|
1687
|
-
);
|
|
1688
|
-
height =
|
|
1689
|
-
(height == NaN ? 0 : height) -
|
|
1690
|
-
parseInt(util.getStyle(this.$el.parentNode, 'padding-top'), 10) -
|
|
1691
|
-
parseInt(
|
|
1692
|
-
util.getStyle(this.$el.parentNode, 'padding-bottom'),
|
|
1693
|
-
10
|
|
1694
|
-
);
|
|
1695
|
-
for (let i = 0; i < this.$el.parentNode.childNodes.length; i++) {
|
|
1696
|
-
let ele = this.$el.parentNode.childNodes[i];
|
|
1697
|
-
if (
|
|
1698
|
-
this.$el &&
|
|
1699
|
-
ele.offsetHeight !== undefined &&
|
|
1700
|
-
ele != this.$el
|
|
1701
|
-
) {
|
|
1702
|
-
height =
|
|
1703
|
-
height -
|
|
1704
|
-
ele.offsetHeight -
|
|
1705
|
-
parseInt(util.getStyle(ele, 'margin-top'), 10) -
|
|
1706
|
-
parseInt(util.getStyle(ele, 'margin-bottom'), 10);
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
height -= this.showToolbar
|
|
1710
|
-
? this.$refs.toolbar.$el.offsetHeight
|
|
1711
|
-
: 0;
|
|
1712
|
-
height -=
|
|
1713
|
-
this.page === false || this.showPage == false
|
|
1714
|
-
? 0
|
|
1715
|
-
: this.$refs.pagination.$el.offsetHeight;
|
|
1716
|
-
height -= this.title ? this.$refs.title.offsetHeight : 0;
|
|
1717
|
-
height -= parseInt(
|
|
1718
|
-
util.getStyle(this.$refs.esTableContent, 'padding-top'),
|
|
1719
|
-
10
|
|
1720
|
-
);
|
|
1721
|
-
height -= parseInt(
|
|
1722
|
-
util.getStyle(this.$refs.esTableContent, 'padding-bottom'),
|
|
1723
|
-
10
|
|
1724
|
-
);
|
|
1725
|
-
let emptyText = this.$refs.esTableContent.querySelector(
|
|
1726
|
-
'.el-table__empty-text'
|
|
1727
|
-
);
|
|
1728
|
-
if (this.total) {
|
|
1729
|
-
height -= 1;
|
|
1730
|
-
}
|
|
1731
|
-
let eht = 0;
|
|
1732
|
-
if (emptyText) {
|
|
1733
|
-
eht = emptyText.offsetHeight;
|
|
1734
|
-
let thead =
|
|
1735
|
-
this.$refs.esTableContent.querySelector('.el-table__header');
|
|
1736
|
-
thead && (eht += thead.offsetHeight);
|
|
1737
|
-
}
|
|
1738
|
-
if (height > 1 && height - eht > 1) {
|
|
1739
|
-
this.tableHeight = height;
|
|
1740
|
-
} else {
|
|
1741
|
-
console.warn(this.$el.parentNode, `获取不到高度!`);
|
|
1742
|
-
}
|
|
1743
|
-
} else if (!warn) {
|
|
1744
|
-
setTimeout(() => {
|
|
1745
|
-
this.resetHeight(true);
|
|
1746
|
-
}, 1000);
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
});
|
|
1750
|
-
},
|
|
1751
|
-
validate(callback) {
|
|
1752
|
-
if (this.form) {
|
|
1753
|
-
let form = this.elForm || this.$children[0];
|
|
1754
|
-
form.validate((valid) => {
|
|
1755
|
-
callback(valid);
|
|
1756
|
-
});
|
|
1757
|
-
}
|
|
1758
|
-
},
|
|
1759
|
-
changeLoading(show, text) {
|
|
1760
|
-
this.tableLoading = show;
|
|
1761
|
-
if (text) {
|
|
1762
|
-
this.tableLoadingText = text;
|
|
1763
|
-
}
|
|
1764
|
-
},
|
|
1765
|
-
handleFilterColumn() {
|
|
1766
|
-
this.showSizer = true;
|
|
1767
|
-
},
|
|
1768
|
-
handleSortChange(res) {
|
|
1769
|
-
if (res.data && res.data.length) {
|
|
1770
|
-
this.list = res.data;
|
|
1771
|
-
}
|
|
1772
|
-
this.$emit('sort-change', res);
|
|
1773
|
-
},
|
|
1774
|
-
handleUpdateDragSort(data, event) {
|
|
1775
|
-
this.$emit('update-drag-sort', data, event);
|
|
1776
|
-
},
|
|
1777
|
-
mergeThead(res) {
|
|
1778
|
-
this.show = false;
|
|
1779
|
-
this.theadData = [];
|
|
1780
|
-
this.icon = true;
|
|
1781
|
-
this.showSizer = false;
|
|
1782
|
-
// if (!this.showTotal) {
|
|
1783
|
-
// for (let i = 0; i < res.length; i++) {
|
|
1784
|
-
// if (res[i].total) {
|
|
1785
|
-
// this.showTotal = true;
|
|
1786
|
-
// break;
|
|
1787
|
-
// }
|
|
1788
|
-
// }
|
|
1789
|
-
// }
|
|
1790
|
-
this.$nextTick(() => {
|
|
1791
|
-
this.theadData = res;
|
|
1792
|
-
setTimeout(() => {
|
|
1793
|
-
this.show = true;
|
|
1794
|
-
}, 500);
|
|
1795
|
-
});
|
|
1796
|
-
},
|
|
1797
|
-
setOptions(val, sysCode) {
|
|
1798
|
-
this.$set(this.options, sysCode, val);
|
|
1799
|
-
},
|
|
1800
|
-
bindEventBus() {
|
|
1801
|
-
this.sysCodes.forEach((item) => {
|
|
1802
|
-
const bus = this.bus || this.$root.Bus;
|
|
1803
|
-
bus &&
|
|
1804
|
-
bus.$on(item, (val) => {
|
|
1805
|
-
this.setOptions(val, item);
|
|
1806
|
-
});
|
|
1807
|
-
});
|
|
1808
|
-
},
|
|
1809
|
-
unbindEventBus() {
|
|
1810
|
-
this.sysCodes.forEach((item) => {
|
|
1811
|
-
const bus = this.bus || this.$root.Bus;
|
|
1812
|
-
bus && bus.$off(item, this.setOptions);
|
|
1813
|
-
});
|
|
1814
|
-
},
|
|
1815
|
-
reset() {
|
|
1816
|
-
this.$refs.toolbar && this.$refs.toolbar.reset();
|
|
1817
|
-
},
|
|
1818
|
-
openEditPage() {
|
|
1819
|
-
let fields = [];
|
|
1820
|
-
this.theads.forEach((item) => {
|
|
1821
|
-
if (item.field || item.prop) {
|
|
1822
|
-
fields.push(item.field || item.prop);
|
|
1823
|
-
}
|
|
1824
|
-
});
|
|
1825
|
-
fields = util.esEncode(fields.join(','));
|
|
1826
|
-
this.editPage = `/lowcode-ui/webpack/index.html#simpleEditOnlinePage?pageId=${this.viewCode}&fields=${fields}`;
|
|
1827
|
-
this.showEditPage = true;
|
|
1828
|
-
}
|
|
1829
|
-
}
|
|
1830
|
-
};
|
|
1831
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
v-show="showTable"
|
|
4
|
+
class="es-data-table"
|
|
5
|
+
label-width="0"
|
|
6
|
+
ref="component"
|
|
7
|
+
v-loading="tableLoading"
|
|
8
|
+
element-loading-background="rgba(0, 0, 0, 0.65)"
|
|
9
|
+
:is="tag"
|
|
10
|
+
:model="tag === 'div' ? '' : list"
|
|
11
|
+
:element-loading-text="tableLoadingText"
|
|
12
|
+
>
|
|
13
|
+
<es-toolbar
|
|
14
|
+
v-if="showToolbar"
|
|
15
|
+
ref="toolbar"
|
|
16
|
+
:class="{
|
|
17
|
+
'es-table-toolbar-plus': mode == 'plus'
|
|
18
|
+
}"
|
|
19
|
+
v-bind="{
|
|
20
|
+
contents: toolbars,
|
|
21
|
+
showLabel: showLabel,
|
|
22
|
+
close: close,
|
|
23
|
+
callBack: resetHeight,
|
|
24
|
+
showFormBtn: showFormBtn,
|
|
25
|
+
searchValue: searchValue,
|
|
26
|
+
advanceValue: advanceValue
|
|
27
|
+
}"
|
|
28
|
+
v-on="{
|
|
29
|
+
click: handleClick,
|
|
30
|
+
search: hanleSearch,
|
|
31
|
+
submit: hanleSubmit,
|
|
32
|
+
tabs: handleTabs,
|
|
33
|
+
reset: hanleReset,
|
|
34
|
+
cancel: hanleCancel,
|
|
35
|
+
toolbarChange: toolbarChange,
|
|
36
|
+
...toolbarEvents
|
|
37
|
+
}"
|
|
38
|
+
></es-toolbar>
|
|
39
|
+
<p v-if="title" ref="title" class="es-table-title" v-html="title"></p>
|
|
40
|
+
<div
|
|
41
|
+
v-if="show"
|
|
42
|
+
:style="styles"
|
|
43
|
+
class="es-data-table-content"
|
|
44
|
+
:class="{
|
|
45
|
+
'es-table-border-none': border == 'none',
|
|
46
|
+
'es-table-plus': mode == 'plus'
|
|
47
|
+
}"
|
|
48
|
+
ref="esTableContent"
|
|
49
|
+
>
|
|
50
|
+
<el-table
|
|
51
|
+
ref="oaTable"
|
|
52
|
+
v-bind="{
|
|
53
|
+
...$attrs,
|
|
54
|
+
emptyText: emptyText,
|
|
55
|
+
showSummary: showTotal,
|
|
56
|
+
sumText: sumText || totalText,
|
|
57
|
+
totalRow: restotalRow || totalRow,
|
|
58
|
+
height:
|
|
59
|
+
tableHeight !== 'auto' && tableHeight !== false
|
|
60
|
+
? tableHeight
|
|
61
|
+
: undefined,
|
|
62
|
+
border: _border,
|
|
63
|
+
infiniteScroll: getTableData,
|
|
64
|
+
infiniteScrollDisabled: infiniteDisabled,
|
|
65
|
+
dragSort: dragSort,
|
|
66
|
+
dragSortClass: dragSortIcon
|
|
67
|
+
}"
|
|
68
|
+
:data.sync="list"
|
|
69
|
+
v-on="{
|
|
70
|
+
...$listeners,
|
|
71
|
+
'row-click': rowClick,
|
|
72
|
+
'selection-change': selectionChange,
|
|
73
|
+
'filter-column': handleFilterColumn,
|
|
74
|
+
'sort-change': handleSortChange,
|
|
75
|
+
'update-drag-sort': handleUpdateDragSort
|
|
76
|
+
}"
|
|
77
|
+
:class="
|
|
78
|
+
'es-table' +
|
|
79
|
+
(theadBorder && border != 'none' ? ' es-thead-border' : '')
|
|
80
|
+
"
|
|
81
|
+
>
|
|
82
|
+
<slot name="suffix"></slot>
|
|
83
|
+
<slot></slot>
|
|
84
|
+
<template v-for="(item, index) in theads">
|
|
85
|
+
<template v-if="item.hide !== true">
|
|
86
|
+
<el-table-column
|
|
87
|
+
v-if="item.type === 'sort'"
|
|
88
|
+
width="32"
|
|
89
|
+
prop="id"
|
|
90
|
+
:key="item.key || item.label || item.title || index"
|
|
91
|
+
label=" "
|
|
92
|
+
>
|
|
93
|
+
<template slot-scope="scope">
|
|
94
|
+
<es-icon
|
|
95
|
+
v-if="!scope.row.fixed"
|
|
96
|
+
class="es-move"
|
|
97
|
+
:contents="dragSortIcon"
|
|
98
|
+
></es-icon>
|
|
99
|
+
</template>
|
|
100
|
+
</el-table-column>
|
|
101
|
+
<template
|
|
102
|
+
v-else-if="item.type === 'index' || item.type === 'selection'"
|
|
103
|
+
>
|
|
104
|
+
<el-table-column
|
|
105
|
+
:key="item.key || item.label || item.title || index"
|
|
106
|
+
v-bind="dragSort ? { ...item, fixed: false } : item"
|
|
107
|
+
></el-table-column>
|
|
108
|
+
</template>
|
|
109
|
+
<template v-else>
|
|
110
|
+
<children
|
|
111
|
+
:key="item.key || item.label || item.title || index"
|
|
112
|
+
:tag="item.tag"
|
|
113
|
+
v-bind="{
|
|
114
|
+
mode: mode,
|
|
115
|
+
name: name,
|
|
116
|
+
indexs: index,
|
|
117
|
+
form: form,
|
|
118
|
+
readonly: readonly,
|
|
119
|
+
optionData: optionDatas,
|
|
120
|
+
dragSort: dragSort,
|
|
121
|
+
...(dragSort ? { ...item, fixed: false } : { ...item })
|
|
122
|
+
}"
|
|
123
|
+
v-on="{
|
|
124
|
+
handleClick: handleClick,
|
|
125
|
+
formBlur: formBlur,
|
|
126
|
+
formFocus: formFocus,
|
|
127
|
+
formChange: formChange
|
|
128
|
+
}"
|
|
129
|
+
></children>
|
|
130
|
+
</template>
|
|
131
|
+
</template>
|
|
132
|
+
</template>
|
|
133
|
+
<slot name="prefix"></slot>
|
|
134
|
+
<el-table-column
|
|
135
|
+
v-if="editable && !readonly"
|
|
136
|
+
width="80"
|
|
137
|
+
type="handle"
|
|
138
|
+
align="center"
|
|
139
|
+
label="操作"
|
|
140
|
+
fixed="right"
|
|
141
|
+
class="eoss-ui-eidt-column"
|
|
142
|
+
:button="headButton"
|
|
143
|
+
:total="false"
|
|
144
|
+
>
|
|
145
|
+
<template slot-scope="scope">
|
|
146
|
+
<el-button
|
|
147
|
+
v-if="!scope.row.cantAdd"
|
|
148
|
+
type="text"
|
|
149
|
+
@click="handleClickAddData(scope)"
|
|
150
|
+
>
|
|
151
|
+
<i class="el-icon-circle-plus-outline"></i>
|
|
152
|
+
</el-button>
|
|
153
|
+
<el-button
|
|
154
|
+
v-if="!scope.row.cantDelete && !isLeast"
|
|
155
|
+
type="text"
|
|
156
|
+
@click="handleClickDeleteData(scope)"
|
|
157
|
+
>
|
|
158
|
+
<i class="el-icon-remove-outline"></i>
|
|
159
|
+
</el-button>
|
|
160
|
+
</template>
|
|
161
|
+
</el-table-column>
|
|
162
|
+
<template slot="append"><slot name="append"></slot></template>
|
|
163
|
+
</el-table>
|
|
164
|
+
<div v-if="infiniteScroll" class="es-table-page es-loading-page">
|
|
165
|
+
<span>共{{ config.totalCount }}条,</span>
|
|
166
|
+
<span>已加载{{ list.length }}条</span>
|
|
167
|
+
</div>
|
|
168
|
+
<es-pagination
|
|
169
|
+
v-else-if="page !== false && showPage !== false"
|
|
170
|
+
ref="pagination"
|
|
171
|
+
v-bind="config"
|
|
172
|
+
class="es-table-page"
|
|
173
|
+
:position="page.position"
|
|
174
|
+
:style="{ 'text-align': page.position }"
|
|
175
|
+
v-on="{
|
|
176
|
+
change: sizeChange,
|
|
177
|
+
current: currentChange,
|
|
178
|
+
prev: preClick,
|
|
179
|
+
next: nextClick
|
|
180
|
+
}"
|
|
181
|
+
></es-pagination>
|
|
182
|
+
<slot name="dialog"></slot>
|
|
183
|
+
<slot name="other"></slot>
|
|
184
|
+
</div>
|
|
185
|
+
<es-dialog v-if="theads.length" title="列表设置" :visible.sync="showSizer">
|
|
186
|
+
<sizer
|
|
187
|
+
v-if="showSizer"
|
|
188
|
+
:data="theads"
|
|
189
|
+
:mode="mode"
|
|
190
|
+
@confirm="mergeThead"
|
|
191
|
+
></sizer>
|
|
192
|
+
</es-dialog>
|
|
193
|
+
<i
|
|
194
|
+
class="el-icon-setting es-table-setting"
|
|
195
|
+
title="页面配置"
|
|
196
|
+
v-if="isShow"
|
|
197
|
+
@click="openEditPage"
|
|
198
|
+
></i>
|
|
199
|
+
|
|
200
|
+
<es-dialog title="页面配置" :visible.sync="showEditPage" size="full">
|
|
201
|
+
<iframe
|
|
202
|
+
v-if="showEditPage"
|
|
203
|
+
width="100%"
|
|
204
|
+
height="100%"
|
|
205
|
+
frameborder="0"
|
|
206
|
+
:src="editPage"
|
|
207
|
+
></iframe>
|
|
208
|
+
</es-dialog>
|
|
209
|
+
</component>
|
|
210
|
+
</template>
|
|
211
|
+
<script>
|
|
212
|
+
import {
|
|
213
|
+
findSysCode,
|
|
214
|
+
getDictList,
|
|
215
|
+
formContents
|
|
216
|
+
} from 'eoss-ui/src/config/api.js';
|
|
217
|
+
import { debounce, throttle } from 'throttle-debounce';
|
|
218
|
+
import children from './children.vue';
|
|
219
|
+
import sizer from './sizer.vue';
|
|
220
|
+
import util from 'eoss-ui/src/utils/util';
|
|
221
|
+
import qs from 'qs';
|
|
222
|
+
const systemMode = util.win.top.systemMode || util.win.systemMode || 'default';
|
|
223
|
+
const pageView = util.getParams('pageView');
|
|
224
|
+
export default {
|
|
225
|
+
name: 'EsDataTable',
|
|
226
|
+
inheritAttrs: false,
|
|
227
|
+
components: {
|
|
228
|
+
children,
|
|
229
|
+
sizer
|
|
230
|
+
},
|
|
231
|
+
provide() {
|
|
232
|
+
return {
|
|
233
|
+
table: this,
|
|
234
|
+
tableReload: this.reload
|
|
235
|
+
};
|
|
236
|
+
},
|
|
237
|
+
inject: {
|
|
238
|
+
elForm: {
|
|
239
|
+
default: ''
|
|
240
|
+
},
|
|
241
|
+
injector: {
|
|
242
|
+
default: ''
|
|
243
|
+
},
|
|
244
|
+
scale: {
|
|
245
|
+
default: ''
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
props: {
|
|
249
|
+
viewCode: {
|
|
250
|
+
type: String,
|
|
251
|
+
default: pageView
|
|
252
|
+
},
|
|
253
|
+
contentsUrl: {
|
|
254
|
+
type: String,
|
|
255
|
+
default: formContents
|
|
256
|
+
},
|
|
257
|
+
mode: {
|
|
258
|
+
type: String,
|
|
259
|
+
default: systemMode
|
|
260
|
+
},
|
|
261
|
+
service: String,
|
|
262
|
+
loading: {
|
|
263
|
+
type: Boolean,
|
|
264
|
+
default: false
|
|
265
|
+
},
|
|
266
|
+
readonly: Boolean,
|
|
267
|
+
url: {
|
|
268
|
+
type: String,
|
|
269
|
+
default: ''
|
|
270
|
+
},
|
|
271
|
+
defaults: {
|
|
272
|
+
type: Boolean,
|
|
273
|
+
default: false
|
|
274
|
+
},
|
|
275
|
+
param: {
|
|
276
|
+
type: Object,
|
|
277
|
+
default() {
|
|
278
|
+
return {};
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
method: {
|
|
282
|
+
type: String,
|
|
283
|
+
default: 'get'
|
|
284
|
+
},
|
|
285
|
+
isEncodeURI: Boolean,
|
|
286
|
+
format: {
|
|
287
|
+
type: Boolean,
|
|
288
|
+
default: true
|
|
289
|
+
},
|
|
290
|
+
data: {
|
|
291
|
+
type: Array,
|
|
292
|
+
default() {
|
|
293
|
+
return [];
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
// 表格表单
|
|
297
|
+
form: {
|
|
298
|
+
type: Boolean,
|
|
299
|
+
default: false
|
|
300
|
+
},
|
|
301
|
+
name: String,
|
|
302
|
+
title: {
|
|
303
|
+
type: String,
|
|
304
|
+
default: ''
|
|
305
|
+
},
|
|
306
|
+
// 导出文件名
|
|
307
|
+
fileName: {
|
|
308
|
+
type: String,
|
|
309
|
+
default: ''
|
|
310
|
+
},
|
|
311
|
+
// 工具栏配置
|
|
312
|
+
toolbar: {
|
|
313
|
+
type: [Array, Object, Boolean],
|
|
314
|
+
default: false
|
|
315
|
+
},
|
|
316
|
+
showLabel: Boolean,
|
|
317
|
+
searchValue: Object,
|
|
318
|
+
advanceValue: Object,
|
|
319
|
+
executeSearch: {
|
|
320
|
+
type: Boolean,
|
|
321
|
+
default: true
|
|
322
|
+
},
|
|
323
|
+
executeFilter: {
|
|
324
|
+
type: Boolean,
|
|
325
|
+
default: true
|
|
326
|
+
},
|
|
327
|
+
// 是否开启序号
|
|
328
|
+
numbers: {
|
|
329
|
+
type: Boolean,
|
|
330
|
+
default: false
|
|
331
|
+
},
|
|
332
|
+
orders: {
|
|
333
|
+
type: String,
|
|
334
|
+
default: 'asc'
|
|
335
|
+
},
|
|
336
|
+
// 是否筛选列功能
|
|
337
|
+
filter: {
|
|
338
|
+
type: Boolean,
|
|
339
|
+
default: false
|
|
340
|
+
},
|
|
341
|
+
// 是否开启多选
|
|
342
|
+
checkbox: {
|
|
343
|
+
type: Boolean,
|
|
344
|
+
default: false
|
|
345
|
+
},
|
|
346
|
+
selectable: Function,
|
|
347
|
+
reserveSelection: Boolean,
|
|
348
|
+
// 默认选中,类型为Boolean时默认全(不)选
|
|
349
|
+
checked: {
|
|
350
|
+
type: [Boolean, Array],
|
|
351
|
+
default: false
|
|
352
|
+
},
|
|
353
|
+
checkedKey: {
|
|
354
|
+
type: String,
|
|
355
|
+
default: 'id'
|
|
356
|
+
},
|
|
357
|
+
// 无数据时显示的文本
|
|
358
|
+
emptyText: {
|
|
359
|
+
type: String,
|
|
360
|
+
default: '暂无数据'
|
|
361
|
+
},
|
|
362
|
+
// 是否开启合计行区域
|
|
363
|
+
total: {
|
|
364
|
+
type: Boolean,
|
|
365
|
+
default: false
|
|
366
|
+
},
|
|
367
|
+
//本地数据总条数差值
|
|
368
|
+
lose: {
|
|
369
|
+
type: Number,
|
|
370
|
+
default: 0
|
|
371
|
+
},
|
|
372
|
+
// 合计行显示文本
|
|
373
|
+
totalText: {
|
|
374
|
+
type: String,
|
|
375
|
+
default: ''
|
|
376
|
+
},
|
|
377
|
+
showSummary: {
|
|
378
|
+
type: Boolean,
|
|
379
|
+
default: false
|
|
380
|
+
},
|
|
381
|
+
sumText: {
|
|
382
|
+
type: String,
|
|
383
|
+
default: ''
|
|
384
|
+
},
|
|
385
|
+
// 开启分页
|
|
386
|
+
page: {
|
|
387
|
+
type: [Boolean, Object],
|
|
388
|
+
default() {
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
showPage: {
|
|
393
|
+
type: Boolean,
|
|
394
|
+
default: true
|
|
395
|
+
},
|
|
396
|
+
// 渲染树形数据指定field
|
|
397
|
+
treeKey: {
|
|
398
|
+
type: String,
|
|
399
|
+
default: ''
|
|
400
|
+
},
|
|
401
|
+
// 单元格配置
|
|
402
|
+
thead: {
|
|
403
|
+
type: Array,
|
|
404
|
+
default() {
|
|
405
|
+
return [];
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
optionData: Object,
|
|
409
|
+
// 开启数据增加删除按钮
|
|
410
|
+
editable: {
|
|
411
|
+
type: Boolean,
|
|
412
|
+
default: false
|
|
413
|
+
},
|
|
414
|
+
theadAdd: {
|
|
415
|
+
type: Boolean,
|
|
416
|
+
default: true
|
|
417
|
+
},
|
|
418
|
+
// 单元格点击事件
|
|
419
|
+
click: {
|
|
420
|
+
type: Boolean,
|
|
421
|
+
default: false
|
|
422
|
+
},
|
|
423
|
+
totalRow: {
|
|
424
|
+
type: Object,
|
|
425
|
+
default() {
|
|
426
|
+
return {};
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
parseData: Function,
|
|
430
|
+
close: Boolean,
|
|
431
|
+
full: {
|
|
432
|
+
type: Boolean,
|
|
433
|
+
default: true
|
|
434
|
+
},
|
|
435
|
+
height: [Number, String],
|
|
436
|
+
maxHeight: [Number, String],
|
|
437
|
+
response: Function,
|
|
438
|
+
minWidth: [Number, String],
|
|
439
|
+
border: {
|
|
440
|
+
type: [Boolean, String],
|
|
441
|
+
default: false,
|
|
442
|
+
validator: function (value) {
|
|
443
|
+
return [true, false, 'none'].includes(value);
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
theadBorder: {
|
|
447
|
+
type: Boolean,
|
|
448
|
+
default: true
|
|
449
|
+
},
|
|
450
|
+
checkboxParseData: Function,
|
|
451
|
+
checkboxParse: Object,
|
|
452
|
+
display: {
|
|
453
|
+
type: Boolean,
|
|
454
|
+
default: true
|
|
455
|
+
},
|
|
456
|
+
showFormBtn: {
|
|
457
|
+
type: Boolean,
|
|
458
|
+
default: true
|
|
459
|
+
},
|
|
460
|
+
index: {
|
|
461
|
+
type: [Number, Function],
|
|
462
|
+
default: 1
|
|
463
|
+
},
|
|
464
|
+
accumulated: {
|
|
465
|
+
type: Boolean,
|
|
466
|
+
default: true
|
|
467
|
+
},
|
|
468
|
+
immediate: {
|
|
469
|
+
type: Boolean,
|
|
470
|
+
default: true
|
|
471
|
+
},
|
|
472
|
+
zoom: false,
|
|
473
|
+
exportExcludeLabel: {
|
|
474
|
+
type: Array,
|
|
475
|
+
default() {
|
|
476
|
+
return [];
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
rowData: [Object, Boolean],
|
|
480
|
+
least: Boolean,
|
|
481
|
+
//保留搜索参数
|
|
482
|
+
retainSearh: Boolean,
|
|
483
|
+
//无线滚动
|
|
484
|
+
infiniteScroll: Boolean,
|
|
485
|
+
isJoin: {
|
|
486
|
+
type: Boolean,
|
|
487
|
+
default: true
|
|
488
|
+
},
|
|
489
|
+
ajaxConfig: {
|
|
490
|
+
type: Object,
|
|
491
|
+
default() {
|
|
492
|
+
return {};
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
dragSort: Boolean,
|
|
496
|
+
dragSortIcon: {
|
|
497
|
+
type: String,
|
|
498
|
+
default: 'es-icon-caidan'
|
|
499
|
+
},
|
|
500
|
+
isFieldsEncryption: Boolean,
|
|
501
|
+
contentSuccess: Function,
|
|
502
|
+
resetScroll: {
|
|
503
|
+
type: Boolean,
|
|
504
|
+
default: true
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
data() {
|
|
508
|
+
return {
|
|
509
|
+
isEncryption: this.isFieldsEncryption,
|
|
510
|
+
requests: [],
|
|
511
|
+
toolbars: [],
|
|
512
|
+
toolbarEvents: {},
|
|
513
|
+
hasThead: false,
|
|
514
|
+
theadData: [],
|
|
515
|
+
list: [],
|
|
516
|
+
tableLoading: this.loading,
|
|
517
|
+
tableLoadingText: '加载中...',
|
|
518
|
+
isFirsetCheck: false,
|
|
519
|
+
// 可修改表单的值
|
|
520
|
+
editValue: {},
|
|
521
|
+
restotalRow: null,
|
|
522
|
+
showTotal: false,
|
|
523
|
+
config: {
|
|
524
|
+
pageNum: 1,
|
|
525
|
+
pageSize: 20,
|
|
526
|
+
totalCount: 0,
|
|
527
|
+
layout:
|
|
528
|
+
this.mode == 'plus'
|
|
529
|
+
? 'total, sizes, prev, pager, next, jumper'
|
|
530
|
+
: undefined
|
|
531
|
+
},
|
|
532
|
+
searchWhere: {},
|
|
533
|
+
advanceWhere: {},
|
|
534
|
+
tableHeight: 'auto',
|
|
535
|
+
styles: {},
|
|
536
|
+
selected: null,
|
|
537
|
+
options: {},
|
|
538
|
+
icon: true,
|
|
539
|
+
sysCodes: [],
|
|
540
|
+
infiniteDisabled: !this.infiniteScroll,
|
|
541
|
+
isReload: false,
|
|
542
|
+
pageView: null,
|
|
543
|
+
showSizer: false,
|
|
544
|
+
show: true,
|
|
545
|
+
isSetHeight: false,
|
|
546
|
+
showTable: false,
|
|
547
|
+
fields: null,
|
|
548
|
+
showEditPage: false,
|
|
549
|
+
editPage: ''
|
|
550
|
+
};
|
|
551
|
+
},
|
|
552
|
+
computed: {
|
|
553
|
+
wheres() {
|
|
554
|
+
return { ...this.searchWhere, ...this.advanceWhere };
|
|
555
|
+
},
|
|
556
|
+
params() {
|
|
557
|
+
return {
|
|
558
|
+
...(this.param || {}),
|
|
559
|
+
...(this.searchValue || {}),
|
|
560
|
+
...(this.advanceValue || {})
|
|
561
|
+
};
|
|
562
|
+
},
|
|
563
|
+
tag() {
|
|
564
|
+
return this.form && this.elForm == '' ? 'el-form' : 'div';
|
|
565
|
+
},
|
|
566
|
+
_border() {
|
|
567
|
+
return this.border === true ? true : false;
|
|
568
|
+
},
|
|
569
|
+
theads: {
|
|
570
|
+
get() {
|
|
571
|
+
let types;
|
|
572
|
+
types = this.theadData
|
|
573
|
+
.filter((item) => {
|
|
574
|
+
return (
|
|
575
|
+
item.type == 'selection' ||
|
|
576
|
+
item.type == 'index' ||
|
|
577
|
+
item.type == 'sort' ||
|
|
578
|
+
item.type == 'handle'
|
|
579
|
+
);
|
|
580
|
+
})
|
|
581
|
+
.map((item) => {
|
|
582
|
+
return item.type;
|
|
583
|
+
});
|
|
584
|
+
let thead = [];
|
|
585
|
+
let addfilter = false;
|
|
586
|
+
if (this.dragSort && !types.includes('sort')) {
|
|
587
|
+
addfilter = true;
|
|
588
|
+
thead.push({
|
|
589
|
+
type: 'sort',
|
|
590
|
+
key: 'es-sort'
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
if (this.checkbox && !types.includes('selection')) {
|
|
594
|
+
thead.push({
|
|
595
|
+
type: 'selection',
|
|
596
|
+
width: '55',
|
|
597
|
+
align: 'center',
|
|
598
|
+
fixed: 'left',
|
|
599
|
+
selectable: this.selectable,
|
|
600
|
+
reserveSelection: this.reserveSelection,
|
|
601
|
+
filterIcon: this.filter && !addfilter ? 'es-icon-biao' : undefined,
|
|
602
|
+
key: 'es-checkbox'
|
|
603
|
+
});
|
|
604
|
+
if (!addfilter) {
|
|
605
|
+
addfilter = true;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
if (this.numbers && !types.includes('index')) {
|
|
609
|
+
let index = 1;
|
|
610
|
+
if (typeof this.index === 'function') {
|
|
611
|
+
index = this.index;
|
|
612
|
+
} else {
|
|
613
|
+
if (this.orders == 'desc') {
|
|
614
|
+
index = (num) => {
|
|
615
|
+
return this.config.totalCount - num;
|
|
616
|
+
};
|
|
617
|
+
} else if (this.accumulated) {
|
|
618
|
+
index =
|
|
619
|
+
(this.config.pageNum - 1) * this.config.pageSize + this.index;
|
|
620
|
+
} else {
|
|
621
|
+
index = this.index;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
thead.push({
|
|
625
|
+
type: 'index',
|
|
626
|
+
label: '序号',
|
|
627
|
+
width: '70',
|
|
628
|
+
align: 'center',
|
|
629
|
+
fixed: 'left',
|
|
630
|
+
index: index,
|
|
631
|
+
filterIcon: this.filter && !addfilter ? 'es-icon-biao' : undefined,
|
|
632
|
+
key: 'es-index'
|
|
633
|
+
});
|
|
634
|
+
if (!addfilter) {
|
|
635
|
+
addfilter = true;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
if (this.theadData.length) {
|
|
639
|
+
let handle = this.thead.filter((item) => {
|
|
640
|
+
return item.type == 'handle';
|
|
641
|
+
});
|
|
642
|
+
thead = [
|
|
643
|
+
...thead,
|
|
644
|
+
...this.theadData,
|
|
645
|
+
...(types.includes('handle') ? [] : handle)
|
|
646
|
+
];
|
|
647
|
+
} else if (this.show) {
|
|
648
|
+
thead = [...thead, ...this.thead];
|
|
649
|
+
}
|
|
650
|
+
return thead;
|
|
651
|
+
},
|
|
652
|
+
set(val) {
|
|
653
|
+
return val;
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
datas: {
|
|
657
|
+
get() {
|
|
658
|
+
if (this.list && this.list.length) {
|
|
659
|
+
return this.list;
|
|
660
|
+
}
|
|
661
|
+
if (
|
|
662
|
+
this.page &&
|
|
663
|
+
((typeof this.page === 'object' &&
|
|
664
|
+
(!Object.prototype.hasOwnProperty.call(this.page, 'totalCount') ||
|
|
665
|
+
this.page.totalCount == 0)) ||
|
|
666
|
+
this.page === true)
|
|
667
|
+
) {
|
|
668
|
+
this.config.totalCount = this.data.length - this.lose;
|
|
669
|
+
}
|
|
670
|
+
if (this.page && this.data.length > this.config.pageSize) {
|
|
671
|
+
return this.data.filter((item, index) => {
|
|
672
|
+
return (
|
|
673
|
+
index > (this.config.pageNum - 1) * this.config.pageSize - 1 &&
|
|
674
|
+
index < this.config.pageNum * this.config.pageSize
|
|
675
|
+
);
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
return this.data;
|
|
679
|
+
},
|
|
680
|
+
set(val) {
|
|
681
|
+
if (this.list && this.list.length) {
|
|
682
|
+
this.$nextTick(() => {
|
|
683
|
+
this.list = val;
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
this.$emit('update:data', val);
|
|
687
|
+
return val;
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
showToolbar() {
|
|
691
|
+
if (this.readonly) {
|
|
692
|
+
return false;
|
|
693
|
+
}
|
|
694
|
+
if (typeof this.toolbar === 'boolean') {
|
|
695
|
+
if (this.toolbar) {
|
|
696
|
+
this.toolbars = [
|
|
697
|
+
{
|
|
698
|
+
type: 'search',
|
|
699
|
+
contents: [
|
|
700
|
+
{
|
|
701
|
+
type: 'text',
|
|
702
|
+
name: 'keyword',
|
|
703
|
+
placeholder: '请输入关键字'
|
|
704
|
+
}
|
|
705
|
+
]
|
|
706
|
+
}
|
|
707
|
+
];
|
|
708
|
+
}
|
|
709
|
+
return this.toolbar;
|
|
710
|
+
} else if (Array.isArray(this.toolbar)) {
|
|
711
|
+
this.toolbars = this.toolbar;
|
|
712
|
+
return true;
|
|
713
|
+
} else {
|
|
714
|
+
this.toolbars = this.toolbar.contents;
|
|
715
|
+
this.toolbarEvents = this.toolbar.events || {};
|
|
716
|
+
return true;
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
optionDatas: {
|
|
720
|
+
get() {
|
|
721
|
+
let data = this.optionData
|
|
722
|
+
? { ...this.optionData, ...this.options }
|
|
723
|
+
: this.options;
|
|
724
|
+
return data;
|
|
725
|
+
},
|
|
726
|
+
set(val) {
|
|
727
|
+
return val;
|
|
728
|
+
}
|
|
729
|
+
},
|
|
730
|
+
headButton() {
|
|
731
|
+
return this.theadAdd && !this.readonly
|
|
732
|
+
? {
|
|
733
|
+
icon: 'el-icon-circle-plus-outline',
|
|
734
|
+
type: 'text',
|
|
735
|
+
event: this.handleClickAddData
|
|
736
|
+
}
|
|
737
|
+
: undefined;
|
|
738
|
+
},
|
|
739
|
+
isLeast() {
|
|
740
|
+
return this.data.length < 2 && this.least;
|
|
741
|
+
},
|
|
742
|
+
findCode() {
|
|
743
|
+
if (this.service) {
|
|
744
|
+
return `/${this.service}${getDictList}`;
|
|
745
|
+
}
|
|
746
|
+
return findSysCode;
|
|
747
|
+
},
|
|
748
|
+
isShow() {
|
|
749
|
+
let useCaseCodes = util.getStorage('useCaseCodes');
|
|
750
|
+
return (
|
|
751
|
+
this.viewCode &&
|
|
752
|
+
useCaseCodes &&
|
|
753
|
+
(useCaseCodes.indexOf('SuperAdminRoleID') > -1 ||
|
|
754
|
+
useCaseCodes.indexOf('OrgAdminRoleID') > -1)
|
|
755
|
+
);
|
|
756
|
+
}
|
|
757
|
+
},
|
|
758
|
+
watch: {
|
|
759
|
+
viewCode: {
|
|
760
|
+
immediate: true,
|
|
761
|
+
handler(val) {
|
|
762
|
+
if (val) {
|
|
763
|
+
this.hasThead = true;
|
|
764
|
+
this.getContents();
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
showToolbar() {
|
|
769
|
+
this.resetHeight();
|
|
770
|
+
this.doLayout();
|
|
771
|
+
},
|
|
772
|
+
data: {
|
|
773
|
+
deep: true,
|
|
774
|
+
handler() {
|
|
775
|
+
this.list = this.setData();
|
|
776
|
+
}
|
|
777
|
+
},
|
|
778
|
+
scale: {
|
|
779
|
+
deep: true,
|
|
780
|
+
handler(val) {
|
|
781
|
+
if (
|
|
782
|
+
this.tableHeight != 'auto' &&
|
|
783
|
+
this.tableHeight !== false &&
|
|
784
|
+
this.display
|
|
785
|
+
) {
|
|
786
|
+
this.resetHeight();
|
|
787
|
+
this.doLayout();
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
},
|
|
791
|
+
zoom: {
|
|
792
|
+
handler() {
|
|
793
|
+
if (
|
|
794
|
+
this.tableHeight != 'auto' &&
|
|
795
|
+
this.tableHeight !== false &&
|
|
796
|
+
this.display
|
|
797
|
+
) {
|
|
798
|
+
this.resetHeight();
|
|
799
|
+
this.doLayout();
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
checked(newVal) {
|
|
804
|
+
this.list.length && this.checkSelect(newVal);
|
|
805
|
+
},
|
|
806
|
+
thead: {
|
|
807
|
+
deep: true,
|
|
808
|
+
handler(val, old) {
|
|
809
|
+
if (!util.isObjectEqual(val, old)) {
|
|
810
|
+
this.getOptions(val);
|
|
811
|
+
this.chekOpenTotalArea();
|
|
812
|
+
if (Array.isArray(val) && val.length && this.datas.length == 0) {
|
|
813
|
+
this.getTableData();
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
},
|
|
818
|
+
theads: {
|
|
819
|
+
deep: true,
|
|
820
|
+
handler() {
|
|
821
|
+
this.chekOpenTotalArea();
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
param: {
|
|
825
|
+
handler(val, old) {
|
|
826
|
+
if (!util.isObjectEqual(val, old)) {
|
|
827
|
+
this.getTableData();
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
page: {
|
|
832
|
+
immediate: true,
|
|
833
|
+
deep: true,
|
|
834
|
+
handler(val) {
|
|
835
|
+
if (this.$el) {
|
|
836
|
+
this.resetHeight();
|
|
837
|
+
this.doLayout();
|
|
838
|
+
}
|
|
839
|
+
if (typeof val === 'object') {
|
|
840
|
+
this.config = util.extend({}, this.config, val);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
},
|
|
844
|
+
'config.pageNum'() {
|
|
845
|
+
if (this.data.length) {
|
|
846
|
+
this.resetScroll &&
|
|
847
|
+
this.$refs.oaTable &&
|
|
848
|
+
this.$refs.oaTable.resetScroll &&
|
|
849
|
+
this.$refs.oaTable.resetScroll(0, 0);
|
|
850
|
+
this.list = this.setData();
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
height: {
|
|
854
|
+
immediate: true,
|
|
855
|
+
handler(val) {
|
|
856
|
+
if (val) {
|
|
857
|
+
this.tableHeight = val;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
},
|
|
861
|
+
maxHeight: {
|
|
862
|
+
immediate: true,
|
|
863
|
+
handler(val) {
|
|
864
|
+
if (val && this.height === undefined) {
|
|
865
|
+
this.tableHeight = val;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
},
|
|
869
|
+
display(val) {
|
|
870
|
+
if (val) {
|
|
871
|
+
this.resetHeight();
|
|
872
|
+
this.doLayout();
|
|
873
|
+
}
|
|
874
|
+
},
|
|
875
|
+
showEditPage(val) {
|
|
876
|
+
if (val === false) {
|
|
877
|
+
util.win.top.refresh();
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
beforeCreate() {
|
|
882
|
+
this.getTableData = debounce(500, (res) => {
|
|
883
|
+
this.getTableDatas(res);
|
|
884
|
+
});
|
|
885
|
+
},
|
|
886
|
+
created() {
|
|
887
|
+
if (Array.isArray(this.thead) && this.thead.length) {
|
|
888
|
+
this.getOptions(this.thead);
|
|
889
|
+
this.immediate && !this.viewCode && this.getTableData();
|
|
890
|
+
}
|
|
891
|
+
this.chekOpenTotalArea();
|
|
892
|
+
},
|
|
893
|
+
mounted() {
|
|
894
|
+
this.showTable = true;
|
|
895
|
+
if (this.data.length) {
|
|
896
|
+
this.list = this.setData();
|
|
897
|
+
}
|
|
898
|
+
this.list.length && this.checkSelect(this.checked);
|
|
899
|
+
this.resetHeight();
|
|
900
|
+
if (util.win.top != util.win.self) {
|
|
901
|
+
util.win.onresize = throttle(500, this.resetHeight);
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
methods: {
|
|
905
|
+
setData() {
|
|
906
|
+
if (
|
|
907
|
+
this.page &&
|
|
908
|
+
((typeof this.page === 'object' &&
|
|
909
|
+
(!Object.prototype.hasOwnProperty.call(this.page, 'totalCount') ||
|
|
910
|
+
this.page.totalCount == 0)) ||
|
|
911
|
+
this.page === true)
|
|
912
|
+
) {
|
|
913
|
+
this.config.totalCount = this.data.length - this.lose;
|
|
914
|
+
}
|
|
915
|
+
if (this.page && this.data.length > this.config.pageSize) {
|
|
916
|
+
return this.data.filter((item, index) => {
|
|
917
|
+
return (
|
|
918
|
+
index > (this.config.pageNum - 1) * this.config.pageSize - 1 &&
|
|
919
|
+
index < this.config.pageNum * this.config.pageSize
|
|
920
|
+
);
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
return this.data;
|
|
924
|
+
},
|
|
925
|
+
getRequestKey(config) {
|
|
926
|
+
const { method, url, params, data } = config;
|
|
927
|
+
return [method, url, qs.stringify(params), qs.stringify(data)].join('&');
|
|
928
|
+
},
|
|
929
|
+
getContents() {
|
|
930
|
+
util
|
|
931
|
+
.ajax({
|
|
932
|
+
url: this.contentsUrl,
|
|
933
|
+
params: {
|
|
934
|
+
formId: this.viewCode
|
|
935
|
+
}
|
|
936
|
+
})
|
|
937
|
+
.then((res) => {
|
|
938
|
+
if (res.rCode == 0) {
|
|
939
|
+
if (this.contentSuccess) {
|
|
940
|
+
this.contentSuccess(res.results);
|
|
941
|
+
} else {
|
|
942
|
+
let {
|
|
943
|
+
results: { eossFormJson }
|
|
944
|
+
} = res;
|
|
945
|
+
eossFormJson = JSON.parse(eossFormJson);
|
|
946
|
+
if (eossFormJson && eossFormJson.table) {
|
|
947
|
+
this.isEncryption = true;
|
|
948
|
+
this.theadData = eossFormJson.table.thead;
|
|
949
|
+
this.getTableData();
|
|
950
|
+
} else {
|
|
951
|
+
this.hasThead = false;
|
|
952
|
+
}
|
|
953
|
+
this.$emit('init-contents', res.results);
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
},
|
|
958
|
+
getOptions(res) {
|
|
959
|
+
let sysCodes = [];
|
|
960
|
+
res.forEach((item) => {
|
|
961
|
+
if (item.sysCode || item.url) {
|
|
962
|
+
item.sysCode && sysCodes.push(item.sysCode);
|
|
963
|
+
let params = util.extend(
|
|
964
|
+
{},
|
|
965
|
+
item.sysCode
|
|
966
|
+
? { sysAppCode: item.sysCode, code: item.sysCode }
|
|
967
|
+
: {},
|
|
968
|
+
item.param ? item.param : {}
|
|
969
|
+
);
|
|
970
|
+
let key = this.getRequestKey({
|
|
971
|
+
method: this.method,
|
|
972
|
+
url: item.sysCode ? this.findCode : item.url,
|
|
973
|
+
params: params,
|
|
974
|
+
data: {}
|
|
975
|
+
});
|
|
976
|
+
if (!this.requests.includes(key)) {
|
|
977
|
+
util
|
|
978
|
+
.ajax({
|
|
979
|
+
url: item.sysCode ? this.findCode : item.url,
|
|
980
|
+
method: this.method,
|
|
981
|
+
params: params,
|
|
982
|
+
data: params
|
|
983
|
+
})
|
|
984
|
+
.then((res) => {
|
|
985
|
+
if (res.rCode === 0) {
|
|
986
|
+
if (item.type == 'ganged') {
|
|
987
|
+
this.$set(
|
|
988
|
+
this.options,
|
|
989
|
+
item.sysCode || item.field || item.prop,
|
|
990
|
+
[JSON.parse(JSON.stringify(res.results))]
|
|
991
|
+
);
|
|
992
|
+
if (item.sysCode) {
|
|
993
|
+
const bus = this.bus || this.$root.Bus;
|
|
994
|
+
bus &&
|
|
995
|
+
bus.$emit(
|
|
996
|
+
item.sysCode,
|
|
997
|
+
JSON.parse(JSON.stringify(this.options[item.sysCode]))
|
|
998
|
+
);
|
|
999
|
+
}
|
|
1000
|
+
} else {
|
|
1001
|
+
this.$set(
|
|
1002
|
+
this.options,
|
|
1003
|
+
item.sysCode || item.field || item.prop,
|
|
1004
|
+
JSON.parse(JSON.stringify(res.results))
|
|
1005
|
+
);
|
|
1006
|
+
if (item.sysCode) {
|
|
1007
|
+
const bus = this.bus || this.$root.Bus;
|
|
1008
|
+
bus &&
|
|
1009
|
+
bus.$emit(
|
|
1010
|
+
item.sysCode,
|
|
1011
|
+
JSON.parse(JSON.stringify(res.results))
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
this.requests.push(key);
|
|
1016
|
+
} else {
|
|
1017
|
+
let msg = res.msg || '系统错误,请联系管理员!';
|
|
1018
|
+
this.$message.error(msg);
|
|
1019
|
+
}
|
|
1020
|
+
})
|
|
1021
|
+
.catch((err) => {
|
|
1022
|
+
if (err.message && err.message !== 'canceled') {
|
|
1023
|
+
this.$message.error(err.message);
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
} else {
|
|
1028
|
+
if (item.childHead && item.childHead.length) {
|
|
1029
|
+
this.getOptions(item.childHead);
|
|
1030
|
+
}
|
|
1031
|
+
if (item.children && item.children.length) {
|
|
1032
|
+
this.getOptions(item.children);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
this.sysCodes = sysCodes;
|
|
1037
|
+
|
|
1038
|
+
this.bindEventBus();
|
|
1039
|
+
},
|
|
1040
|
+
checkObject(item) {
|
|
1041
|
+
return util.getObjectType(item) === 'object';
|
|
1042
|
+
},
|
|
1043
|
+
chekOpenTotalArea() {
|
|
1044
|
+
if (this.total || this.showSummary) {
|
|
1045
|
+
this.showTotal = true;
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
if (!this.theads) {
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
const arr = JSON.parse(JSON.stringify(this.theads));
|
|
1052
|
+
let flag = false;
|
|
1053
|
+
arr.forEach((item) => {
|
|
1054
|
+
if (item.total) {
|
|
1055
|
+
flag = true;
|
|
1056
|
+
this.showTotal = true;
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
1059
|
+
if (this.showTotal !== flag) {
|
|
1060
|
+
this.showTotal = flag;
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
rowClick(row, column, event) {
|
|
1064
|
+
this.$emit('click', row, column, event);
|
|
1065
|
+
this.$emit('row-click', row, column, event);
|
|
1066
|
+
},
|
|
1067
|
+
handleClickAddData(scope) {
|
|
1068
|
+
if (scope && scope.row) {
|
|
1069
|
+
const data = JSON.parse(JSON.stringify(scope.row));
|
|
1070
|
+
let index = scope.$index + 1;
|
|
1071
|
+
if (this.page) {
|
|
1072
|
+
index += (this.config.pageNum - 1) * this.config.pageSize;
|
|
1073
|
+
}
|
|
1074
|
+
this.data.splice(index, 0, data);
|
|
1075
|
+
this.$emit('dataChange', 'add', data);
|
|
1076
|
+
this.$emit('data-change', 'add', data);
|
|
1077
|
+
this.$emit('btnClick', {
|
|
1078
|
+
event: 'addRow',
|
|
1079
|
+
row: data,
|
|
1080
|
+
index: index,
|
|
1081
|
+
data: this.data
|
|
1082
|
+
});
|
|
1083
|
+
this.$emit('btn-click', {
|
|
1084
|
+
event: 'addRow',
|
|
1085
|
+
row: data,
|
|
1086
|
+
index: index,
|
|
1087
|
+
data: this.data
|
|
1088
|
+
});
|
|
1089
|
+
} else {
|
|
1090
|
+
let index = this.data.length;
|
|
1091
|
+
if (this.page) {
|
|
1092
|
+
index += (this.config.pageNum - 1) * this.config.pageSize;
|
|
1093
|
+
}
|
|
1094
|
+
let rows = {};
|
|
1095
|
+
if (this.rowData && typeof this.rowData == 'object') {
|
|
1096
|
+
rows = this.rowData;
|
|
1097
|
+
} else if (index && this.rowData === true) {
|
|
1098
|
+
rows = JSON.parse(JSON.stringify(this.data[index - 1]));
|
|
1099
|
+
} else {
|
|
1100
|
+
this.getRow(this.thead, rows);
|
|
1101
|
+
}
|
|
1102
|
+
this.data.splice(index, 0, rows);
|
|
1103
|
+
}
|
|
1104
|
+
},
|
|
1105
|
+
getRow(thead, obj) {
|
|
1106
|
+
thead.forEach((item) => {
|
|
1107
|
+
if (item.field) {
|
|
1108
|
+
obj[item['field']] = item.defaultValue || '';
|
|
1109
|
+
} else if (item.children && item.children.length) {
|
|
1110
|
+
this.getRow(item.children, obj);
|
|
1111
|
+
}
|
|
1112
|
+
});
|
|
1113
|
+
},
|
|
1114
|
+
handleClickDeleteData(scope) {
|
|
1115
|
+
const data = JSON.parse(JSON.stringify(scope.row));
|
|
1116
|
+
let index = scope.$index;
|
|
1117
|
+
if (this.page) {
|
|
1118
|
+
index += (this.config.pageNum - 1) * this.config.pageSize;
|
|
1119
|
+
}
|
|
1120
|
+
this.data.splice(index, 1);
|
|
1121
|
+
this.$emit('dataChange', 'delete', data);
|
|
1122
|
+
this.$emit('data-change', 'delete', data);
|
|
1123
|
+
this.$emit('btnClick', {
|
|
1124
|
+
event: 'deleteRow',
|
|
1125
|
+
row: data,
|
|
1126
|
+
index: index,
|
|
1127
|
+
data: this.data
|
|
1128
|
+
});
|
|
1129
|
+
this.$emit('btn-click', {
|
|
1130
|
+
event: 'deleteRow',
|
|
1131
|
+
row: data,
|
|
1132
|
+
index: index,
|
|
1133
|
+
data: this.data
|
|
1134
|
+
});
|
|
1135
|
+
},
|
|
1136
|
+
checkSelect(newVal) {
|
|
1137
|
+
this.$nextTick(() => {
|
|
1138
|
+
if (util.getObjectType(newVal) === 'array') {
|
|
1139
|
+
newVal.forEach((row) => {
|
|
1140
|
+
if (util.isObject(row)) {
|
|
1141
|
+
this.$refs.oaTable.toggleRowSelection(row, true);
|
|
1142
|
+
} else {
|
|
1143
|
+
this.setChecked(this.list, row);
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1146
|
+
} else if (newVal === true) {
|
|
1147
|
+
this.toggleAllSelection();
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
},
|
|
1151
|
+
setChecked(list, row) {
|
|
1152
|
+
list.forEach((item) => {
|
|
1153
|
+
if (item.children && item.children.length) {
|
|
1154
|
+
this.setChecked(item.children, row);
|
|
1155
|
+
}
|
|
1156
|
+
if (item[this.checkedKey] === row) {
|
|
1157
|
+
this.$refs.oaTable.toggleRowSelection(item, true);
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1161
|
+
},
|
|
1162
|
+
getTableDatas(res) {
|
|
1163
|
+
let where;
|
|
1164
|
+
let first;
|
|
1165
|
+
if (res) {
|
|
1166
|
+
where = res.where;
|
|
1167
|
+
first = res.first;
|
|
1168
|
+
}
|
|
1169
|
+
if (!this.url) {
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
if (first !== false && !this.infiniteScroll) {
|
|
1173
|
+
this.config.pageNum = 1;
|
|
1174
|
+
}
|
|
1175
|
+
this.tableLoadingText = '加载中...';
|
|
1176
|
+
let reqData = util.extend(
|
|
1177
|
+
{},
|
|
1178
|
+
this.params,
|
|
1179
|
+
this.page
|
|
1180
|
+
? {
|
|
1181
|
+
pageNum: this.config.pageNum,
|
|
1182
|
+
pageSize: this.config.pageSize
|
|
1183
|
+
}
|
|
1184
|
+
: {}
|
|
1185
|
+
);
|
|
1186
|
+
if (where) {
|
|
1187
|
+
reqData = util.extend({}, reqData, where);
|
|
1188
|
+
}
|
|
1189
|
+
//if (this.fields)
|
|
1190
|
+
if (this.retainSearh || first === false) {
|
|
1191
|
+
reqData = util.extend({}, reqData, this.wheres);
|
|
1192
|
+
}
|
|
1193
|
+
if (this.isJoin) {
|
|
1194
|
+
for (let i in reqData) {
|
|
1195
|
+
if (Array.isArray(reqData[i])) {
|
|
1196
|
+
reqData[i] = reqData[i].join(',');
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
if (this.isEncryption) {
|
|
1201
|
+
let fields = [];
|
|
1202
|
+
this.theads.forEach((item) => {
|
|
1203
|
+
if (item.field || item.prop) {
|
|
1204
|
+
fields.push(item.field || item.prop);
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
let initLogin = util.getStorage('initLogin');
|
|
1208
|
+
initLogin && (initLogin = JSON.parse(initLogin));
|
|
1209
|
+
reqData['fields'] = initLogin.secret
|
|
1210
|
+
? util.esmEncrypt({
|
|
1211
|
+
data: fields.join(','),
|
|
1212
|
+
key: initLogin.secret
|
|
1213
|
+
})
|
|
1214
|
+
: fields.join(',');
|
|
1215
|
+
}
|
|
1216
|
+
this.tableLoading = true;
|
|
1217
|
+
util
|
|
1218
|
+
.ajax({
|
|
1219
|
+
...this.ajaxConfig,
|
|
1220
|
+
url: this.url,
|
|
1221
|
+
method: this.method,
|
|
1222
|
+
format: this.format,
|
|
1223
|
+
params: reqData,
|
|
1224
|
+
data: reqData
|
|
1225
|
+
})
|
|
1226
|
+
.then((res) => {
|
|
1227
|
+
this.tableLoading = false;
|
|
1228
|
+
if (res.rCode === 0 || res.status === 'success') {
|
|
1229
|
+
if (this.isReload) {
|
|
1230
|
+
this.list = [];
|
|
1231
|
+
this.isReload = false;
|
|
1232
|
+
}
|
|
1233
|
+
let results =
|
|
1234
|
+
this.parseData !== undefined
|
|
1235
|
+
? this.parseData(res.results || res.data || res)
|
|
1236
|
+
: res.results || res.data;
|
|
1237
|
+
if (this.infiniteScroll) {
|
|
1238
|
+
this.list = this.list.concat(
|
|
1239
|
+
results.data || results.records || results.list
|
|
1240
|
+
);
|
|
1241
|
+
this.config.pageNum += 1;
|
|
1242
|
+
} else {
|
|
1243
|
+
this.list = results.data || results.records || results.list;
|
|
1244
|
+
this.$nextTick(() => {
|
|
1245
|
+
this.resetScroll &&
|
|
1246
|
+
this.$refs.oaTable &&
|
|
1247
|
+
this.$refs.oaTable.resetScroll &&
|
|
1248
|
+
this.$refs.oaTable.resetScroll(0, 0);
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
this.config.totalCount =
|
|
1252
|
+
results.count || results.total || results.totalCount;
|
|
1253
|
+
this.config.pageCount = results.pageCount;
|
|
1254
|
+
this.checked &&
|
|
1255
|
+
this.$nextTick(() => {
|
|
1256
|
+
this.checkSelect(this.checked);
|
|
1257
|
+
});
|
|
1258
|
+
if (
|
|
1259
|
+
this.infiniteScroll &&
|
|
1260
|
+
this.config.totalCount === this.list.length
|
|
1261
|
+
) {
|
|
1262
|
+
this.infiniteDisabled = true;
|
|
1263
|
+
}
|
|
1264
|
+
} else {
|
|
1265
|
+
this.list = [];
|
|
1266
|
+
//this.tableHeight = false;
|
|
1267
|
+
let msg = res.msg || '系统错误,请联系管理员!';
|
|
1268
|
+
this.$message.error(msg);
|
|
1269
|
+
}
|
|
1270
|
+
this.$emit('success', res);
|
|
1271
|
+
})
|
|
1272
|
+
.catch((err) => {
|
|
1273
|
+
//this.tableHeight = false;
|
|
1274
|
+
if (err.message && err.message !== 'canceled') {
|
|
1275
|
+
this.$message.error(err.message);
|
|
1276
|
+
}
|
|
1277
|
+
this.tableLoading = false;
|
|
1278
|
+
});
|
|
1279
|
+
},
|
|
1280
|
+
selectionChange(data) {
|
|
1281
|
+
this.selected = JSON.parse(JSON.stringify(data));
|
|
1282
|
+
this.$emit('selection-change', data);
|
|
1283
|
+
},
|
|
1284
|
+
clearSelection() {
|
|
1285
|
+
this.$refs.oaTable.clearSelection();
|
|
1286
|
+
},
|
|
1287
|
+
toggleRowSelection(row, selected) {
|
|
1288
|
+
this.$refs.oaTable.toggleRowSelection(row, selected);
|
|
1289
|
+
},
|
|
1290
|
+
toggleAllSelection() {
|
|
1291
|
+
this.$refs.oaTable.toggleAllSelection();
|
|
1292
|
+
},
|
|
1293
|
+
toggleRowExpansion(row, expanded) {
|
|
1294
|
+
this.$refs.oaTable.toggleRowExpansion(row, expanded);
|
|
1295
|
+
},
|
|
1296
|
+
setCurrentRow(row) {
|
|
1297
|
+
this.$refs.oaTable.setCurrentRow(row);
|
|
1298
|
+
},
|
|
1299
|
+
|
|
1300
|
+
clearSort() {
|
|
1301
|
+
this.$refs.oaTable.clearSort();
|
|
1302
|
+
},
|
|
1303
|
+
clearFilter(columnKey) {
|
|
1304
|
+
this.$refs.oaTable.clearFilter(columnKey);
|
|
1305
|
+
},
|
|
1306
|
+
doLayout() {
|
|
1307
|
+
this.$refs.oaTable && this.$refs.oaTable.doLayout();
|
|
1308
|
+
},
|
|
1309
|
+
sort(prop, order) {
|
|
1310
|
+
this.$refs.oaTable.sort(prop, order);
|
|
1311
|
+
},
|
|
1312
|
+
formBlur(data) {
|
|
1313
|
+
this.$emit('blur', data, this.list);
|
|
1314
|
+
},
|
|
1315
|
+
formFocus(data) {
|
|
1316
|
+
this.$emit('focus', data, this.list);
|
|
1317
|
+
},
|
|
1318
|
+
formChange(data) {
|
|
1319
|
+
this.$emit('edit', data, this.list);
|
|
1320
|
+
this.$emit('change', data, this.list);
|
|
1321
|
+
},
|
|
1322
|
+
toolbarChange(...args) {
|
|
1323
|
+
this.$emit('toolbar-change', ...args);
|
|
1324
|
+
},
|
|
1325
|
+
handleAjax(handle, row) {
|
|
1326
|
+
this.changeLoading(true, `${handle.text}中...`);
|
|
1327
|
+
let params = handle.param || {};
|
|
1328
|
+
if (handle.syncKeys) {
|
|
1329
|
+
if (typeof handle.syncKeys === 'string') {
|
|
1330
|
+
params[handle.syncKeys] = row[handle.syncKeys];
|
|
1331
|
+
} else if (Array.isArray(handle.syncKeys)) {
|
|
1332
|
+
for (let i in handle.syncKeys) {
|
|
1333
|
+
if (Array.isArray(row)) {
|
|
1334
|
+
let param = row.map((item) => {
|
|
1335
|
+
return item[handle.syncKeys[i]];
|
|
1336
|
+
});
|
|
1337
|
+
params[handle.syncKeys[i]] = param.join(',');
|
|
1338
|
+
} else {
|
|
1339
|
+
params[handle.syncKeys[i]] = row[handle.syncKeys[i]];
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
} else {
|
|
1343
|
+
for (let i in handle.syncKeys) {
|
|
1344
|
+
if (Array.isArray(row)) {
|
|
1345
|
+
let param = row.map((item) => {
|
|
1346
|
+
return item[handle.syncKeys[i]];
|
|
1347
|
+
});
|
|
1348
|
+
params[i] = param.join(',');
|
|
1349
|
+
} else {
|
|
1350
|
+
params[i] = row[handle.syncKeys[i]];
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
} else {
|
|
1355
|
+
if (Array.isArray(row)) {
|
|
1356
|
+
let param = row.map((item) => {
|
|
1357
|
+
return item.id;
|
|
1358
|
+
});
|
|
1359
|
+
params.id = param.join(',');
|
|
1360
|
+
} else {
|
|
1361
|
+
params.id = row.id;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
let keys = Object.keys(params);
|
|
1365
|
+
util
|
|
1366
|
+
.ajax({
|
|
1367
|
+
...(handle.ajaxConfig || {}),
|
|
1368
|
+
url: handle.action,
|
|
1369
|
+
data:
|
|
1370
|
+
keys.length == 1 && handle.format === false
|
|
1371
|
+
? params[keys[0]].split(',')
|
|
1372
|
+
: params,
|
|
1373
|
+
params:
|
|
1374
|
+
keys.length == 1 && handle.format === false
|
|
1375
|
+
? params[keys[0]].split(',')
|
|
1376
|
+
: params,
|
|
1377
|
+
method: handle.method,
|
|
1378
|
+
format: handle.format
|
|
1379
|
+
})
|
|
1380
|
+
.then((res) => {
|
|
1381
|
+
this.changeLoading(false);
|
|
1382
|
+
if (res.rCode === 0) {
|
|
1383
|
+
this.$message({
|
|
1384
|
+
message: `${handle.text}成功`,
|
|
1385
|
+
duration: 2000,
|
|
1386
|
+
type: 'success',
|
|
1387
|
+
onClose: () => {
|
|
1388
|
+
let first = Object.prototype.hasOwnProperty.call(
|
|
1389
|
+
handle,
|
|
1390
|
+
'first'
|
|
1391
|
+
)
|
|
1392
|
+
? handle.first
|
|
1393
|
+
: false;
|
|
1394
|
+
let reload = handle.reload || true;
|
|
1395
|
+
if (reload) {
|
|
1396
|
+
this.reload({}, first);
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
} else {
|
|
1401
|
+
this.$message.error(
|
|
1402
|
+
res.msg || `${handle.text}失败,请联系管理员!`
|
|
1403
|
+
);
|
|
1404
|
+
}
|
|
1405
|
+
})
|
|
1406
|
+
.catch((err) => {
|
|
1407
|
+
this.changeLoading(false);
|
|
1408
|
+
if (err.message && err.message !== 'canceled') {
|
|
1409
|
+
this.$message.error(err.message);
|
|
1410
|
+
}
|
|
1411
|
+
});
|
|
1412
|
+
},
|
|
1413
|
+
checkParse(data, parse) {
|
|
1414
|
+
if (Array.isArray(data)) {
|
|
1415
|
+
return data.map((items) => {
|
|
1416
|
+
let item = JSON.parse(JSON.stringify(items));
|
|
1417
|
+
let obj = {};
|
|
1418
|
+
for (let i in parse) {
|
|
1419
|
+
obj[i] = item[parse[i]];
|
|
1420
|
+
delete item[parse[i]];
|
|
1421
|
+
}
|
|
1422
|
+
return { ...obj, ...item };
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
let item = JSON.parse(JSON.stringify(data));
|
|
1426
|
+
let obj = {};
|
|
1427
|
+
for (let i in parse) {
|
|
1428
|
+
obj[i] = item[parse[i]];
|
|
1429
|
+
delete item[parse[i]];
|
|
1430
|
+
}
|
|
1431
|
+
return { ...obj, ...item };
|
|
1432
|
+
},
|
|
1433
|
+
handleClick(res) {
|
|
1434
|
+
let { row, handle } = res;
|
|
1435
|
+
let rows;
|
|
1436
|
+
if (handle.checkbox) {
|
|
1437
|
+
if (!this.selected || !this.selected.length) {
|
|
1438
|
+
this.$alert('请选择数据', '提示', { type: 'warning' });
|
|
1439
|
+
return;
|
|
1440
|
+
} else {
|
|
1441
|
+
row = this.selected;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
if (this.checkboxParseData) {
|
|
1445
|
+
rows = this.checkboxParseData(JSON.parse(JSON.stringify(row)));
|
|
1446
|
+
} else if (this.checkboxParse) {
|
|
1447
|
+
rows = this.checkParse(row, this.checkboxParse);
|
|
1448
|
+
} else if (handle.checkboxParse) {
|
|
1449
|
+
rows = this.checkParse(row, handle.checkboxParse);
|
|
1450
|
+
} else if (row) {
|
|
1451
|
+
rows = JSON.parse(JSON.stringify(row));
|
|
1452
|
+
}
|
|
1453
|
+
let thead = this.theads;
|
|
1454
|
+
if (this.$refs.oaTable) {
|
|
1455
|
+
thead = this.$refs.oaTable.getThead().thead;
|
|
1456
|
+
}
|
|
1457
|
+
if (handle.action) {
|
|
1458
|
+
let isConfirm = handle.confirm || true;
|
|
1459
|
+
if (isConfirm) {
|
|
1460
|
+
let msg = handle.field ? row[handle.field] : '';
|
|
1461
|
+
this.$confirm(`确定要${handle.text}${msg}吗`, '提示', {
|
|
1462
|
+
confirmButtonText: '确定',
|
|
1463
|
+
cancelButtonText: '取消',
|
|
1464
|
+
type: 'warning'
|
|
1465
|
+
})
|
|
1466
|
+
.then(() => {
|
|
1467
|
+
this.handleAjax(handle, rows);
|
|
1468
|
+
})
|
|
1469
|
+
.catch(() => {});
|
|
1470
|
+
} else {
|
|
1471
|
+
this.handleAjax(handle, rows);
|
|
1472
|
+
}
|
|
1473
|
+
} else if (handle.event) {
|
|
1474
|
+
if (typeof handle.event === 'function') {
|
|
1475
|
+
handle.event({
|
|
1476
|
+
ele: this,
|
|
1477
|
+
thead: thead,
|
|
1478
|
+
data: this.list,
|
|
1479
|
+
selected: rows,
|
|
1480
|
+
...res
|
|
1481
|
+
});
|
|
1482
|
+
} else if (
|
|
1483
|
+
handle.event === 'add' ||
|
|
1484
|
+
handle.event === 'edit' ||
|
|
1485
|
+
handle.event === 'look'
|
|
1486
|
+
) {
|
|
1487
|
+
let changes = {
|
|
1488
|
+
event: handle.event,
|
|
1489
|
+
title: handle.title || handle.text,
|
|
1490
|
+
value: handle.event === 'add' ? {} : rows,
|
|
1491
|
+
readonly: handle.event === 'look',
|
|
1492
|
+
actionType: handle.actionType
|
|
1493
|
+
? handle.actionType
|
|
1494
|
+
: handle.event === 'add'
|
|
1495
|
+
? 'save'
|
|
1496
|
+
: 'update',
|
|
1497
|
+
visible: true
|
|
1498
|
+
};
|
|
1499
|
+
if (handle.dialog) {
|
|
1500
|
+
let dialog;
|
|
1501
|
+
for (let i = 0; i < this.$children.length; i++) {
|
|
1502
|
+
let child = this.$children[i];
|
|
1503
|
+
if (child.$refs[handle.dialog]) {
|
|
1504
|
+
dialog = child.$refs[handle.dialog];
|
|
1505
|
+
break;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
dialog.setAttrs(changes);
|
|
1509
|
+
}
|
|
1510
|
+
this.injector && this.injector.handleChangeData(changes);
|
|
1511
|
+
if (handle.busEvent) {
|
|
1512
|
+
const bus = this.bus || this.$root.Bus;
|
|
1513
|
+
bus && bus.$emit(handle.busEvent, changes);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
} else if (handle.changeData) {
|
|
1517
|
+
let changeData = {};
|
|
1518
|
+
if (Array.isArray(handle.changeData)) {
|
|
1519
|
+
handle.changeData.forEach((item) => {
|
|
1520
|
+
if (util.isObject(item)) {
|
|
1521
|
+
for (let i in item) {
|
|
1522
|
+
if (typeof item[i] === 'boolean') {
|
|
1523
|
+
changeData[i] = item[i];
|
|
1524
|
+
} else {
|
|
1525
|
+
changeData[i] = handle[item[i]] || item[i];
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
} else {
|
|
1529
|
+
changeData[item] =
|
|
1530
|
+
handle[item] || (Array.isArray(rows) ? rows : rows[item]);
|
|
1531
|
+
}
|
|
1532
|
+
});
|
|
1533
|
+
} else {
|
|
1534
|
+
for (let i in handle.changeData) {
|
|
1535
|
+
let item = handle.changeData[i];
|
|
1536
|
+
if (util.isObject(item)) {
|
|
1537
|
+
let obj = {};
|
|
1538
|
+
for (let e in item) {
|
|
1539
|
+
obj[e] =
|
|
1540
|
+
handle[item[e]] ||
|
|
1541
|
+
(Array.isArray(rows) ? rows : rows[item[e]]);
|
|
1542
|
+
}
|
|
1543
|
+
changeData[i] = obj;
|
|
1544
|
+
} else {
|
|
1545
|
+
if (typeof item === 'boolean') {
|
|
1546
|
+
changeData[i] = item;
|
|
1547
|
+
} else {
|
|
1548
|
+
changeData[i] =
|
|
1549
|
+
handle[item] || (Array.isArray(rows) ? rows : rows[item]);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
if (handle.actionType) {
|
|
1555
|
+
changeData['actionType'] = handle.actionType;
|
|
1556
|
+
}
|
|
1557
|
+
this.injector && this.injector.handleChangeData(changeData);
|
|
1558
|
+
if (handle.busEvent) {
|
|
1559
|
+
const bus = this.bus || this.$root.Bus;
|
|
1560
|
+
bus && bus.$emit(handle.busEvent, changes);
|
|
1561
|
+
}
|
|
1562
|
+
} else {
|
|
1563
|
+
if (handle.exportXls) {
|
|
1564
|
+
let text = '操作';
|
|
1565
|
+
if (
|
|
1566
|
+
this.theads[this.theads.length - 1] &&
|
|
1567
|
+
this.theads[this.theads.length - 1].type === 'handle'
|
|
1568
|
+
) {
|
|
1569
|
+
text = this.theads[this.theads.length - 1].title;
|
|
1570
|
+
}
|
|
1571
|
+
let type = ['selection', 'index', 'expand'];
|
|
1572
|
+
thead = thead.map((item) => {
|
|
1573
|
+
return item.filter((ele) => {
|
|
1574
|
+
return (
|
|
1575
|
+
!type.includes(ele.type) &&
|
|
1576
|
+
ele.label !== text &&
|
|
1577
|
+
!this.exportExcludeLabel.includes(ele.label)
|
|
1578
|
+
);
|
|
1579
|
+
});
|
|
1580
|
+
});
|
|
1581
|
+
util.exportXls({
|
|
1582
|
+
thead: thead,
|
|
1583
|
+
data: this.list,
|
|
1584
|
+
name: this.fileName,
|
|
1585
|
+
option: this.optionDatas
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
this.$emit('btnClick', res, this.list, thead, rows);
|
|
1589
|
+
this.$emit('btn-click', res, this.list, thead, rows);
|
|
1590
|
+
}
|
|
1591
|
+
},
|
|
1592
|
+
sizeChange(res) {
|
|
1593
|
+
this.config.pageSize = res;
|
|
1594
|
+
this.config.pageNum = 1;
|
|
1595
|
+
this.checkSelect(this.checked);
|
|
1596
|
+
this.$emit('page-size-change', res);
|
|
1597
|
+
if (this.url) {
|
|
1598
|
+
this.getTableData({ where: this.wheres, first: false });
|
|
1599
|
+
}
|
|
1600
|
+
},
|
|
1601
|
+
currentChange(res) {
|
|
1602
|
+
this.config.pageNum = res;
|
|
1603
|
+
this.checkSelect(this.checked);
|
|
1604
|
+
this.$emit('page-current-change', res);
|
|
1605
|
+
this.$emit('current', res);
|
|
1606
|
+
if (this.url) {
|
|
1607
|
+
this.getTableData({ where: this.wheres, first: false });
|
|
1608
|
+
}
|
|
1609
|
+
},
|
|
1610
|
+
preClick(res) {
|
|
1611
|
+
this.config.pageNum = res;
|
|
1612
|
+
this.checkSelect(this.checked);
|
|
1613
|
+
this.$emit('prev', res);
|
|
1614
|
+
},
|
|
1615
|
+
nextClick(res) {
|
|
1616
|
+
this.config.pageNum = res;
|
|
1617
|
+
this.checkSelect(this.checked);
|
|
1618
|
+
this.$emit('next', res);
|
|
1619
|
+
},
|
|
1620
|
+
hanleSearch(data) {
|
|
1621
|
+
this.searchWhere =
|
|
1622
|
+
this.response !== undefined
|
|
1623
|
+
? this.response({
|
|
1624
|
+
type: 'search',
|
|
1625
|
+
data: JSON.parse(JSON.stringify(data))
|
|
1626
|
+
})
|
|
1627
|
+
: data;
|
|
1628
|
+
if (this.url && this.executeSearch) {
|
|
1629
|
+
this.getTableData({ where: this.wheres });
|
|
1630
|
+
}
|
|
1631
|
+
this.$emit('search', this.searchWhere);
|
|
1632
|
+
},
|
|
1633
|
+
hanleReset() {
|
|
1634
|
+
this.searchWhere = {};
|
|
1635
|
+
this.advanceWhere = {};
|
|
1636
|
+
if (this.url) {
|
|
1637
|
+
this.getTableData();
|
|
1638
|
+
}
|
|
1639
|
+
this.$emit('reset', this.params);
|
|
1640
|
+
},
|
|
1641
|
+
hanleSubmit({ data, show }) {
|
|
1642
|
+
this.advanceWhere =
|
|
1643
|
+
this.response !== undefined
|
|
1644
|
+
? this.response({
|
|
1645
|
+
type: 'filter',
|
|
1646
|
+
data: JSON.parse(JSON.stringify(data))
|
|
1647
|
+
})
|
|
1648
|
+
: data;
|
|
1649
|
+
|
|
1650
|
+
if (this.url && this.executeFilter) {
|
|
1651
|
+
this.getTableData({ where: this.wheres });
|
|
1652
|
+
}
|
|
1653
|
+
this.$emit('submit', {
|
|
1654
|
+
data: this.advanceWhere,
|
|
1655
|
+
where: this.wheres,
|
|
1656
|
+
show
|
|
1657
|
+
});
|
|
1658
|
+
},
|
|
1659
|
+
hanleCancel() {
|
|
1660
|
+
this.$emit('cancel', this.params);
|
|
1661
|
+
},
|
|
1662
|
+
handleTabs({ item, index }) {
|
|
1663
|
+
if (this.url) {
|
|
1664
|
+
this.getTableData({ where: item });
|
|
1665
|
+
}
|
|
1666
|
+
this.$emit('tabs', { item, index });
|
|
1667
|
+
},
|
|
1668
|
+
reload(obj, first = false) {
|
|
1669
|
+
if (obj && obj.config) {
|
|
1670
|
+
this.config = util.extend({}, this.config, obj.config);
|
|
1671
|
+
}
|
|
1672
|
+
if (this.url) {
|
|
1673
|
+
this.isReload = true;
|
|
1674
|
+
this.getTableData({ where: obj && obj.where ? obj.where : {}, first });
|
|
1675
|
+
}
|
|
1676
|
+
},
|
|
1677
|
+
resetHeight(warn) {
|
|
1678
|
+
this.isSetHeight =
|
|
1679
|
+
util.getStyle(this.$el.parentNode, 'height') == '0px' ? false : true;
|
|
1680
|
+
this.$nextTick(() => {
|
|
1681
|
+
if (this.full && !this.height && !this.maxHeight && this.isSetHeight) {
|
|
1682
|
+
let height = this.$el.parentNode.offsetHeight;
|
|
1683
|
+
if (height) {
|
|
1684
|
+
height = parseInt(
|
|
1685
|
+
util.getStyle(this.$el.parentNode, 'height', '%'),
|
|
1686
|
+
10
|
|
1687
|
+
);
|
|
1688
|
+
height =
|
|
1689
|
+
(height == NaN ? 0 : height) -
|
|
1690
|
+
parseInt(util.getStyle(this.$el.parentNode, 'padding-top'), 10) -
|
|
1691
|
+
parseInt(
|
|
1692
|
+
util.getStyle(this.$el.parentNode, 'padding-bottom'),
|
|
1693
|
+
10
|
|
1694
|
+
);
|
|
1695
|
+
for (let i = 0; i < this.$el.parentNode.childNodes.length; i++) {
|
|
1696
|
+
let ele = this.$el.parentNode.childNodes[i];
|
|
1697
|
+
if (
|
|
1698
|
+
this.$el &&
|
|
1699
|
+
ele.offsetHeight !== undefined &&
|
|
1700
|
+
ele != this.$el
|
|
1701
|
+
) {
|
|
1702
|
+
height =
|
|
1703
|
+
height -
|
|
1704
|
+
ele.offsetHeight -
|
|
1705
|
+
parseInt(util.getStyle(ele, 'margin-top'), 10) -
|
|
1706
|
+
parseInt(util.getStyle(ele, 'margin-bottom'), 10);
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
height -= this.showToolbar
|
|
1710
|
+
? this.$refs.toolbar.$el.offsetHeight
|
|
1711
|
+
: 0;
|
|
1712
|
+
height -=
|
|
1713
|
+
this.page === false || this.showPage == false
|
|
1714
|
+
? 0
|
|
1715
|
+
: this.$refs.pagination.$el.offsetHeight;
|
|
1716
|
+
height -= this.title ? this.$refs.title.offsetHeight : 0;
|
|
1717
|
+
height -= parseInt(
|
|
1718
|
+
util.getStyle(this.$refs.esTableContent, 'padding-top'),
|
|
1719
|
+
10
|
|
1720
|
+
);
|
|
1721
|
+
height -= parseInt(
|
|
1722
|
+
util.getStyle(this.$refs.esTableContent, 'padding-bottom'),
|
|
1723
|
+
10
|
|
1724
|
+
);
|
|
1725
|
+
let emptyText = this.$refs.esTableContent.querySelector(
|
|
1726
|
+
'.el-table__empty-text'
|
|
1727
|
+
);
|
|
1728
|
+
if (this.total) {
|
|
1729
|
+
height -= 1;
|
|
1730
|
+
}
|
|
1731
|
+
let eht = 0;
|
|
1732
|
+
if (emptyText) {
|
|
1733
|
+
eht = emptyText.offsetHeight;
|
|
1734
|
+
let thead =
|
|
1735
|
+
this.$refs.esTableContent.querySelector('.el-table__header');
|
|
1736
|
+
thead && (eht += thead.offsetHeight);
|
|
1737
|
+
}
|
|
1738
|
+
if (height > 1 && height - eht > 1) {
|
|
1739
|
+
this.tableHeight = height;
|
|
1740
|
+
} else {
|
|
1741
|
+
console.warn(this.$el.parentNode, `获取不到高度!`);
|
|
1742
|
+
}
|
|
1743
|
+
} else if (!warn) {
|
|
1744
|
+
setTimeout(() => {
|
|
1745
|
+
this.resetHeight(true);
|
|
1746
|
+
}, 1000);
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
});
|
|
1750
|
+
},
|
|
1751
|
+
validate(callback) {
|
|
1752
|
+
if (this.form) {
|
|
1753
|
+
let form = this.elForm || this.$children[0];
|
|
1754
|
+
form.validate((valid) => {
|
|
1755
|
+
callback(valid);
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
},
|
|
1759
|
+
changeLoading(show, text) {
|
|
1760
|
+
this.tableLoading = show;
|
|
1761
|
+
if (text) {
|
|
1762
|
+
this.tableLoadingText = text;
|
|
1763
|
+
}
|
|
1764
|
+
},
|
|
1765
|
+
handleFilterColumn() {
|
|
1766
|
+
this.showSizer = true;
|
|
1767
|
+
},
|
|
1768
|
+
handleSortChange(res) {
|
|
1769
|
+
if (res.data && res.data.length) {
|
|
1770
|
+
this.list = res.data;
|
|
1771
|
+
}
|
|
1772
|
+
this.$emit('sort-change', res);
|
|
1773
|
+
},
|
|
1774
|
+
handleUpdateDragSort(data, event) {
|
|
1775
|
+
this.$emit('update-drag-sort', data, event);
|
|
1776
|
+
},
|
|
1777
|
+
mergeThead(res) {
|
|
1778
|
+
this.show = false;
|
|
1779
|
+
this.theadData = [];
|
|
1780
|
+
this.icon = true;
|
|
1781
|
+
this.showSizer = false;
|
|
1782
|
+
// if (!this.showTotal) {
|
|
1783
|
+
// for (let i = 0; i < res.length; i++) {
|
|
1784
|
+
// if (res[i].total) {
|
|
1785
|
+
// this.showTotal = true;
|
|
1786
|
+
// break;
|
|
1787
|
+
// }
|
|
1788
|
+
// }
|
|
1789
|
+
// }
|
|
1790
|
+
this.$nextTick(() => {
|
|
1791
|
+
this.theadData = res;
|
|
1792
|
+
setTimeout(() => {
|
|
1793
|
+
this.show = true;
|
|
1794
|
+
}, 500);
|
|
1795
|
+
});
|
|
1796
|
+
},
|
|
1797
|
+
setOptions(val, sysCode) {
|
|
1798
|
+
this.$set(this.options, sysCode, val);
|
|
1799
|
+
},
|
|
1800
|
+
bindEventBus() {
|
|
1801
|
+
this.sysCodes.forEach((item) => {
|
|
1802
|
+
const bus = this.bus || this.$root.Bus;
|
|
1803
|
+
bus &&
|
|
1804
|
+
bus.$on(item, (val) => {
|
|
1805
|
+
this.setOptions(val, item);
|
|
1806
|
+
});
|
|
1807
|
+
});
|
|
1808
|
+
},
|
|
1809
|
+
unbindEventBus() {
|
|
1810
|
+
this.sysCodes.forEach((item) => {
|
|
1811
|
+
const bus = this.bus || this.$root.Bus;
|
|
1812
|
+
bus && bus.$off(item, this.setOptions);
|
|
1813
|
+
});
|
|
1814
|
+
},
|
|
1815
|
+
reset() {
|
|
1816
|
+
this.$refs.toolbar && this.$refs.toolbar.reset();
|
|
1817
|
+
},
|
|
1818
|
+
openEditPage() {
|
|
1819
|
+
let fields = [];
|
|
1820
|
+
this.theads.forEach((item) => {
|
|
1821
|
+
if (item.field || item.prop) {
|
|
1822
|
+
fields.push(item.field || item.prop);
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1825
|
+
fields = util.esEncode(fields.join(','));
|
|
1826
|
+
this.editPage = `/lowcode-ui/webpack/index.html#simpleEditOnlinePage?pageId=${this.viewCode}&fields=${fields}`;
|
|
1827
|
+
this.showEditPage = true;
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
};
|
|
1831
|
+
</script>
|