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

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

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