super-pages 0.0.15-up → 0.0.17-up

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.
Files changed (52) hide show
  1. package/README.md +7 -7
  2. package/index.html +13 -13
  3. package/lib/super-pages.css +1 -1
  4. package/lib/super-pages.js +2603 -2569
  5. package/lib/super-pages.umd.cjs +14 -14
  6. package/package.json +1 -1
  7. package/packages/index.js +30 -30
  8. package/packages/super-page/index.js +9 -9
  9. package/packages/super-page/src/button-group.vue +294 -294
  10. package/packages/super-page/src/chart-page.vue +215 -215
  11. package/packages/super-page/src/chart-query-page.vue +163 -163
  12. package/packages/super-page/src/common-form-page.vue +5 -1
  13. package/packages/super-page/src/export-form-report-dialog.vue +145 -145
  14. package/packages/super-page/src/form-head.vue +74 -74
  15. package/packages/super-page/src/form-page.vue +107 -107
  16. package/packages/super-page/src/group-tag.vue +21 -21
  17. package/packages/super-page/src/list-page.vue +4 -2
  18. package/packages/super-page/src/list-toolbar-dynamic-source.vue +89 -89
  19. package/packages/super-page/src/list-toolbar-page.vue +377 -377
  20. package/packages/super-page/src/my-button-base.vue +438 -438
  21. package/packages/super-page/src/my-button.vue +196 -196
  22. package/packages/super-page/src/page-custom-component.vue +56 -56
  23. package/packages/super-page/src/remove-signer-dialog.vue +103 -103
  24. package/packages/super-page/src/sub-tab-page.vue +79 -79
  25. package/packages/super-page/src/super-page-component.vue +86 -86
  26. package/packages/super-page/src/super-page.vue +162 -162
  27. package/packages/super-page/src/tab-page.vue +154 -154
  28. package/packages/super-page/src/task-informition-dialog.vue +82 -82
  29. package/packages/super-page/src/util/ListButtonEvent.js +896 -896
  30. package/packages/super-page/src/util/api.js +37 -37
  31. package/packages/super-page/src/util/callEvents.js +62 -62
  32. package/packages/super-page/src/util/chartButtonEvent.js +60 -60
  33. package/packages/super-page/src/util/common-util.js +102 -102
  34. package/packages/super-page/src/util/commonButtonEvent.js +70 -70
  35. package/packages/super-page/src/util/formButtonEvent.js +509 -509
  36. package/packages/super-page/src/util/store.js +3 -3
  37. package/packages/super-page/src/util/super-page.js +29 -29
  38. package/packages/super-page/src/util/util.js +46 -10
  39. package/packages/super-page/src/util/workflowButtonEvent.js +1729 -1729
  40. package/packages/super-page/src/widget-col-page.vue +339 -339
  41. package/packages/super-page/src/widget-page.vue +703 -703
  42. package/packages/super-page/src/widget-sub-tab-pane-page.vue +115 -115
  43. package/packages/super-page/src/widget-tab-pane-page.vue +135 -135
  44. package/packages/super-page/src/workflow-button-group.vue +561 -561
  45. package/packages/super-page/src/workflow-form-page.vue +5 -2
  46. package/packages/super-page-dialog/index.js +9 -9
  47. package/packages/super-page-dialog/src/super-page-dialog.vue +200 -200
  48. package/packages/utils/gogocodeTransfer.js +59 -59
  49. package/src/i18n/langs/cn.js +65 -65
  50. package/src/i18n/langs/en.js +68 -68
  51. package/src/utils/common-util.js +9 -9
  52. package/vite.config.js +36 -36
