agilebuilder-ui 1.0.76 → 1.0.77
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/lib/super-ui.css +1 -1
- package/lib/super-ui.js +80258 -78821
- package/lib/super-ui.umd.cjs +103 -103
- package/package.json +1 -1
- package/packages/department-tree/src/department-tree.vue +0 -1
- package/packages/department-tree-mobile/src/department-tree-inline-app.vue +15 -15
- package/packages/department-user-tree/src/department-user-tree.vue +1 -0
- package/packages/department-user-tree-mobile/src/department-user-tree-inline-app.vue +17 -19
- package/packages/department-user-tree-mobile/src/department-user-tree-service.ts +0 -11
- package/packages/dynamic-source-select/src/dynamic-source-select.vue +5 -5
- package/packages/fs-upload-list/src/fs-upload-list.vue +179 -119
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-app.vue +2 -6
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-browser.vue +2 -6
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-component.vue +2 -2
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-input.vue +1 -6
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload.vue +0 -6
- package/packages/fs-upload-new/src/fs-upload-new.vue +15 -13
- package/packages/index.js +8 -2
- package/packages/organization-input/src/organization-input.vue +3 -0
- package/packages/plugins/export-data-new.js +34 -1
- package/packages/scan-code-input/src/scan-code-input.vue +136 -104
- package/packages/scan-code-input-browser/index.js +6 -0
- package/packages/{scan-code-input/src/scan-code-input-colse.vue → scan-code-input-browser/src/scan-code-input.vue} +1 -28
- package/packages/super-grid/src/apis.js +12 -0
- package/packages/super-grid/src/dynamic-input.vue +236 -14
- package/packages/super-grid/src/normal-column.vue +37 -2
- package/packages/super-grid/src/scan-util.ts +243 -0
- package/packages/super-grid/src/search-form-advancedQuery.vue +3 -1
- package/packages/super-grid/src/search-form-item.vue +4 -2
- package/packages/super-grid/src/super-grid-service.js +2 -1
- package/packages/super-grid/src/super-grid.vue +19 -0
- package/packages/super-grid/src/utils.js +9 -0
- package/packages/workgroup-tree/src/workgroup-tree.vue +31 -0
- package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +28 -0
- package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +26 -0
- package/packages/workgroup-tree-mobile/index.js +6 -0
- package/packages/workgroup-tree-mobile/src/dept-result.vue +51 -0
- package/packages/workgroup-tree-mobile/src/workgroup-tree-app.vue +120 -0
- package/packages/workgroup-tree-mobile/src/workgroup-tree-inline-app.vue +375 -0
- package/packages/workgroup-tree-mobile/src/workgroup-tree-service.ts +62 -0
- package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +15 -0
- package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +27 -0
- package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +11 -0
- package/packages/workgroup-user-tree-mobile/index.js +6 -0
- package/packages/workgroup-user-tree-mobile/src/dept-path.vue +36 -0
- package/packages/workgroup-user-tree-mobile/src/dept-result.vue +58 -0
- package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-app.vue +119 -0
- package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-inline-app.vue +394 -0
- package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-service.ts +41 -0
- package/src/i18n/langs/cn.js +3 -1
- package/src/i18n/langs/en.js +3 -1
- package/src/utils/common-util.js +18 -2
- package/src/views/layout/EmptyLayout.vue +1 -44
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
:entity="row"
|
|
11
11
|
:grid-data="gridData"
|
|
12
12
|
:page-grid-data="pageGridData"
|
|
13
|
+
:additional-settings="controlConfig"
|
|
13
14
|
:parent="parentFormData"
|
|
14
15
|
:prop="column.prop"
|
|
15
16
|
:row="row"
|
|
@@ -17,6 +18,8 @@
|
|
|
17
18
|
:select-options="options"
|
|
18
19
|
:value="innerValue"
|
|
19
20
|
:additional-param-map="additionalParamMap"
|
|
21
|
+
:listCode="listCode"
|
|
22
|
+
:component-id="componentId"
|
|
20
23
|
@change="cellEvent('change', $event)"
|
|
21
24
|
@input="cellEvent('input', $event)"
|
|
22
25
|
/>
|
|
@@ -151,7 +154,17 @@
|
|
|
151
154
|
@clear="cellEvent('clear', $event)"
|
|
152
155
|
@focus="cellEvent('focus', $event)"
|
|
153
156
|
@input="cellEvent('input', $event, true)"
|
|
154
|
-
|
|
157
|
+
>
|
|
158
|
+
<template
|
|
159
|
+
v-if="isShowScanIcon"
|
|
160
|
+
#append
|
|
161
|
+
>
|
|
162
|
+
<SuperIcon
|
|
163
|
+
iconValue="fa-barcode"
|
|
164
|
+
@click="scanClick()"
|
|
165
|
+
></SuperIcon>
|
|
166
|
+
</template>
|
|
167
|
+
</el-input>
|
|
155
168
|
|
|
156
169
|
<el-input
|
|
157
170
|
v-else-if="type === 'textarea'"
|
|
@@ -173,6 +186,7 @@
|
|
|
173
186
|
/>
|
|
174
187
|
<fs-upload-list
|
|
175
188
|
v-else-if="type === 'annex'"
|
|
189
|
+
ref="fileUploadRef"
|
|
176
190
|
:custom-view-url="true"
|
|
177
191
|
:disabled="disabled"
|
|
178
192
|
:file-info="fileInfo"
|
|
@@ -181,6 +195,9 @@
|
|
|
181
195
|
:is-sql="isSql"
|
|
182
196
|
:row="row"
|
|
183
197
|
:value="innerValue"
|
|
198
|
+
:page-context="pageContext"
|
|
199
|
+
:list-code="listCode"
|
|
200
|
+
:componentId="componentId"
|
|
184
201
|
@delete="deleteFile"
|
|
185
202
|
@delete-success="deleteSuccess"
|
|
186
203
|
@upload-success="uploadOnSuccess"
|
|
@@ -405,6 +422,7 @@
|
|
|
405
422
|
@close="showSingleImgFlag = false"
|
|
406
423
|
@delete="deleteFile"
|
|
407
424
|
/>
|
|
425
|
+
<scan-code-input-browser v-if="isShowBrowserScan" @close="closeBrowserScan" />
|
|
408
426
|
</div>
|
|
409
427
|
</template>
|
|
410
428
|
<script>
|
|
@@ -416,7 +434,8 @@ import {
|
|
|
416
434
|
isDisableEdit,
|
|
417
435
|
isDynamicDataSourceSource,
|
|
418
436
|
isEditOptionFunction,
|
|
419
|
-
otherFilesToStandard
|
|
437
|
+
otherFilesToStandard,
|
|
438
|
+
getControlConfig
|
|
420
439
|
} from './utils'
|
|
421
440
|
import dynamicSourceSelect from '../../dynamic-source-select/src/dynamic-source-select.vue'
|
|
422
441
|
import { getEntityFieldValue, setEntityFieldValue } from '../../../src/utils/util'
|
|
@@ -425,6 +444,8 @@ import apis from './apis'
|
|
|
425
444
|
import ViewImageDialog from './view-image-dialog'
|
|
426
445
|
import { $emit } from '../../utils/gogocodeTransfer'
|
|
427
446
|
import eventBus from './eventBus'
|
|
447
|
+
import { isMobileBrowser } from '../../../src/utils/common-util'
|
|
448
|
+
import { analysisScanValue, setScanAnalysisValue } from './scan-util.ts'
|
|
428
449
|
|
|
429
450
|
export default {
|
|
430
451
|
name: 'DynamicInput',
|
|
@@ -530,6 +551,26 @@ export default {
|
|
|
530
551
|
controlConfig = JSON.parse(this.column.controlConfig)
|
|
531
552
|
}
|
|
532
553
|
const additionalParamMap = getAdditionalParamMap(gridParams)
|
|
554
|
+
const pageContext = gridParams.options.pageContext
|
|
555
|
+
const isMobile = isMobileBrowser()
|
|
556
|
+
|
|
557
|
+
const componentId = this.listCode+'_'+this.column.prop
|
|
558
|
+
let scanEnable = false
|
|
559
|
+
if(controlConfig.scanEnable){
|
|
560
|
+
scanEnable = true
|
|
561
|
+
}
|
|
562
|
+
let userAgent
|
|
563
|
+
const userAgentOrg = navigator.userAgent
|
|
564
|
+
if (userAgentOrg.indexOf(' uni-app ') > 0) {
|
|
565
|
+
// 表示uni-app中访问的
|
|
566
|
+
userAgent = 'app'
|
|
567
|
+
} else {
|
|
568
|
+
// 表示手机浏览器访问的
|
|
569
|
+
userAgent = 'browser'
|
|
570
|
+
}
|
|
571
|
+
console.log('superGrid----window.location.protocol---', window.location.protocol)
|
|
572
|
+
const isShowScanIcon = isMobile && window.location.protocol === 'https:' ? true: false
|
|
573
|
+
const isApk = isMobile && userAgent && userAgent === 'app' ? true: false
|
|
533
574
|
return {
|
|
534
575
|
deptManTree: false, // 是否是部门人员树
|
|
535
576
|
isMultiTree: false, // 是否是多选树
|
|
@@ -566,7 +607,7 @@ export default {
|
|
|
566
607
|
gridData: isSubTableShowPage ? subTableData : gridData,
|
|
567
608
|
pageGridData: isSubTableShowPage ? gridData : null,
|
|
568
609
|
additionalParamMap,
|
|
569
|
-
controlConfig,
|
|
610
|
+
controlConfig: getControlConfig(this.column),
|
|
570
611
|
// 设置日期选择器选择范围
|
|
571
612
|
pickerOptions: {
|
|
572
613
|
disabledDate: (time) => {
|
|
@@ -582,7 +623,15 @@ export default {
|
|
|
582
623
|
}
|
|
583
624
|
},
|
|
584
625
|
stateForbiddenTime: null,
|
|
585
|
-
endForbiddenTime: null
|
|
626
|
+
endForbiddenTime: null,
|
|
627
|
+
pageContext,
|
|
628
|
+
isMobile,
|
|
629
|
+
componentId,
|
|
630
|
+
scanEnable,
|
|
631
|
+
userAgent,
|
|
632
|
+
isApk,
|
|
633
|
+
isShowBrowserScan: false,
|
|
634
|
+
isShowScanIcon
|
|
586
635
|
}
|
|
587
636
|
},
|
|
588
637
|
computed: {},
|
|
@@ -694,6 +743,33 @@ export default {
|
|
|
694
743
|
// immediate: true,
|
|
695
744
|
// deep: true
|
|
696
745
|
// })
|
|
746
|
+
const that = this
|
|
747
|
+
// 选择文件结束
|
|
748
|
+
eventBus.$on(this.componentId + '-pickFileDone', (data) => {
|
|
749
|
+
console.log('superPage666611---pickFileDone--data.componentId=', data.componentId, 'data.listCode=', data.listCode, 'data=', data)
|
|
750
|
+
if (that.$refs.fileUploadRef) {
|
|
751
|
+
that.$refs.fileUploadRef.pickFileDone(data)
|
|
752
|
+
}
|
|
753
|
+
})
|
|
754
|
+
// 上传文件结束
|
|
755
|
+
eventBus.$on(this.componentId + '-uploadFileDone', (data) => {
|
|
756
|
+
if (that.$refs.fileUploadRef) {
|
|
757
|
+
that.$refs.fileUploadRef.uploadFileDone(data)
|
|
758
|
+
}
|
|
759
|
+
})
|
|
760
|
+
// 扫描结束
|
|
761
|
+
eventBus.$on(this.componentId + '-scanDone', (data) => {
|
|
762
|
+
console.log('superPage666611---scanDone--data.componentId=', data.componentId, 'data.listCode=', data.listCode, 'data=', data)
|
|
763
|
+
that.innerValue = data.result
|
|
764
|
+
that.blurEvent()
|
|
765
|
+
})
|
|
766
|
+
},
|
|
767
|
+
destroyed(){
|
|
768
|
+
eventBus.$off(this.componentId + '-pickFileDone')
|
|
769
|
+
// 上传文件结束
|
|
770
|
+
eventBus.$off(this.componentId + '-uploadFileDone')
|
|
771
|
+
// 扫描结束
|
|
772
|
+
eventBus.$off(this.componentId + '-scanDone')
|
|
697
773
|
},
|
|
698
774
|
methods: {
|
|
699
775
|
/**
|
|
@@ -938,6 +1014,8 @@ export default {
|
|
|
938
1014
|
}
|
|
939
1015
|
// 必须这样调用input事件 ,否则组件无法输入值
|
|
940
1016
|
$emit(this, 'update:value', this.innerValue) // 现在的用法
|
|
1017
|
+
// 扫描组件时监控值变化
|
|
1018
|
+
this.watchScanValueChange(this.innerValue)
|
|
941
1019
|
},
|
|
942
1020
|
// 是否是输入框
|
|
943
1021
|
isInputControl() {
|
|
@@ -1038,18 +1116,38 @@ export default {
|
|
|
1038
1116
|
},
|
|
1039
1117
|
// 上传成功
|
|
1040
1118
|
uploadOnSuccess(response) {
|
|
1119
|
+
console.log('superGrid---uploadOnSuccess----response=', response)
|
|
1041
1120
|
if (response) {
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
this.
|
|
1049
|
-
|
|
1050
|
-
|
|
1121
|
+
if(this.isMobile){
|
|
1122
|
+
// 移动端时事件
|
|
1123
|
+
if (this.column.fileSet && this.column.fileSet !== '') {
|
|
1124
|
+
const fileSetObj = JSON.parse(this.column.fileSet)
|
|
1125
|
+
if (fileSetObj) {
|
|
1126
|
+
// 判断单选还是多选
|
|
1127
|
+
if (this.fileMultiple) {
|
|
1128
|
+
this.multiStorageMobile(fileSetObj, response)
|
|
1129
|
+
} else {
|
|
1130
|
+
const fileObj = response[0]
|
|
1131
|
+
const responseFile = { name: fileObj.showName, serverPath: fileObj.serverPath }
|
|
1132
|
+
this.radioStorageFile(fileSetObj, responseFile)
|
|
1133
|
+
}
|
|
1134
|
+
this.fileList = getFileList(this.row, this.column, this.isSql)
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
} else {
|
|
1138
|
+
// PC端
|
|
1139
|
+
const responseFile = { name: response.showName, serverPath: response.serverPath }
|
|
1140
|
+
if (this.column.fileSet && this.column.fileSet !== '') {
|
|
1141
|
+
const fileSetObj = JSON.parse(this.column.fileSet)
|
|
1142
|
+
if (fileSetObj) {
|
|
1143
|
+
// 判断单选还是多选
|
|
1144
|
+
if (this.fileMultiple) {
|
|
1145
|
+
this.multiStorage(fileSetObj, responseFile)
|
|
1146
|
+
} else {
|
|
1147
|
+
this.radioStorageFile(fileSetObj, responseFile)
|
|
1148
|
+
}
|
|
1149
|
+
this.fileList = getFileList(this.row, this.column, this.isSql)
|
|
1051
1150
|
}
|
|
1052
|
-
this.fileList = getFileList(this.row, this.column, this.isSql)
|
|
1053
1151
|
}
|
|
1054
1152
|
}
|
|
1055
1153
|
}
|
|
@@ -1175,6 +1273,98 @@ export default {
|
|
|
1175
1273
|
}
|
|
1176
1274
|
this.packageFileNameWithFileList()
|
|
1177
1275
|
},
|
|
1276
|
+
// 多选上传完成后存储 移动端时
|
|
1277
|
+
multiStorageMobile(fileSetObj, responseFiles) {
|
|
1278
|
+
console.log('superGrid---multiStorageMobile----responseFiles=', responseFiles, 'fileSetObj=', fileSetObj)
|
|
1279
|
+
const keyValueParam = analysisFileSetObj(fileSetObj, this.isSql)
|
|
1280
|
+
// 存储
|
|
1281
|
+
// 判断主表拼接还是子表保存
|
|
1282
|
+
if (fileSetObj.childAnnexDataTableCode) {
|
|
1283
|
+
// 存储子表
|
|
1284
|
+
// const lowerStr = fileSetObj.childAnnexDataTableCode.toLowerCase()
|
|
1285
|
+
let fileArr = this.row[this.column.prop]
|
|
1286
|
+
if (!fileArr) {
|
|
1287
|
+
fileArr = []
|
|
1288
|
+
}
|
|
1289
|
+
responseFiles.forEach(responseFile=>{
|
|
1290
|
+
const fileObj = this.responseFileToFileObj(fileSetObj, responseFile)
|
|
1291
|
+
fileArr.push(fileObj)
|
|
1292
|
+
})
|
|
1293
|
+
this.fileList = otherFilesToStandard(fileSetObj, keyValueParam, fileArr, null)
|
|
1294
|
+
this.setCellValue(this.column.prop, fileArr, 'input')
|
|
1295
|
+
} else {
|
|
1296
|
+
let showNameStr = ''
|
|
1297
|
+
let pathNameStr = ''
|
|
1298
|
+
// 存储主表
|
|
1299
|
+
if (fileSetObj.showNameData) {
|
|
1300
|
+
if (this.isSql) {
|
|
1301
|
+
if (fileSetObj.showNameData.dbName) {
|
|
1302
|
+
if (this.row) {
|
|
1303
|
+
let showName = ''
|
|
1304
|
+
responseFiles.forEach(responseFile=>{
|
|
1305
|
+
showName = showName + responseFile.name + ','
|
|
1306
|
+
})
|
|
1307
|
+
if(showName.indexOf(',')>=0){
|
|
1308
|
+
showName = showName.substring(0,showName.lastIndexOf(','))
|
|
1309
|
+
}
|
|
1310
|
+
this.setCellValue(fileSetObj.showNameData.dbName, showName, 'input')
|
|
1311
|
+
showNameStr = this.row[fileSetObj.showNameData.dbName]
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
} else {
|
|
1315
|
+
if (fileSetObj.showNameData.name) {
|
|
1316
|
+
if (this.row) {
|
|
1317
|
+
let showName = ''
|
|
1318
|
+
responseFiles.forEach(responseFile=>{
|
|
1319
|
+
showName = showName + responseFile.name + ','
|
|
1320
|
+
})
|
|
1321
|
+
if(showName.indexOf(',')>=0){
|
|
1322
|
+
showName = showName.substring(0,showName.lastIndexOf(','))
|
|
1323
|
+
}
|
|
1324
|
+
this.setCellValue(fileSetObj.showNameData.name, showName, 'input')
|
|
1325
|
+
showNameStr = this.row[fileSetObj.showNameData.name]
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
if (fileSetObj.serverNameData) {
|
|
1331
|
+
if (this.isSql) {
|
|
1332
|
+
if (fileSetObj.serverNameData.dbName) {
|
|
1333
|
+
if (this.row) {
|
|
1334
|
+
let serverName = ''
|
|
1335
|
+
responseFiles.forEach(responseFile=>{
|
|
1336
|
+
serverName = serverName + responseFile.serverPath + ','
|
|
1337
|
+
})
|
|
1338
|
+
if(serverName.indexOf(',')>=0){
|
|
1339
|
+
serverName = serverName.substring(0,serverName.lastIndexOf(','))
|
|
1340
|
+
}
|
|
1341
|
+
this.setCellValue(fileSetObj.serverNameData.dbName, serverName, 'input')
|
|
1342
|
+
pathNameStr = this.row[fileSetObj.serverNameData.dbName]
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
} else {
|
|
1346
|
+
if (fileSetObj.serverNameData.name) {
|
|
1347
|
+
if (this.row) {
|
|
1348
|
+
let serverName = ''
|
|
1349
|
+
responseFiles.forEach(responseFile=>{
|
|
1350
|
+
serverName = serverName + responseFile.serverPath + ','
|
|
1351
|
+
})
|
|
1352
|
+
if(serverName.indexOf(',')>=0){
|
|
1353
|
+
serverName = serverName.substring(0,serverName.lastIndexOf(','))
|
|
1354
|
+
}
|
|
1355
|
+
this.setCellValue(fileSetObj.serverNameData.name, serverName, 'input')
|
|
1356
|
+
pathNameStr = this.row[fileSetObj.serverNameData.name]
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
this.fileList = otherFilesToStandard(fileSetObj, keyValueParam, null, {
|
|
1362
|
+
showName: showNameStr,
|
|
1363
|
+
serverPath: pathNameStr
|
|
1364
|
+
})
|
|
1365
|
+
}
|
|
1366
|
+
this.packageFileNameWithFileList()
|
|
1367
|
+
},
|
|
1178
1368
|
responseFileToFileObj(fileSetObj, responseFile) {
|
|
1179
1369
|
const fileObj = {}
|
|
1180
1370
|
if (fileSetObj.showNameData) {
|
|
@@ -1544,6 +1734,38 @@ export default {
|
|
|
1544
1734
|
return '#13ce66'
|
|
1545
1735
|
}
|
|
1546
1736
|
}
|
|
1737
|
+
},
|
|
1738
|
+
scanClick(){
|
|
1739
|
+
console.log('scanClick----userAgent=', this.userAgent)
|
|
1740
|
+
if(this.isApk) {
|
|
1741
|
+
// 表示是APK中
|
|
1742
|
+
const message = {
|
|
1743
|
+
type: 'scan',
|
|
1744
|
+
componentId: this.componentId,
|
|
1745
|
+
systemCode: this.pageContext.systemCode,
|
|
1746
|
+
listCode: this.listCode
|
|
1747
|
+
}
|
|
1748
|
+
window.parent.postMessage(JSON.stringify(message), '*')
|
|
1749
|
+
} else {
|
|
1750
|
+
// 表示是移动端浏览器中
|
|
1751
|
+
this.isShowBrowserScan = true
|
|
1752
|
+
}
|
|
1753
|
+
},
|
|
1754
|
+
/**
|
|
1755
|
+
* 扫描组件时,监听扫描值变化
|
|
1756
|
+
*/
|
|
1757
|
+
watchScanValueChange(newValue) {
|
|
1758
|
+
if(this.scanEnable && this.type === 'input'){
|
|
1759
|
+
const valueSet = analysisScanValue(newValue, this.column._scanRuleSets)
|
|
1760
|
+
if (valueSet) {
|
|
1761
|
+
setScanAnalysisValue(this.row, valueSet.scanSet, valueSet.params)
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
},
|
|
1765
|
+
closeBrowserScan(value) {
|
|
1766
|
+
this.isShowBrowserScan = false
|
|
1767
|
+
this.innerValue = value
|
|
1768
|
+
this.blurEvent()
|
|
1547
1769
|
}
|
|
1548
1770
|
}
|
|
1549
1771
|
}
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
:show-value="$escapeHtml(getLabel(scope.row, scope.$index))"
|
|
110
110
|
:value="getCellValue(scope.row)"
|
|
111
111
|
:additional-param-map="additionalParamMap"
|
|
112
|
+
:additional-settings="controlConfig"
|
|
112
113
|
/>
|
|
113
114
|
</span>
|
|
114
115
|
<!-- 自定义格式的时候 -->
|
|
@@ -142,6 +143,9 @@
|
|
|
142
143
|
:show-value="$escapeHtml(getLabel(pageGridData[scope.$index], scope.$index))"
|
|
143
144
|
:value="getCellValue(pageGridData[scope.$index])"
|
|
144
145
|
:additional-param-map="additionalParamMap"
|
|
146
|
+
:listCode="listCode"
|
|
147
|
+
:component-id="componentId"
|
|
148
|
+
:additional-settings="controlConfig"
|
|
145
149
|
@prohibitToEdit="prohibitToEdit"
|
|
146
150
|
/></span>
|
|
147
151
|
<span
|
|
@@ -362,7 +366,7 @@ import eventBus from './eventBus'
|
|
|
362
366
|
import FsPreview from '../../fs-preview'
|
|
363
367
|
import RichEditorViewer from '../../rich-editor/viewer.vue'
|
|
364
368
|
import GridIcon from './components/grid-icon.vue'
|
|
365
|
-
import {
|
|
369
|
+
import { formatScanRuleSets } from './scan-util.ts'
|
|
366
370
|
export default {
|
|
367
371
|
components: {
|
|
368
372
|
DynamicInput,
|
|
@@ -436,6 +440,16 @@ export default {
|
|
|
436
440
|
parentFormData = gridParams.options.extraParam.entityMap
|
|
437
441
|
}
|
|
438
442
|
const additionalParamMap = getAdditionalParamMap(gridParams)
|
|
443
|
+
let controlConfig = {}
|
|
444
|
+
if (this.column.controlConfig) {
|
|
445
|
+
controlConfig = JSON.parse(this.column.controlConfig)
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
let scanEnable = false
|
|
449
|
+
if(controlConfig.scanEnable){
|
|
450
|
+
scanEnable = true
|
|
451
|
+
}
|
|
452
|
+
const componentId = this.listCode+'_'+this.column.prop
|
|
439
453
|
return {
|
|
440
454
|
selectRow: null,
|
|
441
455
|
that: this,
|
|
@@ -459,7 +473,10 @@ export default {
|
|
|
459
473
|
getFormData: gridParams.options.getFormData,
|
|
460
474
|
getTableGridData: gridParams.options.getGridData,
|
|
461
475
|
additionalParamMap,
|
|
462
|
-
disabled: false
|
|
476
|
+
disabled: false,
|
|
477
|
+
controlConfig: this.getColumnCustomControlControlConfig(this.column.formatter),
|
|
478
|
+
scanEnable,
|
|
479
|
+
componentId
|
|
463
480
|
}
|
|
464
481
|
},
|
|
465
482
|
computed: {
|
|
@@ -622,6 +639,7 @@ export default {
|
|
|
622
639
|
this.fileMultiple = true
|
|
623
640
|
}
|
|
624
641
|
}
|
|
642
|
+
this.setScanRuleSets()
|
|
625
643
|
},
|
|
626
644
|
mounted() {
|
|
627
645
|
// 监听保存时点击按钮事件线触发
|
|
@@ -978,6 +996,12 @@ export default {
|
|
|
978
996
|
closeRichEditorContent() {
|
|
979
997
|
this.showRichEditorViewer = false
|
|
980
998
|
},
|
|
999
|
+
getColumnCustomControlControlConfig(columnFormatter) {
|
|
1000
|
+
if (columnFormatter && columnFormatter.options && columnFormatter.options.controlConfig) {
|
|
1001
|
+
const controlConfig = JSON.parse(columnFormatter.options.controlConfig)
|
|
1002
|
+
return controlConfig
|
|
1003
|
+
}
|
|
1004
|
+
},
|
|
981
1005
|
isRequired(editing) {
|
|
982
1006
|
if (!this.isFormSubTable && this.lineEdit.editable && this.isEditable && editing && this.column.validations) {
|
|
983
1007
|
if (this.column.validations.indexOf('"required":true') > 0) {
|
|
@@ -1017,6 +1041,17 @@ export default {
|
|
|
1017
1041
|
return JSON.parse(this.column.formatter.options.fileSet)
|
|
1018
1042
|
}
|
|
1019
1043
|
return {}
|
|
1044
|
+
},
|
|
1045
|
+
/**
|
|
1046
|
+
* 设置条码扫描解析规则
|
|
1047
|
+
*/
|
|
1048
|
+
setScanRuleSets() {
|
|
1049
|
+
if(this.scanEnable && this.controlConfig && this.controlConfig.scanRuleList) {
|
|
1050
|
+
formatScanRuleSets(this.controlConfig.scanRuleList).then((res) => {
|
|
1051
|
+
//扫描处理
|
|
1052
|
+
this.column._scanRuleSets = res
|
|
1053
|
+
})
|
|
1054
|
+
}
|
|
1020
1055
|
}
|
|
1021
1056
|
},
|
|
1022
1057
|
emits: ['refresData', 'refresPortData', 'refresPortsData', 'refresMainTableFields', 'prohibitToEdit', ,]
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { setEntityFieldValue } from "../../../src/utils/util";
|
|
2
|
+
|
|
3
|
+
export interface ScanRuleSet {
|
|
4
|
+
[key: string]: { outs: any[]; adaptations: any[] }
|
|
5
|
+
}
|
|
6
|
+
export function formatScanRuleSets(ruleList: any[]) {
|
|
7
|
+
const scanRuleSets: ScanRuleSet = {}
|
|
8
|
+
// 从配置的解析规则中获取所有使用的条码解析规则, (因为有的配置的是规则分组,并且有可能值设置只使用了分组中的某几个规则,)
|
|
9
|
+
// 输出为 {规则编码:[ outs:[{returnedValue:'返回值的编码',pageVariable:'设置到'}], adaptations:[] ]} 的结构
|
|
10
|
+
// 获取到这个结构后,再去后端调用,获取规则的详细信息(适配条件,输出字段的匹配规则)
|
|
11
|
+
ruleList.forEach((ruleSet: any) => {
|
|
12
|
+
if (ruleSet.type === 'group') {
|
|
13
|
+
// 当时规则组时,需要获取每条值设置的规则,并存放到scanRuleSets
|
|
14
|
+
ruleSet.outs.forEach((valueSet: any) => {
|
|
15
|
+
if (!scanRuleSets[valueSet.ruleCode]) {
|
|
16
|
+
scanRuleSets[valueSet.ruleCode] = { outs: [], adaptations: [] }
|
|
17
|
+
}
|
|
18
|
+
scanRuleSets[valueSet.ruleCode].outs.push(valueSet)
|
|
19
|
+
})
|
|
20
|
+
} else {
|
|
21
|
+
scanRuleSets[ruleSet.code] = { outs: ruleSet.outs, adaptations: [] }
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
return packageScanRuleSets(scanRuleSets)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function packageScanRuleSets(scanRuleSets: ScanRuleSet) {
|
|
28
|
+
// 获取规则的详细信息(适配条件,输出字段的匹配规则)
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
//
|
|
31
|
+
if (Object.keys(scanRuleSets).length > 0) {
|
|
32
|
+
// Object.keys(scanRuleSets) 为当前配置使用的所有规则的编码
|
|
33
|
+
window.$vueApp.config.globalProperties.$http
|
|
34
|
+
.post(
|
|
35
|
+
window['$vueApp'].config.globalProperties.baseAPI +
|
|
36
|
+
'/dc/setting-barcode-analysis/by-codes',
|
|
37
|
+
Object.keys(scanRuleSets)
|
|
38
|
+
)
|
|
39
|
+
.then((res: any) => {
|
|
40
|
+
res.forEach((rule: any) => {
|
|
41
|
+
// 遍历所有的规则,看哪些规则的输出字段需要设值,因为有可能配置的规则中只使用了部分输出字段
|
|
42
|
+
const ruleOuts = JSON.parse(rule.barcodeAnalysisOuts)
|
|
43
|
+
// 获取当前输入框配置的输出字段编码
|
|
44
|
+
const needOutsFields = new Set()
|
|
45
|
+
// 解析规则配置的"返回值编码(来自条码解析规则定义的输出字段,唯一值)"字段和"设置到"字段的映射
|
|
46
|
+
const outsFiledsSet: any = {}
|
|
47
|
+
scanRuleSets[rule.code].outs.forEach((valueSet: any) => {
|
|
48
|
+
needOutsFields.add(valueSet.returnedValue)
|
|
49
|
+
outsFiledsSet[valueSet.returnedValue] = valueSet.pageVariable
|
|
50
|
+
})
|
|
51
|
+
const filteredOutsField: any[] = []
|
|
52
|
+
ruleOuts.forEach((outFiled: any) => {
|
|
53
|
+
if (needOutsFields.has(outFiled.code)) {
|
|
54
|
+
// 设置输出字段 需要设置到的变量
|
|
55
|
+
outFiled.pageVariable = outsFiledsSet[outFiled.code]
|
|
56
|
+
filteredOutsField.push(outFiled)
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
scanRuleSets[rule.code].outs = filteredOutsField
|
|
60
|
+
// 适配条件
|
|
61
|
+
scanRuleSets[rule.code].adaptations = JSON.parse(rule.barcodeAnalysisAdaptations)
|
|
62
|
+
resolve(scanRuleSets)
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
} else {
|
|
66
|
+
resolve(null)
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 解析扫描值
|
|
73
|
+
* @param obj
|
|
74
|
+
* return {value:扫描值,params:{},scanSet:{}}
|
|
75
|
+
*/
|
|
76
|
+
export function analysisScanValue(scanValue: any, scanRuleSets: ScanRuleSet) {
|
|
77
|
+
if (!scanValue || !scanRuleSets) {
|
|
78
|
+
return null
|
|
79
|
+
}
|
|
80
|
+
const scanSets = Object.values(scanRuleSets)
|
|
81
|
+
for (let i = 0; i < scanSets.length; i++) {
|
|
82
|
+
const scanSet: any = scanSets[i]
|
|
83
|
+
//检查是否匹配
|
|
84
|
+
const adaptations = scanSet.adaptations
|
|
85
|
+
let validStr = ''
|
|
86
|
+
for (let k = 0; k < adaptations.length; k++) {
|
|
87
|
+
const adap = adaptations[k]
|
|
88
|
+
const indexs = _getScanIndexs(scanValue, adap.startIndex, adap.endIndex)
|
|
89
|
+
const startIndex = indexs[0]
|
|
90
|
+
const endIndex = indexs[1]
|
|
91
|
+
let paramValue = scanValue.substring(startIndex, endIndex)
|
|
92
|
+
let compareValue = adap.value
|
|
93
|
+
//比较条件为times时,把operate设置为==
|
|
94
|
+
let operate = adap.operate
|
|
95
|
+
if (operate == 'times') {
|
|
96
|
+
//出现的次数
|
|
97
|
+
const realValue = paramValue.split(compareValue == undefined ? '' : compareValue).length - 1
|
|
98
|
+
//替换为需要比较的次数
|
|
99
|
+
compareValue = realValue
|
|
100
|
+
paramValue = adap.times
|
|
101
|
+
operate = '='
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (isNaN(paramValue) || isNaN(compareValue)) {
|
|
105
|
+
paramValue = "'" + paramValue + "'"
|
|
106
|
+
compareValue = "'" + compareValue + "'"
|
|
107
|
+
}
|
|
108
|
+
if (adap.leftBracket) {
|
|
109
|
+
validStr += adap.leftBracket
|
|
110
|
+
}
|
|
111
|
+
if (operate == '<>') {
|
|
112
|
+
operate = '!='
|
|
113
|
+
} else if (operate == '=') {
|
|
114
|
+
operate = '=='
|
|
115
|
+
}
|
|
116
|
+
if (operate == 'include' || operate == 'notinclude') {
|
|
117
|
+
validStr += paramValue + '.indexOf(' + compareValue + ')'
|
|
118
|
+
if (operate == 'include') {
|
|
119
|
+
validStr += '>-1'
|
|
120
|
+
} else {
|
|
121
|
+
validStr += '<0'
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
validStr += paramValue + operate + compareValue
|
|
125
|
+
}
|
|
126
|
+
if (adap.rightBracket) {
|
|
127
|
+
validStr += adap.rightBracket
|
|
128
|
+
}
|
|
129
|
+
if (adap.joinStr && k + 1 < adaptations.length) {
|
|
130
|
+
const joinStr = adap.joinStr == 'and' ? '&&' : '||'
|
|
131
|
+
validStr += joinStr
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
let res = false
|
|
135
|
+
if (validStr) {
|
|
136
|
+
try {
|
|
137
|
+
console.log('validStr', validStr)
|
|
138
|
+
res = eval('(' + validStr + ')')
|
|
139
|
+
console.log('res', res)
|
|
140
|
+
} catch (e) {
|
|
141
|
+
console.log(e)
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
res = true //没有规则表示都符合
|
|
145
|
+
}
|
|
146
|
+
//如果符合条件时,后续规则不验证
|
|
147
|
+
if (res) {
|
|
148
|
+
return executeAnalysisForScan(scanValue, scanSet)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return null
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 处理条码解析
|
|
156
|
+
* @param obj
|
|
157
|
+
*/
|
|
158
|
+
function executeAnalysisForScan(scanValue: any, scanSet: any) {
|
|
159
|
+
if (!scanSet || !scanValue) {
|
|
160
|
+
return
|
|
161
|
+
}
|
|
162
|
+
//解析获取指定的值
|
|
163
|
+
const outs = scanSet.outs
|
|
164
|
+
const params: any = {}
|
|
165
|
+
outs.forEach((outJson: any) => {
|
|
166
|
+
const fieldName = outJson.fieldName
|
|
167
|
+
if (outJson.fixedValue != undefined) {
|
|
168
|
+
params[fieldName] = outJson.fixedValue
|
|
169
|
+
} else {
|
|
170
|
+
let pValue = scanValue
|
|
171
|
+
//分隔符后取值
|
|
172
|
+
if (outJson.splitChar && outJson.splitNum) {
|
|
173
|
+
const splitChar = outJson.splitChar == '|' ? outJson.splitChar : outJson.splitChar
|
|
174
|
+
const strs = scanValue.split(splitChar)
|
|
175
|
+
const splitNum = outJson.splitNum < 1 ? 1 : outJson.splitNum
|
|
176
|
+
console.log(pValue, splitChar, strs, splitNum)
|
|
177
|
+
if (splitNum <= strs.length) {
|
|
178
|
+
pValue = strs[splitNum - 1]
|
|
179
|
+
} else {
|
|
180
|
+
pValue = ''
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
//检查第二次分隔符后取值
|
|
184
|
+
if (outJson.splitChar2 && outJson.splitNum2) {
|
|
185
|
+
const splitChar2 = outJson.splitChar2 == '|' ? outJson.splitChar2 : outJson.splitChar2
|
|
186
|
+
const strs: any = pValue.split(splitChar2)
|
|
187
|
+
const splitNum2 = outJson.splitNum2 < 1 ? 1 : outJson.splitNum2
|
|
188
|
+
console.log(pValue, splitChar2, strs, splitNum2)
|
|
189
|
+
if (splitNum2 <= strs.length) {
|
|
190
|
+
pValue = strs[splitNum2 - 1]
|
|
191
|
+
} else {
|
|
192
|
+
pValue = ''
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
//有值时,判断是否有截取
|
|
196
|
+
if (pValue.length > 0) {
|
|
197
|
+
const indexs = _getScanIndexs(pValue, outJson.startIndex, outJson.endIndex)
|
|
198
|
+
const startIndex = indexs[0]
|
|
199
|
+
const endIndex = indexs[1]
|
|
200
|
+
pValue = pValue.substring(startIndex, endIndex)
|
|
201
|
+
}
|
|
202
|
+
//获取值
|
|
203
|
+
params[fieldName] = pValue
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
return { value: scanValue, params: params, scanSet: scanSet }
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* 获取有效的索引位置
|
|
211
|
+
* @param value
|
|
212
|
+
* @param startIndex
|
|
213
|
+
* @param endIndex
|
|
214
|
+
*/
|
|
215
|
+
function _getScanIndexs(value: any, startIndex: any, endIndex: any) {
|
|
216
|
+
startIndex = startIndex == undefined ? 0 : startIndex - 1
|
|
217
|
+
startIndex = startIndex < 0 ? 0 : startIndex
|
|
218
|
+
startIndex = startIndex > value.length - 1 ? value.length - 1 : startIndex
|
|
219
|
+
endIndex = endIndex == undefined ? value.length : endIndex
|
|
220
|
+
endIndex = endIndex > value.length ? value.length : endIndex
|
|
221
|
+
endIndex = endIndex < 1 ? 1 : endIndex
|
|
222
|
+
if (endIndex < startIndex) {
|
|
223
|
+
endIndex = startIndex
|
|
224
|
+
}
|
|
225
|
+
return [startIndex, endIndex]
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function setScanAnalysisValue(entity: any, scanSet: any, params: any) {
|
|
229
|
+
if (!scanSet) {
|
|
230
|
+
return
|
|
231
|
+
}
|
|
232
|
+
const outs = scanSet.outs
|
|
233
|
+
outs.forEach((outField: any) => {
|
|
234
|
+
const fieldName = outField.fieldName
|
|
235
|
+
const value = params[fieldName]
|
|
236
|
+
let variableName = outField.pageVariable
|
|
237
|
+
if (variableName && variableName.indexOf('${')>=0) {
|
|
238
|
+
variableName = variableName.substring(2, variableName.length - 1)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
setEntityFieldValue(entity, variableName, value)
|
|
242
|
+
})
|
|
243
|
+
}
|