agilebuilder-ui 1.0.71 → 1.0.73

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.
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <FsUploadList
3
- v-if="displayType === 'input'"
3
+ v-if="!isMobile && displayType === 'input'"
4
4
  :value="props.fileInfo.showName"
5
5
  :row="entity"
6
6
  :disabled="disabled"
@@ -11,7 +11,7 @@
11
11
  @delete-success="onInputDeleteSuccess"
12
12
  />
13
13
  <fs-button-upload
14
- v-else-if="displayType === 'button'"
14
+ v-else-if="!isMobile && displayType === 'button'"
15
15
  :disabled="disabled"
16
16
  :fileInfo="fileInfo"
17
17
  :systemCode="systemCode"
@@ -23,17 +23,17 @@
23
23
  :action="action"
24
24
  :headers="headers"
25
25
  :file-list="fileList"
26
- :handleBeforeUpload="handleBeforeUpload"
26
+ :beforeUpload="beforeUpload"
27
27
  :onSuccess="onSuccess"
28
28
  :beforeRemove="beforeRemove"
29
29
  :onRemove="onRemove"
30
30
  :beforeDownload="beforeDownload"
31
31
  :pageContext="pageContext"
32
32
  :configure="configure"
33
- :openFsUpload="openFsUpload"
33
+ :openFsUpload="openFsUpload"
34
34
  />
35
35
  <fs-drag-upload
36
- v-else-if="displayType === 'drag'"
36
+ v-else-if="!isMobile && displayType === 'drag'"
37
37
  :disabled="disabled"
38
38
  :fileInfo="fileInfo"
39
39
  :systemCode="systemCode"
@@ -45,20 +45,68 @@
45
45
  :action="action"
46
46
  :headers="headers"
47
47
  :file-list="fileList"
48
- :handleBeforeUpload="handleBeforeUpload"
48
+ :beforeUpload="beforeUpload"
49
49
  :onSuccess="onSuccess"
50
50
  :beforeRemove="beforeRemove"
51
51
  :onRemove="onRemove"
52
52
  :beforeDownload="beforeDownload"
53
53
  :pageContext="pageContext"
54
54
  :configure="configure"
55
- :openFsUpload="openFsUpload"
55
+ :openFsUpload="openFsUpload"
56
+ />
57
+ <FileUploadInputMobile
58
+ v-else-if="isMobile && displayType === 'input'"
59
+ :disabled="disabled"
60
+ :fileInfo="fileInfo"
61
+ :systemCode="systemCode"
62
+ :accept="accept"
63
+ :multiple="multiple"
64
+ :limit="limit"
65
+ :limitFileSize="limitFileSize"
66
+ :placeholder="placeholder"
67
+ :action="action"
68
+ :headers="headers"
69
+ :file-list="fileList"
70
+ :beforeUpload="beforeUpload"
71
+ :onSuccess="onSuccess"
72
+ :beforeRemove="beforeRemove"
73
+ :onRemove="onRemove"
74
+ :beforeDownload="beforeDownload"
75
+ :pageContext="pageContext"
76
+ :configure="configure"
77
+ :openFsUpload="openFsUpload"
78
+ />
79
+ <FileUploadMobile v-else-if="isMobile"
80
+ :disabled="disabled"
81
+ :fileInfo="fileInfo"
82
+ :systemCode="systemCode"
83
+ :accept="accept"
84
+ :multiple="multiple"
85
+ :limit="limit"
86
+ :limitFileSize="limitFileSize"
87
+ :placeholder="placeholder"
88
+ :action="action"
89
+ :headers="headers"
90
+ :file-list="fileList"
91
+ :beforeUpload="beforeUpload"
92
+ :onSuccess="onSuccess"
93
+ :beforeRemove="beforeRemove"
94
+ :onRemove="onRemove"
95
+ :beforeDownload="beforeDownload"
96
+ :pageContext="pageContext"
97
+ :configure="configure"
98
+ :openFsUpload="openFsUpload"
99
+ @uploadend="uploadendMobile"
100
+ @remove="removeMobileFile"
56
101
  />
