Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
exhibition_backstage
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
龙菲
exhibition_backstage
Commits
d1ec8d4f
提交
d1ec8d4f
authored
10月 14, 2023
作者:
龙菲
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复文物编辑缺陷
上级
7018502f
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
311 行增加
和
434 行删除
+311
-434
ManualUploader.vue
src/components/Uploader/ManualUploader.vue
+20
-5
fileUploadFuctions.js
src/utils/fileUploadFuctions.js
+53
-10
transformData.js
src/utils/transformData.js
+14
-5
InfoEditDialog.vue
src/views/culturalRelic/components/InfoEditDialog.vue
+53
-59
fileUploadFuctions.js
src/views/culturalRelic/configs/fileUploadFuctions.js
+0
-147
list.js
src/views/culturalRelic/configs/list.js
+44
-44
transformData.js
src/views/culturalRelic/configs/transformData.js
+0
-125
index.vue
src/views/culturalRelic/index.vue
+33
-34
InfoEditDialog.vue
src/views/display/components/InfoEditDialog.vue
+2
-1
index.vue
src/views/displayApproval/index.vue
+92
-4
没有找到文件。
src/components/Uploader/ManualUploader.vue
浏览文件 @
d1ec8d4f
...
...
@@ -73,6 +73,7 @@ export default {
data
()
{
return
{
fileList
:
[],
removedIds
:[],
//被删除的文件Id集合
};
},
watch
:
{
...
...
@@ -138,11 +139,20 @@ export default {
if
(
item
.
status
==
"ready"
)
{
return
item
;
}
else
{
item
.
url
=
item
.
highImg
;
item
.
pressUrl
=
item
.
lowImg
;
item
.
name
=
item
.
name
;
item
.
fileId
=
item
.
fileId
;
return
item
;
const
{
highImg
,
lowImg
,
name
,
fileId
,
status
}
=
item
const
obj
=
{
urL
:
highImg
,
pressUrl
:
lowImg
,
name
,
fileId
,
status
,
}
// item.url = item.highImg;
// item.pressUrl = item.lowImg;
// item.name = item.name;
// item.fileId = item.fileId;
// item.status =
return
obj
;
}
});
return
newFileList
;
...
...
@@ -197,6 +207,11 @@ export default {
// 文件列表移除文件时的钩子
handleRemove
(
file
,
fileList
)
{
let
that
=
this
;
const
{
status
}
=
file
;
if
(
status
==
"success"
)
{
this
.
removedIds
.
push
(
file
.
fileId
);
this
.
$emit
(
'getRemovedIds'
,
this
.
removedIds
)
}
that
.
fileList
.
map
(
async
(
item
,
index
)
=>
{
if
(
item
.
uid
===
file
.
uid
)
{
that
.
fileList
.
splice
(
index
,
1
);
...
...
src/utils/fileUploadFuctions.js
浏览文件 @
d1ec8d4f
...
...
@@ -2,6 +2,7 @@
* 本文件用于处理文物的相关文件上传过程中的函数
* 注意不要使用this可能导致找不到等问题,内部调用内部方法时直接使用fileUploadFuctions
*/
import
{
deleteFiles
}
from
"@/api/file"
;
const
fileUploadFuctions
=
{
/**
* 判断文件是否上传过
...
...
@@ -58,17 +59,46 @@ const fileUploadFuctions = {
* @param {Array} mediaKeys 媒体keys数组
* @returns {Object} 已经存在(数据库已存储的)文件ID对象
*/
getOldIdsObj
(
mediaKeys
,
dialogForm
)
{
getOldIdsObj
(
mediaKeys
,
dialogForm
,
$el
)
{
// debugger
let
oldFileIdsObj
=
{};
// 文物的3D文件和封面需要单独处理
mediaKeys
.
forEach
((
key
)
=>
{
if
(
dialogForm
[
key
])
{
oldFileIdsObj
[
key
]
=
dialogForm
[
key
];
// 因为封面和3D文件的旧ID就是dialogForm的faceImage和file3d,此时还是旧的
// 新的在调用组件的this.faceImage和this.file3d对象里
if
(
key
==
"faceImage"
)
{
oldFileIdsObj
.
faceImage
=
dialogForm
.
faceImage
;
return
;
}
if
(
key
==
"file3d"
)
{
oldFileIdsObj
.
file3d
=
dialogForm
.
file3d
;
return
;
}
// const voKey = `${key}Vo`;
if
(
$el
.
$refs
[
key
])
{
// 已存在的文件status为success
const
files
=
$el
.
$refs
[
key
].
getFiles
();
const
successItems
=
files
.
filter
((
item
)
=>
{
return
item
.
status
==
"success"
;
});
if
(
successItems
.
length
>
0
)
{
// 获取他们的fileId
oldFileIdsObj
[
key
]
=
successItems
.
map
((
item
)
=>
{
return
item
.
fileId
;
})
.
join
(
","
);
}
else
{
oldFileIdsObj
[
key
]
=
""
;
}
}
else
{
oldFileIdsObj
[
key
]
=
""
;
}
});
return
oldFileIdsObj
;
},
/**
* 获取返回结果中的文件id对象
* @param {Array} mediaKeys 媒体keys数组
...
...
@@ -111,13 +141,27 @@ const fileUploadFuctions = {
* @returns {string} 新上传的文件id字符串
*/
getMergedIdsObj
(
oldObj
,
newObj
,
mediaKeys
)
{
// debugger;
const
obj
=
{};
mediaKeys
.
forEach
((
key
)
=>
{
let
newArr
=
newObj
[
key
].
split
(
","
);
let
oldArr
=
oldObj
[
key
].
split
(
","
);
if
(
key
==
"file3d"
||
key
==
"faceImage"
)
{
obj
[
key
]
=
newObj
[
key
];
return
;
}
let
newArr
=
[];
let
oldArr
=
[];
if
(
newObj
[
key
])
{
newArr
=
newObj
[
key
].
split
(
","
);
}
if
(
oldObj
[
key
])
{
oldArr
=
oldObj
[
key
].
split
(
","
);
}
let
fullArr
=
[...
new
Set
([...
newArr
,
...
oldArr
])];
let
fullStr
=
fullArr
.
join
(
","
);
obj
[
key
]
=
fullStr
.
substring
(
0
,
fullStr
.
length
-
1
);
let
fullStr
=
""
;
if
(
fullArr
.
length
>
0
)
{
fullStr
=
fullArr
.
join
(
","
);
}
obj
[
key
]
=
fullStr
;
});
return
obj
;
},
...
...
@@ -145,8 +189,8 @@ const fileUploadFuctions = {
},
/**
* @param {array} fileArr 需要被删除的文件ID数组
*/
* @param {array} fileArr 需要被删除的文件ID数组
*/
async
handleDeleteFiles
(
fileArr
)
{
console
.
log
(
"doing delete"
);
if
(
fileArr
.
length
==
0
)
{
...
...
@@ -156,6 +200,5 @@ const fileUploadFuctions = {
await
deleteFiles
(
fileArr
);
console
.
log
(
"delete done"
);
},
};
export
default
fileUploadFuctions
;
src/utils/transformData.js
浏览文件 @
d1ec8d4f
// 本文件提供一些前端和后端数据交互和转换的一些方法,可批量使用的
const
transformData
=
{
/**
* 转换服务器的封面数据到前端可用的封面数据
* @param {String} faceImage
PressUrl 压缩过得封面
* @param {String} faceImage
封面文件ID
* @param {String} faceImageUrl 封面原图
* @param {String} faceImagePressUrl 压缩过的封面
* @returns {Array} el-upload组件需要的数据
*/
faceImageToClient
(
faceImage
PressUrl
,
faceImage
Url
)
{
faceImageToClient
(
faceImage
,
faceImageUrl
,
faceImagePress
Url
)
{
if
(
!
faceImageUrl
)
{
return
[];
}
const
faceImage
=
[
const
result
=
[
{
name
:
""
,
url
:
faceImageUrl
||
""
,
...
...
@@ -19,7 +19,7 @@ const transformData = {
fileId
:
faceImage
||
""
,
},
];
return
faceImage
;
return
result
;
},
/**
...
...
@@ -88,6 +88,15 @@ const transformData = {
* @returns {Boolean} 组件需要的布尔值
*/
statusStrToBool
(
statusString
)
{
if
(
!
(
statusString
&&
statusString
instanceof
String
&&
statusString
instanceof
Number
)
)
{
return
;
}
const
statusBoolean
=
Boolean
(
Number
(
statusString
));
return
statusBoolean
;
},
...
...
src/views/culturalRelic/components/InfoEditDialog.vue
浏览文件 @
d1ec8d4f
<
template
>
<el-dialog
:visible
.
sync=
"
dialogV
isible"
:visible
.
sync=
"
v
isible"
width=
"80%"
:before-close=
"handleClose"
top=
"2vh"
...
...
@@ -213,6 +213,7 @@
listType=
"picture-card"
:fileType=
"['png', 'jpeg', 'jpg']"
ref=
"faceImage"
@
getRemovedIds=
"getRemovedIds"
/>
</el-form-item>
<el-form-item
label=
"文物图片"
:label-width=
"formLabelWidth"
>
...
...
@@ -223,6 +224,7 @@
listType=
"picture-card"
:fileType=
"['png', 'jpeg', 'jpg']"
ref=
"images"
@
getRemovedIds=
"getRemovedIds"
/>
</el-form-item>
...
...
@@ -234,6 +236,7 @@
:fileType=
"['mp4']"
listType=
"text"
ref=
"videos"
@
getRemovedIds=
"getRemovedIds"
/>
</el-form-item>
...
...
@@ -245,6 +248,7 @@
:fileType=
"['OBJ', 'STL', 'FBX', '3DS']"
listType=
"text"
ref=
"file3d"
@
getRemovedIds=
"getRemovedIds"
/>
</el-form-item>
<el-form-item
label=
"文物音频"
:label-width=
"formLabelWidth"
>
...
...
@@ -255,6 +259,7 @@
:fileType=
"['mp3']"
listType=
"text"
ref=
"audios"
@
getRemovedIds=
"getRemovedIds"
/>
</el-form-item>
</el-col>
...
...
@@ -262,7 +267,7 @@
</el-form>
<div
class=
"dialog-footer"
>
<el-button
@
click=
"
cancelForm
"
size=
"mini"
>
取 消
</el-button>
<el-button
@
click=
"
handleClose
"
size=
"mini"
>
取 消
</el-button>
<el-button
type=
"primary"
size=
"mini"
...
...
@@ -282,7 +287,6 @@ import { getLiteratureList } from "@/api/literature";
import
{
addOrUpdateCulturalRelic
}
from
"@/api/culturalRelic"
;
import
{
mapGetters
,
mapActions
}
from
"vuex"
;
import
{
uploadV1
}
from
"@/utils/file"
;
import
{
deleteFiles
}
from
"@/api/file"
;
import
{
rules
}
from
"../configs/validateRules"
;
import
fileUploadFunctions
from
"@/utils/fileUploadFuctions"
;
import
transformData
from
"@/utils/transformData"
;
...
...
@@ -299,10 +303,6 @@ const {
export
default
{
name
:
"InfoEditDialog"
,
props
:
{
visible
:
{
type
:
Boolean
,
default
:
false
,
},
form
:
{
type
:
Object
,
default
:
()
=>
({}),
...
...
@@ -311,6 +311,9 @@ export default {
computed
:
{
...
mapGetters
([
"userInfo"
,
"dicts"
]),
title
()
{
if
(
!
this
.
dialogForm
)
{
return
;
}
if
(
this
.
dialogForm
.
crId
)
{
return
"修改文物信息"
;
}
else
{
...
...
@@ -319,13 +322,6 @@ export default {
},
},
watch
:
{
visible
:
{
handler
:
function
(
value
)
{
this
.
dialogVisible
=
value
;
},
immediate
:
true
,
deep
:
true
,
},
form
:
{
handler
(
value
)
{
if
(
!
value
)
{
...
...
@@ -339,13 +335,15 @@ export default {
},
data
()
{
return
{
dialogForm
:
{
...
this
.
form
,
},
// dialogForm: {
// ...this.form,
// },
visible
:
false
,
formLabelWidth
:
"100px"
,
loading
:
false
,
submitLoading
:
false
,
loadingText
:
""
,
dialogForm
:
{},
literatureList
:
[],
//服务器获得的文献列表
literatureIdArr
:
[],
//文献ID集合,用于绑定数据
faceImage
:
[],
...
...
@@ -361,7 +359,6 @@ export default {
children
:
"children"
,
checkStrictly
:
true
,
},
dialogVisible
:
false
,
orgTreeData
:
[],
optionProps
:
{
value
:
"id"
,
...
...
@@ -371,6 +368,7 @@ export default {
},
rules
,
mediaKeys
:
[
"faceImage"
,
"images"
,
"videos"
,
"audios"
,
"file3d"
],
//表单中的媒体
removedIds
:
[],
//被删除掉的文件
};
},
async
created
()
{
...
...
@@ -395,6 +393,7 @@ export default {
covertServerData
(
serverData
)
{
this
.
dialogForm
=
JSON
.
parse
(
JSON
.
stringify
(
serverData
));
const
{
faceImage
,
faceImageUrl
,
faceImagePressUrl
,
imagesVo
,
...
...
@@ -407,7 +406,11 @@ export default {
file3dUrl
,
}
=
this
.
dialogForm
;
this
.
dialogForm
.
status
=
statusStrToBool
(
status
);
this
.
faceImage
=
faceImageToClient
(
faceImagePressUrl
,
faceImageUrl
);
this
.
faceImage
=
faceImageToClient
(
faceImage
,
faceImageUrl
,
faceImagePressUrl
);
this
.
file3d
=
file3dToClient
(
file3d
,
file3dUrl
);
this
.
images
=
imagesVo
||
[];
this
.
videos
=
videosVo
||
[];
...
...
@@ -438,17 +441,6 @@ export default {
}
},
500
);
},
// 取消编辑
cancelForm
()
{
this
.
$emit
(
"handleClose"
);
if
(
this
.
loading
)
{
this
.
loading
=
false
;
}
if
(
this
.
submitLoading
)
{
this
.
submitLoading
=
false
;
}
this
.
reset
();
},
/**
* @param {Object} dialogForm 当前表单
...
...
@@ -465,6 +457,8 @@ export default {
this
.
$refs
.
form
.
validate
(
async
(
valid
,
err
)
=>
{
if
(
valid
)
{
this
.
submitLoading
=
true
;
// console.log('this.removedIds',this.removedIds);
// return
this
.
uploadMediaFiles
(
this
.
mediaKeys
,
this
.
dialogForm
)
.
then
(
async
(
mediaForm
)
=>
{
// console.log(mediaForm);
...
...
@@ -477,12 +471,16 @@ export default {
form
.
years
=
this
.
processYear
(
years
);
form
.
textureType
=
this
.
processTextureType
(
textureType
);
form
.
deptId
=
getDeptIdStr
(
deptId
);
le
t
res
=
await
addOrUpdateCulturalRelic
(
form
);
cons
t
res
=
await
addOrUpdateCulturalRelic
(
form
);
this
.
submitLoading
=
false
;
if
(
res
.
code
==
0
)
{
this
.
$message
.
success
(
"提交成功!"
);
const
{
handleDeleteFiles
}
=
fileUploadFunctions
;
handleDeleteFiles
(
this
.
removedIds
);
this
.
visible
=
false
;
this
.
reset
();
this
.
$emit
(
"refresh"
);
this
.
$emit
(
"handleClose"
);
// 提交成功后再删除,因为可能没成功的话要保留原本的数据
}
})
.
catch
((
err
)
=>
{
...
...
@@ -529,9 +527,7 @@ export default {
getNewIdsObj
,
getOldIdsObj
,
getMergedIdsObj
,
getDeleteFileArr
,
isFormDataHasData
,
handleDeleteFiles
,
}
=
fileUploadFunctions
;
const
formData
=
getNeedUploadFormData
(
this
,
mediaKeys
);
try
{
...
...
@@ -541,26 +537,16 @@ export default {
let
upLoadRes
=
await
uploadV1
(
formData
);
if
(
upLoadRes
.
code
==
0
)
{
const
newIdObj
=
getNewIdsObj
(
mediaKeys
,
upLoadRes
);
const
oldIdObj
=
getOldIdsObj
(
mediaKeys
,
dialogForm
);
const
mergedIdObj
=
getMergedIdsObj
(
oldIdObj
,
newIdObj
,
mediaKeys
);
const
deleteIdArr
=
getDeleteFileArr
(
oldIdObj
,
newIdObj
,
mediaKeys
);
handleDeleteFiles
(
deleteIdArr
);
console
.
log
(
"mergedFileIdsObj"
,
mergedIdObj
);
console
.
log
(
"deleteFiles"
,
deleteIdArr
);
console
.
log
(
"uploadMediaFiles done"
);
resolve
(
mergedIdObj
);
const
oldIdObj
=
getOldIdsObj
(
mediaKeys
,
dialogForm
,
this
);
const
mediaForm
=
getMergedIdsObj
(
oldIdObj
,
newIdObj
,
mediaKeys
);
console
.
log
(
"mediaForm"
,
mediaForm
);
resolve
(
mediaForm
);
}
}
else
{
console
.
log
(
"uploadMediaFiles nothing to upload"
);
resolve
({});
// 没有任何媒体需要上传的,把已有的交给后面
const
mediaForm
=
getOldIdsObj
(
mediaKeys
,
dialogForm
,
this
);
console
.
log
(
"uploadMediaFiles nothing to upload"
,
mediaForm
);
resolve
(
mediaForm
);
}
}
catch
(
error
)
{
console
.
error
(
"uploadMediaFiles error"
);
...
...
@@ -572,31 +558,39 @@ export default {
handleClose
(
done
)
{
this
.
$confirm
(
"确认关闭?"
)
.
then
((
_
)
=>
{
done
();
this
.
$emit
(
"handleClose"
);
this
.
visible
=
false
;
this
.
reset
();
this
.
submitLoading
=
false
;
if
(
this
.
loading
)
{
this
.
loading
=
false
;
}
if
(
this
.
submitLoading
)
{
this
.
submitLoading
=
false
;
}
done
();
})
.
catch
((
_
)
=>
{});
},
// 清空编辑组件中的所有值
reset
()
{
//父组件将清空form绑定的值
// 清空文献
this
.
dialogForm
=
{};
this
.
literatureIdArr
=
[];
this
.
images
=
[];
this
.
videos
=
[];
this
.
audios
=
[];
this
.
faceImage
=
[];
this
.
$refs
.
form
.
resetFields
();
this
.
removedIds
=
[];
this
.
file3d
=
[];
this
.
$refs
.
form
?.
resetFields
();
},
refresh
()
{
this
.
$emit
(
"refresh"
);
},
editorInput
(
e
)
{
console
.
log
(
e
);
getRemovedIds
(
removedIds
)
{
this
.
removedIds
=
[...
new
Set
([...
this
.
removedIds
,
...
removedIds
])];
console
.
log
(
"this.removedIds"
,
this
.
removedIds
);
},
},
};
...
...
src/views/culturalRelic/configs/fileUploadFuctions.js
deleted
100644 → 0
浏览文件 @
7018502f
/**
* 本文件用于处理文物的相关文件上传过程中的函数
* 注意不要使用this可能导致找不到等问题,内部调用内部方法时直接使用fileUploadFuctions
*/
const
fileUploadFuctions
=
{
/**
* 判断文件是否上传过
* @param {File | Object} file 文件对象,可能是File可能就是普通对象
* @returns {Boolean} 文件是否上传过
*/
isFileRaw
(
file
)
{
let
isFileRaw
=
false
;
isFileRaw
=
file
.
status
&&
file
.
status
==
"ready"
;
return
isFileRaw
;
},
/**
* 判断formData中是否有数据
* @param {FormData} formData 文件对象,可能是File可能就是普通对象
* @returns {Boolean} formData中是否有数据
*/
isFormDataHasData
(
formData
)
{
const
formDataArr
=
Array
.
from
(
formData
.
entries
(),
([
key
,
prop
])
=>
({
[
key
]:
{
ContentLength
:
typeof
prop
===
"string"
?
prop
.
length
:
prop
.
size
,
},
}));
return
formDataArr
.
length
>
0
;
},
/**
* 获取对应媒体下的文件
* @param {string} mediaKey 媒体key
* @returns {Array} 媒体对应的文件
*/
getMediaFile
(
$el
,
mediaKey
)
{
return
$el
.
$refs
[
mediaKey
].
getFiles
();
},
/**
* 获取需要上传的FormData
* @param {Array} mediaKeys 媒体keys数组
* @returns {FormData} formData 需要上传的formdata
*/
getNeedUploadFormData
(
$el
,
mediaKeys
)
{
const
formData
=
new
FormData
();
mediaKeys
.
forEach
((
mediaKey
)
=>
{
const
currentFileList
=
fileUploadFuctions
.
getMediaFile
(
$el
,
mediaKey
);
currentFileList
.
forEach
((
file
)
=>
{
if
(
fileUploadFuctions
.
isFileRaw
(
file
))
{
formData
.
append
(
mediaKey
,
file
.
raw
);
}
});
});
return
formData
;
},
/**
* 获取需要已经存在(数据库已存储的)文件ID对象
* @param {Array} mediaKeys 媒体keys数组
* @returns {Object} 已经存在(数据库已存储的)文件ID对象
*/
getOldIdsObj
(
mediaKeys
,
dialogForm
)
{
let
oldFileIdsObj
=
{};
mediaKeys
.
forEach
((
key
)
=>
{
if
(
dialogForm
[
key
])
{
oldFileIdsObj
[
key
]
=
dialogForm
[
key
];
}
else
{
oldFileIdsObj
[
key
]
=
""
;
}
});
return
oldFileIdsObj
;
},
/**
* 获取返回结果中的文件id对象
* @param {Array} mediaKeys 媒体keys数组
* @param {Object} requestRes 上传返回的数据对象
* @returns {Object} 新上传的文件id对象
*/
getNewIdsObj
(
mediaKeys
,
requestRes
)
{
let
newUploadedFileIdsObj
=
{};
mediaKeys
.
forEach
((
key
)
=>
{
newUploadedFileIdsObj
[
key
]
=
fileUploadFuctions
.
getResIdStrByMedia
(
key
,
requestRes
);
});
return
newUploadedFileIdsObj
;
},
/**
* 获取上传返回结果中的id字符串
* @param {Array} mediaKeys 媒体keys数组
* @param {Object} requestRes 上传返回的数据对象
* @returns {string} 新上传的文件id字符串
*/
getResIdStrByMedia
(
mediaKey
,
requestRes
)
{
const
arr
=
[];
requestRes
.
data
.
forEach
((
item
)
=>
{
if
(
item
.
fileKey
==
mediaKey
)
{
arr
.
push
(
item
.
fileId
);
}
});
const
str
=
arr
.
length
>
0
?
arr
.
join
(
","
)
:
""
;
return
str
;
},
/**
* 获取新旧合并的文件id对象
* @param {Array} mediaKeys 媒体keys数组
* @param {Object} oldObj 已经存在的
* @param {Object} newObj 新上传的
* @returns {string} 新上传的文件id字符串
*/
getMergedIdsObj
(
oldObj
,
newObj
,
mediaKeys
)
{
const
obj
=
{};
mediaKeys
.
forEach
((
key
)
=>
{
let
newArr
=
newObj
[
key
].
split
(
","
);
let
oldArr
=
oldObj
[
key
].
split
(
","
);
let
fullArr
=
[...
new
Set
([...
newArr
,
...
oldArr
])];
let
fullStr
=
fullArr
.
join
(
","
);
obj
[
key
]
=
fullStr
.
substring
(
0
,
fullStr
.
length
-
1
);
});
return
obj
;
},
/**
* 获取需要被删除的文件ID合集
* @param {Array} mediaKeys 媒体keys数组
* @param {Object} dialogForm 表单对象
* @param {Object} newUploadedFileIdsObj 最新上传之后的
* @returns {Object} 新上传的文件id对象
*/
getDeleteFileArr
(
oldObj
,
newObj
,
mediaKeys
)
{
const
arr
=
[];
mediaKeys
.
forEach
((
key
)
=>
{
let
newArr
=
newObj
[
key
].
split
(
","
);
let
oldArr
=
oldObj
[
key
].
split
(
","
);
let
fullArr
=
[...
new
Set
([...
newArr
,
...
oldArr
])];
oldArr
.
forEach
((
oldId
)
=>
{
if
(
!
fullArr
.
includes
(
oldId
))
{
arr
.
push
(
oldId
);
}
});
});
return
arr
;
},
};
export
default
fileUploadFuctions
;
src/views/culturalRelic/configs/list.js
浏览文件 @
d1ec8d4f
...
...
@@ -107,17 +107,7 @@ export const passedTitle = [{
columnAlign
:
'center'
,
showOverFlowToolTip
:
true
,
},
{
prop
:
"checkStatus"
,
label
:
"审核状态"
,
columnAlign
:
'center'
,
},
{
prop
:
"checkRemark"
,
label
:
"审核意见"
,
columnAlign
:
'center'
,
showOverFlowToolTip
:
true
,
},
{
prop
:
"remark"
,
label
:
"备注"
,
...
...
@@ -158,16 +148,16 @@ export const unPassedTitle = [{
// columnAlign: 'center',
// isCulturalRelicType:true
// },
//
{
//
prop: "createId",
//
label: "创建人",
//
columnAlign: 'center',
//
},
//
{
//
prop: "createTime",
//
label: "创建时间",
//
columnAlign: 'center',
//
},
{
prop
:
"createId"
,
label
:
"创建人"
,
columnAlign
:
'center'
,
},
{
prop
:
"createTime"
,
label
:
"创建时间"
,
columnAlign
:
'center'
,
},
{
prop
:
"deptName"
,
...
...
@@ -175,12 +165,12 @@ export const unPassedTitle = [{
columnAlign
:
'center'
,
showOverFlowToolTip
:
true
,
},
//
{
//
prop: "regionName",
//
label: "所属地",
//
columnAlign: 'center',
//
showOverFlowToolTip: true,
//
},
{
prop
:
"regionName"
,
label
:
"所属地"
,
columnAlign
:
'center'
,
showOverFlowToolTip
:
true
,
},
// {
// prop: "intro",
// label: "馆藏介绍",
...
...
@@ -214,30 +204,40 @@ export const unPassedTitle = [{
// columnAlign: 'center',
// },
// {
// prop: "loveCount",
// label: "点赞量",
// columnAlign: 'center',
// sortable: true
// },
// {
// prop: "collectCount",
// label: "收藏量",
// columnAlign: 'center', sortable: true
// },
// {
// prop: "browseCount",
// label: "浏览量",
// columnAlign: 'center', sortable: true
// },
// {
// prop: "sourceWay",
// label: "来源方式",
// columnAlign: 'center',
// showOverFlowToolTip: true,
// },
{
prop
:
"
loveCount
"
,
label
:
"
点赞量
"
,
prop
:
"
checkStatus
"
,
label
:
"
审核状态
"
,
columnAlign
:
'center'
,
sortable
:
true
},
{
prop
:
"collectCount"
,
label
:
"收藏量"
,
columnAlign
:
'center'
,
sortable
:
true
},
{
prop
:
"browseCount"
,
label
:
"浏览量"
,
columnAlign
:
'center'
,
sortable
:
true
},
{
prop
:
"sourceWay"
,
label
:
"来源方式"
,
prop
:
"checkRemark"
,
label
:
"审核意见"
,
columnAlign
:
'center'
,
showOverFlowToolTip
:
true
,
},
{
prop
:
"remark"
,
label
:
"备注"
,
...
...
src/views/culturalRelic/configs/transformData.js
deleted
100644 → 0
浏览文件 @
7018502f
const
transformData
=
{
/**
* 转换服务器的封面数据到前端可用的封面数据
* @param {String} faceImagePressUrl 压缩过得封面
* @param {String} faceImageUrl 封面原图
* @returns {Array} el-upload组件需要的数据
*/
faceImageToClient
(
faceImagePressUrl
,
faceImageUrl
)
{
if
(
!
faceImageUrl
)
{
return
[];
}
const
faceImage
=
[
{
name
:
""
,
url
:
faceImageUrl
||
""
,
pressUrl
:
faceImagePressUrl
||
faceImageUrl
||
""
,
fileId
:
faceImage
||
""
,
},
];
return
faceImage
;
},
/**
* 转换服务器的封面数据到前端可用的3D模型数据
* @param {String} file3d 3D文件ID
* @param {String} file3dUrl 3D文件url
* @returns {Array} el-upload组件需要的数据
*/
file3dToClient
(
file3d
,
file3dUrl
)
{
if
(
!
file3d
)
{
return
[];
}
const
file3dArr
=
[
{
name
:
""
,
url
:
file3dUrl
||
""
,
fileId
:
file3d
||
""
,
},
];
return
file3dArr
;
},
/**
*
* @param {Array} arr 文献id数组
* @returns {String} 提交给服务器需要的以逗号隔开的字符串
*/
literatureIdArrToStr
(
arr
)
{
let
str
=
""
;
if
(
arr
.
length
==
0
)
{
return
""
;
}
const
result
=
arr
.
join
(
","
);
str
=
result
.
substring
(
0
,
result
.
length
-
1
);
return
str
;
},
/**
*
* @param {Array} literatureVo 文献数组,每个条目是一个文献对象
* @returns {Array} 文献ID集合
*/
literatureListToIds
(
literatureVo
)
{
if
(
!
literatureVo
||
literatureVo
.
length
==
0
)
{
return
[];
}
else
{
const
ids
=
literatureVo
.
map
((
item
)
=>
{
return
item
.
ids
;
});
return
ids
;
}
},
/**
* 转换状态从布尔型到数值型
* @param {Boolean} statusBoolean 布尔值的状态
* @returns {Number} 提交给服务器需要的以逗号隔开的数值
*/
statusBoolToNum
(
statusBoolean
)
{
const
statusNumber
=
statusBoolean
?
1
:
0
;
return
statusNumber
;
},
/**
* 转换状态从数值型到布尔型
* @param {String} statusString 字符串型的状态
* @returns {Boolean} 组件需要的布尔值
*/
statusStrToBool
(
statusString
)
{
const
statusBoolean
=
Boolean
(
Number
(
statusString
));
return
statusBoolean
;
},
/**
* 回填馆藏单位
* @param {String} deptId 部门ID
* @param {Object} userInfo 当前用户的信息
* @returns {Array} 符合element-ui使用的数组
*/
getDeptIdArr
(
deptId
,
userInfo
)
{
let
deptIdArr
=
[];
if
(
deptId
)
{
deptIdArr
=
[
deptId
];
}
else
if
(
userInfo
)
{
deptIdArr
=
[
userInfo
.
deptId
];
}
return
deptIdArr
;
},
/**
* 回填馆藏单位
* @param {Array} deptArr 部门ID集合
* @returns {String} 部门ID字符串
*/
getDeptIdStr
(
deptArr
)
{
let
str
=
""
;
if
(
deptArr
.
length
==
0
)
{
return
""
;
}
const
result
=
deptArr
.
join
(
","
);
str
=
result
.
substring
(
0
,
result
.
length
-
1
);
return
str
;
},
};
export
default
transformData
;
src/views/culturalRelic/index.vue
浏览文件 @
d1ec8d4f
...
...
@@ -54,7 +54,7 @@
</el-tabs>
<TablePage
:data=
"getCurrentList().records"
:tableTitle=
"
passed
Title"
:tableTitle=
"
get
Title"
:operates=
"operates"
>
<template
v-slot:status=
"data"
>
...
...
@@ -107,12 +107,7 @@
</el-pagination>
</div>
<InfoEditDialog
:visible=
"editVisible"
:form=
"form"
@
handleClose=
"handleEditClose"
@
refresh=
"loadData"
/>
<InfoEditDialog
ref=
"InfoEditDialog"
:form=
"form"
@
refresh=
"loadData"
/>
<UploadDialog
ref=
"UploadDialog"
@
update=
"loadData"
/>
<ImportRecordDialog
...
...
@@ -156,6 +151,7 @@ import InfoEditDialog from "./components/InfoEditDialog";
import
UploadDialog
from
"./components/UploadDialog"
;
import
ImportRecordDialog
from
"./components/ImportRecordDialog"
;
import
View3dDialog
from
"./components/View3dDialog"
;
import
{
rules
}
from
"./configs/validateRules"
;
export
default
{
components
:
{
...
...
@@ -183,30 +179,7 @@ export default {
},
searchConfig
,
editVisible
:
false
,
//编辑
form
:
{
name
:
""
,
//名称
type
:
""
,
//类别(字典值)
level
:
""
,
//文物级别(字典值)
textureType
:
""
,
//质地(字典值)
detailSize
:
""
,
// 具体尺寸
years
:
""
,
//年代
num
:
1
,
//数量
deptId
:
""
,
//收藏馆id——新增传当前用户的deptId
intro
:
""
,
//馆藏介绍
literature
:
""
,
//关联文献。id1,id2,id3
// directory:'',// 文件夹(字母或者数字命名)
// regionCode:'',//所属地(分号分隔的编号)——传当前用户的regionCode
sourceWay
:
""
,
//来源方式
sayExplain
:
""
,
//讲解词文件。文件id
status
:
true
,
//上下架状态(0-下架,1-上架)
// flag3d:'',//是否有3D图片(字典值:1-有;0-无)
themeWord
:
""
,
//主题词
url3d
:
""
,
//3durl链接
remark
:
""
,
//备注
audios
:
""
,
//音频文件(文件id)
images
:
""
,
//图片文件(文件id,多个以逗号隔开)
videos
:
""
,
//视频文件(文件id)
},
form
:
{},
loading
:
false
,
imgViewerVisible
:
false
,
importRecordVisible
:
false
,
//上传记录
...
...
@@ -228,6 +201,9 @@ export default {
},
},
computed
:
{
getTitle
()
{
return
this
.
tabActive
==
"passed"
?
this
.
passedTitle
:
this
.
unPassedTitle
;
},
getStatusTitle
(
status
)
{
return
(
status
)
=>
{
if
(
Number
(
status
))
{
...
...
@@ -303,14 +279,37 @@ export default {
async
handleOperation
(
value
,
row
)
{
switch
(
value
.
type
)
{
case
"add"
:
this
.
editVisible
=
true
;
this
.
form
=
{
name
:
""
,
//名称
type
:
""
,
//类别(字典值)
level
:
""
,
//文物级别(字典值)
textureType
:
""
,
//质地(字典值)
detailSize
:
""
,
// 具体尺寸
years
:
""
,
//年代
num
:
1
,
//数量
deptId
:
""
,
//收藏馆id——新增传当前用户的deptId
intro
:
""
,
//馆藏介绍
literature
:
""
,
//关联文献。id1,id2,id3
// directory:'',// 文件夹(字母或者数字命名)
// regionCode:'',//所属地(分号分隔的编号)——传当前用户的regionCode
sourceWay
:
""
,
//来源方式
sayExplain
:
""
,
//讲解词文件。文件id
status
:
1
,
//上下架状态(0-下架,1-上架)
// flag3d:'',//是否有3D图片(字典值:1-有;0-无)
themeWord
:
""
,
//主题词
url3d
:
""
,
//3durl链接
remark
:
""
,
//备注
audios
:
""
,
//音频文件(文件id)
images
:
""
,
//图片文件(文件id,多个以逗号隔开)
videos
:
""
,
//视频文件(文件id)
};
this
.
$refs
.
InfoEditDialog
.
visible
=
true
;
break
;
case
"view3D"
:
console
.
log
(
value
,
row
);
this
.
$refs
.
View3dDialog
.
visible
=
true
;
break
;
case
"edit"
:
console
.
log
(
value
,
row
)
;
this
.
$refs
.
InfoEditDialog
.
visible
=
true
;
let
detailRes
=
await
getRCDetailByIdTemp
({
crId
:
row
.
crId
});
if
(
detailRes
.
code
==
0
)
{
this
.
form
=
detailRes
.
data
;
...
...
src/views/display/components/InfoEditDialog.vue
浏览文件 @
d1ec8d4f
...
...
@@ -527,6 +527,7 @@ export default {
this
.
currentId
=
this
.
dialogForm
.
exhibitionId
;
}
const
{
faceImage
,
faceImageUrl
,
faceImagePressUrl
,
imagesVo
,
...
...
@@ -537,7 +538,7 @@ export default {
deptId
,
exhibitionUnits
,
}
=
this
.
dialogForm
;
this
.
faceImage
=
faceImageToClient
(
faceImage
PressUrl
,
faceImageUrl
);
this
.
faceImage
=
faceImageToClient
(
faceImage
,
faceImageUrl
,
faceImagePressUrl
);
this
.
images
=
imagesVo
||
[];
this
.
videos
=
videosVo
||
[];
this
.
audios
=
audiosVo
||
[];
...
...
src/views/displayApproval/index.vue
浏览文件 @
d1ec8d4f
...
...
@@ -64,11 +64,24 @@
@
handleClose=
"handleClosePreviewDialog"
@
refresh=
"loadData"
/>
<CrInfoEditDialog
ref=
"CrInfo"
:form=
"form"
@
refresh=
"loadData"
/>
<DisplayInfoEditDialog
ref=
"CrInfo"
:form=
"form"
@
handleClose=
"handleEditClose"
@
refresh=
"loadData"
/>
</div>
</template>
<
script
>
import
PreviewDialog
from
"./components/PreviewDialog.vue"
;
import
CrInfoEditDialog
from
"@/views/culturalRelic/components/InfoEditDialog"
;
import
DisplayInfoEditDialog
from
"@/views/display/components/InfoEditDialog"
;
import
{
approvleTableTitle
,
operates
,
...
...
@@ -76,11 +89,19 @@ import {
approvalButton
,
reSubmitButtton
,
}
from
"./config"
;
import
{
getFlowListPagePer
,
getFlowDetailById
}
from
"@/api/approval"
;
import
{
getFlowListPagePer
,
getFlowDetailById
,
getFlowCulturalRelicDetail
,
getFlowExhibitionDetail
,
}
from
"@/api/approval"
;
import
{
mapGetters
}
from
"vuex"
;
export
default
{
components
:
{
PreviewDialog
,
CrInfoEditDialog
,
DisplayInfoEditDialog
,
},
data
()
{
return
{
...
...
@@ -125,6 +146,8 @@ export default {
operates
,
// operations,
approvleTableTitle
,
resubmitCrInfo
:{},
//重传的文物信息
resubmitDisplayInfo
:{},
//重传的展览信息
};
},
computed
:
{
...
...
@@ -192,11 +215,76 @@ export default {
}
},
resubmit
(
row
)
{
const
{
addWay
,
sourceType
}
=
row
;
// const isMultiCr = addWay==''
async
resubmit
(
row
)
{
console
.
log
(
row
);
// return
const
{
addWay
,
sourceType
,
id
}
=
row
;
console
.
log
(
addWay
,
sourceType
);
const
isManual
=
sourceType
==
"手动添加"
;
switch
(
sourceType
)
{
case
"文物"
:
if
(
isManual
)
{
const
params
=
{
crId
:
""
,
//TODO:问后端文物ID是什么,row里面没有
flowId
:
id
,
};
const
res
=
await
getFlowCulturalRelicDetail
(
params
);
if
(
res
.
code
==
0
)
{
this
.
openResubmitDialog
(
"CrInfo"
);
this
.
resubmitCrInfo
=
res
.
data
;
}
}
else
{
this
.
openResubmitDialog
(
"CrMulti"
);
}
break
;
case
"展览展示"
:
if
(
isManual
)
{
const
params
=
{
exhibitionId
:
""
,
//TODO:问后端展览ID是什么,row里面没有
flowId
:
id
,
};
const
res
=
await
getFlowExhibitionDetail
(
params
);
if
(
res
.
code
==
0
)
{
this
.
openResubmitDialog
(
"DisplayInfo"
);
this
.
resubmitDisplayInfo
=
res
.
data
;
}
}
else
{
this
.
openResubmitDialog
(
"DisplayMulti"
);
}
break
;
}
},
// 打开文物编辑重传弹窗
openResubmitDialog
(
name
)
{
this
.
$refs
[
name
].
visible
=
true
;
},
// 关闭文物编辑重传弹窗
closeResubmitDialog
(
name
)
{
this
.
$refs
[
name
].
visible
=
false
;
},
// // 关闭批量文物重传弹窗
// closeResubmitCrMulti() {
// this.$refs.CrMultiResubmit.visible = false;
// },
// // 打开展览编辑重传弹窗
// openResubmitDisplayInfo() {
// this.displayInfoResubmitVisible = true;
// },
// // 打开整量展览重传弹窗
// openResubmitDislayMulti() {
// this.displayMultiResubmitVisible = true;
// },
// // 打开文物编辑重传弹窗
// closeResubmitDisplayInfo() {
// this.displayInfoResubmitVisible = false;
// },
// // 打开批量文物重传弹窗
// closeResubmitDislayMulti() {
// this.displayMultiResubmitVisible = false;
// },
// 多选
handleSelectionChange
(
val
)
{
this
.
multipleSelection
=
val
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论