agilebuilder-ui 1.0.621 → 1.0.962

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 (120) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.js +115880 -110424
  3. package/lib/super-ui.umd.cjs +103 -95
  4. package/package.json +6 -3
  5. package/packages/department-tree/src/department-tree.vue +27 -10
  6. package/packages/department-tree-inline/src/department-tree-service.js +20 -41
  7. package/packages/department-tree-mobile/src/department-tree-app.vue +6 -6
  8. package/packages/department-tree-mobile/src/department-tree-inline-app.vue +15 -15
  9. package/packages/department-user-tree/src/department-user-tree.vue +17 -2
  10. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +61 -26
  11. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +64 -22
  12. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -6
  13. package/packages/department-user-tree-inline/src/group-user/group-input.vue +162 -0
  14. package/packages/department-user-tree-inline/src/group-user/group-list.vue +99 -0
  15. package/packages/department-user-tree-inline/src/group-user/group-user.vue +42 -0
  16. package/packages/department-user-tree-inline/src/group-user-multiple-tree.vue +304 -0
  17. package/packages/department-user-tree-inline/src/group-user-single-tree.vue +155 -0
  18. package/packages/department-user-tree-inline/src/group-user-tree-service.js +74 -0
  19. package/packages/department-user-tree-inline/src/search-result.vue +34 -36
  20. package/packages/department-user-tree-mobile/src/department-user-tree-app.vue +6 -6
  21. package/packages/department-user-tree-mobile/src/department-user-tree-inline-app.vue +17 -19
  22. package/packages/department-user-tree-mobile/src/department-user-tree-service.ts +0 -11
  23. package/packages/dynamic-source-select/src/dynamic-source-select.vue +795 -799
  24. package/packages/dynamic-source-select/src/events.js +11 -16
  25. package/packages/fs-upload-list/src/fs-upload-list.vue +183 -122
  26. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-app.vue +246 -0
  27. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-browser.vue +480 -0
  28. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-component.vue +127 -0
  29. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-input.vue +246 -0
  30. package/packages/fs-upload-new/src/file-upload-mobile/file-upload.vue +255 -0
  31. package/packages/fs-upload-new/src/fs-button-upload.vue +10 -13
  32. package/packages/fs-upload-new/src/fs-drag-upload.vue +4 -8
  33. package/packages/fs-upload-new/src/fs-preview-new.vue +103 -36
  34. package/packages/fs-upload-new/src/fs-upload-new.vue +160 -13
  35. package/packages/index.js +11 -2
  36. package/packages/organization-input/src/organization-input.vue +493 -539
  37. package/packages/plugins/export-data-new.js +34 -1
  38. package/packages/rich-editor/index.vue +29 -0
  39. package/packages/row-form/index.js +7 -0
  40. package/packages/row-form/index.vue +211 -0
  41. package/packages/scan-code-input/src/scan-code-input.vue +136 -104
  42. package/packages/scan-code-input-browser/index.js +6 -0
  43. package/packages/{scan-code-input/src/scan-code-input-colse.vue → scan-code-input-browser/src/scan-code-input.vue} +1 -28
  44. package/packages/secret-info/index.vue +2 -2
  45. package/packages/super-grid/src/apis.js +158 -10
  46. package/packages/super-grid/src/components/grid-icon.vue +7 -14
  47. package/packages/super-grid/src/components/hyperlinks.vue +24 -8
  48. package/packages/super-grid/src/custom-formatter.js +312 -380
  49. package/packages/super-grid/src/dynamic-input.vue +346 -43
  50. package/packages/super-grid/src/formValidatorUtil.js +79 -15
  51. package/packages/super-grid/src/group-column.vue +5 -0
  52. package/packages/super-grid/src/normal-column-content.vue +1056 -0
  53. package/packages/super-grid/src/normal-column.vue +57 -740
  54. package/packages/super-grid/src/row-detail.vue +50 -0
  55. package/packages/super-grid/src/row-operation.vue +19 -10
  56. package/packages/super-grid/src/scan-util.ts +243 -0
  57. package/packages/super-grid/src/search-button.vue +18 -14
  58. package/packages/super-grid/src/search-form-advancedQuery.vue +9 -2
  59. package/packages/super-grid/src/search-form-item.vue +10 -3
  60. package/packages/super-grid/src/search-form-mobile.vue +250 -0
  61. package/packages/super-grid/src/search-form.vue +159 -82
  62. package/packages/super-grid/src/super-grid-service.js +51 -6
  63. package/packages/super-grid/src/super-grid.vue +657 -761
  64. package/packages/super-grid/src/utils.js +126 -170
  65. package/packages/super-nine-grid/src/super-nine-grid.vue +1032 -1141
  66. package/packages/workflow-button/src/workflow-button.vue +6 -1
  67. package/packages/workgroup-tree/src/workgroup-tree.vue +31 -0
  68. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +28 -0
  69. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +26 -0
  70. package/packages/workgroup-tree-mobile/index.js +6 -0
  71. package/packages/workgroup-tree-mobile/src/dept-result.vue +51 -0
  72. package/packages/workgroup-tree-mobile/src/workgroup-tree-app.vue +120 -0
  73. package/packages/workgroup-tree-mobile/src/workgroup-tree-inline-app.vue +375 -0
  74. package/packages/workgroup-tree-mobile/src/workgroup-tree-service.ts +62 -0
  75. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +15 -0
  76. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +27 -0
  77. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +11 -0
  78. package/packages/workgroup-user-tree-mobile/index.js +6 -0
  79. package/packages/workgroup-user-tree-mobile/src/dept-path.vue +36 -0
  80. package/packages/workgroup-user-tree-mobile/src/dept-result.vue +58 -0
  81. package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-app.vue +119 -0
  82. package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-inline-app.vue +394 -0
  83. package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-service.ts +41 -0
  84. package/src/api/sso-service.js +44 -15
  85. package/src/directives/permission/permission.js +4 -3
  86. package/src/i18n/langs/cn.js +19 -3
  87. package/src/i18n/langs/en.js +18 -2
  88. package/src/permission.js +114 -122
  89. package/src/store/modules/user.js +32 -33
  90. package/src/styles/index.scss +1 -0
  91. package/src/styles/table.scss +12 -0
  92. package/src/styles/theme/dark-blue/button.scss +2 -2
  93. package/src/styles/theme/dark-blue/index.scss +1 -1
  94. package/src/styles/theme/dark-blue/sidebar.scss +10 -0
  95. package/src/styles/theme/dark-blue/table.scss +8 -52
  96. package/src/styles/theme/green/button.scss +2 -2
  97. package/src/styles/theme/green/green.scss +1 -1
  98. package/src/styles/theme/green/index.scss +1 -1
  99. package/src/styles/theme/green/sidebar.scss +20 -0
  100. package/src/styles/theme/green/table.scss +7 -51
  101. package/src/styles/theme/ocean-blue/button.scss +2 -2
  102. package/src/styles/theme/ocean-blue/index.scss +1 -1
  103. package/src/styles/theme/ocean-blue/ocean-blue.scss +1 -1
  104. package/src/styles/theme/ocean-blue/sidebar.scss +10 -0
  105. package/src/styles/theme/ocean-blue/table.scss +7 -52
  106. package/src/utils/auth.js +23 -3
  107. package/src/utils/calculator/calculator-factory.js +4 -4
  108. package/src/utils/calculator/calculator-util.js +14 -0
  109. package/src/utils/common-util.js +270 -124
  110. package/src/utils/i18n-util.js +145 -0
  111. package/src/utils/jump-page-utils.js +245 -314
  112. package/src/utils/permission.js +7 -1
  113. package/src/utils/permissionAuth.js +155 -37
  114. package/src/utils/request.js +10 -11
  115. package/src/utils/util.js +154 -205
  116. package/src/views/layout/EmptyLayout.vue +1 -1
  117. package/src/views/layout/components/Menubar/Item.vue +27 -4
  118. package/src/views/layout/components/Menubar/SidebarItem.vue +7 -3
  119. package/src/views/layout/components/Menubar/index.vue +14 -2
  120. package/src/views/layout/tab-content-index.vue +1 -1
