agilebuilder-ui 1.1.28 → 1.1.29-dingtalkphoto1

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,5 +1,5 @@
1
1
  import { openBlock as r, createElementBlock as t, createCommentVNode as o } from "vue";
2
- import { _ as s } from "./index-ce3ae297.js";
2
+ import { _ as s } from "./index-1a5b5812.js";
3
3
  const u = ["src"], f = s({ data: () => ({ src: null }), watch: { $route(n, c) {
4
4
  this.src = this.$route.query.src;
5
5
  } }, mounted() {
@@ -1,4 +1,4 @@
1
- import { _ as f, c as $, g as x, b as P, s as h, m as M, M as O, i as I } from "./index-ce3ae297.js";
1
+ import { _ as f, c as $, g as x, b as P, s as h, m as M, M as O, i as I } from "./index-1a5b5812.js";
2
2
  import { resolveComponent as u, openBlock as l, createBlock as b, withCtx as g, createVNode as v, TransitionGroup as L, createElementBlock as p, Fragment as T, renderList as C, createElementVNode as m, toDisplayString as w, normalizeClass as S, createCommentVNode as y } from "vue";
3
3
  const k = { class: "no-redirect" }, A = f({ name: "Breadcrumb", data: () => ({ levelList: null }), computed: { levelListWithTitle() {
4
4
  return this.levelList.filter((e) => e.meta.title !== void 0 && e.meta.title !== null);
@@ -1,5 +1,5 @@
1
1
  import { resolveComponent as t, openBlock as a, createElementBlock as s, createElementVNode as y, createVNode as l, withCtx as r, createTextVNode as n, toDisplayString as p, createCommentVNode as c, createBlock as h } from "vue";
2
- import { _ as I } from "./index-ce3ae297.js";
2
+ import { _ as I } from "./index-1a5b5812.js";
3
3
  const g = { style: { "padding-bottom": "10px" } }, k = { key: 0, class: "graphDiv" }, N = I({ name: "TacheSubprocessHistory", data: () => ({ type: "graph", workflowId: null }), created() {
4
4
  const o = this.$route.query.workflowId;
5
5
  o && (this.workflowId = parseInt(o));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agilebuilder-ui",
3
- "version": "1.1.28",
3
+ "version": "1.1.29-dingtalkphoto1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./lib/super-ui.js",
@@ -15,66 +15,44 @@
15
15
  @chooseFile="pickBrowserFiles"
16
16
  @remove="removeFile"
17
17
  />
18
- <!-- <template v-if="openCameraOrChoosePhoto && openCameraOrChoosePhoto === 'openCamera'"> -->
19
- <!-- 由于直接打开capture相机属性的设置为空或者不是user/environment其中的任意一项时会打开的本地捕获音频 麦克风-->
20
- <!-- 所有使用 template 可查看 https://w3c.github.io/html-media-capture/#introduction -->
18
+ <template
19
+ v-if="openCameraOrChoosePhoto === 'openChoosePhoto' || openCameraOrChoosePhoto === 'openCameraAndChoosePhoto'"
20
+ >
21
21
  <input
22
- v-if="multiple && !disabled"
23
22
  ref="fileRef"
24
23
  type="file"
25
- multiple="multiple"
26
- :capture="'environment'"
24
+ :multiple="multiple ? true : false"
27
25
  name="file"
28
26
  :accept="myAccept"
29
27
  style="display: none"
30
28
  @change="uploadFiles"
31
29
  />
32
- <input
33
- v-else-if="!disabled"
34
- ref="fileRef"
35
- type="file"
36
- :capture="'environment'"
37
- name="file"
38
- style="display: none"
39
- :accept="myAccept"
40
- @change="uploadFiles"
41
- />
42
- <!-- </template>
30
+ </template>
43
31
  <template v-else>
32
+ <!-- 由于直接打开capture相机属性的设置为空或者不是user/environment其中的任意一项时会打开的本地捕获音频 麦克风-->
33
+ <!-- 所有使用 template 可查看 https://w3c.github.io/html-media-capture/#introduction -->
44
34
  <input
45
- v-if="multiple && !disabled"
46
35
  ref="fileRef"
47
36
  type="file"
48
- multiple="multiple"
37
+ :multiple="multiple ? true : false"
38
+ capture="environment"
49
39
  name="file"
50
40
  :accept="myAccept"
51
41
  style="display: none"
52
42
  @change="uploadFiles"
53
43
  />
54
- <input
55
- v-else-if="!disabled"
56
- ref="fileRef"
57
- type="file"
58
- name="file"
59
- style="display: none"
60
- :accept="myAccept"
61
- @change="uploadFiles"
62
- />
63
- </template> -->
44
+ </template>
64
45
  <el-drawer v-model="fileTypeFlag" direction="btt" @close="fileTypeFlag = false">
65
- <div><el-button
66
- link
67
- @click="confirmFileType('image')"
68
- >
69
- {{ $t('fsUpload.image') }}
70
- </el-button></div>
71
46
  <div>
72
- <el-button
73
- link
74
- @click="confirmFileType('video')"
75
- >
76
- {{ $t('fsUpload.video') }}
77
- </el-button></div>
47
+ <el-button link @click="confirmFileType('image')">
48
+ {{ $t('fsUpload.image') }}
49
+ </el-button>
50
+ </div>
51
+ <div>
52
+ <el-button link @click="confirmFileType('video')">
53
+ {{ $t('fsUpload.video') }}
54
+ </el-button>
55
+ </div>
78
56
  </el-drawer>
79
57
  </div>
80
58
  </template>
@@ -204,6 +182,12 @@ const props = defineProps({
204
182
  }
205
183
  })
206
184
 
185
+ const isDingTalk = ref(false)
186
+ const authSource = window.localStorage.getItem('auth_source')
187
+ if (authSource && authSource === 'dingtalk') {
188
+ isDingTalk.value = true
189
+ }
190
+
207
191
  const fileListResult = ref(props.fileList)
208
192
 
209
193
  let baseURL = window.$vueApp.config.globalProperties.baseURL
@@ -230,11 +214,11 @@ if (props.action) {
230
214
 
231
215
  defaultAction.value = getReplaceUrlDomain(defaultAction.value)
232
216
 
233
- let myAccept = ref(props.accept ? props.accept : '')
217
+ let myAccept = ref(props.accept ? props.accept : 'image/*')
234
218
  let tempFileList = ref([])
235
219
  let isUploading = ref(false)
236
220
  let isFile = ref(false)
237
- const fileRef = ref(null)
221
+ const fileRef = ref()
238
222
  const fileTypeFlag = ref(false)
239
223
  const emits = defineEmits(['remove', 'uploadend'])
240
224
  const { t } = useI18n()
@@ -256,17 +240,21 @@ function isImg(file) {
256
240
  function removeFile(param) {
257
241
  console.log('removeFile----param=', param)
258
242
  const file = param.file
259
- if(file){
243
+ if (file) {
260
244
  emits('remove', { rmFiles: [file], serverFiles: fileListResult.value, index: param.index })
261
245
  }
262
246
  }
263
247
  function pickBrowserFiles() {
264
248
  // if (props.openCameraOrChoosePhoto && props.openCameraOrChoosePhoto === 'openCamera') {
265
- // 只打开相机
266
- myAccept.value = 'image/*'
267
- setTimeout(() => {
268
- fileRef.value.click()
269
- })
249
+ // 只打开相机
250
+ myAccept.value = 'image/*'
251
+ // if (isDingTalk.value) {
252
+ // dingtalkChooseImage()
253
+ // } else {
254
+ setTimeout(() => {
255
+ fileRef.value.click()
256
+ })
257
+ // }
270
258
  // } else {
271
259
  // // 相机和文件都可以选
272
260
  // myAccept.value = '*'
@@ -299,7 +287,7 @@ async function uploadBrowserFile() {
299
287
  limitFileSize = 30
300
288
  }
301
289
  let isCanUpload = false
302
- const files = fileRef.value.files
290
+ const files = fileRef.value.files
303
291
  for (let i = 0; i < files.length; i++) {
304
292
  const newFile = files[i]
305
293
  isCanUpload = validateCanUploadFile(newFile, limitFileSize)
@@ -309,18 +297,24 @@ async function uploadBrowserFile() {
309
297
  break
310
298
  }
311
299
  }
312
- console.error('isCanUpload=', isCanUpload)
300
+ console.error('isCanUpload=', isCanUpload)
313
301
  if (isCanUpload) {
314
302
  for (let i = 0; i < files.length; i++) {
315
303
  const fileObj = files[i]
316
- console.error('fileObj.name=', fileObj.name, 'fileNames=', fileNames)
304
+ console.error('fileObj.name=', fileObj.name, 'fileNames=', fileNames)
317
305
  if (fileNames.indexOf(fileObj.name) >= 0) {
318
306
  selectFiles.push(fileObj)
319
307
  }
320
308
  if (props.beforeUpload && typeof props.beforeUpload === 'function') {
321
309
  const isMobile = true
322
310
  // eslint-disable-next-line no-useless-call
323
- isCanUpload = props.beforeUpload({fileObj, files:selectFiles, isMobile, pageContext: props.pageContext, configureObj: props.configure})
311
+ isCanUpload = props.beforeUpload({
312
+ fileObj,
313
+ files: selectFiles,
314
+ isMobile,
315
+ pageContext: props.pageContext,
316
+ configureObj: props.configure
317
+ })
324
318
  }
325
319
  }
326
320
  }
@@ -353,7 +347,6 @@ async function uploadBrowserFile() {
353
347
  }
354
348
  param.append('systemCode', props.systemCode)
355
349
 
356
- console.log('上传文件111-----defaultAction.value=',defaultAction.value, 'param=', param, 'uploadFiles=', uploadFiles)
357
350
  window.$vueApp.config.globalProperties.$http
358
351
  .post(defaultAction.value, param, { headers: { 'Content-Type': 'multipart/form-data', Authorization: getToken() } })
359
352
  .then((result) => {
@@ -381,14 +374,13 @@ async function uploadBrowserFile() {
381
374
  }
382
375
  function validateCanUploadFile(file, limitFileSize) {
383
376
  let isCanUpload = true
384
- console.log('上传文件--验证文件大小--file.size=', file.size, '文件线状大小,单位是M,limitFileSize=', limitFileSize)
385
377
  if (file.size > limitFileSize * 1024 * 1024) {
386
378
  // 超过最大限制
387
379
  ElMessage({
388
- showClose: true,
389
- type: 'warning',
390
- message: t('fileUpload.exceedFileSize', { fileName: file.name, fileSize: limitFileSize })
391
- })
380
+ showClose: true,
381
+ type: 'warning',
382
+ message: t('fileUpload.exceedFileSize', { fileName: file.name, fileSize: limitFileSize })
383
+ })
392
384
  // 返回false停止上传
393
385
  isCanUpload = false
394
386
  }
@@ -396,35 +388,23 @@ function validateCanUploadFile(file, limitFileSize) {
396
388
  }
397
389
  // 所有文件上传完毕后
398
390
  function uploadComplete(result) {
399
- console.log('uploadComplete=开始')
400
- if(!fileListResult.value){
391
+ if (!fileListResult.value) {
401
392
  fileListResult.value = []
402
393
  }
403
394
  if (props.multiple) {
404
- console.log(
405
- 'uploadComplete====fileListResult.value111=',
406
- JSON.stringify(fileListResult.value),
407
- 'result=',
408
- result
409
- )
410
395
  fileListResult.value = fileListResult.value.concat(result)
411
- console.log('uploadComplete====fileListResult.value222=', fileListResult.value)
412
396
  } else {
413
397
  // 单选时将已选文件移除,然后再替换为新上传的文件
414
- console.log('uploadComplete====fileListResult.value333=', JSON.stringify(fileListResult.value))
415
398
  const rmFiles = JSON.parse(JSON.stringify(fileListResult.value))
416
399
  fileListResult.value.push(result)
417
400
  emits('remove', { rmFiles, serverFiles: fileListResult.value, index: 0 })
418
- console.log('uploadComplete====fileListResult.value444=', fileListResult.value)
419
401
  }
420
- console.log('uploadComplete====fileListResult.value555=', fileListResult.value)
421
402
 
422
403
  fileRef.value.value = null
423
404
  isUploading.value = false
424
405
  fileUploadRef.value.changeFileList(fileListResult.value)
425
406
  // 表示上传完成
426
407
  emits('uploadend', fileListResult.value)
427
- console.log('uploadComplete====上传完成=')
428
408
  }
429
409
  function uploadFiles() {
430
410
  uploadBrowserFiles()
@@ -433,8 +413,19 @@ function uploadBrowserFiles() {
433
413
  console.log('uploadBrowserFiles=====上传开始=')
434
414
  const files = fileRef.value.files
435
415
  if (files && files.length > 0) {
436
- isUploading.value = true
437
- uploadBrowserFile()
416
+ if (isDingTalk.value && !props.multiple) {
417
+ // 清除文件列表
418
+ ElMessage({
419
+ showClose: true,
420
+ type: 'warning',
421
+ message: t('fileUpload.theNumberOfUploadsExceedsTheLimitTheLimitIs') + ': 1'
422
+ })
423
+ fileRef.value.value = null
424
+ return
425
+ } else {
426
+ isUploading.value = true
427
+ uploadBrowserFile()
428
+ }
438
429
  } else {
439
430
  uploadNoNewFiles()
440
431
  }
@@ -475,6 +466,34 @@ function compressionImg(selectFiles) {
475
466
  }
476
467
  return Promise.all(uploadFilesPromises)
477
468
  }
469
+
470
+ function dingtalkChooseImage() {
471
+ let sourceType = ['album']
472
+ if (props.openCameraOrChoosePhoto === 'openCameraAndChoosePhoto') {
473
+ sourceType = ['album', 'camera']
474
+ } else if (props.openCameraOrChoosePhoto === 'openChoosePhoto') {
475
+ sourceType = ['album']
476
+ } else if (props.openCameraOrChoosePhoto === 'openCamera') {
477
+ sourceType = ['camera']
478
+ }
479
+ let count = 1
480
+ if (props.multiple) {
481
+ count = 20
482
+ if (props.limit) {
483
+ count = props.limit
484
+ }
485
+ }
486
+ window.top.$dd.biz.util
487
+ .chooseImage({
488
+ sourceType: sourceType,
489
+ count: count
490
+ })
491
+ .then((res) => {
492
+ //
493
+ if (res && res.filePaths && res.filePaths.length > 0) {
494
+ }
495
+ })
496
+ }
478
497
  </script>
479
498
 
480
499
  <style lang="scss" scoped></style>
@@ -1,54 +1,54 @@
1
1
  <template>
2
2
  <div>
3
3
  <el-input
4
- ref="item"
4
+ ref="item"
5
+ :disabled="disabled"
6
+ v-model="fileNames"
7
+ :placeholder="$t('imatrixUIMessage.fileUpload')"
8
+ :readonly="true"
9
+ >
10
+ <template v-slot:append>
11
+ <el-button :icon="Upload" size="default" @click="openAnnexUpload" />
12
+ </template>
13
+ </el-input>
14
+
15
+ <el-dialog
16
+ v-model="annexUploadFlag"
17
+ :append-to-body="true"
18
+ :show-close="true"
19
+ :title="$t('imatrixUIMessage.upload')"
20
+ width="80%"
21
+ @close="annexUploadFlag = false"
22
+ >
23
+ <FileUploadMobile
24
+ ref="fileUploadRef"
5
25
  :disabled="disabled"
6
- v-model="fileNames"
7
- :placeholder="$t('imatrixUIMessage.fileUpload')"
8
- :readonly="true"
9
- >
10
- <template v-slot:append>
11
- <el-button :icon="Upload" size="default" @click="openAnnexUpload" />
12
- </template>
13
- </el-input>
14
-
15
- <el-dialog
16
- v-model="annexUploadFlag"
17
- :append-to-body="true"
18
- :show-close="true"
19
- :title="$t('imatrixUIMessage.upload')"
20
- width="80%"
21
- @close="annexUploadFlag=false"
22
- >
23
- <FileUploadMobile
24
- ref="fileUploadRef"
25
- :disabled="disabled"
26
- :fileInfo="fileInfo"
27
- :systemCode="systemCode"
28
- :accept="accept"
29
- :multiple="multiple"
30
- :limit="limit"
31
- :limitFileSize="limitFileSize"
32
- :placeholder="placeholder"
33
- :action="action"
34
- :headers="headers"
35
- :file-list="fileList"
36
- :beforeUpload="beforeUpload"
37
- :onSuccess="onSuccess"
38
- :beforeRemove="beforeRemove"
39
- :onRemove="onRemove"
40
- :beforeDownload="beforeDownload"
41
- :pageContext="pageContext"
42
- :configure="configure"
43
- :openFsUpload="openFsUpload"
44
- :componentId="componentId"
45
- :componentName="componentName"
46
- :listCode="listCode"
47
- :openCameraOrChoosePhoto="openCameraOrChoosePhoto"
48
- @uploadend="uploadendMobile"
49
- @remove="removeMobileFile"
50
- />
51
- </el-dialog>
26
+ :fileInfo="fileInfo"
27
+ :systemCode="systemCode"
28
+ :accept="accept"
29
+ :multiple="multiple"
30
+ :limit="limit"
31
+ :limitFileSize="limitFileSize"
32
+ :placeholder="placeholder"
33
+ :action="action"
34
+ :headers="headers"
35
+ :file-list="fileList"
36
+ :beforeUpload="beforeUpload"
37
+ :onSuccess="onSuccess"
38
+ :beforeRemove="beforeRemove"
39
+ :onRemove="onRemove"
40
+ :beforeDownload="beforeDownload"
41
+ :pageContext="pageContext"
42
+ :configure="configure"
43
+ :openFsUpload="openFsUpload"
44
+ :componentId="componentId"
45
+ :componentName="componentName"
46
+ :listCode="listCode"
47
+ :openCameraOrChoosePhoto="openCameraOrChoosePhoto"
48
+ @uploadend="uploadendMobile"
49
+ @remove="removeMobileFile"
50
+ />
51
+ </el-dialog>
52
52
  </div>
53
53
  </template>
54
54
 
@@ -56,9 +56,7 @@
56
56
  import { ref, defineEmits } from 'vue'
57
57
  import { ElMessage } from 'element-plus'
58
58
  import FileUploadMobile from './file-upload.vue'
59
- import {
60
- Upload
61
- } from '@element-plus/icons-vue'
59
+ import { Upload } from '@element-plus/icons-vue'
62
60
 
63
61
  const props = defineProps({
64
62
  openFsUpload: {
@@ -179,43 +177,57 @@ const props = defineProps({
179
177
  const emits = defineEmits(['remove', 'uploadend'])
180
178
  const annexUploadFlag = ref(false)
181
179
  const fileNames = ref(null)
182
- fileNames.value = props.fileList && props.fileList.length > 0 ? props.fileList.map((item: any) => item.showName).join(','): null
180
+ fileNames.value =
181
+ props.fileList && props.fileList.length > 0 ? props.fileList.map((item: any) => item.showName).join(',') : null
183
182
 
184
- const openAnnexUpload = ()=>{
183
+ const openAnnexUpload = () => {
185
184
  console.log('点击选择文件按钮---')
186
185
  annexUploadFlag.value = true
187
186
  }
188
187
 
189
188
  function uploadendMobile(fileList) {
190
- const fileServerPaths = Array.from(props.fileList,({serverPath})=>serverPath)
191
- console.log('uploadendMobile---props.fileList=', JSON.stringify(props.fileList),'fileServerPaths=',fileServerPaths, 'fileList=', JSON.stringify(fileList))
192
- fileList.forEach(file=>{
189
+ const fileServerPaths = Array.from(props.fileList, ({ serverPath }) => serverPath)
190
+ console.log(
191
+ 'uploadendMobile---props.fileList=',
192
+ JSON.stringify(props.fileList),
193
+ 'fileServerPaths=',
194
+ fileServerPaths,
195
+ 'fileList=',
196
+ JSON.stringify(fileList)
197
+ )
198
+ fileList.forEach((file) => {
193
199
  // 如果已经存在就不要重复添加到fileList中了
194
- if(fileServerPaths.indexOf(file.serverPath) < 0){
200
+ if (fileServerPaths.indexOf(file.serverPath) < 0) {
195
201
  props.fileList.push({
196
202
  showName: file.name,
197
203
  serverPath: file.serverPath
198
204
  })
199
205
  }
200
206
  })
201
- console.log('uploadendMobile2222---props.fileList=', JSON.stringify(props.fileList),'fileServerPaths=',fileServerPaths, 'fileList=', JSON.stringify(fileList))
202
- fileNames.value =props.fileList.map((item: any) => item.showName).join(',')
207
+ console.log(
208
+ 'uploadendMobile2222---props.fileList=',
209
+ JSON.stringify(props.fileList),
210
+ 'fileServerPaths=',
211
+ fileServerPaths,
212
+ 'fileList=',
213
+ JSON.stringify(fileList)
214
+ )
215
+ fileNames.value = props.fileList.map((item: any) => item.showName).join(',')
203
216
  console.log('uploadendMobile3333---fileNames.value=', fileNames.value)
204
217
  props.onSuccess()
205
218
  }
206
219
 
207
-
208
220
  function removeMobileFile(param) {
209
221
  // console.log('removeMobileFile---props.fileList=', props.fileList, 'param=', param)
210
222
  const deleteFile = param.rmFiles && param.rmFiles.length > 0 ? param.rmFiles[0] : null
211
- if(deleteFile){
223
+ if (deleteFile) {
212
224
  let index = props.fileList.findIndex((item: any) => item.serverPath === deleteFile.serverPath)
213
225
  if (index > -1) {
214
226
  // eslint-disable-next-line vue/no-mutating-props
215
227
  props.fileList.splice(index, 1)
216
228
  }
217
229
  }
218
- fileNames.value =props.fileList.map((item: any) => item.showName).join(',')
230
+ fileNames.value = props.fileList.map((item: any) => item.showName).join(',')
219
231
  props.onRemove()
220
232
  }
221
233
 
@@ -241,7 +253,7 @@ function uploadFileDone(data) {
241
253
  fileUploadRef.value.uploadFileDone(data)
242
254
  }
243
255
  }
244
- defineExpose({pickFileDone,uploadFileDone})
256
+ defineExpose({ pickFileDone, uploadFileDone })
245
257
  </script>
246
258
 
247
259
  <style lang="scss" scoped></style>
@@ -0,0 +1,37 @@
1
+ export function checkDingtalkEnvironment() {
2
+ const authSource = window.localStorage.getItem('auth_source')
3
+ let isDingTalk = false
4
+ if (authSource && authSource === 'dingtalk') {
5
+ isDingTalk = true
6
+ }
7
+
8
+ if (isDingTalk) {
9
+ let dd: any = null
10
+ import('dingtalk-jsapi').then((module) => {
11
+ dd = module.default
12
+ window.$dd = dd
13
+ const nonceStr = '1234567890' // 必填,自定义固定字符串。
14
+ const timeStamp = new Date().getTime() // 必填,生成签名的时间戳
15
+ window.$http
16
+ .post(window.$vueApp.config.globalProperties.baseAPI + '/component/dingtalk/jsticket-sign', {
17
+ nonceStr: nonceStr, // 必填,自定义固定字符串。
18
+ timeStamp: timeStamp, // 必填,生成签名的时间戳
19
+ url: window.location.href // 必填,当前页面的url
20
+ })
21
+ .then((response: any) => {
22
+ dd.config({
23
+ agentId: response.agentId, // 必填,授权应用的agentid
24
+ corpId: response.corpId, //必填,企业ID
25
+ timeStamp: timeStamp, // 必填,生成签名的时间戳
26
+ nonceStr: nonceStr, // 必填,自定义固定字符串。
27
+ signature: response.signature, // 必填,签名
28
+ type: 0, //选填。0表示微应用的jsapi,1表示服务窗的jsapi;不填默认为0。该参数从dingtalk.js的0.8.3版本开始支持
29
+ jsApiList: ['biz.util.chooseImage'] // 必填,需要使用的jsapi列表,注意:不要带dd。
30
+ })
31
+ dd.error(function (err) {
32
+ console.error('dd error: ' + JSON.stringify(err))
33
+ })
34
+ })
35
+ })
36
+ }
37
+ }