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

业务开发

上级 c472f4d4
......@@ -13,11 +13,11 @@ const DiyInput = (props) => {
type={config.dataType}
editable={!config.readOnly}
value={formValue[config.key]}
placeholder={'请输入'}
placeholder={config.placeholder || '点击输入'}
onChange={(e) => {
changeValue(e, config.key)
}}
{...otherProps}
{...config.otherProps}
>
{giveRequiredName(config)}
</InputItem>
......@@ -32,13 +32,13 @@ const DiyTextarea = (props) => {
title={giveRequiredName(config)}
maxLength={200}
autoHeight={true}
placeholder={'请输入'}
placeholder={config.placeholder || '点击输入'}
editable={!config.readOnly}
value={formValue[config.key]}
onChange={(e) => {
changeValue(e, config.key)
}}
{...otherProps}
{...config.otherProps}
>
</TextareaItem>
......@@ -49,22 +49,22 @@ const DiyPicker = (props) => {
let {config, formValue, changeValue} = props;
let opt = config.options.map((x) => {
return {
label: x,
value: x,
label: x.name,
value: x.key,
}
});
return (
<Picker
data={opt}
cols={1}
extra="请选择"
extra={config.placeholder || '请选择'}
key={config.key}
value={[formValue[config.key]]}
disabled={config.readOnly}
onChange={(val) => {
changeValue(val[0], config.key);
}}
{...otherProps}
{...config.otherProps}
>
<List.Item arrow="horizontal">
......@@ -85,7 +85,7 @@ const DiyDatePicker = (props) => {
return (
<DatePicker
value={value}
extra="请选择"
extra={config.placeholder || '请选择'}
mode={'date'}
key={config.key}
disabled={config.readOnly}
......@@ -113,7 +113,12 @@ const giveRequiredName = (config) => {
</Fragment>
)
}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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论