From 711262a097fdec190c01d85ccfbe7f1f6351899e Mon Sep 17 00:00:00 2001 From: wyw <571921741@qq.com> Date: Fri, 26 Dec 2025 13:49:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=BA=93=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=8F=AA=E6=9C=89=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=88=B0=E6=9C=AC=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/files/edit/PF147 copy.js | 467 +++++++++++++++++++++++++++++++++++ src/files/edit/PF147.js | 372 ++-------------------------- 2 files changed, 490 insertions(+), 349 deletions(-) create mode 100644 src/files/edit/PF147 copy.js diff --git a/src/files/edit/PF147 copy.js b/src/files/edit/PF147 copy.js new file mode 100644 index 0000000..d4d6f81 --- /dev/null +++ b/src/files/edit/PF147 copy.js @@ -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, // 是根据将secretkey和ts按照顺序拼凑起来的字符串进行MD5计算得到的值(小写) + 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 + "
" + // console.log("文件上传开始: " + uploadInfo.fileData.title); + }, + FileProgress: function (uploadInfo) { // 文件上传过程返回上传进度信息回调 + html += "文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%' + "
" + // console.log("文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%'); + document.getElementById('upload-info').innerHTML = html + }, + FileStopped: function (uploadInfo) { // 文件暂停上传回调 + html += "文件上传停止: " + uploadInfo.fileData.title + "
" + // console.log("文件上传停止: " + uploadInfo.fileData.title); + document.getElementById('upload-info').innerHTML = html + }, + FileSucceed: function (uploadInfo) { // 文件上传成功回调 + html += "文件上传成功: " + uploadInfo.fileData.title + "
" + // 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 + "
" + // 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, // 是根据将secretkey和ts按照顺序拼凑起来的字符串进行MD5计算得到的值(小写) + // 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 + "
" + // // console.log("文件上传开始: " + uploadInfo.fileData.title); + // }, + // FileProgress: function (uploadInfo) { // 文件上传过程返回上传进度信息回调 + // html += "文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%' + "
" + // // console.log("文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%'); + // document.getElementById('upload-info').innerHTML = html + // }, + // FileStopped: function (uploadInfo) { // 文件暂停上传回调 + // html += "文件上传停止: " + uploadInfo.fileData.title + "
" + // // console.log("文件上传停止: " + uploadInfo.fileData.title); + // document.getElementById('upload-info').innerHTML = html + // }, + // FileSucceed: function (uploadInfo) { // 文件上传成功回调 + // html += "文件上传成功: " + uploadInfo.fileData.title + "
" + // // 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 + "
" + // // console.log("文件上传失败: " + uploadInfo.fileData.title); + // document.getElementById('upload-info').innerHTML = html + // } + // }, + // fileSetting + // ); + // videoUpload.startAll(); + // } + // }, + // }; + + return <> +
+
+
+ +
+
+ + {isEditFile &&

  

} + {isShowFile && {params.record.NAME}} +
+
+
+ + } 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 <> +
+
+
+ +
+
+ {/* {isShowFile && } */} + {isShowFile && } + {isShowFile && {params.record.NAME}} + {isEditFile && + + } + + {/* + + */} + {/* +
+ + {isEditFile &&

 

} + {isShowFile && {params.record.NAME}} +
+ */} +
+
+
+ + } + }, +} diff --git a/src/files/edit/PF147.js b/src/files/edit/PF147.js index d4d6f81..9e4a6d0 100644 --- a/src/files/edit/PF147.js +++ b/src/files/edit/PF147.js @@ -28,331 +28,13 @@ export default { // } } - //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); + // //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, // 是根据将secretkey和ts按照顺序拼凑起来的字符串进行MD5计算得到的值(小写) - 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 + "
" - // console.log("文件上传开始: " + uploadInfo.fileData.title); - }, - FileProgress: function (uploadInfo) { // 文件上传过程返回上传进度信息回调 - html += "文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%' + "
" - // console.log("文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%'); - document.getElementById('upload-info').innerHTML = html - }, - FileStopped: function (uploadInfo) { // 文件暂停上传回调 - html += "文件上传停止: " + uploadInfo.fileData.title + "
" - // console.log("文件上传停止: " + uploadInfo.fileData.title); - document.getElementById('upload-info').innerHTML = html - }, - FileSucceed: function (uploadInfo) { // 文件上传成功回调 - html += "文件上传成功: " + uploadInfo.fileData.title + "
" - // 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 + "
" - // 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, // 是根据将secretkey和ts按照顺序拼凑起来的字符串进行MD5计算得到的值(小写) - // 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 + "
" - // // console.log("文件上传开始: " + uploadInfo.fileData.title); - // }, - // FileProgress: function (uploadInfo) { // 文件上传过程返回上传进度信息回调 - // html += "文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%' + "
" - // // console.log("文件上传中: " + (uploadInfo.progress * 100).toFixed(2) + '%'); - // document.getElementById('upload-info').innerHTML = html - // }, - // FileStopped: function (uploadInfo) { // 文件暂停上传回调 - // html += "文件上传停止: " + uploadInfo.fileData.title + "
" - // // console.log("文件上传停止: " + uploadInfo.fileData.title); - // document.getElementById('upload-info').innerHTML = html - // }, - // FileSucceed: function (uploadInfo) { // 文件上传成功回调 - // html += "文件上传成功: " + uploadInfo.fileData.title + "
" - // // 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 + "
" - // // console.log("文件上传失败: " + uploadInfo.fileData.title); - // document.getElementById('upload-info').innerHTML = html - // } - // }, - // fileSetting - // ); - // videoUpload.startAll(); - // } - // }, - // }; - - return <> -
-
-
- -
-
- - {isEditFile &&

  

} - {isShowFile && {params.record.NAME}} -
-
-
- - } else if (params.colConfig.field === 'Nav_Files') { + if (params.colConfig.field === 'Nav_Files') { //重写 使只上传视频 并且控制按钮不可操作 const Tenant = storage('lacal').getItem('Tenant').val; var isEditFile = true//默认显示编辑按钮 @@ -369,11 +51,12 @@ export default { const uploadSopProps = { accept: '.flv,.avi,.mpg,.mp4,.wmv,.mov,.3gp,.asf', name: 'file', - action: config.serviceHost('api/PF/File/UploadFile'), + action: config.serviceHost('api/PF/File/UploadVideo'),//UploadFile 方法分开 以免影响 data: { OrgId: params.login.OrgId }, fileList: params.record['Files'],//Files Nav_Files headers: { Tenant: Tenant, + PBN: "VIDEO" }, onChange(info) { params.record['Files'] = [...info.fileList]; @@ -394,15 +77,19 @@ export default { 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 - }) + if (t.response.IsSuccessful) { + //附件信息赋值给数据库对象,多个附件需要遍历附件信息 + 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 + }) + } 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: 'NAME', value: info.file.name }) params.setFieldValueByBatch(temps); - params.setFieldEditable("NAME", false) + // params.setFieldEditable("NAME", false)//让可修改 } // params.setFieldEditable("ISLOCAL", false) message.success(`${info.file.name} 上传成功`); @@ -433,7 +120,7 @@ export default {
@@ -442,22 +129,9 @@ export default { {isShowFile && {params.record.NAME}} {isEditFile && } - - {/* - - */} - {/* -
- - {isEditFile &&

 

} - {isShowFile && {params.record.NAME}} -
- */}