vue2-client 1.20.61 → 1.20.63
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/.idea/af-vue2-client.iml +4 -7
- package/.idea/deployment.xml +14 -0
- package/.idea/misc.xml +6 -0
- package/package.json +116 -115
- package/src/base-client/components/VueSfcComponent/CloudVueSfcComponent.vue +233 -0
- package/src/base-client/components/VueSfcComponent/VueSfcComponent.vue +246 -0
- package/src/base-client/components/common/HIS/HTab/HTab.vue +115 -1
- package/src/base-client/components/common/Tree/Tree.vue +1 -1
- package/src/base-client/components/common/XDetailsView/XDetailsView.vue +1 -1
- package/src/base-client/components/common/XInspectionDetailDrawer/components/CheckItems.vue +871 -871
- package/src/base-client/components/common/XInspectionDetailDrawer/components/InspectionSummary.vue +579 -579
- package/src/base-client/components/common/XTab/XTab.vue +18 -0
- package/src/base-client/components/his/XHDescriptions/XHDescriptions.vue +337 -8
- package/src/base-client/components/his/XHDescriptions/index.md +114 -0
- package/src/layouts/VuePage.vue +94 -0
- package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowLog.vue +221 -221
- package/src/router/async/router.map.js +2 -0
- package/src/utils/module-loader/Vue2ClientModuleLoader.js +118 -0
- package/src/utils/module-loader/VueSfcModuleCache.js +93 -0
- package/src/utils/module-loader/index.js +5 -0
- package/src/utils/routerUtil.js +9 -0
- package/.idea/git_toolbox_blame.xml +0 -6
- package/.idea/git_toolbox_prj.xml +0 -15
package/.idea/af-vue2-client.iml
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
|
9
6
|
<orderEntry type="inheritedJdk" />
|
|
10
7
|
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
8
|
</component>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
|
|
4
|
+
<serverData>
|
|
5
|
+
<paths name="50.4">
|
|
6
|
+
<serverdata>
|
|
7
|
+
<mappings>
|
|
8
|
+
<mapping local="$PROJECT_DIR$" web="/" />
|
|
9
|
+
</mappings>
|
|
10
|
+
</serverdata>
|
|
11
|
+
</paths>
|
|
12
|
+
</serverData>
|
|
13
|
+
</component>
|
|
14
|
+
</project>
|
package/.idea/misc.xml
ADDED
package/package.json
CHANGED
|
@@ -1,115 +1,116 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vue2-client",
|
|
3
|
-
"version": "1.20.
|
|
4
|
-
"private": false,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
|
|
7
|
-
"serve:gaslink": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode gaslink",
|
|
8
|
-
"serve:revenue": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode revenue",
|
|
9
|
-
"serve:liuli": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode liuli",
|
|
10
|
-
"serve:scada": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode scada",
|
|
11
|
-
"serve:iot": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode iot",
|
|
12
|
-
"serve:his": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode his",
|
|
13
|
-
"serve:runtime": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode runtime",
|
|
14
|
-
"serve:message": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode message",
|
|
15
|
-
"serve:apply": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode apply",
|
|
16
|
-
"mac-serve": "vue-cli-service serve --no-eslint --mode his",
|
|
17
|
-
"build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
|
|
18
|
-
"test:unit": "vue-cli-service test:unit",
|
|
19
|
-
"lint": "vue-cli-service lint",
|
|
20
|
-
"build:preview": "vue-cli-service build --mode preview",
|
|
21
|
-
"lint:nofix": "vue-cli-service lint --no-fix",
|
|
22
|
-
"test": "jest"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@afwenming123/vue-easy-tree": "^1.0.1",
|
|
26
|
-
"@afwenming123/vue-plugin-hiprint": "^0.0.70",
|
|
27
|
-
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
28
|
-
"@antv/data-set": "^0.11.8",
|
|
29
|
-
"@antv/g2plot": "^2.4.31",
|
|
30
|
-
"@hufe921/canvas-editor": "^0.9.49",
|
|
31
|
-
"@microsoft/fetch-event-source": "^2.0.1",
|
|
32
|
-
"@vue/babel-preset-jsx": "^1.4.0",
|
|
33
|
-
"animate.css": "^4.1.1",
|
|
34
|
-
"ant-design-vue": "^1.7.8",
|
|
35
|
-
"axios": "^0.27.2",
|
|
36
|
-
"clipboard": "^2.0.11",
|
|
37
|
-
"core-js": "^3.33.0",
|
|
38
|
-
"crypto-js": "^4.1.1",
|
|
39
|
-
"date-fns": "^2.29.3",
|
|
40
|
-
"default-passive-events": "^2.0.0",
|
|
41
|
-
"dotenv": "^16.3.1",
|
|
42
|
-
"echarts": "^5.5.0",
|
|
43
|
-
"enquire.js": "^2.1.6",
|
|
44
|
-
"file-saver": "^2.0.5",
|
|
45
|
-
"highlight.js": "^11.7.0",
|
|
46
|
-
"html-to-image": "^1.11.13",
|
|
47
|
-
"html2canvas": "^1.4.1",
|
|
48
|
-
"js-base64": "^3.7.5",
|
|
49
|
-
"js-cookie": "^2.2.1",
|
|
50
|
-
"jsencrypt": "^3.3.2",
|
|
51
|
-
"jspdf": "^2.5.1",
|
|
52
|
-
"lodash.clonedeep": "^4.5.0",
|
|
53
|
-
"lodash.debounce": "^4",
|
|
54
|
-
"lodash.get": "^4.4.2",
|
|
55
|
-
"marked": "^4",
|
|
56
|
-
"mockjs": "^1.1.0",
|
|
57
|
-
"nprogress": "^0.2.0",
|
|
58
|
-
"ol": "10.3.1",
|
|
59
|
-
"qs": "^6.11.2",
|
|
60
|
-
"regenerator-runtime": "^0.14.0",
|
|
61
|
-
"splitpanes": "^2.4.1",
|
|
62
|
-
"videojs-contrib-hls": "^5.15.0",
|
|
63
|
-
"viser-vue": "^2.4.8",
|
|
64
|
-
"vue": "^2.7.14",
|
|
65
|
-
"vue-codemirror": "4.0.6",
|
|
66
|
-
"vue-color": "2.7.0",
|
|
67
|
-
"vue-draggable-resizable": "^2.3.0",
|
|
68
|
-
"vue-i18n": "^8.28.2",
|
|
69
|
-
"vue-json-viewer": "^2.2.22",
|
|
70
|
-
"vue-router": "^3.6.5",
|
|
71
|
-
"vue-video-player": "^5.0.2",
|
|
72
|
-
"vue-virtual-scroller": "^1.1.2",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"@
|
|
80
|
-
"@babel/
|
|
81
|
-
"@babel/
|
|
82
|
-
"@
|
|
83
|
-
"@vue/cli-plugin-
|
|
84
|
-
"@vue/cli-
|
|
85
|
-
"@vue/
|
|
86
|
-
"@vue/
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"eslint
|
|
93
|
-
"eslint-
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"jest
|
|
98
|
-
"jest-
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"vue-
|
|
104
|
-
"vue-
|
|
105
|
-
"
|
|
106
|
-
"webpack
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"not
|
|
114
|
-
|
|
115
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "vue2-client",
|
|
3
|
+
"version": "1.20.63",
|
|
4
|
+
"private": false,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
|
|
7
|
+
"serve:gaslink": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode gaslink",
|
|
8
|
+
"serve:revenue": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode revenue",
|
|
9
|
+
"serve:liuli": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode liuli",
|
|
10
|
+
"serve:scada": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode scada",
|
|
11
|
+
"serve:iot": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode iot",
|
|
12
|
+
"serve:his": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode his",
|
|
13
|
+
"serve:runtime": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode runtime",
|
|
14
|
+
"serve:message": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode message",
|
|
15
|
+
"serve:apply": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode apply",
|
|
16
|
+
"mac-serve": "vue-cli-service serve --no-eslint --mode his",
|
|
17
|
+
"build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
|
|
18
|
+
"test:unit": "vue-cli-service test:unit",
|
|
19
|
+
"lint": "vue-cli-service lint",
|
|
20
|
+
"build:preview": "vue-cli-service build --mode preview",
|
|
21
|
+
"lint:nofix": "vue-cli-service lint --no-fix",
|
|
22
|
+
"test": "jest"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@afwenming123/vue-easy-tree": "^1.0.1",
|
|
26
|
+
"@afwenming123/vue-plugin-hiprint": "^0.0.70",
|
|
27
|
+
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
28
|
+
"@antv/data-set": "^0.11.8",
|
|
29
|
+
"@antv/g2plot": "^2.4.31",
|
|
30
|
+
"@hufe921/canvas-editor": "^0.9.49",
|
|
31
|
+
"@microsoft/fetch-event-source": "^2.0.1",
|
|
32
|
+
"@vue/babel-preset-jsx": "^1.4.0",
|
|
33
|
+
"animate.css": "^4.1.1",
|
|
34
|
+
"ant-design-vue": "^1.7.8",
|
|
35
|
+
"axios": "^0.27.2",
|
|
36
|
+
"clipboard": "^2.0.11",
|
|
37
|
+
"core-js": "^3.33.0",
|
|
38
|
+
"crypto-js": "^4.1.1",
|
|
39
|
+
"date-fns": "^2.29.3",
|
|
40
|
+
"default-passive-events": "^2.0.0",
|
|
41
|
+
"dotenv": "^16.3.1",
|
|
42
|
+
"echarts": "^5.5.0",
|
|
43
|
+
"enquire.js": "^2.1.6",
|
|
44
|
+
"file-saver": "^2.0.5",
|
|
45
|
+
"highlight.js": "^11.7.0",
|
|
46
|
+
"html-to-image": "^1.11.13",
|
|
47
|
+
"html2canvas": "^1.4.1",
|
|
48
|
+
"js-base64": "^3.7.5",
|
|
49
|
+
"js-cookie": "^2.2.1",
|
|
50
|
+
"jsencrypt": "^3.3.2",
|
|
51
|
+
"jspdf": "^2.5.1",
|
|
52
|
+
"lodash.clonedeep": "^4.5.0",
|
|
53
|
+
"lodash.debounce": "^4",
|
|
54
|
+
"lodash.get": "^4.4.2",
|
|
55
|
+
"marked": "^4",
|
|
56
|
+
"mockjs": "^1.1.0",
|
|
57
|
+
"nprogress": "^0.2.0",
|
|
58
|
+
"ol": "10.3.1",
|
|
59
|
+
"qs": "^6.11.2",
|
|
60
|
+
"regenerator-runtime": "^0.14.0",
|
|
61
|
+
"splitpanes": "^2.4.1",
|
|
62
|
+
"videojs-contrib-hls": "^5.15.0",
|
|
63
|
+
"viser-vue": "^2.4.8",
|
|
64
|
+
"vue": "^2.7.14",
|
|
65
|
+
"vue-codemirror": "4.0.6",
|
|
66
|
+
"vue-color": "2.7.0",
|
|
67
|
+
"vue-draggable-resizable": "^2.3.0",
|
|
68
|
+
"vue-i18n": "^8.28.2",
|
|
69
|
+
"vue-json-viewer": "^2.2.22",
|
|
70
|
+
"vue-router": "^3.6.5",
|
|
71
|
+
"vue-video-player": "^5.0.2",
|
|
72
|
+
"vue-virtual-scroller": "^1.1.2",
|
|
73
|
+
"vue3-sfc-loader": "^0.9.5",
|
|
74
|
+
"vuedraggable": "^2.24.3",
|
|
75
|
+
"vuex": "^3.6.2",
|
|
76
|
+
"xlsx": "0.18.5"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@ant-design/colors": "^7.0.0",
|
|
80
|
+
"@babel/core": "^7.22.20",
|
|
81
|
+
"@babel/eslint-parser": "^7.22.15",
|
|
82
|
+
"@babel/preset-env": "^7.22.20",
|
|
83
|
+
"@vue/cli-plugin-babel": "^5.0.8",
|
|
84
|
+
"@vue/cli-plugin-eslint": "^5.0.8",
|
|
85
|
+
"@vue/cli-service": "^5.0.8",
|
|
86
|
+
"@vue/eslint-config-standard": "^8.0.1",
|
|
87
|
+
"@vue/test-utils": "^1.3.6",
|
|
88
|
+
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
89
|
+
"compression-webpack-plugin": "^10.0.0",
|
|
90
|
+
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
91
|
+
"deepmerge": "^4.3.1",
|
|
92
|
+
"eslint": "^8.51.0",
|
|
93
|
+
"eslint-config-prettier": "^10.1.8",
|
|
94
|
+
"eslint-plugin-vue": "^9.17.0",
|
|
95
|
+
"fast-deep-equal": "^3.1.3",
|
|
96
|
+
"ignore-loader": "^0.1.2",
|
|
97
|
+
"jest": "^29.7.0",
|
|
98
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
99
|
+
"jest-transform-stub": "^2.0.0",
|
|
100
|
+
"less-loader": "^6.2.0",
|
|
101
|
+
"script-loader": "^0.7.2",
|
|
102
|
+
"style-resources-loader": "^1.5.0",
|
|
103
|
+
"vue-cli-plugin-style-resources-loader": "^0.1.5",
|
|
104
|
+
"vue-jest": "^4.0.1",
|
|
105
|
+
"vue-template-compiler": "^2.7.14",
|
|
106
|
+
"webpack": "^5.88.2",
|
|
107
|
+
"webpack-theme-color-replacer": "^1.4.7",
|
|
108
|
+
"whatwg-fetch": "^3.6.19"
|
|
109
|
+
},
|
|
110
|
+
"browserslist": [
|
|
111
|
+
"> 1%",
|
|
112
|
+
"last 2 versions",
|
|
113
|
+
"not dead",
|
|
114
|
+
"not ie 11"
|
|
115
|
+
]
|
|
116
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { getConfigByNameAsync } from '@vue2-client/services/api/common'
|
|
3
|
+
import { loadModule } from 'vue3-sfc-loader/vue2'
|
|
4
|
+
import { VueSfcModuleCache } from '@vue2-client/utils/module-loader'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: 'CloudVueSfcComponent',
|
|
8
|
+
props: {
|
|
9
|
+
configName: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
serviceName: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: process.env.VUE_APP_SYSTEM_NAME
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
componentDefinition: null,
|
|
21
|
+
loading: false,
|
|
22
|
+
error: null,
|
|
23
|
+
injectedStyles: []
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
previewStyles() {
|
|
28
|
+
return {
|
|
29
|
+
width: '100%',
|
|
30
|
+
height: '100%',
|
|
31
|
+
overflow: 'auto'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
created() {
|
|
36
|
+
this.loadSfcFromCloud()
|
|
37
|
+
},
|
|
38
|
+
beforeDestroy() {
|
|
39
|
+
this.cleanupInjectedStyles()
|
|
40
|
+
},
|
|
41
|
+
methods: {
|
|
42
|
+
cleanupInjectedStyles() {
|
|
43
|
+
if (this.injectedStyles && this.injectedStyles.length > 0) {
|
|
44
|
+
this.injectedStyles.forEach(style => {
|
|
45
|
+
if (style.parentNode) {
|
|
46
|
+
style.parentNode.removeChild(style)
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
this.injectedStyles = []
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 刷新组件 - 重新从云端获取并渲染
|
|
55
|
+
*/
|
|
56
|
+
refresh() {
|
|
57
|
+
this.loadSfcFromCloud()
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 从云端加载 SFC
|
|
62
|
+
*/
|
|
63
|
+
async loadSfcFromCloud() {
|
|
64
|
+
this.loading = true
|
|
65
|
+
this.error = null
|
|
66
|
+
this.cleanupInjectedStyles()
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
// 1. 获取云端配置
|
|
70
|
+
const config = await getConfigByNameAsync(this.configName, this.serviceName)
|
|
71
|
+
|
|
72
|
+
if (!config || !config.source) {
|
|
73
|
+
this.error = '配置内容为空'
|
|
74
|
+
this.componentDefinition = null
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const sfcCode = typeof config.source === 'string' ? config.source : JSON.stringify(config.source)
|
|
79
|
+
|
|
80
|
+
if (!sfcCode || !sfcCode.trim()) {
|
|
81
|
+
this.error = '配置内容为空'
|
|
82
|
+
this.componentDefinition = null
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 2. 获取 moduleCache
|
|
87
|
+
const moduleCache = VueSfcModuleCache.toObject()
|
|
88
|
+
|
|
89
|
+
// 3. 准备编译选项
|
|
90
|
+
const timestamp = Date.now()
|
|
91
|
+
const virtualUrl = `cloud-sfc.vue?t=${timestamp}`
|
|
92
|
+
|
|
93
|
+
const options = {
|
|
94
|
+
moduleCache,
|
|
95
|
+
getFile: (url) => {
|
|
96
|
+
if (url.startsWith('cloud-sfc.vue')) {
|
|
97
|
+
return {
|
|
98
|
+
getContentData: (asBinary) => asBinary ? null : sfcCode,
|
|
99
|
+
type: '.vue'
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
console.warn('[CloudVueSfcComponent] getFile 被非 cloud-sfc 路径调用:', url)
|
|
103
|
+
return {
|
|
104
|
+
getContentData: () => null,
|
|
105
|
+
type: ''
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
addStyle: (textContent) => {
|
|
109
|
+
const style = document.createElement('style')
|
|
110
|
+
style.textContent = textContent
|
|
111
|
+
document.head.appendChild(style)
|
|
112
|
+
this.injectedStyles.push(style)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 4. 编译 SFC
|
|
117
|
+
const component = await loadModule(virtualUrl, options)
|
|
118
|
+
|
|
119
|
+
if (component && typeof component === 'object') {
|
|
120
|
+
this.componentDefinition = component
|
|
121
|
+
} else {
|
|
122
|
+
this.error = '组件加载失败,返回结果为空'
|
|
123
|
+
this.componentDefinition = null
|
|
124
|
+
}
|
|
125
|
+
} catch (e) {
|
|
126
|
+
console.error('[CloudVueSfcComponent] 加载错误:', e)
|
|
127
|
+
this.error = this.formatError(e)
|
|
128
|
+
this.componentDefinition = null
|
|
129
|
+
} finally {
|
|
130
|
+
this.loading = false
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
formatError(e) {
|
|
135
|
+
if (e.message) {
|
|
136
|
+
return e.message.replace(/https?:\/\/[^\s]+/g, '').trim() || '组件渲染失败'
|
|
137
|
+
}
|
|
138
|
+
if (typeof e === 'string') {
|
|
139
|
+
return e
|
|
140
|
+
}
|
|
141
|
+
return '组件渲染失败'
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
render(h) {
|
|
145
|
+
if (this.loading) {
|
|
146
|
+
return h('div', {
|
|
147
|
+
class: 'cloud-vue-sfc-component',
|
|
148
|
+
style: this.previewStyles
|
|
149
|
+
}, [
|
|
150
|
+
h('div', {
|
|
151
|
+
class: 'loading-wrapper',
|
|
152
|
+
style: { display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%' }
|
|
153
|
+
}, [
|
|
154
|
+
h('a-spin', { props: { size: 'large' } }),
|
|
155
|
+
h('span', { style: { marginLeft: '12px', color: '#666' } }, '正在加载云端组件...')
|
|
156
|
+
])
|
|
157
|
+
])
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (this.error) {
|
|
161
|
+
return h('div', {
|
|
162
|
+
class: 'cloud-vue-sfc-component',
|
|
163
|
+
style: this.previewStyles
|
|
164
|
+
}, [
|
|
165
|
+
h('div', {
|
|
166
|
+
class: 'error-wrapper',
|
|
167
|
+
style: { padding: '16px', color: '#f5222d' }
|
|
168
|
+
}, [
|
|
169
|
+
h('a-icon', { props: { type: 'close-circle', theme: 'filled', style: { fontSize: '20px', marginRight: '8px' } } }),
|
|
170
|
+
h('span', { style: { fontWeight: '500' } }, '加载错误'),
|
|
171
|
+
h('pre', {
|
|
172
|
+
style: {
|
|
173
|
+
marginTop: '8px',
|
|
174
|
+
padding: '12px',
|
|
175
|
+
background: '#fff2f0',
|
|
176
|
+
borderRadius: '4px',
|
|
177
|
+
fontSize: '12px',
|
|
178
|
+
whiteSpace: 'pre-wrap',
|
|
179
|
+
wordBreak: 'break-all'
|
|
180
|
+
}
|
|
181
|
+
}, this.error),
|
|
182
|
+
h('a-button', {
|
|
183
|
+
props: { type: 'link', icon: 'reload', style: { marginTop: '8px' } },
|
|
184
|
+
on: { click: this.refresh }
|
|
185
|
+
}, '重试')
|
|
186
|
+
])
|
|
187
|
+
])
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (this.componentDefinition) {
|
|
191
|
+
try {
|
|
192
|
+
return h(this.componentDefinition, { props: this.$attrs })
|
|
193
|
+
} catch (err) {
|
|
194
|
+
console.error('[CloudVueSfcComponent] 渲染错误:', err)
|
|
195
|
+
return h('div', {
|
|
196
|
+
style: { padding: '16px', color: '#f5222d' }
|
|
197
|
+
}, '渲染组件时出错: ' + err.message)
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return h('div', {
|
|
202
|
+
class: 'cloud-vue-sfc-component',
|
|
203
|
+
style: this.previewStyles
|
|
204
|
+
}, [
|
|
205
|
+
h('div', {
|
|
206
|
+
class: 'empty-wrapper',
|
|
207
|
+
style: { display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%', color: '#999' }
|
|
208
|
+
}, [
|
|
209
|
+
h('a-empty', {
|
|
210
|
+
props: { description: '暂无云端组件内容' }
|
|
211
|
+
})
|
|
212
|
+
])
|
|
213
|
+
])
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
</script>
|
|
217
|
+
|
|
218
|
+
<style scoped lang="less">
|
|
219
|
+
.cloud-vue-sfc-component {
|
|
220
|
+
background: #fff;
|
|
221
|
+
border: 1px solid #e8e8e8;
|
|
222
|
+
border-radius: 4px;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.loading-wrapper,
|
|
227
|
+
.error-wrapper,
|
|
228
|
+
.content-wrapper,
|
|
229
|
+
.empty-wrapper {
|
|
230
|
+
width: 100%;
|
|
231
|
+
height: 100%;
|
|
232
|
+
}
|
|
233
|
+
</style>
|