vue2-client 1.8.197 → 1.8.198
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/package.json +1 -1
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +2 -2
- package/src/base-client/components/common/XDescriptions/XDescriptions.vue +62 -35
- package/src/base-client/components/common/XFormTable/XFormTable.vue +72 -35
- package/src/base-client/components/common/XTable/XTable.vue +26 -15
- package/src/utils/lowcode/lowcodeComponentMixin.js +10 -4
package/package.json
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<a-
|
|
4
|
-
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
<a-descriptions-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
<a-row>
|
|
3
|
+
<a-col :span="$slots.addonAfter ? 20 : 24">
|
|
4
|
+
<a-skeleton :loading="loading" :paragraph="{ rows: 4 }" />
|
|
5
|
+
<div v-show="!loading">
|
|
6
|
+
<template v-if="!loadError">
|
|
7
|
+
<a-descriptions v-if="realData" :column="isMobile ? 1 : column" size="small" :title="title">
|
|
8
|
+
<a-descriptions-item
|
|
9
|
+
v-for="(value, key) in realData"
|
|
10
|
+
:key="key"
|
|
11
|
+
:label="key">
|
|
12
|
+
{{ formatText(value) }}
|
|
13
|
+
</a-descriptions-item>
|
|
14
|
+
</a-descriptions>
|
|
15
|
+
</template>
|
|
16
|
+
<template v-else>
|
|
17
|
+
<a-empty>
|
|
18
|
+
<span slot="description"> 页面配置不存在,请联系系统管理员 </span>
|
|
19
|
+
</a-empty>
|
|
20
|
+
</template>
|
|
21
|
+
</div>
|
|
22
|
+
</a-col>
|
|
23
|
+
<a-col v-if="$slots.addonAfter" :span="4">
|
|
24
|
+
<slot name="addonAfter"></slot>
|
|
25
|
+
</a-col>
|
|
26
|
+
</a-row>
|
|
22
27
|
</template>
|
|
23
28
|
<script>
|
|
24
29
|
|
|
25
30
|
import { mapState } from 'vuex'
|
|
26
|
-
import {
|
|
31
|
+
import { getRealKeyData } from '@vue2-client/utils/formatter'
|
|
32
|
+
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
27
33
|
|
|
28
34
|
export default {
|
|
29
35
|
name: 'XDescriptions',
|
|
@@ -43,7 +49,8 @@ export default {
|
|
|
43
49
|
// 模型名
|
|
44
50
|
model: {
|
|
45
51
|
type: String,
|
|
46
|
-
required:
|
|
52
|
+
required: false,
|
|
53
|
+
default: ''
|
|
47
54
|
},
|
|
48
55
|
// 配置名称
|
|
49
56
|
configName: {
|
|
@@ -59,6 +66,11 @@ export default {
|
|
|
59
66
|
column: {
|
|
60
67
|
type: Number,
|
|
61
68
|
default: 2
|
|
69
|
+
},
|
|
70
|
+
// 每列显示数量
|
|
71
|
+
getRealData: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
62
74
|
}
|
|
63
75
|
},
|
|
64
76
|
created () {
|
|
@@ -73,7 +85,7 @@ export default {
|
|
|
73
85
|
}
|
|
74
86
|
},
|
|
75
87
|
computed: {
|
|
76
|
-
...mapState('setting',
|
|
88
|
+
...mapState('setting', { isMobile: 'isMobile' })
|
|
77
89
|
},
|
|
78
90
|
methods: {
|
|
79
91
|
initConfig () {
|
|
@@ -87,22 +99,37 @@ export default {
|
|
|
87
99
|
}
|
|
88
100
|
},
|
|
89
101
|
getConfig () {
|
|
90
|
-
|
|
102
|
+
getConfigByName(this.configName, this.serviceName, (res) => {
|
|
91
103
|
const mapIndex = {}
|
|
92
|
-
res.formJson.filter(item => {
|
|
93
|
-
const model = item.model
|
|
94
|
-
return model.indexOf(this.model) > 0
|
|
95
|
-
})[0].groupItems.forEach(item => {
|
|
96
|
-
mapIndex[item.model.substring(item.model.indexOf('_') + 1)] = item.name
|
|
97
|
-
})
|
|
98
104
|
const result = {}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
if (res.formJson) {
|
|
106
|
+
res.formJson.filter(item => {
|
|
107
|
+
const model = item.model
|
|
108
|
+
return model.indexOf(this.model) > 0
|
|
109
|
+
})[0].groupItems.forEach(item => {
|
|
110
|
+
mapIndex[item.model.substring(item.model.indexOf('_') + 1)] = item.name
|
|
111
|
+
})
|
|
112
|
+
for (const key of Object.keys(this.content)) {
|
|
113
|
+
const name = mapIndex[key]
|
|
114
|
+
if (name) {
|
|
115
|
+
result[name] = this.content[key]
|
|
116
|
+
} else {
|
|
117
|
+
result[key] = this.content[key]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
} else if (res.column) {
|
|
121
|
+
// [{label:'标签1',filed:'字段1'}]
|
|
122
|
+
let content = {}
|
|
123
|
+
if (this.getRealData) {
|
|
124
|
+
content = getRealKeyData(this.content)
|
|
103
125
|
} else {
|
|
104
|
-
|
|
126
|
+
content = this.content
|
|
105
127
|
}
|
|
128
|
+
console.log(res.column)
|
|
129
|
+
console.log(content)
|
|
130
|
+
res.column.forEach(item => {
|
|
131
|
+
result[item.label] = content[item.filed]
|
|
132
|
+
})
|
|
106
133
|
}
|
|
107
134
|
this.realData = result
|
|
108
135
|
this.loading = false
|
|
@@ -40,8 +40,10 @@
|
|
|
40
40
|
:queryParamsName="queryParamsName"
|
|
41
41
|
:query-params-json="queryParamsJson"
|
|
42
42
|
:show-pagination="showPagination"
|
|
43
|
+
:customDelete="customDelete"
|
|
43
44
|
@add="add"
|
|
44
45
|
@edit="edit"
|
|
46
|
+
@del="del"
|
|
45
47
|
@afterDelete="afterDelete"
|
|
46
48
|
@action="action"
|
|
47
49
|
@selectRow="selectRow"
|
|
@@ -106,7 +108,9 @@ export default {
|
|
|
106
108
|
},
|
|
107
109
|
loadError: false,
|
|
108
110
|
// 实际查询配置内容
|
|
109
|
-
realQueryConfig: {}
|
|
111
|
+
realQueryConfig: {},
|
|
112
|
+
table_selectedRowKeys: [],
|
|
113
|
+
table_selectedRows: []
|
|
110
114
|
}
|
|
111
115
|
},
|
|
112
116
|
computed: {
|
|
@@ -197,7 +201,22 @@ export default {
|
|
|
197
201
|
buttonState: {
|
|
198
202
|
type: Object,
|
|
199
203
|
default: undefined
|
|
200
|
-
}
|
|
204
|
+
},
|
|
205
|
+
// 是否自定义新增按钮的功能
|
|
206
|
+
customAdd: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
default: false
|
|
209
|
+
},
|
|
210
|
+
// 是否自定义删除按钮的功能
|
|
211
|
+
customDelete: {
|
|
212
|
+
type: Boolean,
|
|
213
|
+
default: false
|
|
214
|
+
},
|
|
215
|
+
// 是否自定义修改按钮的功能
|
|
216
|
+
customEdit: {
|
|
217
|
+
type: Boolean,
|
|
218
|
+
default: false
|
|
219
|
+
},
|
|
201
220
|
},
|
|
202
221
|
watch: {
|
|
203
222
|
logicParam: {
|
|
@@ -343,49 +362,65 @@ export default {
|
|
|
343
362
|
treeOnChecked (checkedKeys, deepNodes, deepKeys) {
|
|
344
363
|
this.$emit('treeOnChecked', checkedKeys, deepNodes, deepKeys)
|
|
345
364
|
},
|
|
365
|
+
/**
|
|
366
|
+
* 新增按钮事件
|
|
367
|
+
*/
|
|
368
|
+
del (keys, callback) {
|
|
369
|
+
if (this.customDelete) {
|
|
370
|
+
this.$emit('del', keys, callback)
|
|
371
|
+
}
|
|
372
|
+
},
|
|
346
373
|
/**
|
|
347
374
|
* 新增按钮事件
|
|
348
375
|
*/
|
|
349
376
|
add () {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
377
|
+
if (this.customAdd) {
|
|
378
|
+
this.$emit('add')
|
|
379
|
+
} else {
|
|
380
|
+
const res = this.realQueryConfig
|
|
381
|
+
this.$refs.xAddForm.init({
|
|
382
|
+
businessType: '新增',
|
|
383
|
+
title: this.title,
|
|
384
|
+
isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
|
|
385
|
+
configName: this.queryParamsName,
|
|
386
|
+
configContent: this.queryParamsJson,
|
|
387
|
+
formItems: res.formJson,
|
|
388
|
+
viewMode: this.viewMode,
|
|
389
|
+
isTableTemp: this.isTableTemp,
|
|
390
|
+
serviceName: this.serviceName,
|
|
391
|
+
fixedAddForm: this.fixedAddForm,
|
|
392
|
+
getDataParams: this.getDataParams,
|
|
393
|
+
layout: res.xAddFormLayout || 'horizontal',
|
|
394
|
+
env: this.env
|
|
395
|
+
})
|
|
396
|
+
}
|
|
366
397
|
},
|
|
367
398
|
/**
|
|
368
399
|
* 修改按钮事件
|
|
369
400
|
* @param modifyModelData 修改表单数据
|
|
370
401
|
*/
|
|
371
402
|
edit (modifyModelData) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
403
|
+
if (this.customAdd) {
|
|
404
|
+
this.$emit('edit')
|
|
405
|
+
} else {
|
|
406
|
+
const res = this.realQueryConfig
|
|
407
|
+
this.$refs.xAddForm.init({
|
|
408
|
+
businessType: '修改',
|
|
409
|
+
title: this.title,
|
|
410
|
+
isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
|
|
411
|
+
configName: this.queryParamsName,
|
|
412
|
+
configContent: this.queryParamsJson,
|
|
413
|
+
formItems: res.formJson,
|
|
414
|
+
viewMode: this.viewMode,
|
|
415
|
+
isTableTemp: this.isTableTemp,
|
|
416
|
+
serviceName: this.serviceName,
|
|
417
|
+
fixedAddForm: this.fixedAddForm,
|
|
418
|
+
getDataParams: this.getDataParams,
|
|
419
|
+
modifyModelData: modifyModelData,
|
|
420
|
+
layout: res.xAddFormLayout || 'horizontal',
|
|
421
|
+
env: this.env
|
|
422
|
+
})
|
|
423
|
+
}
|
|
389
424
|
},
|
|
390
425
|
/**
|
|
391
426
|
* 删除后事件
|
|
@@ -408,6 +443,8 @@ export default {
|
|
|
408
443
|
* @param selectedRows 选中列
|
|
409
444
|
*/
|
|
410
445
|
selectRow (selectedRowKeys, selectedRows) {
|
|
446
|
+
this.table_selectedRowKeys = selectedRowKeys
|
|
447
|
+
this.table_selectedRows = selectedRows
|
|
411
448
|
this.$emit('selectRow', selectedRowKeys, selectedRows)
|
|
412
449
|
},
|
|
413
450
|
/**
|
|
@@ -91,12 +91,13 @@
|
|
|
91
91
|
<a class="ant-dropdown-link" @click="e => e.preventDefault()">
|
|
92
92
|
{{ item.scopedSlots?.customRender || item.slotValue }} <a-icon type="down"/>
|
|
93
93
|
</a>
|
|
94
|
-
<a-menu slot="overlay">
|
|
94
|
+
<a-menu slot="overlay" style="min-width: 60px">
|
|
95
95
|
<a-menu-item
|
|
96
96
|
v-for="(action_item, index) in item.actionArr"
|
|
97
97
|
:key="index"
|
|
98
98
|
v-if="!action_item.customFunction || executeStrFunction( action_item.customFunction,[record,index])">
|
|
99
99
|
<a
|
|
100
|
+
style="text-align: center"
|
|
100
101
|
@click="action(record, item.dataIndex, action_item.func)"
|
|
101
102
|
>{{ action_item.text }}</a>
|
|
102
103
|
</a-menu-item>
|
|
@@ -236,6 +237,11 @@ export default {
|
|
|
236
237
|
showPagination: {
|
|
237
238
|
type: Boolean,
|
|
238
239
|
default: true
|
|
240
|
+
},
|
|
241
|
+
// 是否自定义删除功能
|
|
242
|
+
customDelete: {
|
|
243
|
+
type: Boolean,
|
|
244
|
+
default: false
|
|
239
245
|
}
|
|
240
246
|
},
|
|
241
247
|
computed: {
|
|
@@ -254,7 +260,8 @@ export default {
|
|
|
254
260
|
...mapState('account', { currUser: 'user' }),
|
|
255
261
|
...mapState('setting', ['compatible'])
|
|
256
262
|
},
|
|
257
|
-
mounted () {
|
|
263
|
+
mounted () {
|
|
264
|
+
},
|
|
258
265
|
methods: {
|
|
259
266
|
executeStrFunction,
|
|
260
267
|
/**
|
|
@@ -477,20 +484,24 @@ export default {
|
|
|
477
484
|
zIndex: 1001,
|
|
478
485
|
onOk: () => {
|
|
479
486
|
return new Promise((resolve, reject) => {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
487
|
+
if (this.customDelete) {
|
|
488
|
+
this.$emit('del', this.selectedRows, resolve)
|
|
489
|
+
} else {
|
|
490
|
+
const requestParameters = {
|
|
491
|
+
queryParamsName: this.queryParamsName,
|
|
492
|
+
idList: this.selectedRowKeys
|
|
493
|
+
}
|
|
494
|
+
remove(requestParameters, this.serviceName, this.env === 'dev').then(res => {
|
|
495
|
+
resolve(res)
|
|
496
|
+
this.$message.success('删除成功!')
|
|
497
|
+
this.refresh(true)
|
|
498
|
+
// afterDelete
|
|
499
|
+
this.$emit('afterDelete', requestParameters)
|
|
500
|
+
}).catch(e => {
|
|
501
|
+
reject(e)
|
|
502
|
+
this.$message.error('删除失败!')
|
|
503
|
+
})
|
|
483
504
|
}
|
|
484
|
-
remove(requestParameters, this.serviceName, this.env === 'dev').then(res => {
|
|
485
|
-
resolve(res)
|
|
486
|
-
this.$message.success('删除成功!')
|
|
487
|
-
this.refresh(true)
|
|
488
|
-
// afterDelete
|
|
489
|
-
this.$emit('afterDelete', requestParameters)
|
|
490
|
-
}).catch(e => {
|
|
491
|
-
reject(e)
|
|
492
|
-
this.$message.error('删除失败!')
|
|
493
|
-
})
|
|
494
505
|
})
|
|
495
506
|
},
|
|
496
507
|
onCancel () {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
// eslint-disable-next-line no-unused-vars
|
|
2
2
|
import Vue from 'vue'
|
|
3
3
|
import lowcodeLog from '@vue2-client/utils/lowcode/lowcodeLog'
|
|
4
|
+
import { uuid } from '@vue2-client/utils/util'
|
|
4
5
|
export default {
|
|
5
6
|
props: {
|
|
6
7
|
mixinComponentId: {
|
|
7
8
|
type: String,
|
|
8
|
-
required:
|
|
9
|
+
required: false,
|
|
10
|
+
default: uuid()
|
|
9
11
|
},
|
|
10
12
|
propsData: {
|
|
11
13
|
type: Object,
|
|
12
|
-
default: {}
|
|
14
|
+
default: () => {}
|
|
13
15
|
}
|
|
14
16
|
},
|
|
15
17
|
methods: {
|
|
@@ -48,11 +50,15 @@ export default {
|
|
|
48
50
|
},
|
|
49
51
|
// 处理本组件发出的事件
|
|
50
52
|
$lowCodeEmit (eventType, data) {
|
|
51
|
-
|
|
53
|
+
if (this.mixinComponentId) {
|
|
54
|
+
this.$emit('onEvent', data, eventType, this.mixinComponentId)
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
},
|
|
54
58
|
mounted () {
|
|
55
|
-
|
|
59
|
+
if (this.mixinComponentId) {
|
|
60
|
+
this.$emit('componentDidMounted', this, this.mixinComponentId)
|
|
61
|
+
}
|
|
56
62
|
},
|
|
57
63
|
supportedEventType: [
|
|
58
64
|
'changeValue',
|