super-pages 0.0.4-up → 0.0.5-up
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/index.html +13 -13
- package/lib/super-pages.css +1 -1
- package/lib/super-pages.js +1375 -1285
- package/lib/super-pages.umd.cjs +13 -13
- package/package.json +6 -3
- package/packages/index.js +30 -30
- package/packages/super-page/index.js +9 -9
- package/packages/super-page/src/button-group.vue +294 -294
- package/packages/super-page/src/chart-page.vue +215 -215
- package/packages/super-page/src/chart-query-page.vue +163 -163
- package/packages/super-page/src/export-form-report-dialog.vue +145 -145
- package/packages/super-page/src/form-head.vue +74 -74
- package/packages/super-page/src/form-page.vue +107 -107
- package/packages/super-page/src/group-tag.vue +21 -21
- package/packages/super-page/src/list-page.vue +1453 -1454
- package/packages/super-page/src/list-toolbar-dynamic-source.vue +89 -89
- package/packages/super-page/src/list-toolbar-page.vue +377 -377
- package/packages/super-page/src/my-button-base.vue +438 -438
- package/packages/super-page/src/my-button.vue +196 -196
- package/packages/super-page/src/page-custom-component.vue +56 -56
- package/packages/super-page/src/remove-signer-dialog.vue +103 -103
- package/packages/super-page/src/sub-tab-page.vue +79 -79
- package/packages/super-page/src/super-page-component.vue +86 -86
- package/packages/super-page/src/super-page.vue +162 -162
- package/packages/super-page/src/tab-page.vue +154 -154
- package/packages/super-page/src/task-informition-dialog.vue +82 -82
- package/packages/super-page/src/util/ListButtonEvent.js +896 -896
- package/packages/super-page/src/util/api.js +37 -37
- package/packages/super-page/src/util/callEvents.js +62 -62
- package/packages/super-page/src/util/chartButtonEvent.js +60 -60
- package/packages/super-page/src/util/common-util.js +102 -102
- package/packages/super-page/src/util/commonButtonEvent.js +70 -70
- package/packages/super-page/src/util/eventBus.js +8 -2
- package/packages/super-page/src/util/formButtonEvent.js +509 -509
- package/packages/super-page/src/util/store.js +3 -3
- package/packages/super-page/src/util/super-page.js +29 -29
- package/packages/super-page/src/util/workflowButtonEvent.js +1729 -1729
- package/packages/super-page/src/widget-col-page.vue +339 -339
- package/packages/super-page/src/widget-page.vue +703 -703
- package/packages/super-page/src/widget-sub-tab-pane-page.vue +115 -115
- package/packages/super-page/src/widget-tab-pane-page.vue +135 -135
- package/packages/super-page/src/workflow-button-group.vue +561 -561
- package/packages/super-page-dialog/index.js +9 -9
- package/packages/super-page-dialog/src/super-page-dialog.vue +200 -200
- package/packages/utils/gogocodeTransfer.js +59 -59
- package/src/i18n/langs/cn.js +65 -65
- package/src/i18n/langs/en.js +68 -68
- package/src/utils/common-util.js +9 -9
- package/vite.config.js +36 -36
|
@@ -1,1454 +1,1453 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-if="showPage">
|
|
3
|
-
<button-group
|
|
4
|
-
v-if="colSetting.options.buttonGroup"
|
|
5
|
-
:button-groups="colSetting.options.buttonGroup"
|
|
6
|
-
:permission-prefix="permissionPrefix"
|
|
7
|
-
:additional-param-map="additionalParamMap"
|
|
8
|
-
:list-toolbar-list="listToolbarList"
|
|
9
|
-
:button-area-custom-component-arr="
|
|
10
|
-
colSetting.options.buttonAreaCustomComponentArr
|
|
11
|
-
"
|
|
12
|
-
position="list"
|
|
13
|
-
:search-form-info="searchFormInfo"
|
|
14
|
-
:toolbar-right-show="colSetting.options.toolbarRightShow"
|
|
15
|
-
:page-code="pageCode"
|
|
16
|
-
:selections="selections"
|
|
17
|
-
:disabled="disabled"
|
|
18
|
-
@refresh="refreshList"
|
|
19
|
-
@searchGridData="searchGridData"
|
|
20
|
-
@click="clickListButton"
|
|
21
|
-
@getSystemRef="getSystemRef"
|
|
22
|
-
/>
|
|
23
|
-
<!-- 工具栏组件 -->
|
|
24
|
-
<div v-else>
|
|
25
|
-
<list-toolbar-page
|
|
26
|
-
:list-toolbar-list="listToolbarList"
|
|
27
|
-
:page-code="pageCode"
|
|
28
|
-
@searchGridData="searchGridData"
|
|
29
|
-
/>
|
|
30
|
-
<page-custom-component
|
|
31
|
-
:button-area-custom-component-arr="
|
|
32
|
-
colSetting.options.buttonAreaCustomComponentArr
|
|
33
|
-
"
|
|
34
|
-
:page-code="pageCode"
|
|
35
|
-
@getSystemRef="getSystemRef"
|
|
36
|
-
/>
|
|
37
|
-
</div>
|
|
38
|
-
<input
|
|
39
|
-
ref="_selectFile_"
|
|
40
|
-
type="file"
|
|
41
|
-
name="_selectFile_"
|
|
42
|
-
style="display: none"
|
|
43
|
-
@change="doImport(button)"
|
|
44
|
-
/>
|
|
45
|
-
<super-grid
|
|
46
|
-
ref="grid"
|
|
47
|
-
:url="urlToListData"
|
|
48
|
-
:options="options"
|
|
49
|
-
:code="listCode"
|
|
50
|
-
:search-form-info="searchFormInfo"
|
|
51
|
-
:list-toolbar-form-data="listToolbarFormData"
|
|
52
|
-
@select="select"
|
|
53
|
-
@select-all="select"
|
|
54
|
-
@setSearchType="closeSearch"
|
|
55
|
-
@refresh="clickRefresh"
|
|
56
|
-
/>
|
|
57
|
-
<super-page-dialog
|
|
58
|
-
v-if="isShowPageDialog"
|
|
59
|
-
:preview="isPreview"
|
|
60
|
-
:dev-mode="pageDevMode"
|
|
61
|
-
:jump-page-setting="jumpPageSetting"
|
|
62
|
-
@update-value="updateValues"
|
|
63
|
-
@close="closeInPage"
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
</template>
|
|
67
|
-
|
|
68
|
-
<script>
|
|
69
|
-
import Util from './util/util'
|
|
70
|
-
import * as Vue from 'vue'
|
|
71
|
-
import ButtonGroup from './button-group'
|
|
72
|
-
import eventBus from './util/eventBus'
|
|
73
|
-
import buttonEvents from './util/ListButtonEvent'
|
|
74
|
-
import callEvents from './util/callEvents'
|
|
75
|
-
import apis from './util/api'
|
|
76
|
-
import store from './util/store'
|
|
77
|
-
import listToolbarPage from './list-toolbar-page'
|
|
78
|
-
import pageCustomComponent from './page-custom-component'
|
|
79
|
-
import { getStoreInfo, setStoreInfo } from './util/common-util'
|
|
80
|
-
import {
|
|
81
|
-
getSystemBackendUrl,
|
|
82
|
-
isPromise,
|
|
83
|
-
} from 'imatrix-ui/src/utils/common-util'
|
|
84
|
-
export default {
|
|
85
|
-
name: 'ListPage',
|
|
86
|
-
components: {
|
|
87
|
-
ButtonGroup,
|
|
88
|
-
listToolbarPage,
|
|
89
|
-
pageCustomComponent,
|
|
90
|
-
},
|
|
91
|
-
props: {
|
|
92
|
-
colSetting: {
|
|
93
|
-
type: Object,
|
|
94
|
-
default: null,
|
|
95
|
-
},
|
|
96
|
-
// 页面编码
|
|
97
|
-
pageCode: {
|
|
98
|
-
type: String,
|
|
99
|
-
default: null,
|
|
100
|
-
},
|
|
101
|
-
// 页签编码
|
|
102
|
-
tabCode: {
|
|
103
|
-
type: String,
|
|
104
|
-
default: null,
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
data() {
|
|
108
|
-
let baseURL = window.$vueApp.config.globalProperties.baseURL
|
|
109
|
-
const tableName = this.colSetting.baseSetting.modelDataTableCode
|
|
110
|
-
let isWorkflowEntity = getStoreInfo(this.pageCode, tableName + '_isProcess')
|
|
111
|
-
if (isWorkflowEntity === null && isWorkflowEntity === undefined) {
|
|
112
|
-
isWorkflowEntity = false
|
|
113
|
-
}
|
|
114
|
-
const system = getStoreInfo(this.pageCode, '_systemInfo')
|
|
115
|
-
const isSqlQuery = getStoreInfo(this.pageCode, '_pageIsDsc')
|
|
116
|
-
console.log(
|
|
117
|
-
'list-page--_pageIsDsc--isSqlQuery=',
|
|
118
|
-
isSqlQuery,
|
|
119
|
-
'this.pageCode=',
|
|
120
|
-
this.pageCode
|
|
121
|
-
)
|
|
122
|
-
const pageCode = getStoreInfo(this.pageCode, '_pageCode')
|
|
123
|
-
const urlToListData = this.getUrlToListData(system)
|
|
124
|
-
// 实体类名,首字母小写
|
|
125
|
-
const entityName = this.colSetting.baseSetting.modelDataTableEntityName
|
|
126
|
-
const beanName = this.colSetting.baseSetting.beanName
|
|
127
|
-
const importBeanName = this.colSetting.baseSetting.importBeanName
|
|
128
|
-
let permissionPrefix
|
|
129
|
-
if (system) {
|
|
130
|
-
baseURL = getSystemBackendUrl(system.backendUrl)
|
|
131
|
-
permissionPrefix =
|
|
132
|
-
system.code +
|
|
133
|
-
'.' +
|
|
134
|
-
pageCode +
|
|
135
|
-
'.' +
|
|
136
|
-
this.colSetting.baseSetting.componentCode
|
|
137
|
-
}
|
|
138
|
-
let initSearchForm = this.colSetting.options.listFilterCondition
|
|
139
|
-
if (typeof initSearchForm === 'undefined') {
|
|
140
|
-
initSearchForm = []
|
|
141
|
-
}
|
|
142
|
-
const pathQuery = getStoreInfo(this.pageCode, '_pathQuery')
|
|
143
|
-
const pageHeight = getStoreInfo(this.pageCode, '_pageHeight')
|
|
144
|
-
const options = {
|
|
145
|
-
isSql: isSqlQuery,
|
|
146
|
-
extraParam: {
|
|
147
|
-
entityName: entityName,
|
|
148
|
-
beanName: beanName,
|
|
149
|
-
functionCode: permissionPrefix + '.list',
|
|
150
|
-
tableName,
|
|
151
|
-
},
|
|
152
|
-
initSearchForm,
|
|
153
|
-
lineEditOptions: {
|
|
154
|
-
aftersaveIsCreateRow: false,
|
|
155
|
-
autoSave: false,
|
|
156
|
-
enter: this.enterSave,
|
|
157
|
-
esc: this.escRestorRow,
|
|
158
|
-
},
|
|
159
|
-
multiple: this.colSetting.options.isListViewMultiple, // 是否多选,默认以列表管理中配置的为准
|
|
160
|
-
showIndex: this.colSetting.options.isListViewShowSerialNumber, // 是否显示序号,默认以列表管理中配置的为准
|
|
161
|
-
indexContinuous: this.colSetting.options.serialNumberContinuous,
|
|
162
|
-
pageSizes: this.colSetting.options.listViewPageNum, // 可选行数
|
|
163
|
-
initSearch: this.colSetting.options.isListViewDefaultQuery, // 初始化时是否查询,默认是查询
|
|
164
|
-
resizeHeight: this.resizeListHeight,
|
|
165
|
-
pageCode: this.pageCode,
|
|
166
|
-
pageHeight: pageHeight, // 页面的高度
|
|
167
|
-
additionalParamMap: pathQuery, // 将路由参数传给列表组件
|
|
168
|
-
showOverflowTooltip: !!(
|
|
169
|
-
this.colSetting.options.isBreakLine === undefined ||
|
|
170
|
-
this.colSetting.options.isBreakLine === false
|
|
171
|
-
), // 单元格内容是否换行显示
|
|
172
|
-
isEnableEnterEvent: this.colSetting.options.isEnableEnterEvent, // 是否启用回车事件
|
|
173
|
-
}
|
|
174
|
-
if (system) {
|
|
175
|
-
// 系统编码传给列表数据后台请求
|
|
176
|
-
options.extraParam.systemCode = system.code
|
|
177
|
-
// 当前系统,表示是当前的自定义系统信息
|
|
178
|
-
options.system = system
|
|
179
|
-
}
|
|
180
|
-
if (this.colSetting.options.sortFields) {
|
|
181
|
-
options.initSortInfo = []
|
|
182
|
-
this.colSetting.options.sortFields.forEach((item) => {
|
|
183
|
-
const sortInfo = {
|
|
184
|
-
order: item.sortOrder,
|
|
185
|
-
}
|
|
186
|
-
if (isSqlQuery) {
|
|
187
|
-
sortInfo.prop = item.propDbName
|
|
188
|
-
} else {
|
|
189
|
-
sortInfo.prop = item.sortColumn
|
|
190
|
-
}
|
|
191
|
-
options.initSortInfo.push(sortInfo)
|
|
192
|
-
})
|
|
193
|
-
} else {
|
|
194
|
-
if (
|
|
195
|
-
this.colSetting.options.listViewOrderProp &&
|
|
196
|
-
this.colSetting.options.listViewOrderMode
|
|
197
|
-
) {
|
|
198
|
-
// 默认排序字段,和排序方式
|
|
199
|
-
options.initSortInfo = {
|
|
200
|
-
order: this.colSetting.options.listViewOrderMode,
|
|
201
|
-
}
|
|
202
|
-
if (isSqlQuery) {
|
|
203
|
-
options.initSortInfo.prop =
|
|
204
|
-
this.colSetting.options.listViewOrderPropDbName
|
|
205
|
-
} else {
|
|
206
|
-
options.initSortInfo.prop = this.colSetting.options.listViewOrderProp
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
if (this.colSetting.options.isWithDataPermission) {
|
|
211
|
-
options.isWithDataPermission =
|
|
212
|
-
this.colSetting.options.isWithDataPermission
|
|
213
|
-
}
|
|
214
|
-
const listViewTreeTableSetting =
|
|
215
|
-
this.colSetting.options.listViewTreeTableSetting
|
|
216
|
-
if (listViewTreeTableSetting) {
|
|
217
|
-
// 父级字段配置
|
|
218
|
-
// 格式为:name~~dbCloumnName,name表示实体字段名,dbCloumnName表示数据库字段名
|
|
219
|
-
const parentPropInfo = listViewTreeTableSetting.parentProp
|
|
220
|
-
let parentProp
|
|
221
|
-
let parentPropDbName
|
|
222
|
-
if (parentPropInfo && parentPropInfo.indexOf('~~') > 0) {
|
|
223
|
-
parentProp = parentPropInfo.substring(0, parentPropInfo.indexOf('~~'))
|
|
224
|
-
parentPropDbName = parentPropInfo.substring(
|
|
225
|
-
parentPropInfo.indexOf('~~') + 2
|
|
226
|
-
)
|
|
227
|
-
}
|
|
228
|
-
if (isSqlQuery) {
|
|
229
|
-
// 数据库字段名
|
|
230
|
-
options.parentProp = parentPropDbName
|
|
231
|
-
} else {
|
|
232
|
-
// 实体字段名
|
|
233
|
-
options.parentProp = parentProp
|
|
234
|
-
}
|
|
235
|
-
if (options.parentProp) {
|
|
236
|
-
// 表示配置了父级字段名,则表示是树状结构数据
|
|
237
|
-
// 树表格配置传给后台
|
|
238
|
-
options.extraParam.listViewTreeSetting = JSON.stringify(
|
|
239
|
-
listViewTreeTableSetting
|
|
240
|
-
)
|
|
241
|
-
const lazy = listViewTreeTableSetting.lazy
|
|
242
|
-
if (lazy === undefined || lazy === null) {
|
|
243
|
-
options.lazy = true
|
|
244
|
-
} else {
|
|
245
|
-
options.lazy = lazy
|
|
246
|
-
}
|
|
247
|
-
const defaultExpandAll = listViewTreeTableSetting.defaultExpandAll
|
|
248
|
-
if (defaultExpandAll === undefined || defaultExpandAll === null) {
|
|
249
|
-
options.defaultExpandAll = false
|
|
250
|
-
} else {
|
|
251
|
-
options.defaultExpandAll = defaultExpandAll
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
if (isSqlQuery) {
|
|
255
|
-
options.subRowUrl = baseURL + '/dsc/commons/list-subs'
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
const isPreview = getStoreInfo(this.pageCode, '_pagePreview')
|
|
260
|
-
if (isPreview !== undefined && isPreview === true) {
|
|
261
|
-
// 预览时,不请求数据,只查看列表结构
|
|
262
|
-
options.loadBeforeSend = function () {
|
|
263
|
-
return false
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
let pageDevMode = getStoreInfo(this.pageCode, '_pageDevMode')
|
|
267
|
-
if (pageDevMode === null || pageDevMode === undefined) {
|
|
268
|
-
pageDevMode = false
|
|
269
|
-
}
|
|
270
|
-
options.pageDevMode = pageDevMode
|
|
271
|
-
let formNoRuleCode = ''
|
|
272
|
-
if (this.colSetting.options && this.colSetting.options.formNoRuleCode) {
|
|
273
|
-
formNoRuleCode = this.colSetting.options.formNoRuleCode
|
|
274
|
-
}
|
|
275
|
-
let listToolbarList
|
|
276
|
-
if (this.colSetting.options && this.colSetting.options.listToolbarList) {
|
|
277
|
-
listToolbarList = this.colSetting.options.listToolbarList
|
|
278
|
-
}
|
|
279
|
-
const listCode = this.colSetting.baseSetting.modelCode
|
|
280
|
-
let importRuleCode = ''
|
|
281
|
-
if (this.colSetting.options && this.colSetting.options.importRuleCode) {
|
|
282
|
-
importRuleCode = this.colSetting.options.importRuleCode
|
|
283
|
-
} else {
|
|
284
|
-
// 如果没有配置导入编码的时候,可以默认给导入编码赋上列表编码
|
|
285
|
-
// importRuleCode = listCode
|
|
286
|
-
}
|
|
287
|
-
options.isWorkflowEntity = isWorkflowEntity
|
|
288
|
-
// 表单事件集合
|
|
289
|
-
let listEvents
|
|
290
|
-
const pageEvents = getStoreInfo(this.pageCode, '_pageEvents')
|
|
291
|
-
if (pageEvents) {
|
|
292
|
-
listEvents = pageEvents.listEvents
|
|
293
|
-
if (listEvents && listEvents[listCode + '__beforeListLoad']) {
|
|
294
|
-
options.loadBeforeSend = listEvents[listCode + '__beforeListLoad']
|
|
295
|
-
}
|
|
296
|
-
if (listEvents && listEvents[listCode + '__onListLoad']) {
|
|
297
|
-
options.gridDataLoaded = listEvents[listCode + '__onListLoad']
|
|
298
|
-
}
|
|
299
|
-
if (listEvents && listEvents[listCode + '__afterListLoad']) {
|
|
300
|
-
options.gridComplete = listEvents[listCode + '__afterListLoad']
|
|
301
|
-
}
|
|
302
|
-
// 重新计算列表高度事件
|
|
303
|
-
if (listEvents && listEvents[listCode + '__resizeTableHeight']) {
|
|
304
|
-
options.resizeHeight = listEvents[listCode + '__resizeTableHeight']
|
|
305
|
-
}
|
|
306
|
-
if (listEvents && listEvents[listCode + '__beforeEdit']) {
|
|
307
|
-
if (options.lineEditOptions === undefined) {
|
|
308
|
-
options.lineEditOptions = {}
|
|
309
|
-
}
|
|
310
|
-
options.lineEditOptions.beforeEdit =
|
|
311
|
-
listEvents[listCode + '__beforeEdit']
|
|
312
|
-
}
|
|
313
|
-
if (listEvents && listEvents[listCode + '__beforeRestoreValidate']) {
|
|
314
|
-
if (options.lineEditOptions === undefined) {
|
|
315
|
-
options.lineEditOptions = {}
|
|
316
|
-
}
|
|
317
|
-
options.lineEditOptions.beforeRestoreValidate =
|
|
318
|
-
listEvents[listCode + '__beforeRestoreValidate']
|
|
319
|
-
}
|
|
320
|
-
if (listEvents && listEvents[listCode + '__beforeRestore']) {
|
|
321
|
-
if (options.lineEditOptions === undefined) {
|
|
322
|
-
options.lineEditOptions = {}
|
|
323
|
-
}
|
|
324
|
-
options.lineEditOptions.beforeRestore =
|
|
325
|
-
listEvents[listCode + '__beforeRestore']
|
|
326
|
-
}
|
|
327
|
-
const customEvents = pageEvents.customEvents
|
|
328
|
-
if (customEvents) {
|
|
329
|
-
// 将页面中配置的自定义事件集合传给列表组件super-grid,供列表行编辑控件使用
|
|
330
|
-
options.eventCallBack = customEvents
|
|
331
|
-
if (
|
|
332
|
-
this.colSetting.options.styleCustomMethod &&
|
|
333
|
-
this.colSetting.options.styleCustomMethod !== ''
|
|
334
|
-
) {
|
|
335
|
-
if (
|
|
336
|
-
customEvents &&
|
|
337
|
-
customEvents[this.colSetting.options.styleCustomMethod]
|
|
338
|
-
) {
|
|
339
|
-
options.rowStyleRender =
|
|
340
|
-
customEvents[this.colSetting.options.styleCustomMethod]
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
// console.log('options--', options)
|
|
346
|
-
return {
|
|
347
|
-
listToolbarList,
|
|
348
|
-
urlToListData,
|
|
349
|
-
// 列表组件配置属性
|
|
350
|
-
options,
|
|
351
|
-
operationButtons: this.colSetting.options.operationButtons,
|
|
352
|
-
selections: null,
|
|
353
|
-
listCode,
|
|
354
|
-
permissionPrefix, // 按钮组中按钮的资源编码前缀,例如:系统编码.实体类名
|
|
355
|
-
system,
|
|
356
|
-
tableName: this.colSetting.baseSetting.modelDataTableCode,
|
|
357
|
-
entityName: entityName, // 实体类名(包括包路径)
|
|
358
|
-
beanName,
|
|
359
|
-
importBeanName,
|
|
360
|
-
myJsContent: null, // 按钮的js内容
|
|
361
|
-
isSqlQuery,
|
|
362
|
-
judgeHeavyList: this.colSetting.options.judgeHeavyList, // 判重组合字段配置
|
|
363
|
-
listViewImportDuplicate: this.colSetting.options.listViewImportDuplicate, // 导入重复规则
|
|
364
|
-
buttonRestfulApiPath: null, // 按钮的后台路径
|
|
365
|
-
deleteLogicSetting: this.colSetting.options.deleteLogicSetting, // 删除逻辑控制配置,子表有记录时是否允许删除,默认是true允许
|
|
366
|
-
baseURL,
|
|
367
|
-
autoSetValueData: null, // 按钮的“自动设值”配置
|
|
368
|
-
dataConversionRule: null, // 数据转换规则编码
|
|
369
|
-
formNoRuleCode, // 表单编号规则
|
|
370
|
-
importRuleCode, // 导入编码
|
|
371
|
-
isPreview, // 是否是预览
|
|
372
|
-
button: null, // 点击的当前按钮
|
|
373
|
-
logSettingText: null,
|
|
374
|
-
additionalParamMap: null, // 跳转页面的附加参数
|
|
375
|
-
dataTypeMap: null, // 数据类型map集合,key为字段名,value为字段类型,优化保存速度
|
|
376
|
-
showPage: false, // 是否显示页面内容
|
|
377
|
-
operationButtonObj: {}, // 操作列按钮对象,key为按钮编码,value为按钮对象
|
|
378
|
-
listEvents,
|
|
379
|
-
pageDevMode,
|
|
380
|
-
isShowPageDialog: false, // 是否显示弹框页面
|
|
381
|
-
jumpPageSetting: null, // 弹框页面的设置信息
|
|
382
|
-
editRowData: null, // 行编辑时当前编辑的行记录
|
|
383
|
-
searchIsPopup: false, // 是否是弹窗查询
|
|
384
|
-
customEvents: pageEvents ? pageEvents.customEvents : null,
|
|
385
|
-
listToolbarFormData: null, // 列表工具栏的值对象
|
|
386
|
-
isWorkflowEntity,
|
|
387
|
-
searchFormInfo: { data: {} },
|
|
388
|
-
disabled: false,
|
|
389
|
-
pageType: 'list', // 页面类型
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
watch: {
|
|
393
|
-
jumpPageSetting: {
|
|
394
|
-
deep: true,
|
|
395
|
-
handler(jumpPageSetting) {
|
|
396
|
-
if (jumpPageSetting && jumpPageSetting !== null) {
|
|
397
|
-
const that = this
|
|
398
|
-
eventBus.$on(
|
|
399
|
-
jumpPageSetting.pageCode + '-close-dialog',
|
|
400
|
-
(pageCode, successOperation, popEntity, popPageCode) => {
|
|
401
|
-
if (pageCode === jumpPageSetting.pageCode) {
|
|
402
|
-
that.closeInPageEvent(
|
|
403
|
-
popEntity,
|
|
404
|
-
popPageCode,
|
|
405
|
-
successOperation,
|
|
406
|
-
that
|
|
407
|
-
)
|
|
408
|
-
}
|
|
409
|
-
that.$set(that, 'selections', null)
|
|
410
|
-
// that.selections = null
|
|
411
|
-
// 关闭事件
|
|
412
|
-
eventBus.$off(pageCode + '-close-dialog')
|
|
413
|
-
}
|
|
414
|
-
)
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
},
|
|
418
|
-
},
|
|
419
|
-
created() {
|
|
420
|
-
window.addEventListener('message', this.recieveMessage)
|
|
421
|
-
this.getDataTypeMap().then(() => {
|
|
422
|
-
const tableName = this.colSetting.baseSetting.modelDataTableCode
|
|
423
|
-
const isWfEntity = getStoreInfo(this.pageCode, tableName + '_isProcess')
|
|
424
|
-
if (isWfEntity === null && isWfEntity === undefined) {
|
|
425
|
-
this.isWorkflowEntity = false
|
|
426
|
-
} else {
|
|
427
|
-
this.isWorkflowEntity = isWfEntity
|
|
428
|
-
}
|
|
429
|
-
// 设置列表操作列按钮
|
|
430
|
-
this.setOperationButtons()
|
|
431
|
-
})
|
|
432
|
-
const additionalParamMap = getStoreInfo(this.pageCode, 'additionalParamMap')
|
|
433
|
-
if (additionalParamMap) {
|
|
434
|
-
if (!this.options.additionalParamMap) {
|
|
435
|
-
this.options['additionalParamMap'] = {}
|
|
436
|
-
}
|
|
437
|
-
Object.assign(this.options.additionalParamMap, additionalParamMap)
|
|
438
|
-
}
|
|
439
|
-
if (this.options.additionalParamMap) {
|
|
440
|
-
this.additionalParamMap = this.options.additionalParamMap
|
|
441
|
-
}
|
|
442
|
-
const that = this
|
|
443
|
-
eventBus.$on(
|
|
444
|
-
that.pageCode + '-close-component-page-dialog',
|
|
445
|
-
(jumpInfo, popEntity, popPageCode) => {
|
|
446
|
-
console.log(
|
|
447
|
-
'close-component-page-dialog-list------',
|
|
448
|
-
jumpInfo,
|
|
449
|
-
popEntity,
|
|
450
|
-
popPageCode
|
|
451
|
-
)
|
|
452
|
-
if (that.$refs.grid) {
|
|
453
|
-
that.$refs.grid.closePageDialog({
|
|
454
|
-
entity: popEntity,
|
|
455
|
-
pageCode: popPageCode,
|
|
456
|
-
})
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
)
|
|
460
|
-
// 刷新指定页签的表格数据
|
|
461
|
-
eventBus.$on(that.pageCode + '-refresh-tab', (tabCode) => {
|
|
462
|
-
if (
|
|
463
|
-
that.$refs.grid &&
|
|
464
|
-
tabCode !== undefined &&
|
|
465
|
-
tabCode === that.tabCode
|
|
466
|
-
) {
|
|
467
|
-
that.$refs.grid.refresh()
|
|
468
|
-
}
|
|
469
|
-
})
|
|
470
|
-
// 关闭弹框事件回调使用
|
|
471
|
-
eventBus.$on(this.pageCode + '_close-dialog-get-entity', () => {
|
|
472
|
-
$emit(eventBus, that.pageCode + '_close-super-dialog')
|
|
473
|
-
})
|
|
474
|
-
},
|
|
475
|
-
beforeUnmount() {
|
|
476
|
-
eventBus.$off(this.pageCode + '-close-component-page-dialog')
|
|
477
|
-
eventBus.$off(this.pageCode + '-refresh-tab')
|
|
478
|
-
eventBus.$off(this.pageCode + '_close-dialog-get-entity')
|
|
479
|
-
},
|
|
480
|
-
methods: {
|
|
481
|
-
...Util,
|
|
482
|
-
...buttonEvents,
|
|
483
|
-
...callEvents,
|
|
484
|
-
...apis,
|
|
485
|
-
// 列表组件内容刷新后的回调事件
|
|
486
|
-
clickRefresh() {
|
|
487
|
-
this.selections = []
|
|
488
|
-
},
|
|
489
|
-
getSystemRef(refKey, operation) {
|
|
490
|
-
if (!refKey) {
|
|
491
|
-
// 列表的ref属性的值
|
|
492
|
-
refKey = 'grid'
|
|
493
|
-
}
|
|
494
|
-
if (!operation) {
|
|
495
|
-
operation = 'refresh'
|
|
496
|
-
}
|
|
497
|
-
if (this.$refs[refKey]) {
|
|
498
|
-
const domRef = this.$refs[refKey]
|
|
499
|
-
if (domRef) {
|
|
500
|
-
if (operation === 'refresh') {
|
|
501
|
-
domRef.refresh()
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
return 123
|
|
506
|
-
},
|
|
507
|
-
getDataTypeMap() {
|
|
508
|
-
return new Promise((resolve, reject) => {
|
|
509
|
-
if (this.isPreview) {
|
|
510
|
-
// 预览时不需要获得字段类型
|
|
511
|
-
this.showPage = true
|
|
512
|
-
resolve()
|
|
513
|
-
} else {
|
|
514
|
-
this.getDataTypeMapRequest(this.system, this.tableName)
|
|
515
|
-
.then((dataTypeMap) => {
|
|
516
|
-
this.dataTypeMap = dataTypeMap.dataTypeMap
|
|
517
|
-
setStoreInfo(
|
|
518
|
-
this.pageCode,
|
|
519
|
-
this.tableName + '_isProcess',
|
|
520
|
-
dataTypeMap.isProcess
|
|
521
|
-
)
|
|
522
|
-
console.log(store)
|
|
523
|
-
this.showPage = true
|
|
524
|
-
resolve()
|
|
525
|
-
})
|
|
526
|
-
.catch(() => {
|
|
527
|
-
reject(
|
|
528
|
-
new Error(
|
|
529
|
-
'获得数据表:' + this.tableName + '的字段类型集合失败'
|
|
530
|
-
)
|
|
531
|
-
)
|
|
532
|
-
})
|
|
533
|
-
}
|
|
534
|
-
})
|
|
535
|
-
},
|
|
536
|
-
// 点击导入按钮选择文件
|
|
537
|
-
clickImport() {
|
|
538
|
-
if (!this.isPreview) {
|
|
539
|
-
// 预览时,导入按钮不生效才行
|
|
540
|
-
this.$refs._selectFile_.click()
|
|
541
|
-
}
|
|
542
|
-
},
|
|
543
|
-
// 选择文件后执行导入
|
|
544
|
-
doImport() {
|
|
545
|
-
const button = this.button
|
|
546
|
-
if (button) {
|
|
547
|
-
const that = this
|
|
548
|
-
if (!this.$refs._selectFile_) {
|
|
549
|
-
return
|
|
550
|
-
}
|
|
551
|
-
if (
|
|
552
|
-
this.$refs._selectFile_.value === '' ||
|
|
553
|
-
this.$refs._selectFile_.value === null
|
|
554
|
-
)
|
|
555
|
-
return
|
|
556
|
-
const fileObj = this.$refs._selectFile_.files[0]
|
|
557
|
-
if (fileObj) {
|
|
558
|
-
this.$refs._selectFile_.value = null
|
|
559
|
-
// console.log('doImport=', button)
|
|
560
|
-
that.doImportFinally(
|
|
561
|
-
that.system,
|
|
562
|
-
button.restfulApiPath,
|
|
563
|
-
that.tableName,
|
|
564
|
-
that.entityName,
|
|
565
|
-
that.myJsContent,
|
|
566
|
-
button,
|
|
567
|
-
that.listViewImportDuplicate,
|
|
568
|
-
fileObj,
|
|
569
|
-
that.judgeHeavyList,
|
|
570
|
-
that.formNoRuleCode,
|
|
571
|
-
that.importRuleCode,
|
|
572
|
-
that.listCode,
|
|
573
|
-
that.beanName,
|
|
574
|
-
that.pageCode,
|
|
575
|
-
that.importBeanName
|
|
576
|
-
)
|
|
577
|
-
} else {
|
|
578
|
-
this.$message({
|
|
579
|
-
showClose: true,
|
|
580
|
-
type: 'warning',
|
|
581
|
-
message: this.$t('superPageMessage.noFileSelected'),
|
|
582
|
-
})
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
},
|
|
586
|
-
clickListButton(button) {
|
|
587
|
-
const that = this
|
|
588
|
-
// console.log('---clickListButton---', button, this.selections)
|
|
589
|
-
if (that.isPreview) {
|
|
590
|
-
// 预览时按钮无需操作
|
|
591
|
-
return
|
|
592
|
-
}
|
|
593
|
-
if (button) {
|
|
594
|
-
const beforeClickResult = this.callBeforeClickButton(
|
|
595
|
-
this.listEvents,
|
|
596
|
-
this.listCode + '__' + button.code,
|
|
597
|
-
{
|
|
598
|
-
params: this.additionalParamMap,
|
|
599
|
-
additionalParamMap: this.additionalParamMap,
|
|
600
|
-
entity: this.selections,
|
|
601
|
-
listToolbarFormData: this.listToolbarFormData,
|
|
602
|
-
button: button,
|
|
603
|
-
formNoRuleCode: this.formNoRuleCode,
|
|
604
|
-
importRuleCode: this.importRuleCode,
|
|
605
|
-
}
|
|
606
|
-
)
|
|
607
|
-
if (!beforeClickResult) {
|
|
608
|
-
// 返回值为false,不继续执行按钮操作
|
|
609
|
-
return
|
|
610
|
-
}
|
|
611
|
-
if (isPromise(beforeClickResult)) {
|
|
612
|
-
beforeClickResult.then((result) => {
|
|
613
|
-
if (result) {
|
|
614
|
-
that.clickListButtonSuccess(button, that)
|
|
615
|
-
}
|
|
616
|
-
})
|
|
617
|
-
} else {
|
|
618
|
-
that.clickListButtonSuccess(button, that)
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
},
|
|
622
|
-
clickListButtonSuccess(button, that) {
|
|
623
|
-
let entities = []
|
|
624
|
-
if (that.selections && that.selections !== null) {
|
|
625
|
-
entities = [].concat(that.selections)
|
|
626
|
-
}
|
|
627
|
-
if (button.code && button.code === 'search') {
|
|
628
|
-
// 表示点击的查询按钮
|
|
629
|
-
this.clickSearchButton(button)
|
|
630
|
-
return
|
|
631
|
-
} else if (button.code && button.code === 'import') {
|
|
632
|
-
this.button = button
|
|
633
|
-
this.clickImport()
|
|
634
|
-
return
|
|
635
|
-
} else if (button.code && button.code === 'lineEditCreate') {
|
|
636
|
-
this.createRow(button)
|
|
637
|
-
return
|
|
638
|
-
}
|
|
639
|
-
// 不是行编辑的事件响应
|
|
640
|
-
let dataIds = []
|
|
641
|
-
dataIds = that.getSelectionIds()
|
|
642
|
-
that
|
|
643
|
-
.canExecuteWithMore(
|
|
644
|
-
button.executableData,
|
|
645
|
-
entities,
|
|
646
|
-
that.isSqlQuery,
|
|
647
|
-
this.tableName,
|
|
648
|
-
this.additionalParamMap
|
|
649
|
-
)
|
|
650
|
-
.then((result) => {
|
|
651
|
-
if (result.canExecute === true) {
|
|
652
|
-
// 表示可执行该操作
|
|
653
|
-
if (button.code !== 'lineEditDelete' && result.entities) {
|
|
654
|
-
entities = result.entities
|
|
655
|
-
}
|
|
656
|
-
let jsContent = false
|
|
657
|
-
if (button && typeof button.jsContent !== 'undefined') {
|
|
658
|
-
jsContent = button.jsContent
|
|
659
|
-
}
|
|
660
|
-
that.myJsContent = jsContent
|
|
661
|
-
that.buttonRestfulApiPath = button.restfulApiPath
|
|
662
|
-
if (button.autoSetValueData) {
|
|
663
|
-
that.autoSetValueData = button.autoSetValueData
|
|
664
|
-
}
|
|
665
|
-
if (button.dataConversionRule) {
|
|
666
|
-
that.dataConversionRule = button.dataConversionRule
|
|
667
|
-
}
|
|
668
|
-
const UUID = that.getUUID()
|
|
669
|
-
that.clickButton(
|
|
670
|
-
button,
|
|
671
|
-
that.system,
|
|
672
|
-
that.listCode,
|
|
673
|
-
dataIds,
|
|
674
|
-
that.tableName,
|
|
675
|
-
that.entityName,
|
|
676
|
-
jsContent,
|
|
677
|
-
entities,
|
|
678
|
-
that.deleteLogicSetting,
|
|
679
|
-
that.formNoRuleCode,
|
|
680
|
-
that.importRuleCode,
|
|
681
|
-
that.beanName,
|
|
682
|
-
that.isWorkflowEntity,
|
|
683
|
-
UUID
|
|
684
|
-
)
|
|
685
|
-
this.getExport(UUID)
|
|
686
|
-
}
|
|
687
|
-
})
|
|
688
|
-
},
|
|
689
|
-
/**
|
|
690
|
-
* 获取一个UUID
|
|
691
|
-
* 格式:8-4-4-4-12
|
|
692
|
-
* @returns UUID
|
|
693
|
-
*/
|
|
694
|
-
getUUID() {
|
|
695
|
-
return 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
696
|
-
const r = (Math.random() * 16) | 0
|
|
697
|
-
const v = c === 'x' ? r : (r & 0x3) | 0x8
|
|
698
|
-
return v.toString(16)
|
|
699
|
-
})
|
|
700
|
-
},
|
|
701
|
-
// 导出时,权限控制
|
|
702
|
-
getExport(UUID) {
|
|
703
|
-
const that = this
|
|
704
|
-
setTimeout(() => {
|
|
705
|
-
if (localStorage.getItem(UUID)) {
|
|
706
|
-
if (localStorage.getItem(UUID) === 'start') {
|
|
707
|
-
that.disabled = true
|
|
708
|
-
that['disabled'] = true
|
|
709
|
-
this.getExport(UUID)
|
|
710
|
-
} else {
|
|
711
|
-
that.disabled = false
|
|
712
|
-
localStorage.removeItem(UUID)
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
}, 500)
|
|
716
|
-
},
|
|
717
|
-
// 点击查询或取消查询按钮
|
|
718
|
-
clickSearchButton(button) {
|
|
719
|
-
const cancelSearchLabel = this.$t(
|
|
720
|
-
'superPageMessage.cancelSearchButtonLabel'
|
|
721
|
-
)
|
|
722
|
-
const searchLabel = this.$t('superPageMessage.searchButtonLabel')
|
|
723
|
-
|
|
724
|
-
const queryMode = this.$refs.grid.getQueryMode()
|
|
725
|
-
if (queryMode === 'popup') {
|
|
726
|
-
// 如果是弹窗方式,每次都是打开方式,每次都是查询按钮
|
|
727
|
-
// 点击查询时
|
|
728
|
-
this.$refs.grid.showSearchForm()
|
|
729
|
-
if (!this.searchIsPopup) {
|
|
730
|
-
button.label = searchLabel
|
|
731
|
-
}
|
|
732
|
-
} else {
|
|
733
|
-
// 如果是嵌入模式,再进行判断
|
|
734
|
-
if (!button.label || button.label === searchLabel) {
|
|
735
|
-
// 点击查询时
|
|
736
|
-
this.$refs.grid.showSearchForm()
|
|
737
|
-
if (!this.searchIsPopup) {
|
|
738
|
-
button.label = cancelSearchLabel
|
|
739
|
-
}
|
|
740
|
-
} else {
|
|
741
|
-
// 表示取消查询时
|
|
742
|
-
this.$refs.grid.cancelSearch()
|
|
743
|
-
button.label = searchLabel
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
},
|
|
747
|
-
// 弹窗方式关闭查询
|
|
748
|
-
closeSearch(flag) {
|
|
749
|
-
this.searchIsPopup = flag
|
|
750
|
-
},
|
|
751
|
-
// 行编辑新建按钮
|
|
752
|
-
createRow(button) {
|
|
753
|
-
this.$refs.grid.createRow(this.listCode).then((row) => {
|
|
754
|
-
// 调用afterClick回调方法
|
|
755
|
-
this.callAfterClickButton(
|
|
756
|
-
this.listEvents,
|
|
757
|
-
this.listCode + '__' + button.code,
|
|
758
|
-
{
|
|
759
|
-
params: this.additionalParamMap,
|
|
760
|
-
additionalParamMap: this.additionalParamMap,
|
|
761
|
-
row,
|
|
762
|
-
listToolbarFormData: this.listToolbarFormData,
|
|
763
|
-
}
|
|
764
|
-
)
|
|
765
|
-
})
|
|
766
|
-
},
|
|
767
|
-
// 重写行编辑时保存的实现
|
|
768
|
-
saveLineEditRow(
|
|
769
|
-
row,
|
|
770
|
-
columns,
|
|
771
|
-
dataTypeMap,
|
|
772
|
-
dynamicColumnInfo,
|
|
773
|
-
additionalParamMap,
|
|
774
|
-
mainDefaultValueColumns
|
|
775
|
-
) {
|
|
776
|
-
const button = this.operationButtonObj.lineEditSave
|
|
777
|
-
const that = this
|
|
778
|
-
return new Promise((resolve, reject) => {
|
|
779
|
-
that.myJsContent = ''
|
|
780
|
-
let jsContent = false
|
|
781
|
-
if (button && typeof button.jsContent !== 'undefined') {
|
|
782
|
-
jsContent = button.jsContent
|
|
783
|
-
}
|
|
784
|
-
that.myJsContent = jsContent
|
|
785
|
-
// formViewCode,formViewVersion 都设为空,是因为行编辑时保存时,后台会获得最高版本的表单的配置进行保存
|
|
786
|
-
this.getSaveFormRequest(
|
|
787
|
-
that.system,
|
|
788
|
-
that.buttonRestfulApiPath,
|
|
789
|
-
'',
|
|
790
|
-
'',
|
|
791
|
-
that.tableName,
|
|
792
|
-
row,
|
|
793
|
-
that.entityName,
|
|
794
|
-
that.myJsContent,
|
|
795
|
-
that.formNoRuleCode,
|
|
796
|
-
that.dataConversionRule,
|
|
797
|
-
that.autoSetValueData,
|
|
798
|
-
'/dsc/commons',
|
|
799
|
-
that.operationButtonObj && that.operationButtonObj.lineEditSave
|
|
800
|
-
? that.operationButtonObj.lineEditSave.logSetting
|
|
801
|
-
: null,
|
|
802
|
-
dynamicColumnInfo,
|
|
803
|
-
mainDefaultValueColumns,
|
|
804
|
-
button.taskMap,
|
|
805
|
-
null,
|
|
806
|
-
additionalParamMap,
|
|
807
|
-
that.beanName,
|
|
808
|
-
that.isWorkflowEntity,
|
|
809
|
-
button.functionCode
|
|
810
|
-
)
|
|
811
|
-
.then((commonEntity) => {
|
|
812
|
-
if (commonEntity) {
|
|
813
|
-
resolve(commonEntity.entity)
|
|
814
|
-
} else {
|
|
815
|
-
resolve({})
|
|
816
|
-
}
|
|
817
|
-
})
|
|
818
|
-
.catch((error) => {
|
|
819
|
-
reject(error)
|
|
820
|
-
})
|
|
821
|
-
})
|
|
822
|
-
},
|
|
823
|
-
getUrlToListData(system) {
|
|
824
|
-
let urlToListData = this.colSetting.options.urlToListData
|
|
825
|
-
if (system && system.standard === false && !urlToListData) {
|
|
826
|
-
// 表示自定义系统,并且没有配置路径
|
|
827
|
-
urlToListData = this.baseURL + '/dsc/commons/list'
|
|
828
|
-
}
|
|
829
|
-
if (urlToListData) {
|
|
830
|
-
urlToListData = this.getRealRestApiPath(urlToListData, system)
|
|
831
|
-
}
|
|
832
|
-
return urlToListData
|
|
833
|
-
},
|
|
834
|
-
select(selection, row) {
|
|
835
|
-
this.selections = selection
|
|
836
|
-
},
|
|
837
|
-
// 获得列表组件需要的操作列按钮配置信息
|
|
838
|
-
setOperationButtons() {
|
|
839
|
-
this.operationButtonObj = {}
|
|
840
|
-
if (this.operationButtons) {
|
|
841
|
-
// 是否受权限控制
|
|
842
|
-
let noPermission = false
|
|
843
|
-
const isDevMode = getStoreInfo(this.pageCode, '_pageDevMode')
|
|
844
|
-
const isPreview = getStoreInfo(this.pageCode, '_pagePreview')
|
|
845
|
-
if (
|
|
846
|
-
(isDevMode && isDevMode === true) ||
|
|
847
|
-
(isPreview && isPreview === true)
|
|
848
|
-
) {
|
|
849
|
-
// 开发模式 或 预览时,权限不受控制
|
|
850
|
-
noPermission = true
|
|
851
|
-
}
|
|
852
|
-
const operationButtons = []
|
|
853
|
-
const operationButtonGroupMap = {}
|
|
854
|
-
this.operationButtons.forEach((button) => {
|
|
855
|
-
const myButtonSet = {}
|
|
856
|
-
const myButtonProps = Object.assign({}, button)
|
|
857
|
-
//
|
|
858
|
-
//
|
|
859
|
-
|
|
860
|
-
myButtonProps.
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
myButtonSet.
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
group
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
groupObj.
|
|
889
|
-
groupObj.
|
|
890
|
-
groupObj
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
this.
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
this.
|
|
963
|
-
this.
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
this.
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
this.
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
this.
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
)
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
this.
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
this.
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
)
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
this.
|
|
1088
|
-
this.
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
this.
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1132
|
-
this.
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
)
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
this.
|
|
1188
|
-
this.
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
this.
|
|
1201
|
-
this.
|
|
1202
|
-
this.
|
|
1203
|
-
this.
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
this.
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
this.
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1235
|
-
this.
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
)
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
//
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
fieldParam.
|
|
1306
|
-
fieldParam.
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
fieldParam.
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
fieldParam.
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
fieldParam.
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
controlTypes[key + '~~
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
)
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
)
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
)
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
//
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
)
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
fieldParam.
|
|
1372
|
-
fieldParam.
|
|
1373
|
-
fieldParam.
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
fieldParam.
|
|
1378
|
-
fieldParam.
|
|
1379
|
-
fieldParam.
|
|
1380
|
-
fieldParam
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
fieldParam.
|
|
1392
|
-
fieldParam.
|
|
1393
|
-
fieldParam.
|
|
1394
|
-
fieldParam.
|
|
1395
|
-
fieldParam.
|
|
1396
|
-
fieldParam.
|
|
1397
|
-
fieldParam.
|
|
1398
|
-
fieldParam.
|
|
1399
|
-
fieldParam.
|
|
1400
|
-
fieldParam.
|
|
1401
|
-
fieldParam
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
pageHeight ===
|
|
1408
|
-
pageHeight ===
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
this.
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
this.
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="showPage">
|
|
3
|
+
<button-group
|
|
4
|
+
v-if="colSetting.options.buttonGroup"
|
|
5
|
+
:button-groups="colSetting.options.buttonGroup"
|
|
6
|
+
:permission-prefix="permissionPrefix"
|
|
7
|
+
:additional-param-map="additionalParamMap"
|
|
8
|
+
:list-toolbar-list="listToolbarList"
|
|
9
|
+
:button-area-custom-component-arr="
|
|
10
|
+
colSetting.options.buttonAreaCustomComponentArr
|
|
11
|
+
"
|
|
12
|
+
position="list"
|
|
13
|
+
:search-form-info="searchFormInfo"
|
|
14
|
+
:toolbar-right-show="colSetting.options.toolbarRightShow"
|
|
15
|
+
:page-code="pageCode"
|
|
16
|
+
:selections="selections"
|
|
17
|
+
:disabled="disabled"
|
|
18
|
+
@refresh="refreshList"
|
|
19
|
+
@searchGridData="searchGridData"
|
|
20
|
+
@click="clickListButton"
|
|
21
|
+
@getSystemRef="getSystemRef"
|
|
22
|
+
/>
|
|
23
|
+
<!-- 工具栏组件 -->
|
|
24
|
+
<div v-else>
|
|
25
|
+
<list-toolbar-page
|
|
26
|
+
:list-toolbar-list="listToolbarList"
|
|
27
|
+
:page-code="pageCode"
|
|
28
|
+
@searchGridData="searchGridData"
|
|
29
|
+
/>
|
|
30
|
+
<page-custom-component
|
|
31
|
+
:button-area-custom-component-arr="
|
|
32
|
+
colSetting.options.buttonAreaCustomComponentArr
|
|
33
|
+
"
|
|
34
|
+
:page-code="pageCode"
|
|
35
|
+
@getSystemRef="getSystemRef"
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
<input
|
|
39
|
+
ref="_selectFile_"
|
|
40
|
+
type="file"
|
|
41
|
+
name="_selectFile_"
|
|
42
|
+
style="display: none"
|
|
43
|
+
@change="doImport(button)"
|
|
44
|
+
/>
|
|
45
|
+
<super-grid
|
|
46
|
+
ref="grid"
|
|
47
|
+
:url="urlToListData"
|
|
48
|
+
:options="options"
|
|
49
|
+
:code="listCode"
|
|
50
|
+
:search-form-info="searchFormInfo"
|
|
51
|
+
:list-toolbar-form-data="listToolbarFormData"
|
|
52
|
+
@select="select"
|
|
53
|
+
@select-all="select"
|
|
54
|
+
@setSearchType="closeSearch"
|
|
55
|
+
@refresh="clickRefresh"
|
|
56
|
+
/>
|
|
57
|
+
<super-page-dialog
|
|
58
|
+
v-if="isShowPageDialog"
|
|
59
|
+
:preview="isPreview"
|
|
60
|
+
:dev-mode="pageDevMode"
|
|
61
|
+
:jump-page-setting="jumpPageSetting"
|
|
62
|
+
@update-value="updateValues"
|
|
63
|
+
@close="closeInPage"
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script>
|
|
69
|
+
import Util from './util/util'
|
|
70
|
+
import * as Vue from 'vue'
|
|
71
|
+
import ButtonGroup from './button-group'
|
|
72
|
+
import eventBus from './util/eventBus'
|
|
73
|
+
import buttonEvents from './util/ListButtonEvent'
|
|
74
|
+
import callEvents from './util/callEvents'
|
|
75
|
+
import apis from './util/api'
|
|
76
|
+
import store from './util/store'
|
|
77
|
+
import listToolbarPage from './list-toolbar-page'
|
|
78
|
+
import pageCustomComponent from './page-custom-component'
|
|
79
|
+
import { getStoreInfo, setStoreInfo } from './util/common-util'
|
|
80
|
+
import {
|
|
81
|
+
getSystemBackendUrl,
|
|
82
|
+
isPromise,
|
|
83
|
+
} from 'imatrix-ui/src/utils/common-util'
|
|
84
|
+
export default {
|
|
85
|
+
name: 'ListPage',
|
|
86
|
+
components: {
|
|
87
|
+
ButtonGroup,
|
|
88
|
+
listToolbarPage,
|
|
89
|
+
pageCustomComponent,
|
|
90
|
+
},
|
|
91
|
+
props: {
|
|
92
|
+
colSetting: {
|
|
93
|
+
type: Object,
|
|
94
|
+
default: null,
|
|
95
|
+
},
|
|
96
|
+
// 页面编码
|
|
97
|
+
pageCode: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: null,
|
|
100
|
+
},
|
|
101
|
+
// 页签编码
|
|
102
|
+
tabCode: {
|
|
103
|
+
type: String,
|
|
104
|
+
default: null,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
data() {
|
|
108
|
+
let baseURL = window.$vueApp.config.globalProperties.baseURL
|
|
109
|
+
const tableName = this.colSetting.baseSetting.modelDataTableCode
|
|
110
|
+
let isWorkflowEntity = getStoreInfo(this.pageCode, tableName + '_isProcess')
|
|
111
|
+
if (isWorkflowEntity === null && isWorkflowEntity === undefined) {
|
|
112
|
+
isWorkflowEntity = false
|
|
113
|
+
}
|
|
114
|
+
const system = getStoreInfo(this.pageCode, '_systemInfo')
|
|
115
|
+
const isSqlQuery = getStoreInfo(this.pageCode, '_pageIsDsc')
|
|
116
|
+
console.log(
|
|
117
|
+
'list-page--_pageIsDsc--isSqlQuery=',
|
|
118
|
+
isSqlQuery,
|
|
119
|
+
'this.pageCode=',
|
|
120
|
+
this.pageCode
|
|
121
|
+
)
|
|
122
|
+
const pageCode = getStoreInfo(this.pageCode, '_pageCode')
|
|
123
|
+
const urlToListData = this.getUrlToListData(system)
|
|
124
|
+
// 实体类名,首字母小写
|
|
125
|
+
const entityName = this.colSetting.baseSetting.modelDataTableEntityName
|
|
126
|
+
const beanName = this.colSetting.baseSetting.beanName
|
|
127
|
+
const importBeanName = this.colSetting.baseSetting.importBeanName
|
|
128
|
+
let permissionPrefix
|
|
129
|
+
if (system) {
|
|
130
|
+
baseURL = getSystemBackendUrl(system.backendUrl)
|
|
131
|
+
permissionPrefix =
|
|
132
|
+
system.code +
|
|
133
|
+
'.' +
|
|
134
|
+
pageCode +
|
|
135
|
+
'.' +
|
|
136
|
+
this.colSetting.baseSetting.componentCode
|
|
137
|
+
}
|
|
138
|
+
let initSearchForm = this.colSetting.options.listFilterCondition
|
|
139
|
+
if (typeof initSearchForm === 'undefined') {
|
|
140
|
+
initSearchForm = []
|
|
141
|
+
}
|
|
142
|
+
const pathQuery = getStoreInfo(this.pageCode, '_pathQuery')
|
|
143
|
+
const pageHeight = getStoreInfo(this.pageCode, '_pageHeight')
|
|
144
|
+
const options = {
|
|
145
|
+
isSql: isSqlQuery,
|
|
146
|
+
extraParam: {
|
|
147
|
+
entityName: entityName,
|
|
148
|
+
beanName: beanName,
|
|
149
|
+
functionCode: permissionPrefix + '.list',
|
|
150
|
+
tableName,
|
|
151
|
+
},
|
|
152
|
+
initSearchForm,
|
|
153
|
+
lineEditOptions: {
|
|
154
|
+
aftersaveIsCreateRow: false,
|
|
155
|
+
autoSave: false,
|
|
156
|
+
enter: this.enterSave,
|
|
157
|
+
esc: this.escRestorRow,
|
|
158
|
+
},
|
|
159
|
+
multiple: this.colSetting.options.isListViewMultiple, // 是否多选,默认以列表管理中配置的为准
|
|
160
|
+
showIndex: this.colSetting.options.isListViewShowSerialNumber, // 是否显示序号,默认以列表管理中配置的为准
|
|
161
|
+
indexContinuous: this.colSetting.options.serialNumberContinuous,
|
|
162
|
+
pageSizes: this.colSetting.options.listViewPageNum, // 可选行数
|
|
163
|
+
initSearch: this.colSetting.options.isListViewDefaultQuery, // 初始化时是否查询,默认是查询
|
|
164
|
+
resizeHeight: this.resizeListHeight,
|
|
165
|
+
pageCode: this.pageCode,
|
|
166
|
+
pageHeight: pageHeight, // 页面的高度
|
|
167
|
+
additionalParamMap: pathQuery, // 将路由参数传给列表组件
|
|
168
|
+
showOverflowTooltip: !!(
|
|
169
|
+
this.colSetting.options.isBreakLine === undefined ||
|
|
170
|
+
this.colSetting.options.isBreakLine === false
|
|
171
|
+
), // 单元格内容是否换行显示
|
|
172
|
+
isEnableEnterEvent: this.colSetting.options.isEnableEnterEvent, // 是否启用回车事件
|
|
173
|
+
}
|
|
174
|
+
if (system) {
|
|
175
|
+
// 系统编码传给列表数据后台请求
|
|
176
|
+
options.extraParam.systemCode = system.code
|
|
177
|
+
// 当前系统,表示是当前的自定义系统信息
|
|
178
|
+
options.system = system
|
|
179
|
+
}
|
|
180
|
+
if (this.colSetting.options.sortFields) {
|
|
181
|
+
options.initSortInfo = []
|
|
182
|
+
this.colSetting.options.sortFields.forEach((item) => {
|
|
183
|
+
const sortInfo = {
|
|
184
|
+
order: item.sortOrder,
|
|
185
|
+
}
|
|
186
|
+
if (isSqlQuery) {
|
|
187
|
+
sortInfo.prop = item.propDbName
|
|
188
|
+
} else {
|
|
189
|
+
sortInfo.prop = item.sortColumn
|
|
190
|
+
}
|
|
191
|
+
options.initSortInfo.push(sortInfo)
|
|
192
|
+
})
|
|
193
|
+
} else {
|
|
194
|
+
if (
|
|
195
|
+
this.colSetting.options.listViewOrderProp &&
|
|
196
|
+
this.colSetting.options.listViewOrderMode
|
|
197
|
+
) {
|
|
198
|
+
// 默认排序字段,和排序方式
|
|
199
|
+
options.initSortInfo = {
|
|
200
|
+
order: this.colSetting.options.listViewOrderMode,
|
|
201
|
+
}
|
|
202
|
+
if (isSqlQuery) {
|
|
203
|
+
options.initSortInfo.prop =
|
|
204
|
+
this.colSetting.options.listViewOrderPropDbName
|
|
205
|
+
} else {
|
|
206
|
+
options.initSortInfo.prop = this.colSetting.options.listViewOrderProp
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (this.colSetting.options.isWithDataPermission) {
|
|
211
|
+
options.isWithDataPermission =
|
|
212
|
+
this.colSetting.options.isWithDataPermission
|
|
213
|
+
}
|
|
214
|
+
const listViewTreeTableSetting =
|
|
215
|
+
this.colSetting.options.listViewTreeTableSetting
|
|
216
|
+
if (listViewTreeTableSetting) {
|
|
217
|
+
// 父级字段配置
|
|
218
|
+
// 格式为:name~~dbCloumnName,name表示实体字段名,dbCloumnName表示数据库字段名
|
|
219
|
+
const parentPropInfo = listViewTreeTableSetting.parentProp
|
|
220
|
+
let parentProp
|
|
221
|
+
let parentPropDbName
|
|
222
|
+
if (parentPropInfo && parentPropInfo.indexOf('~~') > 0) {
|
|
223
|
+
parentProp = parentPropInfo.substring(0, parentPropInfo.indexOf('~~'))
|
|
224
|
+
parentPropDbName = parentPropInfo.substring(
|
|
225
|
+
parentPropInfo.indexOf('~~') + 2
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
if (isSqlQuery) {
|
|
229
|
+
// 数据库字段名
|
|
230
|
+
options.parentProp = parentPropDbName
|
|
231
|
+
} else {
|
|
232
|
+
// 实体字段名
|
|
233
|
+
options.parentProp = parentProp
|
|
234
|
+
}
|
|
235
|
+
if (options.parentProp) {
|
|
236
|
+
// 表示配置了父级字段名,则表示是树状结构数据
|
|
237
|
+
// 树表格配置传给后台
|
|
238
|
+
options.extraParam.listViewTreeSetting = JSON.stringify(
|
|
239
|
+
listViewTreeTableSetting
|
|
240
|
+
)
|
|
241
|
+
const lazy = listViewTreeTableSetting.lazy
|
|
242
|
+
if (lazy === undefined || lazy === null) {
|
|
243
|
+
options.lazy = true
|
|
244
|
+
} else {
|
|
245
|
+
options.lazy = lazy
|
|
246
|
+
}
|
|
247
|
+
const defaultExpandAll = listViewTreeTableSetting.defaultExpandAll
|
|
248
|
+
if (defaultExpandAll === undefined || defaultExpandAll === null) {
|
|
249
|
+
options.defaultExpandAll = false
|
|
250
|
+
} else {
|
|
251
|
+
options.defaultExpandAll = defaultExpandAll
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (isSqlQuery) {
|
|
255
|
+
options.subRowUrl = baseURL + '/dsc/commons/list-subs'
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const isPreview = getStoreInfo(this.pageCode, '_pagePreview')
|
|
260
|
+
if (isPreview !== undefined && isPreview === true) {
|
|
261
|
+
// 预览时,不请求数据,只查看列表结构
|
|
262
|
+
options.loadBeforeSend = function () {
|
|
263
|
+
return false
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
let pageDevMode = getStoreInfo(this.pageCode, '_pageDevMode')
|
|
267
|
+
if (pageDevMode === null || pageDevMode === undefined) {
|
|
268
|
+
pageDevMode = false
|
|
269
|
+
}
|
|
270
|
+
options.pageDevMode = pageDevMode
|
|
271
|
+
let formNoRuleCode = ''
|
|
272
|
+
if (this.colSetting.options && this.colSetting.options.formNoRuleCode) {
|
|
273
|
+
formNoRuleCode = this.colSetting.options.formNoRuleCode
|
|
274
|
+
}
|
|
275
|
+
let listToolbarList
|
|
276
|
+
if (this.colSetting.options && this.colSetting.options.listToolbarList) {
|
|
277
|
+
listToolbarList = this.colSetting.options.listToolbarList
|
|
278
|
+
}
|
|
279
|
+
const listCode = this.colSetting.baseSetting.modelCode
|
|
280
|
+
let importRuleCode = ''
|
|
281
|
+
if (this.colSetting.options && this.colSetting.options.importRuleCode) {
|
|
282
|
+
importRuleCode = this.colSetting.options.importRuleCode
|
|
283
|
+
} else {
|
|
284
|
+
// 如果没有配置导入编码的时候,可以默认给导入编码赋上列表编码
|
|
285
|
+
// importRuleCode = listCode
|
|
286
|
+
}
|
|
287
|
+
options.isWorkflowEntity = isWorkflowEntity
|
|
288
|
+
// 表单事件集合
|
|
289
|
+
let listEvents
|
|
290
|
+
const pageEvents = getStoreInfo(this.pageCode, '_pageEvents')
|
|
291
|
+
if (pageEvents) {
|
|
292
|
+
listEvents = pageEvents.listEvents
|
|
293
|
+
if (listEvents && listEvents[listCode + '__beforeListLoad']) {
|
|
294
|
+
options.loadBeforeSend = listEvents[listCode + '__beforeListLoad']
|
|
295
|
+
}
|
|
296
|
+
if (listEvents && listEvents[listCode + '__onListLoad']) {
|
|
297
|
+
options.gridDataLoaded = listEvents[listCode + '__onListLoad']
|
|
298
|
+
}
|
|
299
|
+
if (listEvents && listEvents[listCode + '__afterListLoad']) {
|
|
300
|
+
options.gridComplete = listEvents[listCode + '__afterListLoad']
|
|
301
|
+
}
|
|
302
|
+
// 重新计算列表高度事件
|
|
303
|
+
if (listEvents && listEvents[listCode + '__resizeTableHeight']) {
|
|
304
|
+
options.resizeHeight = listEvents[listCode + '__resizeTableHeight']
|
|
305
|
+
}
|
|
306
|
+
if (listEvents && listEvents[listCode + '__beforeEdit']) {
|
|
307
|
+
if (options.lineEditOptions === undefined) {
|
|
308
|
+
options.lineEditOptions = {}
|
|
309
|
+
}
|
|
310
|
+
options.lineEditOptions.beforeEdit =
|
|
311
|
+
listEvents[listCode + '__beforeEdit']
|
|
312
|
+
}
|
|
313
|
+
if (listEvents && listEvents[listCode + '__beforeRestoreValidate']) {
|
|
314
|
+
if (options.lineEditOptions === undefined) {
|
|
315
|
+
options.lineEditOptions = {}
|
|
316
|
+
}
|
|
317
|
+
options.lineEditOptions.beforeRestoreValidate =
|
|
318
|
+
listEvents[listCode + '__beforeRestoreValidate']
|
|
319
|
+
}
|
|
320
|
+
if (listEvents && listEvents[listCode + '__beforeRestore']) {
|
|
321
|
+
if (options.lineEditOptions === undefined) {
|
|
322
|
+
options.lineEditOptions = {}
|
|
323
|
+
}
|
|
324
|
+
options.lineEditOptions.beforeRestore =
|
|
325
|
+
listEvents[listCode + '__beforeRestore']
|
|
326
|
+
}
|
|
327
|
+
const customEvents = pageEvents.customEvents
|
|
328
|
+
if (customEvents) {
|
|
329
|
+
// 将页面中配置的自定义事件集合传给列表组件super-grid,供列表行编辑控件使用
|
|
330
|
+
options.eventCallBack = customEvents
|
|
331
|
+
if (
|
|
332
|
+
this.colSetting.options.styleCustomMethod &&
|
|
333
|
+
this.colSetting.options.styleCustomMethod !== ''
|
|
334
|
+
) {
|
|
335
|
+
if (
|
|
336
|
+
customEvents &&
|
|
337
|
+
customEvents[this.colSetting.options.styleCustomMethod]
|
|
338
|
+
) {
|
|
339
|
+
options.rowStyleRender =
|
|
340
|
+
customEvents[this.colSetting.options.styleCustomMethod]
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// console.log('options--', options)
|
|
346
|
+
return {
|
|
347
|
+
listToolbarList,
|
|
348
|
+
urlToListData,
|
|
349
|
+
// 列表组件配置属性
|
|
350
|
+
options,
|
|
351
|
+
operationButtons: this.colSetting.options.operationButtons,
|
|
352
|
+
selections: null,
|
|
353
|
+
listCode,
|
|
354
|
+
permissionPrefix, // 按钮组中按钮的资源编码前缀,例如:系统编码.实体类名
|
|
355
|
+
system,
|
|
356
|
+
tableName: this.colSetting.baseSetting.modelDataTableCode,
|
|
357
|
+
entityName: entityName, // 实体类名(包括包路径)
|
|
358
|
+
beanName,
|
|
359
|
+
importBeanName,
|
|
360
|
+
myJsContent: null, // 按钮的js内容
|
|
361
|
+
isSqlQuery,
|
|
362
|
+
judgeHeavyList: this.colSetting.options.judgeHeavyList, // 判重组合字段配置
|
|
363
|
+
listViewImportDuplicate: this.colSetting.options.listViewImportDuplicate, // 导入重复规则
|
|
364
|
+
buttonRestfulApiPath: null, // 按钮的后台路径
|
|
365
|
+
deleteLogicSetting: this.colSetting.options.deleteLogicSetting, // 删除逻辑控制配置,子表有记录时是否允许删除,默认是true允许
|
|
366
|
+
baseURL,
|
|
367
|
+
autoSetValueData: null, // 按钮的“自动设值”配置
|
|
368
|
+
dataConversionRule: null, // 数据转换规则编码
|
|
369
|
+
formNoRuleCode, // 表单编号规则
|
|
370
|
+
importRuleCode, // 导入编码
|
|
371
|
+
isPreview, // 是否是预览
|
|
372
|
+
button: null, // 点击的当前按钮
|
|
373
|
+
logSettingText: null,
|
|
374
|
+
additionalParamMap: null, // 跳转页面的附加参数
|
|
375
|
+
dataTypeMap: null, // 数据类型map集合,key为字段名,value为字段类型,优化保存速度
|
|
376
|
+
showPage: false, // 是否显示页面内容
|
|
377
|
+
operationButtonObj: {}, // 操作列按钮对象,key为按钮编码,value为按钮对象
|
|
378
|
+
listEvents,
|
|
379
|
+
pageDevMode,
|
|
380
|
+
isShowPageDialog: false, // 是否显示弹框页面
|
|
381
|
+
jumpPageSetting: null, // 弹框页面的设置信息
|
|
382
|
+
editRowData: null, // 行编辑时当前编辑的行记录
|
|
383
|
+
searchIsPopup: false, // 是否是弹窗查询
|
|
384
|
+
customEvents: pageEvents ? pageEvents.customEvents : null,
|
|
385
|
+
listToolbarFormData: null, // 列表工具栏的值对象
|
|
386
|
+
isWorkflowEntity,
|
|
387
|
+
searchFormInfo: { data: {} },
|
|
388
|
+
disabled: false,
|
|
389
|
+
pageType: 'list', // 页面类型
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
watch: {
|
|
393
|
+
jumpPageSetting: {
|
|
394
|
+
deep: true,
|
|
395
|
+
handler(jumpPageSetting) {
|
|
396
|
+
if (jumpPageSetting && jumpPageSetting !== null) {
|
|
397
|
+
const that = this
|
|
398
|
+
eventBus.$on(
|
|
399
|
+
jumpPageSetting.pageCode + '-close-dialog',
|
|
400
|
+
(pageCode, successOperation, popEntity, popPageCode) => {
|
|
401
|
+
if (pageCode === jumpPageSetting.pageCode) {
|
|
402
|
+
that.closeInPageEvent(
|
|
403
|
+
popEntity,
|
|
404
|
+
popPageCode,
|
|
405
|
+
successOperation,
|
|
406
|
+
that
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
that.$set(that, 'selections', null)
|
|
410
|
+
// that.selections = null
|
|
411
|
+
// 关闭事件
|
|
412
|
+
eventBus.$off(pageCode + '-close-dialog')
|
|
413
|
+
}
|
|
414
|
+
)
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
created() {
|
|
420
|
+
window.addEventListener('message', this.recieveMessage)
|
|
421
|
+
this.getDataTypeMap().then(() => {
|
|
422
|
+
const tableName = this.colSetting.baseSetting.modelDataTableCode
|
|
423
|
+
const isWfEntity = getStoreInfo(this.pageCode, tableName + '_isProcess')
|
|
424
|
+
if (isWfEntity === null && isWfEntity === undefined) {
|
|
425
|
+
this.isWorkflowEntity = false
|
|
426
|
+
} else {
|
|
427
|
+
this.isWorkflowEntity = isWfEntity
|
|
428
|
+
}
|
|
429
|
+
// 设置列表操作列按钮
|
|
430
|
+
this.setOperationButtons()
|
|
431
|
+
})
|
|
432
|
+
const additionalParamMap = getStoreInfo(this.pageCode, 'additionalParamMap')
|
|
433
|
+
if (additionalParamMap) {
|
|
434
|
+
if (!this.options.additionalParamMap) {
|
|
435
|
+
this.options['additionalParamMap'] = {}
|
|
436
|
+
}
|
|
437
|
+
Object.assign(this.options.additionalParamMap, additionalParamMap)
|
|
438
|
+
}
|
|
439
|
+
if (this.options.additionalParamMap) {
|
|
440
|
+
this.additionalParamMap = this.options.additionalParamMap
|
|
441
|
+
}
|
|
442
|
+
const that = this
|
|
443
|
+
eventBus.$on(
|
|
444
|
+
that.pageCode + '-close-component-page-dialog',
|
|
445
|
+
(jumpInfo, popEntity, popPageCode) => {
|
|
446
|
+
console.log(
|
|
447
|
+
'close-component-page-dialog-list------',
|
|
448
|
+
jumpInfo,
|
|
449
|
+
popEntity,
|
|
450
|
+
popPageCode
|
|
451
|
+
)
|
|
452
|
+
if (that.$refs.grid) {
|
|
453
|
+
that.$refs.grid.closePageDialog({
|
|
454
|
+
entity: popEntity,
|
|
455
|
+
pageCode: popPageCode,
|
|
456
|
+
})
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
)
|
|
460
|
+
// 刷新指定页签的表格数据
|
|
461
|
+
eventBus.$on(that.pageCode + '-refresh-tab', (tabCode) => {
|
|
462
|
+
if (
|
|
463
|
+
that.$refs.grid &&
|
|
464
|
+
tabCode !== undefined &&
|
|
465
|
+
tabCode === that.tabCode
|
|
466
|
+
) {
|
|
467
|
+
that.$refs.grid.refresh()
|
|
468
|
+
}
|
|
469
|
+
})
|
|
470
|
+
// 关闭弹框事件回调使用
|
|
471
|
+
eventBus.$on(this.pageCode + '_close-dialog-get-entity', () => {
|
|
472
|
+
$emit(eventBus, that.pageCode + '_close-super-dialog')
|
|
473
|
+
})
|
|
474
|
+
},
|
|
475
|
+
beforeUnmount() {
|
|
476
|
+
eventBus.$off(this.pageCode + '-close-component-page-dialog')
|
|
477
|
+
eventBus.$off(this.pageCode + '-refresh-tab')
|
|
478
|
+
eventBus.$off(this.pageCode + '_close-dialog-get-entity')
|
|
479
|
+
},
|
|
480
|
+
methods: {
|
|
481
|
+
...Util,
|
|
482
|
+
...buttonEvents,
|
|
483
|
+
...callEvents,
|
|
484
|
+
...apis,
|
|
485
|
+
// 列表组件内容刷新后的回调事件
|
|
486
|
+
clickRefresh() {
|
|
487
|
+
this.selections = []
|
|
488
|
+
},
|
|
489
|
+
getSystemRef(refKey, operation) {
|
|
490
|
+
if (!refKey) {
|
|
491
|
+
// 列表的ref属性的值
|
|
492
|
+
refKey = 'grid'
|
|
493
|
+
}
|
|
494
|
+
if (!operation) {
|
|
495
|
+
operation = 'refresh'
|
|
496
|
+
}
|
|
497
|
+
if (this.$refs[refKey]) {
|
|
498
|
+
const domRef = this.$refs[refKey]
|
|
499
|
+
if (domRef) {
|
|
500
|
+
if (operation === 'refresh') {
|
|
501
|
+
domRef.refresh()
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return 123
|
|
506
|
+
},
|
|
507
|
+
getDataTypeMap() {
|
|
508
|
+
return new Promise((resolve, reject) => {
|
|
509
|
+
if (this.isPreview) {
|
|
510
|
+
// 预览时不需要获得字段类型
|
|
511
|
+
this.showPage = true
|
|
512
|
+
resolve()
|
|
513
|
+
} else {
|
|
514
|
+
this.getDataTypeMapRequest(this.system, this.tableName)
|
|
515
|
+
.then((dataTypeMap) => {
|
|
516
|
+
this.dataTypeMap = dataTypeMap.dataTypeMap
|
|
517
|
+
setStoreInfo(
|
|
518
|
+
this.pageCode,
|
|
519
|
+
this.tableName + '_isProcess',
|
|
520
|
+
dataTypeMap.isProcess
|
|
521
|
+
)
|
|
522
|
+
console.log(store)
|
|
523
|
+
this.showPage = true
|
|
524
|
+
resolve()
|
|
525
|
+
})
|
|
526
|
+
.catch(() => {
|
|
527
|
+
reject(
|
|
528
|
+
new Error(
|
|
529
|
+
'获得数据表:' + this.tableName + '的字段类型集合失败'
|
|
530
|
+
)
|
|
531
|
+
)
|
|
532
|
+
})
|
|
533
|
+
}
|
|
534
|
+
})
|
|
535
|
+
},
|
|
536
|
+
// 点击导入按钮选择文件
|
|
537
|
+
clickImport() {
|
|
538
|
+
if (!this.isPreview) {
|
|
539
|
+
// 预览时,导入按钮不生效才行
|
|
540
|
+
this.$refs._selectFile_.click()
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
// 选择文件后执行导入
|
|
544
|
+
doImport() {
|
|
545
|
+
const button = this.button
|
|
546
|
+
if (button) {
|
|
547
|
+
const that = this
|
|
548
|
+
if (!this.$refs._selectFile_) {
|
|
549
|
+
return
|
|
550
|
+
}
|
|
551
|
+
if (
|
|
552
|
+
this.$refs._selectFile_.value === '' ||
|
|
553
|
+
this.$refs._selectFile_.value === null
|
|
554
|
+
)
|
|
555
|
+
return
|
|
556
|
+
const fileObj = this.$refs._selectFile_.files[0]
|
|
557
|
+
if (fileObj) {
|
|
558
|
+
this.$refs._selectFile_.value = null
|
|
559
|
+
// console.log('doImport=', button)
|
|
560
|
+
that.doImportFinally(
|
|
561
|
+
that.system,
|
|
562
|
+
button.restfulApiPath,
|
|
563
|
+
that.tableName,
|
|
564
|
+
that.entityName,
|
|
565
|
+
that.myJsContent,
|
|
566
|
+
button,
|
|
567
|
+
that.listViewImportDuplicate,
|
|
568
|
+
fileObj,
|
|
569
|
+
that.judgeHeavyList,
|
|
570
|
+
that.formNoRuleCode,
|
|
571
|
+
that.importRuleCode,
|
|
572
|
+
that.listCode,
|
|
573
|
+
that.beanName,
|
|
574
|
+
that.pageCode,
|
|
575
|
+
that.importBeanName
|
|
576
|
+
)
|
|
577
|
+
} else {
|
|
578
|
+
this.$message({
|
|
579
|
+
showClose: true,
|
|
580
|
+
type: 'warning',
|
|
581
|
+
message: this.$t('superPageMessage.noFileSelected'),
|
|
582
|
+
})
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
clickListButton(button) {
|
|
587
|
+
const that = this
|
|
588
|
+
// console.log('---clickListButton---', button, this.selections)
|
|
589
|
+
if (that.isPreview) {
|
|
590
|
+
// 预览时按钮无需操作
|
|
591
|
+
return
|
|
592
|
+
}
|
|
593
|
+
if (button) {
|
|
594
|
+
const beforeClickResult = this.callBeforeClickButton(
|
|
595
|
+
this.listEvents,
|
|
596
|
+
this.listCode + '__' + button.code,
|
|
597
|
+
{
|
|
598
|
+
params: this.additionalParamMap,
|
|
599
|
+
additionalParamMap: this.additionalParamMap,
|
|
600
|
+
entity: this.selections,
|
|
601
|
+
listToolbarFormData: this.listToolbarFormData,
|
|
602
|
+
button: button,
|
|
603
|
+
formNoRuleCode: this.formNoRuleCode,
|
|
604
|
+
importRuleCode: this.importRuleCode,
|
|
605
|
+
}
|
|
606
|
+
)
|
|
607
|
+
if (!beforeClickResult) {
|
|
608
|
+
// 返回值为false,不继续执行按钮操作
|
|
609
|
+
return
|
|
610
|
+
}
|
|
611
|
+
if (isPromise(beforeClickResult)) {
|
|
612
|
+
beforeClickResult.then((result) => {
|
|
613
|
+
if (result) {
|
|
614
|
+
that.clickListButtonSuccess(button, that)
|
|
615
|
+
}
|
|
616
|
+
})
|
|
617
|
+
} else {
|
|
618
|
+
that.clickListButtonSuccess(button, that)
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
clickListButtonSuccess(button, that) {
|
|
623
|
+
let entities = []
|
|
624
|
+
if (that.selections && that.selections !== null) {
|
|
625
|
+
entities = [].concat(that.selections)
|
|
626
|
+
}
|
|
627
|
+
if (button.code && button.code === 'search') {
|
|
628
|
+
// 表示点击的查询按钮
|
|
629
|
+
this.clickSearchButton(button)
|
|
630
|
+
return
|
|
631
|
+
} else if (button.code && button.code === 'import') {
|
|
632
|
+
this.button = button
|
|
633
|
+
this.clickImport()
|
|
634
|
+
return
|
|
635
|
+
} else if (button.code && button.code === 'lineEditCreate') {
|
|
636
|
+
this.createRow(button)
|
|
637
|
+
return
|
|
638
|
+
}
|
|
639
|
+
// 不是行编辑的事件响应
|
|
640
|
+
let dataIds = []
|
|
641
|
+
dataIds = that.getSelectionIds()
|
|
642
|
+
that
|
|
643
|
+
.canExecuteWithMore(
|
|
644
|
+
button.executableData,
|
|
645
|
+
entities,
|
|
646
|
+
that.isSqlQuery,
|
|
647
|
+
this.tableName,
|
|
648
|
+
this.additionalParamMap
|
|
649
|
+
)
|
|
650
|
+
.then((result) => {
|
|
651
|
+
if (result.canExecute === true) {
|
|
652
|
+
// 表示可执行该操作
|
|
653
|
+
if (button.code !== 'lineEditDelete' && result.entities) {
|
|
654
|
+
entities = result.entities
|
|
655
|
+
}
|
|
656
|
+
let jsContent = false
|
|
657
|
+
if (button && typeof button.jsContent !== 'undefined') {
|
|
658
|
+
jsContent = button.jsContent
|
|
659
|
+
}
|
|
660
|
+
that.myJsContent = jsContent
|
|
661
|
+
that.buttonRestfulApiPath = button.restfulApiPath
|
|
662
|
+
if (button.autoSetValueData) {
|
|
663
|
+
that.autoSetValueData = button.autoSetValueData
|
|
664
|
+
}
|
|
665
|
+
if (button.dataConversionRule) {
|
|
666
|
+
that.dataConversionRule = button.dataConversionRule
|
|
667
|
+
}
|
|
668
|
+
const UUID = that.getUUID()
|
|
669
|
+
that.clickButton(
|
|
670
|
+
button,
|
|
671
|
+
that.system,
|
|
672
|
+
that.listCode,
|
|
673
|
+
dataIds,
|
|
674
|
+
that.tableName,
|
|
675
|
+
that.entityName,
|
|
676
|
+
jsContent,
|
|
677
|
+
entities,
|
|
678
|
+
that.deleteLogicSetting,
|
|
679
|
+
that.formNoRuleCode,
|
|
680
|
+
that.importRuleCode,
|
|
681
|
+
that.beanName,
|
|
682
|
+
that.isWorkflowEntity,
|
|
683
|
+
UUID
|
|
684
|
+
)
|
|
685
|
+
this.getExport(UUID)
|
|
686
|
+
}
|
|
687
|
+
})
|
|
688
|
+
},
|
|
689
|
+
/**
|
|
690
|
+
* 获取一个UUID
|
|
691
|
+
* 格式:8-4-4-4-12
|
|
692
|
+
* @returns UUID
|
|
693
|
+
*/
|
|
694
|
+
getUUID() {
|
|
695
|
+
return 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
696
|
+
const r = (Math.random() * 16) | 0
|
|
697
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8
|
|
698
|
+
return v.toString(16)
|
|
699
|
+
})
|
|
700
|
+
},
|
|
701
|
+
// 导出时,权限控制
|
|
702
|
+
getExport(UUID) {
|
|
703
|
+
const that = this
|
|
704
|
+
setTimeout(() => {
|
|
705
|
+
if (localStorage.getItem(UUID)) {
|
|
706
|
+
if (localStorage.getItem(UUID) === 'start') {
|
|
707
|
+
that.disabled = true
|
|
708
|
+
that['disabled'] = true
|
|
709
|
+
this.getExport(UUID)
|
|
710
|
+
} else {
|
|
711
|
+
that.disabled = false
|
|
712
|
+
localStorage.removeItem(UUID)
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}, 500)
|
|
716
|
+
},
|
|
717
|
+
// 点击查询或取消查询按钮
|
|
718
|
+
clickSearchButton(button) {
|
|
719
|
+
const cancelSearchLabel = this.$t(
|
|
720
|
+
'superPageMessage.cancelSearchButtonLabel'
|
|
721
|
+
)
|
|
722
|
+
const searchLabel = this.$t('superPageMessage.searchButtonLabel')
|
|
723
|
+
|
|
724
|
+
const queryMode = this.$refs.grid.getQueryMode()
|
|
725
|
+
if (queryMode === 'popup') {
|
|
726
|
+
// 如果是弹窗方式,每次都是打开方式,每次都是查询按钮
|
|
727
|
+
// 点击查询时
|
|
728
|
+
this.$refs.grid.showSearchForm()
|
|
729
|
+
if (!this.searchIsPopup) {
|
|
730
|
+
button.label = searchLabel
|
|
731
|
+
}
|
|
732
|
+
} else {
|
|
733
|
+
// 如果是嵌入模式,再进行判断
|
|
734
|
+
if (!button.label || button.label === searchLabel) {
|
|
735
|
+
// 点击查询时
|
|
736
|
+
this.$refs.grid.showSearchForm()
|
|
737
|
+
if (!this.searchIsPopup) {
|
|
738
|
+
button.label = cancelSearchLabel
|
|
739
|
+
}
|
|
740
|
+
} else {
|
|
741
|
+
// 表示取消查询时
|
|
742
|
+
this.$refs.grid.cancelSearch()
|
|
743
|
+
button.label = searchLabel
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
},
|
|
747
|
+
// 弹窗方式关闭查询
|
|
748
|
+
closeSearch(flag) {
|
|
749
|
+
this.searchIsPopup = flag
|
|
750
|
+
},
|
|
751
|
+
// 行编辑新建按钮
|
|
752
|
+
createRow(button) {
|
|
753
|
+
this.$refs.grid.createRow(this.listCode).then((row) => {
|
|
754
|
+
// 调用afterClick回调方法
|
|
755
|
+
this.callAfterClickButton(
|
|
756
|
+
this.listEvents,
|
|
757
|
+
this.listCode + '__' + button.code,
|
|
758
|
+
{
|
|
759
|
+
params: this.additionalParamMap,
|
|
760
|
+
additionalParamMap: this.additionalParamMap,
|
|
761
|
+
row,
|
|
762
|
+
listToolbarFormData: this.listToolbarFormData,
|
|
763
|
+
}
|
|
764
|
+
)
|
|
765
|
+
})
|
|
766
|
+
},
|
|
767
|
+
// 重写行编辑时保存的实现
|
|
768
|
+
saveLineEditRow(
|
|
769
|
+
row,
|
|
770
|
+
columns,
|
|
771
|
+
dataTypeMap,
|
|
772
|
+
dynamicColumnInfo,
|
|
773
|
+
additionalParamMap,
|
|
774
|
+
mainDefaultValueColumns
|
|
775
|
+
) {
|
|
776
|
+
const button = this.operationButtonObj.lineEditSave
|
|
777
|
+
const that = this
|
|
778
|
+
return new Promise((resolve, reject) => {
|
|
779
|
+
that.myJsContent = ''
|
|
780
|
+
let jsContent = false
|
|
781
|
+
if (button && typeof button.jsContent !== 'undefined') {
|
|
782
|
+
jsContent = button.jsContent
|
|
783
|
+
}
|
|
784
|
+
that.myJsContent = jsContent
|
|
785
|
+
// formViewCode,formViewVersion 都设为空,是因为行编辑时保存时,后台会获得最高版本的表单的配置进行保存
|
|
786
|
+
this.getSaveFormRequest(
|
|
787
|
+
that.system,
|
|
788
|
+
that.buttonRestfulApiPath,
|
|
789
|
+
'',
|
|
790
|
+
'',
|
|
791
|
+
that.tableName,
|
|
792
|
+
row,
|
|
793
|
+
that.entityName,
|
|
794
|
+
that.myJsContent,
|
|
795
|
+
that.formNoRuleCode,
|
|
796
|
+
that.dataConversionRule,
|
|
797
|
+
that.autoSetValueData,
|
|
798
|
+
'/dsc/commons',
|
|
799
|
+
that.operationButtonObj && that.operationButtonObj.lineEditSave
|
|
800
|
+
? that.operationButtonObj.lineEditSave.logSetting
|
|
801
|
+
: null,
|
|
802
|
+
dynamicColumnInfo,
|
|
803
|
+
mainDefaultValueColumns,
|
|
804
|
+
button.taskMap,
|
|
805
|
+
null,
|
|
806
|
+
additionalParamMap,
|
|
807
|
+
that.beanName,
|
|
808
|
+
that.isWorkflowEntity,
|
|
809
|
+
button.functionCode
|
|
810
|
+
)
|
|
811
|
+
.then((commonEntity) => {
|
|
812
|
+
if (commonEntity) {
|
|
813
|
+
resolve(commonEntity.entity)
|
|
814
|
+
} else {
|
|
815
|
+
resolve({})
|
|
816
|
+
}
|
|
817
|
+
})
|
|
818
|
+
.catch((error) => {
|
|
819
|
+
reject(error)
|
|
820
|
+
})
|
|
821
|
+
})
|
|
822
|
+
},
|
|
823
|
+
getUrlToListData(system) {
|
|
824
|
+
let urlToListData = this.colSetting.options.urlToListData
|
|
825
|
+
if (system && system.standard === false && !urlToListData) {
|
|
826
|
+
// 表示自定义系统,并且没有配置路径
|
|
827
|
+
urlToListData = this.baseURL + '/dsc/commons/list'
|
|
828
|
+
}
|
|
829
|
+
if (urlToListData) {
|
|
830
|
+
urlToListData = this.getRealRestApiPath(urlToListData, system)
|
|
831
|
+
}
|
|
832
|
+
return urlToListData
|
|
833
|
+
},
|
|
834
|
+
select(selection, row) {
|
|
835
|
+
this.selections = selection
|
|
836
|
+
},
|
|
837
|
+
// 获得列表组件需要的操作列按钮配置信息
|
|
838
|
+
setOperationButtons() {
|
|
839
|
+
this.operationButtonObj = {}
|
|
840
|
+
if (this.operationButtons) {
|
|
841
|
+
// 是否受权限控制
|
|
842
|
+
let noPermission = false
|
|
843
|
+
const isDevMode = getStoreInfo(this.pageCode, '_pageDevMode')
|
|
844
|
+
const isPreview = getStoreInfo(this.pageCode, '_pagePreview')
|
|
845
|
+
if (
|
|
846
|
+
(isDevMode && isDevMode === true) ||
|
|
847
|
+
(isPreview && isPreview === true)
|
|
848
|
+
) {
|
|
849
|
+
// 开发模式 或 预览时,权限不受控制
|
|
850
|
+
noPermission = true
|
|
851
|
+
}
|
|
852
|
+
const operationButtons = []
|
|
853
|
+
const operationButtonGroupMap = {}
|
|
854
|
+
this.operationButtons.forEach((button) => {
|
|
855
|
+
const myButtonSet = {}
|
|
856
|
+
const myButtonProps = Object.assign({}, button)
|
|
857
|
+
// element plus不支持该属性了
|
|
858
|
+
// myButtonProps.type = 'text'
|
|
859
|
+
myButtonProps.elementType = 'el-button'
|
|
860
|
+
if(myButtonProps.size==='mini') {
|
|
861
|
+
myButtonProps.size = 'small'
|
|
862
|
+
}
|
|
863
|
+
myButtonProps.elementType = 'el-button'
|
|
864
|
+
if (!noPermission) {
|
|
865
|
+
// 表示受权限控制
|
|
866
|
+
myButtonProps.permission = this.permissionPrefix + '.' + button.code
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
myButtonSet.props = myButtonProps
|
|
870
|
+
myButtonSet.onClick = this.getOperationButtonClickEvent(button)
|
|
871
|
+
if (!button.groupName || button.groupName === '') {
|
|
872
|
+
operationButtons.push(myButtonSet)
|
|
873
|
+
} else {
|
|
874
|
+
const groupName = button.groupName
|
|
875
|
+
if (operationButtonGroupMap[groupName]) {
|
|
876
|
+
const group = operationButtonGroupMap[groupName]
|
|
877
|
+
group.push(myButtonSet)
|
|
878
|
+
} else {
|
|
879
|
+
const group = []
|
|
880
|
+
group.push(myButtonSet)
|
|
881
|
+
operationButtonGroupMap[groupName] = group
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
})
|
|
885
|
+
for (let key in operationButtonGroupMap) {
|
|
886
|
+
const groupObj = {}
|
|
887
|
+
groupObj.label = key
|
|
888
|
+
groupObj.isGroup = true
|
|
889
|
+
groupObj.buttons = operationButtonGroupMap[key]
|
|
890
|
+
operationButtons.push(groupObj)
|
|
891
|
+
}
|
|
892
|
+
if (!this.options.operations) {
|
|
893
|
+
this.options.operations = {}
|
|
894
|
+
}
|
|
895
|
+
this.options.operations.operation = operationButtons
|
|
896
|
+
}
|
|
897
|
+
},
|
|
898
|
+
// 获得操作列按钮点击事件
|
|
899
|
+
getOperationButtonClickEvent(button) {
|
|
900
|
+
let onClick = function () {}
|
|
901
|
+
this.operationButtonObj[button.code] = button
|
|
902
|
+
if (button.code === 'lineEditSave') {
|
|
903
|
+
// 行编辑保存
|
|
904
|
+
onClick = this.saveRow
|
|
905
|
+
} else if (button.code === 'restoreEdit') {
|
|
906
|
+
onClick = this.restoreRow
|
|
907
|
+
} else if (button.code === 'lineEditUpdate') {
|
|
908
|
+
// 行编辑修改按钮
|
|
909
|
+
onClick = this.editRow
|
|
910
|
+
} else if (button.code === 'lineEditDelete') {
|
|
911
|
+
// 行编辑删除按钮
|
|
912
|
+
onClick = this.deleteRow
|
|
913
|
+
} else if (button.code === 'viewDetail') {
|
|
914
|
+
onClick = this.viewDetailLineEdit
|
|
915
|
+
} else {
|
|
916
|
+
onClick = this.customButtonClick
|
|
917
|
+
// TODO 自定义行编辑按钮事件处理
|
|
918
|
+
}
|
|
919
|
+
return onClick
|
|
920
|
+
},
|
|
921
|
+
// 回车保存事件
|
|
922
|
+
enterSave(rowIndex, column, row, orgRow) {
|
|
923
|
+
this.saveRow(null, null, row, column, rowIndex)
|
|
924
|
+
},
|
|
925
|
+
// esc取消行编辑
|
|
926
|
+
escRestorRow(rowIndex, column, row, orgRow) {
|
|
927
|
+
this.restoreRow(null, null, row, column, rowIndex)
|
|
928
|
+
},
|
|
929
|
+
beforeSaveRow(
|
|
930
|
+
row,
|
|
931
|
+
columns,
|
|
932
|
+
dataTypeMap,
|
|
933
|
+
dynamicColumnInfo,
|
|
934
|
+
additionalParamMap,
|
|
935
|
+
mainDefaultValueColumns
|
|
936
|
+
) {
|
|
937
|
+
const button = this.operationButtonObj.lineEditSave
|
|
938
|
+
return this.callBeforeClickButton(
|
|
939
|
+
this.listEvents,
|
|
940
|
+
this.listCode + '__' + button.code,
|
|
941
|
+
{
|
|
942
|
+
params: additionalParamMap,
|
|
943
|
+
additionalParamMap: additionalParamMap,
|
|
944
|
+
row,
|
|
945
|
+
columns,
|
|
946
|
+
dataTypeMap,
|
|
947
|
+
dynamicColumnInfo,
|
|
948
|
+
mainDefaultValueColumns,
|
|
949
|
+
}
|
|
950
|
+
)
|
|
951
|
+
},
|
|
952
|
+
// 行编辑保存
|
|
953
|
+
saveRow(originalValue, formatValue, row, column, rowIndex) {
|
|
954
|
+
const button = this.operationButtonObj.lineEditSave
|
|
955
|
+
this.options.lineEditOptions['beforeSave'] = this.beforeSaveRow
|
|
956
|
+
const entities = []
|
|
957
|
+
entities.push(row)
|
|
958
|
+
this.canExecuteWithMore(
|
|
959
|
+
button.executableData,
|
|
960
|
+
entities,
|
|
961
|
+
this.isSqlQuery,
|
|
962
|
+
this.tableName,
|
|
963
|
+
this.additionalParamMap
|
|
964
|
+
).then((result) => {
|
|
965
|
+
if (result.canExecute === true) {
|
|
966
|
+
// 设置保存的自定义实现
|
|
967
|
+
if (button.autoSetValueData) {
|
|
968
|
+
this.autoSetValueData = button.autoSetValueData
|
|
969
|
+
}
|
|
970
|
+
this.options.lineEditOptions['saveRow'] = this.saveLineEditRow
|
|
971
|
+
this.$refs.grid.saveRow(rowIndex, this.listCode).then(() => {
|
|
972
|
+
// 调用afterClick回调方法
|
|
973
|
+
this.callAfterClickButton(
|
|
974
|
+
this.listEvents,
|
|
975
|
+
this.listCode + '__' + button.code,
|
|
976
|
+
{
|
|
977
|
+
params: this.additionalParamMap,
|
|
978
|
+
additionalParamMap: this.additionalParamMap,
|
|
979
|
+
originalValue,
|
|
980
|
+
formatValue,
|
|
981
|
+
row,
|
|
982
|
+
column,
|
|
983
|
+
rowIndex,
|
|
984
|
+
}
|
|
985
|
+
)
|
|
986
|
+
})
|
|
987
|
+
}
|
|
988
|
+
})
|
|
989
|
+
},
|
|
990
|
+
// 行编辑取消编辑
|
|
991
|
+
restoreRow(originalValue, formatValue, row, column, rowIndex) {
|
|
992
|
+
const beforeClickResult = this.callBeforeClickButton(
|
|
993
|
+
this.listEvents,
|
|
994
|
+
this.listCode + '__restoreEdit',
|
|
995
|
+
{
|
|
996
|
+
params: this.additionalParamMap,
|
|
997
|
+
additionalParamMap: this.additionalParamMap,
|
|
998
|
+
originalValue,
|
|
999
|
+
formatValue,
|
|
1000
|
+
row,
|
|
1001
|
+
column,
|
|
1002
|
+
rowIndex,
|
|
1003
|
+
}
|
|
1004
|
+
)
|
|
1005
|
+
if (!beforeClickResult) {
|
|
1006
|
+
// 返回值为false,不继续执行按钮操作
|
|
1007
|
+
return
|
|
1008
|
+
}
|
|
1009
|
+
if (isPromise(beforeClickResult)) {
|
|
1010
|
+
// 表示是promise函数
|
|
1011
|
+
beforeClickResult.then((result) => {
|
|
1012
|
+
if (result) {
|
|
1013
|
+
this.$refs.grid.restoreRow(rowIndex, this.listCode)
|
|
1014
|
+
}
|
|
1015
|
+
})
|
|
1016
|
+
} else {
|
|
1017
|
+
this.$refs.grid.restoreRow(rowIndex, this.listCode)
|
|
1018
|
+
}
|
|
1019
|
+
// 调用afterClick回调方法
|
|
1020
|
+
this.callAfterClickButton(
|
|
1021
|
+
this.listEvents,
|
|
1022
|
+
this.listCode + '__restoreEdit',
|
|
1023
|
+
{
|
|
1024
|
+
params: this.additionalParamMap,
|
|
1025
|
+
additionalParamMap: this.additionalParamMap,
|
|
1026
|
+
originalValue,
|
|
1027
|
+
formatValue,
|
|
1028
|
+
row,
|
|
1029
|
+
column,
|
|
1030
|
+
rowIndex,
|
|
1031
|
+
}
|
|
1032
|
+
)
|
|
1033
|
+
},
|
|
1034
|
+
// 行编辑的修改
|
|
1035
|
+
editRow(originalValue, formatValue, row, column, rowIndex) {
|
|
1036
|
+
const button = this.operationButtonObj.lineEditUpdate
|
|
1037
|
+
const beforeClickResult = this.callBeforeClickButton(
|
|
1038
|
+
this.listEvents,
|
|
1039
|
+
this.listCode + '__' + button.code,
|
|
1040
|
+
{
|
|
1041
|
+
params: this.additionalParamMap,
|
|
1042
|
+
additionalParamMap: this.additionalParamMap,
|
|
1043
|
+
originalValue,
|
|
1044
|
+
formatValue,
|
|
1045
|
+
row,
|
|
1046
|
+
column,
|
|
1047
|
+
rowIndex,
|
|
1048
|
+
}
|
|
1049
|
+
)
|
|
1050
|
+
if (!beforeClickResult) {
|
|
1051
|
+
// 返回值为false,不继续执行按钮操作
|
|
1052
|
+
return
|
|
1053
|
+
}
|
|
1054
|
+
if (isPromise(beforeClickResult)) {
|
|
1055
|
+
// 表示是promise函数
|
|
1056
|
+
beforeClickResult.then((result) => {
|
|
1057
|
+
if (result) {
|
|
1058
|
+
this.editRowReal(
|
|
1059
|
+
originalValue,
|
|
1060
|
+
formatValue,
|
|
1061
|
+
row,
|
|
1062
|
+
column,
|
|
1063
|
+
rowIndex,
|
|
1064
|
+
button
|
|
1065
|
+
)
|
|
1066
|
+
}
|
|
1067
|
+
})
|
|
1068
|
+
} else {
|
|
1069
|
+
this.editRowReal(
|
|
1070
|
+
originalValue,
|
|
1071
|
+
formatValue,
|
|
1072
|
+
row,
|
|
1073
|
+
column,
|
|
1074
|
+
rowIndex,
|
|
1075
|
+
button
|
|
1076
|
+
)
|
|
1077
|
+
}
|
|
1078
|
+
},
|
|
1079
|
+
editRowReal(originalValue, formatValue, row, column, rowIndex, button) {
|
|
1080
|
+
this.editRowData = row
|
|
1081
|
+
const entities = []
|
|
1082
|
+
entities.push(row)
|
|
1083
|
+
this.canExecuteWithMore(
|
|
1084
|
+
button.executableData,
|
|
1085
|
+
entities,
|
|
1086
|
+
this.isSqlQuery,
|
|
1087
|
+
this.tableName,
|
|
1088
|
+
this.additionalParamMap
|
|
1089
|
+
).then((result) => {
|
|
1090
|
+
if (result.canExecute === true) {
|
|
1091
|
+
if (button.jumpPage) {
|
|
1092
|
+
let dataId
|
|
1093
|
+
if (row && row.id) {
|
|
1094
|
+
dataId = row.id
|
|
1095
|
+
} else if (row && row.ID) {
|
|
1096
|
+
dataId = row.ID
|
|
1097
|
+
}
|
|
1098
|
+
if (!dataId) {
|
|
1099
|
+
this.$message({
|
|
1100
|
+
showClose: true,
|
|
1101
|
+
type: 'warning',
|
|
1102
|
+
message: this.$t('superPageMessage.pleaseSaveRow'),
|
|
1103
|
+
})
|
|
1104
|
+
return
|
|
1105
|
+
}
|
|
1106
|
+
this.update(button.jumpPage, this.system, dataId, button)
|
|
1107
|
+
} else {
|
|
1108
|
+
this.$refs.grid.editRow(rowIndex, this.listCode)
|
|
1109
|
+
// 调用afterClick回调方法
|
|
1110
|
+
this.callAfterClickButton(
|
|
1111
|
+
this.listEvents,
|
|
1112
|
+
this.listCode + '__' + button.code,
|
|
1113
|
+
{
|
|
1114
|
+
params: this.additionalParamMap,
|
|
1115
|
+
additionalParamMap: this.additionalParamMap,
|
|
1116
|
+
originalValue,
|
|
1117
|
+
formatValue,
|
|
1118
|
+
row,
|
|
1119
|
+
column,
|
|
1120
|
+
rowIndex,
|
|
1121
|
+
}
|
|
1122
|
+
)
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
})
|
|
1126
|
+
},
|
|
1127
|
+
// 行编辑的删除
|
|
1128
|
+
deleteRow(originalValue, formatValue, row, column, rowIndex) {
|
|
1129
|
+
const button = this.operationButtonObj.lineEditDelete
|
|
1130
|
+
const beforeClickResult = this.callBeforeClickButton(
|
|
1131
|
+
this.listEvents,
|
|
1132
|
+
this.listCode + '__' + button.code,
|
|
1133
|
+
{
|
|
1134
|
+
params: this.additionalParamMap,
|
|
1135
|
+
additionalParamMap: this.additionalParamMap,
|
|
1136
|
+
originalValue,
|
|
1137
|
+
formatValue,
|
|
1138
|
+
row,
|
|
1139
|
+
column,
|
|
1140
|
+
rowIndex,
|
|
1141
|
+
}
|
|
1142
|
+
)
|
|
1143
|
+
if (!beforeClickResult) {
|
|
1144
|
+
// 返回值为false,不继续执行按钮操作
|
|
1145
|
+
return
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
if (isPromise(beforeClickResult)) {
|
|
1149
|
+
// 表示是promise函数
|
|
1150
|
+
beforeClickResult.then((result) => {
|
|
1151
|
+
if (result) {
|
|
1152
|
+
this.deleteRowReal(
|
|
1153
|
+
originalValue,
|
|
1154
|
+
formatValue,
|
|
1155
|
+
row,
|
|
1156
|
+
column,
|
|
1157
|
+
rowIndex,
|
|
1158
|
+
button
|
|
1159
|
+
)
|
|
1160
|
+
}
|
|
1161
|
+
})
|
|
1162
|
+
} else {
|
|
1163
|
+
this.deleteRowReal(
|
|
1164
|
+
originalValue,
|
|
1165
|
+
formatValue,
|
|
1166
|
+
row,
|
|
1167
|
+
column,
|
|
1168
|
+
rowIndex,
|
|
1169
|
+
button
|
|
1170
|
+
)
|
|
1171
|
+
}
|
|
1172
|
+
},
|
|
1173
|
+
deleteRowReal(originalValue, formatValue, row, column, rowIndex, button) {
|
|
1174
|
+
if (row.id || row.ID) {
|
|
1175
|
+
this.buttonRestfulApiPath = button.restfulApiPath
|
|
1176
|
+
let jsContent = false
|
|
1177
|
+
if (button && typeof button.jsContent !== 'undefined') {
|
|
1178
|
+
jsContent = button.jsContent
|
|
1179
|
+
}
|
|
1180
|
+
this.myJsContent = jsContent
|
|
1181
|
+
const entities = []
|
|
1182
|
+
entities.push(row)
|
|
1183
|
+
this.canExecuteWithMore(
|
|
1184
|
+
button.executableData,
|
|
1185
|
+
entities,
|
|
1186
|
+
this.isSqlQuery,
|
|
1187
|
+
this.tableName,
|
|
1188
|
+
this.additionalParamMap
|
|
1189
|
+
).then((result) => {
|
|
1190
|
+
if (result.canExecute === true) {
|
|
1191
|
+
const ids = []
|
|
1192
|
+
if (row.id) {
|
|
1193
|
+
ids.push(row.id)
|
|
1194
|
+
} else {
|
|
1195
|
+
ids.push(row.ID)
|
|
1196
|
+
}
|
|
1197
|
+
this.delete(
|
|
1198
|
+
ids,
|
|
1199
|
+
this.system,
|
|
1200
|
+
this.buttonRestfulApiPath,
|
|
1201
|
+
this.tableName,
|
|
1202
|
+
this.entityName,
|
|
1203
|
+
this.myJsContent,
|
|
1204
|
+
button,
|
|
1205
|
+
this.deleteLogicSetting,
|
|
1206
|
+
null,
|
|
1207
|
+
this.beanName,
|
|
1208
|
+
this.isWorkflowEntity
|
|
1209
|
+
)
|
|
1210
|
+
}
|
|
1211
|
+
})
|
|
1212
|
+
} else {
|
|
1213
|
+
this.restoreRow(originalValue, formatValue, row, column, rowIndex)
|
|
1214
|
+
// 调用afterClick回调方法
|
|
1215
|
+
this.callAfterClickButton(
|
|
1216
|
+
this.listEvents,
|
|
1217
|
+
this.listCode + '__' + button.code,
|
|
1218
|
+
{
|
|
1219
|
+
params: this.additionalParamMap,
|
|
1220
|
+
additionalParamMap: this.additionalParamMap,
|
|
1221
|
+
originalValue,
|
|
1222
|
+
formatValue,
|
|
1223
|
+
row,
|
|
1224
|
+
column,
|
|
1225
|
+
rowIndex,
|
|
1226
|
+
}
|
|
1227
|
+
)
|
|
1228
|
+
}
|
|
1229
|
+
},
|
|
1230
|
+
// 行编辑查看详情
|
|
1231
|
+
viewDetailLineEdit(originalValue, formatValue, row, column, rowIndex) {
|
|
1232
|
+
const button = this.operationButtonObj.viewDetail
|
|
1233
|
+
const beforeClickResult = this.callBeforeClickButton(
|
|
1234
|
+
this.listEvents,
|
|
1235
|
+
this.listCode + '__' + button.code,
|
|
1236
|
+
{
|
|
1237
|
+
params: this.additionalParamMap,
|
|
1238
|
+
additionalParamMap: this.additionalParamMap,
|
|
1239
|
+
originalValue,
|
|
1240
|
+
formatValue,
|
|
1241
|
+
row,
|
|
1242
|
+
column,
|
|
1243
|
+
rowIndex,
|
|
1244
|
+
}
|
|
1245
|
+
)
|
|
1246
|
+
if (!beforeClickResult) {
|
|
1247
|
+
// 返回值为false,不继续执行按钮操作
|
|
1248
|
+
return
|
|
1249
|
+
}
|
|
1250
|
+
if (isPromise(beforeClickResult)) {
|
|
1251
|
+
// 表示是promise函数
|
|
1252
|
+
beforeClickResult.then((result) => {
|
|
1253
|
+
if (result) {
|
|
1254
|
+
this.viewDetail(
|
|
1255
|
+
button.jumpPage,
|
|
1256
|
+
this.system,
|
|
1257
|
+
row.id ? row.id : row.ID ? row.ID : null,
|
|
1258
|
+
button,
|
|
1259
|
+
row
|
|
1260
|
+
)
|
|
1261
|
+
}
|
|
1262
|
+
})
|
|
1263
|
+
} else {
|
|
1264
|
+
this.viewDetail(
|
|
1265
|
+
button.jumpPage,
|
|
1266
|
+
this.system,
|
|
1267
|
+
row.id ? row.id : row.ID ? row.ID : null,
|
|
1268
|
+
button,
|
|
1269
|
+
row
|
|
1270
|
+
)
|
|
1271
|
+
}
|
|
1272
|
+
},
|
|
1273
|
+
// 获得选中记录id集合
|
|
1274
|
+
getSelectionIds() {
|
|
1275
|
+
const dataIds = []
|
|
1276
|
+
if (this.selections && this.selections !== null) {
|
|
1277
|
+
this.selections.forEach((item) => {
|
|
1278
|
+
dataIds.push(item.id ? item.id : item.ID ? item.ID : null)
|
|
1279
|
+
})
|
|
1280
|
+
}
|
|
1281
|
+
return dataIds
|
|
1282
|
+
},
|
|
1283
|
+
// 接受工具栏参数,刷新列表
|
|
1284
|
+
searchGridData(data, controlTypes, dataTypeObj, currentControlType) {
|
|
1285
|
+
this.listToolbarFormData = data
|
|
1286
|
+
let toolbarFieldParam = []
|
|
1287
|
+
if (data) {
|
|
1288
|
+
for (var key in data) {
|
|
1289
|
+
const value = data[key]
|
|
1290
|
+
if (value !== null && value !== undefined && value !== '') {
|
|
1291
|
+
// 需要解析data为FieldParam,
|
|
1292
|
+
// 如果是多选,需要用or拼接,其他不为空不为“”的值,用and连接
|
|
1293
|
+
if (value instanceof Array) {
|
|
1294
|
+
// 需要解析为两个
|
|
1295
|
+
if (value.length > 0) {
|
|
1296
|
+
const multipleFieldParam = []
|
|
1297
|
+
for (var i = 0; i < value.length; i++) {
|
|
1298
|
+
const fieldParam = {}
|
|
1299
|
+
if (i === 0) {
|
|
1300
|
+
fieldParam.leftBracket = '(('
|
|
1301
|
+
} else {
|
|
1302
|
+
fieldParam.leftBracket = '('
|
|
1303
|
+
}
|
|
1304
|
+
fieldParam.propName = key
|
|
1305
|
+
fieldParam.propDbName = key
|
|
1306
|
+
fieldParam.dataType = dataTypeObj[key]
|
|
1307
|
+
? dataTypeObj[key]
|
|
1308
|
+
: 'TEXT'
|
|
1309
|
+
fieldParam.operator = 'EQ'
|
|
1310
|
+
fieldParam.propValue = value[i]
|
|
1311
|
+
if (i === value.length - 1) {
|
|
1312
|
+
fieldParam.rightBracket = '))'
|
|
1313
|
+
fieldParam.joinSign = 'and'
|
|
1314
|
+
} else {
|
|
1315
|
+
fieldParam.rightBracket = ')'
|
|
1316
|
+
fieldParam.joinSign = 'or'
|
|
1317
|
+
}
|
|
1318
|
+
multipleFieldParam.push(fieldParam)
|
|
1319
|
+
}
|
|
1320
|
+
toolbarFieldParam = toolbarFieldParam.concat(multipleFieldParam)
|
|
1321
|
+
}
|
|
1322
|
+
} else {
|
|
1323
|
+
// 解析为单个-判断是普通值还是时间选择
|
|
1324
|
+
if (
|
|
1325
|
+
currentControlType &&
|
|
1326
|
+
controlTypes[key + '~~year'] &&
|
|
1327
|
+
controlTypes[key + '~~month']
|
|
1328
|
+
) {
|
|
1329
|
+
// 表示使用一个字段同时配置了年份、月份,判断当前点击的是年份还是月份
|
|
1330
|
+
if (currentControlType === 'year') {
|
|
1331
|
+
// 表示当前点击的是年份,以年份的值为准
|
|
1332
|
+
const fieldParam = this.getFieldParamByYearOrMonth(
|
|
1333
|
+
key,
|
|
1334
|
+
value,
|
|
1335
|
+
dataTypeObj[key],
|
|
1336
|
+
'YEAR'
|
|
1337
|
+
)
|
|
1338
|
+
toolbarFieldParam.push(fieldParam)
|
|
1339
|
+
} else if (currentControlType === 'month') {
|
|
1340
|
+
// 表示当前点击的是月份,以月份的值为准
|
|
1341
|
+
const fieldParam = this.getFieldParamByYearOrMonth(
|
|
1342
|
+
key,
|
|
1343
|
+
value,
|
|
1344
|
+
dataTypeObj[key],
|
|
1345
|
+
'MONTH'
|
|
1346
|
+
)
|
|
1347
|
+
toolbarFieldParam.push(fieldParam)
|
|
1348
|
+
}
|
|
1349
|
+
} else if (controlTypes[key + '~~year'] === 'year') {
|
|
1350
|
+
// 表示是年份控件
|
|
1351
|
+
const fieldParam = this.getFieldParamByYearOrMonth(
|
|
1352
|
+
key,
|
|
1353
|
+
value,
|
|
1354
|
+
dataTypeObj[key],
|
|
1355
|
+
'YEAR'
|
|
1356
|
+
)
|
|
1357
|
+
toolbarFieldParam.push(fieldParam)
|
|
1358
|
+
} else if (controlTypes[key + '~~month'] === 'month') {
|
|
1359
|
+
// 表示是月份控件
|
|
1360
|
+
// 年份月份如何匹配 2020(动态解析为未1-1和12-31) 2020-01(根据月份匹配第一天和最后一天)?
|
|
1361
|
+
const fieldParam = this.getFieldParamByYearOrMonth(
|
|
1362
|
+
key,
|
|
1363
|
+
value,
|
|
1364
|
+
dataTypeObj[key],
|
|
1365
|
+
'MONTH'
|
|
1366
|
+
)
|
|
1367
|
+
toolbarFieldParam.push(fieldParam)
|
|
1368
|
+
} else {
|
|
1369
|
+
const fieldParam = {}
|
|
1370
|
+
fieldParam.leftBracket = '('
|
|
1371
|
+
fieldParam.propName = key
|
|
1372
|
+
fieldParam.propDbName = key
|
|
1373
|
+
fieldParam.dataType = dataTypeObj[key]
|
|
1374
|
+
? dataTypeObj[key]
|
|
1375
|
+
: 'TEXT'
|
|
1376
|
+
fieldParam.operator = 'EQ'
|
|
1377
|
+
fieldParam.propValue = value
|
|
1378
|
+
fieldParam.rightBracket = ')'
|
|
1379
|
+
fieldParam.joinSign = 'and'
|
|
1380
|
+
toolbarFieldParam.push(fieldParam)
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
this.$refs.grid.toolbarRefresh(null, null, toolbarFieldParam)
|
|
1387
|
+
},
|
|
1388
|
+
getFieldParamByYearOrMonth(key, value, dataType, formatType) {
|
|
1389
|
+
const fieldParam = {}
|
|
1390
|
+
fieldParam.leftBracket = '('
|
|
1391
|
+
fieldParam.propName = key
|
|
1392
|
+
fieldParam.propDbName = key
|
|
1393
|
+
fieldParam.dataType = dataType || null
|
|
1394
|
+
fieldParam.dateFormatType = formatType
|
|
1395
|
+
fieldParam.operator = 'EQ'
|
|
1396
|
+
fieldParam.startValue = value
|
|
1397
|
+
fieldParam.endValue = value
|
|
1398
|
+
fieldParam.propValue = value
|
|
1399
|
+
fieldParam.rightBracket = ')'
|
|
1400
|
+
fieldParam.joinSign = 'and'
|
|
1401
|
+
return fieldParam
|
|
1402
|
+
},
|
|
1403
|
+
resizeListHeight(params) {
|
|
1404
|
+
const pageHeight = getStoreInfo(this.pageCode, '_pageHeight')
|
|
1405
|
+
if (
|
|
1406
|
+
pageHeight === undefined ||
|
|
1407
|
+
pageHeight === null ||
|
|
1408
|
+
pageHeight === ''
|
|
1409
|
+
) {
|
|
1410
|
+
return params.height - 20
|
|
1411
|
+
}
|
|
1412
|
+
},
|
|
1413
|
+
// 设置字段禁止编辑
|
|
1414
|
+
fnProhibitToEdit(entity) {
|
|
1415
|
+
this.$refs['grid'].fnProhibitToEdit(entity)
|
|
1416
|
+
},
|
|
1417
|
+
recieveMessage(event) {
|
|
1418
|
+
if (event.data === 'close_open_win') {
|
|
1419
|
+
if (this.$refs.grid) {
|
|
1420
|
+
this.$refs.grid.refresh()
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
},
|
|
1424
|
+
customButtonClick(
|
|
1425
|
+
originalValue,
|
|
1426
|
+
formatValue,
|
|
1427
|
+
row,
|
|
1428
|
+
column,
|
|
1429
|
+
rowIndex,
|
|
1430
|
+
button
|
|
1431
|
+
) {
|
|
1432
|
+
this.callBeforeClickButton(
|
|
1433
|
+
this.listEvents,
|
|
1434
|
+
this.listCode + '__' + button.code,
|
|
1435
|
+
{
|
|
1436
|
+
params: this.additionalParamMap,
|
|
1437
|
+
listToolbarFormData: this.listToolbarFormData,
|
|
1438
|
+
originalValue,
|
|
1439
|
+
formatValue,
|
|
1440
|
+
row,
|
|
1441
|
+
column,
|
|
1442
|
+
rowIndex,
|
|
1443
|
+
}
|
|
1444
|
+
)
|
|
1445
|
+
},
|
|
1446
|
+
customButtonSaveRow(rowIndex) {
|
|
1447
|
+
this.options.lineEditOptions['saveRow'] = this.saveLineEditRow
|
|
1448
|
+
this.$refs.grid.saveRow(rowIndex, this.listCode)
|
|
1449
|
+
},
|
|
1450
|
+
},
|
|
1451
|
+
emits: [],
|
|
1452
|
+
}
|
|
1453
|
+
</script>
|