vue2-client 1.5.9 → 1.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -1
- package/package.json +1 -1
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +74 -9
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +43 -22
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +28 -39
- package/src/base-client/components/common/XAddForm/XAddForm.vue +11 -20
- package/src/base-client/components/common/XForm/XForm.vue +1 -1
- package/src/base-client/components/common/XFormTable/XFormTable.vue +75 -45
- package/src/base-client/components/common/XTable/XTable.vue +4 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
@close="onClose"
|
|
8
8
|
>
|
|
9
9
|
<a-row :gutter="24">
|
|
10
|
-
<a-col :lg="12" :md="12" :sm="24" :xl="
|
|
10
|
+
<a-col :lg="12" :md="12" :sm="24" :xl="18" :xs="24">
|
|
11
11
|
<a-form-model
|
|
12
12
|
ref="businessCreateForm"
|
|
13
13
|
:label-col="labelCol"
|
|
@@ -66,7 +66,33 @@
|
|
|
66
66
|
<a-input v-model="form.orderBy" placeholder="排序字段,用别名+字段名+排序方式(可选)表示,如:u.id desc"/>
|
|
67
67
|
</a-form-model-item>
|
|
68
68
|
<a-form-model-item label="数据字段" prop="column">
|
|
69
|
-
<a-
|
|
69
|
+
<a-space>
|
|
70
|
+
<a-button type="primary" @click="addColumnItem()">增加</a-button>
|
|
71
|
+
<a-button icon="import" @click="$message.warn('从创意库中选择并引用高质量的通用表单项配置,敬请期待')">从创意库引入</a-button>
|
|
72
|
+
</a-space>
|
|
73
|
+
<a-row :gutter="24">
|
|
74
|
+
<a-col :span="8">
|
|
75
|
+
<span style="font-weight: bold">
|
|
76
|
+
标签名
|
|
77
|
+
</span>
|
|
78
|
+
</a-col>
|
|
79
|
+
<a-col :span="7">
|
|
80
|
+
<span style="font-weight: bold">
|
|
81
|
+
字段名
|
|
82
|
+
</span>
|
|
83
|
+
</a-col>
|
|
84
|
+
<a-col :span="7">
|
|
85
|
+
<span style="font-weight: bold">
|
|
86
|
+
数据模式
|
|
87
|
+
</span>
|
|
88
|
+
</a-col>
|
|
89
|
+
<a-col :span="2">
|
|
90
|
+
<span style="font-weight: bold">
|
|
91
|
+
操作
|
|
92
|
+
</span>
|
|
93
|
+
</a-col>
|
|
94
|
+
</a-row>
|
|
95
|
+
<a-divider style="margin: 6px 0" />
|
|
70
96
|
<div
|
|
71
97
|
v-for="(columnItem, index) in form.column"
|
|
72
98
|
:key="index"
|
|
@@ -80,13 +106,52 @@
|
|
|
80
106
|
<span class="dragTips">拖到此处放置</span>
|
|
81
107
|
</a-row>
|
|
82
108
|
<a-row :gutter="24">
|
|
83
|
-
<a-col :span="
|
|
84
|
-
<span style="font-weight: bold">
|
|
109
|
+
<a-col :span="8">
|
|
110
|
+
<span style="font-weight: bold">
|
|
111
|
+
{{ columnItem.title }}
|
|
112
|
+
</span>
|
|
85
113
|
</a-col>
|
|
86
|
-
<a-col :span="
|
|
114
|
+
<a-col :span="7">
|
|
115
|
+
<span style="font-weight: bold">
|
|
116
|
+
{{ columnItem.key }}
|
|
117
|
+
</span>
|
|
118
|
+
</a-col>
|
|
119
|
+
<a-col :span="7">
|
|
120
|
+
<a-tooltip>
|
|
121
|
+
<template slot="title">
|
|
122
|
+
查询表单项
|
|
123
|
+
</template>
|
|
124
|
+
<a-tag :color="columnItem.dataModeArray.includes('queryForm') ? 'blue' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="file-search" /></a-tag>
|
|
125
|
+
</a-tooltip>
|
|
126
|
+
<a-tooltip>
|
|
127
|
+
<template slot="title">
|
|
128
|
+
表格列
|
|
129
|
+
</template>
|
|
130
|
+
<a-tag :color="columnItem.dataModeArray.includes('table') ? 'orange' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="table" /></a-tag>
|
|
131
|
+
</a-tooltip>
|
|
132
|
+
<a-tooltip>
|
|
133
|
+
<template slot="title">
|
|
134
|
+
新增/修改表单项
|
|
135
|
+
</template>
|
|
136
|
+
<a-tag :color="columnItem.dataModeArray.includes('addOrEditForm') ? 'green' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="form" /></a-tag>
|
|
137
|
+
</a-tooltip>
|
|
138
|
+
<a-tooltip>
|
|
139
|
+
<template slot="title">
|
|
140
|
+
SQL查询项
|
|
141
|
+
</template>
|
|
142
|
+
<a-tag :color="columnItem.dataModeArray.includes('sqlQueryItem') ? 'cyan' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="bars" /></a-tag>
|
|
143
|
+
</a-tooltip>
|
|
144
|
+
<a-tooltip>
|
|
145
|
+
<template slot="title">
|
|
146
|
+
SQL查询表达式
|
|
147
|
+
</template>
|
|
148
|
+
<a-tag :color="columnItem.dataModeArray.includes('sqlQueryCondition') ? 'purple' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="search" /></a-tag>
|
|
149
|
+
</a-tooltip>
|
|
150
|
+
</a-col>
|
|
151
|
+
<a-col :span="1">
|
|
87
152
|
<a-icon type="edit" @click="editColumnItem(columnItem.key,index)"/>
|
|
88
153
|
</a-col>
|
|
89
|
-
<a-col :span="
|
|
154
|
+
<a-col :span="1">
|
|
90
155
|
<a-icon type="close" @click="removeColumnItem(columnItem.key,index)"/>
|
|
91
156
|
</a-col>
|
|
92
157
|
</a-row>
|
|
@@ -127,7 +192,7 @@
|
|
|
127
192
|
<create-query-item ref="queryItem" @getColumn="getColumn" @itemHandle="itemHandle"/>
|
|
128
193
|
<a-button type="primary" @click="view">操作</a-button>
|
|
129
194
|
</a-col>
|
|
130
|
-
<a-col :lg="12" :md="12" :sm="24" :xl="
|
|
195
|
+
<a-col :lg="12" :md="12" :sm="24" :xl="6" :xs="24">
|
|
131
196
|
<a-card :bordered="false" size="small" style="overflow: auto" title="预览">
|
|
132
197
|
<json-viewer
|
|
133
198
|
:copyable="{copyText: '复制', copiedText: '已复制'}"
|
|
@@ -193,8 +258,8 @@ export default {
|
|
|
193
258
|
],
|
|
194
259
|
// 操作按钮状态集合值
|
|
195
260
|
buttonStateData: ['add', 'edit', 'delete', 'import', 'export'],
|
|
196
|
-
labelCol: { span:
|
|
197
|
-
wrapperCol: { span:
|
|
261
|
+
labelCol: { span: 3 },
|
|
262
|
+
wrapperCol: { span: 18 },
|
|
198
263
|
form: {
|
|
199
264
|
serviceName: '',
|
|
200
265
|
tableName: '',
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
@close="onClose"
|
|
8
8
|
>
|
|
9
9
|
<a-row :gutter="24">
|
|
10
|
-
<a-col :lg="12" :md="12" :sm="24" :xl="
|
|
10
|
+
<a-col :lg="12" :md="12" :sm="24" :xl="18" :xs="24">
|
|
11
11
|
<a-form-model
|
|
12
12
|
ref="businessCreateForm"
|
|
13
13
|
:label-col="labelCol"
|
|
@@ -23,6 +23,24 @@
|
|
|
23
23
|
</a-form-model-item>
|
|
24
24
|
<a-form-model-item label="数据字段" prop="column">
|
|
25
25
|
<a-button type="primary" @click="addColumnItem()">增加</a-button>
|
|
26
|
+
<a-row :gutter="24">
|
|
27
|
+
<a-col :span="11">
|
|
28
|
+
<span style="font-weight: bold">
|
|
29
|
+
标签名
|
|
30
|
+
</span>
|
|
31
|
+
</a-col>
|
|
32
|
+
<a-col :span="11">
|
|
33
|
+
<span style="font-weight: bold">
|
|
34
|
+
字段名
|
|
35
|
+
</span>
|
|
36
|
+
</a-col>
|
|
37
|
+
<a-col :span="2">
|
|
38
|
+
<span style="font-weight: bold">
|
|
39
|
+
操作
|
|
40
|
+
</span>
|
|
41
|
+
</a-col>
|
|
42
|
+
</a-row>
|
|
43
|
+
<a-divider style="margin: 6px 0" />
|
|
26
44
|
<div
|
|
27
45
|
v-for="(columnItem, index) in form.column"
|
|
28
46
|
:key="index"
|
|
@@ -36,13 +54,20 @@
|
|
|
36
54
|
<span class="dragTips">拖到此处放置</span>
|
|
37
55
|
</a-row>
|
|
38
56
|
<a-row :gutter="24">
|
|
39
|
-
<a-col :span="
|
|
40
|
-
<span style="font-weight: bold">
|
|
57
|
+
<a-col :span="11">
|
|
58
|
+
<span style="font-weight: bold">
|
|
59
|
+
{{ columnItem.title }}
|
|
60
|
+
</span>
|
|
41
61
|
</a-col>
|
|
42
|
-
<a-col :span="
|
|
62
|
+
<a-col :span="11">
|
|
63
|
+
<span style="font-weight: bold">
|
|
64
|
+
{{ columnItem.key }}
|
|
65
|
+
</span>
|
|
66
|
+
</a-col>
|
|
67
|
+
<a-col :span="1">
|
|
43
68
|
<a-icon type="edit" @click="editColumnItem(columnItem.key,index)"/>
|
|
44
69
|
</a-col>
|
|
45
|
-
<a-col :span="
|
|
70
|
+
<a-col :span="1">
|
|
46
71
|
<a-icon type="close" @click="removeColumnItem(columnItem.key,index)"/>
|
|
47
72
|
</a-col>
|
|
48
73
|
</a-row>
|
|
@@ -80,7 +105,7 @@
|
|
|
80
105
|
<create-simple-form-query-item ref="queryItem" @getColumn="getColumn" @itemHandle="itemHandle"/>
|
|
81
106
|
<a-button type="primary" @click="view">操作</a-button>
|
|
82
107
|
</a-col>
|
|
83
|
-
<a-col :lg="12" :md="12" :sm="24" :xl="
|
|
108
|
+
<a-col :lg="12" :md="12" :sm="24" :xl="6" :xs="24">
|
|
84
109
|
<a-card :bordered="false" size="small" style="overflow: auto" title="预览">
|
|
85
110
|
<json-viewer
|
|
86
111
|
:copyable="{copyText: '复制', copiedText: '已复制'}"
|
|
@@ -91,10 +116,7 @@
|
|
|
91
116
|
</a-col>
|
|
92
117
|
</a-row>
|
|
93
118
|
<x-add-form
|
|
94
|
-
|
|
95
|
-
business-type="新增"
|
|
96
|
-
:visible.sync="modelVisible"
|
|
97
|
-
:json-data="formItems"
|
|
119
|
+
ref="xAddForm"
|
|
98
120
|
@onSubmit="submit"/>
|
|
99
121
|
</a-drawer>
|
|
100
122
|
</template>
|
|
@@ -118,12 +140,10 @@ export default {
|
|
|
118
140
|
return {
|
|
119
141
|
// 页面宽度
|
|
120
142
|
screenWidth: document.documentElement.clientWidth,
|
|
121
|
-
// 效果预览模态框是否展示
|
|
122
|
-
modelVisible: false,
|
|
123
143
|
// 数据列操作类型:新增,修改
|
|
124
144
|
type: '新增',
|
|
125
|
-
labelCol: { span:
|
|
126
|
-
wrapperCol: { span:
|
|
145
|
+
labelCol: { span: 3 },
|
|
146
|
+
wrapperCol: { span: 18 },
|
|
127
147
|
form: {
|
|
128
148
|
group: '',
|
|
129
149
|
describe: '',
|
|
@@ -152,8 +172,7 @@ export default {
|
|
|
152
172
|
{ label: '获取行信息后插槽', value: 'editQueryAfter' },
|
|
153
173
|
{ label: '新增/修改保存前插槽', value: 'addOrEditSaveBefore' },
|
|
154
174
|
{ label: '新增/修改保存后插槽', value: 'addOrEditSaveAfter' },
|
|
155
|
-
]
|
|
156
|
-
formItems: []
|
|
175
|
+
]
|
|
157
176
|
}
|
|
158
177
|
},
|
|
159
178
|
mounted () {
|
|
@@ -266,9 +285,6 @@ export default {
|
|
|
266
285
|
onClose () {
|
|
267
286
|
this.$emit('update:visible', false)
|
|
268
287
|
},
|
|
269
|
-
onModelClose () {
|
|
270
|
-
this.modelVisible = false
|
|
271
|
-
},
|
|
272
288
|
addJoinItem () {
|
|
273
289
|
},
|
|
274
290
|
removeJoinItem (index) {
|
|
@@ -358,15 +374,20 @@ export default {
|
|
|
358
374
|
if (valid) {
|
|
359
375
|
this.viewHandle(() => {
|
|
360
376
|
post(commonApi.getColumnsJson, { queryObject: this.result }).then(res => {
|
|
361
|
-
this.
|
|
362
|
-
|
|
377
|
+
this.$refs.xAddForm.init({
|
|
378
|
+
formItems: res.formJson,
|
|
379
|
+
serviceName: res.serviceName
|
|
380
|
+
})
|
|
381
|
+
this.$refs.xAddForm.open({
|
|
382
|
+
businessType: '新增',
|
|
383
|
+
title: '效果预览'
|
|
384
|
+
})
|
|
363
385
|
})
|
|
364
386
|
})
|
|
365
387
|
}
|
|
366
388
|
})
|
|
367
389
|
},
|
|
368
390
|
submit () {
|
|
369
|
-
this.onModelClose()
|
|
370
391
|
this.$refs.businessCreateForm.validate(valid => {
|
|
371
392
|
if (valid) {
|
|
372
393
|
this.viewHandle(() => {
|
|
@@ -7,13 +7,8 @@
|
|
|
7
7
|
@close="onClose"
|
|
8
8
|
>
|
|
9
9
|
<x-add-form
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
:visible.sync="editQueryVisible"
|
|
13
|
-
:json-data="formObj.formJson"
|
|
14
|
-
:modify-model-data="modifyModelDataItem"
|
|
15
|
-
:loading="loading"
|
|
16
|
-
@onSubmit="submit"/>
|
|
10
|
+
ref="xAddForm"
|
|
11
|
+
@onSubmit="onAddOrEditSubmit"/>
|
|
17
12
|
<a-list
|
|
18
13
|
:grid="{gutter: 24, lg: 4, md: 3, sm: 1, xs: 1}"
|
|
19
14
|
:dataSource="columnJson.groups"
|
|
@@ -45,18 +40,11 @@ export default {
|
|
|
45
40
|
return {
|
|
46
41
|
// 页面宽度
|
|
47
42
|
screenWidth: document.documentElement.clientWidth,
|
|
48
|
-
// 是否显示参数下发抽屉
|
|
49
|
-
editQueryVisible: false,
|
|
50
|
-
targetIndex: 0,
|
|
51
43
|
columnJson: {},
|
|
52
|
-
editIndex: -1,
|
|
53
44
|
formObj: {
|
|
54
45
|
groupName: '',
|
|
55
46
|
formJson: []
|
|
56
|
-
}
|
|
57
|
-
modifyModelDataItem: {},
|
|
58
|
-
// 参数设置业务执行状态
|
|
59
|
-
loading: false
|
|
47
|
+
}
|
|
60
48
|
}
|
|
61
49
|
},
|
|
62
50
|
mounted () {
|
|
@@ -94,36 +82,37 @@ export default {
|
|
|
94
82
|
toEdit (item) {
|
|
95
83
|
post(commonApi.getColumnsJson, { queryObject: item }).then(res => {
|
|
96
84
|
this.formObj = res
|
|
97
|
-
this.
|
|
98
|
-
|
|
85
|
+
this.$refs.xAddForm.init({
|
|
86
|
+
formItems: res.formJson,
|
|
87
|
+
serviceName: res.serviceName
|
|
88
|
+
})
|
|
89
|
+
const modifyModelData = { data: this.modifyModelData[res.groupName] }
|
|
90
|
+
this.$refs.xAddForm.open({
|
|
91
|
+
businessType: '修改',
|
|
92
|
+
modifyModelData: modifyModelData,
|
|
93
|
+
title: '参数项'
|
|
94
|
+
})
|
|
99
95
|
})
|
|
100
96
|
},
|
|
101
97
|
onClose () {
|
|
102
98
|
this.$emit('update:visible', false)
|
|
103
99
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
requestParameters.paramsJson[this.formObj.groupName] =
|
|
111
|
-
for (const key of Object.keys(res.form)) {
|
|
112
|
-
const realKey = key.substring(key.indexOf('_') + 1)
|
|
113
|
-
requestParameters.paramsJson[this.formObj.groupName][realKey] = res.form[key]
|
|
114
|
-
}
|
|
115
|
-
this.$emit('onSubmit', requestParameters, result => {
|
|
116
|
-
if (result) {
|
|
117
|
-
this.$message.success('参数设置成功!')
|
|
118
|
-
} else {
|
|
119
|
-
this.$message.error('参数设置失败!')
|
|
120
|
-
}
|
|
121
|
-
this.loading = false
|
|
122
|
-
this.editQueryVisible = false
|
|
123
|
-
})
|
|
124
|
-
} else {
|
|
125
|
-
return false
|
|
100
|
+
onAddOrEditSubmit (res, callback) {
|
|
101
|
+
const requestParameters = {
|
|
102
|
+
paramsJson: {}
|
|
103
|
+
}
|
|
104
|
+
requestParameters.paramsJson[this.formObj.groupName] = {}
|
|
105
|
+
for (const key of Object.keys(res.form)) {
|
|
106
|
+
requestParameters.paramsJson[this.formObj.groupName][key] = res.form[key]
|
|
126
107
|
}
|
|
108
|
+
this.$emit('onSubmit', requestParameters, result => {
|
|
109
|
+
if (result) {
|
|
110
|
+
this.$message.success('参数设置成功!')
|
|
111
|
+
} else {
|
|
112
|
+
this.$message.error('参数设置失败!')
|
|
113
|
+
}
|
|
114
|
+
callback()
|
|
115
|
+
})
|
|
127
116
|
}
|
|
128
117
|
}
|
|
129
118
|
}
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormItem'
|
|
40
40
|
import { formatDate } from '@vue2-client/utils/util'
|
|
41
41
|
import { mapState } from 'vuex'
|
|
42
|
-
import {
|
|
42
|
+
import { post } from '@vue2-client/services/api'
|
|
43
43
|
|
|
44
44
|
export default {
|
|
45
45
|
name: 'XAddForm',
|
|
@@ -52,8 +52,6 @@ export default {
|
|
|
52
52
|
viewMode: false,
|
|
53
53
|
// 是否展示
|
|
54
54
|
isShow: false,
|
|
55
|
-
// 查询配置文件名
|
|
56
|
-
queryParamsName: '',
|
|
57
55
|
// 内容加载是否完成
|
|
58
56
|
loaded: false,
|
|
59
57
|
// 业务类型
|
|
@@ -105,13 +103,12 @@ export default {
|
|
|
105
103
|
},
|
|
106
104
|
methods: {
|
|
107
105
|
init (params) {
|
|
108
|
-
const { isShow = true, formItems, viewMode, isTableTemp,
|
|
106
|
+
const { isShow = true, formItems, viewMode, isTableTemp, serviceName = 'af-system' } = params
|
|
109
107
|
if (isShow) {
|
|
110
108
|
this.isShow = true
|
|
111
109
|
this.formItems = JSON.parse(JSON.stringify(formItems))
|
|
112
110
|
this.viewMode = viewMode
|
|
113
111
|
this.isTableTemp = isTableTemp
|
|
114
|
-
this.queryParamsName = queryParamsName
|
|
115
112
|
this.serviceName = serviceName
|
|
116
113
|
}
|
|
117
114
|
},
|
|
@@ -251,24 +248,18 @@ export default {
|
|
|
251
248
|
})
|
|
252
249
|
return
|
|
253
250
|
}
|
|
254
|
-
//
|
|
255
|
-
const
|
|
256
|
-
queryParamsName: this.queryParamsName,
|
|
257
|
-
form: {},
|
|
258
|
-
businessType: this.businessType,
|
|
259
|
-
operator: this.currUser.name
|
|
260
|
-
}
|
|
251
|
+
// 处理表单键问题
|
|
252
|
+
const realForm = {}
|
|
261
253
|
for (const key of Object.keys(requestForm)) {
|
|
262
254
|
const realKey = this.getRealKey(key)
|
|
263
|
-
|
|
255
|
+
realForm[realKey] = requestForm[key]
|
|
264
256
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}).finally(() => {
|
|
257
|
+
// 交由父级处理
|
|
258
|
+
this.$emit('onSubmit', {
|
|
259
|
+
businessType: this.businessType,
|
|
260
|
+
realForm: realForm,
|
|
261
|
+
currUserName: this.currUser.name
|
|
262
|
+
}, () => {
|
|
272
263
|
this.close()
|
|
273
264
|
})
|
|
274
265
|
})
|
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
3
|
+
<a-skeleton :loading="loading" :paragraph="{ rows: 4 }" />
|
|
4
|
+
<div v-show="!loading">
|
|
5
|
+
<x-add-form
|
|
6
|
+
ref="xAddForm"
|
|
7
|
+
@onSubmit="onAddOrEditSubmit"
|
|
8
|
+
/>
|
|
9
|
+
<x-form
|
|
10
|
+
ref="xForm"
|
|
11
|
+
style="margin-bottom: 14px;"
|
|
12
|
+
@onSubmit="onSearchSubmit">
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</x-form>
|
|
15
|
+
<x-table
|
|
16
|
+
ref="xTable"
|
|
17
|
+
:fixedQueryForm="fixedQueryForm"
|
|
18
|
+
:queryParamsName="queryParamsName"
|
|
19
|
+
:query-params-json="queryParamsJson"
|
|
20
|
+
:show-pagination="showPagination"
|
|
21
|
+
@add="add"
|
|
22
|
+
@edit="edit"
|
|
23
|
+
@afterDelete="afterDelete"
|
|
24
|
+
@action="action"
|
|
25
|
+
@selectRow="selectRow"
|
|
26
|
+
@afterQuery="afterQuery"
|
|
27
|
+
@tempTableEdit="tempTableEdit">
|
|
28
|
+
<template slot="expand">
|
|
29
|
+
<slot name="expand"></slot>
|
|
30
|
+
</template>
|
|
31
|
+
<template slot="rightBtnExpand">
|
|
32
|
+
<slot name="rightBtnExpand"></slot>
|
|
33
|
+
<a-button @click="toggleIsFormShow">
|
|
34
|
+
<a-icon :style="iconStyle" type="vertical-align-top"/>
|
|
35
|
+
</a-button>
|
|
36
|
+
</template>
|
|
37
|
+
<!-- 底部插槽 -->
|
|
38
|
+
<template slot="footer">
|
|
39
|
+
<slot name="footer"></slot>
|
|
40
|
+
</template>
|
|
41
|
+
</x-table>
|
|
42
|
+
</div>
|
|
40
43
|
</div>
|
|
41
44
|
</template>
|
|
42
45
|
<script>
|
|
@@ -44,7 +47,7 @@ import XForm from '@vue2-client/base-client/components/common/XForm'
|
|
|
44
47
|
import XAddForm from '@vue2-client/base-client/components/common/XAddForm'
|
|
45
48
|
import XTable from '@vue2-client/base-client/components/common/XTable'
|
|
46
49
|
import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
|
|
47
|
-
import { commonApi } from '@vue2-client/services/api/common'
|
|
50
|
+
import { addOrModify, commonApi } from '@vue2-client/services/api/common'
|
|
48
51
|
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
49
52
|
import { mapState } from 'vuex'
|
|
50
53
|
import { post } from '@vue2-client/services/api/restTools'
|
|
@@ -59,6 +62,8 @@ export default {
|
|
|
59
62
|
},
|
|
60
63
|
data () {
|
|
61
64
|
return {
|
|
65
|
+
// 加载状态
|
|
66
|
+
loading: false,
|
|
62
67
|
// 图标样式
|
|
63
68
|
iconStyle: {
|
|
64
69
|
position: 'relative',
|
|
@@ -131,7 +136,7 @@ export default {
|
|
|
131
136
|
},
|
|
132
137
|
fixedQueryForm: {
|
|
133
138
|
handler () {
|
|
134
|
-
this
|
|
139
|
+
this.refreshTable(true)
|
|
135
140
|
},
|
|
136
141
|
deep: true
|
|
137
142
|
},
|
|
@@ -156,16 +161,19 @@ export default {
|
|
|
156
161
|
},
|
|
157
162
|
methods: {
|
|
158
163
|
getColumnsJson () {
|
|
164
|
+
this.loading = true
|
|
159
165
|
indexedDB.getByWeb(this.queryParamsName, commonApi.getColumnsJson, { str: this.queryParamsName }, (res) => {
|
|
160
166
|
this.updateComponents(res)
|
|
161
167
|
})
|
|
162
168
|
},
|
|
163
169
|
getColumnsJsonBySource () {
|
|
170
|
+
this.loading = true
|
|
164
171
|
post(commonApi.getColumnsJson, { queryObject: this.queryParamsJson }).then(res => {
|
|
165
172
|
this.updateComponents(res, true)
|
|
166
173
|
})
|
|
167
174
|
},
|
|
168
175
|
getColumnJsonByLogic () {
|
|
176
|
+
this.loading = true
|
|
169
177
|
indexedDB.getByWeb(`${this.logicName}_${JSON.stringify(this.logicParam)}`, commonApi.getColumnsJson, { logic: this.logicName, logicParam: this.logicParam }, (res) => {
|
|
170
178
|
this.updateComponents(res, true)
|
|
171
179
|
})
|
|
@@ -194,9 +202,9 @@ export default {
|
|
|
194
202
|
formItems: res.formJson,
|
|
195
203
|
viewMode: this.viewMode,
|
|
196
204
|
isTableTemp: this.isTableTemp,
|
|
197
|
-
queryParamsName: this.queryParamsName,
|
|
198
205
|
serviceName: res.serviceName
|
|
199
206
|
})
|
|
207
|
+
this.loading = false
|
|
200
208
|
},
|
|
201
209
|
/**
|
|
202
210
|
* 提交查询表单事件
|
|
@@ -213,11 +221,26 @@ export default {
|
|
|
213
221
|
}
|
|
214
222
|
},
|
|
215
223
|
/**
|
|
216
|
-
*
|
|
217
|
-
* @param res 参数
|
|
224
|
+
* 提交新增表单事件
|
|
218
225
|
*/
|
|
219
|
-
|
|
220
|
-
|
|
226
|
+
onAddOrEditSubmit (res, callback) {
|
|
227
|
+
// 组织请求
|
|
228
|
+
const requestParameters = {
|
|
229
|
+
queryParamsName: this.queryParamsName,
|
|
230
|
+
form: res.realForm,
|
|
231
|
+
businessType: res.businessType,
|
|
232
|
+
operator: res.currUserName
|
|
233
|
+
}
|
|
234
|
+
addOrModify(requestParameters, this.serviceName).then(data => {
|
|
235
|
+
this.$message.success(res.businessType + '成功!')
|
|
236
|
+
this.refreshTable(res.businessType === '新增')
|
|
237
|
+
// commit
|
|
238
|
+
this.$emit('afterSubmit', { type: res.businessType, id: data.id, form: requestParameters.form })
|
|
239
|
+
}).catch(e => {
|
|
240
|
+
this.$message.error(res.businessType + '失败:' + e)
|
|
241
|
+
}).finally(() => {
|
|
242
|
+
callback()
|
|
243
|
+
})
|
|
221
244
|
},
|
|
222
245
|
/**
|
|
223
246
|
* 表格查询后事件
|
|
@@ -283,7 +306,14 @@ export default {
|
|
|
283
306
|
*/
|
|
284
307
|
tempTableEdit (res) {
|
|
285
308
|
this.$emit('tempTableEdit', res)
|
|
286
|
-
}
|
|
309
|
+
},
|
|
310
|
+
/**
|
|
311
|
+
* 刷新表格
|
|
312
|
+
* @param toFirstPage 是否到第一页
|
|
313
|
+
*/
|
|
314
|
+
refreshTable (toFirstPage = true) {
|
|
315
|
+
this.$refs.xTable.refresh(toFirstPage)
|
|
316
|
+
},
|
|
287
317
|
}
|
|
288
318
|
}
|
|
289
319
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div v-show="tableColumns.length > 0">
|
|
3
3
|
<a-row :gutter="48">
|
|
4
4
|
<a-col>
|
|
5
5
|
<span :style="{ float: 'left', overflow: 'hidden', marginBottom: '8px' }">
|
|
@@ -230,6 +230,9 @@ export default {
|
|
|
230
230
|
} = params
|
|
231
231
|
this.queryParams = queryParams
|
|
232
232
|
this.tableColumns = JSON.parse(JSON.stringify(tableColumns))
|
|
233
|
+
if (this.tableColumns.length === 0) {
|
|
234
|
+
return
|
|
235
|
+
}
|
|
233
236
|
this.buttonState = buttonState
|
|
234
237
|
this.title = title
|
|
235
238
|
this.serviceName = serviceName
|