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

修复bug

上级 2651542b
......@@ -9,7 +9,8 @@ import { Row, Col, Input, message } from 'antd'
import TableCom from '../tableCompon'
import { Toast } from 'antd-mobile'
import router from 'umi/router'
import IsNewTable from './isNewTable';
import IsNewTable from './isNewMobileTable';
import NewWebTable from './isNewWebTable';
export default class ZdyTable extends Component {
constructor(props) {
super(props)
......@@ -357,7 +358,23 @@ export default class ZdyTable extends Component {
}
render() {
let { width, isBorder, sqlData, mapData, defaultBinds, defaultValues, items, init, currentFormKey, isEdit, datas, isReady, formConfig, formCode, formId } = this.state
let {
width,
isBorder,
sqlData,
mapData,
defaultBinds,
defaultValues,
items,
init,
currentFormKey,
isEdit,
datas,
isReady,
formConfig,
formCode,
formId
} = this.state
let {
border,
get,
......@@ -389,10 +406,15 @@ export default class ZdyTable extends Component {
};
const max = this.countMax(items)
const borderStyle = {
borderRight: "1px solid gray", borderTop: "1px solid gray", borderLeft: "1px solid gray", borderBottom: "1px solid gray"
borderRight: "1px solid gray",
borderTop: "1px solid gray",
borderLeft: "1px solid gray",
borderBottom: "1px solid gray"
}
const borderStyleTwo = { // 处理隐藏组件边框样式问题
borderRight: "1px solid gray", borderLeft: "1px solid gray"
borderRight: "1px solid gray",
borderLeft: "1px solid gray",
borderTop: "1px solid gray"
}
const styleDiv = this.props.height ? { overflow: "auto", width: "100%", height: this.props.height } : { overflow: "auto", width: "100%" }
if (!isReady) return <></>
......@@ -428,6 +450,33 @@ export default class ZdyTable extends Component {
style={styleDiv}
ref={ref => { this.root = ref }}
>
{/* <NewWebTable
items={items}
checkAllHidden={this.checkAllHidden}
border={border}
isBorder={isBorder}
borderStyle={borderStyle}
fatherCode={fatherCode}
index={index}
datas={datas}
isEdit={isEdit}
currentFormKey={currentFormKey}
init={init}
get={get}
obj={obj}
mapData={mapData}
form={this.props.form}
sqlData={sqlData}
defaultValues={defaultValues}
width={width}
formCode={formCode}
style={style}
routerState={routerState} // 兼容表单设计器路由传参
messageData={messageData} // 场景设计器共享变量参数
formId={formId}
fatherObj={this.props.fatherObj}
max={max}
/> */}
<table
style={{
overflow: "auto",
......@@ -443,6 +492,9 @@ export default class ZdyTable extends Component {
return <tr key={i}>
{row.map((cell, j) => {
if(!cell.content){
return
}
let styles = {}
if (cell.content && cell.content.styles) {
try {
......@@ -464,8 +516,13 @@ export default class ZdyTable extends Component {
style={{
overflow: "auto",
textAlign: cell.content && cell.content.calign ? cell.content.calign : "left",
...isBorder ? (cell?.content?.comName == "InputHidden" || !cell?.content?.comName ? {} : borderStyle) : {},
...styles
...isBorder ?
(cell?.content?.comName == "InputHidden" || !cell?.content?.comName ?
{} :borderStyle
) : {},
// position: cell.content&&cell.content.comName ==="InputHidden"&&'absolute',
...styles,
display:cell.content&&cell.content.comName ==="InputHidden"&&'none',
}} >
<TableCom
......@@ -533,7 +590,32 @@ export default class ZdyTable extends Component {
})(<Input type="hidden" />);
}) : ""}
{
<IsNewTable
items={items}
checkAllHidden={this.checkAllHidden}
isBorder={isBorder}
borderStyle={borderStyle}
fatherCode={fatherCode}
index={index}
datas={datas}
isEdit={isEdit}
currentFormKey={currentFormKey}
init={init}
get={get}
obj={obj}
mapData={mapData}
form={this.props.form}
sqlData={sqlData}
defaultValues={defaultValues}
width={width}
formCode={formCode}
style={style}
routerState={routerState} // 兼容表单设计器路由传参
messageData={messageData} // 场景设计器共享变量参数
formId={formId}
fatherObj={this.props.fatherObj}
/>
{/* {
items.map((item, i) => {
const allhidden = this.checkAllHidden(items)
return (<div
......@@ -577,7 +659,7 @@ export default class ZdyTable extends Component {
}
</div>)
})
}
} */}
</Form>
)
}
......
/**
* 测试新表格
*/
import React, { Component } from 'react'
import TableCom from '../tableCompon/index';
import { Card, WhiteSpace } from 'antd-mobile';
import { Row, Col } from 'antd';
export default class isNewTable extends Component {
render() {
const {
items,
checkAllHidden,
isBorder,
borderStyle,
fatherCode,
index,
datas,
isEdit,
currentFormKey,
init,
get,
obj,
mapData,
form,
sqlData,
defaultValues,
width,
routerState,
messageData,
formCode,
formId,
fatherObj,
style
} = this.props
if(!isEdit ){ // 展示栏 暂不做处理
return <>
{
items.map((item, i) => {
const allhidden = checkAllHidden(items)
return (<div
key={i}
style={{
marginTop: 0,
background: '#ffffff',
paddingLeft: 12,
width: '100%',
flexWrap: 'wrap',
...style
}}>
{
item.map((ary, j) => {
return !allhidden && ary.hidden ? ""
: <><TableCom
formCode={formCode}
formId={formId}
i={i}
j={j}
index={index}
fatherCode={fatherCode}
datas={datas}
isEdit={isEdit}
fatherObj={this.props.fatherObj}
formKey={currentFormKey}
init={init}
get={get}
key={j}
sqlData={sqlData}
obj={obj || {}}
form={this.props.form}
mapData={mapData}
json={ary.content}
uuid={ary.uuid}
routerState={routerState} // 兼容表单设计器路由传参
defaultValues={defaultValues || {}}
messageData={messageData} // 场景设计器共享变量参数
/></>
})
}
</div>)
})
}
</>
}
return (
<>
{/* { // Row Col 模式
items.map((item, i) => {
console.log(item)
const allhidden = checkAllHidden(items)
return <> <Row>
{
item.map((ary, j) => {
if(ary.content?.comName==="Label"){
console.log(ary)
return <Col
span={ary.content?.labelSpan}
>
{!allhidden && ary.hidden ? ""
:<><TableCom
formCode={formCode}
formId={formId}
i={i}
j={j}
index={index}
fatherCode={fatherCode}
datas={datas}
isEdit={isEdit}
fatherObj={this.props.fatherObj}
formKey={currentFormKey}
init={init}
get={get}
key={j}
sqlData={sqlData}
obj={obj || {}}
form={this.props.form}
mapData={mapData}
json={ary.content}
uuid={ary.uuid}
routerState={routerState} // 兼容表单设计器路由传参
defaultValues={defaultValues || {}}
messageData={messageData} // 场景设计器共享变量参数
/></>
}</Col>
}
return <Col
span={24}
>
{!allhidden && ary.hidden ? ""
:<><TableCom
formCode={formCode}
formId={formId}
i={i}
j={j}
index={index}
fatherCode={fatherCode}
datas={datas}
isEdit={isEdit}
fatherObj={this.props.fatherObj}
formKey={currentFormKey}
init={init}
get={get}
key={j}
sqlData={sqlData}
obj={obj || {}}
form={this.props.form}
mapData={mapData}
json={ary.content}
uuid={ary.uuid}
routerState={routerState} // 兼容表单设计器路由传参
defaultValues={defaultValues || {}}
messageData={messageData} // 场景设计器共享变量参数
/></>
}</Col>
})
}
</Row>
</>
})
} */}
{ // 卡片模式
items.map((item, i) => {
const allhidden = checkAllHidden(items)
return <> <Card full>
{
item.map((ary, j) => {
if(!ary.content){
return
}
if(ary.content&&ary.content.comName==="Label"){
return <Card.Header
title={
!allhidden && ary.hidden ? ""
:<><TableCom
formCode={formCode}
formId={formId}
i={i}
j={j}
index={index}
fatherCode={fatherCode}
datas={datas}
isEdit={isEdit}
fatherObj={this.props.fatherObj}
formKey={currentFormKey}
init={init}
get={get}
key={j}
sqlData={sqlData}
obj={obj || {}}
form={this.props.form}
mapData={mapData}
json={ary.content}
uuid={ary.uuid}
routerState={routerState} // 兼容表单设计器路由传参
defaultValues={defaultValues || {}}
messageData={messageData} // 场景设计器共享变量参数
/></>
}
/>
}
return !allhidden && ary.hidden ? ""
:<Card.Body
style={{
textAlign:ary.content&&ary.content.comName === 'Table'?"left":'right'
}}
> <><TableCom
formCode={formCode}
formId={formId}
i={i}
j={j}
index={index}
fatherCode={fatherCode}
datas={datas}
isEdit={isEdit}
fatherObj={this.props.fatherObj}
formKey={currentFormKey}
init={init}
get={get}
key={j}
sqlData={sqlData}
obj={obj || {}}
form={this.props.form}
mapData={mapData}
json={ary.content}
uuid={ary.uuid}
routerState={routerState} // 兼容表单设计器路由传参
defaultValues={defaultValues || {}}
messageData={messageData} // 场景设计器共享变量参数
/></>
</Card.Body>
})
}
</Card>
<WhiteSpace />
</>
})
}
</>
)
}
}
/**
* 测试新表格
*/
import React, { Component } from 'react'
import TableCom from '../tableCompon/index';
export default class isNewTable extends Component {
render() {
const {
items,
checkAllHidden,
isBorder,
borderStyle,
fatherCode,
index,
datas,
isEdit,
currentFormKey,
init,
get,
obj,
mapData,
form,
sqlData,
defaultValues,
width
} = this.props
return (
<>
{
items.map((row,i)=>{
const allhidden = checkAllHidden(row)
console.log(row,items)
return <div key={i}>
{
row.map((cell,j)=>{ // 每行渲染
let styles={}
if(cell.content&&cell.content.styles){
try{
styles= JSON.parse(cell.content.styles)
}catch (e) {
console.log(`第${i}行第${j}列样式配置有误,${e}`)
}
}
console.log(cell)
return !allhidden && cell.hidden ?
""
:<div // 组件渲染
style = {{
display:'inline-block',
width:i==0?
((cell.content!=null&&cell.content.cwidth!=null?cell.content.cwidth:width) * (cell.col ? cell.col : 1))
:width * (cell.col ? cell.col : 1),
overflow:'auto',
textAlign: cell.content&&cell.content.calign?cell.content.calign:"left",
...isBorder?borderStyle:{},
minWidth:100,
minHeight:32
}}
key ={j}
>
<TableCom
i={i}
j={j}
fatherCode={fatherCode}
index={index}
datas={datas}
uuid={cell.uuid}
isEdit={isEdit}
formKey={currentFormKey}
init={init}
get={get}
json={cell.content}
obj={ obj}
mapData={mapData}
form={form}
sqlData={sqlData}
defaultValues={defaultValues}
/>
</div>
})
}
</div>
})
}
</>
)
}
}
/**
* web端表格
*/
import React, { Component } from 'react'
import { Row, Col } from 'antd';
import TableCom from '../tableCompon/index';
export default class isNewWebTable extends Component {
render() {
const {
items,
checkAllHidden,
isBorder,
borderStyle,
fatherCode,
index,
datas,
isEdit,
border,
currentFormKey,
init,
get,
obj,
mapData,
form,
sqlData,
defaultValues,
width,
routerState,
messageData,
formCode,
formId,
fatherObj,
style,
max,
} = this.props
console.log(max * width)
return (
<div
style={{
overflow: "auto",
margin: "auto" ,
border: border?'1px solid #333':'',
...style
}}
>
{items.map((row, i) => {
const allhidden = checkAllHidden(row)
return <Row
key={i}>
{row.map((cell, j) => {
let styles = {}
console.log(cell)
if (cell.content && cell.content.styles) {
try {
styles = JSON.parse(cell.content.styles)
} catch (e) {
console.log(`第${i}行第${j}列样式配置有误,${e}`)
}
}
return !allhidden && cell.hidden ?
""
: <Col
style={{
minWidth:200
}}
span={6}
key={j}
style={{
overflow: "auto",
width: i == 0 ?
((cell.content != null && cell.content.cwidth != null ? cell.content.cwidth : width) * (cell.col ? cell.col : 1))
: width * (cell.col ? cell.col : 1),
textAlign: cell.content && cell.content.calign ? cell.content.calign : "left",
...isBorder ? (cell?.content?.comName == "InputHidden" || !cell?.content?.comName ? {} : borderStyle) : {},
...styles
}} >
<TableCom
formCode={formCode} // 当前表单code
formId={formId} // 当前表单Id
i={i} // 当前组件下标
j={j} // 当前行数下班
fatherCode={fatherCode}
index={index}
fatherObj={fatherObj}
datas={datas}
uuid={cell.uuid}
isEdit={isEdit}
formKey={currentFormKey}
init={init}
get={get} // 区分移动端或wen端
json={cell.content}
obj={obj || {}} // 是否存在默认值
mapData={mapData}
form={form} // antd form控件
sqlData={sqlData}
defaultValues={defaultValues || {}} // 接口中的默认值
routerState={routerState} // 兼容表单设计器路由传参
messageData={messageData} // 场景设计器共享变量参数
/>
</Col>
}
)
}
</Row>
})}
</div>
)
}
}
......@@ -43,6 +43,7 @@ export default class TableList extends React.Component {
return <FormList
istableCom={true}
showHeader={this.props.showHeader}
get={this.props.get}
isHiddenPage={
this.props.isHiddenPage!=null?
this.props.isHiddenPage
......
......@@ -175,7 +175,6 @@ export default class TableSelect extends React.Component {
return item
})
}
console.log(selects, Object.keys(selects).length)
return (
<div>
{Object.keys(selects).length > 0 ?
......@@ -187,7 +186,7 @@ export default class TableSelect extends React.Component {
<Button type="primary" onClick={this.open}>选择</Button>
<Modal
width="60%"
width={this.props.get==='mobile'?"100%":"60%"}
maskClosable={false}
title={`请选择`}
visible={visiable}
......
......@@ -276,6 +276,7 @@ class FormList extends React.Component {
showMobileDiv,
})
}
console.log(showMobileDiv)
}
//渲染值
componentDidMount() {
......@@ -842,7 +843,9 @@ class FormList extends React.Component {
renderForm() {
const {
form,
get,
} = this.props;
console.log(get)
const { querys } = this.state
if (querys.length == 0) {
return '';
......@@ -852,7 +855,7 @@ class FormList extends React.Component {
<Form layout="inline">
<Row >
{querys.map((item) =>
<Col style={{height:58}} span={8} key={item.id}>
<Col style={{height:58}} span={get==='mobile'?24:8} key={item.id}>
{this.getItem(true,form, {
...item,
isNull: true
......@@ -860,7 +863,12 @@ class FormList extends React.Component {
</Col>
)}
<Col span={8} >
<Col span={get==='mobile'?24:8}
style={{
textAlign:get==='mobile'?'right':'',
paddingRight: get==='mobile'?12:''
}}
>
<span className={styles.submitButtons}>
<Button type="primary" loading={this.props.loading} onClick={this.handleSearch}>
查询
......@@ -878,15 +886,22 @@ class FormList extends React.Component {
);
}
render() {
const { modalVisible, selectedRows, querys,tableWidth,rights ,data,isReady} = this.state;
const {
modalVisible,
selectedRows,
querys,
tableWidth,
rights ,
data,
isReady,
} = this.state;
if(!isReady){
return <div style={{width:20,margin:"auto"}}><Spin/></div>
}
const {
isFormCom,
isSelect,
get,
callback,
valueName,
notShowBack,
......@@ -1070,7 +1085,11 @@ class FormList extends React.Component {
>
<div
>
{
get==='mobile'?
<div>手机端,请将手机横屏查看</div>
:null
}
{
showDiv&&<StandardTable
showHeader={this.props.showHeader!=null?this.props.showHeader:true}
......
......@@ -1516,7 +1516,6 @@ export default class tableCom extends Component {
} else {
uid = this.props.uuid
}
if (!isEdit) {
return obj[this.props.uuid] || json.initialValue || ""
} else {
......@@ -1668,8 +1667,6 @@ export default class tableCom extends Component {
if (json.isLabel) {
if (obj&&obj.defaultValues && obj.defaultValues[formKey]) {
if(!isEdit ){
console.log(sqlData[key].title)
return (
<Row
style={{
......@@ -1898,7 +1895,12 @@ export default class tableCom extends Component {
const ds = obj[dataColumn.base52] && obj[dataColumn.base52].selects ? Object.values(obj[dataColumn.base52].selects) : []
if (json.showTable) {
cm = <Table columns={this.state.columns} size="small" dataSource={ds} pagination={false} />;
cm = <Table
get={get}
columns={this.state.columns}
size="small"
dataSource={ds}
pagination={false} />;
} else {
cm = <span>{ds.map((r, i) => i == 0 ? r[json.labelName] : "," + r[json.labelName])}</span>;
......@@ -2037,7 +2039,21 @@ export default class tableCom extends Component {
delete xxxxx[""]
}
cm = <ChildForm fatherObj={obj} json={json} rights={json.rights || ["add", "delete"]} isMobile={get === 'mobile'} value={xxxxx} deleteName={json.deleteName} addName={json.addName} isEdit={isEdit} base52={dataColumn.base52} mapData={mapData} datas={datas ? datas[json.childFormKey] : null} defaultValues={defaultValues} sqlData={sqlData} form={this.props.form} />
cm = <ChildForm
fatherObj={obj}
json={json}
rights={json.rights || ["add", "delete"]}
isMobile={get === 'mobile'}
value={xxxxx}
deleteName={json.deleteName}
addName={json.addName}
isEdit={isEdit}
base52={dataColumn.base52}
mapData={mapData}
datas={datas ? datas[json.childFormKey] : null}
defaultValues={defaultValues}
sqlData={sqlData}
form={this.props.form} />
break;
case 'Button':
......@@ -2070,10 +2086,12 @@ export default class tableCom extends Component {
case 'Table':
if (json.objCode == null || json.objCode == "") {
cm = <></>
}
cm = <TableList
get={get}
loading={this.props.loading}
showHeader={json.showHeader}
isHiddenPage={json.isHiddenPage}
......@@ -2465,7 +2483,14 @@ export default class tableCom extends Component {
}
)(
<TableSelect json={json} dataColumn={dataColumn} columns={this.state.columns} dataSource={this.state.dataSource} sqlModel={this.state.sqlModel} />
<TableSelect
get={get}
json={json}
dataColumn={dataColumn}
columns={this.state.columns}
dataSource={this.state.dataSource}
sqlModel={this.state.sqlModel}
/>
);
if (get === 'mobile' && json.isLabel && title) {
cm = <Form.Item
......@@ -2642,7 +2667,22 @@ export default class tableCom extends Component {
case 'ChildForm':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue || {},
})(<ChildForm rights={json.rights || []} isMobile={get === 'mobile'} num={json.num} min={json.min} max={json.max} json={json} deleteName={json.deleteName} addName={json.addName} isEdit={isEdit} base52={dataColumn.base52} mapData={mapData} datas={datas ? datas[json.childFormKey] : null} defaultValues={defaultValues} sqlData={sqlData} form={this.props.form} />)
})(<ChildForm
rights={json.rights || []}
isMobile={get === 'mobile'}
num={json.num}
min={json.min}
max={json.max}
json={json}
deleteName={json.deleteName}
addName={json.addName}
isEdit={isEdit}
base52={dataColumn.base52}
mapData={mapData}
datas={datas ? datas[json.childFormKey] : null}
defaultValues={defaultValues}
sqlData={sqlData}
form={this.props.form} />)
if (get === 'mobile' && json.isLabel && title) {
cm = <Form.Item
......@@ -2692,7 +2732,6 @@ export default class tableCom extends Component {
}
break;
case 'Table':
if (json.objCode == null || json.objCode == "") {
cm = <></>
......@@ -2700,7 +2739,16 @@ export default class tableCom extends Component {
cm = <>{getFieldDecorator(dataColumn.base52 || this.props.uuid, {
initialValue: initValue || {}
})(<TableList isHiddenPage={json.isHiddenPage} showHeader={json.showHeader} loading={this.props.loading} pageSize={json.pageSize} objCode={json.objCode} sql={json.filterSql} rights={json.rights} />)}</>
})(<TableList
isHiddenPage={json.isHiddenPage}
showHeader={json.showHeader}
loading={this.props.loading}
pageSize={json.pageSize}
objCode={json.objCode}
sql={json.filterSql}
rights={json.rights}
get={get}
/>)}</>
}
break;
......
:global{
// table{
// border-collapse:collapse;
// }
.ant-form-item{
margin-bottom: 2.5px;
margin-top: 2.5px;
}
.ant-form-item-control{
line-height: 20px;
}
#mobile_table .am-list-item{
//background-color: rgba(238, 238, 238, 0.801);
border-radius: 4px;
}
#mobile_table .am-textarea-control textarea{
background-color: #f5f5f5d3;
}
#mobile_table>.am-card{
min-height: 0;
}
#mobile_table .ant-form-item{
margin-bottom: 8px;
margin-top: 8px;
......@@ -82,3 +94,4 @@ text-align: left;
font-weight: bold;
font-family: PingFang-SC-Regular;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论