提交 7a1d69de authored 作者: chscls@163.com's avatar chscls@163.com

弹出框函数

上级 0d669149
......@@ -11,7 +11,6 @@ import { Toast } from 'antd-mobile'
import router from 'umi/router'
import IsNewTable from './isNewTable';
import maintain from '../assets/maintain.png'
import FormModal from '../tableCompon/FormModal'
import moment from 'moment'
export default class ZdyTable extends Component {
constructor(props) {
......@@ -37,13 +36,10 @@ export default class ZdyTable extends Component {
isEdit: true,
isReady: false,
formConfig: {},
modalCode:null,
modalTitle:"",
}
}
showModal=(modalCode,modalTitle)=>{
this.setState({modalCode,modalTitle,isShowModal:true})
}
componentDidMount() {
let {
postData, // 数据源
......@@ -363,9 +359,7 @@ export default class ZdyTable extends Component {
})
return max
}
handleCancel=()=>{
this.setState({isShowModal:false})
}
render() {
let { width,
isBorder,
......@@ -383,8 +377,7 @@ export default class ZdyTable extends Component {
formConfig,
formCode,
formId,
isShowModal,
modalCode,
} = this.state
let { border,
get,
......@@ -393,6 +386,7 @@ export default class ZdyTable extends Component {
fatherCode,
routerState,
postData,
modalInit
} = this.props
let style = {}
if (formConfig.style != null) {
......@@ -473,7 +467,7 @@ export default class ZdyTable extends Component {
})(<Input type="hidden" />);
}) : ""}
<FormModal visible={isShowModal} handleCancel={this.handleCancel} title={modalTitle}>{modalCode}</FormModal>
<Row>
<Col span={24}>
<div
......@@ -521,8 +515,7 @@ export default class ZdyTable extends Component {
}} >
<TableCom
showModal={this.showModal}
modalInit={this.props.modalInit||{}}
modalInit={modalInit||{}}
formCode={formCode} // 当前表单code
formId={formId} // 当前表单Id
i={i} // 当前组件下标
......@@ -606,7 +599,7 @@ export default class ZdyTable extends Component {
})(<Input type="hidden" />);
}) : ""}
<FormModal visible={isShowModal} handleCancel={this.handleCancel} title={modalTitle}>{modalCode}</FormModal>
{
items.map((item, i) => {
const allhidden = this.checkAllHidden(items)
......@@ -624,8 +617,7 @@ export default class ZdyTable extends Component {
item.map((ary, j) => {
return !allhidden && ary.hidden ? ""
: <><TableCom
showModal={this.showModal}
modalInit={this.props.modalInit||{}}
modalInit={modalInit||{}}
formCode={formCode}
formId={formId}
i={i}
......
......@@ -14,6 +14,7 @@ export default class FormModal extends React.Component {
<Modal
destroyOnClose
title={this.props.title}
maskClosable={false}
visible={this.props.visible}
footer={null}
onCancel={this.props.handleCancel}
......
......@@ -5,6 +5,7 @@
*/
import React, { Component } from 'react';
import md5 from 'js-md5';
import FormModal from './FormModal'
import {
message,
Icon,
......@@ -140,18 +141,22 @@ export default class tableCom extends Component {
sqlModel: {},
columns: [],
sqlContent: null,
isShowModal:false,
modalTitle:"",
modalInit:{},
modalCode:null,
dataSource: {
list: [],
pagination: false
},
};
excludeKeys = ["defaultValues", ""]
handleCancel=()=>{
this.setState({isShowModal:false})
}
showModal=(fk,title,data)=>{
const {datas,get,isEdit,obj,init,mapData,sqlData,defaultValues}=this.props
const child =<ZdyTable modalInit={data} key={fk} datas={datas} get={get} isChild={true} currentFormKey={fk} isEdit={isEdit} obj={obj} init={init} form={this.props.form} mapData={mapData} sqlData={sqlData} {...datas[fk]} defaultValues={defaultValues} />
this.props.showModal(child,title)
this.setState({isShowModal:true,modalInit:data,modalTitle:title,modalCode:fk})
}
equal = (obj1, obj2, json, sqlContent, depth) => {
......@@ -1116,11 +1121,13 @@ export default class tableCom extends Component {
}
getFunctionValue = (fun, column, json, callback) => {
/* if (!this.props.isEdit) {
return
} */
const base52 = column.base52
/**
* 中台函数库注入
* 动态生成表单配置函数所使用
......@@ -1157,7 +1164,7 @@ export default class tableCom extends Component {
functionObj,
this.props.routerState
)
if (base52) {
if (value != null && value == "norefeshxxxxxxxxxxxxxxxxxxxx") {
......@@ -1184,7 +1191,9 @@ export default class tableCom extends Component {
this.setState({ option: value })
} else {
try {
this.props.form.setFieldsValue({ [base52]: value })
} catch{
console.log(`页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,函数内部错误,`, e)
//message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,函数内部错误${e}`, 10)
......@@ -1475,7 +1484,7 @@ export default class tableCom extends Component {
* obj为查看详情用户输入值
*/
let { json, obj, mapData, init, sqlData, defaultValues, get, formKey, isEdit, datas } = this.props;
const { options, labels, selectDis } = this.state;
const { options, labels, selectDis,modalCode,modalTitle,isShowModal,modalInit } = this.state;
const { getFieldDecorator, getFieldError, getFieldProps } = this.props.form;
const disabled = json != null ? json.disabled : false
if (json == null) {
......@@ -2275,6 +2284,7 @@ export default class tableCom extends Component {
})(<Input type="hidden" />);
break;
case 'InputNumber':
/* if (get === 'mobile') {
cm = (<div className={styles.form}><MobileInputItem
......@@ -2730,6 +2740,10 @@ export default class tableCom extends Component {
* 卡片类型
*/
return (<Card style={{ margin: 5, border: '1px solid #ccc' }}>
{modalCode?<FormModal visible={isShowModal} handleCancel={this.handleCancel} title={modalTitle}>
<ZdyTable modalInit={modalInit} key={modalCode} datas={datas} get={get} isChild={true} currentFormKey={modalCode} isEdit={isEdit} obj={obj} init={init} form={this.props.form} mapData={mapData} sqlData={sqlData} {...datas[modalCode]} defaultValues={defaultValues} />
</FormModal>:""}
<Card.Header title={<span style={{ fontSize: 14 }}>{title}:</span>} />
<Card.Body>
{cm}
......@@ -2787,30 +2801,45 @@ export default class tableCom extends Component {
>
{cm}
</Col>
{modalCode?<FormModal visible={isShowModal} handleCancel={this.handleCancel} title={modalTitle}>
<ZdyTable modalInit={modalInit} key={modalCode} datas={datas} get={get} isChild={true} currentFormKey={modalCode} isEdit={isEdit} obj={obj} init={init} form={this.props.form} mapData={mapData} sqlData={sqlData} {...datas[modalCode]} defaultValues={defaultValues} />
</FormModal>:""}
</Row>
)
} else {
return (
<>{modalCode?<FormModal visible={isShowModal} handleCancel={this.handleCancel} title={modalTitle}>
<ZdyTable modalInit={modalInit} key={modalCode} datas={datas} get={get} isChild={true} currentFormKey={modalCode} isEdit={isEdit} obj={obj} init={init} form={this.props.form} mapData={mapData} sqlData={sqlData} {...datas[modalCode]} defaultValues={defaultValues} />
</FormModal>:""}
<Form.Item
labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }}
label={title}
>
{cm}
</Form.Item>
</Form.Item></>
)
}
} else {
return cm
return <>{modalCode?<FormModal visible={isShowModal} handleCancel={this.handleCancel} title={modalTitle}>
<ZdyTable modalInit={modalInit} key={modalCode} datas={datas} get={get} isChild={true} currentFormKey={modalCode} isEdit={isEdit} obj={obj} init={init} form={this.props.form} mapData={mapData} sqlData={sqlData} {...datas[modalCode]} defaultValues={defaultValues} />
</FormModal>:""}{cm}</>
}
} else {
return (
<>{modalCode?<FormModal visible={isShowModal} handleCancel={this.handleCancel} title={modalTitle}>
<ZdyTable modalInit={modalInit} key={modalCode} datas={datas} get={get} isChild={true} currentFormKey={modalCode} isEdit={isEdit} obj={obj} init={init} form={this.props.form} mapData={mapData} sqlData={sqlData} {...datas[modalCode]} defaultValues={defaultValues} />
</FormModal>:""}
<Form.Item
>
{cm}
</Form.Item>
</Form.Item></>
);
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论