vue2-client 1.8.4 → 1.8.5
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/.eslintrc.js +1 -0
- package/docs/index.md +2 -1
- package/package.json +5 -4
- package/src/App.vue +3 -89
- package/src/base-client/components/common/AMisRender/index.vue +42 -6
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +3 -3
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1 -1
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +4 -8
- package/src/base-client/components/common/Tree/Tree.vue +149 -0
- package/src/base-client/components/common/Tree/index.js +2 -0
- package/src/base-client/components/common/XCard/XCard.vue +1 -1
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +2 -2
- package/src/base-client/components/common/XFormTable/XFormTable.vue +2 -2
- package/src/base-client/components/common/XStepView/XStepView.vue +492 -0
- package/src/base-client/components/common/XStepView/index.js +3 -0
- package/src/base-client/components/common/XStepView/index.md +31 -0
- package/src/base-client/components/index.js +45 -41
- package/src/bootstrap.js +2 -2
- package/src/config/default/setting.config.js +2 -2
- package/src/main.js +40 -12
- package/src/pages/AMisDemo/AMisDemo.vue +41 -140
- package/src/pages/CreateQueryPage.vue +6 -0
- package/src/pages/resourceManage/orgListManage.vue +2 -2
- package/src/react-client/amis-react-starter/.prettierrc +12 -0
- package/src/react-client/amis-react-starter/LICENSE +201 -0
- package/src/react-client/amis-react-starter/README.md +16 -0
- package/src/react-client/amis-react-starter/index.html +13 -0
- package/src/react-client/amis-react-starter/package.json +63 -0
- package/src/react-client/amis-react-starter/server.js +23 -0
- package/src/react-client/amis-react-starter/snowpack/favicon.ico +0 -0
- package/src/react-client/amis-react-starter/snowpack/index.html +25 -0
- package/src/react-client/amis-react-starter/snowpack.config.js +30 -0
- package/src/react-client/amis-react-starter/src/AMISComponent.tsx +79 -0
- package/src/react-client/amis-react-starter/src/App.tsx +154 -0
- package/src/react-client/amis-react-starter/src/index.html +13 -0
- package/src/react-client/amis-react-starter/src/index.tsx +7 -0
- package/src/react-client/amis-react-starter/src/react-app-env.d.ts +74 -0
- package/src/react-client/amis-react-starter/tsconfig.json +19 -0
- package/src/react-client/amis-react-starter/vite.config.ts +7 -0
- package/src/react-client/amis-react-starter/webpack.config.js +76 -0
- package/src/router/async/router.map.js +1 -1
- package/src/router.js +13 -0
- package/src/services/api/common.js +9 -1
- package/test/Amis.spec.js +163 -0
- package/test/Tree.spec.js +167 -0
- package/vue.config.js +21 -5
package/.eslintrc.js
CHANGED
package/docs/index.md
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* [XFormCol 适用于表单的通用响应式栅格a-col封装](../src/base-client/components/common/XFormCol/index.md)
|
|
13
13
|
* [XFormTable 动态查询控件,进一步整合了XTable和XForm](../src/base-client/components/common/XFormTable/index.md)
|
|
14
14
|
* [XTable 动态表格控件,根据JSON配置生成一个完整的动态表格](../src/base-client/components/common/XTable/index.md)
|
|
15
|
-
|
|
15
|
+
* [XTable 动态表格控件,根据JSON配置生成一个完整的动态表格](../src/base-client/components/common/XTable/index.md)
|
|
16
|
+
*
|
|
16
17
|
### iot
|
|
17
18
|
* [CustomerDetailsView 客户详情页](../src/base-client/components/iot/CustomerDetailsView/index.md)
|
|
18
19
|
* [DeviceDetailsView 档案详情页](../src/base-client/components/iot/DeviceDetailsView/index.md)
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue2-client",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
|
7
|
-
"mac-serve": "vue-cli-service serve --mode mac",
|
|
6
|
+
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
|
|
7
|
+
"mac-serve": "vue-cli-service serve --no-eslint --mode mac",
|
|
8
8
|
"build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
|
|
9
9
|
"test:unit": "vue-cli-service test:unit",
|
|
10
10
|
"lint": "vue-cli-service lint",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"babel-jest": "^26.6.3",
|
|
64
64
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
65
65
|
"compression-webpack-plugin": "^10.0.0",
|
|
66
|
-
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
67
66
|
"copy-webpack-plugin": "^11.0.0",
|
|
67
|
+
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
68
68
|
"deepmerge": "^4.3.1",
|
|
69
69
|
"eslint": "^8.51.0",
|
|
70
70
|
"eslint-plugin-vue": "^9.17.0",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"jest-transform-stub": "^2.0.0",
|
|
75
75
|
"less-loader": "^6.2.0",
|
|
76
76
|
"script-loader": "^0.7.2",
|
|
77
|
+
"ignore-loader": "^0.1.2",
|
|
77
78
|
"style-resources-loader": "^1.5.0",
|
|
78
79
|
"vue-cli-plugin-style-resources-loader": "^0.1.5",
|
|
79
80
|
"vue-jest": "^4.0.1",
|
package/src/App.vue
CHANGED
|
@@ -1,98 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<div id="app">
|
|
3
3
|
<router-view/>
|
|
4
|
-
</
|
|
4
|
+
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script>
|
|
8
|
-
import { enquireScreen } from '@vue2-client/utils/util'
|
|
9
|
-
import { mapState, mapMutations } from 'vuex'
|
|
10
|
-
import themeUtil from '@vue2-client/utils/themeUtil'
|
|
11
|
-
import { getI18nKey } from '@vue2-client/utils/routerUtil'
|
|
12
|
-
import { setSystemVersion } from '@vue2-client/utils/request'
|
|
13
|
-
|
|
14
8
|
export default {
|
|
15
|
-
name: 'App'
|
|
16
|
-
data () {
|
|
17
|
-
return {
|
|
18
|
-
locale: {}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
created () {
|
|
22
|
-
this.setHtmlTitle()
|
|
23
|
-
this.setLanguage(this.lang)
|
|
24
|
-
enquireScreen(isMobile => this.setDevice(isMobile))
|
|
25
|
-
},
|
|
26
|
-
mounted () {
|
|
27
|
-
this.setWeekModeTheme(this.weekMode)
|
|
28
|
-
// 设置系统版本
|
|
29
|
-
setSystemVersion(this.compatible)
|
|
30
|
-
},
|
|
31
|
-
watch: {
|
|
32
|
-
weekMode (val) {
|
|
33
|
-
this.setWeekModeTheme(val)
|
|
34
|
-
},
|
|
35
|
-
lang (val) {
|
|
36
|
-
this.setLanguage(val)
|
|
37
|
-
this.setHtmlTitle()
|
|
38
|
-
},
|
|
39
|
-
$route () {
|
|
40
|
-
this.setHtmlTitle()
|
|
41
|
-
},
|
|
42
|
-
'theme.mode': {
|
|
43
|
-
immediate: true,
|
|
44
|
-
handler: function (val) {
|
|
45
|
-
const closeMessage = this.$message.loading(`您选择了主题模式 ${val}, 正在切换...`)
|
|
46
|
-
themeUtil.changeThemeColor(this.theme.color, val).then(closeMessage)
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
'theme.color': {
|
|
50
|
-
immediate: true,
|
|
51
|
-
handler: function (val) {
|
|
52
|
-
const closeMessage = this.$message.loading(`您选择了主题色 ${val}, 正在切换...`)
|
|
53
|
-
themeUtil.changeThemeColor(val, this.theme.mode).then(closeMessage)
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
layout: function () {
|
|
57
|
-
window.dispatchEvent(new Event('resize'))
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
computed: {
|
|
61
|
-
...mapState('setting', ['layout', 'theme', 'weekMode', 'lang', 'compatible'])
|
|
62
|
-
},
|
|
63
|
-
methods: {
|
|
64
|
-
...mapMutations('setting', ['setDevice']),
|
|
65
|
-
setWeekModeTheme (weekMode) {
|
|
66
|
-
if (weekMode) {
|
|
67
|
-
document.body.classList.add('week-mode')
|
|
68
|
-
} else {
|
|
69
|
-
document.body.classList.remove('week-mode')
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
setLanguage (lang) {
|
|
73
|
-
this.$i18n.locale = lang
|
|
74
|
-
switch (lang) {
|
|
75
|
-
case 'CN':
|
|
76
|
-
this.locale = require('ant-design-vue/es/locale-provider/zh_CN').default
|
|
77
|
-
break
|
|
78
|
-
case 'HK':
|
|
79
|
-
this.locale = require('ant-design-vue/es/locale-provider/zh_TW').default
|
|
80
|
-
break
|
|
81
|
-
case 'US':
|
|
82
|
-
default:
|
|
83
|
-
this.locale = require('ant-design-vue/es/locale-provider/en_US').default
|
|
84
|
-
break
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
setHtmlTitle () {
|
|
88
|
-
const route = this.$route
|
|
89
|
-
const key = route.path === '/' ? 'home.name' : getI18nKey(route.matched[route.matched.length - 1].path)
|
|
90
|
-
document.title = process.env.VUE_APP_NAME + ' | ' + this.$t(key)
|
|
91
|
-
},
|
|
92
|
-
popContainer () {
|
|
93
|
-
return document.getElementById('popContainer')
|
|
94
|
-
}
|
|
95
|
-
}
|
|
9
|
+
name: 'App'
|
|
96
10
|
}
|
|
97
11
|
</script>
|
|
98
12
|
|
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
// 可以不引用, 如果你不想要任何辅助类样式的话 (比如 `m-t-xs` 这种)
|
|
9
9
|
// https://aisuda.bce.baidu.com/amis/zh-CN/style/index
|
|
10
|
-
import 'amis/sdk/helper.css'
|
|
10
|
+
// import 'amis/sdk/helper.css'
|
|
11
11
|
import qs from 'qs'
|
|
12
|
+
import Vue from 'vue'
|
|
13
|
+
import Index from '@vue2-client/base-client/components/index.js'
|
|
14
|
+
import locale from 'ant-design-vue/es/locale-provider/zh_CN'
|
|
12
15
|
|
|
13
16
|
function loadScript (src, callback) {
|
|
14
17
|
const script = document.createElement('script')
|
|
@@ -29,6 +32,35 @@ function loadStyles (styles) {
|
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
// 动态导入组件
|
|
36
|
+
function CustomComponent (props) {
|
|
37
|
+
const React = window.amisRequire('react')
|
|
38
|
+
const dom = React.useRef(null)
|
|
39
|
+
const store = Vue.$store
|
|
40
|
+
const router = Vue.$router
|
|
41
|
+
const i18n = Vue.$i18n
|
|
42
|
+
React.useEffect(function () {
|
|
43
|
+
new Vue({
|
|
44
|
+
router,
|
|
45
|
+
store,
|
|
46
|
+
i18n,
|
|
47
|
+
render: h => h('a-config-provider', {
|
|
48
|
+
props: {
|
|
49
|
+
locale: locale,
|
|
50
|
+
popContainer: document.getElementById('popContainer')
|
|
51
|
+
}
|
|
52
|
+
}, [
|
|
53
|
+
h(Index[props.$schema.type], {
|
|
54
|
+
props: props.$schema
|
|
55
|
+
})
|
|
56
|
+
])
|
|
57
|
+
}).$mount(dom.current)
|
|
58
|
+
})
|
|
59
|
+
return React.createElement('div', {
|
|
60
|
+
ref: dom
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
32
64
|
function loadSDK () {
|
|
33
65
|
return new Promise((resolve, reject) => {
|
|
34
66
|
if (window.amisRequire) {
|
|
@@ -36,7 +68,7 @@ function loadSDK () {
|
|
|
36
68
|
return
|
|
37
69
|
}
|
|
38
70
|
loadStyles([
|
|
39
|
-
'/amis/sdk/
|
|
71
|
+
'/amis/sdk/sdk.css',
|
|
40
72
|
'/amis/sdk/helper.css',
|
|
41
73
|
'/amis/sdk/iconfont.css',
|
|
42
74
|
])
|
|
@@ -71,9 +103,7 @@ export default {
|
|
|
71
103
|
},
|
|
72
104
|
env: {
|
|
73
105
|
type: Object,
|
|
74
|
-
default: () => ({
|
|
75
|
-
theme: 'antd'
|
|
76
|
-
}),
|
|
106
|
+
default: () => ({}),
|
|
77
107
|
},
|
|
78
108
|
},
|
|
79
109
|
data () {
|
|
@@ -122,9 +152,13 @@ export default {
|
|
|
122
152
|
return
|
|
123
153
|
}
|
|
124
154
|
|
|
155
|
+
const amisLib = window.amisRequire('amis')
|
|
125
156
|
const scoped = window.amisRequire('amis/embed')
|
|
126
|
-
const { normalizeLink } =
|
|
157
|
+
const { normalizeLink } = amisLib
|
|
127
158
|
const router = this.$router
|
|
159
|
+
amisLib.Renderer({
|
|
160
|
+
test: new RegExp(`(^|\/)${this.schema.type}`)
|
|
161
|
+
})(CustomComponent)
|
|
128
162
|
const instance = scoped.embed(
|
|
129
163
|
this.$el,
|
|
130
164
|
this.schema,
|
|
@@ -189,6 +223,7 @@ export default {
|
|
|
189
223
|
|
|
190
224
|
methods: {
|
|
191
225
|
updateProps () {
|
|
226
|
+
// eslint-disable-next-line no-unused-expressions
|
|
192
227
|
this.amisInstance?.updateProps({
|
|
193
228
|
data: {
|
|
194
229
|
...this.locals,
|
|
@@ -201,6 +236,7 @@ export default {
|
|
|
201
236
|
|
|
202
237
|
destroyed () {
|
|
203
238
|
this.unmounted = true
|
|
239
|
+
// eslint-disable-next-line no-unused-expressions
|
|
204
240
|
this.amisInstance?.unmount()
|
|
205
241
|
},
|
|
206
242
|
}
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
describeList: {
|
|
20
20
|
type: Array,
|
|
21
21
|
// eslint-disable-next-line vue/require-valid-default-prop
|
|
22
|
-
default: () => { return [
|
|
22
|
+
default: () => { return [] } // lng:描述信息 lat:描述信息对应的值的字段名 { describe: '用户名称', field: 'name' }
|
|
23
23
|
},
|
|
24
24
|
// 需要渲染的点位数据
|
|
25
25
|
markers: {
|
|
@@ -30,7 +30,7 @@ export default {
|
|
|
30
30
|
imgurl: {
|
|
31
31
|
type: String,
|
|
32
32
|
default: () => {
|
|
33
|
-
return
|
|
33
|
+
return 'https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png'
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
mapStyle: {
|
|
@@ -105,7 +105,7 @@ export default {
|
|
|
105
105
|
extData: this.markers
|
|
106
106
|
})
|
|
107
107
|
marker.on('click', (e) => {
|
|
108
|
-
if(e.target.getExtData() && e.target.getExtData().lng){
|
|
108
|
+
if (e.target.getExtData() && e.target.getExtData().lng) {
|
|
109
109
|
this.infoWindow.setContent(document.getElementById('amap_point_rendering_template'))
|
|
110
110
|
this.infoWindow.open(this.map, [e.target.getExtData().lng, e.target.getExtData().lat])
|
|
111
111
|
}
|
|
@@ -704,7 +704,7 @@ export default {
|
|
|
704
704
|
this.dataModeArrayData = this.item.dataModeArray
|
|
705
705
|
this.flashModal()
|
|
706
706
|
|
|
707
|
-
for (const columnItem of this.item.column
|
|
707
|
+
for (const columnItem of this.item.column) {
|
|
708
708
|
this.itemMap[columnItem.key] = Object.assign({
|
|
709
709
|
key: '',
|
|
710
710
|
title: '',
|
|
@@ -163,8 +163,6 @@ export default {
|
|
|
163
163
|
break
|
|
164
164
|
} else if (arr[s].children && arr[s].children.length > 0) { // 递归条件
|
|
165
165
|
this.searchitem(option, arr[s].children)
|
|
166
|
-
} else {
|
|
167
|
-
|
|
168
166
|
}
|
|
169
167
|
}
|
|
170
168
|
},
|
|
@@ -258,12 +256,10 @@ export default {
|
|
|
258
256
|
float: left;
|
|
259
257
|
}
|
|
260
258
|
.ant-card-body {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
position: relative;
|
|
266
|
-
}
|
|
259
|
+
.ant-tree {
|
|
260
|
+
line-height: 3;
|
|
261
|
+
li {
|
|
262
|
+
position: relative;
|
|
267
263
|
}
|
|
268
264
|
}
|
|
269
265
|
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-tree :treeData="treeData" :expandedKeys="expandedKeys" :selectedKeys="selectedKeys" @expand="handleExpand" @select="handleSelect"></a-tree>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import { Tree } from 'ant-design-vue'
|
|
7
|
+
import Vue from 'vue'
|
|
8
|
+
import { getConfig, runLogic } from '@vue2-client/services/api/common'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
components: {
|
|
12
|
+
'a-tree': Tree,
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
configContent: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: {}
|
|
18
|
+
},
|
|
19
|
+
systemName: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
configName: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ''
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
data () {
|
|
29
|
+
return {
|
|
30
|
+
treeData: [],
|
|
31
|
+
expandedKeys: [],
|
|
32
|
+
selectedKeys: [],
|
|
33
|
+
actualConfig: null,
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
async mounted () {
|
|
37
|
+
try {
|
|
38
|
+
this.actualConfig = await getConfig(this.configContent, this.configName, this.systemName)
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error('Failed to get config:', error)
|
|
41
|
+
}
|
|
42
|
+
// 根据配置文件中的tableStructure字段生成树组件结构
|
|
43
|
+
this.generateTreeData()
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
async generateTreeData () {
|
|
47
|
+
try {
|
|
48
|
+
// 定义逻辑名称和参数,这里需要根据实际情况来填写
|
|
49
|
+
const logicName = 'get_root_nodes' // 例如: 'GenerateTreeStructure'
|
|
50
|
+
const parameters = {
|
|
51
|
+
// 你需要传递给后端逻辑的参数
|
|
52
|
+
// 例如: key1: 'value1', key2: 'value2'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 调用通用业务逻辑函数
|
|
56
|
+
const response = await runLogic(logicName, parameters)
|
|
57
|
+
|
|
58
|
+
// 检查返回的数据是否有效,这将依赖于你的后端服务发送什么样的响应
|
|
59
|
+
if (response && response.data) {
|
|
60
|
+
// 如果响应中有数据,则将其设置为树组件的数据
|
|
61
|
+
this.treeData = response.data // 或者根据实际的返回结构调整,比如 response.data.treeStructure
|
|
62
|
+
} else {
|
|
63
|
+
// 处理没有返回数据的情况,可以是设置默认值或抛出错误
|
|
64
|
+
throw new Error('No data returned from the logic execution')
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
// 处理调用逻辑或设置数据时出现的错误
|
|
68
|
+
console.error('There was an error generating the tree data:', error)
|
|
69
|
+
// 这里可以进行更多的错误处理,比如显示一个错误消息到UI界面
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
async handleExpand (expandedKeys, { expanded, node }) {
|
|
73
|
+
console.log('handleExpand', expandedKeys, expanded, node)
|
|
74
|
+
// 更新展开的节点列表,由于这不依赖于异步操作,因此可以立即设置
|
|
75
|
+
this.expandedKeys = expandedKeys
|
|
76
|
+
|
|
77
|
+
if (expanded) {
|
|
78
|
+
try {
|
|
79
|
+
// 向后端发送请求,获取子节点数据
|
|
80
|
+
const path = this.getNodePath(node)
|
|
81
|
+
const childNodes = await this.fetchChildNodes(path) // 等待子节点数据
|
|
82
|
+
|
|
83
|
+
// 将子节点数据添加到当前节点下
|
|
84
|
+
Vue.set(node, 'children', childNodes)
|
|
85
|
+
|
|
86
|
+
// 现在,我们需要确保每个子节点都有一个指向其父节点的引用。
|
|
87
|
+
// 这是必须的,因为 'getNodePath' 方法依赖于 'parentNode' 属性来重建节点的完整路径。
|
|
88
|
+
if (childNodes && childNodes.length) {
|
|
89
|
+
childNodes.forEach(child => {
|
|
90
|
+
// 由于我们直接修改了节点,这可能不会触发视图的自动更新。
|
|
91
|
+
// 如果你遇到了这个问题,你可能需要找到一种方法来手动触发组件的重新渲染。
|
|
92
|
+
child.parentNode = node
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
} catch (error) {
|
|
96
|
+
// 处理或记录错误
|
|
97
|
+
console.error('An error occurred:', error)
|
|
98
|
+
// 这里可以执行其他错误处理逻辑,比如向用户显示错误消息
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// 如果没有展开,就没有更多要做的,因为 this.expandedKeys 已经更新
|
|
102
|
+
},
|
|
103
|
+
handleSelect (selectedKeys, { selected, node }) {
|
|
104
|
+
if (selected) {
|
|
105
|
+
// 触发节点选中事件,传递节点的完整路径
|
|
106
|
+
const path = this.getNodePath(node)
|
|
107
|
+
this.$emit('nodeSelected', path)
|
|
108
|
+
} else {
|
|
109
|
+
this.selectedKeys = selectedKeys
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
getNodePath (node) {
|
|
113
|
+
// 获取节点的完整路径
|
|
114
|
+
let path = node.title
|
|
115
|
+
let parent = node.parentNode
|
|
116
|
+
while (parent) {
|
|
117
|
+
path = parent.title + '/' + path
|
|
118
|
+
parent = parent.parentNode
|
|
119
|
+
}
|
|
120
|
+
return path
|
|
121
|
+
},
|
|
122
|
+
async fetchChildNodes (path) {
|
|
123
|
+
// 定义逻辑名称和参数 - 根据你的后端逻辑具体定义这些值
|
|
124
|
+
const logicName = 'get_child_nodes' // 例如,这可能是后端服务识别的逻辑名称
|
|
125
|
+
const parameters = {
|
|
126
|
+
path: path, // 参数是什么取决于你的后端服务需要什么
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
// 调用通用业务逻辑函数并等待结果
|
|
131
|
+
const response = await runLogic(logicName, parameters)
|
|
132
|
+
|
|
133
|
+
// 确保响应包含我们期望的数据 - 如果你的后端服务使用不同的结构,你可能需要调整这里
|
|
134
|
+
if (response && response.data) {
|
|
135
|
+
return Promise.resolve(response.data) // 返回子节点数据
|
|
136
|
+
} else {
|
|
137
|
+
// 如果响应格式不符合预期,可以抛出一个错误或返回一个失败的Promise
|
|
138
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
139
|
+
return Promise.reject('Received unexpected response format')
|
|
140
|
+
}
|
|
141
|
+
} catch (error) {
|
|
142
|
+
// 如果请求失败(例如网络错误、服务器错误等),我们捕获这个错误并将其向上传递
|
|
143
|
+
console.error('Error fetching child nodes:', error)
|
|
144
|
+
return Promise.reject(error.message || 'Error fetching child nodes')
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
</script>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
26
|
<!-- actions -->
|
|
27
|
-
<template
|
|
27
|
+
<template #extra>
|
|
28
28
|
<a-button-group style="margin-right: 4px;">
|
|
29
29
|
<a-button :loading="loading" type="dashed" @click="initView('1')">刷新</a-button>
|
|
30
30
|
</a-button-group>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<slot name="extraActions" :datas="details"></slot>
|
|
33
33
|
</a-button-group>
|
|
34
34
|
</template>
|
|
35
|
-
<template
|
|
35
|
+
<template #footer>
|
|
36
36
|
<slot name="footerContent" :datas="details"></slot>
|
|
37
37
|
</template>
|
|
38
38
|
</a-page-header>
|
|
@@ -57,7 +57,7 @@ import XForm from '@vue2-client/base-client/components/common/XForm'
|
|
|
57
57
|
import XAddForm from '@vue2-client/base-client/components/common/XAddForm'
|
|
58
58
|
import XTable from '@vue2-client/base-client/components/common/XTable'
|
|
59
59
|
import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
|
|
60
|
-
import {
|
|
60
|
+
import { getConfigByName, getConfigByLogic, parseConfig } from '@vue2-client/services/api/common'
|
|
61
61
|
import { mapState } from 'vuex'
|
|
62
62
|
|
|
63
63
|
export default {
|
|
@@ -186,7 +186,7 @@ export default {
|
|
|
186
186
|
}
|
|
187
187
|
},
|
|
188
188
|
getConfig () {
|
|
189
|
-
|
|
189
|
+
getConfigByName(this.queryParamsName, this.serviceName, (res) => {
|
|
190
190
|
this.updateComponents(res)
|
|
191
191
|
})
|
|
192
192
|
},
|