提交 54e191b2 authored 作者: 钟是志's avatar 钟是志

Merge remote-tracking branch 'origin/master'

...@@ -9,8 +9,8 @@ import { Row, Col ,Input,message} from 'antd' ...@@ -9,8 +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 { formulaList } from '../excelInitFuc/functionList';
import IsNewTable from './isNewTable';
export default class ZdyTable extends Component { export default class ZdyTable extends Component {
constructor(props){ constructor(props){
super(props) super(props)
...@@ -38,7 +38,19 @@ export default class ZdyTable extends Component { ...@@ -38,7 +38,19 @@ export default class ZdyTable extends Component {
} }
componentDidMount(){ componentDidMount(){
if(!window.functionObj){ // 检查是否注册
/**
* 注册全局函数集
* 动态生成表单配置函数所使用
*/
let functionObj = {}
formulaList.map(item => {
item.children.map(arr=> {
functionObj[arr.callKey] = arr.function
})
})
window.functionObj = functionObj
}
let { let {
postData, // 数据源 postData, // 数据源
isCg, // 用户点击草稿页面进入 isCg, // 用户点击草稿页面进入
...@@ -378,6 +390,9 @@ export default class ZdyTable extends Component { ...@@ -378,6 +390,9 @@ export default class ZdyTable extends Component {
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={ // 处理隐藏组件边框样式问题
borderRight:"1px solid gray",borderLeft:"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<></>
...@@ -425,12 +440,10 @@ export default class ZdyTable extends Component { ...@@ -425,12 +440,10 @@ export default class ZdyTable extends Component {
console.log(`第${i}行第${j}列样式配置有误,${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={{ 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", 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"?{}:borderStyle):{}, ...isBorder?(cell.content.comName=="InputHidden"||!cell?.content?.comName?{}:borderStyle):{},
...styles ...styles
}} > }} >
......
/**
* 测试新表格
*/
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>
})
}
</>
)
}
}
...@@ -145,7 +145,7 @@ export default class ChildForm extends React.Component { ...@@ -145,7 +145,7 @@ export default class ChildForm extends React.Component {
<ZdyTable formConfig={datas} key={r} fatherCode={base52} isEdit={isEdit} index={r} obj={objs[r]} init={objs} isChild={true} get="web" form={form} mapData={mapData} sqlData={sqlData} {...datas} defaultValues={defaultValues} /> <ZdyTable formConfig={datas} key={r} fatherCode={base52} isEdit={isEdit} index={r} obj={objs[r]} init={objs} isChild={true} get="web" form={form} mapData={mapData} sqlData={sqlData} {...datas} defaultValues={defaultValues} />
{rights.includes("delete") && isEdit ? <Button size="small" {rights.includes("delete") && isEdit ? <Button size="small"
style={{ position: "absolute", right: 0, top: 0 }} style={{ position: "absolute", right: 10, top: '50%',transform:'translateY(-50%)' }}
type='danger' onClick={this.delete.bind(this, r)}>{deleteName || "删除"}</Button> : ""} type='danger' onClick={this.delete.bind(this, r)}>{deleteName || "删除"}</Button> : ""}
</Col> </Col>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
*/ */
import React from 'react'; import React from 'react';
import { Tree, Table, Spin } from 'antd'; import { Tree, Table, Spin } from 'antd';
import FormList from './formList/index'; import FormList from './formList';
import { connect } from 'dva'; import { connect } from 'dva';
export default class TableList extends React.Component { export default class TableList extends React.Component {
...@@ -40,9 +40,21 @@ export default class TableList extends React.Component { ...@@ -40,9 +40,21 @@ export default class TableList extends React.Component {
} }
render() { render() {
return <FormList
istableCom={true}
return <FormList istableCom={true} showHeader={this.props.showHeader} isHiddenPage={this.props.isHiddenPage!=null?this.props.isHiddenPage:false} loading={this.props.loading} pageSize={this.props.pageSize||10} value={this.state} notShowBack={true} rights={this.props.rights || []} objCode={this.props.objCode} isFormCom={true} sql={this.props.sql} /> showHeader={this.props.showHeader}
isHiddenPage={
this.props.isHiddenPage!=null?
this.props.isHiddenPage
:false}
loading={this.props.loading}
pageSize={this.props.pageSize||10}
value={this.state}
notShowBack={true}
rights={this.props.rights || []}
objCode={this.props.objCode}
isFormCom={true}
sql={this.props.sql} />
} }
} }
...@@ -271,7 +271,6 @@ class FormList extends React.Component { ...@@ -271,7 +271,6 @@ class FormList extends React.Component {
//渲染值 //渲染值
componentDidMount() { componentDidMount() {
const { dispatch, isFormCom, isSelect, callback, valueName } = this.props; const { dispatch, isFormCom, isSelect, callback, valueName } = this.props;
window.addEventListener('resize', this.resize); window.addEventListener('resize', this.resize);
if(this.props.objCode){ if(this.props.objCode){
const { dispatch, objCode,sql} = this.props; const { dispatch, objCode,sql} = this.props;
...@@ -296,6 +295,7 @@ class FormList extends React.Component { ...@@ -296,6 +295,7 @@ class FormList extends React.Component {
type: 'DataRight/getUserColumnRight', type: 'DataRight/getUserColumnRight',
payload: { objId: this.state.objId }, payload: { objId: this.state.objId },
callback: data => { callback: data => {
this.setState({ columnRights: data }); this.setState({ columnRights: data });
this.initColumn(); this.initColumn();
} }
...@@ -504,7 +504,6 @@ class FormList extends React.Component { ...@@ -504,7 +504,6 @@ class FormList extends React.Component {
if(this.props.objCode&&(this.props.objCode=="1"||this.props.objCode==1)){ if(this.props.objCode&&(this.props.objCode=="1"||this.props.objCode==1)){
if(callPage){ if(callPage){
callPage(params,(data)=>{ callPage(params,(data)=>{
if(!this.state.isReady){ if(!this.state.isReady){
this.setState({data,isReady:true}) this.setState({data,isReady:true})
}else{ }else{
...@@ -882,7 +881,8 @@ class FormList extends React.Component { ...@@ -882,7 +881,8 @@ class FormList extends React.Component {
} }
let showDiv = document.querySelector('#mobelDiv')? let showDiv = document.querySelector('#mobelDiv')?
document.querySelector('#mobelDiv').clientWidth document.querySelector('#mobelDiv').clientWidth
:1100 :'100%'
const parentMethods = { const parentMethods = {
handleAdd: this.handleAdd, handleAdd: this.handleAdd,
handleModalVisible: this.handleModalVisible, handleModalVisible: this.handleModalVisible,
......
...@@ -15,6 +15,13 @@ export default class rollTab extends Component { ...@@ -15,6 +15,13 @@ export default class rollTab extends Component {
} }
} }
componentDidMount(){ componentDidMount(){
let functionObj = {}
formulaList.map(item => {
item.children.map(arr=> {
functionObj[arr.callKey] = arr.function
})
})
window.functionObj = functionObj
this.setState({ this.setState({
tabList:formulaList tabList:formulaList
},()=>{ },()=>{
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论