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

业务开发

上级 c472f4d4
...@@ -13,11 +13,11 @@ const DiyInput = (props) => { ...@@ -13,11 +13,11 @@ const DiyInput = (props) => {
type={config.dataType} type={config.dataType}
editable={!config.readOnly} editable={!config.readOnly}
value={formValue[config.key]} value={formValue[config.key]}
placeholder={'请输入'} placeholder={config.placeholder || '点击输入'}
onChange={(e) => { onChange={(e) => {
changeValue(e, config.key) changeValue(e, config.key)
}} }}
{...otherProps} {...config.otherProps}
> >
{giveRequiredName(config)} {giveRequiredName(config)}
</InputItem> </InputItem>
...@@ -32,13 +32,13 @@ const DiyTextarea = (props) => { ...@@ -32,13 +32,13 @@ const DiyTextarea = (props) => {
title={giveRequiredName(config)} title={giveRequiredName(config)}
maxLength={200} maxLength={200}
autoHeight={true} autoHeight={true}
placeholder={'请输入'} placeholder={config.placeholder || '点击输入'}
editable={!config.readOnly} editable={!config.readOnly}
value={formValue[config.key]} value={formValue[config.key]}
onChange={(e) => { onChange={(e) => {
changeValue(e, config.key) changeValue(e, config.key)
}} }}
{...otherProps} {...config.otherProps}
> >
</TextareaItem> </TextareaItem>
...@@ -49,22 +49,22 @@ const DiyPicker = (props) => { ...@@ -49,22 +49,22 @@ const DiyPicker = (props) => {
let {config, formValue, changeValue} = props; let {config, formValue, changeValue} = props;
let opt = config.options.map((x) => { let opt = config.options.map((x) => {
return { return {
label: x, label: x.name,
value: x, value: x.key,
} }
}); });
return ( return (
<Picker <Picker
data={opt} data={opt}
cols={1} cols={1}
extra="请选择" extra={config.placeholder || '请选择'}
key={config.key} key={config.key}
value={[formValue[config.key]]} value={[formValue[config.key]]}
disabled={config.readOnly} disabled={config.readOnly}
onChange={(val) => { onChange={(val) => {
changeValue(val[0], config.key); changeValue(val[0], config.key);
}} }}
{...otherProps} {...config.otherProps}
> >
<List.Item arrow="horizontal"> <List.Item arrow="horizontal">
...@@ -85,7 +85,7 @@ const DiyDatePicker = (props) => { ...@@ -85,7 +85,7 @@ const DiyDatePicker = (props) => {
return ( return (
<DatePicker <DatePicker
value={value} value={value}
extra="请选择" extra={config.placeholder || '请选择'}
mode={'date'} mode={'date'}
key={config.key} key={config.key}
disabled={config.readOnly} disabled={config.readOnly}
...@@ -113,7 +113,12 @@ const giveRequiredName = (config) => { ...@@ -113,7 +113,12 @@ const giveRequiredName = (config) => {
</Fragment> </Fragment>
) )
}else{ }else{
return config.name; return (
<Fragment>
<i style={{color: 'red'}}>&nbsp;&nbsp;</i>
{config.name}
</Fragment>
)
} }
}; };
......
import { Toast } from 'antd-mobile'
export function checkRequiredData(config = [], data = {}) {
for(let x of config){
if(x.required && (data[x.key] === '' || data[x.key] === undefined)){
Toast.fail( '请填写' + x.name);
return false;
}
}
return true;
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论