@@ -1,37 +1,37 @@
1
- const api = {
2
- // 刷新表单页面
3
- refreshForm(entity) {
4
- if (this.$refs.superForm && entity) {
5
- this.$refs.superForm.refresh(entity)
6
- }
7
- },
8
- // 刷新列表页面
9
- refreshList() {
10
- this.selections = []
11
- if (this.$refs.grid) {
12
- this.$refs.grid.refresh()
13
- }
14
- },
15
- // 刷新表单中子表数据
16
- refreshSubTable(ref, model) {
17
- if (this.$refs.superForm && ref && model) {
18
- this.$refs.superForm.refreshSubTable(ref, model)
19
- }
20
- },
21
- // 表单子表切换每页显示多少条记录时的事件处理
22
- changeSubTablePageSize({ pageSize, propName, isShowPageArea }) {
23
- console.log(
24
- '页面组件--流程表单页面--changeSubTablePageSize=',
25
- pageSize,
26
- propName,
27
- isShowPageArea
28
- )
29
- if (isShowPageArea && propName) {
30
- // 表示表单子表显示分页区域
31
- this.subTablePageInfo[propName] = {
32
- pageSize: pageSize,
33
- }
34
- }
35
- },
36
- }
37
- export default api
1
+ const api = {
2
+ // 刷新表单页面
3
+ refreshForm(entity) {
4
+ if (this.$refs.superForm && entity) {
5
+ this.$refs.superForm.refresh(entity)
6
+ }
7
+ },
8
+ // 刷新列表页面
9
+ refreshList() {
10
+ this.selections = []
11
+ if (this.$refs.grid) {
12
+ this.$refs.grid.refresh()
13
+ }
14
+ },
15
+ // 刷新表单中子表数据
16
+ refreshSubTable(ref, model) {
17
+ if (this.$refs.superForm && ref && model) {
18
+ this.$refs.superForm.refreshSubTable(ref, model)
19
+ }
20
+ },
21
+ // 表单子表切换每页显示多少条记录时的事件处理
22
+ changeSubTablePageSize({ pageSize, propName, isShowPageArea }) {
23
+ console.log(
24
+ '页面组件--流程表单页面--changeSubTablePageSize=',
25
+ pageSize,
26
+ propName,
27
+ isShowPageArea
28
+ )
29
+ if (isShowPageArea && propName) {
30
+ // 表示表单子表显示分页区域
31
+ this.subTablePageInfo[propName] = {
32
+ pageSize: pageSize,
33
+ }
34
+ }
35
+ },
36
+ }
37
+ export default api
@@ -1,62 +1,62 @@
1
- const callFormEvents = {
2
- // 调用点击前回调方法,返回true表示继续执行,否则false表示不执行点击事件
3
- // buttonEventPrefix: 表单编码/列表编码__按钮编码
4
- callBeforeClickButton(events, buttonEventPrefix, params) {
5
- let result = true
6
- if (events) {
7
- const beforeClick = events[buttonEventPrefix + '__beforeClick']
8
- if (beforeClick) {
9
- result = beforeClick.call(this, params)
10
- if (result === undefined) {
11
- result = true
12
- }
13
- }
14
- }
15
- return result
16
- },
17
- // 调用点击后回调方法
18
- // buttonEventPrefix: 表单编码/列表编码__按钮编码
19
- callAfterClickButton(events, buttonEventPrefix, params) {
20
- if (events) {
21
- const afterClick = events[buttonEventPrefix + '__afterClick']
22
- if (afterClick) {
23
- afterClick.call(this, params)
24
- }
25
- }
26
- },
27
- // 调用表单组件元素的事件
28
- callFormItemEvent(formOptions, eventName, formData, eventParams) {
29
- if (!eventName) {
30
- return
31
- }
32
- if (formOptions && formOptions.customEvents) {
33
- const formItemEventFun = this.getEventFunction(
34
- formOptions,
35
- 'customEvents',
36
- eventName
37
- )
38
- if (formItemEventFun) {
39
- const params = {
40
- params: formOptions.additionalParamMap,
41
- additionalParamMap: formOptions.additionalParamMap,
42
- entity: formData,
43
- }
44
- if (eventParams) {
45
- params.eventParams = eventParams
46
- }
47
- return formItemEventFun.call(this, params)
48
- }
49
- }
50
- },
51
- getEventFunction(formOptions, eventType, eventName) {
52
- if (
53
- formOptions &&
54
- formOptions[eventType] &&
55
- formOptions[eventType][eventName] &&
56
- typeof formOptions[eventType][eventName] === 'function'
57
- ) {
58
- return formOptions[eventType][eventName]
59
- }
60
- },
61
- }
62
- export default callFormEvents
1
+ const callFormEvents = {
2
+ // 调用点击前回调方法,返回true表示继续执行,否则false表示不执行点击事件
3
+ // buttonEventPrefix: 表单编码/列表编码__按钮编码
4
+ callBeforeClickButton(events, buttonEventPrefix, params) {
5
+ let result = true
6
+ if (events) {
7
+ const beforeClick = events[buttonEventPrefix + '__beforeClick']
8
+ if (beforeClick) {
9
+ result = beforeClick.call(this, params)
10
+ if (result === undefined) {
11
+ result = true
12
+ }
13
+ }
14
+ }
15
+ return result
16
+ },
17
+ // 调用点击后回调方法
18
+ // buttonEventPrefix: 表单编码/列表编码__按钮编码
19
+ callAfterClickButton(events, buttonEventPrefix, params) {
20
+ if (events) {
21
+ const afterClick = events[buttonEventPrefix + '__afterClick']
22
+ if (afterClick) {
23
+ afterClick.call(this, params)
24
+ }
25
+ }
26
+ },
27
+ // 调用表单组件元素的事件
28
+ callFormItemEvent(formOptions, eventName, formData, eventParams) {
29
+ if (!eventName) {
30
+ return
31
+ }
32
+ if (formOptions && formOptions.customEvents) {
33
+ const formItemEventFun = this.getEventFunction(
34
+ formOptions,
35
+ 'customEvents',
36
+ eventName
37
+ )
38
+ if (formItemEventFun) {
39
+ const params = {
40
+ params: formOptions.additionalParamMap,
41
+ additionalParamMap: formOptions.additionalParamMap,
42
+ entity: formData,
43
+ }
44
+ if (eventParams) {
45
+ params.eventParams = eventParams
46
+ }
47
+ return formItemEventFun.call(this, params)
48
+ }
49
+ }
50
+ },
51
+ getEventFunction(formOptions, eventType, eventName) {
52
+ if (
53
+ formOptions &&
54
+ formOptions[eventType] &&
55
+ formOptions[eventType][eventName] &&
56
+ typeof formOptions[eventType][eventName] === 'function'
57
+ ) {
58
+ return formOptions[eventType][eventName]
59
+ }
60
+ },
61
+ }
62
+ export default callFormEvents
@@ -1,60 +1,60 @@
1
- const buttonEvents = {
2
- // 点击按钮触发
3
- clickListButton(button) {
4
- if (button) {
5
- if (button.code === 'export') {
6
- // 导出按钮
7
- this.exportChart()
8
- }
9
- // 统计和重置按钮在ChartQuery组件内实现的
10
- // else if (button.code === 'statistics') {
11
- // // 查询按钮
12
- // const refStr = 'chartQueryRef' + this.chartQuerySetting.baseSetting.componentCode
13
- // if (this.$refs && this.$refs[refStr]) {
14
- // this.$refs[refStr].search()
15
- // }
16
- // } else if (button.code === 'reset') {
17
- // // 重置按钮
18
- // const refStr = 'chartQueryRef' + this.chartQuerySetting.baseSetting.componentCode
19
- // if (this.$refs && this.$refs[refStr]) {
20
- // this.$refs[refStr].resetForm(true)
21
- // }
22
- // } else {
23
- // 自定义按钮
24
- // TODO: 表示是扩展按钮,暂不支持自定义按钮
25
- // const param = {}
26
- // if (this.judgeHeavyList) {
27
- // // 判重组合字段配置
28
- // param.judgeHeavyList = JSON.stringify(this.judgeHeavyList)
29
- // }
30
- // if (button.autoSetValueData) {
31
- // param.autoSetValueData = JSON.stringify(button.autoSetValueData)
32
- // }
33
- // if (button.logSetting) {
34
- // param.logSettingText = button.logSetting
35
- // }
36
- // if (button.taskMap) {
37
- // param.taskMap = button.taskMap
38
- // }
39
- // if (button.jumpPage) {
40
- // this.jumpToPage(button.jumpPage, null, null, null, this.additionalParamMap, null, button.code, this.pageCode)
41
- // return
42
- // }
43
- // if (button.jsContent && button.jsContent !== null && button.jsContent !== '') {
44
- // // 将js文本转换为函数,并运行
45
- // // eslint-disable-next-line no-eval
46
- // const buttonFun = eval('(' + button.jsContent + ')')
47
- // // 运行方法
48
- // const request = buttonFun(this, param)
49
- // if (request) {
50
- // request.then(data => {
51
- // // afterClick回调方法
52
- // this.callAfterClickButton(this.listEvents, this.listCode + '__' + button.code, { params: this.additionalParamMap })
53
- // })
54
- // }
55
- // }
56
- // }
57
- }
58
- },
59
- }
60
- export default buttonEvents
1
+ const buttonEvents = {
2
+ // 点击按钮触发
3
+ clickListButton(button) {
4
+ if (button) {
5
+ if (button.code === 'export') {
6
+ // 导出按钮
7
+ this.exportChart()
8
+ }
9
+ // 统计和重置按钮在ChartQuery组件内实现的
10
+ // else if (button.code === 'statistics') {
11
+ // // 查询按钮
12
+ // const refStr = 'chartQueryRef' + this.chartQuerySetting.baseSetting.componentCode
13
+ // if (this.$refs && this.$refs[refStr]) {
14
+ // this.$refs[refStr].search()
15
+ // }
16
+ // } else if (button.code === 'reset') {
17
+ // // 重置按钮
18
+ // const refStr = 'chartQueryRef' + this.chartQuerySetting.baseSetting.componentCode
19
+ // if (this.$refs && this.$refs[refStr]) {
20
+ // this.$refs[refStr].resetForm(true)
21
+ // }
22
+ // } else {
23
+ // 自定义按钮
24
+ // TODO: 表示是扩展按钮,暂不支持自定义按钮
25
+ // const param = {}
26
+ // if (this.judgeHeavyList) {
27
+ // // 判重组合字段配置
28
+ // param.judgeHeavyList = JSON.stringify(this.judgeHeavyList)
29
+ // }
30
+ // if (button.autoSetValueData) {
31
+ // param.autoSetValueData = JSON.stringify(button.autoSetValueData)
32
+ // }
33
+ // if (button.logSetting) {
34
+ // param.logSettingText = button.logSetting
35
+ // }
36
+ // if (button.taskMap) {
37
+ // param.taskMap = button.taskMap
38
+ // }
39
+ // if (button.jumpPage) {
40
+ // this.jumpToPage(button.jumpPage, null, null, null, this.additionalParamMap, null, button.code, this.pageCode)
41
+ // return
42
+ // }
43
+ // if (button.jsContent && button.jsContent !== null && button.jsContent !== '') {
44
+ // // 将js文本转换为函数,并运行
45
+ // // eslint-disable-next-line no-eval
46
+ // const buttonFun = eval('(' + button.jsContent + ')')
47
+ // // 运行方法
48
+ // const request = buttonFun(this, param)
49
+ // if (request) {
50
+ // request.then(data => {
51
+ // // afterClick回调方法
52
+ // this.callAfterClickButton(this.listEvents, this.listCode + '__' + button.code, { params: this.additionalParamMap })
53
+ // })
54
+ // }
55
+ // }
56
+ // }
57
+ }
58
+ },
59
+ }
60
+ export default buttonEvents
@@ -1,102 +1,102 @@
1
- import store from './store'
2
- import { getLanguageWithLocale } from 'imatrix-ui/src/utils/util'
3
- // 获得store中缓存的信息。返回的是Object对象,不是json字符串
4
- export function getStoreInfo(pageCode, key) {
5
- const pageCodeStoreInfo = store.get(pageCode)
6
- if (pageCodeStoreInfo) {
7
- return pageCodeStoreInfo[key]
8
- }
9
- }
10
-
11
- // 往store中缓存信息
12
- export function setStoreInfo(pageCode, key, value) {
13
- let pageCodeStoreInfo = store.get(pageCode)
14
- if (!pageCodeStoreInfo) {
15
- pageCodeStoreInfo = {}
16
- store.set(pageCode, pageCodeStoreInfo)
17
- }
18
- pageCodeStoreInfo[key] = value
19
- }
20
- /**
21
- * 删除某属性
22
- * @param {*} pageCode
23
- * @param {*} key
24
- */
25
- export function deleteStoreInfo(pageCode, key) {
26
- let pageCodeStoreInfo = store.get(pageCode)
27
- if (pageCodeStoreInfo && pageCodeStoreInfo[key]) {
28
- delete pageCodeStoreInfo[key]
29
- }
30
- }
31
-
32
- export function getPageParam(devMode, jumpMode, buttonCode, pathQuery) {
33
- return {
34
- _pageDevMode: devMode,
35
- _sourceButtonCode: buttonCode,
36
- _pathQuery: pathQuery,
37
- }
38
- }
39
-
40
- export function isNumber(numStr) {
41
- const num = parseInt(numStr)
42
- if (Number.isInteger(num)) {
43
- // 表示是数字
44
- return true
45
- }
46
- return false
47
- }
48
-
49
- // 获得单列组件宽度
50
- export function getColWidth(col) {
51
- return col.options && col.options.colWidth ? col.options.colWidth : 24
52
- }
53
- export function isShouldAddBorder(pageSettingList) {
54
- for (let i = 0; i < pageSettingList.length; i++) {
55
- const row = pageSettingList[i]
56
- for (let j = 0; j < row.colList.length; j++) {
57
- const col = row.colList[j]
58
- if (getColWidth(col) < 24) {
59
- // 表示不是整行的,需要添加边框
60
- return true
61
- }
62
- }
63
- }
64
- return false
65
- }
66
-
67
- export function packageTemplateFiles(templateFiles) {
68
- if (!templateFiles) {
69
- return templateFiles
70
- }
71
- const currentLocale = getLanguageWithLocale()
72
- if (Array.isArray(templateFiles)) {
73
- // 表示是上传的多个模板
74
- let templateFilesResult = []
75
- let fileCodes = []
76
- const fileSeperate = '~-~-'
77
- templateFiles.forEach((template) => {
78
- let showName = template.templateShowPath
79
- if (showName.indexOf(fileSeperate) > 0) {
80
- // 表示是多语言模板
81
- const fileCode = showName.substring(0, showName.indexOf(fileSeperate))
82
- const fileLanguage = showName.substring(
83
- showName.indexOf(fileSeperate) + fileSeperate.length,
84
- showName.lastIndexOf(fileSeperate)
85
- )
86
- const fileName = showName.substring(
87
- showName.lastIndexOf(fileSeperate) + fileSeperate.length
88
- )
89
- if (currentLocale === fileLanguage && fileCodes.indexOf(fileCode) < 0) {
90
- templateFilesResult.push({
91
- templateUUID: template.templateUUID,
92
- templateShowPath: fileName,
93
- })
94
- fileCodes.push(fileCode)
95
- }
96
- } else {
97
- templateFilesResult.push(template)
98
- }
99
- })
100
- return templateFilesResult
101
- }
102
- }
1
+ import store from './store'
2
+ import { getLanguageWithLocale } from 'imatrix-ui/src/utils/util'
3
+ // 获得store中缓存的信息。返回的是Object对象,不是json字符串
4
+ export function getStoreInfo(pageCode, key) {
5
+ const pageCodeStoreInfo = store.get(pageCode)
6
+ if (pageCodeStoreInfo) {
7
+ return pageCodeStoreInfo[key]
8
+ }
9
+ }
10
+
11
+ // 往store中缓存信息
12
+ export function setStoreInfo(pageCode, key, value) {
13
+ let pageCodeStoreInfo = store.get(pageCode)
14
+ if (!pageCodeStoreInfo) {
15
+ pageCodeStoreInfo = {}
16
+ store.set(pageCode, pageCodeStoreInfo)
17
+ }
18
+ pageCodeStoreInfo[key] = value
19
+ }
20
+ /**
21
+ * 删除某属性
22
+ * @param {*} pageCode
23
+ * @param {*} key
24
+ */
25
+ export function deleteStoreInfo(pageCode, key) {
26
+ let pageCodeStoreInfo = store.get(pageCode)
27
+ if (pageCodeStoreInfo && pageCodeStoreInfo[key]) {
28
+ delete pageCodeStoreInfo[key]
29
+ }
30
+ }
31
+
32
+ export function getPageParam(devMode, jumpMode, buttonCode, pathQuery) {
33
+ return {
34
+ _pageDevMode: devMode,
35
+ _sourceButtonCode: buttonCode,
36
+ _pathQuery: pathQuery,
37
+ }
38
+ }
39
+
40
+ export function isNumber(numStr) {
41
+ const num = parseInt(numStr)
42
+ if (Number.isInteger(num)) {
43
+ // 表示是数字
44
+ return true
45
+ }
46
+ return false
47
+ }
48
+
49
+ // 获得单列组件宽度
50
+ export function getColWidth(col) {
51
+ return col.options && col.options.colWidth ? col.options.colWidth : 24
52
+ }
53
+ export function isShouldAddBorder(pageSettingList) {
54
+ for (let i = 0; i < pageSettingList.length; i++) {
55
+ const row = pageSettingList[i]
56
+ for (let j = 0; j < row.colList.length; j++) {
57
+ const col = row.colList[j]
58
+ if (getColWidth(col) < 24) {
59
+ // 表示不是整行的,需要添加边框
60
+ return true
61
+ }
62
+ }
63
+ }
64
+ return false
65
+ }
66
+
67
+ export function packageTemplateFiles(templateFiles) {
68
+ if (!templateFiles) {
69
+ return templateFiles
70
+ }
71
+ const currentLocale = getLanguageWithLocale()
72
+ if (Array.isArray(templateFiles)) {
73
+ // 表示是上传的多个模板
74
+ let templateFilesResult = []
75
+ let fileCodes = []
76
+ const fileSeperate = '~-~-'
77
+ templateFiles.forEach((template) => {
78
+ let showName = template.templateShowPath
79
+ if (showName.indexOf(fileSeperate) > 0) {
80
+ // 表示是多语言模板
81
+ const fileCode = showName.substring(0, showName.indexOf(fileSeperate))
82
+ const fileLanguage = showName.substring(
83
+ showName.indexOf(fileSeperate) + fileSeperate.length,
84
+ showName.lastIndexOf(fileSeperate)
85
+ )
86
+ const fileName = showName.substring(
87
+ showName.lastIndexOf(fileSeperate) + fileSeperate.length
88
+ )
89
+ if (currentLocale === fileLanguage && fileCodes.indexOf(fileCode) < 0) {
90
+ templateFilesResult.push({
91
+ templateUUID: template.templateUUID,
92
+ templateShowPath: fileName,
93
+ })
94
+ fileCodes.push(fileCode)
95
+ }
96
+ } else {
97
+ templateFilesResult.push(template)
98
+ }
99
+ })
100
+ return templateFilesResult
101
+ }
102
+ }
@@ -1,70 +1,70 @@
1
- const buttonEvents = {
2
- // 按钮组件的操作
3
- clickButtonEvent(buttonSetting, system) {
4
- const jsContent = buttonSetting.options.jsContent
5
- if (
6
- typeof jsContent !== 'undefined' &&
7
- jsContent !== null &&
8
- jsContent !== ''
9
- ) {
10
- // 将js文本转换为函数,并运行
11
- // eslint-disable-next-line no-eval
12
- const buttonFun = eval('(' + jsContent + ')')
13
- // 运行方法
14
- const request = buttonFun(this, system)
15
- if (request) {
16
- request.then((data) => {
17
- this.$message({
18
- showClose: true,
19
- type: 'success',
20
- message: this.$t('superPageMessage.successfulOperation'),
21
- })
22
- })
23
- }
24
- } else {
25
- if (buttonSetting.options.operationType === 'inner') {
26
- // 内置操作时
27
- this.jumpToPage(
28
- buttonSetting.options.jumpPage,
29
- system,
30
- null,
31
- null,
32
- this.additionalParamMap,
33
- null,
34
- null,
35
- this.pageCode
36
- )
37
- } else if (buttonSetting.options.operationType === 'custom') {
38
- // 自定义操作时
39
- const path = this.getRealRestApiPath(
40
- buttonSetting.options.restfulApiPat,
41
- system
42
- )
43
- const config = { url: path }
44
- const apiMethod = buttonSetting.options.restfulApiMethod
45
- if (apiMethod) {
46
- config.method = apiMethod
47
- }
48
- const params = buttonSetting.options.restfulApiParameters
49
- if (params) {
50
- config.data = params
51
- }
52
- if (buttonSetting.options.logSetting) {
53
- config.logSettingText = buttonSetting.options.logSetting
54
- }
55
- if (!config.systemCode) {
56
- config.systemCode = system.code
57
- }
58
- this.$http.request(config).then((data) => {
59
- // console.log('clickButtonEvent', data)
60
- this.$message({
61
- showClose: true,
62
- type: 'success',
63
- message: this.$t('superPageMessage.successfulOperation'),
64
- })
65
- })
66
- }
67
- }
68
- },
69
- }
70
- export default buttonEvents
1
+ const buttonEvents = {
2
+ // 按钮组件的操作
3
+ clickButtonEvent(buttonSetting, system) {
4
+ const jsContent = buttonSetting.options.jsContent
5
+ if (
6
+ typeof jsContent !== 'undefined' &&
7
+ jsContent !== null &&
8
+ jsContent !== ''
9
+ ) {
10
+ // 将js文本转换为函数,并运行
11
+ // eslint-disable-next-line no-eval
12
+ const buttonFun = eval('(' + jsContent + ')')
13
+ // 运行方法
14
+ const request = buttonFun(this, system)
15
+ if (request) {
16
+ request.then((data) => {
17
+ this.$message({
18
+ showClose: true,
19
+ type: 'success',
20
+ message: this.$t('superPageMessage.successfulOperation'),
21
+ })
22
+ })
23
+ }
24
+ } else {
25
+ if (buttonSetting.options.operationType === 'inner') {
26
+ // 内置操作时
27
+ this.jumpToPage(
28
+ buttonSetting.options.jumpPage,
29
+ system,
30
+ null,
31
+ null,
32
+ this.additionalParamMap,
33
+ null,
34
+ null,
35
+ this.pageCode
36
+ )
37
+ } else if (buttonSetting.options.operationType === 'custom') {
38
+ // 自定义操作时
39
+ const path = this.getRealRestApiPath(
40
+ buttonSetting.options.restfulApiPat,
41
+ system
42
+ )
43
+ const config = { url: path }
44
+ const apiMethod = buttonSetting.options.restfulApiMethod
45
+ if (apiMethod) {
46
+ config.method = apiMethod
47
+ }
48
+ const params = buttonSetting.options.restfulApiParameters
49
+ if (params) {
50
+ config.data = params
51
+ }
52
+ if (buttonSetting.options.logSetting) {
53
+ config.logSettingText = buttonSetting.options.logSetting
54
+ }
55
+ if (!config.systemCode) {
56
+ config.systemCode = system.code
57
+ }
58
+ this.$http.request(config).then((data) => {
59
+ // console.log('clickButtonEvent', data)
60
+ this.$message({
61
+ showClose: true,
62
+ type: 'success',
63
+ message: this.$t('superPageMessage.successfulOperation'),
64
+ })
65
+ })
66
+ }
67
+ }
68
+ },
69
+ }
70
+ export default buttonEvents