安全培训管理:完成视频上传
This commit is contained in:
parent
cfb6fd20ab
commit
ef76f2b97a
@ -62,6 +62,7 @@ export default {
|
|||||||
'每日交底(大工程交底)',
|
'每日交底(大工程交底)',
|
||||||
],
|
],
|
||||||
signInInfo:'签到信息',
|
signInInfo:'签到信息',
|
||||||
|
trainVideo:'教学视频上传',
|
||||||
photo:'培训照片',
|
photo:'培训照片',
|
||||||
trainDateTime:'培训时间',
|
trainDateTime:'培训时间',
|
||||||
selectWorker: '选择工人',
|
selectWorker: '选择工人',
|
||||||
|
|||||||
@ -253,23 +253,35 @@
|
|||||||
<el-form-item :label="$t('message.laborDev.trainPersonNum')">
|
<el-form-item :label="$t('message.laborDev.trainPersonNum')">
|
||||||
<el-input :value="cardForm.list.length" disabled></el-input>
|
<el-input :value="cardForm.list.length" disabled></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<!-- 签到信息 -->
|
||||||
<el-form-item :label="$t('message.laborDev.signInInfo')" prop="list">
|
<el-form-item :label="$t('message.laborDev.signInInfo')" prop="list">
|
||||||
<el-button type="primary" @click="selectWorkerDialog = true">
|
<el-button type="primary" @click="selectWorkerDialog = true" style="margin-right: 200px">
|
||||||
{{ $t("message.laborDev.selectWorker") }}
|
{{ $t("message.laborDev.selectWorker") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- 添加上传相关材料 -->
|
</el-form-item>
|
||||||
<el-upload
|
<!-- 教学视频上传 -->
|
||||||
name="files"
|
<el-form-item :label="$t('message.laborDev.trainVideo')" prop="uploadAttachments" >
|
||||||
class="upload-demo uploadBtn"
|
<div class="videoUpload">
|
||||||
:action="$store.state.UPLOADURL"
|
<el-upload
|
||||||
multiple
|
name="files"
|
||||||
:file-list="fileList"
|
:action="$store.state.UPLOADURL"
|
||||||
:on-preview="handlePreview"
|
multiple
|
||||||
:on-success="handleSuccess"
|
:file-list="fileList"
|
||||||
:show-file-list="false"
|
:on-success="handleSuccess"
|
||||||
>
|
:before-upload="beforeUpload"
|
||||||
<el-button type="primary">材料上传</el-button>
|
:show-file-list="false"
|
||||||
</el-upload>
|
>
|
||||||
|
<el-button type="primary">教学视频上传</el-button>
|
||||||
|
</el-upload>
|
||||||
|
<template v-if="cardForm.uploadAttachments">
|
||||||
|
<video width="120" height="80" controls autoplay style="margin-left: 10px">
|
||||||
|
<source :src="$store.state.FILEURL + cardForm.uploadAttachments" type="video/mp4">
|
||||||
|
<source :src="$store.state.FILEURL + cardForm.uploadAttachments" type="video/ogg">
|
||||||
|
<source :src="$store.state.FILEURL + cardForm.uploadAttachments" type="video/x-ms-wmv">
|
||||||
|
您的浏览器不支持 video 标签。
|
||||||
|
</video>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- 培训照片 -->
|
<!-- 培训照片 -->
|
||||||
<el-form-item :label="$t('message.laborDev.photo')" prop="photo" >
|
<el-form-item :label="$t('message.laborDev.photo')" prop="photo" >
|
||||||
@ -281,7 +293,7 @@
|
|||||||
:action="$store.state.UPLOADURL"
|
:action="$store.state.UPLOADURL"
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:on-success="file => handleUpload(file, i)"
|
:on-success="file => handleUpload(file, i)"
|
||||||
:before-upload="beforeAvatarUpload">
|
>
|
||||||
<img v-if="cardForm[`edu${i === 1 ? 'Before': i === 2 ? 'In' : 'After'}Photo`]"
|
<img v-if="cardForm[`edu${i === 1 ? 'Before': i === 2 ? 'In' : 'After'}Photo`]"
|
||||||
:src="$store.state.FILEURL + cardForm[`edu${i === 1 ? 'Before': i === 2 ? 'In' : 'After'}Photo`]"
|
:src="$store.state.FILEURL + cardForm[`edu${i === 1 ? 'Before': i === 2 ? 'In' : 'After'}Photo`]"
|
||||||
class="photo">
|
class="photo">
|
||||||
@ -435,6 +447,12 @@ import {
|
|||||||
export default {
|
export default {
|
||||||
components: { selectWorker },
|
components: { selectWorker },
|
||||||
data() {
|
data() {
|
||||||
|
const validateConfig = {
|
||||||
|
required: true,
|
||||||
|
message: this.$t("message.personnelPosition.mandatory"),
|
||||||
|
trigger: "blur",
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uploadaurl:'',
|
uploadaurl:'',
|
||||||
fileList:[],
|
fileList:[],
|
||||||
@ -468,27 +486,10 @@ export default {
|
|||||||
projectSn: this.$store.state.projectSn,
|
projectSn: this.$store.state.projectSn,
|
||||||
},
|
},
|
||||||
cardFormRules: {
|
cardFormRules: {
|
||||||
eduCourseName: [
|
eduCourseName: [validateConfig],
|
||||||
{
|
eduTime: [validateConfig],
|
||||||
required: true,
|
list: [validateConfig],
|
||||||
message: this.$t("message.personnelPosition.mandatory"),
|
uploadAttachments: [validateConfig],
|
||||||
trigger: "blur",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
eduTime: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: this.$t("message.personnelPosition.mandatory"),
|
|
||||||
trigger: "blur",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
list: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: this.$t("message.personnelPosition.mandatory"),
|
|
||||||
trigger: "blur",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
isAdd: false,
|
isAdd: false,
|
||||||
allPersonList: [],
|
allPersonList: [],
|
||||||
@ -508,25 +509,24 @@ export default {
|
|||||||
this.cardForm[`edu${num === 1 ? 'Before': num === 2 ? 'In' : 'After'}Photo`] = imageUrl
|
this.cardForm[`edu${num === 1 ? 'Before': num === 2 ? 'In' : 'After'}Photo`] = imageUrl
|
||||||
console.log(this.eduPhoto1,this.eduPhoto2,this.eduPhoto3, num);
|
console.log(this.eduPhoto1,this.eduPhoto2,this.eduPhoto3, num);
|
||||||
},
|
},
|
||||||
handlePreview(file,type){
|
|
||||||
// console.log('file',file)
|
|
||||||
// console.log('fileList',type)
|
|
||||||
},
|
|
||||||
handleSuccess(file,fileList){
|
handleSuccess(file,fileList){
|
||||||
console.log('成功的file',file)
|
console.log('成功的file',file)
|
||||||
this.cardForm.uploadAttachments = file.data[0].filename
|
this.cardForm.uploadAttachments = file.data[0].filename
|
||||||
if(file.status == "SUCCESS"){
|
if(file.status == "SUCCESS"){
|
||||||
this.$message({
|
this.$message({ message: '视频上传成功', type: 'success' });
|
||||||
message: '相关材料上传成功!',
|
|
||||||
type: 'success'
|
|
||||||
});
|
|
||||||
}else{
|
}else{
|
||||||
this.$message({
|
this.$message({ message: '上传失败,请重新上传!', type: 'error' });
|
||||||
message: '上传失败,请重新上传!',
|
|
||||||
type: 'error'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeUpload(file){
|
||||||
|
const videoTypes = ['video/mp4','application/x-mpegURL','video/x-ms-wmv','video/x-msvideo','video/x-flv','video/x-ms-wmv']
|
||||||
|
const type = file.type
|
||||||
|
const flag = videoTypes.includes(type)
|
||||||
|
if (!flag) {
|
||||||
|
this.$message({ message: '只能上传视频', type: 'error' });
|
||||||
|
}
|
||||||
|
return flag
|
||||||
|
},
|
||||||
changeScore(index, value) {
|
changeScore(index, value) {
|
||||||
console.log("changeScore", value, index);
|
console.log("changeScore", value, index);
|
||||||
var json = this.cardForm.list[index];
|
var json = this.cardForm.list[index];
|
||||||
@ -800,4 +800,12 @@ export default {
|
|||||||
/deep/.el-date-editor{
|
/deep/.el-date-editor{
|
||||||
width: 120px;
|
width: 120px;
|
||||||
}
|
}
|
||||||
|
.videoUpload{
|
||||||
|
width: 320px;
|
||||||
|
display: flex;
|
||||||
|
// align-items: center;
|
||||||
|
>div{
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user