视频库上传修改 只有上传到本地
This commit is contained in:
parent
f5fbcac08c
commit
711262a097
467
src/files/edit/PF147 copy.js
Normal file
467
src/files/edit/PF147 copy.js
Normal file
@ -0,0 +1,467 @@
|
|||||||
|
import React, { useEffect, useState } from 'react'
|
||||||
|
import { message, Checkbox, Radio } from "antd/lib/index";
|
||||||
|
import { getPropertyData, guid, extendInclude, extendRule, getDataFieldValue, setDataFieldValue, initFilter, empty, onBeforeSaveHandleRecordLog, Format } from "../../utils/common";
|
||||||
|
import { connect } from 'dva';
|
||||||
|
import moment from 'moment';
|
||||||
|
import config from "../../config.js"
|
||||||
|
import { Button, Row, Col, Form, Input, Upload, Icon, Modal, Spin } from 'antd';
|
||||||
|
import storage from '../../utils/storage'
|
||||||
|
import MD5 from "js-md5"
|
||||||
|
// import PlvVideoUpload from "@polyv/vod-upload-js-sdk/vod-upload-js-sdk.min.js";
|
||||||
|
/**
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
// 编辑 事故事件调查结果填报
|
||||||
|
export default {
|
||||||
|
|
||||||
|
onBeforeEdit: ({ isNew, login, stateData, data, setFieldEditable, getFieldValue, dispatch, ListCheckRiskArea, setFieldValueByBatch, setFieldVisible, setFieldValue }) => {
|
||||||
|
if (!isNew) {
|
||||||
|
setFieldEditable("CODE", false)
|
||||||
|
if (stateData.NAME != undefined && stateData.NAME != null && stateData.ISLOCAL == true && stateData.NAME.length > 0) {
|
||||||
|
setFieldEditable("Nav_Files", false)
|
||||||
|
}
|
||||||
|
if (stateData.ISLOCAL == false) {
|
||||||
|
setFieldEditable("Nav_Files", false)
|
||||||
|
}
|
||||||
|
// if (stateData.Nav_Files) {
|
||||||
|
// getFieldValue("Nav_Files", stateData.Nav_Files)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
//import PlvVideoUpload from "@polyv/vod-upload-js-sdk/vod-upload-js-sdk.min.js"; //此处插入 如果直接导入 发布会报错
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.src = 'https://player.polyv.net/resp/vod-upload-js-sdk/latest/vod-upload-js-sdk.min.js';
|
||||||
|
document.body.appendChild(script);
|
||||||
|
},
|
||||||
|
handleRenderHeadControl(params) {
|
||||||
|
if (params.colConfig.field === 'NAME') {
|
||||||
|
var isEditFile = true//默认显示编辑按钮
|
||||||
|
var isShowFile = false//默认文件显示
|
||||||
|
// import PlvVideoUpload from "@polyv/vod-upload-js-sdk/vod-upload-js-sdk.min.js";
|
||||||
|
|
||||||
|
// const script = document.createElement('script');
|
||||||
|
// script.src = 'https://websdk.videocc.net/vod-upload-js-sdk/latest/vod-upload-js-sdk.min.js';
|
||||||
|
// document.body.appendChild(script);
|
||||||
|
|
||||||
|
//如果显示 本地文件 isShowFile true isEditFile false
|
||||||
|
var p = document.getElementById('upload-info')
|
||||||
|
if (p != null) {
|
||||||
|
p.innerHTML = ' '
|
||||||
|
}
|
||||||
|
if (params.record.ISLOCAL != null && params.record.ISLOCAL == false && params.record.FILE_PATH != null && params.record.FILE_PATH.indexOf('http') > -1) {
|
||||||
|
isShowFile = true
|
||||||
|
isEditFile = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 点播上传SDK 本地可以 发布不行
|
||||||
|
const uploadInput = {
|
||||||
|
key: 'fileBlv',
|
||||||
|
type: "file",
|
||||||
|
id: 'file',
|
||||||
|
accept: '.flv,.avi,.mpg,.mp4,.wmv,.mov,.3gp,.asf',
|
||||||
|
name: 'file',
|
||||||
|
multiple: true,
|
||||||
|
onChange(info) {
|
||||||
|
let uploadFiles = info.target.files
|
||||||
|
if (uploadFiles.length > 0) {
|
||||||
|
console.log('事件触发58')
|
||||||
|
// let PlvVideoUpload;
|
||||||
|
// try {
|
||||||
|
// PlvVideoUpload = require('@polyv/vod-upload-js-sdk/vod-upload-js-sdk.min.js');
|
||||||
|
// // PlvVideoUpload = require('@polyv/vod-upload-js-sdk');
|
||||||
|
// } catch (e) {
|
||||||
|
// console.log(e)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// 授权验证信息3分钟内有效,当 sign 过期时需要调用该方法更新
|
||||||
|
const videoUpload = new PlvVideoUpload({
|
||||||
|
region: 'line1', // auto:自动选择。根据IP的地区自动选择,当IP解析不出时使用默认值。
|
||||||
|
// line1(默认值):华南OSS bucket,对应ab-upload.polyv.net。
|
||||||
|
// line2:华北OSS bucket,对应ab-upload2.polyv.net。
|
||||||
|
events: {
|
||||||
|
Error: (err) => { // 错误事件回调
|
||||||
|
message.error(`上传失败!`);
|
||||||
|
},
|
||||||
|
UploadComplete: (infoResult) => {
|
||||||
|
//数据处理
|
||||||
|
|
||||||
|
// message.success(`上传成功`);
|
||||||
|
} // 全部上传任务完成回调
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var userid = params.colConfig.column.VERIFY_MSG
|
||||||
|
var promptInfo = params.colConfig.column.PROMPT_INFO
|
||||||
|
var secretkey = ""
|
||||||
|
var writeToken = "";
|
||||||
|
if (promptInfo && promptInfo.length > 0 && promptInfo.indexOf('|') > -1) {
|
||||||
|
var promptInfoArr = promptInfo.split('|')
|
||||||
|
secretkey = promptInfoArr[0]
|
||||||
|
writeToken = promptInfoArr[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
var ts = (new Date()).getTime()
|
||||||
|
var sign = MD5(secretkey + ts)
|
||||||
|
var hash = MD5(ts + writeToken)
|
||||||
|
videoUpload.updateUserData({
|
||||||
|
userid: userid, // Polyv云点播账号的ID
|
||||||
|
ptime: ts, // 时间戳
|
||||||
|
sign: sign, // <sign>是根据将secretkey和ts按照顺序拼凑起来的字符串进行MD5计算得到的值(小写)
|
||||||
|
hash: hash, // <hash> 是根据将ts和writeToken按照顺序拼凑起来的字符串进行MD5计算得到的值(小写)
|
||||||
|
});
|
||||||
|
var file = uploadFiles[0]
|
||||||
|
var cataid = '1746673652001'//每个公司对应的文件夹ID不一样 测试环境
|
||||||
|
// "47xlk": 1746673652001 "xlk": 1746673689001, "jd": 1746673724001, "yl": 1746673761001, "bb": 1746674077001, "xt": 1746674428001,
|
||||||
|
if (window.location.href.indexOf('localhost') == -1 && window.location.href.indexOf('47.122') == -1) { //不包含 localhost 正式环境
|
||||||
|
switch (params.record.ORG_ID) {
|
||||||
|
case 'B043B28B-BBC3-C452-6052-4FBA1457ABFA':
|
||||||
|
cataid = '1746673689001'//"xlk": 1746673689001,
|
||||||
|
break
|
||||||
|
case '8F1CF418-8BF3-EA3F-7A6D-FC5D61247008':
|
||||||
|
cataid = '1746674428001'//"xt": 1746674428001,
|
||||||
|
break
|
||||||
|
case 'D9871BA8-0EEC-9E4A-BB87-7D5A540D8913':
|
||||||
|
cataid = '1746673761001'//"yl": 1746673761001
|
||||||
|
break
|
||||||
|
case '8B3C41AA-51B1-7CE9-1879-248A038C1B5C':
|
||||||
|
cataid = '1746673724001'//"jd": 1746673724001
|
||||||
|
break
|
||||||
|
case '3EFD5276-632B-E379-9FF3-7A7546591FCA':
|
||||||
|
cataid = '1746674077001'// "bb": 1746674077001,
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
cataid = '1746673652001'//"47xlk": 1746673652001
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var fileSetting = { // 文件上传相关信息设置
|
||||||
|
title: file.name, // 标题
|
||||||
|
desc: 'jssdk插件上传', // 描述
|
||||||
|
cataid: cataid, // 上传分类目录ID
|
||||||
|
tag: '', // 标签
|
||||||
|
luping: 0, // 是否开启视频课件优化处理,对于上传录屏类视频清晰度有所优化:0为不开启,1为开启
|
||||||
|
keepsource: 0, // 是否源文件播放(不对视频进行编码):0为编码,1为不编码
|
||||||
|
state: '' //用户自定义信息,如果提交了该字段,会在服务端上传完成回调时透传返回。
|
||||||
|
}
|
||||||
|
var html = ''
|
||||||
|
var uploadManager = videoUpload.addFile(
|
||||||
|
file, // file 为待上传的文件对象
|
||||||
|
{
|
||||||
|
FileStarted: function (uploadInfo) { // 文件开始上传回调
|
||||||
|
html = ''
|
||||||
|
document.getElementById('upload-info').innerHTML = ''
|
||||||
|
html += "文件上传开始: " + uploadInfo.fileData.title + "<br>"
|
||||||
|
// console.log("文件上传开始: " + uploadInfo.fileData.title);
|
||||||
|
},
|
||||||
|
FileProgress: function (uploadInfo) { // 文件上传过程返回上传进度信息回调
|
||||||
|
html += "文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%' + "<br>"
|
||||||
|
// console.log("文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%');
|
||||||
|
document.getElementById('upload-info').innerHTML = html
|
||||||
|
},
|
||||||
|
FileStopped: function (uploadInfo) { // 文件暂停上传回调
|
||||||
|
html += "文件上传停止: " + uploadInfo.fileData.title + "<br>"
|
||||||
|
// console.log("文件上传停止: " + uploadInfo.fileData.title);
|
||||||
|
document.getElementById('upload-info').innerHTML = html
|
||||||
|
},
|
||||||
|
FileSucceed: function (uploadInfo) { // 文件上传成功回调
|
||||||
|
html += "文件上传成功: " + uploadInfo.fileData.title + "<br>"
|
||||||
|
// console.log("文件上传成功: " + uploadInfo.fileData.title);
|
||||||
|
document.getElementById('upload-info').innerHTML = html
|
||||||
|
if (params.record.NAME == undefined || params.record.NAME == null || params.record.NAME.length < 1) {
|
||||||
|
const temps = [];
|
||||||
|
// temps.push({ field: 'Nav_Files', value: navFiles })
|
||||||
|
// temps.push({ field: 'IMG_FILE_ID', value: IMG_FILE_ID })
|
||||||
|
temps.push({ field: 'FILE_PATH', value: `http://share.polyv.net/front/video/view?vid=${uploadInfo.fileData.vid}` })
|
||||||
|
temps.push({ field: 'NAME', value: uploadInfo.fileData.filename })
|
||||||
|
temps.push({ field: 'ISLOCAL', value: false })
|
||||||
|
temps.push({ field: 'Nav_Files', value: null })
|
||||||
|
params.setFieldValueByBatch(temps);
|
||||||
|
params.setFieldEditable("Nav_Files", false)
|
||||||
|
message.success(`${uploadInfo.fileData.filename} 上传成功!`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
FileFailed: function (uploadInfo) { // 文件上传失败回调
|
||||||
|
html += "文件上传失败: " + uploadInfo.fileData.title + "<br>"
|
||||||
|
// console.log("文件上传失败: " + uploadInfo.fileData.title);
|
||||||
|
document.getElementById('upload-info').innerHTML = html
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fileSetting
|
||||||
|
);
|
||||||
|
videoUpload.startAll();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// const uploadInput = {
|
||||||
|
// key: 'fileBlv',
|
||||||
|
// type: "file",
|
||||||
|
// id: 'file',
|
||||||
|
// accept: '.flv,.avi,.mpg,.mp4,.wmv,.mov,.3gp,.asf',
|
||||||
|
// name: 'file',
|
||||||
|
// multiple: true,
|
||||||
|
// onChange(info) {
|
||||||
|
// let uploadFiles = info.target.files
|
||||||
|
// if (uploadFiles.length > 0) {
|
||||||
|
// // let PlvVideoUpload;
|
||||||
|
// // try {
|
||||||
|
// // PlvVideoUpload = require('@polyv/vod-upload-js-sdk/vod-upload-js-sdk.min.js');
|
||||||
|
// // // PlvVideoUpload = require('@polyv/vod-upload-js-sdk');
|
||||||
|
// // } catch (e) {
|
||||||
|
// // console.log(e)
|
||||||
|
// // }
|
||||||
|
// //
|
||||||
|
// // 授权验证信息3分钟内有效,当 sign 过期时需要调用该方法更新
|
||||||
|
// const videoUpload = new PlvVideoUpload({
|
||||||
|
// region: 'line1', // auto:自动选择。根据IP的地区自动选择,当IP解析不出时使用默认值。
|
||||||
|
// // line1(默认值):华南OSS bucket,对应ab-upload.polyv.net。
|
||||||
|
// // line2:华北OSS bucket,对应ab-upload2.polyv.net。
|
||||||
|
// events: {
|
||||||
|
// Error: (err) => { // 错误事件回调
|
||||||
|
// message.error(`上传失败!`);
|
||||||
|
// },
|
||||||
|
// UploadComplete: (infoResult) => {
|
||||||
|
// //数据处理
|
||||||
|
|
||||||
|
// // message.success(`上传成功`);
|
||||||
|
// } // 全部上传任务完成回调
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// console.log('事件触发60')
|
||||||
|
// var userid = params.colConfig.column.VERIFY_MSG
|
||||||
|
// var promptInfo = params.colConfig.column.PROMPT_INFO
|
||||||
|
// var secretkey = ""
|
||||||
|
// var writeToken = "";
|
||||||
|
// if (promptInfo && promptInfo.length > 0 && promptInfo.indexOf('|') > -1) {
|
||||||
|
// var promptInfoArr = promptInfo.split('|')
|
||||||
|
// secretkey = promptInfoArr[0]
|
||||||
|
// writeToken = promptInfoArr[1]
|
||||||
|
// }
|
||||||
|
|
||||||
|
// var ts = (new Date()).getTime()
|
||||||
|
// var sign = MD5(secretkey + ts)
|
||||||
|
// var hash = MD5(ts + writeToken)
|
||||||
|
// videoUpload.updateUserData({
|
||||||
|
// userid: userid, // Polyv云点播账号的ID
|
||||||
|
// ptime: ts, // 时间戳
|
||||||
|
// sign: sign, // <sign>是根据将secretkey和ts按照顺序拼凑起来的字符串进行MD5计算得到的值(小写)
|
||||||
|
// hash: hash, // <hash> 是根据将ts和writeToken按照顺序拼凑起来的字符串进行MD5计算得到的值(小写)
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
// var file = uploadFiles[0]
|
||||||
|
// var cataid = '1746673652001'//每个公司对应的文件夹ID不一样 测试环境
|
||||||
|
// // "47xlk": 1746673652001 "xlk": 1746673689001, "jd": 1746673724001, "yl": 1746673761001, "bb": 1746674077001, "xt": 1746674428001,
|
||||||
|
|
||||||
|
// if (window.location.href.indexOf('localhost') == -1 || window.location.href.indexOf('47.122') == -1) { //不包含 localhost 正式环境
|
||||||
|
// switch (params.record.ORG_ID) {
|
||||||
|
// case 'B043B28B-BBC3-C452-6052-4FBA1457ABFA':
|
||||||
|
// cataid = '1746673689001'//"xlk": 1746673689001,
|
||||||
|
// break
|
||||||
|
// case '8F1CF418-8BF3-EA3F-7A6D-FC5D61247008':
|
||||||
|
// cataid = '1746674428001'//"xt": 1746674428001,
|
||||||
|
// break
|
||||||
|
// case 'D9871BA8-0EEC-9E4A-BB87-7D5A540D8913':
|
||||||
|
// cataid = '1746673761001'//"yl": 1746673761001
|
||||||
|
// break
|
||||||
|
// case '8B3C41AA-51B1-7CE9-1879-248A038C1B5C':
|
||||||
|
// cataid = '1746673724001'//"jd": 1746673724001
|
||||||
|
// break
|
||||||
|
// case '3EFD5276-632B-E379-9FF3-7A7546591FCA':
|
||||||
|
// cataid = '1746674077001'// "bb": 1746674077001,
|
||||||
|
// break
|
||||||
|
// default:
|
||||||
|
// cataid = '1746673652001'//"47xlk": 1746673652001
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// console.log(cataid)
|
||||||
|
|
||||||
|
// var fileSetting = { // 文件上传相关信息设置
|
||||||
|
// title: file.name, // 标题
|
||||||
|
// desc: 'jssdk插件上传', // 描述
|
||||||
|
// cataid: cataid, // 上传分类目录ID
|
||||||
|
// tag: '', // 标签
|
||||||
|
// luping: 0, // 是否开启视频课件优化处理,对于上传录屏类视频清晰度有所优化:0为不开启,1为开启
|
||||||
|
// keepsource: 0, // 是否源文件播放(不对视频进行编码):0为编码,1为不编码
|
||||||
|
// state: '' //用户自定义信息,如果提交了该字段,会在服务端上传完成回调时透传返回。
|
||||||
|
// }
|
||||||
|
// var html = ''
|
||||||
|
// var uploadManager = videoUpload.addFile(
|
||||||
|
// file, // file 为待上传的文件对象
|
||||||
|
// {
|
||||||
|
// FileStarted: function (uploadInfo) { // 文件开始上传回调
|
||||||
|
// html = ''
|
||||||
|
// document.getElementById('upload-info').innerHTML = ''
|
||||||
|
// html += "文件上传开始: " + uploadInfo.fileData.title + "<br>"
|
||||||
|
// // console.log("文件上传开始: " + uploadInfo.fileData.title);
|
||||||
|
// },
|
||||||
|
// FileProgress: function (uploadInfo) { // 文件上传过程返回上传进度信息回调
|
||||||
|
// html += "文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%' + "<br>"
|
||||||
|
// // console.log("文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%');
|
||||||
|
// document.getElementById('upload-info').innerHTML = html
|
||||||
|
// },
|
||||||
|
// FileStopped: function (uploadInfo) { // 文件暂停上传回调
|
||||||
|
// html += "文件上传停止: " + uploadInfo.fileData.title + "<br>"
|
||||||
|
// // console.log("文件上传停止: " + uploadInfo.fileData.title);
|
||||||
|
// document.getElementById('upload-info').innerHTML = html
|
||||||
|
// },
|
||||||
|
// FileSucceed: function (uploadInfo) { // 文件上传成功回调
|
||||||
|
// html += "文件上传成功: " + uploadInfo.fileData.title + "<br>"
|
||||||
|
// // console.log("文件上传成功: " + uploadInfo.fileData.title);
|
||||||
|
// document.getElementById('upload-info').innerHTML = html
|
||||||
|
// if (params.record.NAME == undefined || params.record.NAME == null || params.record.NAME.length < 1) {
|
||||||
|
// const temps = [];
|
||||||
|
// // temps.push({ field: 'Nav_Files', value: navFiles })
|
||||||
|
// // temps.push({ field: 'IMG_FILE_ID', value: IMG_FILE_ID })
|
||||||
|
// temps.push({ field: 'FILE_PATH', value: `http://share.polyv.net/front/video/view?vid=${uploadInfo.fileData.vid}` })
|
||||||
|
// temps.push({ field: 'NAME', value: uploadInfo.fileData.filename })
|
||||||
|
// temps.push({ field: 'ISLOCAL', value: false })
|
||||||
|
// temps.push({ field: 'Nav_Files', value: null })
|
||||||
|
// params.setFieldValueByBatch(temps);
|
||||||
|
// params.setFieldEditable("Nav_Files", false)
|
||||||
|
// message.success(`${uploadInfo.fileData.filename} 上传成功!`);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// FileFailed: function (uploadInfo) { // 文件上传失败回调
|
||||||
|
// html += "文件上传失败: " + uploadInfo.fileData.title + "<br>"
|
||||||
|
// // console.log("文件上传失败: " + uploadInfo.fileData.title);
|
||||||
|
// document.getElementById('upload-info').innerHTML = html
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// fileSetting
|
||||||
|
// );
|
||||||
|
// videoUpload.startAll();
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
|
||||||
|
return <>
|
||||||
|
<div key="keyD1" className="ant-col ant-col-lg-12 ant-col-xxl-8">
|
||||||
|
<div key="keyD2">
|
||||||
|
<div key="keyD3" className="ant-col ant-col-24 ant-form-item-label">
|
||||||
|
<label key="LNAME">
|
||||||
|
<span key="keyS1">上传视频(保利威)</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div key="keyD4" className="ant-col ant-col-18 ant-form-item-control-wrapper">
|
||||||
|
<Input {...uploadInput} style={{ height: '39px' }} key="keyI1" disabled={(params.record.NAME == null || params.record.NAME.length == 0) ? false : true} />
|
||||||
|
{isEditFile && <p key="keyP1" id="upload-info"> </p>}
|
||||||
|
{isShowFile && <a key="keyA1" href={params.record.FILE_PATH} target="_blank">{params.record.NAME}</a>}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
} else if (params.colConfig.field === 'Nav_Files') {
|
||||||
|
//重写 使只上传视频 并且控制按钮不可操作
|
||||||
|
const Tenant = storage('lacal').getItem('Tenant').val;
|
||||||
|
var isEditFile = true//默认显示编辑按钮
|
||||||
|
var isShowFile = false//默认文件显示
|
||||||
|
//如果显示 本地文件 isShowFile true isEditFile false
|
||||||
|
if (params.record.ISLOCAL == true && params.record.Nav_Files != null && params.record.Nav_Files.length > 0) {
|
||||||
|
isEditFile = false
|
||||||
|
isShowFile = true
|
||||||
|
}
|
||||||
|
// if (params.record.Nav_Files && params.record.Nav_Files.length > 0) {
|
||||||
|
// params.record['Files'] = params.record.Nav_Files
|
||||||
|
// }
|
||||||
|
//上传到本地服务器
|
||||||
|
const uploadSopProps = {
|
||||||
|
accept: '.flv,.avi,.mpg,.mp4,.wmv,.mov,.3gp,.asf',
|
||||||
|
name: 'file',
|
||||||
|
action: config.serviceHost('api/PF/File/UploadFile'),
|
||||||
|
data: { OrgId: params.login.OrgId },
|
||||||
|
fileList: params.record['Files'],//Files Nav_Files
|
||||||
|
headers: {
|
||||||
|
Tenant: Tenant,
|
||||||
|
},
|
||||||
|
onChange(info) {
|
||||||
|
params.record['Files'] = [...info.fileList];
|
||||||
|
// params.saveRowRecord(params.record);
|
||||||
|
// params.record.NAME = info.file.name;
|
||||||
|
// if (info.file.status !== 'uploading') {
|
||||||
|
// }
|
||||||
|
if (info.file.status === 'removed') {
|
||||||
|
if (info.file.response && info.file.response.file) {
|
||||||
|
info.file.response.file.IS_DELETED = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (info.file.status === 'done') {
|
||||||
|
let uploadFiles = [...info.fileList]
|
||||||
|
if (uploadFiles) {
|
||||||
|
let navFiles = [];
|
||||||
|
var IMG_FILE_ID = ''
|
||||||
|
var FILE_PATH = ''
|
||||||
|
uploadFiles.forEach(t => {
|
||||||
|
if (t.response) {
|
||||||
|
//附件信息赋值给数据库对象,多个附件需要遍历附件信息
|
||||||
|
IMG_FILE_ID = t.response.Data.imgFileID
|
||||||
|
FILE_PATH = t.response.Data.imgFilePath
|
||||||
|
navFiles.push({
|
||||||
|
FILE_DB_ID: params.record.ID,
|
||||||
|
ORG_ID: params.record.ORG_ID,
|
||||||
|
IMG_FILE_ID: IMG_FILE_ID, //附件表文件名称
|
||||||
|
ID: t.response.file ? t.uid : guid()//标记ID
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const temps = [];
|
||||||
|
temps.push({ field: 'Nav_Files', value: navFiles })
|
||||||
|
temps.push({ field: 'IMG_FILE_ID', value: IMG_FILE_ID })
|
||||||
|
temps.push({ field: 'FILE_PATH', value: FILE_PATH })
|
||||||
|
temps.push({ field: 'NAME', value: info.file.name })
|
||||||
|
params.setFieldValueByBatch(temps);
|
||||||
|
params.setFieldEditable("NAME", false)
|
||||||
|
}
|
||||||
|
// params.setFieldEditable("ISLOCAL", false)
|
||||||
|
message.success(`${info.file.name} 上传成功`);
|
||||||
|
} else if (info.file.status === 'error') {
|
||||||
|
message.error(`${info.file.name} 上传失败!`);
|
||||||
|
}
|
||||||
|
if (info.file.status != 'done') {
|
||||||
|
//上传成功回调不处理数据赋值
|
||||||
|
const temps2 = [];
|
||||||
|
temps2.push({ field: 'Nav_Files', value: params.record['Files'] })
|
||||||
|
temps2.push({ field: 'NAME', value: info.file.name })
|
||||||
|
params.setFieldValueByBatch(temps2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return <>
|
||||||
|
<div className="ant-col ant-col-lg-12 ant-col-xxl-8">
|
||||||
|
<div>
|
||||||
|
<div className="ant-col ant-col-24 ant-form-item-label">
|
||||||
|
<label>
|
||||||
|
<span>上传视频(本地服务)</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div className="ant-col ant-col-18 ant-form-item-control-wrapper">
|
||||||
|
{/* {isShowFile && <Attachment disabled={false} value={"附件上传"} colConfig={params.colConfig} record={params.record} />} */}
|
||||||
|
{isShowFile && <Input type="file" style={{ height: '39px' }} key="keyI1" disabled={true} />}
|
||||||
|
{isShowFile && <a key="keyA21" href={config.picServerHost + params.record.FILE_PATH} target="_blank">{params.record.NAME}</a>}
|
||||||
|
{isEditFile && <Upload {...uploadSopProps}>
|
||||||
|
<Button disabled={(params.record.NAME == null || params.record.NAME.length == 0) ? false : true}>
|
||||||
|
<Icon type="upload" />上传视频
|
||||||
|
</Button>
|
||||||
|
</Upload>}
|
||||||
|
|
||||||
|
{/* <Upload {...uploadSopProps}>
|
||||||
|
<Button disabled={(params.record.NAME == null || params.record.NAME.length == 0) ? false : true}>
|
||||||
|
<Icon type="upload" />上传视频
|
||||||
|
</Button>
|
||||||
|
</Upload> */}
|
||||||
|
{/*
|
||||||
|
<div key="keyD4" className="ant-col ant-col-18 ant-form-item-control-wrapper">
|
||||||
|
<Input {...uploadInput} style={{ height: '39px' }} key="keyI1" disabled={(params.record.NAME == null || params.record.NAME.length == 0) ? false : true} />
|
||||||
|
{isEditFile && <p key="keyP1" id="upload-info"> </p>}
|
||||||
|
{isShowFile && <a key="keyA1" href={params.record.FILE_PATH} target="_blank">{params.record.NAME}</a>}
|
||||||
|
</div>
|
||||||
|
*/}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
@ -28,331 +28,13 @@ export default {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//import PlvVideoUpload from "@polyv/vod-upload-js-sdk/vod-upload-js-sdk.min.js"; //此处插入 如果直接导入 发布会报错
|
// //import PlvVideoUpload from "@polyv/vod-upload-js-sdk/vod-upload-js-sdk.min.js"; //此处插入 如果直接导入 发布会报错
|
||||||
const script = document.createElement('script');
|
// const script = document.createElement('script');
|
||||||
script.src = 'https://player.polyv.net/resp/vod-upload-js-sdk/latest/vod-upload-js-sdk.min.js';
|
// script.src = 'https://player.polyv.net/resp/vod-upload-js-sdk/latest/vod-upload-js-sdk.min.js';
|
||||||
document.body.appendChild(script);
|
// document.body.appendChild(script);
|
||||||
},
|
},
|
||||||
handleRenderHeadControl(params) {
|
handleRenderHeadControl(params) {
|
||||||
if (params.colConfig.field === 'NAME') {
|
if (params.colConfig.field === 'Nav_Files') {
|
||||||
var isEditFile = true//默认显示编辑按钮
|
|
||||||
var isShowFile = false//默认文件显示
|
|
||||||
// import PlvVideoUpload from "@polyv/vod-upload-js-sdk/vod-upload-js-sdk.min.js";
|
|
||||||
|
|
||||||
// const script = document.createElement('script');
|
|
||||||
// script.src = 'https://websdk.videocc.net/vod-upload-js-sdk/latest/vod-upload-js-sdk.min.js';
|
|
||||||
// document.body.appendChild(script);
|
|
||||||
|
|
||||||
//如果显示 本地文件 isShowFile true isEditFile false
|
|
||||||
var p = document.getElementById('upload-info')
|
|
||||||
if (p != null) {
|
|
||||||
p.innerHTML = ' '
|
|
||||||
}
|
|
||||||
if (params.record.ISLOCAL != null && params.record.ISLOCAL == false && params.record.FILE_PATH != null && params.record.FILE_PATH.indexOf('http') > -1) {
|
|
||||||
isShowFile = true
|
|
||||||
isEditFile = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// 点播上传SDK 本地可以 发布不行
|
|
||||||
const uploadInput = {
|
|
||||||
key: 'fileBlv',
|
|
||||||
type: "file",
|
|
||||||
id: 'file',
|
|
||||||
accept: '.flv,.avi,.mpg,.mp4,.wmv,.mov,.3gp,.asf',
|
|
||||||
name: 'file',
|
|
||||||
multiple: true,
|
|
||||||
onChange(info) {
|
|
||||||
let uploadFiles = info.target.files
|
|
||||||
if (uploadFiles.length > 0) {
|
|
||||||
console.log('事件触发58')
|
|
||||||
// let PlvVideoUpload;
|
|
||||||
// try {
|
|
||||||
// PlvVideoUpload = require('@polyv/vod-upload-js-sdk/vod-upload-js-sdk.min.js');
|
|
||||||
// // PlvVideoUpload = require('@polyv/vod-upload-js-sdk');
|
|
||||||
// } catch (e) {
|
|
||||||
// console.log(e)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// 授权验证信息3分钟内有效,当 sign 过期时需要调用该方法更新
|
|
||||||
const videoUpload = new PlvVideoUpload({
|
|
||||||
region: 'line1', // auto:自动选择。根据IP的地区自动选择,当IP解析不出时使用默认值。
|
|
||||||
// line1(默认值):华南OSS bucket,对应ab-upload.polyv.net。
|
|
||||||
// line2:华北OSS bucket,对应ab-upload2.polyv.net。
|
|
||||||
events: {
|
|
||||||
Error: (err) => { // 错误事件回调
|
|
||||||
message.error(`上传失败!`);
|
|
||||||
},
|
|
||||||
UploadComplete: (infoResult) => {
|
|
||||||
//数据处理
|
|
||||||
|
|
||||||
// message.success(`上传成功`);
|
|
||||||
} // 全部上传任务完成回调
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var userid = params.colConfig.column.VERIFY_MSG
|
|
||||||
var promptInfo = params.colConfig.column.PROMPT_INFO
|
|
||||||
var secretkey = ""
|
|
||||||
var writeToken = "";
|
|
||||||
if (promptInfo && promptInfo.length > 0 && promptInfo.indexOf('|') > -1) {
|
|
||||||
var promptInfoArr = promptInfo.split('|')
|
|
||||||
secretkey = promptInfoArr[0]
|
|
||||||
writeToken = promptInfoArr[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
var ts = (new Date()).getTime()
|
|
||||||
var sign = MD5(secretkey + ts)
|
|
||||||
var hash = MD5(ts + writeToken)
|
|
||||||
videoUpload.updateUserData({
|
|
||||||
userid: userid, // Polyv云点播账号的ID
|
|
||||||
ptime: ts, // 时间戳
|
|
||||||
sign: sign, // <sign>是根据将secretkey和ts按照顺序拼凑起来的字符串进行MD5计算得到的值(小写)
|
|
||||||
hash: hash, // <hash> 是根据将ts和writeToken按照顺序拼凑起来的字符串进行MD5计算得到的值(小写)
|
|
||||||
});
|
|
||||||
var file = uploadFiles[0]
|
|
||||||
var cataid = '1746673652001'//每个公司对应的文件夹ID不一样 测试环境
|
|
||||||
// "47xlk": 1746673652001 "xlk": 1746673689001, "jd": 1746673724001, "yl": 1746673761001, "bb": 1746674077001, "xt": 1746674428001,
|
|
||||||
if (window.location.href.indexOf('localhost') == -1 && window.location.href.indexOf('47.122') == -1) { //不包含 localhost 正式环境
|
|
||||||
switch (params.record.ORG_ID) {
|
|
||||||
case 'B043B28B-BBC3-C452-6052-4FBA1457ABFA':
|
|
||||||
cataid = '1746673689001'//"xlk": 1746673689001,
|
|
||||||
break
|
|
||||||
case '8F1CF418-8BF3-EA3F-7A6D-FC5D61247008':
|
|
||||||
cataid = '1746674428001'//"xt": 1746674428001,
|
|
||||||
break
|
|
||||||
case 'D9871BA8-0EEC-9E4A-BB87-7D5A540D8913':
|
|
||||||
cataid = '1746673761001'//"yl": 1746673761001
|
|
||||||
break
|
|
||||||
case '8B3C41AA-51B1-7CE9-1879-248A038C1B5C':
|
|
||||||
cataid = '1746673724001'//"jd": 1746673724001
|
|
||||||
break
|
|
||||||
case '3EFD5276-632B-E379-9FF3-7A7546591FCA':
|
|
||||||
cataid = '1746674077001'// "bb": 1746674077001,
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
cataid = '1746673652001'//"47xlk": 1746673652001
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var fileSetting = { // 文件上传相关信息设置
|
|
||||||
title: file.name, // 标题
|
|
||||||
desc: 'jssdk插件上传', // 描述
|
|
||||||
cataid: cataid, // 上传分类目录ID
|
|
||||||
tag: '', // 标签
|
|
||||||
luping: 0, // 是否开启视频课件优化处理,对于上传录屏类视频清晰度有所优化:0为不开启,1为开启
|
|
||||||
keepsource: 0, // 是否源文件播放(不对视频进行编码):0为编码,1为不编码
|
|
||||||
state: '' //用户自定义信息,如果提交了该字段,会在服务端上传完成回调时透传返回。
|
|
||||||
}
|
|
||||||
var html = ''
|
|
||||||
var uploadManager = videoUpload.addFile(
|
|
||||||
file, // file 为待上传的文件对象
|
|
||||||
{
|
|
||||||
FileStarted: function (uploadInfo) { // 文件开始上传回调
|
|
||||||
html = ''
|
|
||||||
document.getElementById('upload-info').innerHTML = ''
|
|
||||||
html += "文件上传开始: " + uploadInfo.fileData.title + "<br>"
|
|
||||||
// console.log("文件上传开始: " + uploadInfo.fileData.title);
|
|
||||||
},
|
|
||||||
FileProgress: function (uploadInfo) { // 文件上传过程返回上传进度信息回调
|
|
||||||
html += "文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%' + "<br>"
|
|
||||||
// console.log("文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%');
|
|
||||||
document.getElementById('upload-info').innerHTML = html
|
|
||||||
},
|
|
||||||
FileStopped: function (uploadInfo) { // 文件暂停上传回调
|
|
||||||
html += "文件上传停止: " + uploadInfo.fileData.title + "<br>"
|
|
||||||
// console.log("文件上传停止: " + uploadInfo.fileData.title);
|
|
||||||
document.getElementById('upload-info').innerHTML = html
|
|
||||||
},
|
|
||||||
FileSucceed: function (uploadInfo) { // 文件上传成功回调
|
|
||||||
html += "文件上传成功: " + uploadInfo.fileData.title + "<br>"
|
|
||||||
// console.log("文件上传成功: " + uploadInfo.fileData.title);
|
|
||||||
document.getElementById('upload-info').innerHTML = html
|
|
||||||
if (params.record.NAME == undefined || params.record.NAME == null || params.record.NAME.length < 1) {
|
|
||||||
const temps = [];
|
|
||||||
// temps.push({ field: 'Nav_Files', value: navFiles })
|
|
||||||
// temps.push({ field: 'IMG_FILE_ID', value: IMG_FILE_ID })
|
|
||||||
temps.push({ field: 'FILE_PATH', value: `http://share.polyv.net/front/video/view?vid=${uploadInfo.fileData.vid}` })
|
|
||||||
temps.push({ field: 'NAME', value: uploadInfo.fileData.filename })
|
|
||||||
temps.push({ field: 'ISLOCAL', value: false })
|
|
||||||
temps.push({ field: 'Nav_Files', value: null })
|
|
||||||
params.setFieldValueByBatch(temps);
|
|
||||||
params.setFieldEditable("Nav_Files", false)
|
|
||||||
message.success(`${uploadInfo.fileData.filename} 上传成功!`);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
FileFailed: function (uploadInfo) { // 文件上传失败回调
|
|
||||||
html += "文件上传失败: " + uploadInfo.fileData.title + "<br>"
|
|
||||||
// console.log("文件上传失败: " + uploadInfo.fileData.title);
|
|
||||||
document.getElementById('upload-info').innerHTML = html
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fileSetting
|
|
||||||
);
|
|
||||||
videoUpload.startAll();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// const uploadInput = {
|
|
||||||
// key: 'fileBlv',
|
|
||||||
// type: "file",
|
|
||||||
// id: 'file',
|
|
||||||
// accept: '.flv,.avi,.mpg,.mp4,.wmv,.mov,.3gp,.asf',
|
|
||||||
// name: 'file',
|
|
||||||
// multiple: true,
|
|
||||||
// onChange(info) {
|
|
||||||
// let uploadFiles = info.target.files
|
|
||||||
// if (uploadFiles.length > 0) {
|
|
||||||
// // let PlvVideoUpload;
|
|
||||||
// // try {
|
|
||||||
// // PlvVideoUpload = require('@polyv/vod-upload-js-sdk/vod-upload-js-sdk.min.js');
|
|
||||||
// // // PlvVideoUpload = require('@polyv/vod-upload-js-sdk');
|
|
||||||
// // } catch (e) {
|
|
||||||
// // console.log(e)
|
|
||||||
// // }
|
|
||||||
// //
|
|
||||||
// // 授权验证信息3分钟内有效,当 sign 过期时需要调用该方法更新
|
|
||||||
// const videoUpload = new PlvVideoUpload({
|
|
||||||
// region: 'line1', // auto:自动选择。根据IP的地区自动选择,当IP解析不出时使用默认值。
|
|
||||||
// // line1(默认值):华南OSS bucket,对应ab-upload.polyv.net。
|
|
||||||
// // line2:华北OSS bucket,对应ab-upload2.polyv.net。
|
|
||||||
// events: {
|
|
||||||
// Error: (err) => { // 错误事件回调
|
|
||||||
// message.error(`上传失败!`);
|
|
||||||
// },
|
|
||||||
// UploadComplete: (infoResult) => {
|
|
||||||
// //数据处理
|
|
||||||
|
|
||||||
// // message.success(`上传成功`);
|
|
||||||
// } // 全部上传任务完成回调
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// console.log('事件触发60')
|
|
||||||
// var userid = params.colConfig.column.VERIFY_MSG
|
|
||||||
// var promptInfo = params.colConfig.column.PROMPT_INFO
|
|
||||||
// var secretkey = ""
|
|
||||||
// var writeToken = "";
|
|
||||||
// if (promptInfo && promptInfo.length > 0 && promptInfo.indexOf('|') > -1) {
|
|
||||||
// var promptInfoArr = promptInfo.split('|')
|
|
||||||
// secretkey = promptInfoArr[0]
|
|
||||||
// writeToken = promptInfoArr[1]
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var ts = (new Date()).getTime()
|
|
||||||
// var sign = MD5(secretkey + ts)
|
|
||||||
// var hash = MD5(ts + writeToken)
|
|
||||||
// videoUpload.updateUserData({
|
|
||||||
// userid: userid, // Polyv云点播账号的ID
|
|
||||||
// ptime: ts, // 时间戳
|
|
||||||
// sign: sign, // <sign>是根据将secretkey和ts按照顺序拼凑起来的字符串进行MD5计算得到的值(小写)
|
|
||||||
// hash: hash, // <hash> 是根据将ts和writeToken按照顺序拼凑起来的字符串进行MD5计算得到的值(小写)
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
// var file = uploadFiles[0]
|
|
||||||
// var cataid = '1746673652001'//每个公司对应的文件夹ID不一样 测试环境
|
|
||||||
// // "47xlk": 1746673652001 "xlk": 1746673689001, "jd": 1746673724001, "yl": 1746673761001, "bb": 1746674077001, "xt": 1746674428001,
|
|
||||||
|
|
||||||
// if (window.location.href.indexOf('localhost') == -1 || window.location.href.indexOf('47.122') == -1) { //不包含 localhost 正式环境
|
|
||||||
// switch (params.record.ORG_ID) {
|
|
||||||
// case 'B043B28B-BBC3-C452-6052-4FBA1457ABFA':
|
|
||||||
// cataid = '1746673689001'//"xlk": 1746673689001,
|
|
||||||
// break
|
|
||||||
// case '8F1CF418-8BF3-EA3F-7A6D-FC5D61247008':
|
|
||||||
// cataid = '1746674428001'//"xt": 1746674428001,
|
|
||||||
// break
|
|
||||||
// case 'D9871BA8-0EEC-9E4A-BB87-7D5A540D8913':
|
|
||||||
// cataid = '1746673761001'//"yl": 1746673761001
|
|
||||||
// break
|
|
||||||
// case '8B3C41AA-51B1-7CE9-1879-248A038C1B5C':
|
|
||||||
// cataid = '1746673724001'//"jd": 1746673724001
|
|
||||||
// break
|
|
||||||
// case '3EFD5276-632B-E379-9FF3-7A7546591FCA':
|
|
||||||
// cataid = '1746674077001'// "bb": 1746674077001,
|
|
||||||
// break
|
|
||||||
// default:
|
|
||||||
// cataid = '1746673652001'//"47xlk": 1746673652001
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// console.log(cataid)
|
|
||||||
|
|
||||||
// var fileSetting = { // 文件上传相关信息设置
|
|
||||||
// title: file.name, // 标题
|
|
||||||
// desc: 'jssdk插件上传', // 描述
|
|
||||||
// cataid: cataid, // 上传分类目录ID
|
|
||||||
// tag: '', // 标签
|
|
||||||
// luping: 0, // 是否开启视频课件优化处理,对于上传录屏类视频清晰度有所优化:0为不开启,1为开启
|
|
||||||
// keepsource: 0, // 是否源文件播放(不对视频进行编码):0为编码,1为不编码
|
|
||||||
// state: '' //用户自定义信息,如果提交了该字段,会在服务端上传完成回调时透传返回。
|
|
||||||
// }
|
|
||||||
// var html = ''
|
|
||||||
// var uploadManager = videoUpload.addFile(
|
|
||||||
// file, // file 为待上传的文件对象
|
|
||||||
// {
|
|
||||||
// FileStarted: function (uploadInfo) { // 文件开始上传回调
|
|
||||||
// html = ''
|
|
||||||
// document.getElementById('upload-info').innerHTML = ''
|
|
||||||
// html += "文件上传开始: " + uploadInfo.fileData.title + "<br>"
|
|
||||||
// // console.log("文件上传开始: " + uploadInfo.fileData.title);
|
|
||||||
// },
|
|
||||||
// FileProgress: function (uploadInfo) { // 文件上传过程返回上传进度信息回调
|
|
||||||
// html += "文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%' + "<br>"
|
|
||||||
// // console.log("文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%');
|
|
||||||
// document.getElementById('upload-info').innerHTML = html
|
|
||||||
// },
|
|
||||||
// FileStopped: function (uploadInfo) { // 文件暂停上传回调
|
|
||||||
// html += "文件上传停止: " + uploadInfo.fileData.title + "<br>"
|
|
||||||
// // console.log("文件上传停止: " + uploadInfo.fileData.title);
|
|
||||||
// document.getElementById('upload-info').innerHTML = html
|
|
||||||
// },
|
|
||||||
// FileSucceed: function (uploadInfo) { // 文件上传成功回调
|
|
||||||
// html += "文件上传成功: " + uploadInfo.fileData.title + "<br>"
|
|
||||||
// // console.log("文件上传成功: " + uploadInfo.fileData.title);
|
|
||||||
// document.getElementById('upload-info').innerHTML = html
|
|
||||||
// if (params.record.NAME == undefined || params.record.NAME == null || params.record.NAME.length < 1) {
|
|
||||||
// const temps = [];
|
|
||||||
// // temps.push({ field: 'Nav_Files', value: navFiles })
|
|
||||||
// // temps.push({ field: 'IMG_FILE_ID', value: IMG_FILE_ID })
|
|
||||||
// temps.push({ field: 'FILE_PATH', value: `http://share.polyv.net/front/video/view?vid=${uploadInfo.fileData.vid}` })
|
|
||||||
// temps.push({ field: 'NAME', value: uploadInfo.fileData.filename })
|
|
||||||
// temps.push({ field: 'ISLOCAL', value: false })
|
|
||||||
// temps.push({ field: 'Nav_Files', value: null })
|
|
||||||
// params.setFieldValueByBatch(temps);
|
|
||||||
// params.setFieldEditable("Nav_Files", false)
|
|
||||||
// message.success(`${uploadInfo.fileData.filename} 上传成功!`);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// FileFailed: function (uploadInfo) { // 文件上传失败回调
|
|
||||||
// html += "文件上传失败: " + uploadInfo.fileData.title + "<br>"
|
|
||||||
// // console.log("文件上传失败: " + uploadInfo.fileData.title);
|
|
||||||
// document.getElementById('upload-info').innerHTML = html
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// fileSetting
|
|
||||||
// );
|
|
||||||
// videoUpload.startAll();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// };
|
|
||||||
|
|
||||||
return <>
|
|
||||||
<div key="keyD1" className="ant-col ant-col-lg-12 ant-col-xxl-8">
|
|
||||||
<div key="keyD2">
|
|
||||||
<div key="keyD3" className="ant-col ant-col-24 ant-form-item-label">
|
|
||||||
<label key="LNAME">
|
|
||||||
<span key="keyS1">上传视频(保利威)</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div key="keyD4" className="ant-col ant-col-18 ant-form-item-control-wrapper">
|
|
||||||
<Input {...uploadInput} style={{ height: '39px' }} key="keyI1" disabled={(params.record.NAME == null || params.record.NAME.length == 0) ? false : true} />
|
|
||||||
{isEditFile && <p key="keyP1" id="upload-info"> </p>}
|
|
||||||
{isShowFile && <a key="keyA1" href={params.record.FILE_PATH} target="_blank">{params.record.NAME}</a>}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
} else if (params.colConfig.field === 'Nav_Files') {
|
|
||||||
//重写 使只上传视频 并且控制按钮不可操作
|
//重写 使只上传视频 并且控制按钮不可操作
|
||||||
const Tenant = storage('lacal').getItem('Tenant').val;
|
const Tenant = storage('lacal').getItem('Tenant').val;
|
||||||
var isEditFile = true//默认显示编辑按钮
|
var isEditFile = true//默认显示编辑按钮
|
||||||
@ -369,11 +51,12 @@ export default {
|
|||||||
const uploadSopProps = {
|
const uploadSopProps = {
|
||||||
accept: '.flv,.avi,.mpg,.mp4,.wmv,.mov,.3gp,.asf',
|
accept: '.flv,.avi,.mpg,.mp4,.wmv,.mov,.3gp,.asf',
|
||||||
name: 'file',
|
name: 'file',
|
||||||
action: config.serviceHost('api/PF/File/UploadFile'),
|
action: config.serviceHost('api/PF/File/UploadVideo'),//UploadFile 方法分开 以免影响
|
||||||
data: { OrgId: params.login.OrgId },
|
data: { OrgId: params.login.OrgId },
|
||||||
fileList: params.record['Files'],//Files Nav_Files
|
fileList: params.record['Files'],//Files Nav_Files
|
||||||
headers: {
|
headers: {
|
||||||
Tenant: Tenant,
|
Tenant: Tenant,
|
||||||
|
PBN: "VIDEO"
|
||||||
},
|
},
|
||||||
onChange(info) {
|
onChange(info) {
|
||||||
params.record['Files'] = [...info.fileList];
|
params.record['Files'] = [...info.fileList];
|
||||||
@ -394,6 +77,7 @@ export default {
|
|||||||
var FILE_PATH = ''
|
var FILE_PATH = ''
|
||||||
uploadFiles.forEach(t => {
|
uploadFiles.forEach(t => {
|
||||||
if (t.response) {
|
if (t.response) {
|
||||||
|
if (t.response.IsSuccessful) {
|
||||||
//附件信息赋值给数据库对象,多个附件需要遍历附件信息
|
//附件信息赋值给数据库对象,多个附件需要遍历附件信息
|
||||||
IMG_FILE_ID = t.response.Data.imgFileID
|
IMG_FILE_ID = t.response.Data.imgFileID
|
||||||
FILE_PATH = t.response.Data.imgFilePath
|
FILE_PATH = t.response.Data.imgFilePath
|
||||||
@ -403,6 +87,9 @@ export default {
|
|||||||
IMG_FILE_ID: IMG_FILE_ID, //附件表文件名称
|
IMG_FILE_ID: IMG_FILE_ID, //附件表文件名称
|
||||||
ID: t.response.file ? t.uid : guid()//标记ID
|
ID: t.response.file ? t.uid : guid()//标记ID
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
message.error(`${info.file.name} 上传失败!报错详情:` + t.response.ErrorMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -412,7 +99,7 @@ export default {
|
|||||||
temps.push({ field: 'FILE_PATH', value: FILE_PATH })
|
temps.push({ field: 'FILE_PATH', value: FILE_PATH })
|
||||||
temps.push({ field: 'NAME', value: info.file.name })
|
temps.push({ field: 'NAME', value: info.file.name })
|
||||||
params.setFieldValueByBatch(temps);
|
params.setFieldValueByBatch(temps);
|
||||||
params.setFieldEditable("NAME", false)
|
// params.setFieldEditable("NAME", false)//让可修改
|
||||||
}
|
}
|
||||||
// params.setFieldEditable("ISLOCAL", false)
|
// params.setFieldEditable("ISLOCAL", false)
|
||||||
message.success(`${info.file.name} 上传成功`);
|
message.success(`${info.file.name} 上传成功`);
|
||||||
@ -433,7 +120,7 @@ export default {
|
|||||||
<div>
|
<div>
|
||||||
<div className="ant-col ant-col-24 ant-form-item-label">
|
<div className="ant-col ant-col-24 ant-form-item-label">
|
||||||
<label>
|
<label>
|
||||||
<span>上传视频(本地服务)</span>
|
<span>上传本地视频</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="ant-col ant-col-18 ant-form-item-control-wrapper">
|
<div className="ant-col ant-col-18 ant-form-item-control-wrapper">
|
||||||
@ -442,22 +129,9 @@ export default {
|
|||||||
{isShowFile && <a key="keyA21" href={config.picServerHost + params.record.FILE_PATH} target="_blank">{params.record.NAME}</a>}
|
{isShowFile && <a key="keyA21" href={config.picServerHost + params.record.FILE_PATH} target="_blank">{params.record.NAME}</a>}
|
||||||
{isEditFile && <Upload {...uploadSopProps}>
|
{isEditFile && <Upload {...uploadSopProps}>
|
||||||
<Button disabled={(params.record.NAME == null || params.record.NAME.length == 0) ? false : true}>
|
<Button disabled={(params.record.NAME == null || params.record.NAME.length == 0) ? false : true}>
|
||||||
<Icon type="upload" />上传视频
|
<Icon type="upload" />上传视频(如果视频较大,请耐心等待上传完毕再保存)
|
||||||
</Button>
|
</Button>
|
||||||
</Upload>}
|
</Upload>}
|
||||||
|
|
||||||
{/* <Upload {...uploadSopProps}>
|
|
||||||
<Button disabled={(params.record.NAME == null || params.record.NAME.length == 0) ? false : true}>
|
|
||||||
<Icon type="upload" />上传视频
|
|
||||||
</Button>
|
|
||||||
</Upload> */}
|
|
||||||
{/*
|
|
||||||
<div key="keyD4" className="ant-col ant-col-18 ant-form-item-control-wrapper">
|
|
||||||
<Input {...uploadInput} style={{ height: '39px' }} key="keyI1" disabled={(params.record.NAME == null || params.record.NAME.length == 0) ? false : true} />
|
|
||||||
{isEditFile && <p key="keyP1" id="upload-info"> </p>}
|
|
||||||
{isShowFile && <a key="keyA1" href={params.record.FILE_PATH} target="_blank">{params.record.NAME}</a>}
|
|
||||||
</div>
|
|
||||||
*/}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user