@@ -338,11 +338,32 @@ function exportListData(
338
338
  exportOptions.pageContext.canClick = true
339
339
  }
340
340
  if (isAsync) {
341
+ const message = getI18n().t('imatrixUIMessage.asyncExport')
342
+ const exportPageUrl = getDcExportPageUrl()
343
+ let vnode
344
+ if (exportPageUrl) {
345
+ vnode = '<p><span>' + message + '</span>'
346
+ // 请点击进行权限申请
347
+ const asyncExportJumpMsg = getI18n().t('imatrixUIMessage.asyncExportJumpMsg')
348
+ vnode += '<a href="#" style="color: #1800ff;font-weight: bold;text-decoration:underline" onclick="window.open(\'' + exportPageUrl + '\')">' + asyncExportJumpMsg + '</a>'
349
+ vnode += '</p>'
350
+ }
351
+ if (vnode) {
341
352
  Message({
342
- message: getI18n().t('imatrixUIMessage.asyncExport'),
353
+ showClose: true,
354
+ dangerouslyUseHTMLString: true,
355
+ message: vnode,
343
356
  type: 'success',
357
+ duration: 10 * 1000
358
+ })
359
+ } else {
360
+ Message({
344
361
  showClose: true,
362
+ message: message,
363
+ type: 'success',
364
+ duration: 5 * 1000
345
365
  })
366
+ }
346
367
  localStorage.setItem(uuid, 'ok')
347
368
  } else {
348
369
  if (data.indexOf('~~') >= 0) {
@@ -375,6 +396,18 @@ function exportListData(
375
396
  }
376
397
  })
