vue2-client 1.18.35 → 1.18.37
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 +90 -90
- package/Components.md +60 -60
- package/docs/index.md +30 -30
- package/index.js +31 -31
- package/jest-transform-stub.js +8 -8
- package/jest.setup.js +7 -7
- package/package.json +1 -1
- package/src/assets/img/querySlotDemo.svg +15 -15
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
- package/src/base-client/components/common/AmapMarker/index.js +3 -3
- package/src/base-client/components/common/CitySelect/CitySelect.vue +9 -1
- package/src/base-client/components/common/CitySelect/index.js +3 -3
- package/src/base-client/components/common/CitySelect/index.md +109 -109
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
- package/src/base-client/components/common/CreateQuery/index.js +3 -3
- package/src/base-client/components/common/CreateQuery/index.md +42 -42
- package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
- package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
- package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
- package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
- package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
- package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
- package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
- package/src/base-client/components/common/HIS/HFormTable/HFormTable.vue +22 -0
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
- package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
- package/src/base-client/components/common/PersonSetting/index.js +3 -3
- package/src/base-client/components/common/Tree/Tree.vue +149 -149
- package/src/base-client/components/common/Tree/index.js +2 -2
- package/src/base-client/components/common/Upload/index.js +3 -3
- package/src/base-client/components/common/XAddNativeForm/demo.vue +2 -7
- package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
- package/src/base-client/components/common/XDataDrawer/index.js +3 -3
- package/src/base-client/components/common/XDataDrawer/index.md +41 -41
- package/src/base-client/components/common/XDescriptions/index.js +3 -3
- package/src/base-client/components/common/XDescriptions/index.md +322 -322
- package/src/base-client/components/common/XDetailsView/index.js +3 -3
- package/src/base-client/components/common/XForm/index.md +178 -178
- package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
- package/src/base-client/components/common/XFormTable/demo.vue +125 -125
- package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
- package/src/base-client/components/common/XStepView/index.js +3 -3
- package/src/base-client/components/common/XStepView/index.md +31 -31
- package/src/base-client/components/common/XTable/XTable.vue +1715 -1715
- package/src/base-client/components/common/XTable/XTableWrapper.vue +759 -756
- package/src/base-client/components/common/XTable/index.md +255 -255
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
- package/src/base-client/plugins/Config.js +19 -19
- package/src/base-client/plugins/tabs-page-plugin.js +39 -39
- package/src/components/Charts/Bar.vue +62 -62
- package/src/components/Charts/ChartCard.vue +134 -134
- package/src/components/Charts/Liquid.vue +67 -67
- package/src/components/Charts/MiniArea.vue +39 -39
- package/src/components/Charts/MiniBar.vue +39 -39
- package/src/components/Charts/MiniProgress.vue +75 -75
- package/src/components/Charts/MiniSmoothArea.vue +40 -40
- package/src/components/Charts/Radar.vue +68 -68
- package/src/components/Charts/RankList.vue +77 -77
- package/src/components/Charts/TagCloud.vue +113 -113
- package/src/components/Charts/TransferBar.vue +64 -64
- package/src/components/Charts/Trend.vue +82 -82
- package/src/components/Charts/chart.less +12 -12
- package/src/components/Charts/smooth.area.less +13 -13
- package/src/components/NumberInfo/NumberInfo.vue +54 -54
- package/src/components/NumberInfo/index.js +3 -3
- package/src/components/NumberInfo/index.less +54 -54
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/card/ChartCard.vue +79 -79
- package/src/components/chart/Bar.vue +60 -60
- package/src/components/chart/MiniArea.vue +67 -67
- package/src/components/chart/MiniBar.vue +59 -59
- package/src/components/chart/MiniProgress.vue +57 -57
- package/src/components/chart/Radar.vue +80 -80
- package/src/components/chart/RankingList.vue +60 -60
- package/src/components/chart/Trend.vue +79 -79
- package/src/components/chart/index.less +9 -9
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/input/IInput.vue +66 -66
- package/src/components/menu/SideMenu.vue +75 -75
- package/src/components/menu/menu.js +273 -273
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/layouts/CommonLayout.vue +56 -56
- package/src/layouts/header/HeaderNotice.vue +177 -177
- package/src/lib.js +1 -1
- package/src/mock/extend/index.js +84 -84
- package/src/mock/goods/index.js +108 -108
- package/src/pages/WorkflowDetail/WorkFlowDemo.vue +1 -1
- package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
- package/src/pages/system/dictionary/index.vue +44 -44
- package/src/pages/system/monitor/loginInfor/index.vue +37 -37
- package/src/pages/system/monitor/operLog/index.vue +37 -37
- package/src/router/async/router.map.js +2 -2
- package/src/services/api/cas.js +79 -79
- package/src/store/modules/setting.js +119 -119
- package/src/utils/authority-utils.js +85 -85
- package/src/utils/errorCode.js +6 -6
- package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
- package/tests/unit/a.log +0 -0
|
@@ -1,149 +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>
|
|
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>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import Tree from './Tree'
|
|
2
|
-
export default Tree
|
|
1
|
+
import Tree from './Tree'
|
|
2
|
+
export default Tree
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Upload from './Upload'
|
|
2
|
-
|
|
3
|
-
export default Upload
|
|
1
|
+
import Upload from './Upload'
|
|
2
|
+
|
|
3
|
+
export default Upload
|
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
mounted () {
|
|
14
|
-
getConfigByNameAsync('
|
|
14
|
+
getConfigByNameAsync('formtestForm', 'af-system').then(res => {
|
|
15
15
|
this.$refs.xAddFrom.init(Object.assign(res, {
|
|
16
16
|
modifyModelData: {
|
|
17
17
|
data: {}
|
|
@@ -26,9 +26,6 @@ export default {
|
|
|
26
26
|
},
|
|
27
27
|
singLocal () {
|
|
28
28
|
console.log('singLocal')
|
|
29
|
-
},
|
|
30
|
-
onSubmit () {
|
|
31
|
-
this.$refs.xAddFrom.onSubmit()
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
31
|
}
|
|
@@ -46,10 +43,8 @@ export default {
|
|
|
46
43
|
</a-card>
|
|
47
44
|
<a-card>
|
|
48
45
|
<pre>{{
|
|
49
|
-
form ? JSON.stringify(form, null, 2) : '请先点击获取表单数据
|
|
50
|
-
<a-button type="primary" @click="onSubmit()">提交</a-button>
|
|
46
|
+
form ? JSON.stringify(form, null, 2) : '请先点击获取表单数据' }}
|
|
51
47
|
</pre>
|
|
52
|
-
|
|
53
48
|
</a-card>
|
|
54
49
|
</div>
|
|
55
50
|
</template>
|
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
# XAddNativeForm
|
|
2
|
-
|
|
3
|
-
动态新增/修改表单控件,根据JSON配置生成一个完整的可供新增/修改数据的动态表单
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## 何时使用
|
|
7
|
-
|
|
8
|
-
当需要一个可供新增/修改数据的动态生成的表单时
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
引用方式:
|
|
12
|
-
|
|
13
|
-
```javascript
|
|
14
|
-
import XAddNativeForm from '@vue2-client/base-client/components/XAddNativeForm/XAddNativeForm'
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
components: {
|
|
18
|
-
XAddNativeForm
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## 代码演示
|
|
26
|
-
|
|
27
|
-
```html
|
|
28
|
-
<x-add-native-form
|
|
29
|
-
ref="nativeForm"
|
|
30
|
-
@onSubmit="submit"/>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## 构造参数,通过init方法构造
|
|
34
|
-
|
|
35
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
|
36
|
-
|-----------------|----------------------|-------|--------|
|
|
37
|
-
| formItems | 表单项集合 | array | [] |
|
|
38
|
-
| viewMode | 是否为预览模式 | bool | false |
|
|
39
|
-
| isHandleFormKey | 是否对提交表单的key进行处理 | bool | true |
|
|
40
|
-
| serviceName | 所属服务模块名 | string | system |
|
|
41
|
-
| businessType | 业务类型(新增/修改) | string | - |
|
|
42
|
-
| title | 业务标题 | string | - |
|
|
43
|
-
| getDataParams | 调用logic获取下拉框数据源的追加参数 | {} | - |
|
|
44
|
-
| simpleFormJsonData | 动态简易表单集合 | {} | - |
|
|
45
|
-
|
|
46
|
-
## 事件
|
|
47
|
-
| 事件 | 说明 | 类型 | 默认值 |
|
|
48
|
-
|-----------|----------------------|-------|-----------|
|
|
49
|
-
| @onSubmit | 表单的提交事件 | event | - |
|
|
50
|
-
|
|
51
|
-
## 例子1
|
|
52
|
-
----
|
|
53
|
-
```vue
|
|
54
|
-
<template>
|
|
55
|
-
<x-add-native-form
|
|
56
|
-
ref="nativeForm"
|
|
57
|
-
@onSubmit="submit"/>
|
|
58
|
-
</template>
|
|
59
|
-
<script>
|
|
60
|
-
import { getConfigUrl } from '@vue2-client/services/api/common'
|
|
61
|
-
export default {
|
|
62
|
-
created () {
|
|
63
|
-
this.initComponents()
|
|
64
|
-
},
|
|
65
|
-
methods: {
|
|
66
|
-
initComponents() {
|
|
67
|
-
// 获取请求配置中心的地址
|
|
68
|
-
const url = getConfigUrl('yourConfigModuleName')
|
|
69
|
-
post(url, { configName: 'yourConfigName' }).then(res => {
|
|
70
|
-
if (this.$refs.nativeForm) {
|
|
71
|
-
this.$refs.nativeForm.init({
|
|
72
|
-
formItems: res,
|
|
73
|
-
serviceName: 'af-iot',
|
|
74
|
-
businessType: '新增',
|
|
75
|
-
title: '新增告警记录'
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
},
|
|
80
|
-
submit (res) {
|
|
81
|
-
post(api.addData, res.realForm).then(data => {
|
|
82
|
-
this.$message.success(res.businessType + '成功!')
|
|
83
|
-
}).catch(e => {
|
|
84
|
-
this.$message.error(res.businessType + '失败:' + e)
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
</script>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## JSON配置示例
|
|
93
|
-
----
|
|
94
|
-
`这是一个表单配置示例,通过以下配置,你会得到一个有选项的单选框,一个带校验的输入框,以及一个文本域`
|
|
95
|
-
```json
|
|
96
|
-
[
|
|
97
|
-
{
|
|
98
|
-
"name": "是否通气",
|
|
99
|
-
"model": "is_ventilate",
|
|
100
|
-
"keys": [
|
|
101
|
-
{ "label": "是", "value": "1" },
|
|
102
|
-
{ "label": "否", "value": "0" }
|
|
103
|
-
],
|
|
104
|
-
"type": "radio",
|
|
105
|
-
"addOrEdit": "all",
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"name": "处理人",
|
|
109
|
-
"model": "f_processor",
|
|
110
|
-
"rule": {
|
|
111
|
-
"required": true
|
|
112
|
-
},
|
|
113
|
-
"type": "input",
|
|
114
|
-
"addOrEdit": "all",
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"name": "处理内容",
|
|
118
|
-
"model": "f_handle_content",
|
|
119
|
-
"type": "textarea",
|
|
120
|
-
"addOrEdit": "all",
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## JSON配置规范
|
|
126
|
-
----
|
|
127
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
|
128
|
-
|-----------------|----------------------|-------|-----------|
|
|
129
|
-
| name | 表单项名称 | string | '' |
|
|
130
|
-
| model | 表单项key | string | '' |
|
|
131
|
-
| rule | 表单校验 | json | {} |
|
|
132
|
-
| -> required | 是否必填 | bool | false |
|
|
133
|
-
| type | 表单类型 | string | input |
|
|
134
|
-
| keys | 当表单类型是select,radio时的选项值 | Array | [] |
|
|
135
|
-
| -> label | 选项的字面值 | string | '' |
|
|
136
|
-
| -> value | 选项的实际值 | string | '' |
|
|
137
|
-
| addOrEdit | 新增/修改场景 | string | all |
|
|
138
|
-
| -> add | 仅新增 | string | - |
|
|
139
|
-
| -> edit | 仅修改 | string | - |
|
|
140
|
-
| -> all | 全部支持 | string | - |
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
注意事项
|
|
144
|
-
----
|
|
145
|
-
|
|
146
|
-
> 本组件已经实现了自适应布局,在不同分辨率下的设备均可得到基本理想的展示效果
|
|
1
|
+
# XAddNativeForm
|
|
2
|
+
|
|
3
|
+
动态新增/修改表单控件,根据JSON配置生成一个完整的可供新增/修改数据的动态表单
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## 何时使用
|
|
7
|
+
|
|
8
|
+
当需要一个可供新增/修改数据的动态生成的表单时
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
引用方式:
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import XAddNativeForm from '@vue2-client/base-client/components/XAddNativeForm/XAddNativeForm'
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
components: {
|
|
18
|
+
XAddNativeForm
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## 代码演示
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<x-add-native-form
|
|
29
|
+
ref="nativeForm"
|
|
30
|
+
@onSubmit="submit"/>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 构造参数,通过init方法构造
|
|
34
|
+
|
|
35
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
36
|
+
|-----------------|----------------------|-------|--------|
|
|
37
|
+
| formItems | 表单项集合 | array | [] |
|
|
38
|
+
| viewMode | 是否为预览模式 | bool | false |
|
|
39
|
+
| isHandleFormKey | 是否对提交表单的key进行处理 | bool | true |
|
|
40
|
+
| serviceName | 所属服务模块名 | string | system |
|
|
41
|
+
| businessType | 业务类型(新增/修改) | string | - |
|
|
42
|
+
| title | 业务标题 | string | - |
|
|
43
|
+
| getDataParams | 调用logic获取下拉框数据源的追加参数 | {} | - |
|
|
44
|
+
| simpleFormJsonData | 动态简易表单集合 | {} | - |
|
|
45
|
+
|
|
46
|
+
## 事件
|
|
47
|
+
| 事件 | 说明 | 类型 | 默认值 |
|
|
48
|
+
|-----------|----------------------|-------|-----------|
|
|
49
|
+
| @onSubmit | 表单的提交事件 | event | - |
|
|
50
|
+
|
|
51
|
+
## 例子1
|
|
52
|
+
----
|
|
53
|
+
```vue
|
|
54
|
+
<template>
|
|
55
|
+
<x-add-native-form
|
|
56
|
+
ref="nativeForm"
|
|
57
|
+
@onSubmit="submit"/>
|
|
58
|
+
</template>
|
|
59
|
+
<script>
|
|
60
|
+
import { getConfigUrl } from '@vue2-client/services/api/common'
|
|
61
|
+
export default {
|
|
62
|
+
created () {
|
|
63
|
+
this.initComponents()
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
initComponents() {
|
|
67
|
+
// 获取请求配置中心的地址
|
|
68
|
+
const url = getConfigUrl('yourConfigModuleName')
|
|
69
|
+
post(url, { configName: 'yourConfigName' }).then(res => {
|
|
70
|
+
if (this.$refs.nativeForm) {
|
|
71
|
+
this.$refs.nativeForm.init({
|
|
72
|
+
formItems: res,
|
|
73
|
+
serviceName: 'af-iot',
|
|
74
|
+
businessType: '新增',
|
|
75
|
+
title: '新增告警记录'
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
},
|
|
80
|
+
submit (res) {
|
|
81
|
+
post(api.addData, res.realForm).then(data => {
|
|
82
|
+
this.$message.success(res.businessType + '成功!')
|
|
83
|
+
}).catch(e => {
|
|
84
|
+
this.$message.error(res.businessType + '失败:' + e)
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## JSON配置示例
|
|
93
|
+
----
|
|
94
|
+
`这是一个表单配置示例,通过以下配置,你会得到一个有选项的单选框,一个带校验的输入框,以及一个文本域`
|
|
95
|
+
```json
|
|
96
|
+
[
|
|
97
|
+
{
|
|
98
|
+
"name": "是否通气",
|
|
99
|
+
"model": "is_ventilate",
|
|
100
|
+
"keys": [
|
|
101
|
+
{ "label": "是", "value": "1" },
|
|
102
|
+
{ "label": "否", "value": "0" }
|
|
103
|
+
],
|
|
104
|
+
"type": "radio",
|
|
105
|
+
"addOrEdit": "all",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "处理人",
|
|
109
|
+
"model": "f_processor",
|
|
110
|
+
"rule": {
|
|
111
|
+
"required": true
|
|
112
|
+
},
|
|
113
|
+
"type": "input",
|
|
114
|
+
"addOrEdit": "all",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "处理内容",
|
|
118
|
+
"model": "f_handle_content",
|
|
119
|
+
"type": "textarea",
|
|
120
|
+
"addOrEdit": "all",
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## JSON配置规范
|
|
126
|
+
----
|
|
127
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
128
|
+
|-----------------|----------------------|-------|-----------|
|
|
129
|
+
| name | 表单项名称 | string | '' |
|
|
130
|
+
| model | 表单项key | string | '' |
|
|
131
|
+
| rule | 表单校验 | json | {} |
|
|
132
|
+
| -> required | 是否必填 | bool | false |
|
|
133
|
+
| type | 表单类型 | string | input |
|
|
134
|
+
| keys | 当表单类型是select,radio时的选项值 | Array | [] |
|
|
135
|
+
| -> label | 选项的字面值 | string | '' |
|
|
136
|
+
| -> value | 选项的实际值 | string | '' |
|
|
137
|
+
| addOrEdit | 新增/修改场景 | string | all |
|
|
138
|
+
| -> add | 仅新增 | string | - |
|
|
139
|
+
| -> edit | 仅修改 | string | - |
|
|
140
|
+
| -> all | 全部支持 | string | - |
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
注意事项
|
|
144
|
+
----
|
|
145
|
+
|
|
146
|
+
> 本组件已经实现了自适应布局,在不同分辨率下的设备均可得到基本理想的展示效果
|