vue2-client 1.8.11 → 1.8.13
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/CHANGELOG.md +692 -685
- package/package.json +92 -92
- package/src/assets/img/querySlotDemo.svg +15 -15
- package/src/base-client/components/common/AMisRender/index.vue +243 -257
- 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 +13 -26
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +37 -9
- package/src/base-client/components/common/PersonSetting/index.js +3 -3
- package/src/base-client/components/common/Upload/index.js +3 -3
- package/src/base-client/components/common/XFormTable/XFormTable.vue +347 -384
- package/src/base-client/components/common/XImportExcel/XImportExcel.vue +15 -16
- package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
- package/src/config/CreateQueryConfig.js +11 -1
- package/src/pages/AMisDemo/AMisDemo.vue +67 -223
- package/src/router.js +13 -15
- package/src/services/api/common.js +10 -1
- package/src/services/api/restTools.js +24 -24
- package/src/base-client/components/common/AMisRender/index.js +0 -3
- package/src/pages/AMisDemo/AMisDemo2.vue +0 -70
|
@@ -1,257 +1,243 @@
|
|
|
1
|
-
<template><div
|
|
2
|
-
|
|
3
|
-
<script>
|
|
4
|
-
// import "amis/sdk/sdk.js";
|
|
5
|
-
// import "amis/sdk/sdk.css";
|
|
6
|
-
// import "amis/sdk/iconfont.css";
|
|
7
|
-
|
|
8
|
-
// 可以不引用, 如果你不想要任何辅助类样式的话 (比如 `m-t-xs` 这种)
|
|
9
|
-
// https://aisuda.bce.baidu.com/amis/zh-CN/style/index
|
|
10
|
-
// import 'amis/sdk/helper.css'
|
|
11
|
-
import qs from 'qs'
|
|
12
|
-
import Vue from 'vue'
|
|
13
|
-
import Index from '@vue2-client/base-client/components/index.js'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
script.
|
|
21
|
-
script.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
type: Object,
|
|
98
|
-
default: {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
this.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
})
|
|
245
|
-
},
|
|
246
|
-
initConfig () {
|
|
247
|
-
console.warn('initConfig')
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
destroyed () {
|
|
252
|
-
this.unmounted = true
|
|
253
|
-
// eslint-disable-next-line no-unused-expressions
|
|
254
|
-
this.amisInstance?.unmount()
|
|
255
|
-
},
|
|
256
|
-
}
|
|
257
|
-
</script>
|
|
1
|
+
<template><div>Loading...</div></template>
|
|
2
|
+
|
|
3
|
+
<script>
|
|
4
|
+
// import "amis/sdk/sdk.js";
|
|
5
|
+
// import "amis/sdk/sdk.css";
|
|
6
|
+
// import "amis/sdk/iconfont.css";
|
|
7
|
+
|
|
8
|
+
// 可以不引用, 如果你不想要任何辅助类样式的话 (比如 `m-t-xs` 这种)
|
|
9
|
+
// https://aisuda.bce.baidu.com/amis/zh-CN/style/index
|
|
10
|
+
// import 'amis/sdk/helper.css'
|
|
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'
|
|
15
|
+
|
|
16
|
+
function loadScript (src, callback) {
|
|
17
|
+
const script = document.createElement('script')
|
|
18
|
+
script.setAttribute('type', 'text/javascript')
|
|
19
|
+
script.setAttribute('src', src)
|
|
20
|
+
script.onload = () => callback()
|
|
21
|
+
script.onerror = () => callback(new Error(`Failed to load ${src}`))
|
|
22
|
+
document.body.appendChild(script)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function loadStyles (styles) {
|
|
26
|
+
for (const path of styles) {
|
|
27
|
+
const style = document.createElement('link')
|
|
28
|
+
style.setAttribute('rel', 'stylesheet')
|
|
29
|
+
style.setAttribute('type', 'text/css')
|
|
30
|
+
style.setAttribute('href', path)
|
|
31
|
+
document.head.appendChild(style)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
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
|
+
|
|
64
|
+
function loadSDK () {
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
66
|
+
if (window.amisRequire) {
|
|
67
|
+
resolve()
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
loadStyles([
|
|
71
|
+
'/amis/sdk/sdk.css',
|
|
72
|
+
'/amis/sdk/helper.css',
|
|
73
|
+
'/amis/sdk/iconfont.css',
|
|
74
|
+
])
|
|
75
|
+
loadScript('/amis/sdk/sdk.js', (err) => {
|
|
76
|
+
if (err) {
|
|
77
|
+
reject(err)
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
resolve()
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default {
|
|
86
|
+
name: 'AMISRenderer',
|
|
87
|
+
components: {},
|
|
88
|
+
props: {
|
|
89
|
+
schema: {
|
|
90
|
+
type: Object,
|
|
91
|
+
default: {
|
|
92
|
+
type: 'page',
|
|
93
|
+
body: 'Hello World!',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
locals: {
|
|
97
|
+
type: Object,
|
|
98
|
+
default: () => ({}),
|
|
99
|
+
},
|
|
100
|
+
props: {
|
|
101
|
+
type: Object,
|
|
102
|
+
default: () => ({}),
|
|
103
|
+
},
|
|
104
|
+
env: {
|
|
105
|
+
type: Object,
|
|
106
|
+
default: () => ({}),
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
data () {
|
|
110
|
+
const router = this.$router
|
|
111
|
+
return {
|
|
112
|
+
// 这里面的数据所有 amis 页面都可以获取到
|
|
113
|
+
// 可以用来放一下公共数据,比如用户信息等
|
|
114
|
+
// 不要放受控数据,受控数据应该通过 data 下发
|
|
115
|
+
context: {
|
|
116
|
+
siteName: 'AMIS DEMO',
|
|
117
|
+
},
|
|
118
|
+
get location () {
|
|
119
|
+
const current = router.history.current
|
|
120
|
+
return {
|
|
121
|
+
pathname: current.path,
|
|
122
|
+
hash: current.hash,
|
|
123
|
+
query: current.query,
|
|
124
|
+
search: `?${qs.stringify(current.query)}`,
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
loading: false,
|
|
128
|
+
amisInstance: null,
|
|
129
|
+
unmounted: false,
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
watch: {
|
|
134
|
+
locals: function () {
|
|
135
|
+
this.updateProps()
|
|
136
|
+
},
|
|
137
|
+
props: function () {
|
|
138
|
+
this.updateProps()
|
|
139
|
+
},
|
|
140
|
+
$route: function () {
|
|
141
|
+
this.updateProps()
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
async mounted () {
|
|
145
|
+
try {
|
|
146
|
+
this.loading = true
|
|
147
|
+
await loadSDK()
|
|
148
|
+
} finally {
|
|
149
|
+
this.loading = false
|
|
150
|
+
}
|
|
151
|
+
if (this.unmounted) {
|
|
152
|
+
return
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const amisLib = window.amisRequire('amis')
|
|
156
|
+
const scoped = window.amisRequire('amis/embed')
|
|
157
|
+
const { normalizeLink } = amisLib
|
|
158
|
+
const router = this.$router
|
|
159
|
+
amisLib.Renderer({
|
|
160
|
+
test: new RegExp(`(^|\/)${this.schema.type}`)
|
|
161
|
+
})(CustomComponent)
|
|
162
|
+
const instance = scoped.embed(
|
|
163
|
+
this.$el,
|
|
164
|
+
this.schema,
|
|
165
|
+
{
|
|
166
|
+
data: {
|
|
167
|
+
...this.locals,
|
|
168
|
+
},
|
|
169
|
+
context: this.context,
|
|
170
|
+
location: this.location,
|
|
171
|
+
|
|
172
|
+
// todo 下发 location 对象
|
|
173
|
+
...this.props,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
// 覆盖 amis env
|
|
177
|
+
// 参考 https://aisuda.bce.baidu.com/amis/zh-CN/docs/start/getting-started#sdk
|
|
178
|
+
jumpTo: (to, action) => {
|
|
179
|
+
if (to === 'goBack') {
|
|
180
|
+
return router.go(-1)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
to = normalizeLink(to, this.location)
|
|
184
|
+
|
|
185
|
+
if (action?.actionType === 'url') {
|
|
186
|
+
action.blank === false ? router.push(to) : window.open(to)
|
|
187
|
+
return
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// 主要是支持 nav 中的跳转
|
|
191
|
+
if (action && to && action.target) {
|
|
192
|
+
window.open(to, action.target)
|
|
193
|
+
return
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (/^https?:\/\//.test(to)) {
|
|
197
|
+
window.location.replace(to)
|
|
198
|
+
} else {
|
|
199
|
+
router.push(to)
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
updateLocation: (location, replace) => {
|
|
204
|
+
if (location === 'goBack') {
|
|
205
|
+
return router.go(-1)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
location = normalizeLink(location, this.location)
|
|
209
|
+
replace ? router.replace(location) : router.replace(location)
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
...this.env,
|
|
213
|
+
},
|
|
214
|
+
() => {
|
|
215
|
+
this.$emit('ready', {
|
|
216
|
+
instance,
|
|
217
|
+
})
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
this.amisInstance = instance
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
methods: {
|
|
225
|
+
updateProps () {
|
|
226
|
+
// eslint-disable-next-line no-unused-expressions
|
|
227
|
+
this.amisInstance?.updateProps({
|
|
228
|
+
data: {
|
|
229
|
+
...this.locals,
|
|
230
|
+
},
|
|
231
|
+
context: this.context,
|
|
232
|
+
...this.props,
|
|
233
|
+
})
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
destroyed () {
|
|
238
|
+
this.unmounted = true
|
|
239
|
+
// eslint-disable-next-line no-unused-expressions
|
|
240
|
+
this.amisInstance?.unmount()
|
|
241
|
+
},
|
|
242
|
+
}
|
|
243
|
+
</script>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import CitySelect from './CitySelect'
|
|
2
|
-
|
|
3
|
-
export default CitySelect
|
|
1
|
+
import CitySelect from './CitySelect'
|
|
2
|
+
|
|
3
|
+
export default CitySelect
|