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

修复bug

上级 2651542b
...@@ -9,7 +9,8 @@ import { Row, Col, Input, message } from 'antd' ...@@ -9,7 +9,8 @@ import { Row, Col, Input, message } from 'antd'
import TableCom from '../tableCompon' import TableCom from '../tableCompon'
import { Toast } from 'antd-mobile' import { Toast } from 'antd-mobile'
import router from 'umi/router' import router from 'umi/router'
import IsNewTable from './isNewTable'; import IsNewTable from './isNewMobileTable';
import NewWebTable from './isNewWebTable';
export default class ZdyTable extends Component { export default class ZdyTable extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
...@@ -357,7 +358,23 @@ export default class ZdyTable extends Component { ...@@ -357,7 +358,23 @@ export default class ZdyTable extends Component {
} }
render() { 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 { let {
border, border,
get, get,
...@@ -389,10 +406,15 @@ export default class ZdyTable extends Component { ...@@ -389,10 +406,15 @@ export default class ZdyTable extends Component {
}; };
const max = this.countMax(items) const max = this.countMax(items)
const borderStyle = { 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 = { // 处理隐藏组件边框样式问题 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%" } const styleDiv = this.props.height ? { overflow: "auto", width: "100%", height: this.props.height } : { overflow: "auto", width: "100%" }
if (!isReady) return <></> if (!isReady) return <></>
...@@ -428,6 +450,33 @@ export default class ZdyTable extends Component { ...@@ -428,6 +450,33 @@ export default class ZdyTable extends Component {
style={styleDiv} style={styleDiv}
ref={ref => { this.root = ref }} 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 <table
style={{ style={{
overflow: "auto", overflow: "auto",
...@@ -441,8 +490,11 @@ export default class ZdyTable extends Component { ...@@ -441,8 +490,11 @@ export default class ZdyTable extends Component {
{items.map((row, i) => { {items.map((row, i) => {
const allhidden = this.checkAllHidden(row) const allhidden = this.checkAllHidden(row)
return <tr key={i}> return <tr key={i}>
{row.map((cell, j) => { {row.map((cell, j) => {
if(!cell.content){
return
}
let styles = {} let styles = {}
if (cell.content && cell.content.styles) { if (cell.content && cell.content.styles) {
try { try {
...@@ -464,8 +516,13 @@ export default class ZdyTable extends Component { ...@@ -464,8 +516,13 @@ export default class ZdyTable extends Component {
style={{ style={{
overflow: "auto", overflow: "auto",
textAlign: cell.content && cell.content.calign ? cell.content.calign : "left", textAlign: cell.content && cell.content.calign ? cell.content.calign : "left",
...isBorder ? (cell?.content?.comName == "InputHidden" || !cell?.content?.comName ? {} : borderStyle) : {}, ...isBorder ?
...styles (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 <TableCom
...@@ -533,7 +590,32 @@ export default class ZdyTable extends Component { ...@@ -533,7 +590,32 @@ export default class ZdyTable extends Component {
})(<Input type="hidden" />); })(<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) => { items.map((item, i) => {
const allhidden = this.checkAllHidden(items) const allhidden = this.checkAllHidden(items)
return (<div return (<div
...@@ -577,7 +659,7 @@ export default class ZdyTable extends Component { ...@@ -577,7 +659,7 @@ export default class ZdyTable extends Component {
} }
</div>) </div>)
}) })
} } */}
</Form> </Form>
) )
} }
......
差异被折叠。
/**
* 测试新表格
*/
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 { ...@@ -43,6 +43,7 @@ export default class TableList extends React.Component {
return <FormList return <FormList
istableCom={true} istableCom={true}
showHeader={this.props.showHeader} showHeader={this.props.showHeader}
get={this.props.get}
isHiddenPage={ isHiddenPage={
this.props.isHiddenPage!=null? this.props.isHiddenPage!=null?
this.props.isHiddenPage this.props.isHiddenPage
......
...@@ -175,7 +175,6 @@ export default class TableSelect extends React.Component { ...@@ -175,7 +175,6 @@ export default class TableSelect extends React.Component {
return item return item
}) })
} }
console.log(selects, Object.keys(selects).length)
return ( return (
<div> <div>
{Object.keys(selects).length > 0 ? {Object.keys(selects).length > 0 ?
...@@ -187,7 +186,7 @@ export default class TableSelect extends React.Component { ...@@ -187,7 +186,7 @@ export default class TableSelect extends React.Component {
<Button type="primary" onClick={this.open}>选择</Button> <Button type="primary" onClick={this.open}>选择</Button>
<Modal <Modal
width="60%" width={this.props.get==='mobile'?"100%":"60%"}
maskClosable={false} maskClosable={false}
title={`请选择`} title={`请选择`}
visible={visiable} visible={visiable}
......
...@@ -276,6 +276,7 @@ class FormList extends React.Component { ...@@ -276,6 +276,7 @@ class FormList extends React.Component {
showMobileDiv, showMobileDiv,
}) })
} }
console.log(showMobileDiv)
} }
//渲染值 //渲染值
componentDidMount() { componentDidMount() {
...@@ -842,7 +843,9 @@ class FormList extends React.Component { ...@@ -842,7 +843,9 @@ class FormList extends React.Component {
renderForm() { renderForm() {
const { const {
form, form,
get,
} = this.props; } = this.props;
console.log(get)
const { querys } = this.state const { querys } = this.state
if (querys.length == 0) { if (querys.length == 0) {
return ''; return '';
...@@ -852,7 +855,7 @@ class FormList extends React.Component { ...@@ -852,7 +855,7 @@ class FormList extends React.Component {
<Form layout="inline"> <Form layout="inline">
<Row > <Row >
{querys.map((item) => {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, { {this.getItem(true,form, {
...item, ...item,
isNull: true isNull: true
...@@ -860,7 +863,12 @@ class FormList extends React.Component { ...@@ -860,7 +863,12 @@ class FormList extends React.Component {
</Col> </Col>
)} )}
<Col span={8} > <Col span={get==='mobile'?24:8}
style={{
textAlign:get==='mobile'?'right':'',
paddingRight: get==='mobile'?12:''
}}
>
<span className={styles.submitButtons}> <span className={styles.submitButtons}>
<Button type="primary" loading={this.props.loading} onClick={this.handleSearch}> <Button type="primary" loading={this.props.loading} onClick={this.handleSearch}>
查询 查询
...@@ -878,15 +886,22 @@ class FormList extends React.Component { ...@@ -878,15 +886,22 @@ class FormList extends React.Component {
); );
} }
render() { render() {
const { modalVisible, selectedRows, querys,tableWidth,rights ,data,isReady} = this.state; const {
modalVisible,
selectedRows,
querys,
tableWidth,
rights ,
data,
isReady,
} = this.state;
if(!isReady){ if(!isReady){
return <div style={{width:20,margin:"auto"}}><Spin/></div> return <div style={{width:20,margin:"auto"}}><Spin/></div>
} }
const { const {
isFormCom, isFormCom,
isSelect, isSelect,
get,
callback, callback,
valueName, valueName,
notShowBack, notShowBack,
...@@ -1070,7 +1085,11 @@ class FormList extends React.Component { ...@@ -1070,7 +1085,11 @@ class FormList extends React.Component {
> >
<div <div
> >
{
get==='mobile'?
<div>手机端,请将手机横屏查看</div>
:null
}
{ {
showDiv&&<StandardTable showDiv&&<StandardTable
showHeader={this.props.showHeader!=null?this.props.showHeader:true} showHeader={this.props.showHeader!=null?this.props.showHeader:true}
......
...@@ -1516,7 +1516,6 @@ export default class tableCom extends Component { ...@@ -1516,7 +1516,6 @@ export default class tableCom extends Component {
} else { } else {
uid = this.props.uuid uid = this.props.uuid
} }
if (!isEdit) { if (!isEdit) {
return obj[this.props.uuid] || json.initialValue || "" return obj[this.props.uuid] || json.initialValue || ""
} else { } else {
...@@ -1668,8 +1667,6 @@ export default class tableCom extends Component { ...@@ -1668,8 +1667,6 @@ export default class tableCom extends Component {
if (json.isLabel) { if (json.isLabel) {
if (obj&&obj.defaultValues && obj.defaultValues[formKey]) { if (obj&&obj.defaultValues && obj.defaultValues[formKey]) {
if(!isEdit ){ if(!isEdit ){
console.log(sqlData[key].title)
return ( return (
<Row <Row
style={{ style={{
...@@ -1898,7 +1895,12 @@ export default class tableCom extends Component { ...@@ -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) : [] const ds = obj[dataColumn.base52] && obj[dataColumn.base52].selects ? Object.values(obj[dataColumn.base52].selects) : []
if (json.showTable) { 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 { } else {
cm = <span>{ds.map((r, i) => i == 0 ? r[json.labelName] : "," + r[json.labelName])}</span>; 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 { ...@@ -2037,7 +2039,21 @@ export default class tableCom extends Component {
delete xxxxx[""] 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; break;
case 'Button': case 'Button':
...@@ -2070,10 +2086,12 @@ export default class tableCom extends Component { ...@@ -2070,10 +2086,12 @@ export default class tableCom extends Component {
case 'Table': case 'Table':
if (json.objCode == null || json.objCode == "") { if (json.objCode == null || json.objCode == "") {
cm = <></> cm = <></>
} }
cm = <TableList cm = <TableList
get={get}
loading={this.props.loading} loading={this.props.loading}
showHeader={json.showHeader} showHeader={json.showHeader}
isHiddenPage={json.isHiddenPage} isHiddenPage={json.isHiddenPage}
...@@ -2465,7 +2483,14 @@ export default class tableCom extends Component { ...@@ -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) { if (get === 'mobile' && json.isLabel && title) {
cm = <Form.Item cm = <Form.Item
...@@ -2642,7 +2667,22 @@ export default class tableCom extends Component { ...@@ -2642,7 +2667,22 @@ export default class tableCom extends Component {
case 'ChildForm': case 'ChildForm':
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue || {}, 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) { if (get === 'mobile' && json.isLabel && title) {
cm = <Form.Item cm = <Form.Item
...@@ -2692,7 +2732,6 @@ export default class tableCom extends Component { ...@@ -2692,7 +2732,6 @@ export default class tableCom extends Component {
} }
break; break;
case 'Table': case 'Table':
if (json.objCode == null || json.objCode == "") { if (json.objCode == null || json.objCode == "") {
cm = <></> cm = <></>
...@@ -2700,7 +2739,16 @@ export default class tableCom extends Component { ...@@ -2700,7 +2739,16 @@ export default class tableCom extends Component {
cm = <>{getFieldDecorator(dataColumn.base52 || this.props.uuid, { cm = <>{getFieldDecorator(dataColumn.base52 || this.props.uuid, {
initialValue: initValue || {} 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; break;
......
:global{ :global{
// table{
// border-collapse:collapse;
// }
.ant-form-item{ .ant-form-item{
margin-bottom: 2.5px; margin-bottom: 2.5px;
margin-top: 2.5px; margin-top: 2.5px;
} }
.ant-form-item-control{
line-height: 20px;
}
#mobile_table .am-list-item{ #mobile_table .am-list-item{
//background-color: rgba(238, 238, 238, 0.801); //background-color: rgba(238, 238, 238, 0.801);
border-radius: 4px; border-radius: 4px;
} }
#mobile_table .am-textarea-control textarea{
background-color: #f5f5f5d3;
}
#mobile_table>.am-card{
min-height: 0;
}
#mobile_table .ant-form-item{ #mobile_table .ant-form-item{
margin-bottom: 8px; margin-bottom: 8px;
margin-top: 8px; margin-top: 8px;
...@@ -82,3 +94,4 @@ text-align: left; ...@@ -82,3 +94,4 @@ text-align: left;
font-weight: bold; font-weight: bold;
font-family: PingFang-SC-Regular; font-family: PingFang-SC-Regular;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论