mh_jy_safe_web/src/files/edit/SE072.js

157 lines
4.9 KiB
JavaScript
Raw Normal View History

import { message } from "antd/lib/index";
import { getPropertyData, extendInclude, extendRule, auditOptionShow, initFilter, guid, getCustomParams } from "../../utils/common";
import FormPage from '../../components/FormPage';
import ShowModal from '../../components/common/ShowModal';
import { Button } from 'antd'
/**
* @return {string}
*/
// 编辑
export default {
onBeforeSaveHandleRecord(params) {
// debugger
2026-03-27 16:50:43 +08:00
// if (params != null && params.record != null && params.record.Nav_Detail != null && params.record.Nav_Detail.length > 0) {
// params.record.Nav_Detail.forEach(e => {
// var TestID = guid()
// if (e.TEST_ID == undefined) {
// e.CREATER_ID = null
// e.CREATE_TIME = null
// e.FLOW_ID = null
// e.ENTITY_ORG_TPYE = 0
// e.FLOW_ID = null
// e.FLOW_SEND_STATUS = 0
// e.FLOW_STATUS = 0
// e.FORM_ID = null
// e.IS_DELETED = false
// e.MODIFIER_ID = null
// e.MODIFY_TIME = null
// e.NUM = 0
// e.SCOREPER = 0
// e.TEST_ID = TestID
// e.TaskID = '00000000-0000-0000-0000-000000000000'
// e.Nav_Test.ID = TestID
// e.Nav_Test.ANSWER = 1
// e.Nav_Test.ORG_ID = e.ORG_ID
// e.Nav_Test.TaskID = '00000000-0000-0000-0000-000000000000'
// e.Nav_Test.IS_DELETED = false
// }
// })
// }
},
btnSubAdd: ({ record, parentRecord, setState, data, stateData, close, loadData, login, btn, closeForm, onCancel }) => {//setStateData 报错
let dataSubForm = {
content: <FormPage formCode={btn.FORM_CODE} data={{
id: (record ? record.ID : (stateData && stateData.ID ? stateData.ID : '')),
homeReload: true,
...getCustomParams(btn.CUSTOM_PARAMS),
rules: [parentRecord],
close: () => {
if (login.RegD && login.RegD.length > 0) {
if (stateData.Nav_Detail == null) {
stateData.Nav_Detail = []
}
login.RegD.forEach(e => {
stateData.Nav_Detail.push(e)
})
}
login.RegD = {}
},
onCancel: () => {
//wyw 此方法要有不能被删除 别处会重写
debugger
},
}} />,
};
return {
content: <ShowModal data={dataSubForm} login={login} title={btn.LABEL}>
<Button type={btn.CSS} icon={btn.ICON}>{btn.LABEL}</Button>
</ShowModal>
}
},
2026-03-27 16:50:43 +08:00
onSubChange: ({ value, pageCode, record, colInfo, dispatch, stateData, props, saveRowRecord }) => {
if (colInfo.FIELD_NAME == "TYPE") {
if (record.TYPE == 0) {
stateData.Nav_Detail.forEach(e => {
if (e.ID == record.ID) {
e.OPTION_A = "正确"
e.OPTION_B = "错误"
}
})
record.OPTION_A = "正确"
record.OPTION_B = "错误"
}
}
},
//导入的题目不可编辑
handleRenderRowControl(params) {
// 新增时页面需要重写
// 编辑时页面不能重写 去题库修改
if (params.record.Nav_Test != undefined) {
//说明后台导入 不可编辑
// if (params.colConfig.field === 'TYPE') {
// debugger
// // return <>
// // <p className={styles.pLin} title={params.record.CHECKRESULT_DESCRIPTION}> {params.record.CHECKRESULT_DESCRIPTION}</p>
// // </>
// // return <>
// // {params.record.TYPE}
// // </>
// }
if (params.colConfig.field === 'NAME') {
return <>
{params.record.NAME}
</>
}
if (params.colConfig.field === 'ANSWERSHOW') {
return <>
{params.record.ANSWERSHOW}
</>
}
if (params.colConfig.field === 'OPTION_A') {
return <>
{params.record.OPTION_A}
</>
}
if (params.colConfig.field === 'OPTION_B') {
return <>
{params.record.OPTION_B}
</>
}
if (params.colConfig.field === 'OPTION_C') {
return <>
{params.record.OPTION_C}
</>
}
if (params.colConfig.field === 'OPTION_D') {
return <>
{params.record.OPTION_D}
</>
}
if (params.colConfig.field === 'OPTION_E') {
return <>
{params.record.OPTION_E}
</>
}
} else if (params.record != undefined && params.record.TYPE != undefined && params.record.TYPE == 0) {
if (params.colConfig.field === 'OPTION_A') {
return <>
{params.record.OPTION_A}
</>
}
if (params.colConfig.field === 'OPTION_B') {
return <>{params.record.OPTION_B}</>
}
if (params.colConfig.field === 'OPTION_C') {
return <></>
}
if (params.colConfig.field === 'OPTION_D') {
return <></>
}
if (params.colConfig.field === 'OPTION_E') {
return <></>
}
}
}
}