|
@@ -147,49 +147,62 @@ const submitForm = async () => {
|
|
|
/** 文件上传成功 */
|
|
|
const emits = defineEmits(['success'])
|
|
|
const submitFormSuccess = (response: any) => {
|
|
|
- if (response.data.code !== 0) {
|
|
|
- console.log(response.data.code,'code');
|
|
|
- message.error(response.msg)
|
|
|
- formLoading.value = false
|
|
|
- return
|
|
|
- }
|
|
|
- // 拼接提示语
|
|
|
- const data = response.data.data;
|
|
|
- console.log(data,'data');
|
|
|
- // let text = data;
|
|
|
- let text = '图片上传成功数量:' + data.imageImportResult.createImages.length + ';'
|
|
|
- for (let username of data.imageImportResult.createImages) {
|
|
|
- text += '< ' + username + ' >'
|
|
|
- }
|
|
|
- text += '图片错误数量:' + data.imageImportResult.errorImages.length + ';'
|
|
|
- for (const username of data.imageImportResult.errorImages) {
|
|
|
- text += '< ' + username + ' >'
|
|
|
- }
|
|
|
- text += '图片上传失败数量:' + data.imageImportResult.failureImages.length + ';'
|
|
|
- for (const username of data.imageImportResult.failureImages) {
|
|
|
- text += '< ' + username + ' >'
|
|
|
- }
|
|
|
- text += '找不到用户数量:' + data.imageImportResult.nullUsers.length + ';'
|
|
|
- for (const username of data.imageImportResult.nullUsers) {
|
|
|
- text += '< ' + username + ' >'
|
|
|
- }
|
|
|
- text += '文件上传成功数量:' + data.userImportResult.createUsernames.length + ';'
|
|
|
- for (let username of data.userImportResult.createUsernames) {
|
|
|
- text += '< ' + username + ' >'
|
|
|
- }
|
|
|
- text += '文件更新数量:' + data.userImportResult.updateUsernames.length + ';'
|
|
|
- for (const username of data.userImportResult.updateUsernames) {
|
|
|
- text += '< ' + username + ' >'
|
|
|
- }
|
|
|
- text += '文件上传失败数量:' + Object.keys(data.userImportResult.failureUsernames).length + ';'
|
|
|
- for (const username in data.userImportResult.failureUsernames) {
|
|
|
- text += '< ' + username + ': ' + data.userImportResult.failureUsernames[username] + ' >'
|
|
|
- }
|
|
|
- message.alert(text)
|
|
|
- formLoading.value = false
|
|
|
- dialogVisible.value = false
|
|
|
- // 发送操作成功的事件
|
|
|
- emits('success')
|
|
|
+ if (response.data.code !== 0) {
|
|
|
+ console.log(response.data.code,'code');
|
|
|
+ message.error(response.msg)
|
|
|
+ formLoading.value = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 拼接提示语
|
|
|
+ const data = response.data.data;
|
|
|
+ console.log(data,'data');
|
|
|
+ // let text = data;
|
|
|
+ let text = '上传结果:\n';
|
|
|
+
|
|
|
+// 检查 imageImportResult 是否存在
|
|
|
+if (data.imageImportResult) {
|
|
|
+ text += '图片上传成功数量:' + data.imageImportResult.createImages.length + ';';
|
|
|
+ for (let username of data.imageImportResult.createImages) {
|
|
|
+ text += '< ' + username + ' >';
|
|
|
+ }
|
|
|
+ text += '图片错误数量:' + data.imageImportResult.errorImages.length + ';';
|
|
|
+ for (const username of data.imageImportResult.errorImages) {
|
|
|
+ text += '< ' + username + ' >';
|
|
|
+ }
|
|
|
+ text += '图片上传失败数量:' + data.imageImportResult.failureImages.length + ';';
|
|
|
+ for (const username of data.imageImportResult.failureImages) {
|
|
|
+ text += '< ' + username + ' >';
|
|
|
+ }
|
|
|
+ text += '找不到用户数量:' + data.imageImportResult.nullUsers.length + ';';
|
|
|
+ for (const username of data.imageImportResult.nullUsers) {
|
|
|
+ text += '< ' + username + ' >';
|
|
|
+ }
|
|
|
+} else {
|
|
|
+ text += '图片上传结果为空';
|
|
|
+}
|
|
|
+
|
|
|
+// 检查 userImportResult 是否存在
|
|
|
+if (data.userImportResult) {
|
|
|
+ text += '用户上传成功数量:' + data.userImportResult.createUsernames.length + ';';
|
|
|
+ for (let username of data.userImportResult.createUsernames) {
|
|
|
+ text += '< ' + username + ' >';
|
|
|
+ }
|
|
|
+ text += '用户存在数量:' + data.userImportResult.existUsernames.length + ';';
|
|
|
+ for (const username of data.userImportResult.existUsernames) {
|
|
|
+ text += '< ' + username + ' >';
|
|
|
+ }
|
|
|
+ text += '用户上传失败数量:' + Object.keys(data.userImportResult.failureUsernames).length + ';';
|
|
|
+ for (const username in data.userImportResult.failureUsernames) {
|
|
|
+ text += '< ' + username + ': ' + data.userImportResult.failureUsernames[username] + ' >';
|
|
|
+ }
|
|
|
+} else {
|
|
|
+ text += '用户上传结果为空';
|
|
|
+}
|
|
|
+ message.alert(text)
|
|
|
+ formLoading.value = false
|
|
|
+ dialogVisible.value = false
|
|
|
+ // 发送操作成功的事件
|
|
|
+ emits('success')
|
|
|
}
|
|
|
|
|
|
const submitZipSuccess = (response: any) => {
|