提交 a99dd598 authored 作者: 钟是志's avatar 钟是志

29127 违纪,H5应用增加卡片组件

上级 c1122ace
...@@ -20,7 +20,7 @@ function formatDatas(datas, url = '') { ...@@ -20,7 +20,7 @@ function formatDatas(datas, url = '') {
// 按欢哥的要求 getSqlData 接口要加上appId 参数 // 按欢哥的要求 getSqlData 接口要加上appId 参数
// 解决北电科接口越权的问题. // 解决北电科接口越权的问题.
datas.appId = window.smartFormGlobalProps?.data.appId || window.smartFormGlobalProps?.data.id; datas.appId = window.smartFormGlobalProps?.data.appId || window.smartFormGlobalProps?.data.id;
console.log('getSqlData,AppId', datas.appId); // console.log('getSqlData,AppId', datas.appId);
} }
let datasCode = JSON.stringify(datas); let datasCode = JSON.stringify(datas);
const openIsBinary = window.CONFIG?.IS_BINARY; const openIsBinary = window.CONFIG?.IS_BINARY;
......
...@@ -1055,7 +1055,6 @@ class DetailForm extends React.Component { ...@@ -1055,7 +1055,6 @@ class DetailForm extends React.Component {
} }
//修改候选人分类 //修改候选人分类
onSelect = (value) => { onSelect = (value) => {
// console.log(value);
this.valueDistriBution = '' this.valueDistriBution = ''
this.setState({ this.setState({
optionValue: value, optionValue: value,
......
...@@ -2,13 +2,16 @@ import React, { Fragment, useEffect, useRef } from 'react'; ...@@ -2,13 +2,16 @@ import React, { Fragment, useEffect, useRef } from 'react';
import { WhiteSpace, WingBlank } from 'antd-mobile'; import { WhiteSpace, WingBlank } from 'antd-mobile';
export default function MobileCard(props) { export default function MobileCard(props) {
const { value = {}, onChange, json } = props; const { value = {}, onChange, json, getArguments, tableComProps, dataColumn } = props;
let otherProps = {}; let otherProps = {};
if (json?.otherProps) { if (json?.otherProps) {
otherProps = json?.otherProps; otherProps = json?.otherProps;
try { try {
// mode = multiple 就支持下拉多选了 let arg = {};
otherProps = new Function(otherProps)(); if(typeof getArguments === 'function'){
arg = getArguments({base52: dataColumn.base52}, function() {});
}
otherProps = new Function('functionArguments', 'tableComProps', otherProps)(arg, tableComProps);
} catch (e) { } catch (e) {
console.log('MobileCard组件获取otherProps 报错', e); console.log('MobileCard组件获取otherProps 报错', e);
otherProps = null; otherProps = null;
...@@ -19,7 +22,6 @@ export default function MobileCard(props) { ...@@ -19,7 +22,6 @@ export default function MobileCard(props) {
} }
const dataSource = value?.dataSource || otherProps?.defaultDataSource || []; const dataSource = value?.dataSource || otherProps?.defaultDataSource || [];
const { columns = [], primaryKey = '', style = {} } = otherProps; const { columns = [], primaryKey = '', style = {} } = otherProps;
console.log(otherProps);
return ( return (
<> <>
{dataSource.map((g, index) => { {dataSource.map((g, index) => {
......
...@@ -18,7 +18,6 @@ export default function SwitchWeb(props) { ...@@ -18,7 +18,6 @@ export default function SwitchWeb(props) {
if (value && value === 'true') { if (value && value === 'true') {
onChange(true); onChange(true);
} else { } else {
// console.log(value);
onChange(false); onChange(false);
} }
} }
......
...@@ -1066,9 +1066,55 @@ export default class TableCom extends Component { ...@@ -1066,9 +1066,55 @@ export default class TableCom extends Component {
return 'norefeshxxxxxxxxxxxxxxxxxxxx'; return 'norefeshxxxxxxxxxxxxxxxxxxxx';
}; };
getFunctionValue = (fun, column, json, callback) => { functionArguments = (column, callback) => {
if (this.props.safe) return;
const base52 = column.base52; const base52 = column.base52;
const {
json: jsonStatic,
isEdit,
fatherCode,
form,
defaultValues,
formKey,
fatherObj,
init,
modalInit,
get,
formCode,
taskAssignee,
formId,
userId,
taskId,
index,
uuid,
importExcel,
routerState,
messageData,
concealModel,
} = this.props;
let json = jsonStatic;
if (json) {
json = {
...jsonStatic,
...getActiveJson(formKey, uuid),
};
}
let obj = {};
if (!isEdit && fatherCode) {
obj = {
...fatherObj,
...form.getFieldsValue(),
...defaultValues[formKey],
};
} else {
obj = {
...(fatherObj ? fatherObj : {}),
...this.props.obj,
...form.getFieldsValue(),
...defaultValues[this.props.formKey],
};
}
/** /**
* 中台函数库注入 * 中台函数库注入
...@@ -1080,6 +1126,56 @@ export default class TableCom extends Component { ...@@ -1080,6 +1126,56 @@ export default class TableCom extends Component {
functionObj[arr.callKey] = arr.function; functionObj[arr.callKey] = arr.function;
}); });
}); });
/**
* 中台函数库注入
* 动态生成表单配置函数所使用
*/
return {
obj: obj,
init: init,
modalInit: modalInit,
defaultValues: defaultValues,
env: {
clientType: get,
formCode: formCode,
formId: formId,
isEdit: isEdit,
taskAssignee: taskAssignee,
userId: userId,
taskId: taskId,
},
index,
fatherCode: fatherCode,
utils: {
moment,
sql: this.sqlUtil.bind(this, base52, json, callback), // utils.sql xxx
message,
importExcel: importExcel,
router: router,
uuid: UUID,
setValues: this.setValues.bind(this, base52, json),
req: this.reqUtil.bind(this, base52, json, callback),
md5,
showModal: this.showModal,
closeModal: this.closeModal,
render: getRender,
base64: getBase64,
form: form,
preHandle,
},
functionObj,
routerState,
messageData,
concealModel,
};
}
getFunctionValue = (fun, column, json, callback) => {
if (this.props.safe) return;
const base52 = column.base52;
try { try {
var fun1 = new Function( var fun1 = new Function(
'obj', 'obj',
...@@ -1096,60 +1192,33 @@ export default class TableCom extends Component { ...@@ -1096,60 +1192,33 @@ export default class TableCom extends Component {
'sceneRouter', 'sceneRouter',
fun, fun,
); );
let obj; const {
obj,
if (!this.props.isEdit && this.props.fatherCode) { init,
obj = { modalInit,
...this.props.fatherObj, defaultValues,
...this.props.form.getFieldsValue(), env,
...this.props.defaultValues[this.props.formKey], index,
}; fatherCode,
} else { utils,
obj = { routerState,
...(this.props.fatherObj ? this.props.fatherObj : {}), concealModel,
...this.props.obj, messageData,
...this.props.form.getFieldsValue(), functionObj,
...this.props.defaultValues[this.props.formKey], } = this.functionArguments(column, callback);
};
}
const value = fun1( const value = fun1(
obj, obj,
this.props.init, init,
this.props.modalInit, modalInit,
this.props.defaultValues, defaultValues,
{ env,
clientType: this.props.get, index,
formCode: this.props.formCode, fatherCode,
formId: this.props.formId, utils,
isEdit: this.props.isEdit,
taskAssignee: this.props.taskAssignee,
userId: this.props.userId,
taskId: this.props.taskId,
},
this.props.index,
this.props.fatherCode,
{
// utils函数的参数
moment,
sql: this.sqlUtil.bind(this, base52, json, callback), // utils.sql xxx
message,
importExcel: this.props.importExcel,
router: router,
uuid: UUID,
setValues: this.setValues.bind(this, base52, json),
req: this.reqUtil.bind(this, base52, json, callback),
md5,
showModal: this.showModal,
closeModal: this.closeModal,
render: getRender,
base64: getBase64,
form: this.props.form,
preHandle,
},
functionObj, functionObj,
this.props.routerState, routerState,
this.props.messageData, messageData,
this.props.concealModel, concealModel,
); );
if (base52) { if (base52) {
if (value != null && value == 'norefeshxxxxxxxxxxxxxxxxxxxx') { if (value != null && value == 'norefeshxxxxxxxxxxxxxxxxxxxx') {
...@@ -2137,7 +2206,12 @@ export default class TableCom extends Component { ...@@ -2137,7 +2206,12 @@ export default class TableCom extends Component {
if (!value || value === 'null') { if (!value || value === 'null') {
return <div/>; return <div/>;
} }
cm = <MobileCard value={value} json={json}/>; cm = <MobileCard value={value}
json={json}
getArguments={this.functionArguments}
tableComProps={this.props}
dataColumn={dataColumn}
/>;
break; break;
case 'WangEditor': case 'WangEditor':
let textV = obj[dataColumn.base52]; let textV = obj[dataColumn.base52];
...@@ -3579,6 +3653,9 @@ ${obj[dataColumn.base52]} ...@@ -3579,6 +3653,9 @@ ${obj[dataColumn.base52]}
<MobileCard <MobileCard
json={json} json={json}
uuid={uuid} uuid={uuid}
getArguments={this.functionArguments}
tableComProps={this.props}
dataColumn={dataColumn}
/>); />);
break; break;
case 'RichText': case 'RichText':
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论