377
398
  }
399
+ // 获得文件中心/导出任务菜单的路由地址
400
+ function getDcExportPageUrl() {
401
+ let exportPageUrl
402
+ const baseAPI = window.$vueApp.config.globalProperties.baseAPI
403
+ if (baseAPI) {
404
+ // 获得平台的域名和端口
405
+ const baseUrls = baseAPI.split('/')
406
+ const baseUrlPrefix = baseUrls[0] + '//' + baseUrls[2]
407
+ exportPageUrl = baseUrlPrefix + '/document-center/#/file-task/file-export-task/list'
408
+ }
409
+ return exportPageUrl
410
+ }
378
411
  /**
379
412
  * 根据uuid获取导出情况
380
413
  * @param {*} uuid
@@ -40,6 +40,19 @@
40
40
  >
41
41
  <div :id="fullscreenViewerId"/>
42
42
  </el-dialog>
43
+ <!--<el-image-->
44
+ <!-- ref="preview"-->
45
+ <!-- :src="imgList[0]"-->
46
+ <!-- :preview-src-list="imgList"-->
47
+ <!-- style="display: none"-->
48
+ <!--/>-->
49
+ <el-image-viewer
50
+ v-if="isLightBoxVisible"
51
+ hide-on-click-modal
52
+ :initial-index="0"
53
+ :url-list="imgList"
54
+ :on-close="() =>{isLightBoxVisible = false}"
55
+ />
43
56
  </div>
44
57
  </template>
45
58
 
@@ -92,11 +105,13 @@ import 'tinymce/plugins/visualchars' //
92
105
  import 'tinymce/plugins/wordcount' // 数字统计
93
106
  import 'tinymce/skins/ui/oxide/skin.css' // 编辑器皮肤样式
94
107
  import './tinymce/zh_CN.js'
108
+ import {ElImageViewer} from 'element-plus'
95
109
 
96
110
  export default {
97
111
  name: 'RichEditor',
98
112
  components: {
99
113
  Editor,
114
+ ElImageViewer
100
115
  },
101
116
  props: {
102
117
  entity: {
@@ -188,6 +203,18 @@ export default {
188
203
  }
189
204
  return url
190
205
  },
206
+ setup: (editor) => {
207
+ editor.on('click', (e) => {
208
+ const targetNode = e.target.nodeName
209
+ if (targetNode === 'IMG') {
210
+ // 这里可以实现自定义的图片预览逻辑
211
+ const imgSrc = e.target.src
212
+ this.imgList = []
213
+ this.imgList.push(imgSrc)
214
+ this.isLightBoxVisible = true
215
+ }
216
+ })
217
+ },
191
218
  images_upload_handler: (blobInfo, success, failure, progress) => {
192
219
  let file
193
220
  if (blobInfo.blob() instanceof File) {
@@ -223,6 +250,8 @@ export default {
223
250
  dialogVisible: false,
224
251
  fullscreenViewerId: 'editor_viewer_' + new Date().getTime(),
225
252
  ImageComponent: null,
253
+ imgList: [],
254
+ isLightBoxVisible: false
226
255
  }
227
256
  },
228
257
  watch: {
@@ -0,0 +1,7 @@
1
+ import RowForm from './index.vue'
2
+
3
+ RowForm.install = function (Vue) {
4
+ Vue.component(RowForm.name, RowForm)
5
+ }
6
+
7
+ export default RowForm
@@ -0,0 +1,211 @@
1
+ <template>
2
+ <el-drawer
3
+ v-model="isShowForm"
4
+ :close-on-click-modal="false"
5
+ :close-on-press-escape="false"
6
+ direction="btt"
7
+ size="100%"
8
+ @close="closeForm()"
9
+ >
10
+ <template #header>
11
+ <div style="text-align: center">
12
+ {{ $t('superGrid.recordLine', { row: realEditIndex + 1 }) }}
13
+ </div>
14
+ </template>
15
+ <template #default>
16
+ <el-form label-width="auto">
17
+ <template v-for="(column, index) in columns" >
18
+ <el-form-item :key="index" v-if="column.prop != '$index' && column.prop != '$selection' && column.prop != 'operation'" :label="getMyHeaderLable(column)" >
19
+ <NormalColumnContent
20
+ :ref="column.prop"
21
+ :is-sql="isSql"
22
+ :column="column"
23
+ :list-code="listCode"
24
+ :drag-column-prop="dragColumnProp"
25
+ :right-click-menu-arr="options.rightClickMenuArr"
26
+ :table-name="tableName"
27
+ :page-code="pageCode"
28
+ :list-toolbar-form-data="listToolbarFormData"
29
+ :list-name="listName"
30
+ :options="options"
31
+ :current-page="currentPage"
32
+ :grid-data="gridData"
33
+ :page-grid-data="pageGridData"
34
+ :row="gridData[realEditIndex]"
35
+ :row-index="realEditIndex"
36
+ :is-show-form="true"
37
+ @open-page="openPageEvent"
38
+ @refresData="refresData"
39
+ @refresh-list="refreshList"
40
+ @refresPortData="refresPortData"
41
+ @refresPortsData="refresPortsData"
42
+ @refresMainTableFields="refresMainTableFields"
43
+ @prohibitToEdit="prohibitToEdit"
44
+ />
45
+ </el-form-item>
46
+ </template>
47
+
48
+ </el-form>
49
+ <el-button v-if="realEditIndex !== 0" type="primary" link @click="prevRow">
50
+ {{ $t('superGrid.prevRow') }}
51
+ </el-button>
52
+ <el-button v-if="realEditIndex !== gridData.length - 1" type="primary" link @click="nextRow">
53
+ {{ $t('superGrid.nextRow') }}
54
+ </el-button>
55
+ </template>
56
+ </el-drawer>
57
+ </template>
58
+ <script lang="ts">
59
+ export default {
60
+ name: 'RowForm'
61
+ }
62
+ </script>
63
+ <script setup lang="ts">
64
+ import NormalColumnContent from '../super-grid/src/normal-column-content.vue'
65
+ import {
66
+ getHeaderLable
67
+ } from '../super-grid/src/utils'
68
+ import { reactive, ref, onMounted, defineEmits, nextTick } from 'vue'
69
+ const props = defineProps<{
70
+ columns: {
71
+ type: Array<any>
72
+ default: null
73
+ }
74
+ listCode: {
75
+ type: String
76
+ default: null
77
+ }
78
+ isSql: {
79
+ type: Boolean
80
+ default: false
81
+ }
82
+ dragColumnProp: {
83
+ type: String
84
+ default: null
85
+ }
86
+ tableName: {
87
+ type: String
88
+ default: null
89
+ }
90
+ pageCode: {
91
+ type: String
92
+ default: null
93
+ }
94
+ listName: {
95
+ type: String
96
+ default: null
97
+ }
98
+ currentPage: {
99
+ type: Number
100
+ default: 1
101
+ }
102
+ gridData: {
103
+ type: Array<any>
104
+ default: null
105
+ }
106
+ pageGridData: {
107
+ type: Array<any>
108
+ default: null
109
+ }
110
+ listToolbarFormData: {
111
+ type: Object
112
+ default: null
113
+ }
114
+ // 行记录序号
115
+ rowIndex: {
116
+ type: Number
117
+ default: 0
118
+ }
119
+ options: {
120
+ type: Object
121
+ default: null
122
+ }
123
+ lineEdit: {
124
+ type: Object
125
+ default: null
126
+ }
127
+ }>()
128
+ const emits = defineEmits([
129
+ 'open-page',
130
+ 'close',
131
+ 'prohibitToEdit',
132
+ 'refresData',
133
+ 'refresPortData',
134
+ 'refresPortsData',
135
+ 'refresMainTableFields'
136
+ ])
137
+ const realEditIndex: any = ref(props.rowIndex)
138
+ const isShowForm = ref(true)
139
+ const reload = ref(true)
140
+ function getMyHeaderLable(column) {
141
+ return getHeaderLable(column)
142
+ }
143
+ function prevRow() {
144
+ reload.value = false
145
+ --realEditIndex.value
146
+ nextTick(() => {
147
+ reload.value = true
148
+ })
149
+ console.log(realEditIndex.value)
150
+ }
151
+ function nextRow() {
152
+ reload.value = false
153
+ ++realEditIndex.value
154
+ nextTick(() => {
155
+ reload.value = true
156
+ })
157
+ console.log(realEditIndex.value)
158
+ }
159
+ function isShowColumn(column) {
160
+ let hidden = true
161
+ if (column && column) {
162
+ if (column.prop === '$index') {
163
+ hidden = false
164
+ } else if (column.prop === 'operation') {
165
+ hidden = false
166
+ } else if (column.prop === '$detail') {
167
+ hidden = false
168
+ } else if (!column.show) {
169
+ hidden = false
170
+ } else if (column.formatter && column.formatter.type === 'hyperlinks') {
171
+ hidden = false
172
+ }
173
+ }
174
+ return hidden
175
+ }
176
+
177
+ function closeForm() {
178
+ isShowForm.value = false
179
+ emits('close')
180
+ }
181
+
182
+ function openPageEvent(openPageParams) {
183
+ emits('open-page', openPageParams)
184
+ }
185
+
186
+ // 设置字段禁止编辑
187
+ function prohibitToEdit(entity) {
188
+ emits('prohibitToEdit', entity)
189
+ }
190
+
191
+ function refresData(data) {
192
+ emits('refresData', data)
193
+ }
194
+ function refresPortData(port, value) {
195
+ if (props && props.lineEdit && props.lineEdit.editingCell) {
196
+ emits('refresPortData', port, value, props.lineEdit.editingCell.row)
197
+ } else {
198
+ emits('refresPortData', port, value, this.index)
199
+ }
200
+ }
201
+ function refresPortsData(map) {
202
+ if (props && props.lineEdit && props.lineEdit.editingCell) {
203
+ emits('refresPortsData', map, props.lineEdit.editingCell.row)
204
+ } else {
205
+ emits('refresPortsData', map, this.index)
206
+ }
207
+ }
208
+ function refresMainTableFields(map) {
209
+ emits('refresMainTableFields', map)
210
+ }
211
+ </script>
@@ -13,120 +13,152 @@
13
13
  @input="input"
14
14
  @clear="clear"
15
15
  >
16
- <template v-slot:append>
17
- <el-button
18
- v-if="isMobile"
19
- :icon="ElIconFullScreen"
20
- @click="openVideo"
21
- />
16
+ <template v-if="isShowScanIcon" v-slot:append>
17
+ <SuperIcon iconValue="fa-barcode" @click="scanClick()"></SuperIcon>
22
18
  </template>
23
19
  <!-- <el-button slot="append" icon="el-icon-full-screen" @click="openVideo" /> -->
24
20
  </el-input>
25
- <scan-code-input-colse
26
- v-if="isShow"
27
- :colse-video="colseVideo"
28
- @close="closeVideo"
29
- />
21
+ <scan-code-input-browser v-if="isShow" :colse-video="colseVideo" @close="closeBrowserScan" />
30
22
  </div>
31
23
  </template>
32
24
 
33
25
  <script type="text/ecmascript-6">
34
- import { FullScreen as ElIconFullScreen } from '@element-plus/icons-vue'
35
- import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer';
36
- import scanCodeInputColse from './scan-code-input-colse.vue'
26
+ import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
27
+ import scanCodeInputBrowser from '../../scan-code-input-browser/src/scan-code-input.vue'
37
28
  import events from './events'
29
+ import { isMobileBrowser } from '../../../src/utils/common-util'
38
30
  export default {
39
- data() {
40
-
41
- return {
42
- isMobile: false,
43
- isShow: false,
44
- scanCode: '',
45
- ElIconFullScreen,
31
+ data() {
32
+ const isMobile = isMobileBrowser()
33
+ let userAgent
34
+ const userAgentOrg = navigator.userAgent
35
+ if (userAgentOrg.indexOf(' uni-app ') > 0) {
36
+ // 表示uni-app中访问的
37
+ userAgent = 'app'
38
+ } else {
39
+ // 表示手机浏览器访问的
40
+ userAgent = 'browser'
41
+ }
42
+ console.log('scanCodeInputBrowser----window.location.protocol---', window.location.protocol)
43
+ const isShowScanIcon = isMobile && window.location.protocol === 'https:' ? true: false
44
+ const isApk = isMobile && userAgent && userAgent === 'app' ? true: false
45
+ return {
46
+ isMobile,
47
+ isShow: false,
48
+ scanCode: '',
49
+ isShowScanIcon,
50
+ isApk
51
+ }
52
+ },
53
+ name: 'ScanCodeInput',
54
+ components: {
55
+ scanCodeInputBrowser
56
+ },
57
+ model: {
58
+ prop: 'value',
59
+ event: 'input'
60
+ },
61
+ props: {
62
+ colseVideo: {
63
+ type: Boolean,
64
+ default: false
65
+ },
66
+ value: {
67
+ type: String,
68
+ default: null
69
+ },
70
+ disable: {
71
+ type: Boolean,
72
+ default: false
73
+ },
74
+ placeholder: {
75
+ type: String,
76
+ default: null
77
+ },
78
+ clearable: {
79
+ type: Boolean,
80
+ default: null
81
+ },
82
+ readonly: {
83
+ type: Boolean,
84
+ default: false
85
+ },
86
+ maxlength: {
87
+ type: Number,
88
+ default: null
89
+ },
90
+ // 组件id,页面内要唯一
91
+ componentId: {
92
+ type: String,
93
+ default: null
94
+ },
95
+ // 列表中使用该组件,需要传该参数
96
+ listCode: {
97
+ type: String,
98
+ default: null
99
+ }
100
+ },
101
+ watch: {
102
+ value: {
103
+ deep: true,
104
+ handler(val) {
105
+ this.scanCode = this.value
106
+ }
107
+ }
108
+ },
109
+ created() {
110
+ // this.tipShow = true
111
+ this.scanCode = this.value
112
+ },
113
+ beforeUnmount() {},
114
+ methods: {
115
+ ...events,
116
+ // equipment() {
117
+ // const flag = navigator.userAgent.match(
118
+ // /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
119
+ // )
120
+ // if (flag) {
121
+ // return flag
122
+ // } else {
123
+ // try {
124
+ // document.createEvent('TouchEvent')
125
+ // return true
126
+ // } catch (e) {
127
+ // return false
128
+ // }
129
+ // }
130
+ // },
131
+ openVideo() {
132
+ if (this.isShow) {
133
+ this.isShow = false
134
+ } else {
135
+ this.isShow = true
46
136
  }
47
137
  },
48
- name: 'ScanCodeInput',
49
- components: {
50
- scanCodeInputColse
51
- },
52
- model: {
53
- prop: 'value',
54
- event: 'input'
55
- },
56
- props: {
57
- colseVideo: {
58
- type: Boolean,
59
- default: false
60
- },
61
- value: {
62
- type: String,
63
- default: null
64
- },
65
- disable: {
66
- type: Boolean,
67
- default: false
68
- },
69
- placeholder: {
70
- type: String,
71
- default: null
72
- },
73
- clearable: {
74
- type: Boolean,
75
- default: null
76
- },
77
- readonly: {
78
- type: Boolean,
79
- default: false
80
- },
81
- maxlength: {
82
- type: Number,
83
- default: null
84
- }
85
- },
86
- watch: {
87
- value: {
88
- deep: true,
89
- handler(val) {
90
- this.scanCode = this.value
91
- }
92
- }
93
- },
94
- created() {
95
- // this.tipShow = true
96
- this.isMobile = this.equipment()
97
- this.scanCode = this.value
98
- },
99
- beforeUnmount() {
100
-
101
- },
102
- methods: {
103
- ...events,
104
- equipment() {
105
- const flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
106
- if (flag) {
107
- return flag
108
- } else {
109
- try {
110
- document.createEvent('TouchEvent')
111
- return true
112
- } catch (e) {
113
- return false
114
- }
115
- }
116
- },
117
- openVideo() {
118
- if (this.isShow) {
119
- this.isShow = false
120
- } else {
121
- this.isShow = true
122
- }
123
- },
124
- closeVideo(value) {
125
- this.isShow = false
126
- this.value = value
127
- $emit(this, "colse",value)
128
- }
129
- },
130
- emits:['colse','update:value',]
138
+ closeBrowserScan(value) {
139
+ this.isShow = false
140
+ this.value = value
141
+ $emit(this, 'colse', value)
142
+ },
143
+ scanClick(){
144
+ if(!this.isApk){
145
+ // 表示是移动端浏览器
146
+ this.openVideo()
147
+ } else {
148
+ // 表示是移动端apk
149
+ this.scanClickApk()
150
+ }
151
+ },
152
+ scanClickApk() {
153
+ // 表示是APK中
154
+ const message = {
155
+ type: 'scan',
156
+ componentId: this.componentId,
157
+ listCode: this.listCode
158
+ }
159
+ window.parent.postMessage(JSON.stringify(message), '*')
160
+ }
161
+ },
162
+ emits: ['colse', 'update:value']
131
163
  }
132
164
  </script>
@@ -0,0 +1,6 @@
1
+ import ScanCodeInputBrowser from './src/scan-code-input.vue'
2
+ ScanCodeInputBrowser.install = function (Vue) {
3
+ Vue.component(ScanCodeInputBrowser.name, ScanCodeInputBrowser)
4
+ }
5
+
6
+ export default ScanCodeInputBrowser
@@ -18,7 +18,7 @@
18
18
  import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer';
19
19
  import { BrowserMultiFormatReader } from '@zxing/library'
20
20
 
21
- export default {name: 'ScanCodeInputColse',
21
+ export default {name: 'ScanCodeInputBrowser',
22
22
  components: {},
23
23
  props: {
24
24
  colseVideo: {
@@ -69,33 +69,6 @@ methods: {
69
69
  console.error(err)
70
70
  })
71
71
  },
72
- async openScanTwo() {
73
- const that = this
74
- // codeReader.reset() // 重置
75
- // that.textContent = null // 重置
76
- that.codeReader = await new BrowserMultiFormatReader()
77
- that.codeReader.listVideoInputDevices().then((videoInputDevices) => {
78
- that.tipShow = true
79
- that.tipMsg = this.$t('messageVideo.callingRearCamera')
80
- console.log('videoInputDevices', videoInputDevices)
81
- // 默认获取第一个摄像头设备id
82
- let firstDeviceId = videoInputDevices[0].deviceId
83
- // 获取第一个摄像头设备的名称
84
- const videoInputDeviceslablestr = JSON.stringify(videoInputDevices[0].label)
85
- if (videoInputDevices.length > 1) {
86
- // 判断是否后置摄像头
87
- if (videoInputDeviceslablestr.indexOf('back') > -1) {
88
- firstDeviceId = videoInputDevices[0].deviceId
89
- } else {
90
- firstDeviceId = videoInputDevices[1].deviceId
91
- }
92
- }
93
- that.decodeFromInputVideoFunc(firstDeviceId)
94
- }).catch((err) => {
95
- that.tipShow = false
96
- console.error(err)
97
- })
98
- },
99
72
  decodeFromInputVideoFunc(firstDeviceId) {
100
73
  const that = this
101
74
  that.codeReader.reset() // 重置
@@ -31,7 +31,7 @@ export default {
31
31
  default: null,
32
32
  },
33
33
  value: {
34
- type: String,
34
+ type: [String, Number],
35
35
  default: null,
36
36
  },
37
37
  tableName: {
@@ -79,7 +79,7 @@ export default {
79
79
  pageCode: this.pageCode,
80
80
  fieldName: this.prop,
81
81
  fieldCnName: this.fieldLabel,
82
- ciphertext: this.value,
82
+ ciphertext: this.value ? this.value + '' : null
83
83
  }
84
84
  if (this.entity) {
85
85
  params.dataId = this.entity.ID ? this.entity.ID : this.entity.id