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

Merge remote-tracking branch 'origin/master'

......@@ -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, // 用户点击草稿页面进入
......@@ -378,6 +390,9 @@ export default class ZdyTable extends Component {
const borderStyle={
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%" }
if(!isReady) return<></>
......@@ -425,12 +440,10 @@ export default class ZdyTable extends Component {
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?(cell.content.comName=="InputHidden"?{}:borderStyle):{},
...isBorder?(cell.content.comName=="InputHidden"||!cell?.content?.comName?{}:borderStyle):{},
...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 {
<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>
......
......@@ -8,7 +8,7 @@
*/
import React from 'react';
import { Tree, Table, Spin } from 'antd';
import FormList from './formList/index';
import FormList from './formList';
import { connect } from 'dva';
export default class TableList extends React.Component {
......@@ -40,9 +40,21 @@ export default class TableList extends React.Component {
}
render() {
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} />
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} />
}
}
......@@ -271,7 +271,6 @@ class FormList extends React.Component {
//渲染值
componentDidMount() {
const { dispatch, isFormCom, isSelect, callback, valueName } = this.props;
window.addEventListener('resize', this.resize);
if(this.props.objCode){
const { dispatch, objCode,sql} = this.props;
......@@ -296,6 +295,7 @@ class FormList extends React.Component {
type: 'DataRight/getUserColumnRight',
payload: { objId: this.state.objId },
callback: data => {
this.setState({ columnRights: data });
this.initColumn();
}
......@@ -504,7 +504,6 @@ class FormList extends React.Component {
if(this.props.objCode&&(this.props.objCode=="1"||this.props.objCode==1)){
if(callPage){
callPage(params,(data)=>{
if(!this.state.isReady){
this.setState({data,isReady:true})
}else{
......@@ -882,7 +881,8 @@ class FormList extends React.Component {
}
let showDiv = document.querySelector('#mobelDiv')?
document.querySelector('#mobelDiv').clientWidth
:1100
:'100%'
const parentMethods = {
handleAdd: this.handleAdd,
handleModalVisible: this.handleModalVisible,
......
......@@ -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
},()=>{
......
......@@ -1713,7 +1713,7 @@ export default class tableCom extends Component {
// cm = <img src={queryApiActionPath()+obj[dataColumn.base52]} />
// break;
case 'TextArea':
cm = <span style={{ padding: '0 24px' }}>{obj[dataColumn.base52]}</span>;
cm = <span>{obj[dataColumn.base52]}</span>;
break;
case 'Switch':
......@@ -1932,12 +1932,18 @@ export default class tableCom extends Component {
case 'Table':
if (json.objCode == null || json.objCode == "") {
cm = <></>
}
cm = <TableList loading={this.props.loading} showHeader={json.showHeader} isHiddenPage={json.isHiddenPage} pageSize={json.pageSize} value={obj[dataColumn.base52 || this.props.uuid] || {}} objCode={json.objCode} sql={json.filterSql} rights={json.rights} />
cm = <TableList
loading={this.props.loading}
showHeader={json.showHeader}
isHiddenPage={json.isHiddenPage}
pageSize={json.pageSize}
value={obj[dataColumn.base52 || this.props.uuid] || {}}
objCode={json.objCode}
sql={json.filterSql}
rights={json.rights} />
break;
default:
cm = <span>缺乏字段{json.comName}的匹配项</span>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论