vue2-client 1.7.2 → 1.7.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
@@ -556,10 +556,10 @@ export default {
556
556
  this.form.joinArray = joinArrayObject
557
557
  },
558
558
  exportJson () {
559
- const data = JSON.stringify(this.form, null, 2)
559
+ const data = JSON.stringify(this.result, null, 2)
560
560
  const blob = new Blob([data], { type: 'application/json' })
561
561
  FileSaver.saveAs(blob, `Query.json`)
562
- this.$message.success('导出成功!')
562
+ this.$message.success('导出到本地成功,请复制内容到琉璃配置中心中')
563
563
  },
564
564
  viewHandle (then) {
565
565
  if (this.form.column.length === 0) {
@@ -604,7 +604,7 @@ export default {
604
604
  if (valid) {
605
605
  this.viewHandle(() => {
606
606
  // saveQueryParams
607
- this.$emit('saveQueryParams', this.result)
607
+ this.exportJson()
608
608
  })
609
609
  }
610
610
  })
@@ -130,7 +130,7 @@ import JsonViewer from 'vue-json-viewer'
130
130
  import FileSaver from 'file-saver'
131
131
  import { mapState } from 'vuex'
132
132
  import { post } from '@vue2-client/services/api'
133
- import { getConfigUrl } from '@vue2-client/services/api/common'
133
+ import { parseConfigUrl } from '@vue2-client/services/api/common'
134
134
 
135
135
  export default {
136
136
  name: 'CreateSimpleFormQuery',
@@ -352,10 +352,10 @@ export default {
352
352
  changeJoinArray () {
353
353
  },
354
354
  exportJson () {
355
- const data = JSON.stringify(this.form, null, 2)
355
+ const data = JSON.stringify(this.result, null, 2)
356
356
  const blob = new Blob([data], { type: 'application/json' })
357
357
  FileSaver.saveAs(blob, `SimpleFormQuery.json`)
358
- this.$message.success('导出成功!')
358
+ this.$message.success('导出到本地成功,请复制内容到琉璃配置中心中')
359
359
  },
360
360
  viewHandle (then) {
361
361
  if (this.form.column.length === 0) {
@@ -382,13 +382,16 @@ export default {
382
382
  this.$refs.businessCreateForm.validate(valid => {
383
383
  if (valid) {
384
384
  this.viewHandle(() => {
385
- const url = getConfigUrl(this.serviceName)
386
- post(url, { queryObject: this.result }).then(res => {
385
+ const url = parseConfigUrl(this.serviceName)
386
+ post(url, {
387
+ configType: 'SIMPLE_FORM',
388
+ configContent: this.result
389
+ }).then(res => {
387
390
  this.$refs.xAddForm.init({
388
391
  businessType: '新增',
389
392
  title: '效果预览',
390
393
  formItems: res.formJson,
391
- serviceName: res.serviceName,
394
+ serviceName: this.serviceName,
392
395
  viewMode: true
393
396
  })
394
397
  })
@@ -401,7 +404,7 @@ export default {
401
404
  if (valid) {
402
405
  this.viewHandle(() => {
403
406
  // saveQueryParams
404
- this.$emit('saveSimpleFormQueryParams', this.result)
407
+ this.exportJson()
405
408
  })
406
409
  }
407
410
  })
@@ -93,7 +93,7 @@ export default {
93
93
  businessType: '修改',
94
94
  title: '参数项',
95
95
  formItems: res.formJson,
96
- serviceName: res.serviceName,
96
+ serviceName: this.serviceName,
97
97
  modifyModelData: modifyModelData
98
98
  })
99
99
  })
@@ -401,8 +401,8 @@ export default {
401
401
  const value = newVal[this.attr.model]
402
402
  const isEmpty = !value || !value.toString()
403
403
  // 查询表单点击重置按钮时清空树形选择框选中状态
404
- if (this.attr.type === 'treeSelect' && isEmpty) {
405
- this.$refs.xTreeSelect.setValue(undefined)
404
+ if (this.$refs.XTreeSelect && this.attr.type === 'treeSelect' && isEmpty) {
405
+ this.$refs.xTreeSelect.setValue(undefined)
406
406
  }
407
407
  },
408
408
  deep: true
@@ -50,7 +50,7 @@ import XForm from '@vue2-client/base-client/components/common/XForm'
50
50
  import XAddForm from '@vue2-client/base-client/components/common/XAddForm'
51
51
  import XTable from '@vue2-client/base-client/components/common/XTable'
52
52
  import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
53
- import { addOrModify, getConfigUrl } from '@vue2-client/services/api/common'
53
+ import { addOrModify, getConfigUrl, parseConfigUrl } from '@vue2-client/services/api/common'
54
54
  import { indexedDB } from '@vue2-client/utils/indexedDB'
55
55
  import { mapState } from 'vuex'
56
56
  import { post } from '@vue2-client/services/api/restTools'
@@ -186,8 +186,11 @@ export default {
186
186
  },
187
187
  getColumnsJsonBySource () {
188
188
  this.loading = true
189
- const url = getConfigUrl(this.serviceName)
190
- post(url, { queryObject: this.queryParamsJson }).then(res => {
189
+ const url = parseConfigUrl(this.serviceName)
190
+ post(url, {
191
+ configType: 'CRUD_FORM',
192
+ configContent: this.queryParamsJson
193
+ }).then(res => {
191
194
  this.updateComponents(res, true)
192
195
  })
193
196
  },
@@ -213,11 +216,11 @@ export default {
213
216
  title: this.title,
214
217
  viewMode: this.viewMode,
215
218
  isTableTemp: this.isTableTemp,
216
- serviceName: res.serviceName
219
+ serviceName: this.serviceName
217
220
  })
218
221
  this.$refs.xForm.init({
219
222
  formItems: res.formJson,
220
- serviceName: res.serviceName,
223
+ serviceName: this.serviceName,
221
224
  getDataParams: this.getDataParams
222
225
  })
223
226
  }
@@ -249,7 +252,7 @@ export default {
249
252
  businessType: res.businessType,
250
253
  operator: res.currUserName
251
254
  }
252
- addOrModify(requestParameters, res.serviceName).then(data => {
255
+ addOrModify(requestParameters, this.serviceName).then(data => {
253
256
  this.$message.success(res.businessType + '成功!')
254
257
  this.refreshTable(res.businessType === '新增')
255
258
  // commit
@@ -289,7 +292,7 @@ export default {
289
292
  formItems: res.formJson,
290
293
  viewMode: this.viewMode,
291
294
  isTableTemp: this.isTableTemp,
292
- serviceName: res.serviceName,
295
+ serviceName: this.serviceName,
293
296
  fixedAddForm: this.fixedAddForm,
294
297
  getDataParams: this.getDataParams
295
298
  })
@@ -307,7 +310,7 @@ export default {
307
310
  formItems: res.formJson,
308
311
  viewMode: this.viewMode,
309
312
  isTableTemp: this.isTableTemp,
310
- serviceName: res.serviceName,
313
+ serviceName: this.serviceName,
311
314
  fixedAddForm: this.fixedAddForm,
312
315
  getDataParams: this.getDataParams,
313
316
  modifyModelData: modifyModelData
@@ -2,24 +2,34 @@
2
2
  <div>
3
3
  <create-query
4
4
  :visible.sync="visible"
5
- @saveQueryParams="saveQueryParams"
5
+ :to-edit-json="toEditJson"
6
6
  />
7
7
  <create-simple-form-query
8
8
  :visible.sync="createSimpleFormVisible"
9
- @saveSimpleFormQueryParams="saveSimpleFormQueryParams"
9
+ :to-edit-json="toEditSimpleFormJson"
10
10
  />
11
- <a-button style="margin-top: 10px;margin-left: 10px;" type="primary" @click="showDrawer">打开完整查询配置生成工具
11
+ <a-modal
12
+ :visible="importJsonVisible"
13
+ title="导入JSON配置"
14
+ @cancel="importJsonVisible = false"
15
+ @ok="importJsonHandleOk"
16
+ >
17
+ <a-textarea v-model="importEditJson" placeholder="输入现有的JSON配置"/>
18
+ </a-modal>
19
+ <a-button style="margin-top: 10px;margin-left: 10px;" type="primary" @click="showDrawer">创建查询配置
12
20
  </a-button>
21
+ <a-button style="margin-top: 10px;margin-left: 10px;" type="primary" @click="openImportView(1)">导入已有查询配置
22
+ </a-button>
23
+ <br/>
13
24
  <a-button style="margin-top: 10px;margin-left: 10px;" type="primary" @click="showSimpleFormQueryParamsDrawer">
14
- 打开基础表单配置生成工具
25
+ 创建简易表单配置
26
+ </a-button>
27
+ <a-button style="margin-top: 10px;margin-left: 10px;" type="primary" @click="openImportView(2)">导入已有简易表单配置
15
28
  </a-button>
16
- <a-button style="margin-top: 10px;margin-left: 10px;" type="primary" @click="searchReport">请求数据</a-button>
17
- <!-- <webmeter-analysis-view/>-->
18
29
  </div>
19
30
  </template>
20
31
 
21
32
  <script>
22
- import { post } from '@vue2-client/services/api/restTools'
23
33
  import CreateQuery from '@vue2-client/base-client/components/common/CreateQuery'
24
34
  import CreateSimpleFormQuery from '@vue2-client/base-client/components/common/CreateSimpleFormQuery'
25
35
 
@@ -32,7 +42,12 @@ export default {
32
42
  data () {
33
43
  return {
34
44
  visible: false,
35
- createSimpleFormVisible: false
45
+ createSimpleFormVisible: false,
46
+ toEditJson: undefined,
47
+ toEditSimpleFormJson: undefined,
48
+ importJsonVisible: false,
49
+ type: undefined,
50
+ importEditJson: ''
36
51
  }
37
52
  },
38
53
  methods: {
@@ -42,41 +57,24 @@ export default {
42
57
  showSimpleFormQueryParamsDrawer () {
43
58
  this.createSimpleFormVisible = true
44
59
  },
45
- // 查询report
46
- searchReport (source) {
47
- return post('/rs/report/saleMonthReport', {
48
- 'data': {
49
- 'condition': ' 1=1 ',
50
- 'startDate': '2022-11-21 00:00:00',
51
- 'endDate': '2022-11-21 23:59:59',
52
- 'f_orgid': 'f_orgid in (21142)'
53
- }
54
- }).then(res => {
55
- this.$message.success(res)
56
- }, err => {
57
- console.error(err)
58
- })
60
+ openImportView (type) {
61
+ this.type = type
62
+ this.importJsonVisible = true
59
63
  },
60
- // 存储查询配置信息
61
- saveQueryParams (source) {
62
- return post('/api/system/logic/addOrEditQueryParams', {
63
- source: source
64
- }).then(res => {
65
- this.$message.success('保存查询配置成功')
66
- }, err => {
67
- console.error(err)
68
- })
64
+ importJsonHandleOk () {
65
+ try {
66
+ if (this.type === 1) {
67
+ this.toEditJson = JSON.parse(this.importEditJson)
68
+ this.showDrawer()
69
+ } else {
70
+ this.toEditSimpleFormJson = JSON.parse(this.importEditJson)
71
+ this.showSimpleFormQueryParamsDrawer()
72
+ }
73
+ } catch (e) {
74
+ this.$message.warn('操作失败,输入配置不是JSON格式')
75
+ }
76
+ this.importJsonVisible = false
69
77
  },
70
- // 存储基础表单配置信息
71
- saveSimpleFormQueryParams (source) {
72
- return post('/api/system/logic/addOrEditSimpleFormQueryParams', {
73
- source: source
74
- }).then(res => {
75
- this.$message.success('保存基础表单配置成功')
76
- }, err => {
77
- console.error(err)
78
- })
79
- }
80
78
  }
81
79
  }
82
80
  </script>
@@ -31,6 +31,8 @@ routerResource.operLog = () => import('@vue2-client/pages/system/monitor/operLog
31
31
  routerResource.submitTicket = () => import('@vue2-client/pages/system/ticket')
32
32
  // 系统设置
33
33
  routerResource.settings = () => import('@vue2-client/pages/system/settings')
34
+ // 查询配置生成工具
35
+ routerResource.createQuery = () => import('@vue2-client/pages/CreateQueryPage')
34
36
 
35
37
  // 基础路由组件注册
36
38
  const routerMap = {
@@ -9,6 +9,8 @@ import { post } from '@vue2-client/services/api/restTools'
9
9
  const commonApi = {
10
10
  // 获取表格列配置
11
11
  getConfig: 'logic/getLiuliConfiguration',
12
+ // 配置解析
13
+ parseConfig: 'logic/parseConfig',
12
14
  // 通用查询
13
15
  query: 'logic/commonQuery',
14
16
  // 表单查询
@@ -35,6 +37,10 @@ export function getConfigUrl (serviceName = 'system') {
35
37
  return '/api/' + serviceName + '/' + commonApi.getConfig
36
38
  }
37
39
 
40
+ export function parseConfigUrl (serviceName = 'system') {
41
+ return '/api/' + serviceName + '/' + commonApi.parseConfig
42
+ }
43
+
38
44
  /**
39
45
  * 带缓存查询的表格配置文件查询
40
46
  * @param queryParamsName 配置名称