vue2-client 1.8.32 → 1.8.34

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 (103) hide show
  1. package/.env +1 -0
  2. package/.eslintrc.js +22 -14
  3. package/CHANGELOG.md +58 -0
  4. package/babel.config.js +8 -2
  5. package/docs/index.md +2 -1
  6. package/index.js +1 -1
  7. package/jest-transform-stub.js +8 -0
  8. package/jest.config.js +20 -2
  9. package/jest.setup.js +7 -0
  10. package/package.json +36 -27
  11. package/src/App.vue +33 -7
  12. package/src/assets/img/querySlotDemo.svg +15 -15
  13. package/src/base-client/components/common/AMisRender/index.js +3 -0
  14. package/src/base-client/components/common/AMisRender/index.vue +257 -0
  15. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +2 -2
  16. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +3 -3
  17. package/src/base-client/components/common/CitySelect/index.js +3 -3
  18. package/src/base-client/components/common/CitySelect/index.md +109 -109
  19. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +32 -37
  20. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +80 -12
  21. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +53 -70
  22. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +5 -5
  23. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +19 -18
  24. package/src/base-client/components/common/JSONToTree/jsontotree.vue +4 -8
  25. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +4 -6
  26. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  27. package/src/base-client/components/common/Tree/Tree.vue +149 -0
  28. package/src/base-client/components/common/Tree/index.js +2 -0
  29. package/src/base-client/components/common/Upload/Upload.vue +1 -1
  30. package/src/base-client/components/common/Upload/index.js +3 -3
  31. package/src/base-client/components/common/XAddForm/XAddForm.vue +21 -5
  32. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +88 -53
  33. package/src/base-client/components/common/XCard/XCard.vue +1 -1
  34. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +2 -2
  35. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +117 -0
  36. package/src/base-client/components/common/XDescriptions/index.js +3 -0
  37. package/src/base-client/components/common/XDescriptions/index.md +83 -0
  38. package/src/base-client/components/common/XForm/XForm.vue +2 -0
  39. package/src/base-client/components/common/XFormTable/XFormTable.vue +49 -24
  40. package/src/base-client/components/common/XFormTable/index.md +1 -0
  41. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +17 -18
  42. package/src/base-client/components/common/XStepView/XStepView.vue +252 -0
  43. package/src/base-client/components/common/XStepView/index.js +3 -0
  44. package/src/base-client/components/common/XStepView/index.md +31 -0
  45. package/src/base-client/components/common/XTable/XTable.vue +16 -8
  46. package/src/base-client/components/index.js +11 -5
  47. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +4 -3
  48. package/src/base-client/plugins/AppData.js +1 -2
  49. package/src/base-client/plugins/Config.js +0 -1
  50. package/src/base-client/plugins/GetLoginInfoService.js +6 -3
  51. package/src/base-client/plugins/tabs-page-plugin.js +5 -4
  52. package/src/bootstrap.js +2 -2
  53. package/src/components/FilePreview/FilePreview.vue +2 -2
  54. package/src/components/NumberInfo/NumberInfo.vue +1 -1
  55. package/src/components/checkbox/ColorCheckbox.vue +1 -1
  56. package/src/components/checkbox/ImgCheckbox.vue +2 -2
  57. package/src/components/menu/SideMenu.vue +2 -2
  58. package/src/components/menu/menu.js +1 -1
  59. package/src/components/tool/AStepItem.vue +1 -1
  60. package/src/config/CreateQueryConfig.js +12 -2
  61. package/src/config/default/antd.config.js +11 -6
  62. package/src/config/default/setting.config.js +7 -4
  63. package/src/layouts/PageLayout.vue +1 -1
  64. package/src/layouts/SinglePageView.vue +24 -2
  65. package/src/layouts/header/AdminHeader.vue +4 -4
  66. package/src/layouts/header/HeaderNotice.vue +3 -2
  67. package/src/layouts/tabs/TabsHead.vue +1 -2
  68. package/src/layouts/tabs/TabsView.vue +18 -10
  69. package/src/main.js +40 -12
  70. package/src/mock/extend/index.js +2 -1
  71. package/src/mock/goods/index.js +6 -6
  72. package/src/pages/AMisDemo/AMisDemo.vue +223 -0
  73. package/src/pages/AMisDemo/AMisDemo2.vue +74 -0
  74. package/src/pages/CreateQueryPage.vue +11 -3
  75. package/src/pages/login/Login.vue +2 -2
  76. package/src/pages/resourceManage/orgListManage.vue +2 -2
  77. package/src/pages/system/dictionary/index.vue +1 -0
  78. package/src/pages/system/monitor/loginInfor/index.vue +2 -1
  79. package/src/pages/system/monitor/operLog/index.vue +2 -1
  80. package/src/pages/system/settings/modifyPassword.vue +1 -1
  81. package/src/pages/system/ticket/index.vue +3 -2
  82. package/src/pages/system/ticket/submitTicketSuccess.vue +8 -2
  83. package/src/router/async/router.map.js +2 -0
  84. package/src/router/guards.js +29 -0
  85. package/src/router.js +15 -0
  86. package/src/services/api/cas.js +1 -1
  87. package/src/services/api/common.js +39 -23
  88. package/src/services/api/restTools.js +24 -24
  89. package/src/services/apiService.js +2 -2
  90. package/src/theme/default/style.less +2 -2
  91. package/src/utils/authority-utils.js +12 -12
  92. package/src/utils/errorCode.js +4 -4
  93. package/src/utils/login.js +8 -5
  94. package/src/utils/map-utils.js +20 -12
  95. package/src/utils/request.js +15 -5
  96. package/src/utils/routerUtil.js +31 -11
  97. package/src/utils/util.js +3 -2
  98. package/test/Amis.spec.js +163 -0
  99. package/test/Tree.spec.js +167 -0
  100. package/test/myDialog.spec.js +46 -0
  101. package/vue.config.js +66 -24
  102. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -0
  103. package/webpack.config.js +0 -12
