提交 60cce6ba authored 作者: 徐立's avatar 徐立
......@@ -9,8 +9,8 @@ import { Row, Col ,Input,message} from 'antd'
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)
......@@ -38,7 +38,19 @@ export default class ZdyTable extends Component {
}
componentDidMount(){
if(!window.functionObj){ // 检查是否注册
/**
* 注册全局函数集
* 动态生成表单配置函数所使用
*/
let functionObj = {}
formulaList.map(item => {
item.children.map(arr=> {
functionObj[arr.callKey] = arr.function
})
})
window.functionObj = functionObj
}
let {
postData, // 数据源
isCg, // 用户点击草稿页面进入
......
/**
* 测试新表格
*/
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 {
<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"
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> : ""}
</Col>
......
......@@ -15,6 +15,13 @@ export default class rollTab extends Component {
}
}
componentDidMount(){
let functionObj = {}
formulaList.map(item => {
item.children.map(arr=> {
functionObj[arr.callKey] = arr.function
})
})
window.functionObj = functionObj
this.setState({
tabList:formulaList
},()=>{
......
......@@ -1104,8 +1104,13 @@ export default class tableCom extends Component {
const obj = { ...this.props.obj, ...this.props.form.getFieldsValue(), ...this.props.defaultValues[this.props.formKey] }
<<<<<<< HEAD
const value = fun1(obj,this.props.init, this.props.defaultValues, { clientType: this.props.get }, this.props.index, this.props.fatherCode,
{
=======
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,
{
>>>>>>> b2747db5f35669ed350d5ebb2bf1ce42c5064462
moment: moment,
sql: this.sqlUtil.bind(this, base52, json,callback),
message: message,router:router,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论