vue2-client 1.6.0 → 1.6.1
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 +1 -6
- package/package.json +1 -1
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +667 -672
- package/src/base-client/components/common/XAddForm/XAddForm.vue +324 -328
- package/src/base-client/components/common/XForm/XForm.vue +194 -190
- package/src/base-client/components/common/XForm/XFormItem.vue +521 -520
- package/src/base-client/components/common/XFormTable/XFormTable.vue +333 -289
- package/src/base-client/components/common/XFormTable/index.md +97 -105
- package/src/base-client/components/common/XImportExcel/XImportExcel.vue +131 -132
- package/src/base-client/components/common/XTable/XTable.vue +505 -505
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -229
- package/src/pages/system/dictionary/index.vue +43 -46
- package/src/pages/system/monitor/loginInfor/index.vue +36 -39
- package/src/pages/system/monitor/operLog/index.vue +36 -38
- package/src/pages/system/queryParams/index.vue +43 -46
- package/src/pages/system/ticket/index.vue +450 -453
|
@@ -1,289 +1,333 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<a-skeleton :loading="loading" :paragraph="{ rows: 4 }" />
|
|
4
|
-
<div v-show="!loading">
|
|
5
|
-
<x-add-form
|
|
6
|
-
ref="xAddForm"
|
|
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
|
-
</template>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
import
|
|
49
|
-
import
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
this.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
/**
|
|
191
|
-
*
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
this
|
|
244
|
-
businessType
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
*
|
|
258
|
-
*/
|
|
259
|
-
|
|
260
|
-
this.$
|
|
261
|
-
},
|
|
262
|
-
/**
|
|
263
|
-
*
|
|
264
|
-
* @param
|
|
265
|
-
* @param
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
*
|
|
273
|
-
*/
|
|
274
|
-
|
|
275
|
-
this.$
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<a-skeleton :loading="loading" :paragraph="{ rows: 4 }" />
|
|
4
|
+
<div v-show="!loading">
|
|
5
|
+
<x-add-form
|
|
6
|
+
ref="xAddForm"
|
|
7
|
+
:get-data-params="getDataParams"
|
|
8
|
+
@onSubmit="onAddOrEditSubmit"
|
|
9
|
+
/>
|
|
10
|
+
<x-form
|
|
11
|
+
ref="xForm"
|
|
12
|
+
:get-data-params="getDataParams"
|
|
13
|
+
style="margin-bottom: 14px;"
|
|
14
|
+
@onSubmit="onSearchSubmit">
|
|
15
|
+
<slot name="formBtnExpand"></slot>
|
|
16
|
+
</x-form>
|
|
17
|
+
<x-table
|
|
18
|
+
ref="xTable"
|
|
19
|
+
:fixedQueryForm="fixedQueryForm"
|
|
20
|
+
:queryParamsName="queryParamsName"
|
|
21
|
+
:query-params-json="queryParamsJson"
|
|
22
|
+
:show-pagination="showPagination"
|
|
23
|
+
@add="add"
|
|
24
|
+
@edit="edit"
|
|
25
|
+
@afterDelete="afterDelete"
|
|
26
|
+
@action="action"
|
|
27
|
+
@selectRow="selectRow"
|
|
28
|
+
@afterQuery="afterQuery"
|
|
29
|
+
@tempTableEdit="tempTableEdit">
|
|
30
|
+
<template slot="button" slot-scope="{selectedRowKeys, selectedRows}">
|
|
31
|
+
<slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
|
|
32
|
+
</template>
|
|
33
|
+
<template slot="rightBtnExpand" slot-scope="{selectedRowKeys, selectedRows}">
|
|
34
|
+
<slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
|
|
35
|
+
<a-button @click="toggleIsFormShow">
|
|
36
|
+
<a-icon :style="iconStyle" type="vertical-align-top"/>
|
|
37
|
+
</a-button>
|
|
38
|
+
</template>
|
|
39
|
+
<!-- 底部插槽 -->
|
|
40
|
+
<template slot="footer" slot-scope="{selectedRowKeys, selectedRows}">
|
|
41
|
+
<slot name="footer" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
|
|
42
|
+
</template>
|
|
43
|
+
</x-table>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
<script>
|
|
48
|
+
import XForm from '@vue2-client/base-client/components/common/XForm'
|
|
49
|
+
import XAddForm from '@vue2-client/base-client/components/common/XAddForm'
|
|
50
|
+
import XTable from '@vue2-client/base-client/components/common/XTable'
|
|
51
|
+
import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
|
|
52
|
+
import { addOrModify, commonApi } from '@vue2-client/services/api/common'
|
|
53
|
+
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
54
|
+
import { mapState } from 'vuex'
|
|
55
|
+
import { post } from '@vue2-client/services/api/restTools'
|
|
56
|
+
|
|
57
|
+
export default {
|
|
58
|
+
name: 'XFormTable',
|
|
59
|
+
components: {
|
|
60
|
+
XTable,
|
|
61
|
+
XForm,
|
|
62
|
+
XAddForm,
|
|
63
|
+
XImportExcel
|
|
64
|
+
},
|
|
65
|
+
data () {
|
|
66
|
+
return {
|
|
67
|
+
// 加载状态
|
|
68
|
+
loading: false,
|
|
69
|
+
// 图标样式
|
|
70
|
+
iconStyle: {
|
|
71
|
+
position: 'relative',
|
|
72
|
+
top: '1px'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
computed: {
|
|
77
|
+
...mapState('setting', ['isMobile'])
|
|
78
|
+
},
|
|
79
|
+
props: {
|
|
80
|
+
// 业务名称
|
|
81
|
+
title: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: ''
|
|
84
|
+
},
|
|
85
|
+
// 查询配置文件名
|
|
86
|
+
queryParamsName: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: null
|
|
89
|
+
},
|
|
90
|
+
// 查询配置文件Json,用于查询配置生成器的预览
|
|
91
|
+
queryParamsJson: {
|
|
92
|
+
type: Object,
|
|
93
|
+
default: null
|
|
94
|
+
},
|
|
95
|
+
// 业务逻辑名称, 通过logic获取表单表格配置
|
|
96
|
+
logicName: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: null
|
|
99
|
+
},
|
|
100
|
+
// 执行logic传递的参数
|
|
101
|
+
logicParam: {
|
|
102
|
+
type: Object,
|
|
103
|
+
default: () => {}
|
|
104
|
+
},
|
|
105
|
+
// 固定新增表单
|
|
106
|
+
fixedAddForm: {
|
|
107
|
+
type: Object,
|
|
108
|
+
default: () => {
|
|
109
|
+
return {}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
// 固定查询表单
|
|
113
|
+
fixedQueryForm: {
|
|
114
|
+
type: Object,
|
|
115
|
+
default: () => {
|
|
116
|
+
return {}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
// 预览模式
|
|
120
|
+
viewMode: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: () => {
|
|
123
|
+
return false
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
// 数据只有一页时是否展示分页,true:展示,auto:隐藏
|
|
127
|
+
showPagination: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: true
|
|
130
|
+
},
|
|
131
|
+
// 调用logic获取数据源的追加参数
|
|
132
|
+
getDataParams: {
|
|
133
|
+
type: Object,
|
|
134
|
+
default: undefined
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
watch: {
|
|
138
|
+
logicParam: {
|
|
139
|
+
handler () {
|
|
140
|
+
this.getColumnJsonByLogic()
|
|
141
|
+
},
|
|
142
|
+
deep: true
|
|
143
|
+
},
|
|
144
|
+
fixedQueryForm: {
|
|
145
|
+
handler () {
|
|
146
|
+
this.$nextTick(() => {
|
|
147
|
+
this.refreshTable(true)
|
|
148
|
+
})
|
|
149
|
+
},
|
|
150
|
+
deep: true
|
|
151
|
+
},
|
|
152
|
+
queryParamsJson: {
|
|
153
|
+
handler () {
|
|
154
|
+
this.getColumnsJsonBySource()
|
|
155
|
+
},
|
|
156
|
+
deep: true
|
|
157
|
+
},
|
|
158
|
+
queryParamsName: {
|
|
159
|
+
handler () {
|
|
160
|
+
this.getColumnsJson()
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
created () {
|
|
165
|
+
if (this.queryParamsName) {
|
|
166
|
+
this.getColumnsJson()
|
|
167
|
+
} else if (this.queryParamsJson) {
|
|
168
|
+
this.getColumnsJsonBySource()
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
methods: {
|
|
172
|
+
getColumnsJson () {
|
|
173
|
+
this.loading = true
|
|
174
|
+
indexedDB.getByWeb(this.queryParamsName, commonApi.getColumnsJson, { str: this.queryParamsName }, (res) => {
|
|
175
|
+
this.updateComponents(res)
|
|
176
|
+
})
|
|
177
|
+
},
|
|
178
|
+
getColumnsJsonBySource () {
|
|
179
|
+
this.loading = true
|
|
180
|
+
post(commonApi.getColumnsJson, { queryObject: this.queryParamsJson }).then(res => {
|
|
181
|
+
this.updateComponents(res, true)
|
|
182
|
+
})
|
|
183
|
+
},
|
|
184
|
+
getColumnJsonByLogic () {
|
|
185
|
+
this.loading = true
|
|
186
|
+
indexedDB.getByWeb(`${this.logicName}_${JSON.stringify(this.logicParam)}`, commonApi.getColumnsJson, { logic: this.logicName, logicParam: this.logicParam }, (res) => {
|
|
187
|
+
this.updateComponents(res, true)
|
|
188
|
+
})
|
|
189
|
+
},
|
|
190
|
+
/**
|
|
191
|
+
* 更新子组件
|
|
192
|
+
* @param res 参数
|
|
193
|
+
* @param setQueryParams 是否设置queryParams参数
|
|
194
|
+
*/
|
|
195
|
+
updateComponents (res, setQueryParams) {
|
|
196
|
+
this.$refs.xTable.init({
|
|
197
|
+
queryParams: setQueryParams ? res : null,
|
|
198
|
+
tableColumns: res.columnJson,
|
|
199
|
+
buttonState: res.buttonState,
|
|
200
|
+
title: this.title,
|
|
201
|
+
viewMode: this.viewMode,
|
|
202
|
+
isTableTemp: this.isTableTemp,
|
|
203
|
+
serviceName: res.serviceName
|
|
204
|
+
})
|
|
205
|
+
this.$refs.xForm.init({
|
|
206
|
+
formItems: res.formJson,
|
|
207
|
+
serviceName: res.serviceName
|
|
208
|
+
})
|
|
209
|
+
this.$refs.xAddForm.init({
|
|
210
|
+
isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
|
|
211
|
+
formItems: res.formJson,
|
|
212
|
+
viewMode: this.viewMode,
|
|
213
|
+
isTableTemp: this.isTableTemp,
|
|
214
|
+
serviceName: res.serviceName
|
|
215
|
+
})
|
|
216
|
+
this.loading = false
|
|
217
|
+
},
|
|
218
|
+
/**
|
|
219
|
+
* 提交查询表单事件
|
|
220
|
+
* @param res 参数
|
|
221
|
+
*/
|
|
222
|
+
onSearchSubmit (res) {
|
|
223
|
+
if (res.valid) {
|
|
224
|
+
// 表单赋值
|
|
225
|
+
this.$refs.xTable.setQueryForm(res.form)
|
|
226
|
+
// commit
|
|
227
|
+
this.$emit('afterSearchSubmit', res)
|
|
228
|
+
} else {
|
|
229
|
+
return false
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
/**
|
|
233
|
+
* 提交新增表单事件
|
|
234
|
+
*/
|
|
235
|
+
onAddOrEditSubmit (res, callback) {
|
|
236
|
+
// 组织请求
|
|
237
|
+
const requestParameters = {
|
|
238
|
+
queryParamsName: this.queryParamsName,
|
|
239
|
+
form: res.realForm,
|
|
240
|
+
businessType: res.businessType,
|
|
241
|
+
operator: res.currUserName
|
|
242
|
+
}
|
|
243
|
+
addOrModify(requestParameters, this.serviceName).then(data => {
|
|
244
|
+
this.$message.success(res.businessType + '成功!')
|
|
245
|
+
this.refreshTable(res.businessType === '新增')
|
|
246
|
+
// commit
|
|
247
|
+
this.$emit('afterSubmit', { type: res.businessType, id: data.id, form: requestParameters.form })
|
|
248
|
+
}).catch(e => {
|
|
249
|
+
this.$message.error(res.businessType + '失败:' + e)
|
|
250
|
+
}).finally(() => {
|
|
251
|
+
callback()
|
|
252
|
+
})
|
|
253
|
+
},
|
|
254
|
+
/**
|
|
255
|
+
* 表格查询后事件
|
|
256
|
+
* @param res 参数
|
|
257
|
+
* @param conditionParams 查询条件
|
|
258
|
+
*/
|
|
259
|
+
afterQuery (res, conditionParams) {
|
|
260
|
+
this.$emit('afterQuery', res, conditionParams)
|
|
261
|
+
},
|
|
262
|
+
/**
|
|
263
|
+
* 详情按钮事件
|
|
264
|
+
* @param record 本条数据
|
|
265
|
+
* @param id 数据标识
|
|
266
|
+
* @param actionType 操作类型
|
|
267
|
+
*/
|
|
268
|
+
action (record, id, actionType) {
|
|
269
|
+
this.$emit('action', record, id, actionType)
|
|
270
|
+
},
|
|
271
|
+
/**
|
|
272
|
+
* 新增按钮事件
|
|
273
|
+
*/
|
|
274
|
+
add () {
|
|
275
|
+
this.$refs.xAddForm.open({
|
|
276
|
+
businessType: '新增',
|
|
277
|
+
title: this.title,
|
|
278
|
+
fixedAddForm: this.fixedAddForm
|
|
279
|
+
})
|
|
280
|
+
},
|
|
281
|
+
/**
|
|
282
|
+
* 修改按钮事件
|
|
283
|
+
* @param res 参数
|
|
284
|
+
*/
|
|
285
|
+
edit (res) {
|
|
286
|
+
this.$refs.xAddForm.open({
|
|
287
|
+
businessType: '修改',
|
|
288
|
+
modifyModelData: res,
|
|
289
|
+
title: this.title,
|
|
290
|
+
fixedAddForm: this.fixedAddForm
|
|
291
|
+
})
|
|
292
|
+
},
|
|
293
|
+
/**
|
|
294
|
+
* 删除后事件
|
|
295
|
+
* @param res
|
|
296
|
+
*/
|
|
297
|
+
afterDelete (res) {
|
|
298
|
+
this.$emit('afterDelete', res)
|
|
299
|
+
},
|
|
300
|
+
/**
|
|
301
|
+
* 查询表单部分显示/隐藏切换
|
|
302
|
+
*/
|
|
303
|
+
toggleIsFormShow () {
|
|
304
|
+
this.$refs.xForm.toggleVisible()
|
|
305
|
+
},
|
|
306
|
+
/**
|
|
307
|
+
* 选择列事件
|
|
308
|
+
* @param selectedRowKeys 选中列Key集合
|
|
309
|
+
* @param selectedRows 选中列
|
|
310
|
+
*/
|
|
311
|
+
selectRow (selectedRowKeys, selectedRows) {
|
|
312
|
+
this.$emit('selectRow', selectedRowKeys, selectedRows)
|
|
313
|
+
},
|
|
314
|
+
/**
|
|
315
|
+
* 临时表修改
|
|
316
|
+
* @param res 参数
|
|
317
|
+
*/
|
|
318
|
+
tempTableEdit (res) {
|
|
319
|
+
this.$emit('tempTableEdit', res)
|
|
320
|
+
},
|
|
321
|
+
/**
|
|
322
|
+
* 刷新表格
|
|
323
|
+
* @param toFirstPage 是否到第一页
|
|
324
|
+
*/
|
|
325
|
+
refreshTable (toFirstPage = true) {
|
|
326
|
+
this.$refs.xTable.refresh(toFirstPage)
|
|
327
|
+
},
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
</script>
|
|
331
|
+
<style lang="less" scoped>
|
|
332
|
+
|
|
333
|
+
</style>
|