@@ -0,0 +1,257 @@
1
+ <template><div ref="domRef">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
+ let React
15
+ let amisLib
16
+ let scoped
17
+ const apps = {}
18
+ function loadScript (src, callback) {
19
+ const script = document.createElement('script')
20
+ script.setAttribute('type', 'text/javascript')
21
+ script.setAttribute('src', src)
22
+ script.onload = () => callback()
23
+ script.onerror = () => callback(new Error(`Failed to load ${src}`))
24
+ document.body.appendChild(script)
25
+ }
26
+ const vueList = {}
27
+
28
+ // eslint-disable-next-line no-unused-vars
29
+ function CustomComponent (props, dom) {
30
+ const store = Vue.$store
31
+ const router = Vue.$router
32
+ const i18n = Vue.$i18n
33
+ console.log('props', props)
34
+ React.useEffect(function () {
35
+ vueList[props.$schema.name] = new Vue({
36
+ router,
37
+ store,
38
+ i18n,
39
+ render: h => h(Index[props.$schema.type], {
40
+ props: props.$schema
41
+ })
42
+ }).$mount(dom.current)
43
+ }, [])
44
+ const app = React.createElement('div', {
45
+ ref: dom
46
+ })
47
+ if (apps[props.name] !== undefined) {
48
+ const vue = vueList[props.$schema.name]
49
+ vue.$children[0].active(props.data)
50
+ } else {
51
+ apps[props.name] = app
52
+ }
53
+ return app
54
+ }
55
+
56
+ function loadStyles (styles) {
57
+ for (const path of styles) {
58
+ const style = document.createElement('link')
59
+ style.setAttribute('rel', 'stylesheet')
60
+ style.setAttribute('type', 'text/css')
61
+ style.setAttribute('href', path)
62
+ document.head.appendChild(style)
63
+ }
64
+ }
65
+ // eslint-disable-next-line no-unused-vars
66
+ function appstyle (data) {
67
+ console.log('111111111111')
68
+ }
69
+ // 动态导入组件
70
+
71
+ function loadSDK () {
72
+ return new Promise((resolve, reject) => {
73
+ if (window.amisRequire) {
74
+ resolve()
75
+ return
76
+ }
77
+ loadStyles([
78
+ '/amis/sdk/sdk.css',
79
+ '/amis/sdk/helper.css',
80
+ '/amis/sdk/iconfont.css',
81
+ ])
82
+ loadScript('/amis/sdk/sdk.js', (err) => {
83
+ if (err) {
84
+ reject(err)
85
+ return
86
+ }
87
+ resolve()
88
+ })
89
+ })
90
+ }
91
+
92
+ export default {
93
+ name: 'AMISRenderer',
94
+ components: {},
95
+ props: {
96
+ schema: {
97
+ type: Object,
98
+ default: {
99
+ type: 'page',
100
+ body: 'Hello World!',
101
+ },
102
+ },
103
+ locals: {
104
+ type: Object,
105
+ default: () => ({}),
106
+ },
107
+ props: {
108
+ type: Object,
109
+ default: () => ({}),
110
+ },
111
+ env: {
112
+ type: Object,
113
+ default: () => ({}),
114
+ },
115
+ },
116
+ data () {
117
+ const router = this.$router
118
+ return {
119
+ // 这里面的数据所有 amis 页面都可以获取到
120
+ // 可以用来放一下公共数据,比如用户信息等
121
+ // 不要放受控数据,受控数据应该通过 data 下发
122
+ context: {
123
+ siteName: 'AMIS DEMO',
124
+ },
125
+ get location () {
126
+ const current = router.history.current
127
+ return {
128
+ pathname: current.path,
129
+ hash: current.hash,
130
+ query: current.query,
131
+ search: `?${qs.stringify(current.query)}`,
132
+ }
133
+ },
134
+ loading: false,
135
+ amisInstance: null,
136
+ unmounted: false,
137
+ applist: {}
138
+ }
139
+ },
140
+
141
+ watch: {
142
+ locals: function () {
143
+ this.updateProps()
144
+ },
145
+ props: function () {
146
+ this.updateProps()
147
+ },
148
+ $route: function () {
149
+ this.updateProps()
150
+ },
151
+ },
152
+ async mounted () {
153
+ try {
154
+ this.loading = true
155
+ await loadSDK()
156
+ } finally {
157
+ this.loading = false
158
+ }
159
+ if (this.unmounted) {
160
+ return
161
+ }
162
+ React = window.amisRequire('react')
163
+ amisLib = window.amisRequire('amis')
164
+ scoped = window.amisRequire('amis/embed')
165
+ const { normalizeLink } = amisLib
166
+ const router = this.$router
167
+ // eslint-disable-next-line no-prototype-builtins
168
+ // console.log('this.schema.type', this.schema.type)
169
+
170
+ amisLib.Renderer({
171
+ test: new RegExp(`(^|\/)${this.schema.type}`)
172
+ })(props => CustomComponent(props, this.$el))
173
+
174
+ const instance = scoped.embed(
175
+ this.$el,
176
+ this.schema,
177
+ {
178
+ data: {
179
+ ...this.locals,
180
+ },
181
+ context: this.context,
182
+ location: this.location,
183
+
184
+ // todo 下发 location 对象
185
+ ...this.props,
186
+ },
187
+ {
188
+ // 覆盖 amis env
189
+ // 参考 https://aisuda.bce.baidu.com/amis/zh-CN/docs/start/getting-started#sdk
190
+ jumpTo: (to, action) => {
191
+ if (to === 'goBack') {
192
+ return router.go(-1)
193
+ }
194
+
195
+ to = normalizeLink(to, this.location)
196
+
197
+ if (action?.actionType === 'url') {
198
+ action.blank === false ? router.push(to) : window.open(to)
199
+ return
200
+ }
201
+
202
+ // 主要是支持 nav 中的跳转
203
+ if (action && to && action.target) {
204
+ window.open(to, action.target)
205
+ return
206
+ }
207
+
208
+ if (/^https?:\/\//.test(to)) {
209
+ window.location.replace(to)
210
+ } else {
211
+ router.push(to)
212
+ }
213
+ },
214
+
215
+ updateLocation: (location, replace) => {
216
+ if (location === 'goBack') {
217
+ return router.go(-1)
218
+ }
219
+
220
+ location = normalizeLink(location, this.location)
221
+ replace ? router.replace(location) : router.replace(location)
222
+ },
223
+
224
+ ...this.env,
225
+ },
226
+ () => {
227
+ this.$emit('ready', {
228
+ instance,
229
+ })
230
+ }
231
+ )
232
+ this.amisInstance = instance
233
+ },
234
+
235
+ methods: {
236
+ updateProps () {
237
+ // eslint-disable-next-line no-unused-expressions
238
+ this.amisInstance?.updateProps({
239
+ data: {
240
+ ...this.locals,
241
+ },
242
+ context: this.context,
243
+ ...this.props,
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>
@@ -25,7 +25,7 @@
25
25
  <a-icon type="bank" /> {{ group.title }}
26
26
  </span>
27
27
  <a-select-option v-for="address in group.children" :key="address.label + ' <' + address.value + '>'">
28
- <p class="addressName"><a-icon type="environment" /> <span v-html="highLight(address.label, address.word)">{{ address.label }}</span></p>
28
+ <p class="addressName"><a-icon type="environment" /><span v-html="highLight(address.label, address.word)"></span></p>
29
29
  <p v-if="address.address !== '[]'" class="addressRemark">
30
30
  {{ address.address }}
31
31
  </p>
@@ -169,7 +169,7 @@ export default {
169
169
  const addressMap = {}
170
170
  result.tips.forEach((res) => {
171
171
  if (res.location) {
172
- if (!addressMap.hasOwnProperty(res.district)) {
172
+ if (!Object.prototype.hasOwnProperty.call(addressMap, res.district)) {
173
173
  addressMap[res.district] = []
174
174
  }
175
175
  addressMap[res.district].push({
@@ -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 [ ] } // lng:描述信息 lat:描述信息对应的值的字段名 { describe: '用户名称', field: 'name' }
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 "https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png"
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
  }
@@ -1,3 +1,3 @@
1
- import CitySelect from './CitySelect'
2
-
3
- export default CitySelect
1
+ import CitySelect from './CitySelect'
2
+
3
+ export default CitySelect
@@ -1,109 +1,109 @@
1
- # 省市区修改组件
2
-
3
- > 下拉框数据从库里查询 divisions_of_china 表
4
- > 省市区数据存储格式
5
-
6
- +---------+-----+------------+--------+--------+----------+
7
- |code |name |provinceCode|cityCode|areaCode|parentCode|
8
- +---------+-----+------------+--------+--------+----------+
9
- |11 |北京市 |NULL |NULL |NULL |NULL |
10
- |1101 |市辖区 |11 |NULL |NULL |11 |
11
- |110101 |东城区 |11 |1101 |NULL |1101 |
12
- |110101001|东华门街道|11 |1101 |110101 |1101 |
13
- |110101002|景山街道 |11 |1101 |110101 |1101 |
14
- +---------+-----+------------+--------+--------+----------+
15
-
16
-
17
- 查询出来之后转成tree 作为数据 (截取了一段数据)
18
-
19
- ```json
20
- [
21
- {
22
- "code": "11",
23
- "name": "北京",
24
- "label": "北京",
25
- "value": "北京",
26
- "children":
27
- [
28
- {
29
- "code": "1101",
30
- "parentcode": "11",
31
- "name": "辖区",
32
- "label": "辖区",
33
- "value": "辖区",
34
- "children":
35
- [
36
- {
37
- "code": "110101",
38
- "parentcode": "1101",
39
- "name": "东城区",
40
- "label": "东城区",
41
- "value": "东城区"
42
- }
43
- ]}]}]
44
- ```
45
-
46
- 可传递参数
47
- ```js
48
- props = {
49
- // 页面渲染内容 默认 省市区街道 四个 所以是4
50
- contexts: {
51
- type: Number,
52
- default: 3
53
- },
54
- placeholder: {
55
- type: String,
56
- default: '请选择省市区'
57
- },
58
- // small lage 输入框大小
59
- size: {
60
- type: String,
61
- default: undefined
62
- },
63
- // 类型 simple / undefined
64
- // simple 就是用的 cascader 不穿就是用的 自己封装的
65
- type: {
66
- type: String,
67
- default: undefined
68
- },
69
- // 框的样式
70
- inputStyle: {
71
- type: Object,
72
- default: () => {
73
- }
74
- },
75
- // 下拉框的样式
76
- dropdownStyle: {
77
- type: Object,
78
- default: () => {
79
- return {
80
- width: '35rem',
81
- padding: '1%'
82
- }
83
- }
84
- },
85
- // 标签的样式
86
- tagStyle: {
87
- type: Object,
88
- default: () => {
89
- return {
90
- fontSize: '0.88rem',
91
- width: '23%',
92
- textAlign: 'left',
93
- margin: '0.5%',
94
- cursor: 'pointer'
95
- }
96
- }
97
- },
98
- // 用于v-model 绑定
99
- value: {
100
- type: String,
101
- default: undefined
102
- },
103
- // 用于v-model 绑定 code :最后一级的code address: 所有级拼接的地址
104
- valueType: {
105
- type: String,
106
- default: 'address'
107
- }
108
- }
109
- ```
1
+ # 省市区修改组件
2
+
3
+ > 下拉框数据从库里查询 divisions_of_china 表
4
+ > 省市区数据存储格式
5
+
6
+ +---------+-----+------------+--------+--------+----------+
7
+ |code |name |provinceCode|cityCode|areaCode|parentCode|
8
+ +---------+-----+------------+--------+--------+----------+
9
+ |11 |北京市 |NULL |NULL |NULL |NULL |
10
+ |1101 |市辖区 |11 |NULL |NULL |11 |
11
+ |110101 |东城区 |11 |1101 |NULL |1101 |
12
+ |110101001|东华门街道|11 |1101 |110101 |1101 |
13
+ |110101002|景山街道 |11 |1101 |110101 |1101 |
14
+ +---------+-----+------------+--------+--------+----------+
15
+
16
+
17
+ 查询出来之后转成tree 作为数据 (截取了一段数据)
18
+
19
+ ```json
20
+ [
21
+ {
22
+ "code": "11",
23
+ "name": "北京",
24
+ "label": "北京",
25
+ "value": "北京",
26
+ "children":
27
+ [
28
+ {
29
+ "code": "1101",
30
+ "parentcode": "11",
31
+ "name": "辖区",
32
+ "label": "辖区",
33
+ "value": "辖区",
34
+ "children":
35
+ [
36
+ {
37
+ "code": "110101",
38
+ "parentcode": "1101",
39
+ "name": "东城区",
40
+ "label": "东城区",
41
+ "value": "东城区"
42
+ }
43
+ ]}]}]
44
+ ```
45
+
46
+ 可传递参数
47
+ ```js
48
+ props = {
49
+ // 页面渲染内容 默认 省市区街道 四个 所以是4
50
+ contexts: {
51
+ type: Number,
52
+ default: 3
53
+ },
54
+ placeholder: {
55
+ type: String,
56
+ default: '请选择省市区'
57
+ },
58
+ // small lage 输入框大小
59
+ size: {
60
+ type: String,
61
+ default: undefined
62
+ },
63
+ // 类型 simple / undefined
64
+ // simple 就是用的 cascader 不穿就是用的 自己封装的
65
+ type: {
66
+ type: String,
67
+ default: undefined
68
+ },
69
+ // 框的样式
70
+ inputStyle: {
71
+ type: Object,
72
+ default: () => {
73
+ }
74
+ },
75
+ // 下拉框的样式
76
+ dropdownStyle: {
77
+ type: Object,
78
+ default: () => {
79
+ return {
80
+ width: '35rem',
81
+ padding: '1%'
82
+ }
83
+ }
84
+ },
85
+ // 标签的样式
86
+ tagStyle: {
87
+ type: Object,
88
+ default: () => {
89
+ return {
90
+ fontSize: '0.88rem',
91
+ width: '23%',
92
+ textAlign: 'left',
93
+ margin: '0.5%',
94
+ cursor: 'pointer'
95
+ }
96
+ }
97
+ },
98
+ // 用于v-model 绑定
99
+ value: {
100
+ type: String,
101
+ default: undefined
102
+ },
103
+ // 用于v-model 绑定 code :最后一级的code address: 所有级拼接的地址
104
+ valueType: {
105
+ type: String,
106
+ default: 'address'
107
+ }
108
+ }
109
+ ```