From 053c4a678620a72d84dbbfe896fbfa05910d82dd Mon Sep 17 00:00:00 2001
From: wyw <571921741@qq.com>
Date: Thu, 25 Dec 2025 10:46:30 +0800
Subject: [PATCH 1/2] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E5=85=AC?=
=?UTF-8?q?=E5=85=B1=E6=96=B9=E6=B3=95=E5=AF=B9=20listModel=20=E7=9A=84?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=20=20getArryPropShow=202=E3=80=81=E4=B8=8B?=
=?UTF-8?q?=E7=BA=A7=E5=9F=B9=E8=AE=AD=E7=BB=84=E7=BB=87=20=E5=85=B7?=
=?UTF-8?q?=E4=BD=93=E6=98=BE=E7=A4=BA=E5=90=8D=E7=A7=B0=20=20=E9=83=A8?=
=?UTF-8?q?=E9=97=A8/=E8=BD=A6=E9=97=B4=E7=BA=A7=E5=9F=B9=E8=AE=AD?=
=?UTF-8?q?=E7=BB=84=E7=BB=87=20=20=E7=8F=AD=E7=BB=84=E7=BA=A7=E5=9F=B9?=
=?UTF-8?q?=E8=AE=AD=E7=BB=84=E7=BB=87=203=E3=80=81=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=20=E5=B1=9E=E6=80=A7=E4=BF=AE=E6=94=B9=20?=
=?UTF-8?q?=E8=80=81=E5=B8=88=20=E5=9F=B9=E8=AE=AD=E5=BD=A2=E5=BC=8F=204?=
=?UTF-8?q?=E3=80=81=E8=80=83=E9=A2=98=20=E5=85=BC=E5=AE=B9=E6=80=A7=20?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=80=83=E8=AF=95=E4=BC=A0=20TEXT=5FID=20?=
=?UTF-8?q?=E4=BD=86=E6=98=AF=20=E5=88=97=E8=A1=A8=E6=9F=A5=E7=9C=8B=20?=
=?UTF-8?q?=E4=BF=9D=E6=8C=81=E5=8E=9F=E6=9D=A5=E7=9A=84=20=20RECORD=5FID?=
=?UTF-8?q?=20=20=EF=BC=88SE061PaperPage=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../CustomPages/SE/SE061PaperPage.js | 188 +++++++++++-------
.../CustomPages/SE/SE062ShowPrint.js | 12 +-
src/files/edit/SE061.js | 17 +-
src/utils/common.js | 15 ++
4 files changed, 160 insertions(+), 72 deletions(-)
diff --git a/src/components/CustomPages/SE/SE061PaperPage.js b/src/components/CustomPages/SE/SE061PaperPage.js
index 880da0b..348a2e4 100644
--- a/src/components/CustomPages/SE/SE061PaperPage.js
+++ b/src/components/CustomPages/SE/SE061PaperPage.js
@@ -1,7 +1,7 @@
import { message } from "antd/lib/index";
import { Button, Popconfirm, Row, Col, Checkbox, Radio, Form, Input, Select, Table, Upload, Icon, PageHeader, Modal, Spin } from 'antd';
import React from 'react';
-import { initFilter, extendRule, extendInclude, setDataFieldValue, guid, initQueryFilter } from "../../../utils/common";
+import { initFilter, extendRule, extendInclude, extendSelectField, guid, initQueryFilter } from "../../../utils/common";
import ReactToPrint from "react-to-print";
import styles from '../../CustomPages/HI/StepForm.css';
import SEstyles from './SE.css';
@@ -55,12 +55,19 @@ class SE061PaperPage extends React.Component {
this.props.data.onCancel();
}
getUsers = (dataid) => {
- debugger
let json = initFilter(this.props.login.OrgId);
+ json.Parameter22 = this.props.data.ORG_ID_HV;
json.OrgType = 2;
// extendRule(json, 'RECORD_ID', 1, this.props.data.id);
- extendRule(json, 'RECORD_ID', 1, dataid);
+ if (this.props.data.TaskID) {
+ extendRule(json, 'TEXT_ID', 1, dataid);//RECORD_ID 这个是哪里的 考试
+ } else {
+ extendRule(json, 'RECORD_ID', 1, dataid);// 标准化执行 > 安全教育与培训 > 新三级安全教育记录 小眼睛 查看 有数据
+ }
extendInclude(json, 'Nav_User');
+ extendSelectField(json, 'Nav_User.ID');
+ extendSelectField(json, 'Nav_User.NAME');
+ extendSelectField(json, 'Nav_User.CODE');
this.state.loading = true;
this.props.dispatch({
type: 'app/getDataByPost',
@@ -107,15 +114,23 @@ class SE061PaperPage extends React.Component {
return;
}
-
let json = initFilter(this.props.login.OrgId, '', 'Nav_Test.TYPE', 1);
+ json.Parameter22 = this.props.data.ORG_ID_HV;
json.OrgType = 2;
- extendRule(json, 'RECORD_ID', 1, this.props.data.id);
+ // extendRule(json, 'TEXT_ID', 1, this.props.data.id);//RECORD_ID 这个是哪个页面 考试
+ // extendRule(json, 'RECORD_ID', 1, this.props.data.id);// dataid 标准化执行 > 安全教育与培训 > 新三级安全教育记录 小眼睛 查看 有数据
+
+ if (this.props.data.TaskID) {
+ extendRule(json, 'TEXT_ID', 1, this.props.data.id);//RECORD_ID 这个是哪里的 考试
+ } else {
+ extendRule(json, 'RECORD_ID', 1, this.props.data.id);// 标准化执行 > 安全教育与培训 > 新三级安全教育记录 小眼睛 查看 有数据
+ }
+
extendRule(json, 'USER_ID', 1, SelUsrID);
extendInclude(json, 'Nav_Record');
-
extendInclude(json, 'Nav_Test');
extendInclude(json, 'Nav_User');
+ extendInclude(json, 'Nav_Text');
this.state.loading = true;
this.props.dispatch({
type: 'app/getDataByPost',
@@ -130,11 +145,17 @@ class SE061PaperPage extends React.Component {
let notify = record ? record.Nav_Notify : null;
let NAME = record.NAME;
let hasAnswered = false;
- for (let i = 0; i < ret.Nav_Papers.length; i++) {
- if (ret.Nav_Papers[i].ANSWER !== 0) {
- hasAnswered = true;
+ if (!this.props.data.TaskID) {
+ hasAnswered = true;
+ }
+ if (!hasAnswered) {
+ for (let i = 0; i < ret.Nav_Papers.length; i++) {
+ if (ret.Nav_Papers[i].ANSWER !== 0) {
+ hasAnswered = true;
+ }
}
}
+
this.setState({
papers,
config,
@@ -153,7 +174,24 @@ class SE061PaperPage extends React.Component {
loadData = (dataid) => {
if (this.props.data.id == "")
return;
- this.getUsers(dataid);
+ // this.getUsers(dataid);
+ //如果是待办进来 不要 getUsers 直接获取登录者的试卷进行答题
+ if (this.props.data.TaskID && (this.props.data.tableKey == '1' || this.props.data.tableKey == '2')) {
+ var UserList = []
+ UserList.push({
+ ID: this.props.login.user.ID,
+ CODE: this.props.login.user.CODE,
+ NAME: this.props.login.user.NAME,
+ })
+ this.setState({
+ SelUsrID: this.props.login.user.ID,
+ UserList: UserList
+ }, () => {
+ this.getPapers();
+ });
+ } else {
+ this.getUsers(dataid);
+ }
}
onSave = () => {
if (this.state.readonly) {
@@ -175,8 +213,10 @@ class SE061PaperPage extends React.Component {
Nav_Config: JSON.parse(JSON.stringify(this.state.config)),
Nav_Papers: JSON.parse(JSON.stringify(this.state.papers)),
TaskID: this.props.data.TaskID,
+ TEXT_ID: this.props.data.id,
ORG_ID: this.props.login.OrgId,
}
+
this.props.dispatch({
type: 'app/getDataByPost',
payload: data,
@@ -185,6 +225,11 @@ class SE061PaperPage extends React.Component {
if (ret) {
message.success('提交成功');
this.BtnClose();
+ } else if (ret === false) {
+ //请重新考试
+ setTimeout(() => {
+ this.props.data.onCancel();
+ }, 3000);
}
}
});
@@ -269,44 +314,53 @@ class SE061PaperPage extends React.Component {
}
return str;
}
+
+ //分数计算
CalcScore = () => {
if (!this.state.readonly) {
return "";
- }
- let score = 0;
- let sscore = 1;
- let mscore = 1;
- let cscore = 1;
- if (this.state.config) {
- if (this.state.config.S_TEST_SCORE > 0) {
- sscore = this.state.config.S_TEST_SCORE;
- }
- if (this.state.config.M_TEST_SCORE > 0) {
- mscore = this.state.config.M_TEST_SCORE;
- }
- if (this.state.config.C_TEST_SCORE > 0) {
- cscore = this.state.config.C_TEST_SCORE;
- }
- }
- this.state.papers.map((it, idx) => {
- if (it.ANSWER !== 0 && it.ANSWER == it.Nav_Test.ANSWER) {
- switch (it.Nav_Test.TYPE) {
- case 0: {
- score += cscore;
- break;
- }
- case 1: {
- score += sscore;
- break;
- }
- case 2: {
- score += mscore;
- break;
- }
+ } else if (this.state.papers == null || this.state.papers.length < 1) {
+ return "";
+ } else if (this.state.papers[0].Nav_Text != null) {
+ //新增表单 有存分数 后台排序 最后的显示在最前面
+ return this.state.papers[0].Nav_Text.SCORE ? this.state.papers[0].Nav_Text.SCORE : "";
+ } else {
+ //按理不能来这边
+ let score = 0;
+ let sscore = 1;
+ let mscore = 1;
+ let cscore = 1;
+ if (this.state.config) {
+ if (this.state.config.S_TEST_SCORE > 0) {
+ sscore = this.state.config.S_TEST_SCORE;
+ }
+ if (this.state.config.M_TEST_SCORE > 0) {
+ mscore = this.state.config.M_TEST_SCORE;
+ }
+ if (this.state.config.C_TEST_SCORE > 0) {
+ cscore = this.state.config.C_TEST_SCORE;
}
}
- })
- return score;
+ this.state.papers.map((it, idx) => {
+ if (it.ANSWER !== 0 && it.ANSWER == it.Nav_Test.ANSWER) {
+ switch (it.Nav_Test.TYPE) {
+ case 0: {
+ score += cscore;
+ break;
+ }
+ case 1: {
+ score += sscore;
+ break;
+ }
+ case 2: {
+ score += mscore;
+ break;
+ }
+ }
+ }
+ })
+ return score;
+ }
}
getType(type) {
let ret = '';
@@ -394,19 +448,19 @@ class SE061PaperPage extends React.Component {
{
it.Nav_Test.TYPE === 0 ?
- this.doOptionChange(it, idx, 1, evt)} />
- 正确
+ this.doOptionChange(it, idx, 1, evt)} >正确
+ {/* */}
|
:
{
it.Nav_Test.TYPE === 1 ?
- this.doOptionChange(it, idx, 1, evt)} />
+ this.doOptionChange(it, idx, 1, evt)} >A.{it.Nav_Test.OPTION_A}
:
- this.doOptionChange(it, idx, 1, evt)} />
+ this.doOptionChange(it, idx, 1, evt)} >A.{it.Nav_Test.OPTION_A}
}
- A.
- {it.Nav_Test.OPTION_A}
+ {/* A.
+ {it.Nav_Test.OPTION_A} */}
|
}
@@ -414,19 +468,19 @@ class SE061PaperPage extends React.Component {
{
it.Nav_Test.TYPE === 0 ?
- this.doOptionChange(it, idx, 2, evt)} />
- 错误
+ this.doOptionChange(it, idx, 2, evt)} >错误
+ {/* 错误 */}
|
:
{
it.Nav_Test.TYPE === 1 ?
- this.doOptionChange(it, idx, 2, evt)} />
+ this.doOptionChange(it, idx, 2, evt)} >B.{it.Nav_Test.OPTION_B}
:
- this.doOptionChange(it, idx, 2, evt)} />
+ this.doOptionChange(it, idx, 2, evt)} >B.{it.Nav_Test.OPTION_B}
}
- B.
- {it.Nav_Test.OPTION_B}
+ {/* B.
+ {it.Nav_Test.OPTION_B} */}
|
}
@@ -436,12 +490,12 @@ class SE061PaperPage extends React.Component {
{
it.Nav_Test.TYPE === 1 ?
- this.doOptionChange(it, idx, 4, evt)} />
+ this.doOptionChange(it, idx, 4, evt)} >C.{it.Nav_Test.OPTION_C}
:
- this.doOptionChange(it, idx, 4, evt)} />
+ this.doOptionChange(it, idx, 4, evt)} >C.{it.Nav_Test.OPTION_C}
}
- C.
- {it.Nav_Test.OPTION_C}
+ {/* C.
+ {it.Nav_Test.OPTION_C} */}
|
}
@@ -451,12 +505,12 @@ class SE061PaperPage extends React.Component {
{
it.Nav_Test.TYPE === 1 ?
- this.doOptionChange(it, idx, 8, evt)} />
+ this.doOptionChange(it, idx, 8, evt)} >D.{it.Nav_Test.OPTION_D}
:
- this.doOptionChange(it, idx, 8, evt)} />
+ this.doOptionChange(it, idx, 8, evt)} >D.{it.Nav_Test.OPTION_D}
}
- D.
- {it.Nav_Test.OPTION_D}
+ {/* D.
+ {it.Nav_Test.OPTION_D} */}
|
}
@@ -466,12 +520,12 @@ class SE061PaperPage extends React.Component {
{
it.Nav_Test.TYPE === 1 ?
- this.doOptionChange(it, idx, 16, evt)} />
+ this.doOptionChange(it, idx, 16, evt)} >E.{it.Nav_Test.OPTION_E}
:
- this.doOptionChange(it, idx, 16, evt)} />
+ this.doOptionChange(it, idx, 16, evt)} >E.{it.Nav_Test.OPTION_E}
}
- E.
- {it.Nav_Test.OPTION_E}
+ {/* E.
+ {it.Nav_Test.OPTION_E} */}
|
}
diff --git a/src/components/CustomPages/SE/SE062ShowPrint.js b/src/components/CustomPages/SE/SE062ShowPrint.js
index 734349b..5230fbe 100644
--- a/src/components/CustomPages/SE/SE062ShowPrint.js
+++ b/src/components/CustomPages/SE/SE062ShowPrint.js
@@ -1,7 +1,7 @@
import { message } from "antd/lib/index";
import { Button, Descriptions, Modal, Row, Col, Checkbox, Radio, Form, Input, Select, Table, Upload, Icon, PageHeader } from 'antd';
import React from 'react';
-import { initFilter, extendRule, extendInclude, GetFileModel, guid, initQueryFilter, showFiles } from "../../../utils/common";
+import { initFilter, extendRule, extendInclude, GetFileModel, guid, getArryPropShow, showFiles } from "../../../utils/common";
import ReactToPrint from "react-to-print";
import styles from '../../CustomPages/HI/StepForm.css';
import XLSX from 'xlsx';
@@ -48,6 +48,7 @@ class SE062ShowPrint extends React.Component {
extendInclude(json, 'Nav_NewUser.Nav_User');
extendInclude(json, 'Nav_NewUser.Nav_Content');
extendInclude(json, 'Nav_NewUser.Nav_Files.Nav_ImgFile');
+ extendInclude(json, 'Nav_NewUser.Nav_Teachers.Nav_User');
extendInclude(json, 'Nav_User');
extendInclude(json, 'Nav_Department');
@@ -120,6 +121,7 @@ class SE062ShowPrint extends React.Component {
}
})
}
+
render() {
const { data } = this.state;
const enums = this.props.data.enums ? this.props.data.enums : this.props.app.enums;
@@ -144,8 +146,10 @@ class SE062ShowPrint extends React.Component {
{data ? data.Nav_NewUser.END_TIME : null}
{data ? data.Nav_NewUser.TRAINNING_TIME : null}
{data ? data.Nav_NewUser.TAINNING_ADDR : null}
- {data ? data.Nav_NewUser.TEACHER : null}
- {data ? this.returnModel(data.Nav_NewUser.TRAIN_MODEL) : null}
+ {/* {data ? data.Nav_NewUser.TEACHER : null} */}
+ {getArryPropShow(data.Nav_NewUser.Nav_Teachers, "Nav_User.NAME")}
+ {/* {data ? this.returnModel(data.Nav_NewUser.TRAIN_MODEL) : null} */}
+ {enums.TrainType.enums[data.Nav_NewUser?.TRAINTYPE]}
{data && data.Nav_NewUser.Nav_Content ? data.Nav_NewUser.Nav_Content.NAME : ''}
{showFiles(data.Nav_NewUser.Nav_Files, config.picServerHost, this)}
@@ -163,7 +167,7 @@ class SE062ShowPrint extends React.Component {
{data ? data.SCORE : null}
{/* {data ? data.EXAMINATION_RESULTS == 1 ? "合格" : "不合格" : null} */}
{(data && data.EXAMINATION_RESULTS && data.SCORE) ? enums.SEExaminationResultsEnum.enums[data.EXAMINATION_RESULTS] : ""}
- {data ? this.returnModel(data.Nav_NewUser.TRAIN_MODEL) : null}
+ {/* {data ? this.returnModel(data.Nav_NewUser.TRAIN_MODEL) : null} */}
{showFiles(data.Nav_Files, config.picServerHost, this)}
: null
diff --git a/src/files/edit/SE061.js b/src/files/edit/SE061.js
index c03b436..4715626 100644
--- a/src/files/edit/SE061.js
+++ b/src/files/edit/SE061.js
@@ -10,7 +10,7 @@ export default {
params.record.TaskID = params.data.TaskID //TaskID传递消息表ID
params.record.PUBLISH = params.customParams;
},
- onBeforeEdit: ({ isNew, stateData, setFieldVisible, setFieldValue, setRowFieldVisible }) => {
+ onBeforeEdit: ({ isNew, stateData, setFieldVisible, setRowFieldLabel, setRowFieldVisible }) => {
if (stateData.IS_CREATETEST == 0) {
setRowFieldVisible("T_SE_NEW_USER_DETAIL", { "SCORE": true, "EXAMINATION_RESULTS": true, "Nav_Files": true })
} else if (stateData.IS_CREATETEST == 1) {
@@ -20,6 +20,21 @@ export default {
if (stateData.TRAIN_STATUS == 3) {
setRowFieldVisible("T_SE_NEW_USER_DETAIL", { "Nav_DepartmentNext.NAME": false })
}
+ // TRAIN_STATUS 公司级 = 0, 部门级 = 1, 车间级 = 2, 班组级 = 3,
+ // Nav_DepartmentNext.NAME
+ if (stateData.TRAIN_STATUS == 0) {
+ setRowFieldLabel(
+ "T_SE_NEW_USER_DETAIL", {
+ 'Nav_DepartmentNext.NAME': '部门/车间级培训组织'
+ })
+ } else if (stateData.TRAIN_STATUS == 1) {
+ setRowFieldLabel(
+ "T_SE_NEW_USER_DETAIL", {
+ 'Nav_DepartmentNext.NAME': '班组级培训组织'
+ })
+ } else if (stateData.TRAIN_STATUS == 2 || stateData.TRAIN_STATUS == 3) {
+ // 列不可见
+ }
},
onChange: ({ isNew, stateData, setFieldVisible, setFieldValue, setRowFieldVisible }) => {
if (stateData.IS_CREATETEST == 0) {
diff --git a/src/utils/common.js b/src/utils/common.js
index d074608..77dd3a8 100644
--- a/src/utils/common.js
+++ b/src/utils/common.js
@@ -1937,4 +1937,19 @@ export function showEnum(enums, TRAIN_TYPE) {
}
}
return result
+}
+
+
+/****** 附件ListModel的某个二级属性 getArryPropShow(data.Nav_Teachers, "Nav_User.NAME") ******/
+export function getArryPropShow(arry, propPath) {
+ var arryShow = ''
+ const [prop1, prop2] = propPath.split('.');
+ if (arry && arry.length > 0 && propPath) {
+ arry.map(function (item, index) {
+ var itemProp = item[prop1]?.[prop2]
+ if (itemProp && itemProp.length > 0)
+ arryShow += (index > 0 ? ',' : '') + itemProp;
+ });
+ }
+ return arryShow;
}
\ No newline at end of file
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 2/2] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=BA=93=E4=B8=8A?=
=?UTF-8?q?=E4=BC=A0=E4=BF=AE=E6=94=B9=20=E5=8F=AA=E6=9C=89=E4=B8=8A?=
=?UTF-8?q?=E4=BC=A0=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 <>
+
+ >
+ } 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 &&
+
+ }
+
+ {/*
+
+ */}
+ {/*
+
+ */}
+
+
+
+ >
+ }
+ },
+}
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 <>
-
- >
- } 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 &&
}
-
- {/*
-
- */}
- {/*
-
- */}