n20-common-lib 3.3.0 → 3.3.2
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/package.json +2 -2
- package/src/assets/css/_coreLib.scss +1 -0
- package/src/assets/css/v3/approval-card.scss +513 -0
- package/src/components/ApprovalButtons/getApprovalConfig.js +87 -0
- package/src/components/ApprovalButtons/index.vue +14 -17
- package/src/components/ApprovalRecord/index.vue +8 -4
- package/src/components/FileUploadTable/index.vue +84 -24
- package/src/components/v3/ApprovalCard/index.vue +634 -0
- package/src/i18n.json +7 -0
- package/src/index.js +3 -0
- package/style/index.css +1 -1
- package/theme/blue.css +1 -1
- package/theme/cctcRed.css +1 -1
- package/theme/green.css +1 -1
- package/theme/lightBlue.css +1 -1
- package/theme/orange.css +1 -1
- package/theme/purple.css +1 -1
- package/theme/red.css +1 -1
- package/theme/yellow.css +1 -1
- package/theme/fonts/iconfont.1871f864.ttf +0 -0
- package/theme/fonts/iconfont.7ddd3bd8.woff +0 -0
- package/theme/fonts/iconfont.ca8ecaf4.woff2 +0 -0
|
@@ -546,14 +546,14 @@ export default {
|
|
|
546
546
|
watch: {
|
|
547
547
|
dataPorp: {
|
|
548
548
|
handler() {
|
|
549
|
-
this.requiredTypes = this.
|
|
549
|
+
this.requiredTypes = this.typeOptions
|
|
550
550
|
.filter((item) => {
|
|
551
551
|
return item.required === 1
|
|
552
552
|
})
|
|
553
553
|
.map((item) => {
|
|
554
554
|
return item.attno
|
|
555
555
|
})
|
|
556
|
-
if (this.
|
|
556
|
+
if (this.typeOptions.length === 0) {
|
|
557
557
|
return false
|
|
558
558
|
}
|
|
559
559
|
this.setTableData()
|
|
@@ -711,10 +711,17 @@ export default {
|
|
|
711
711
|
this.$emit('aiFn', data)
|
|
712
712
|
}
|
|
713
713
|
},
|
|
714
|
+
getUserNameSafe() {
|
|
715
|
+
try {
|
|
716
|
+
return (JSON.parse(sessionStorage.getItem('userInfo') || '{}') || {}).uname
|
|
717
|
+
} catch (e) {
|
|
718
|
+
return undefined
|
|
719
|
+
}
|
|
720
|
+
},
|
|
714
721
|
// 平铺附件
|
|
715
722
|
setTableData() {
|
|
716
723
|
if (this.tableData.length === 0 && !this.readonly) {
|
|
717
|
-
this.
|
|
724
|
+
this.typeOptions
|
|
718
725
|
.filter((item) => {
|
|
719
726
|
if (this.fileRequired) {
|
|
720
727
|
return item.required === 1
|
|
@@ -730,9 +737,7 @@ export default {
|
|
|
730
737
|
}
|
|
731
738
|
obj[this.keys.type] = item.attno
|
|
732
739
|
obj[this.keys.time] = ''
|
|
733
|
-
obj[this.keys.user] =
|
|
734
|
-
|
|
735
|
-
console.log(obj)
|
|
740
|
+
obj[this.keys.user] = this.getUserNameSafe()
|
|
736
741
|
this.tableData.push(obj)
|
|
737
742
|
})
|
|
738
743
|
}
|
|
@@ -799,7 +804,13 @@ export default {
|
|
|
799
804
|
handleBathChange() {
|
|
800
805
|
// 创建新的文件数据对象,避免直接修改计算属性
|
|
801
806
|
let fileData = this.fileData || {}
|
|
802
|
-
let dto
|
|
807
|
+
let dto
|
|
808
|
+
try {
|
|
809
|
+
dto = JSON.parse(fileData.data || '{}')
|
|
810
|
+
} catch (e) {
|
|
811
|
+
this.$message.error($lc('批量上传参数格式错误'))
|
|
812
|
+
return
|
|
813
|
+
}
|
|
803
814
|
dto[this.keys.type] = this.bathType
|
|
804
815
|
this.batchFileData = {
|
|
805
816
|
...fileData,
|
|
@@ -816,6 +827,9 @@ export default {
|
|
|
816
827
|
$uploadwrap.submit()
|
|
817
828
|
},
|
|
818
829
|
async autoMatchBatchUpload() {
|
|
830
|
+
if (this.batchUploading) {
|
|
831
|
+
return
|
|
832
|
+
}
|
|
819
833
|
let $uploadwrap = this.$refs['upload-batch']
|
|
820
834
|
let uploadFiles = $uploadwrap?.$refs?.upload?.uploadFiles || []
|
|
821
835
|
let files = uploadFiles.filter((item) => item.status === 'ready' && item.raw)
|
|
@@ -824,6 +838,7 @@ export default {
|
|
|
824
838
|
return
|
|
825
839
|
}
|
|
826
840
|
|
|
841
|
+
this.batchUploading = true
|
|
827
842
|
try {
|
|
828
843
|
for (let item of files) {
|
|
829
844
|
let result = await $uploadwrap.beforeUploadFn(item.raw)
|
|
@@ -838,16 +853,35 @@ export default {
|
|
|
838
853
|
FD.append('file', item)
|
|
839
854
|
})
|
|
840
855
|
|
|
841
|
-
let requestData
|
|
856
|
+
let requestData
|
|
857
|
+
try {
|
|
858
|
+
requestData = JSON.parse(this.fileData?.data || '{}')
|
|
859
|
+
} catch (e) {
|
|
860
|
+
this.$message.error($lc('批量上传参数格式错误'))
|
|
861
|
+
return
|
|
862
|
+
}
|
|
863
|
+
// bussValues 为业务值代码(getByBussValues 入参域),优先显式配置,其次 data JSON 携带
|
|
864
|
+
let configuredBussValues =
|
|
865
|
+
Array.isArray(this.dataPorp.bussValues) && this.dataPorp.bussValues.length
|
|
866
|
+
? this.dataPorp.bussValues
|
|
867
|
+
: Array.isArray(requestData.bussValues)
|
|
868
|
+
? requestData.bussValues
|
|
869
|
+
: []
|
|
870
|
+
let bussValues = configuredBussValues.filter((v) => v !== undefined && v !== null && v !== '')
|
|
871
|
+
if (!bussValues.length) {
|
|
872
|
+
this.$message.error($lc('请配置附件分类'))
|
|
873
|
+
return
|
|
874
|
+
}
|
|
842
875
|
requestData.bussId = requestData.bussId ?? this.fileData?.bussId ?? ''
|
|
843
|
-
requestData.bussValues =
|
|
876
|
+
requestData.bussValues = bussValues
|
|
844
877
|
FD.append('data', JSON.stringify(requestData))
|
|
845
878
|
|
|
846
|
-
this.batchUploading = true
|
|
847
879
|
let { data } = await axios.post(
|
|
848
|
-
this.apiPrefix
|
|
880
|
+
(this.apiPrefix
|
|
849
881
|
? `${this.apiPrefix}/neams/eamsbaserecord/batchSaveFile`
|
|
850
|
-
: '/neams/eamsbaserecord/batchSaveFile'
|
|
882
|
+
: '/neams/eamsbaserecord/batchSaveFile') +
|
|
883
|
+
'?r=' +
|
|
884
|
+
Math.random(),
|
|
851
885
|
FD,
|
|
852
886
|
{
|
|
853
887
|
headers: Object.assign(auth.setHeaders(this.headers), { 'Content-Type': 'multipart/form-data' }),
|
|
@@ -858,6 +892,10 @@ export default {
|
|
|
858
892
|
)
|
|
859
893
|
|
|
860
894
|
let responseList = Array.isArray(data) ? data : []
|
|
895
|
+
if (!responseList.length) {
|
|
896
|
+
this.$message.warning($lc('上传结果为空,请稍后重试'))
|
|
897
|
+
return
|
|
898
|
+
}
|
|
861
899
|
let rows = responseList.map((item) => this.buildAutoMatchBatchRow(item))
|
|
862
900
|
rows.forEach((row) => {
|
|
863
901
|
let type = row[this.keys.type]
|
|
@@ -879,8 +917,8 @@ export default {
|
|
|
879
917
|
this.$emit('on-success', sourceFile?.raw, row)
|
|
880
918
|
})
|
|
881
919
|
|
|
882
|
-
$uploadwrap
|
|
883
|
-
$uploadwrap.fileList = []
|
|
920
|
+
$uploadwrap?.clearFiles?.()
|
|
921
|
+
$uploadwrap && ($uploadwrap.fileList = [])
|
|
884
922
|
this.visibleBatch = false
|
|
885
923
|
} catch (err) {
|
|
886
924
|
this.$message.error(err?.msg || $lc('上传失败'))
|
|
@@ -889,7 +927,12 @@ export default {
|
|
|
889
927
|
}
|
|
890
928
|
},
|
|
891
929
|
buildAutoMatchBatchRow(item) {
|
|
892
|
-
let userInfo =
|
|
930
|
+
let userInfo = {}
|
|
931
|
+
try {
|
|
932
|
+
userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}')
|
|
933
|
+
} catch (e) {
|
|
934
|
+
// sessionStorage 不可用时忽略
|
|
935
|
+
}
|
|
893
936
|
let row = {
|
|
894
937
|
...item,
|
|
895
938
|
_name: item.fileName,
|
|
@@ -898,7 +941,7 @@ export default {
|
|
|
898
941
|
_typeDisabled: false,
|
|
899
942
|
_uploadDisabled: true,
|
|
900
943
|
_typeUpdating: false,
|
|
901
|
-
|
|
944
|
+
_originalType: item.attno ?? '',
|
|
902
945
|
_lastFileType: item.attno,
|
|
903
946
|
_lastFileTypeName: item.attname,
|
|
904
947
|
_lastBussValue: item.bussValue
|
|
@@ -908,15 +951,24 @@ export default {
|
|
|
908
951
|
row[this.keys.name] = item.fileName
|
|
909
952
|
row[this.keys.url] = this.keys.url === this.keys.rowKey ? item.beid : item.filePath || item.beid
|
|
910
953
|
row[this.keys.time] = row[this.keys.time] || dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
911
|
-
row[this.keys.user] = row[this.keys.user] || userInfo.uname
|
|
954
|
+
row[this.keys.user] = row[this.keys.user] || (userInfo.uname ?? '')
|
|
912
955
|
return row
|
|
913
956
|
},
|
|
914
957
|
handleTypeChange(row) {
|
|
915
958
|
let type = row[this.keys.type]
|
|
916
959
|
this.$emit('typeChange', type)
|
|
917
|
-
if (!row.
|
|
960
|
+
if (!type || row._originalType === type) {
|
|
918
961
|
return
|
|
919
962
|
}
|
|
963
|
+
// 未识别类型的行手动选中类型后,删除该类型对应的占位行
|
|
964
|
+
if (!row._originalType) {
|
|
965
|
+
let placeholderIndex = this.tableData.findIndex(
|
|
966
|
+
(item) => item[this.keys.type] === type && !item[this.keys.url] && !item[this.keys.name] && !item._name
|
|
967
|
+
)
|
|
968
|
+
if (placeholderIndex > -1) {
|
|
969
|
+
this.tableData.splice(placeholderIndex, 1)
|
|
970
|
+
}
|
|
971
|
+
}
|
|
920
972
|
this.updateFileBuss(row, type)
|
|
921
973
|
},
|
|
922
974
|
async updateFileBuss(row, type) {
|
|
@@ -936,9 +988,11 @@ export default {
|
|
|
936
988
|
|
|
937
989
|
try {
|
|
938
990
|
await axios.post(
|
|
939
|
-
this.apiPrefix
|
|
991
|
+
(this.apiPrefix
|
|
940
992
|
? `${this.apiPrefix}/neams/eamsbaserecord/updateFlieBuss`
|
|
941
|
-
: '/neams/eamsbaserecord/updateFlieBuss'
|
|
993
|
+
: '/neams/eamsbaserecord/updateFlieBuss') +
|
|
994
|
+
'?r=' +
|
|
995
|
+
Math.random(),
|
|
942
996
|
[
|
|
943
997
|
{
|
|
944
998
|
beid: row.beid,
|
|
@@ -962,6 +1016,7 @@ export default {
|
|
|
962
1016
|
this.$set(row, '_lastFileType', type)
|
|
963
1017
|
this.$set(row, '_lastFileTypeName', typeName)
|
|
964
1018
|
this.$set(row, '_lastBussValue', row.bussValue)
|
|
1019
|
+
this.$set(row, '_originalType', type)
|
|
965
1020
|
} catch (err) {
|
|
966
1021
|
this.$set(row, this.keys.type, previousType)
|
|
967
1022
|
this.$set(row, 'attno', previousType)
|
|
@@ -979,7 +1034,7 @@ export default {
|
|
|
979
1034
|
[this.keys.name]: '',
|
|
980
1035
|
[this.keys.type]: this.bathType,
|
|
981
1036
|
[this.keys.time]: '',
|
|
982
|
-
[this.keys.user]:
|
|
1037
|
+
[this.keys.user]: this.getUserNameSafe(),
|
|
983
1038
|
_percent: 0,
|
|
984
1039
|
_status: undefined,
|
|
985
1040
|
_typeDisabled: false
|
|
@@ -1004,14 +1059,14 @@ export default {
|
|
|
1004
1059
|
|
|
1005
1060
|
list.push(file)
|
|
1006
1061
|
let $uploadwrap = this.$refs['upload-batch']
|
|
1007
|
-
$uploadwrap.fileList = list
|
|
1062
|
+
$uploadwrap && ($uploadwrap.fileList = list)
|
|
1008
1063
|
}
|
|
1009
1064
|
},
|
|
1010
1065
|
batchRemove(file, fileList) {
|
|
1011
1066
|
let list = fileList.filter((f) => f.uid !== file.uid)
|
|
1012
1067
|
|
|
1013
1068
|
let $uploadwrap = this.$refs['upload-batch']
|
|
1014
|
-
$uploadwrap.fileList = list
|
|
1069
|
+
$uploadwrap && ($uploadwrap.fileList = list)
|
|
1015
1070
|
|
|
1016
1071
|
this.$emit('on-remove', file)
|
|
1017
1072
|
},
|
|
@@ -1144,7 +1199,12 @@ export default {
|
|
|
1144
1199
|
let data = opt.data || this.fileData
|
|
1145
1200
|
|
|
1146
1201
|
if (data) {
|
|
1147
|
-
let dto
|
|
1202
|
+
let dto
|
|
1203
|
+
try {
|
|
1204
|
+
dto = JSON.parse(data.data || '{}')
|
|
1205
|
+
} catch (e) {
|
|
1206
|
+
return Promise.reject({ msg: $lc('批量上传参数格式错误') })
|
|
1207
|
+
}
|
|
1148
1208
|
dto[this.keys.type] = this.bathType
|
|
1149
1209
|
data.data = JSON.stringify(dto)
|
|
1150
1210
|
for (let k in data) {
|