提交 dc429174 authored 作者: 徐立's avatar 徐立

合并

......@@ -23,6 +23,7 @@ export default function MyApplyList({
fileSpan = defaultFieldSpan,
tableRowKey = 'buzinessId',
columns = [],
scroll,
}) {
const pageSearch = {
search: {
......@@ -39,6 +40,7 @@ export default function MyApplyList({
nameSpan,
fileSpan,
},
scroll,
tableRowKey,
columns,
};
......
......@@ -11,11 +11,14 @@ import { Toast } from 'antd-mobile'
import router from 'umi/router'
import IsNewTable from './isNewMobileTable';
import NewWebTable from './isNewWebTable';
import maintain from '../assets/maintain.png'
import moment from 'moment'
export default class ZdyTable extends Component {
constructor(props) {
super(props)
this.state = {
selects: new Map(),
left: 0,
top: 0,
......@@ -34,10 +37,11 @@ export default class ZdyTable extends Component {
isEdit: true,
isReady: false,
formConfig: {},
}
}
componentDidMount(){
componentDidMount() {
let {
postData, // 数据源
isCg, // 用户点击草稿页面进入
......@@ -356,7 +360,7 @@ export default class ZdyTable extends Component {
})
return max
}
render() {
let {
width,
......@@ -367,6 +371,7 @@ export default class ZdyTable extends Component {
defaultValues,
items,
init,
modalTitle,
currentFormKey,
isEdit,
datas,
......@@ -383,6 +388,8 @@ export default class ZdyTable extends Component {
fatherCode,
routerState, // 场景设计器共享路由参数
messageData, // 场景设计器共享变量参数 设计器监听到参数发生变化后会重新渲染组件
postData,
modalInit,
} = this.props
let style = {}
if (formConfig.style != null) {
......@@ -416,33 +423,55 @@ export default class ZdyTable extends Component {
borderLeft: "1px solid gray",
borderTop: "1px solid gray"
}
let updateTime
const styleDiv = this.props.height ? { overflow: "auto", width: "100%", height: this.props.height } : { overflow: "auto", width: "100%" }
if (!isReady) return <></>
if (this.props.postData?.isUpdate) {
updateTime = moment(+this.props.postData?.updateTime).format('llll')
}
switch (get) {
case 'web':
return (
<Form
className="login-form" >
{isEdit && defaultBinds ? Object.keys(defaultBinds).map((k) => {
const r = defaultBinds[k]
if (r.columnIds == null || r.columnIds.length < 2 || r.sqls == null || r.sqls.length < 2) {
return ""
}
const name = r.columnIds[r.columnIds.length - 1]
const key = r.sqls[r.sqls.length - 1]
const value = defaultValues[key]
if (value == null) {
return ""
}
return this.props.form.getFieldDecorator(name, {
initialValue: value
})(<Input type="hidden" />);
}) : ""}
return (<>
{this.props.postData?.isUpdate ?
<div style={{ margin: '100px 24px 24px' }}>
<div style={{ textAlign: 'center' }}>
<img style={{ marginRight: 30 }} src={maintain}></img>
</div>
<p style={{
textAlign: "center",
width: '100%',
fontSize: '16px',
fontWeight: 'bold',
color: '#666666',
}}
>
{updateTime !== 'Invalid date' ?
`升级维护中,预计${updateTime ?? '一万年'}恢复使用,请耐心等待。` :
'请耐心等待'}
</p>
</div>
:<Form
className="login-form" >
{isEdit && defaultBinds ? Object.keys(defaultBinds).map((k) => {
const r = defaultBinds[k]
if (r.columnIds == null || r.columnIds.length < 2 || r.sqls == null || r.sqls.length < 2) {
return ""
}
const name = r.columnIds[r.columnIds.length - 1]
const key = r.sqls[r.sqls.length - 1]
const value = defaultValues[key]
if (value == null) {
return ""
}
return this.props.form.getFieldDecorator(name, {
initialValue: value
})(<Input type="hidden" />);
}) : ""}
<Row>
<Col span={24}>
......@@ -567,22 +596,43 @@ export default class ZdyTable extends Component {
</Row>
</Form>
)
}</>)
case 'mobile':
return (
<Form {...formItemLayout} id='mobile_table' className="login-form">
{defaultBinds ? Object.keys(defaultBinds).map((k) => {
const r = defaultBinds[k]
if (r.columnIds == null || r.columnIds.length < 2 || r.sqls == null || r.sqls.length < 2) {
return ""
}
const name = r.columnIds[r.columnIds.length - 1]
const key = r.sqls[r.sqls.length - 1]
const value = defaultValues[key]
if (value == null) {
return ""
}
return (<>
{this.props.postData?.isUpdate ?
<div style={{ margin: '100px 24px 24px' }}>
<div style={{ textAlign: 'center' }}>
<img style={{ width: '100%' }} src={maintain}></img>
</div>
<p style={{
textAlign: "center",
width: '100%',
fontSize: '16px',
fontWeight: 'bold',
color: '#666666',
}}
>
{updateTime !== 'Invalid date' ?
`升级维护中,预计${updateTime ?? '一万年'}恢复使用,请耐心等待。` :
'请耐心等待'}
</p>
</div>
:
<Form {...formItemLayout} id='mobile_table' className="login-form">
{defaultBinds ? Object.keys(defaultBinds).map((k) => {
const r = defaultBinds[k]
if (r.columnIds == null || r.columnIds.length < 2 || r.sqls == null || r.sqls.length < 2) {
return ""
}
const name = r.columnIds[r.columnIds.length - 1]
const key = r.sqls[r.sqls.length - 1]
const value = defaultValues[key]
if (value == null) {
return ""
}
return this.props.form.getFieldDecorator(name, {
initialValue: value
......@@ -661,7 +711,7 @@ export default class ZdyTable extends Component {
})
} */}
</Form>
)
}</>)
}
}
}
import React, { Children } from "react";
import {Button, Form, Input, InputNumber, Modal, Select} from "antd";
export default class FormModal extends React.Component {
render() {
return (
<Modal
destroyOnClose
title={this.props.title}
maskClosable={false}
visible={this.props.visible}
footer={null}
onCancel={this.props.handleCancel}
>
{this.props.children}
</Modal>
);
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@
*/
import React, { Component } from 'react';
import md5 from 'js-md5';
import FormModal from './FormModal'
import {
message,
Icon,
......@@ -140,14 +141,23 @@ 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)=>{
this.setState({isShowModal:true,modalInit:data,modalTitle:title,modalCode:fk})
}
equal = (obj1, obj2, json, sqlContent, depth) => {
......@@ -1111,11 +1121,13 @@ export default class tableCom extends Component {
}
getFunctionValue = (fun, column, json, callback) => {
/* if (!this.props.isEdit) {
return
} */
const base52 = column.base52
/**
* 中台函数库注入
* 动态生成表单配置函数所使用
......@@ -1127,7 +1139,7 @@ export default class tableCom extends Component {
})
})
try {
var fun1 = new Function("obj","init", "defaultValues", "env", "index", "fatherCode", "utils","$","routerState",'shareData', fun);
var fun1 = new Function("obj","init","modalInit", "defaultValues", "env", "index", "fatherCode", "utils","$","routerState",'shareData', fun);
let obj
if(!this.props.isEdit&&this.props.fatherCode){
......@@ -1139,21 +1151,21 @@ export default class tableCom extends Component {
const value = fun1(obj, this.props.init, this.props.defaultValues, { clientType: this.props.get, formCode: this.props.formCode, formId: this.props.formId }, this.props.index, this.props.fatherCode,
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 }, this.props.index, this.props.fatherCode,
{
moment: moment,
sql: this.sqlUtil.bind(this, base52, json, callback),
message: message, router: router,
setValues: this.setValues.bind(this, base52, json),
req: this.reqUtil.bind(this, base52, json, callback),
md5: md5,
md5: md5, showModal:this.showModal,
render:this.getRender,base64:getBase64,
},
functionObj,
this.props.routerState,
this.props.messageData,
)
if (base52) {
if (value != null && value == "norefeshxxxxxxxxxxxxxxxxxxxx") {
......@@ -1180,7 +1192,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)
......@@ -1471,7 +1485,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) {
......@@ -2289,6 +2303,7 @@ export default class tableCom extends Component {
})(<Input type="hidden" />);
break;
case 'InputNumber':
/* if (get === 'mobile') {
cm = (<div className={styles.form}><MobileInputItem
......@@ -2774,6 +2789,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}
......@@ -2831,30 +2850,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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论