提交 02e1497b authored 作者: 徐立's avatar 徐立

调整样式

上级 c0f7cedf
......@@ -10,7 +10,7 @@ import TableCom from '../tableCompon'
import {Toast} from 'antd-mobile'
import router from 'umi/router'
import { formulaList } from '../excelInitFuc/functionList';
import IsNewTable from './isNewTable';
export default class ZdyTable extends Component {
constructor(props){
super(props)
......@@ -418,43 +418,98 @@ export default class ZdyTable extends Component {
<Col span={24}>
<div style={styleDiv} ref={ref => { this.root = ref }}
>
<table style={{ overflow: "auto", margin: max * width > 550 ? "auto" : '',...style }} border={border} cellSpacing="0" cellPadding="0" >
<tbody>
{items.map((row, i) => {
const allhidden = this.checkAllHidden(row)
return <tr 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}`)
{
false ?
<div
style={{
overflow: "auto",
margin: max * width > 550 ? "auto" : '',
...style}}
border={border}
>
<IsNewTable
items={items}
checkAllHidden={this.checkAllHidden}
isBorder={isBorder}
borderStyle={borderStyle}
width={width}
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 || {}}
/>
</div>
:<table style={{ overflow: "auto", margin: max * width > 550 ? "auto" : '',...style }} border={border} cellSpacing="0" cellPadding="0" >
<tbody>
{items.map((row, i) => {
const allhidden = this.checkAllHidden(row)
return <tr 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}`)
}
}
return !allhidden && cell.hidden ?
""
: <td
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)}
rowSpan={cell.row}
colSpan={cell.col}
key={j}
style={{
overflow: "auto",
textAlign: cell.content&&cell.content.calign?cell.content.calign:"left",
...isBorder?borderStyle:{},
...styles
}} >
<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={this.props.form}
sqlData={sqlData}
defaultValues={defaultValues || {}} />
</td>}
)
}
}
return !allhidden && cell.hidden ? "" : <td 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)} rowSpan={cell.row} colSpan={cell.col} key={j} style={{
overflow: "auto",
textAlign: cell.content&&cell.content.calign?cell.content.calign:"left",
...isBorder?borderStyle:{},
...styles
}} >
<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={this.props.form} sqlData={sqlData} defaultValues={defaultValues || {}} />
</td>}
)
}
</tr>
})}
</tbody>
</table>
</tr>
})}
</tbody>
</table>
}
{style.pageBreakAfter!=null?<div style={{pageBreakAfter:style.pageBreakAfter}}></div>:""}
</div>
......
/**
* 测试新表格
*/
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>
})
}
</>
)
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论