|
|
@@ -12,6 +12,21 @@ const OtherConfig = ({ dataSource, dataConnect, dispatch, mode }) => {
|
|
|
wrapperCol: { span: 20 },
|
|
|
};
|
|
|
|
|
|
+ let getGroup = () => {
|
|
|
+ const { group } = dataSource.newOne;
|
|
|
+ const { groupList } = dataSource;
|
|
|
+ let g1 = groupList.filter(g => g.code+'' === group+'')[0];
|
|
|
+ if(!g1) {
|
|
|
+ return ['nogroup']
|
|
|
+ }
|
|
|
+ if(g1.pcode === '-1') {
|
|
|
+ return [g1.code]
|
|
|
+ }else {
|
|
|
+ let g2 = groupList.filter(g => g.code+'' === g1.pcode+'')[0];
|
|
|
+ return [g2.code, g1.code]
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return (
|
|
|
<Form className='form-base' size='small'>
|
|
|
<FormItem label='数据源名称' {...formItemLayout}>
|
|
|
@@ -22,12 +37,12 @@ const OtherConfig = ({ dataSource, dataConnect, dispatch, mode }) => {
|
|
|
</FormItem>
|
|
|
<FormItem label='所属分组' {...formItemLayout}>
|
|
|
<Cascader
|
|
|
- value={dataSource.newOne.group}
|
|
|
+ value={getGroup()}
|
|
|
allowClear={true}
|
|
|
changeOnSelect={true}
|
|
|
expandTrigger='hover'
|
|
|
placeholder='未分组'
|
|
|
- options={dataSource.groupList.filter(g => g.pcode === '-1').map((p, i)=>{
|
|
|
+ options={[{pcode: '-1', code: 'nogroup', label: '未分组'}].concat(dataSource.groupList).filter(g => g.pcode === '-1').map((p, i)=>{
|
|
|
return {
|
|
|
key: p.code,
|
|
|
value: p.code,
|
|
|
@@ -42,7 +57,8 @@ const OtherConfig = ({ dataSource, dataConnect, dispatch, mode }) => {
|
|
|
}
|
|
|
})}
|
|
|
onChange={(value, items) => {
|
|
|
- dispatch({ type: 'dataSource/setNewModelField', name: 'group', value: value });
|
|
|
+ let v = value[1] !== undefined ? value[1] : value[0];
|
|
|
+ dispatch({ type: 'dataSource/setNewModelField', name: 'group', value: v });
|
|
|
}}
|
|
|
|
|
|
>
|