agilebuilder-ui 1.0.85-temp2 → 1.0.85-temp4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/super-ui.js +40 -118
- package/lib/super-ui.umd.cjs +1 -1
- package/package.json +1 -1
- package/packages/super-grid/src/custom-formatter.js +311 -387
- package/src/utils/jump-page-utils.js +8 -34
|
@@ -1,407 +1,322 @@
|
|
|
1
|
-
import {$emit} from '../../utils/gogocodeTransfer'
|
|
2
|
-
import {doFormat} from './formatter'
|
|
1
|
+
import { $emit } from '../../utils/gogocodeTransfer'
|
|
2
|
+
import { doFormat } from './formatter'
|
|
3
3
|
import store from './store'
|
|
4
|
-
import {initialization, jumpToPage} from '../../../src/utils/jump-page-utils'
|
|
5
|
-
import {analysisFileSetObj, otherFilesToStandard} from './utils'
|
|
6
|
-
import {isPromise} from '../../../src/utils/common-util'
|
|
7
|
-
|
|
4
|
+
import { initialization, jumpToPage } from '../../../src/utils/jump-page-utils'
|
|
5
|
+
import { analysisFileSetObj, otherFilesToStandard } from './utils'
|
|
6
|
+
import { isPromise } from '../../../src/utils/common-util'
|
|
8
7
|
|
|
9
8
|
const customFormatter = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
9
|
+
/**
|
|
10
|
+
* 自定义格式化值
|
|
11
|
+
* @param {prop} 属性名
|
|
12
|
+
* @param {formatValue} 格式化后的值
|
|
13
|
+
* @param {format} 格式化方法
|
|
14
|
+
* @param {componentName} 组件名
|
|
15
|
+
*/
|
|
16
|
+
customFormatValue(row, prop, format, rowIndex) {
|
|
17
|
+
// const start = new Date().getTime()
|
|
18
|
+
// console.log('---super-grid--customFormatValue--this.customFormat=', this.customFormat)
|
|
19
|
+
if (this.customFormat) {
|
|
20
|
+
let originalValue = row[prop]
|
|
21
|
+
if (this.isObjectProp(prop)) {
|
|
22
|
+
originalValue = this.objectPropOriginalValue(row, prop)
|
|
23
|
+
}
|
|
24
|
+
const formatValue = doFormat(this.column, originalValue)
|
|
25
|
+
const component = format.call(this, originalValue, formatValue, row, this.column, rowIndex)
|
|
26
|
+
// console.log('---super-grid--customFormatValue--component=', component)
|
|
27
|
+
if (typeof component === 'undefined') {
|
|
28
|
+
return false
|
|
29
|
+
} else {
|
|
30
|
+
// const aa = defineCustomElement(component)
|
|
31
|
+
// window.customElements.define(prop + rowIndex , aa)
|
|
32
|
+
window.$vueApp.component(prop + rowIndex, component)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// const end = new Date().getTime()
|
|
36
|
+
// console.log('---super-grid--customFormatValue--time1=', (end - start))
|
|
37
|
+
return true
|
|
38
|
+
} else {
|
|
39
|
+
// const end = new Date().getTime()
|
|
40
|
+
// console.log('---super-grid--customFormatValue--time2=', (end - start))
|
|
41
|
+
return false
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
isObjectProp(prop) {
|
|
46
|
+
// const start = new Date().getTime()
|
|
47
|
+
// console.log('---super-grid--isObjectProp--')
|
|
48
|
+
if (prop && prop.indexOf('.') > 0) {
|
|
49
|
+
// const end = new Date().getTime()
|
|
50
|
+
// console.log('---super-grid--isObjectProp--time1=', (end - start))
|
|
51
|
+
return true
|
|
52
|
+
} else {
|
|
53
|
+
// const end = new Date().getTime()
|
|
54
|
+
// console.log('---super-grid--isObjectProp--time2=', (end - start))
|
|
55
|
+
return false
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
objectPropOriginalValue(row, prop) {
|
|
60
|
+
try {
|
|
61
|
+
// console.log('---super-grid--objectPropOriginalValue--')
|
|
62
|
+
let objValue = row
|
|
63
|
+
if (prop && prop.indexOf('.') > 0) {
|
|
64
|
+
const props = prop.split('.')
|
|
65
|
+
props.forEach((subProp) => {
|
|
66
|
+
if (objValue) {
|
|
67
|
+
objValue = objValue[subProp]
|
|
68
|
+
} else {
|
|
69
|
+
objValue = ''
|
|
70
|
+
throw objValue
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
return objValue
|
|
74
|
+
} else {
|
|
75
|
+
return row[prop]
|
|
76
|
+
}
|
|
77
|
+
} catch (e) {
|
|
78
|
+
// console.log(e)
|
|
79
|
+
return ''
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
objectPropValue(row, prop) {
|
|
84
|
+
return this.formatter(row, prop, this.column)
|
|
85
|
+
},
|
|
86
|
+
// 获取显示的值
|
|
87
|
+
// 附件类型,显示值与实际值不相同。如果时子表多选,需要单独判断
|
|
88
|
+
objectPropValueTwo(row, column) {
|
|
89
|
+
if ((column.componentType === 'annex' || column.componentType === 'multipartUpload') && column.fileSet) {
|
|
90
|
+
// 判断是否是对象集合(子表存储)
|
|
91
|
+
const fileSetObj = JSON.parse(column.fileSet)
|
|
92
|
+
if (fileSetObj.childAnnexDataTableCode) {
|
|
93
|
+
// 获取存好的json并解析
|
|
94
|
+
const keyValueParam = analysisFileSetObj(fileSetObj, this.isSql)
|
|
95
|
+
// 子表存储。返回最后一个对象的展示名称
|
|
96
|
+
const fileArr = this.objectPropValue(row, column.prop)
|
|
97
|
+
if (fileArr && fileArr.length > 0) {
|
|
98
|
+
const fileList = otherFilesToStandard(fileSetObj, keyValueParam, fileArr, null)
|
|
99
|
+
return fileList[fileList.length - 1].showName
|
|
88
100
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (fileSetObj.childAnnexDataTableCode) {
|
|
104
|
-
// 获取存好的json并解析
|
|
105
|
-
const keyValueParam = analysisFileSetObj(fileSetObj, this.isSql)
|
|
106
|
-
// 子表存储。返回最后一个对象的展示名称
|
|
107
|
-
const fileArr = this.objectPropValue(row, column.prop)
|
|
108
|
-
if (fileArr && fileArr.length > 0) {
|
|
109
|
-
const fileList = otherFilesToStandard(
|
|
110
|
-
fileSetObj,
|
|
111
|
-
keyValueParam,
|
|
112
|
-
fileArr,
|
|
113
|
-
null
|
|
114
|
-
)
|
|
115
|
-
return fileList[fileList.length - 1].showName
|
|
116
|
-
}
|
|
117
|
-
} else {
|
|
118
|
-
return this.objectPropValue(row, column.prop)
|
|
119
|
-
}
|
|
120
|
-
} else if (column.formatter && column.formatter.type === 'files') {
|
|
121
|
-
// 判断是否是对象集合(子表存储)
|
|
122
|
-
const fileSetObj = JSON.parse(column.formatter.options.fileSet)
|
|
123
|
-
if (fileSetObj.childAnnexDataTableCode) {
|
|
124
|
-
// 获取存好的json并解析
|
|
125
|
-
const keyValueParam = analysisFileSetObj(fileSetObj, this.isSql)
|
|
126
|
-
// 子表存储。返回最后一个对象的展示名称
|
|
127
|
-
const fileArr = this.objectPropValue(row, column.prop)
|
|
128
|
-
if (fileArr && fileArr.length > 0) {
|
|
129
|
-
const fileList = otherFilesToStandard(
|
|
130
|
-
fileSetObj,
|
|
131
|
-
keyValueParam,
|
|
132
|
-
fileArr,
|
|
133
|
-
null
|
|
134
|
-
)
|
|
135
|
-
return fileList[fileList.length - 1].showName
|
|
136
|
-
}
|
|
137
|
-
} else {
|
|
138
|
-
return this.objectPropValue(row, column.prop)
|
|
139
|
-
}
|
|
140
|
-
} else {
|
|
141
|
-
return this.objectPropValue(row, column.prop)
|
|
101
|
+
} else {
|
|
102
|
+
return this.objectPropValue(row, column.prop)
|
|
103
|
+
}
|
|
104
|
+
} else if (column.formatter && column.formatter.type === 'files') {
|
|
105
|
+
// 判断是否是对象集合(子表存储)
|
|
106
|
+
const fileSetObj = JSON.parse(column.formatter.options.fileSet)
|
|
107
|
+
if (fileSetObj.childAnnexDataTableCode) {
|
|
108
|
+
// 获取存好的json并解析
|
|
109
|
+
const keyValueParam = analysisFileSetObj(fileSetObj, this.isSql)
|
|
110
|
+
// 子表存储。返回最后一个对象的展示名称
|
|
111
|
+
const fileArr = this.objectPropValue(row, column.prop)
|
|
112
|
+
if (fileArr && fileArr.length > 0) {
|
|
113
|
+
const fileList = otherFilesToStandard(fileSetObj, keyValueParam, fileArr, null)
|
|
114
|
+
return fileList[fileList.length - 1].showName
|
|
142
115
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
116
|
+
} else {
|
|
117
|
+
return this.objectPropValue(row, column.prop)
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
return this.objectPropValue(row, column.prop)
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
formatter(row, prop, column) {
|
|
124
|
+
const cellValue = this.objectPropOriginalValue(row, prop)
|
|
125
|
+
if (this.columnFormatter !== undefined && this.columnFormatter.type === 'custom') {
|
|
126
|
+
// 自定义事件
|
|
127
|
+
let funName
|
|
128
|
+
if (this.columnFormatter.options && this.columnFormatter.options.format) {
|
|
129
|
+
funName = this.columnFormatter.options.format
|
|
130
|
+
}
|
|
131
|
+
if (funName && funName !== null && funName !== '') {
|
|
132
|
+
const gridParams = store.get(this.listCode)
|
|
146
133
|
if (
|
|
147
|
-
|
|
148
|
-
|
|
134
|
+
gridParams.options &&
|
|
135
|
+
gridParams.options['eventCallBack'] &&
|
|
136
|
+
gridParams.options['eventCallBack'][funName] &&
|
|
137
|
+
typeof gridParams.options['eventCallBack'][funName] === 'function'
|
|
149
138
|
) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
gridParams.options &&
|
|
159
|
-
gridParams.options['eventCallBack'] &&
|
|
160
|
-
gridParams.options['eventCallBack'][funName] &&
|
|
161
|
-
typeof gridParams.options['eventCallBack'][funName] === 'function'
|
|
162
|
-
) {
|
|
163
|
-
const param = {
|
|
164
|
-
value: cellValue,
|
|
165
|
-
row: row,
|
|
166
|
-
column: this.column,
|
|
167
|
-
prop: prop,
|
|
168
|
-
additionalParamMap: gridParams.additionalParamMap,
|
|
169
|
-
}
|
|
170
|
-
return gridParams.options['eventCallBack'][funName].call(this, param)
|
|
171
|
-
} else {
|
|
172
|
-
return doFormat(column, cellValue)
|
|
173
|
-
}
|
|
174
|
-
} else {
|
|
175
|
-
return doFormat(column, cellValue)
|
|
176
|
-
}
|
|
139
|
+
const param = {
|
|
140
|
+
value: cellValue,
|
|
141
|
+
row: row,
|
|
142
|
+
column: this.column,
|
|
143
|
+
prop: prop,
|
|
144
|
+
additionalParamMap: gridParams.additionalParamMap
|
|
145
|
+
}
|
|
146
|
+
return gridParams.options['eventCallBack'][funName].call(this, param)
|
|
177
147
|
} else {
|
|
178
|
-
|
|
148
|
+
return doFormat(column, cellValue)
|
|
179
149
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
150
|
+
} else {
|
|
151
|
+
return doFormat(column, cellValue)
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
return doFormat(column, cellValue)
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
getColumnValue(row, column) {
|
|
158
|
+
const prop = column.prop
|
|
159
|
+
let originalValue = row[prop]
|
|
160
|
+
if (this.isObjectProp(prop)) {
|
|
161
|
+
originalValue = this.objectPropOriginalValue(row, prop)
|
|
162
|
+
}
|
|
163
|
+
const formatValue = doFormat(column, originalValue)
|
|
164
|
+
return {
|
|
165
|
+
originalValue,
|
|
166
|
+
formatValue
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
onClickFun(row, column, onClick, rowIndex, button) {
|
|
170
|
+
const values = this.getColumnValue(row, column)
|
|
171
|
+
onClick.call(this, values.originalValue, values.formatValue, row, column, rowIndex, button)
|
|
172
|
+
},
|
|
173
|
+
isShowButtonFun(row, column, isShowFun, rowIndex) {
|
|
174
|
+
if (isShowFun === undefined) {
|
|
175
|
+
return true
|
|
176
|
+
}
|
|
177
|
+
if (typeof isShowFun === 'function') {
|
|
178
|
+
const values = this.getColumnValue(row, column)
|
|
179
|
+
let isShow = isShowFun.call(this, values.originalValue, values.formatValue, row, column, rowIndex)
|
|
180
|
+
if (isShow === undefined) {
|
|
181
|
+
isShow = true
|
|
182
|
+
}
|
|
183
|
+
return isShow
|
|
184
|
+
} else {
|
|
185
|
+
return isShowFun
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
// 超链接解析
|
|
189
|
+
getHyperLinkSetting(column, row, isSql, additionalParamerter, contextParameter, tableName, listCode) {
|
|
190
|
+
const gridParams = store.get(listCode)
|
|
191
|
+
let parentFormData = null
|
|
192
|
+
if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
|
|
193
|
+
parentFormData = gridParams.options.extraParam.entityMap
|
|
194
|
+
}
|
|
195
|
+
let hyperLinkResult = {}
|
|
196
|
+
let jumpPageJson
|
|
197
|
+
if (column && column.formatter && column.formatter.options && column.formatter.options.format) {
|
|
198
|
+
jumpPageJson = column.formatter.options.format
|
|
199
|
+
}
|
|
200
|
+
if (jumpPageJson && jumpPageJson !== '') {
|
|
201
|
+
// 解析是否需要显示该超链接
|
|
202
|
+
const result = initialization(
|
|
203
|
+
JSON.parse(jumpPageJson),
|
|
230
204
|
row,
|
|
231
205
|
isSql,
|
|
232
206
|
additionalParamerter,
|
|
233
207
|
contextParameter,
|
|
234
208
|
tableName,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
hyperLinkResult.visible = true
|
|
282
|
-
hyperLinkResult.label = this.objectPropValueTwo(row, column)
|
|
283
|
-
hyperLinkResult.title = hyperLinkResult.label
|
|
284
|
-
}
|
|
285
|
-
return hyperLinkResult
|
|
286
|
-
},
|
|
287
|
-
// 点击超链接
|
|
288
|
-
clickHyperLink(column, row, listCode, rowIndex) {
|
|
289
|
-
let jumpPageJson
|
|
290
|
-
if (
|
|
291
|
-
column &&
|
|
292
|
-
column.formatter &&
|
|
293
|
-
column.formatter.options &&
|
|
294
|
-
column.formatter.options.format
|
|
295
|
-
) {
|
|
296
|
-
jumpPageJson = column.formatter.options.format
|
|
297
|
-
}
|
|
298
|
-
if (jumpPageJson && jumpPageJson !== '') {
|
|
299
|
-
// 解析是否需要显示该超链接
|
|
300
|
-
let canClick = true
|
|
301
|
-
const gridParams = store.get(listCode)
|
|
302
|
-
const jumpPageSetting = JSON.parse(jumpPageJson)
|
|
303
|
-
console.log(
|
|
304
|
-
'gupre-grid---clickHyperLink--jumpPageSetting=',
|
|
305
|
-
jumpPageSetting
|
|
306
|
-
)
|
|
307
|
-
if (jumpPageSetting.beforeClick) {
|
|
308
|
-
const funName = jumpPageSetting.beforeClick
|
|
309
|
-
console.log(
|
|
310
|
-
'gupre-grid---clickHyperLink--jumpPageSetting.beforeClick=',
|
|
311
|
-
funName
|
|
312
|
-
)
|
|
313
|
-
console.log(
|
|
314
|
-
'gupre-grid---clickHyperLink--gridParams.options[eventCallBack]=',
|
|
315
|
-
gridParams.options['eventCallBack']
|
|
316
|
-
)
|
|
317
|
-
if (
|
|
318
|
-
gridParams.options &&
|
|
319
|
-
gridParams.options['eventCallBack'] &&
|
|
320
|
-
gridParams.options['eventCallBack'][funName] &&
|
|
321
|
-
typeof gridParams.options['eventCallBack'][funName] === 'function'
|
|
322
|
-
) {
|
|
323
|
-
const param = {
|
|
324
|
-
row: row,
|
|
325
|
-
column: column,
|
|
326
|
-
rowIndex: rowIndex,
|
|
327
|
-
listCode,
|
|
328
|
-
additionalParamMap: gridParams.additionalParamMap,
|
|
329
|
-
}
|
|
330
|
-
canClick = gridParams.options['eventCallBack'][funName].call(
|
|
331
|
-
this,
|
|
332
|
-
param
|
|
333
|
-
)
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
if (isPromise(canClick)) {
|
|
337
|
-
canClick.then((result) => {
|
|
338
|
-
this.doClickHyperLink(
|
|
339
|
-
row,
|
|
340
|
-
listCode,
|
|
341
|
-
rowIndex,
|
|
342
|
-
jumpPageSetting,
|
|
343
|
-
gridParams
|
|
344
|
-
)
|
|
345
|
-
})
|
|
346
|
-
} else {
|
|
347
|
-
this.doClickHyperLink(
|
|
348
|
-
row,
|
|
349
|
-
listCode,
|
|
350
|
-
rowIndex,
|
|
351
|
-
jumpPageSetting,
|
|
352
|
-
gridParams
|
|
353
|
-
)
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
doClickHyperLink(row, listCode, rowIndex, jumpPageSetting, gridParams) {
|
|
358
|
-
let parentFormData = null
|
|
209
|
+
parentFormData,
|
|
210
|
+
gridParams.pageContext
|
|
211
|
+
)
|
|
212
|
+
debugger
|
|
213
|
+
if (result.jumpPageSetting) {
|
|
214
|
+
column.formatter.options.format = result.jumpPageSetting
|
|
215
|
+
}
|
|
216
|
+
// console.log('getHyperLinkSetting--resut=', result)
|
|
217
|
+
if (result && result.label && result.label !== '') {
|
|
218
|
+
console.log('label存在')
|
|
219
|
+
} else {
|
|
220
|
+
result.label = this.objectPropValueTwo(row, column)
|
|
221
|
+
}
|
|
222
|
+
if (result && result.title && result.title !== '') {
|
|
223
|
+
console.log('title存在')
|
|
224
|
+
} else {
|
|
225
|
+
result.title = result.label
|
|
226
|
+
}
|
|
227
|
+
hyperLinkResult = result
|
|
228
|
+
} else {
|
|
229
|
+
// 表示显示超链接
|
|
230
|
+
hyperLinkResult.visible = true
|
|
231
|
+
hyperLinkResult.label = this.objectPropValueTwo(row, column)
|
|
232
|
+
hyperLinkResult.title = hyperLinkResult.label
|
|
233
|
+
}
|
|
234
|
+
return hyperLinkResult
|
|
235
|
+
},
|
|
236
|
+
// 点击超链接
|
|
237
|
+
clickHyperLink(column, row, listCode, rowIndex) {
|
|
238
|
+
let jumpPageJson
|
|
239
|
+
if (column && column.formatter && column.formatter.options && column.formatter.options.format) {
|
|
240
|
+
jumpPageJson = column.formatter.options.format
|
|
241
|
+
}
|
|
242
|
+
if (jumpPageJson && jumpPageJson !== '') {
|
|
243
|
+
// 解析是否需要显示该超链接
|
|
244
|
+
let canClick = true
|
|
245
|
+
const gridParams = store.get(listCode)
|
|
246
|
+
const jumpPageSetting = JSON.parse(jumpPageJson)
|
|
247
|
+
console.log('gupre-grid---clickHyperLink--jumpPageSetting=', jumpPageSetting)
|
|
248
|
+
if (jumpPageSetting.beforeClick) {
|
|
249
|
+
const funName = jumpPageSetting.beforeClick
|
|
250
|
+
console.log('gupre-grid---clickHyperLink--jumpPageSetting.beforeClick=', funName)
|
|
251
|
+
console.log(
|
|
252
|
+
'gupre-grid---clickHyperLink--gridParams.options[eventCallBack]=',
|
|
253
|
+
gridParams.options['eventCallBack']
|
|
254
|
+
)
|
|
359
255
|
if (
|
|
360
|
-
|
|
361
|
-
|
|
256
|
+
gridParams.options &&
|
|
257
|
+
gridParams.options['eventCallBack'] &&
|
|
258
|
+
gridParams.options['eventCallBack'][funName] &&
|
|
259
|
+
typeof gridParams.options['eventCallBack'][funName] === 'function'
|
|
362
260
|
) {
|
|
363
|
-
|
|
261
|
+
const param = {
|
|
262
|
+
row: row,
|
|
263
|
+
column: column,
|
|
264
|
+
rowIndex: rowIndex,
|
|
265
|
+
listCode,
|
|
266
|
+
additionalParamMap: gridParams.additionalParamMap
|
|
267
|
+
}
|
|
268
|
+
canClick = gridParams.options['eventCallBack'][funName].call(this, param)
|
|
364
269
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
/// 把父页面的pageData传给弹出的页面或新页签
|
|
371
|
-
const copyPageData = JSON.parse(JSON.stringify((gridParams.pageContext && gridParams.pageContext.page?gridParams.pageContext.page: {})))
|
|
372
|
-
jumpPageSetting._pageData = copyPageData
|
|
373
|
-
jumpToPage(
|
|
374
|
-
jumpPageSetting,
|
|
375
|
-
gridParams.system,
|
|
376
|
-
row.id ? row.id : row.ID,
|
|
377
|
-
row,
|
|
378
|
-
gridParams.additionalParamMap,
|
|
379
|
-
null,
|
|
380
|
-
null,
|
|
381
|
-
parentFormData
|
|
382
|
-
).then((openPageParams) => {
|
|
383
|
-
console.log('doClickHyperLink----openPageParams----', openPageParams)
|
|
384
|
-
if (openPageParams) {
|
|
385
|
-
// 点击列表组件中某元素弹出的页面
|
|
386
|
-
if (
|
|
387
|
-
jumpPageSetting &&
|
|
388
|
-
typeof jumpPageSetting === 'string' &&
|
|
389
|
-
jumpPageSetting !== ''
|
|
390
|
-
) {
|
|
391
|
-
jumpPageSetting = JSON.parse(jumpPageSetting)
|
|
392
|
-
}
|
|
393
|
-
Object.assign(openPageParams, jumpPageSetting)
|
|
394
|
-
// console.log('clickHyperLink--openPageParams22===', openPageParams, '----jumpPageSetting===', jumpPageSetting)
|
|
395
|
-
openPageParams._position = 'list'
|
|
396
|
-
openPageParams._listCode = listCode
|
|
397
|
-
openPageParams._rowIndex = rowIndex
|
|
398
|
-
// 行编辑的记录
|
|
399
|
-
openPageParams.row = row
|
|
400
|
-
// 通知父页面弹出页面
|
|
401
|
-
$emit(this, 'open-page', openPageParams)
|
|
402
|
-
}
|
|
270
|
+
}
|
|
271
|
+
if (isPromise(canClick)) {
|
|
272
|
+
canClick.then((result) => {
|
|
273
|
+
this.doClickHyperLink(row, listCode, rowIndex, jumpPageSetting, gridParams)
|
|
403
274
|
})
|
|
404
|
-
|
|
275
|
+
} else {
|
|
276
|
+
this.doClickHyperLink(row, listCode, rowIndex, jumpPageSetting, gridParams)
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
doClickHyperLink(row, listCode, rowIndex, jumpPageSetting, gridParams) {
|
|
281
|
+
let parentFormData = null
|
|
282
|
+
if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
|
|
283
|
+
parentFormData = gridParams.options.extraParam.entityMap
|
|
284
|
+
}
|
|
285
|
+
console.log('ridParams.options.extraParam.entityMap', gridParams.options.extraParam)
|
|
286
|
+
|
|
287
|
+
/// 把父页面的pageData传给弹出的页面或新页签
|
|
288
|
+
const copyPageData = JSON.parse(
|
|
289
|
+
JSON.stringify(gridParams.pageContext && gridParams.pageContext.page ? gridParams.pageContext.page : {})
|
|
290
|
+
)
|
|
291
|
+
jumpPageSetting._pageData = copyPageData
|
|
292
|
+
jumpToPage(
|
|
293
|
+
jumpPageSetting,
|
|
294
|
+
gridParams.system,
|
|
295
|
+
row.id ? row.id : row.ID,
|
|
296
|
+
row,
|
|
297
|
+
gridParams.additionalParamMap,
|
|
298
|
+
null,
|
|
299
|
+
null,
|
|
300
|
+
parentFormData
|
|
301
|
+
).then((openPageParams) => {
|
|
302
|
+
console.log('doClickHyperLink----openPageParams----', openPageParams)
|
|
303
|
+
if (openPageParams) {
|
|
304
|
+
// 点击列表组件中某元素弹出的页面
|
|
305
|
+
if (jumpPageSetting && typeof jumpPageSetting === 'string' && jumpPageSetting !== '') {
|
|
306
|
+
jumpPageSetting = JSON.parse(jumpPageSetting)
|
|
307
|
+
}
|
|
308
|
+
Object.assign(openPageParams, jumpPageSetting)
|
|
309
|
+
// console.log('clickHyperLink--openPageParams22===', openPageParams, '----jumpPageSetting===', jumpPageSetting)
|
|
310
|
+
openPageParams._position = 'list'
|
|
311
|
+
openPageParams._listCode = listCode
|
|
312
|
+
openPageParams._rowIndex = rowIndex
|
|
313
|
+
// 行编辑的记录
|
|
314
|
+
openPageParams.row = row
|
|
315
|
+
// 通知父页面弹出页面
|
|
316
|
+
$emit(this, 'open-page', openPageParams)
|
|
317
|
+
}
|
|
318
|
+
})
|
|
319
|
+
},
|
|
405
320
|
// 图标解析
|
|
406
321
|
getIconSetting(column, row, isSql, gridParams, listCode) {
|
|
407
322
|
let tableName
|
|
@@ -421,7 +336,16 @@ const customFormatter = {
|
|
|
421
336
|
}
|
|
422
337
|
if (formatJson && formatJson !== '') {
|
|
423
338
|
// 解析是否需要显示该超链接
|
|
424
|
-
const result = initialization(
|
|
339
|
+
const result = initialization(
|
|
340
|
+
JSON.parse(formatJson),
|
|
341
|
+
row,
|
|
342
|
+
isSql,
|
|
343
|
+
additionalParamerter,
|
|
344
|
+
contextParameter,
|
|
345
|
+
tableName,
|
|
346
|
+
parentFormData,
|
|
347
|
+
gridParams.pageContext
|
|
348
|
+
)
|
|
425
349
|
// console.log('getHyperLinkSetting--resut=', result)
|
|
426
350
|
if (result && result.label && result.label !== '') {
|
|
427
351
|
console.log('label存在')
|