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

优化移动端代码

上级 3cd60082
...@@ -385,7 +385,7 @@ export default class ZdyTable extends Component { ...@@ -385,7 +385,7 @@ export default class ZdyTable extends Component {
configs; configs;
initExcel = (configs, callback) => { initExcel = (configs, callback) => {
this.configs = configs; this.configs = configs;
console.log(configs); // console.log(configs);
if (configs == null || configs.trees == null) { if (configs == null || configs.trees == null) {
if (callback) callback(); if (callback) callback();
return; return;
......
...@@ -5,14 +5,11 @@ import React, { Component } from 'react'; ...@@ -5,14 +5,11 @@ import React, { Component } from 'react';
import { Row, Col } from 'antd'; import { Row, Col } from 'antd';
import TableCom from '../tableCompon/index'; import TableCom from '../tableCompon/index';
export default class isNewTable extends Component { export default class IsNewTable extends Component {
render() { render() {
const { const {
isRowCol,
items, items,
checkAllHidden, checkAllHidden,
isBorder,
borderStyle,
fatherCode, fatherCode,
userId, userId,
index, index,
...@@ -23,15 +20,12 @@ export default class isNewTable extends Component { ...@@ -23,15 +20,12 @@ export default class isNewTable extends Component {
get, get,
obj, obj,
mapData, mapData,
form,
sqlData, sqlData,
defaultValues, defaultValues,
width,
routerState, routerState,
messageData, messageData,
formCode, formCode,
formId, formId,
fatherObj,
style, style,
isPreview, isPreview,
modalInit, modalInit,
...@@ -51,8 +45,8 @@ export default class isNewTable extends Component { ...@@ -51,8 +45,8 @@ export default class isNewTable extends Component {
const allhidden = checkAllHidden(items); const allhidden = checkAllHidden(items);
return ( return (
<div <div
key={i} key={item && Array.isArray(item) && item.length > 0 ? item[0].uuid : i}
style={{ style={{
marginTop: 0, marginTop: 0,
background: '#ffffff', background: '#ffffff',
...@@ -61,7 +55,7 @@ export default class isNewTable extends Component { ...@@ -61,7 +55,7 @@ export default class isNewTable extends Component {
...style, ...style,
}}> }}>
{item.map((ary, j) => { {item.map((ary, j) => {
let styles = {}; let styles = {};
if (ary.content && ary.content.styles) { if (ary.content && ary.content.styles) {
try { try {
styles = JSON.parse(ary.content.styles); styles = JSON.parse(ary.content.styles);
...@@ -73,6 +67,7 @@ export default class isNewTable extends Component { ...@@ -73,6 +67,7 @@ export default class isNewTable extends Component {
'' ''
) : ( ) : (
<div <div
key={ary.uuid || j}
style={{ style={{
...styles, ...styles,
textAlign: 'left', textAlign: 'left',
...@@ -133,6 +128,7 @@ export default class isNewTable extends Component { ...@@ -133,6 +128,7 @@ export default class isNewTable extends Component {
const allhidden = checkAllHidden(items); const allhidden = checkAllHidden(items);
return ( return (
<Row <Row
key={item && Array.isArray(item) && item.length > 0 ? item[0].uuid : i}
style={{ style={{
...style, ...style,
}}> }}>
...@@ -148,7 +144,8 @@ export default class isNewTable extends Component { ...@@ -148,7 +144,8 @@ export default class isNewTable extends Component {
if (ary.content?.comName === 'Label') { if (ary.content?.comName === 'Label') {
return ( return (
<Col <Col
style={{ key={ary.uuid || j}
style={{
display: display:
ary.content && ary.content &&
(ary.content.comName === 'InputHidden' || ary.content.isMobileHidden) && (ary.content.comName === 'InputHidden' || ary.content.isMobileHidden) &&
...@@ -202,7 +199,8 @@ export default class isNewTable extends Component { ...@@ -202,7 +199,8 @@ export default class isNewTable extends Component {
} }
return ( return (
<Col <Col
span={24} key={ary.uuid || j}
span={24}
style={{ style={{
display: display:
ary.content && ary.content &&
......
import React, {useMemo} from 'react'; import React, {useMemo, Component} from 'react';
import {List, Picker} from 'antd-mobile'; import {List, Picker} from 'antd-mobile';
import styles from './styles.less'; import styles from './styles.less';
...@@ -20,11 +20,14 @@ const getItemChildren = (childrenList, parent) => { ...@@ -20,11 +20,14 @@ const getItemChildren = (childrenList, parent) => {
return childrenList; return childrenList;
} }
export default function MobileCascader(props) { // 级联选择 export default class MobileCascader extends Component{
const {onChange, options, label, disabled, value, json, otherProps} = props; constructor(props) {
// console.log(props); super(props);
let opt = useMemo(() => { }
return options && render() {
const {onChange, options, label, disabled, value, json, otherProps} = this.props;
// console.log(props);
let opt = options &&
Array.isArray(options) && Array.isArray(options) &&
options.map((x) => { options.map((x) => {
return { return {
...@@ -33,26 +36,31 @@ export default function MobileCascader(props) { // 级联选择 ...@@ -33,26 +36,31 @@ export default function MobileCascader(props) { // 级联选择
children: getItemChildren(x.children, x), children: getItemChildren(x.children, x),
}; };
}); });
}, [options]); return (
return ( <div className={styles.mobileFormInput}>
<div className={styles.mobileFormInput}> <Picker
<Picker data={opt || []}
data={opt || []} cascade={true}
cascade={true} // cols={1}
// cols={1} disabled={disabled}
disabled={disabled} value={value}
value={value} extra={disabled ? '' : json.placeholder || '点击选择'}
extra={disabled ? '' : json.placeholder || '点击选择'} onChange={(val) => {
onChange={(val) => { console.log(val);
console.log(val); onChange(val || undefined);
onChange(val || undefined); }}
}} {...otherProps?.props}
{...otherProps?.props} >
> <List.Item arrow={disabled ? '' : 'horizontal'}>
<List.Item arrow={disabled ? '' : 'horizontal'}> {/*{label}*/}
{/*{label}*/} </List.Item>
</List.Item> </Picker>
</Picker> </div>
</div> );
); }
} }
//
//
// export default function MobileCascader(props) { // 级联选择
//
// }
...@@ -2651,13 +2651,18 @@ export default class tableCom extends Component { ...@@ -2651,13 +2651,18 @@ export default class tableCom extends Component {
/>, />,
); );
if (get === 'mobile') { if (get === 'mobile') {
console.log(json.vlds);
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue, initialValue: initValue,
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [{ required: required, message: '请选择' + dataColumn.title }],
})(<MobileCascader options={options} label={title} disabled={disabled} json={json} />); })(<MobileCascader options={options}
label={title}
disabled={disabled}
json={json}
/>);
} }
if ( if (
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论