57
102
  </template>
58
103
  <script setup lang="ts">
59
104
  import FsDragUpload from './fs-drag-upload.vue'
60
105
  import FsButtonUpload from './fs-button-upload.vue'
106
+ import FileUploadMobile from './file-upload-mobile/file-upload.vue'
107
+ import FileUploadInputMobile from './file-upload-mobile/file-upload-input.vue'
61
108
  import { ref, defineProps } from 'vue'
109
+ import { getReplaceUrlDomain, isMobileBrowser, isPlateSys } from '../../../src/utils/common-util'
62
110
  const props = defineProps({
63
111
  openFsUpload:{
64
112
  type: Object,
@@ -118,7 +166,7 @@ const props = defineProps({
118
166
  type: Array<{ showName: string; serverPath: string }>,
119
167
  default: () => []
120
168
  },
121
- handleBeforeUpload: {
169
+ beforeUpload: {
122
170
  type: Function,
123
171
  default: () => {}
124
172
  },
@@ -147,6 +195,9 @@ const props = defineProps({
147
195
  default: () => ({})
148
196
  }
149
197
  })
198
+ const isMobile = ref(isMobileBrowser())
199
+ const pageType = ref(props.pageContext.pageType)
200
+ console.log('附件上传控件---fs-upload-new---isMobile=', isMobile.value, 'pageType=', pageType.value , 'systemCode=', props.systemCode ,'configure=', props.configure, 'props.pageContext=', props.pageContext)
150
201
  const listFileLabel = ref<string>('')
151
202
  if (props.displayType === 'input') {
152
203
  listFileLabel.value = props.fileInfo.showName || ''
@@ -179,4 +230,33 @@ const onInputDeleteSuccess = (res: any) => {
179
230
  listFileLabel.value = props.fileList.map((item: any) => item.showName).join(',')
180
231
  props.onRemove()
181
232
  }
233
+
234
+ function uploadendMobile(fileList) {
235
+ const fileServerPaths = Array.from(props.fileList,({serverPath})=>serverPath)
236
+ // console.log('uploadendMobile---props.fileList=', props.fileList,'fileServerPaths=',fileServerPaths, 'fileList=', fileList)
237
+ fileList.forEach(file=>{
238
+ // 如果已经存在就不要重复添加到fileList中了
239
+ if(fileServerPaths.indexOf(file.serverPath) < 0){
240
+ props.fileList.push({
241
+ showName: file.name,
242
+ serverPath: file.serverPath
243
+ })
244
+ }
245
+ })
246
+ props.onSuccess()
247
+ }
248
+
249
+
250
+ function removeMobileFile(param) {
251
+ // console.log('removeMobileFile---props.fileList=', props.fileList, 'param=', param)
252
+ const deleteFile = param.rmFiles && param.rmFiles.length > 0 ? param.rmFiles[0] : null
253
+ if(deleteFile){
254
+ let index = props.fileList.findIndex((item: any) => item.serverPath === deleteFile.serverPath)
255
+ if (index > -1) {
256
+ // eslint-disable-next-line vue/no-mutating-props
257
+ props.fileList.splice(index, 1)
258
+ }
259
+ }
260
+ props.onRemove()
261
+ }
182
262
  </script>
@@ -220,7 +220,7 @@ function getDevPlatformPermissions(roleCodes) {
220
220
 
221
221
 
222
222
  function getCurrentUserMobilePermissions (loginName) {
223
- return request.get(Vue.prototype.baseAPI + '/sso/current-users/mobile-permissions?loginName=' + encodeURI(loginName) + '&_t=' + new Date().getTime())
223
+ return request.get(window.$vueApp.config.globalProperties.baseAPI + '/sso/current-users/mobile-permissions?loginName=' + encodeURI(loginName) + '&_t=' + new Date().getTime())
224
224
  }
225
225
 
226
226
  export default {
@@ -259,6 +259,8 @@ const cn = {
259
259
  operating: '操作',
260
260
  uploadSucceeded: '上传成功',
261
261
  theNumberOfUploadsExceedsTheLimitTheLimitIs: '上传数量超过限制,限制数量为',
262
+ image: '图片',
263
+ video: '视频'
262
264
  },
263
265
  messageVideo: {
264
266
  attemptingToIdentify: '正在尝试识别....',
@@ -269,6 +269,8 @@ const en = {
269
269
  uploadSucceeded: 'Upload succeeded',
270
270
  theNumberOfUploadsExceedsTheLimitTheLimitIs:
271
271
  'The number of uploads exceeds the limit. The limit is',
272
+ image: 'Image',
273
+ video: 'Video'
272
274
  },
273
275
  messageVideo: {
274
276
  attemptingToIdentify: 'Attempting to identify',
@@ -535,12 +535,12 @@ function isOpenMobileGateway () {
535
535
  export function getReplaceUrlDomain (url) {
536
536
  const isOpenMobileGatewayCache = isOpenMobileGateway()
537
537
  console.log('===getReplaceUrlDomain==isOpenMobileGatewayCache=', isOpenMobileGatewayCache)
538
- if (isOpenMobileGatewayCache === 'true' && url !== undefined && Vue.prototype.replaceUrl) {
538
+ if (isOpenMobileGatewayCache === 'true' && url !== undefined && window.$vueApp.config.globalProperties.replaceUrl) {
539
539
  // 表示需要替换url中的"https://域名"
540
- const baseApi = Vue.prototype.baseAPI
541
- if ((url + '').indexOf(Vue.prototype.replaceUrl + '/') < 0 && (url + '').indexOf('://') > 0) {
540
+ const baseApi = uswindow.$vueApp.config.globalProperties.baseAPI
541
+ if ((url + '').indexOf(uswindow.$vueApp.config.globalProperties.replaceUrl + '/') < 0 && (url + '').indexOf('://') > 0) {
542
542
  // 表示路径还未替换
543
- console.log('===getReplaceUrlDomain==url.indexOf(Vue.prototype.replaceUrl) !== 0')
543
+ console.log('===getReplaceUrlDomain==url.indexOf(uswindow.$vueApp.config.globalProperties.replaceUrl) !== 0')
544
544
  const prefixUrl1 = baseApi.substring(0, baseApi.indexOf('://'))
545
545
  const urlSuffix1 = baseApi.substring(baseApi.indexOf('://') + 3)
546
546
  const domainUrl1 = urlSuffix1.substring(0, urlSuffix1.indexOf('/'))
@@ -551,7 +551,7 @@ export function getReplaceUrlDomain (url) {
551
551
  const prefixUrl = prefixUrl2 + '://' + domainUrl2
552
552
  if (prefixUrl === prefixUrlBase) {
553
553
  urlSuffix = urlSuffix.substring(urlSuffix.indexOf('/'))
554
- url = Vue.prototype.replaceUrl + urlSuffix
554
+ url = uswindow.$vueApp.config.globalProperties.replaceUrl + urlSuffix
555
555
  console.log('===getReplaceUrlDomain==url=', url)
556
556
  }
557
557
  } else {
@@ -1,3 +1,46 @@
1
1
  <template>
2
2
  <router-view />
3
3
  </template>
4
+ <script>
5
+ import eventBus from '../../../src/utils/eventBus'
6
+ export default {
7
+ created(){
8
+ window.addEventListener('message', this.receiveMessage, false)
9
+ },
10
+ destroyed () {
11
+ window.removeEventListener('message', this.receiveMessage, false)
12
+ },
13
+ methods: {
14
+ receiveMessage (event) {
15
+ const result = event.data
16
+ console.log('receiveMessage-----result111=', result)
17
+ if (result && typeof result === 'string') {
18
+ console.log('receiveMessage-----result2222=', result)
19
+ // console.log('接收手机端传过来的信息--receiveMessage===', result)
20
+ try {
21
+ const data = JSON.parse(result)
22
+ // console.log('接收手机端传过来的信息--data=', data)
23
+ const type = data.type // 'pickFileDone' 选择文件完成,'uploadFileDone' 上传文件完成
24
+ console.log('receiveMessage-----result3333=', type, 'data.files=', data.files)
25
+ // console.log('接收手机端传过来的信息--type=', type)
26
+ if (type && type === 'onResize') {
27
+ // 横竖屏切换时重新计算高度
28
+ eventBus.$emit('onResize')
29
+ } else if (type && type === 'pickFileDone') {
30
+ // 选择文件完成
31
+ console.log('receiveMessage-----result4444=', type)
32
+ // fileNames:[{name:'xx',base64Path:'xxx'},{name:'xxx',base64Path:'xxxxx'}]
33
+ eventBus.$emit('pickFileDone', data)
34
+ } else if (type && type === 'uploadFileDone') {
35
+ eventBus.$emit('uploadFileDone', data)
36
+ } else if (type && type === 'scan') {
37
+ eventBus.$emit('scan', data)
38
+ }
39
+ } catch (error) {
40
+ console.log(error)
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ </script>
@@ -17,6 +17,7 @@
17
17
  import { Sidebar, AppMain, Breadcrumb } from './components'
18
18
  import ResizeMixin from './mixin/ResizeHandler'
19
19
  import { isShowMenuRoute } from '../../../src/utils/common-util'
20
+ import eventBus from '../../../src/utils/eventBus'
20
21
 
21
22
  export default {
22
23
  name: 'Layout',
@@ -49,10 +50,46 @@ export default {
49
50
  }
50
51
  },
51
52
  },
53
+ created(){
54
+ window.addEventListener('message', this.receiveMessage, false)
55
+ },
56
+ destroyed () {
57
+ window.removeEventListener('message', this.receiveMessage, false)
58
+ },
52
59
  methods: {
53
60
  handleClickOutside() {
54
61
  this.$store.dispatch('closeSidebar', { withoutAnimation: false })
55
62
  },
63
+ receiveMessage (event) {
64
+ const result = event.data
65
+ console.log('receiveMessage-----result111=', result)
66
+ if (result && typeof result === 'string') {
67
+ console.log('receiveMessage-----result2222=', result)
68
+ // console.log('接收手机端传过来的信息--receiveMessage===', result)
69
+ try {
70
+ const data = JSON.parse(result)
71
+ // console.log('接收手机端传过来的信息--data=', data)
72
+ const type = data.type // 'pickFileDone' 选择文件完成,'uploadFileDone' 上传文件完成
73
+ console.log('receiveMessage-----result3333=', type, 'data.files=', data.files)
74
+ // console.log('接收手机端传过来的信息--type=', type)
75
+ if (type && type === 'onResize') {
76
+ // 横竖屏切换时重新计算高度
77
+ eventBus.$emit('onResize')
78
+ } else if (type && type === 'pickFileDone') {
79
+ // 选择文件完成
80
+ console.log('receiveMessage-----result4444=', type)
81
+ // fileNames:[{name:'xx',base64Path:'xxx'},{name:'xxx',base64Path:'xxxxx'}]
82
+ eventBus.$emit('pickFileDone', data)
83
+ } else if (type && type === 'uploadFileDone') {
84
+ eventBus.$emit('uploadFileDone', data)
85
+ } else if (type && type === 'scan') {
86
+ eventBus.$emit('scan', data)
87
+ }
88
+ } catch (error) {
89
+ console.log(error)
90
+ }
91
+ }
92
+ }
56
93
  },
57
94
  }
58
95
  </script>