vue2-client 1.3.12 → 1.3.15

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 CHANGED
@@ -1,7 +1,14 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
- **1.3.3 - 1.3.12 -2022-09-09 @江超**
4
+ **1.3.15 -2022-09-13 @江超**
5
+ - 功能修改:
6
+ - 修复上传问题
7
+
8
+ **1.3.14 -2022-09-13 @苗艳强**
9
+ - 修复使用固定查询条件表单清空的问题
10
+
11
+ **1.3.3 - 1.3.13 -2022-09-09 @江超**
5
12
  - 功能修改:
6
13
  - 移除非基础业务组件
7
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.3.12",
3
+ "version": "1.3.15",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -90,7 +90,7 @@ export default {
90
90
  }
91
91
  // 初始化文件信息
92
92
  const fileInfo = {
93
- uid: info.file.uid,
93
+ uid: info.file.id,
94
94
  name: info.file.name,
95
95
  status: 'uploading',
96
96
  response: '',
@@ -124,9 +124,13 @@ export default {
124
124
  // 根据服务端返回的结果判断成功与否,设置文件条目的状态
125
125
  if (res.success) {
126
126
  fileInfo.status = 'done'
127
- fileInfo.response = JSON.parse(res.data)
128
- fileInfo.id = JSON.parse(res.data).id
129
- fileInfo.url = JSON.parse(res.data).f_downloadpath
127
+ let dataObj = res.data
128
+ if (dataObj instanceof String) {
129
+ dataObj = JSON.parse(dataObj)
130
+ }
131
+ fileInfo.response = dataObj
132
+ fileInfo.id = dataObj.id
133
+ fileInfo.url = dataObj.f_downloadpath
130
134
  this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
131
135
  this.$message.success('上传成功!')
132
136
  } else {
@@ -1,505 +1,505 @@
1
- <template>
2
- <a-skeleton :loading="mainLoading">
3
- <template v-if="loaded">
4
- <x-add-form
5
- :business-title="businessTitle"
6
- :business-type="businessType"
7
- :fixedAddForm="fixedAddForm"
8
- :json-data="formItems"
9
- :service-name="serviceName"
10
- :loading="loading"
11
- :modify-model-data="modifyModelData"
12
- :visible.sync="modelVisible"
13
- @onSubmit="onAddOrModify"/>
14
- <x-form
15
- :is-show="isFormShow"
16
- :json-data="formItems"
17
- :service-name="serviceName"
18
- style="margin-bottom: 14px;"
19
- @onSubmit="onSubmit">
20
- <slot></slot>
21
- </x-form>
22
- <x-table
23
- ref="xTable"
24
- :buttonState="buttonState"
25
- :fixedQueryForm="fixedQueryForm"
26
- :form="form"
27
- :json-data="tableColumns"
28
- :queryParams="queryParams"
29
- :queryParamsName="queryParamsName"
30
- :show-pagination="showPagination"
31
- @action="action"
32
- @loadData="loadData"
33
- @selectRow="selectRow"
34
- @toggleIsFormShow="toggleIsFormShow">
35
- <template slot="expand">
36
- <a-space>
37
- <a-button v-if="!buttonState || buttonState.add" type="primary" @click="addItem">
38
- <a-icon :style="iconStyle" type="plus"/>新增
39
- </a-button>
40
- <a-button
41
- v-if="!buttonState || buttonState.edit"
42
- :disabled="!isModify"
43
- :loading="editDataLoading"
44
- class="btn-success"
45
- type="dashed"
46
- @click="editItem">
47
- <a-icon :style="iconStyle" type="edit"/>修改
48
- </a-button>
49
- <a-button v-if="!buttonState || buttonState.delete" :disabled="!isDelete" type="danger" @click="deleteItem">
50
- <a-icon :style="iconStyle" type="delete"/>删除
51
- </a-button>
52
- <slot :selectedRowKeys="selectedRowKeys" name="button"></slot>
53
- </a-space>
54
- <slot name="expand"></slot>
55
- </template>
56
- </x-table>
57
- </template>
58
- </a-skeleton>
59
- </template>
60
- <script>
61
- import XForm from '@vue2-client/base-client/components/common/XForm/XForm'
62
- import XAddForm from '@vue2-client/base-client/components/common/XAddForm/XAddForm'
63
- import XTable from '@vue2-client/base-client/components/common/XTable/XTable'
64
- import { query, commonApi, addOrModify, remove, queryWithResource } from '@vue2-client/services/api/common'
65
- import { indexedDB } from '@vue2-client/utils/indexedDB'
66
- import { mapState } from 'vuex'
67
- import { Modal } from 'ant-design-vue'
68
- import { post } from '@vue2-client/services/api/restTools'
69
- import { CommonTempTable } from '@vue2-client/services/api/commonTempTable'
70
-
71
- export default {
72
- name: 'XFormTable',
73
- components: {
74
- XTable,
75
- XForm,
76
- XAddForm
77
- },
78
- data () {
79
- return {
80
- // Query参数文件内容加载中
81
- mainLoading: false,
82
- // Query参数文件内容加载完成
83
- loaded: false,
84
- // 是否展示表单
85
- isFormShow: true,
86
- // 当使用logic获取到表单表格配置时, 将配置对象直接传入到x-table用于查询
87
- queryParams: null,
88
- // 服务名称
89
- serviceName: 'af-system',
90
- // 表格列集合
91
- tableColumns: [],
92
- // 操作按钮集合
93
- buttonState: {},
94
- // 表格选择列Key集合
95
- selectedRowKeys: [],
96
- // 表单项集合
97
- formItems: [],
98
- // 表单
99
- form: {},
100
- // 图标样式
101
- iconStyle: {
102
- position: 'relative',
103
- top: '1px'
104
- },
105
- // 当前业务类型:新增,修改
106
- businessType: '',
107
- // 是否显示新增/修改模态框
108
- modelVisible: false,
109
- // 修改业务时查询的单条业务数据
110
- modifyModelData: {},
111
- // 是否允许修改
112
- isModify: false,
113
- // 是否允许删除
114
- isDelete: false,
115
- // 新增,修改业务执行状态
116
- loading: false,
117
- // 被修改数据加载状态
118
- editDataLoading: false,
119
- // 是否为临时表
120
- isTableTemp: false,
121
- // 自定义新增修改接口
122
- customAoM: undefined,
123
- // 自定义查询接口
124
- customQuery: undefined
125
- }
126
- },
127
- computed: {
128
- ...mapState('setting', ['isMobile']),
129
- businessTitle () {
130
- return this.businessType + this.title
131
- }
132
- },
133
- props: {
134
- // 业务名称
135
- title: {
136
- type: String,
137
- default: ''
138
- },
139
- // 查询配置文件名
140
- queryParamsName: {
141
- type: String,
142
- default: null
143
- },
144
- // 查询配置文件Json,用于查询配置生成器的预览
145
- queryParamsJson: {
146
- type: Object,
147
- default: null
148
- },
149
- // 业务逻辑名称, 通过logic获取表单表格配置
150
- logicName: {
151
- type: String,
152
- default: null
153
- },
154
- // 执行logic传递的参数
155
- logicParam: {
156
- type: Object,
157
- default: () => {}
158
- },
159
- // 固定新增表单
160
- fixedAddForm: {
161
- type: Object,
162
- default: () => {
163
- return {}
164
- }
165
- },
166
- // 固定查询表单
167
- fixedQueryForm: {
168
- type: Object,
169
- default: () => {
170
- return {}
171
- }
172
- },
173
- // 预览模式
174
- viewMode: {
175
- type: Boolean,
176
- default: () => {
177
- return false
178
- }
179
- },
180
- // 动态创建子表需要的定义
181
- tempTableData: {
182
- type: Object,
183
- default: null
184
- },
185
- // 数据只有一页时是否展示分页,true:展示,auto:隐藏
186
- showPagination: {
187
- type: Boolean,
188
- default: true
189
- }
190
- },
191
- watch: {
192
- logicParam: {
193
- handler () {
194
- this.getColumnJsonByLogic()
195
- },
196
- deep: true
197
- },
198
- fixedQueryForm: {
199
- handler () {
200
- this.getColumnsJson()
201
- },
202
- deep: true
203
- },
204
- queryParamsJson: {
205
- handler () {
206
- this.getColumnsJsonBySource()
207
- },
208
- deep: true
209
- }
210
- },
211
- created () {
212
- if (this.queryParamsName) {
213
- this.getColumnsJson()
214
- } else if (this.queryParamsJson) {
215
- this.getColumnsJsonBySource()
216
- }
217
- },
218
- methods: {
219
- refreshTable () {
220
- this.$refs.xTable.refresh(true)
221
- },
222
- clearRowKeys () {
223
- this.$refs.xTable.clearRowKeys()
224
- },
225
- setParams (res) {
226
- this.tableColumns = res.columnJson
227
- this.formItems = res.formJson
228
- this.buttonState = res.buttonState
229
- this.serviceName = res.serviceName
230
- this.customAoM = res.customAoM
231
- this.customQuery = res.customQuery
232
- this.mainLoading = false
233
- this.loaded = true
234
- },
235
- getColumnsJson () {
236
- this.mainLoading = true
237
- indexedDB.getByWeb(this.queryParamsName, commonApi.getColumnsJson, { str: this.queryParamsName }, (ret) => {
238
- this.setParams(ret)
239
- })
240
- },
241
- getColumnsJsonBySource () {
242
- this.mainLoading = true
243
- post(commonApi.getColumnsJson, { queryObject: this.queryParamsJson }).then(res => {
244
- this.queryParams = res
245
- this.setParams(res)
246
- })
247
- },
248
- getColumnJsonByLogic () {
249
- this.form = {}
250
- this.mainLoading = true
251
- indexedDB.getByWeb(`${this.logicName}_${JSON.stringify(this.logicParam)}`, commonApi.getColumnsJson, { logic: this.logicName, logicParam: this.logicParam }, (ret) => {
252
- this.queryParams = ret
253
- this.setParams(ret)
254
- })
255
- },
256
- // 查询表单提交
257
- onSubmit (res) {
258
- if (res.valid) {
259
- // 表单赋值
260
- this.form = res.form
261
- // commit
262
- this.$emit('afterSearchSubmit', res)
263
- } else {
264
- return false
265
- }
266
- },
267
- // 新增/修改数据表单提交
268
- onAddOrModify (res) {
269
- if (this.viewMode) {
270
- this.$message.info('预览模式禁止新增')
271
- return false
272
- }
273
- // 如果是临时表
274
- if (this.isTableTemp) {
275
- this.$emit('tempTableModify', res)
276
- return
277
- }
278
- if (res.valid) {
279
- this.loading = true
280
- const requestParameters = {
281
- queryParamsName: this.queryParamsName,
282
- form: {}
283
- }
284
- if (this.businessType === '修改') {
285
- const rowKeyValue = this.selectedRowKeys[0]
286
- const key = this.tableColumns[0].dataIndex
287
- const realKey = key.substring(key.indexOf('_') + 1)
288
- requestParameters.form[realKey] = rowKeyValue
289
- }
290
- for (const key of Object.keys(res.form)) {
291
- const realKey = key.substring(key.indexOf('_') + 1)
292
- requestParameters.form[realKey] = res.form[key]
293
- }
294
- if (!this.customAoM || this.customAoM?.length === 0) {
295
- this.customAoM = undefined
296
- }
297
- addOrModify(requestParameters, this.customAoM, this.serviceName).then(res => {
298
- this.$message.success(this.businessType + '成功!')
299
- this.loading = false
300
- this.modelVisible = false
301
- this.$refs.xTable.refresh(true)
302
- // commit
303
- this.$emit('afterSubmit', { type: this.businessType, id: res.id, form: requestParameters.form })
304
- }).catch(e => {
305
- this.loading = false
306
- this.modelVisible = false
307
- this.$message.error(this.businessType + '失败!')
308
- })
309
- } else {
310
- return false
311
- }
312
- },
313
- // 刷新加载表格数据
314
- loadData (requestParameters, callback) {
315
- let result = {}
316
- if (this.queryParamsJson) {
317
- if (this.queryParamsJson.tableName.startsWith('##')) {
318
- this.isTableTemp = true
319
- result = this.initTempTable(requestParameters)
320
- }
321
- }
322
- if (!this.isTableTemp) {
323
- result = query(requestParameters, undefined, this.serviceName)
324
- }
325
- this.$emit('afterQuery', result)
326
- callback(result)
327
- },
328
- // 详情按钮事件
329
- action (record, id) {
330
- this.$emit('action', record, id)
331
- },
332
- // 新增业务
333
- addItem () {
334
- this.businessType = '新增'
335
- this.modifyModelData = {}
336
- this.modelVisible = true
337
- },
338
- // 修改业务
339
- editItem () {
340
- this.businessType = '修改'
341
- if (!this.viewMode) {
342
- const requestParameters = {
343
- queryParamsName: this.queryParamsName,
344
- conditionParams: {},
345
- pageNo: 1,
346
- pageSize: 1
347
- }
348
- requestParameters.conditionParams[this.tableColumns[0].dataIndex] = this.selectedRowKeys[0]
349
- requestParameters.f_businessid = this.selectedRowKeys[0]
350
- if (this.isTableTemp) {
351
- this.$emit('tempTableEdit', requestParameters)
352
- return
353
- }
354
- this.editDataLoading = true
355
- if (!this.customQuery || this.customQuery?.length === 0) {
356
- this.customQuery = undefined
357
- }
358
- queryWithResource(requestParameters, this.customQuery, this.serviceName).then(res => {
359
- this.modifyModelData = { data: res.data[0], images: res.images, files: res.files }
360
- this.modelVisible = true
361
- this.editDataLoading = false
362
- console.warn(this.modifyModelData)
363
- })
364
- } else {
365
- this.$message.info('预览模式禁止修改')
366
- }
367
- },
368
- // 删除业务
369
- deleteItem () {
370
- if (this.viewMode) {
371
- this.$message.info('预览模式禁止删除')
372
- return
373
- }
374
- Modal.confirm({
375
- title: '提示',
376
- content: '您本次要删除共' + this.selectedRowKeys.length + '条数据,确定操作吗?',
377
- confirmLoading: this.loading,
378
- zIndex: 1001,
379
- onOk: () => {
380
- this.loading = true
381
- const requestParameters = {
382
- queryParamsName: this.queryParamsName,
383
- idList: this.selectedRowKeys
384
- }
385
- remove(requestParameters, undefined, this.serviceName).then(res => {
386
- this.loading = false
387
- this.$message.success('删除成功!')
388
- this.$refs.xTable.clearRowKeys()
389
- this.$refs.xTable.refresh(true)
390
- // afterDelete
391
- this.$emit('afterDelete', { idList: requestParameters.idList })
392
- }).catch(e => {
393
- this.loading = false
394
- this.$message.error('删除失败!')
395
- })
396
- },
397
- onCancel () {}
398
- })
399
- },
400
- // 查询表单部分显示/隐藏切换
401
- toggleIsFormShow () {
402
- this.isFormShow = !this.isFormShow
403
- },
404
- // 控制业务操作按钮组的显示
405
- selectRow (rowKeys) {
406
- this.selectedRowKeys = rowKeys
407
- this.isModify = this.selectedRowKeys.length === 1
408
- this.isDelete = this.selectedRowKeys.length > 0
409
- this.$emit('selectRow', this.selectedRowKeys)
410
- },
411
- // 创建临时表sql生成
412
- createTempTable (defineJson) {
413
- const tableName = defineJson.tableName
414
- const define = defineJson.column
415
- return post(CommonTempTable.createTempTable, {
416
- define: define,
417
- tableName: tableName
418
- })
419
- .then(
420
- res => {
421
- return res
422
- },
423
- err => {
424
- console.log(err)
425
- }
426
- )
427
- },
428
- // 插入临时表数据sql生成
429
- insertTempTableData (defineJson) {
430
- const tableName = defineJson.tableName
431
- const params = {}
432
- params.define = defineJson.column
433
- params.applyId = defineJson.applyId
434
- params.stepName = defineJson.stepName
435
- params.tableName = tableName
436
- return post(CommonTempTable.insertDataToTempTable, {
437
- tempTableData: params
438
- })
439
- .then(
440
- res => {
441
- return res
442
- }
443
- )
444
- },
445
- // 初始化临时表
446
- async initTempTable (json) {
447
- await this.createTempTable(this.queryParamsJson)
448
- await this.insertTempTableData(this.queryParamsJson)
449
- let result = {}
450
- await post(CommonTempTable.initApplySubTable, {
451
- define: json
452
- })
453
- .then(
454
- res => {
455
- console.log('子表临时表已创建')
456
- result = res
457
- }
458
- )
459
- return result
460
- }
461
- }
462
- }
463
- </script>
464
- <style lang="less" scoped>
465
- .btn-success {
466
- color: #ffffff;
467
- }
468
- .btn-success:hover {
469
- color: #ffffff !important;
470
- }
471
- .btn-success:focus {
472
- color: #ffffff !important;
473
- }
474
- .btn-success:enabled:hover {
475
- background-color: #85CE61 !important;
476
- border-color: #85CE61 !important;
477
- }
478
- .btn-success:enabled {
479
- background-color: #67c23a;
480
- border-color: #67c23a;
481
- }
482
- .btn-success:disabled {
483
- color: rgba(0, 0, 0, 0.25);
484
- }
485
- .btn-warn {
486
- color: #ffffff;
487
- }
488
- .btn-warn:hover {
489
- color: #ffffff !important;
490
- }
491
- .btn-warn:focus {
492
- color: #ffffff !important;
493
- }
494
- .btn-warn:enabled:hover {
495
- background-color: #ffc833 !important;
496
- border-color: #ffc833 !important;
497
- }
498
- .btn-warn:enabled {
499
- background-color: #ffba00;
500
- border-color: #ffba00;
501
- }
502
- .btn-warn:disabled {
503
- color: rgba(0, 0, 0, 0.25);
504
- }
505
- </style>
1
+ <template>
2
+ <a-skeleton :loading="mainLoading">
3
+ <template v-if="loaded">
4
+ <x-add-form
5
+ :business-title="businessTitle"
6
+ :business-type="businessType"
7
+ :fixedAddForm="fixedAddForm"
8
+ :json-data="formItems"
9
+ :service-name="serviceName"
10
+ :loading="loading"
11
+ :modify-model-data="modifyModelData"
12
+ :visible.sync="modelVisible"
13
+ @onSubmit="onAddOrModify"/>
14
+ <x-form
15
+ :is-show="isFormShow"
16
+ :json-data="formItems"
17
+ :service-name="serviceName"
18
+ style="margin-bottom: 14px;"
19
+ @onSubmit="onSubmit">
20
+ <slot></slot>
21
+ </x-form>
22
+ <x-table
23
+ ref="xTable"
24
+ :buttonState="buttonState"
25
+ :fixedQueryForm="fixedQueryForm"
26
+ :form="form"
27
+ :json-data="tableColumns"
28
+ :queryParams="queryParams"
29
+ :queryParamsName="queryParamsName"
30
+ :show-pagination="showPagination"
31
+ @action="action"
32
+ @loadData="loadData"
33
+ @selectRow="selectRow"
34
+ @toggleIsFormShow="toggleIsFormShow">
35
+ <template slot="expand">
36
+ <a-space>
37
+ <a-button v-if="!buttonState || buttonState.add" type="primary" @click="addItem">
38
+ <a-icon :style="iconStyle" type="plus"/>新增
39
+ </a-button>
40
+ <a-button
41
+ v-if="!buttonState || buttonState.edit"
42
+ :disabled="!isModify"
43
+ :loading="editDataLoading"
44
+ class="btn-success"
45
+ type="dashed"
46
+ @click="editItem">
47
+ <a-icon :style="iconStyle" type="edit"/>修改
48
+ </a-button>
49
+ <a-button v-if="!buttonState || buttonState.delete" :disabled="!isDelete" type="danger" @click="deleteItem">
50
+ <a-icon :style="iconStyle" type="delete"/>删除
51
+ </a-button>
52
+ <slot :selectedRowKeys="selectedRowKeys" name="button"></slot>
53
+ </a-space>
54
+ <slot name="expand"></slot>
55
+ </template>
56
+ </x-table>
57
+ </template>
58
+ </a-skeleton>
59
+ </template>
60
+ <script>
61
+ import XForm from '@vue2-client/base-client/components/common/XForm/XForm'
62
+ import XAddForm from '@vue2-client/base-client/components/common/XAddForm/XAddForm'
63
+ import XTable from '@vue2-client/base-client/components/common/XTable/XTable'
64
+ import { query, commonApi, addOrModify, remove, queryWithResource } from '@vue2-client/services/api/common'
65
+ import { indexedDB } from '@vue2-client/utils/indexedDB'
66
+ import { mapState } from 'vuex'
67
+ import { Modal } from 'ant-design-vue'
68
+ import { post } from '@vue2-client/services/api/restTools'
69
+ import { CommonTempTable } from '@vue2-client/services/api/commonTempTable'
70
+
71
+ export default {
72
+ name: 'XFormTable',
73
+ components: {
74
+ XTable,
75
+ XForm,
76
+ XAddForm
77
+ },
78
+ data () {
79
+ return {
80
+ // Query参数文件内容加载中
81
+ mainLoading: false,
82
+ // Query参数文件内容加载完成
83
+ loaded: false,
84
+ // 是否展示表单
85
+ isFormShow: true,
86
+ // 当使用logic获取到表单表格配置时, 将配置对象直接传入到x-table用于查询
87
+ queryParams: null,
88
+ // 服务名称
89
+ serviceName: 'af-system',
90
+ // 表格列集合
91
+ tableColumns: [],
92
+ // 操作按钮集合
93
+ buttonState: {},
94
+ // 表格选择列Key集合
95
+ selectedRowKeys: [],
96
+ // 表单项集合
97
+ formItems: [],
98
+ // 表单
99
+ form: {},
100
+ // 图标样式
101
+ iconStyle: {
102
+ position: 'relative',
103
+ top: '1px'
104
+ },
105
+ // 当前业务类型:新增,修改
106
+ businessType: '',
107
+ // 是否显示新增/修改模态框
108
+ modelVisible: false,
109
+ // 修改业务时查询的单条业务数据
110
+ modifyModelData: {},
111
+ // 是否允许修改
112
+ isModify: false,
113
+ // 是否允许删除
114
+ isDelete: false,
115
+ // 新增,修改业务执行状态
116
+ loading: false,
117
+ // 被修改数据加载状态
118
+ editDataLoading: false,
119
+ // 是否为临时表
120
+ isTableTemp: false,
121
+ // 自定义新增修改接口
122
+ customAoM: undefined,
123
+ // 自定义查询接口
124
+ customQuery: undefined
125
+ }
126
+ },
127
+ computed: {
128
+ ...mapState('setting', ['isMobile']),
129
+ businessTitle () {
130
+ return this.businessType + this.title
131
+ }
132
+ },
133
+ props: {
134
+ // 业务名称
135
+ title: {
136
+ type: String,
137
+ default: ''
138
+ },
139
+ // 查询配置文件名
140
+ queryParamsName: {
141
+ type: String,
142
+ default: null
143
+ },
144
+ // 查询配置文件Json,用于查询配置生成器的预览
145
+ queryParamsJson: {
146
+ type: Object,
147
+ default: null
148
+ },
149
+ // 业务逻辑名称, 通过logic获取表单表格配置
150
+ logicName: {
151
+ type: String,
152
+ default: null
153
+ },
154
+ // 执行logic传递的参数
155
+ logicParam: {
156
+ type: Object,
157
+ default: () => {}
158
+ },
159
+ // 固定新增表单
160
+ fixedAddForm: {
161
+ type: Object,
162
+ default: () => {
163
+ return {}
164
+ }
165
+ },
166
+ // 固定查询表单
167
+ fixedQueryForm: {
168
+ type: Object,
169
+ default: () => {
170
+ return {}
171
+ }
172
+ },
173
+ // 预览模式
174
+ viewMode: {
175
+ type: Boolean,
176
+ default: () => {
177
+ return false
178
+ }
179
+ },
180
+ // 动态创建子表需要的定义
181
+ tempTableData: {
182
+ type: Object,
183
+ default: null
184
+ },
185
+ // 数据只有一页时是否展示分页,true:展示,auto:隐藏
186
+ showPagination: {
187
+ type: Boolean,
188
+ default: true
189
+ }
190
+ },
191
+ watch: {
192
+ logicParam: {
193
+ handler () {
194
+ this.getColumnJsonByLogic()
195
+ },
196
+ deep: true
197
+ },
198
+ fixedQueryForm: {
199
+ handler () {
200
+ this.form = {}
201
+ },
202
+ deep: true
203
+ },
204
+ queryParamsJson: {
205
+ handler () {
206
+ this.getColumnsJsonBySource()
207
+ },
208
+ deep: true
209
+ }
210
+ },
211
+ created () {
212
+ if (this.queryParamsName) {
213
+ this.getColumnsJson()
214
+ } else if (this.queryParamsJson) {
215
+ this.getColumnsJsonBySource()
216
+ }
217
+ },
218
+ methods: {
219
+ refreshTable () {
220
+ this.$refs.xTable.refresh(true)
221
+ },
222
+ clearRowKeys () {
223
+ this.$refs.xTable.clearRowKeys()
224
+ },
225
+ setParams (res) {
226
+ this.tableColumns = res.columnJson
227
+ this.formItems = res.formJson
228
+ this.buttonState = res.buttonState
229
+ this.serviceName = res.serviceName
230
+ this.customAoM = res.customAoM
231
+ this.customQuery = res.customQuery
232
+ this.mainLoading = false
233
+ this.loaded = true
234
+ },
235
+ getColumnsJson () {
236
+ this.mainLoading = true
237
+ indexedDB.getByWeb(this.queryParamsName, commonApi.getColumnsJson, { str: this.queryParamsName }, (ret) => {
238
+ this.setParams(ret)
239
+ })
240
+ },
241
+ getColumnsJsonBySource () {
242
+ this.mainLoading = true
243
+ post(commonApi.getColumnsJson, { queryObject: this.queryParamsJson }).then(res => {
244
+ this.queryParams = res
245
+ this.setParams(res)
246
+ })
247
+ },
248
+ getColumnJsonByLogic () {
249
+ this.form = {}
250
+ this.mainLoading = true
251
+ indexedDB.getByWeb(`${this.logicName}_${JSON.stringify(this.logicParam)}`, commonApi.getColumnsJson, { logic: this.logicName, logicParam: this.logicParam }, (ret) => {
252
+ this.queryParams = ret
253
+ this.setParams(ret)
254
+ })
255
+ },
256
+ // 查询表单提交
257
+ onSubmit (res) {
258
+ if (res.valid) {
259
+ // 表单赋值
260
+ this.form = res.form
261
+ // commit
262
+ this.$emit('afterSearchSubmit', res)
263
+ } else {
264
+ return false
265
+ }
266
+ },
267
+ // 新增/修改数据表单提交
268
+ onAddOrModify (res) {
269
+ if (this.viewMode) {
270
+ this.$message.info('预览模式禁止新增')
271
+ return false
272
+ }
273
+ // 如果是临时表
274
+ if (this.isTableTemp) {
275
+ this.$emit('tempTableModify', res)
276
+ return
277
+ }
278
+ if (res.valid) {
279
+ this.loading = true
280
+ const requestParameters = {
281
+ queryParamsName: this.queryParamsName,
282
+ form: {}
283
+ }
284
+ if (this.businessType === '修改') {
285
+ const rowKeyValue = this.selectedRowKeys[0]
286
+ const key = this.tableColumns[0].dataIndex
287
+ const realKey = key.substring(key.indexOf('_') + 1)
288
+ requestParameters.form[realKey] = rowKeyValue
289
+ }
290
+ for (const key of Object.keys(res.form)) {
291
+ const realKey = key.substring(key.indexOf('_') + 1)
292
+ requestParameters.form[realKey] = res.form[key]
293
+ }
294
+ if (!this.customAoM || this.customAoM?.length === 0) {
295
+ this.customAoM = undefined
296
+ }
297
+ addOrModify(requestParameters, this.customAoM, this.serviceName).then(res => {
298
+ this.$message.success(this.businessType + '成功!')
299
+ this.loading = false
300
+ this.modelVisible = false
301
+ this.$refs.xTable.refresh(true)
302
+ // commit
303
+ this.$emit('afterSubmit', { type: this.businessType, id: res.id, form: requestParameters.form })
304
+ }).catch(e => {
305
+ this.loading = false
306
+ this.modelVisible = false
307
+ this.$message.error(this.businessType + '失败!')
308
+ })
309
+ } else {
310
+ return false
311
+ }
312
+ },
313
+ // 刷新加载表格数据
314
+ loadData (requestParameters, callback) {
315
+ let result = {}
316
+ if (this.queryParamsJson) {
317
+ if (this.queryParamsJson.tableName.startsWith('##')) {
318
+ this.isTableTemp = true
319
+ result = this.initTempTable(requestParameters)
320
+ }
321
+ }
322
+ if (!this.isTableTemp) {
323
+ result = query(requestParameters, undefined, this.serviceName)
324
+ }
325
+ this.$emit('afterQuery', result)
326
+ callback(result)
327
+ },
328
+ // 详情按钮事件
329
+ action (record, id) {
330
+ this.$emit('action', record, id)
331
+ },
332
+ // 新增业务
333
+ addItem () {
334
+ this.businessType = '新增'
335
+ this.modifyModelData = {}
336
+ this.modelVisible = true
337
+ },
338
+ // 修改业务
339
+ editItem () {
340
+ this.businessType = '修改'
341
+ if (!this.viewMode) {
342
+ const requestParameters = {
343
+ queryParamsName: this.queryParamsName,
344
+ conditionParams: {},
345
+ pageNo: 1,
346
+ pageSize: 1
347
+ }
348
+ requestParameters.conditionParams[this.tableColumns[0].dataIndex] = this.selectedRowKeys[0]
349
+ requestParameters.f_businessid = this.selectedRowKeys[0]
350
+ if (this.isTableTemp) {
351
+ this.$emit('tempTableEdit', requestParameters)
352
+ return
353
+ }
354
+ this.editDataLoading = true
355
+ if (!this.customQuery || this.customQuery?.length === 0) {
356
+ this.customQuery = undefined
357
+ }
358
+ queryWithResource(requestParameters, this.customQuery, this.serviceName).then(res => {
359
+ this.modifyModelData = { data: res.data[0], images: res.images, files: res.files }
360
+ this.modelVisible = true
361
+ this.editDataLoading = false
362
+ console.warn(this.modifyModelData)
363
+ })
364
+ } else {
365
+ this.$message.info('预览模式禁止修改')
366
+ }
367
+ },
368
+ // 删除业务
369
+ deleteItem () {
370
+ if (this.viewMode) {
371
+ this.$message.info('预览模式禁止删除')
372
+ return
373
+ }
374
+ Modal.confirm({
375
+ title: '提示',
376
+ content: '您本次要删除共' + this.selectedRowKeys.length + '条数据,确定操作吗?',
377
+ confirmLoading: this.loading,
378
+ zIndex: 1001,
379
+ onOk: () => {
380
+ this.loading = true
381
+ const requestParameters = {
382
+ queryParamsName: this.queryParamsName,
383
+ idList: this.selectedRowKeys
384
+ }
385
+ remove(requestParameters, undefined, this.serviceName).then(res => {
386
+ this.loading = false
387
+ this.$message.success('删除成功!')
388
+ this.$refs.xTable.clearRowKeys()
389
+ this.$refs.xTable.refresh(true)
390
+ // afterDelete
391
+ this.$emit('afterDelete', { idList: requestParameters.idList })
392
+ }).catch(e => {
393
+ this.loading = false
394
+ this.$message.error('删除失败!')
395
+ })
396
+ },
397
+ onCancel () {}
398
+ })
399
+ },
400
+ // 查询表单部分显示/隐藏切换
401
+ toggleIsFormShow () {
402
+ this.isFormShow = !this.isFormShow
403
+ },
404
+ // 控制业务操作按钮组的显示
405
+ selectRow (rowKeys) {
406
+ this.selectedRowKeys = rowKeys
407
+ this.isModify = this.selectedRowKeys.length === 1
408
+ this.isDelete = this.selectedRowKeys.length > 0
409
+ this.$emit('selectRow', this.selectedRowKeys)
410
+ },
411
+ // 创建临时表sql生成
412
+ createTempTable (defineJson) {
413
+ const tableName = defineJson.tableName
414
+ const define = defineJson.column
415
+ return post(CommonTempTable.createTempTable, {
416
+ define: define,
417
+ tableName: tableName
418
+ })
419
+ .then(
420
+ res => {
421
+ return res
422
+ },
423
+ err => {
424
+ console.log(err)
425
+ }
426
+ )
427
+ },
428
+ // 插入临时表数据sql生成
429
+ insertTempTableData (defineJson) {
430
+ const tableName = defineJson.tableName
431
+ const params = {}
432
+ params.define = defineJson.column
433
+ params.applyId = defineJson.applyId
434
+ params.stepName = defineJson.stepName
435
+ params.tableName = tableName
436
+ return post(CommonTempTable.insertDataToTempTable, {
437
+ tempTableData: params
438
+ })
439
+ .then(
440
+ res => {
441
+ return res
442
+ }
443
+ )
444
+ },
445
+ // 初始化临时表
446
+ async initTempTable (json) {
447
+ await this.createTempTable(this.queryParamsJson)
448
+ await this.insertTempTableData(this.queryParamsJson)
449
+ let result = {}
450
+ await post(CommonTempTable.initApplySubTable, {
451
+ define: json
452
+ })
453
+ .then(
454
+ res => {
455
+ console.log('子表临时表已创建')
456
+ result = res
457
+ }
458
+ )
459
+ return result
460
+ }
461
+ }
462
+ }
463
+ </script>
464
+ <style lang="less" scoped>
465
+ .btn-success {
466
+ color: #ffffff;
467
+ }
468
+ .btn-success:hover {
469
+ color: #ffffff !important;
470
+ }
471
+ .btn-success:focus {
472
+ color: #ffffff !important;
473
+ }
474
+ .btn-success:enabled:hover {
475
+ background-color: #85CE61 !important;
476
+ border-color: #85CE61 !important;
477
+ }
478
+ .btn-success:enabled {
479
+ background-color: #67c23a;
480
+ border-color: #67c23a;
481
+ }
482
+ .btn-success:disabled {
483
+ color: rgba(0, 0, 0, 0.25);
484
+ }
485
+ .btn-warn {
486
+ color: #ffffff;
487
+ }
488
+ .btn-warn:hover {
489
+ color: #ffffff !important;
490
+ }
491
+ .btn-warn:focus {
492
+ color: #ffffff !important;
493
+ }
494
+ .btn-warn:enabled:hover {
495
+ background-color: #ffc833 !important;
496
+ border-color: #ffc833 !important;
497
+ }
498
+ .btn-warn:enabled {
499
+ background-color: #ffba00;
500
+ border-color: #ffba00;
501
+ }
502
+ .btn-warn:disabled {
503
+ color: rgba(0, 0, 0, 0.25);
504
+ }
505
+ </style>
@@ -81,7 +81,7 @@ export default {
81
81
  return
82
82
  }
83
83
  const otherFiles = []
84
- post('/api/af-system/getInstitutionDetail', {
84
+ post('/api/af-system/logic/getInstitutionDetail', {
85
85
  id: this.institutionId
86
86
  }).then(res => {
87
87
  res.files.forEach(item => {
@@ -116,7 +116,7 @@ export default {
116
116
  a.click()
117
117
  },
118
118
  confirm_institution () {
119
- post('/api/af-system/affirmInstitution', {
119
+ post('/api/af-system/logic/affirmInstitution', {
120
120
  data: {
121
121
  tobe: [
122
122
  {