标签增加key
This commit is contained in:
parent
9068dfc33a
commit
6921b2f896
|
|
@ -11,33 +11,57 @@ export default function Render(props) {
|
|||
const [openStation, setStation] = useState(false);
|
||||
const [subwayId, setSubwayId] = useState('');
|
||||
const [stationId, setStationId] = useState('');
|
||||
return (<>
|
||||
<div>
|
||||
点击切换城市:
|
||||
<Select placeholder={'切换城市'} value={areaId} onChange={(value) => {
|
||||
setAreaId(value);
|
||||
setFilterByAreaId(value);
|
||||
}} style={{ width: '20%' }} options={areaOptions} allowClear></Select>
|
||||
return (
|
||||
<>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
城市:
|
||||
<Select
|
||||
placeholder={'选择城市'}
|
||||
value={areaId}
|
||||
onChange={(value) => {
|
||||
setAreaId(value);
|
||||
setFilterByAreaId(value);
|
||||
}}
|
||||
style={{ width: '20%' }}
|
||||
options={areaOptions}
|
||||
allowClear
|
||||
></Select>
|
||||
</div>
|
||||
<Tree className={Style.tree} blockNode={true} treeData={treeData} titleRender={(nodeData) => {
|
||||
return (<Row align="middle" style={{ flex: 1 }}>
|
||||
<Tree
|
||||
className={Style.tree}
|
||||
blockNode={true}
|
||||
treeData={treeData}
|
||||
titleRender={(nodeData) => {
|
||||
return (
|
||||
<Row align="middle" style={{ flex: 1 }}>
|
||||
<Col flex="auto">{nodeData.title}</Col>
|
||||
|
||||
<Col flex="none">
|
||||
<Space>
|
||||
{!nodeData.isLeaf ? (<Button onClick={() => {
|
||||
setSubwayId(nodeData.key);
|
||||
setSubway(true);
|
||||
}}>
|
||||
{!nodeData.isLeaf ? (
|
||||
<Button
|
||||
onClick={() => {
|
||||
setSubwayId(nodeData.key);
|
||||
setSubway(true);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>) : (<Button onClick={() => {
|
||||
const index = nodeData.key.indexOf('/') + 1;
|
||||
const temp = nodeData.key.substr(index);
|
||||
setStationId(temp);
|
||||
setStation(true);
|
||||
}}>
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
onClick={() => {
|
||||
const index =
|
||||
nodeData.key.indexOf('/') +
|
||||
1;
|
||||
const temp =
|
||||
nodeData.key.substr(index);
|
||||
setStationId(temp);
|
||||
setStation(true);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>)}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{/* {!nodeData.isLeaf && (
|
||||
<Button
|
||||
|
|
@ -64,10 +88,30 @@ export default function Render(props) {
|
|||
)} */}
|
||||
</Space>
|
||||
</Col>
|
||||
</Row>);
|
||||
}}/>
|
||||
{openSubway && (<UpsertSubway onClose={() => setSubway(false)} openSubway={openSubway} oakId={subwayId} oakPath={`${oakFullpath}.${subwayId}`} oakAutoUnmount={true}/>)}
|
||||
</Row>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
{openSubway && (
|
||||
<UpsertSubway
|
||||
onClose={() => setSubway(false)}
|
||||
openSubway={openSubway}
|
||||
oakId={subwayId}
|
||||
oakPath={`${oakFullpath}.${subwayId}`}
|
||||
oakAutoUnmount={true}
|
||||
/>
|
||||
)}
|
||||
|
||||
{openStation && (<UpsertStation onClose={() => setStation(false)} openStation={openStation} oakId={stationId} subwayId={subwayId} oakPath={`$subwayLine/upsertStation,${stationId}`} oakAutoUnmount={true}/>)}
|
||||
</>);
|
||||
{openStation && (
|
||||
<UpsertStation
|
||||
onClose={() => setStation(false)}
|
||||
openStation={openStation}
|
||||
oakId={stationId}
|
||||
subwayId={subwayId}
|
||||
oakPath={`$subwayLine/upsertStation,${stationId}`}
|
||||
oakAutoUnmount={true}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,22 @@ import { Checkbox } from 'antd-mobile';
|
|||
export default function Render(props) {
|
||||
const { entity, relations2 } = props.data;
|
||||
const { t, onRelationChange } = props.methods;
|
||||
return (<>
|
||||
{relations2?.map(({ relation, isChecked }) => (<Checkbox style={{ marginRight: 20 }} checked={isChecked} onChange={(checked) => {
|
||||
onRelationChange(relation, checked);
|
||||
}}>
|
||||
{relation.name ? t(`${entity}:r.${relation.name}`) : relation.display}
|
||||
</Checkbox>))}
|
||||
</>);
|
||||
return (
|
||||
<>
|
||||
{relations2?.map(({ relation, isChecked }) => (
|
||||
<Checkbox
|
||||
key={`userRelation_${relation}`}
|
||||
style={{ marginRight: 20 }}
|
||||
checked={isChecked}
|
||||
onChange={(checked) => {
|
||||
onRelationChange(relation, checked);
|
||||
}}
|
||||
>
|
||||
{relation.name
|
||||
? t(`${entity}:r.${relation.name}`)
|
||||
: relation.display}
|
||||
</Checkbox>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,23 @@ import { Checkbox } from 'antd';
|
|||
export default function Render(props) {
|
||||
const { entity, relations2 } = props.data;
|
||||
const { t, onRelationChange } = props.methods;
|
||||
return (<>
|
||||
{relations2?.map(({ relation, isChecked }) => (<Checkbox checked={isChecked} value={relation} onChange={({ target }) => {
|
||||
const { checked } = target;
|
||||
onRelationChange(relation, checked);
|
||||
}}>
|
||||
{relation.name ? t(`${entity}:r.${relation.name}`) : relation.display}
|
||||
</Checkbox>))}
|
||||
</>);
|
||||
return (
|
||||
<>
|
||||
{relations2?.map(({ relation, isChecked }) => (
|
||||
<Checkbox
|
||||
key={`userRelation_${relation}`}
|
||||
checked={isChecked}
|
||||
value={relation}
|
||||
onChange={({ target }) => {
|
||||
const { checked } = target;
|
||||
onRelationChange(relation, checked);
|
||||
}}
|
||||
>
|
||||
{relation.name
|
||||
? t(`${entity}:r.${relation.name}`)
|
||||
: relation.display}
|
||||
</Checkbox>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ export default function Render(
|
|||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
点击切换城市:
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
城市:
|
||||
<Select
|
||||
placeholder={'切换城市'}
|
||||
placeholder={'选择城市'}
|
||||
value={areaId}
|
||||
onChange={(value) => {
|
||||
setAreaId(value);
|
||||
|
|
|
|||
|
|
@ -16,22 +16,21 @@ export default function Render(props: WebComponentProps<EntityDict, 'user', fals
|
|||
const { t, onRelationChange } = props.methods;
|
||||
return (
|
||||
<>
|
||||
{
|
||||
relations2?.map(
|
||||
({ relation, isChecked }) => (
|
||||
<Checkbox
|
||||
checked={isChecked}
|
||||
value={relation}
|
||||
onChange={({ target }) => {
|
||||
const { checked } = target;
|
||||
onRelationChange(relation, checked);
|
||||
}}
|
||||
>
|
||||
{relation.name ? t(`${entity}:r.${relation.name}`) : relation.display}
|
||||
</Checkbox>
|
||||
)
|
||||
)
|
||||
}
|
||||
{relations2?.map(({ relation, isChecked }) => (
|
||||
<Checkbox
|
||||
key={`userRelation_${relation}`}
|
||||
checked={isChecked}
|
||||
value={relation}
|
||||
onChange={({ target }) => {
|
||||
const { checked } = target;
|
||||
onRelationChange(relation, checked);
|
||||
}}
|
||||
>
|
||||
{relation.name
|
||||
? t(`${entity}:r.${relation.name}`)
|
||||
: relation.display}
|
||||
</Checkbox>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -16,21 +16,20 @@ export default function Render(props: WebComponentProps<EntityDict, 'user', fals
|
|||
const { t, onRelationChange } = props.methods;
|
||||
return (
|
||||
<>
|
||||
{
|
||||
relations2?.map(
|
||||
({ relation, isChecked }) => (
|
||||
<Checkbox
|
||||
style={{ marginRight: 20 }}
|
||||
checked={isChecked}
|
||||
onChange={(checked) => {
|
||||
onRelationChange(relation, checked);
|
||||
}}
|
||||
>
|
||||
{relation.name ? t(`${entity}:r.${relation.name}`) : relation.display}
|
||||
</Checkbox>
|
||||
)
|
||||
)
|
||||
}
|
||||
{relations2?.map(({ relation, isChecked }) => (
|
||||
<Checkbox
|
||||
key={`userRelation_${relation}`}
|
||||
style={{ marginRight: 20 }}
|
||||
checked={isChecked}
|
||||
onChange={(checked) => {
|
||||
onRelationChange(relation, checked);
|
||||
}}
|
||||
>
|
||||
{relation.name
|
||||
? t(`${entity}:r.${relation.name}`)
|
||||
: relation.display}
|
||||
</Checkbox>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in New Issue