|
@@ -38,8 +38,13 @@ function A2add({ addInfo, addFu, closeFu }: Props) {
|
|
if (addInfo.acInfo.ancestor)
|
|
if (addInfo.acInfo.ancestor)
|
|
ids = [...addInfo.acInfo.ancestor.split(',').map(v => Number(v)), addInfo.acInfo.id]
|
|
ids = [...addInfo.acInfo.ancestor.split(',').map(v => Number(v)), addInfo.acInfo.id]
|
|
|
|
|
|
- setParentIdArr(ids)
|
|
|
|
- }, [addInfo.acInfo])
|
|
|
|
|
|
+ const idsRes = ids
|
|
|
|
+ if (ids && ids.length >= 1 && addInfo.txt === '编辑') {
|
|
|
|
+ ids.pop()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ setParentIdArr(idsRes)
|
|
|
|
+ }, [addInfo.acInfo, addInfo.txt])
|
|
|
|
|
|
const cardChange = useCallback((aa: any, bb: any) => {
|
|
const cardChange = useCallback((aa: any, bb: any) => {
|
|
setParentIdArr(aa)
|
|
setParentIdArr(aa)
|
|
@@ -130,8 +135,8 @@ function A2add({ addInfo, addFu, closeFu }: Props) {
|
|
onFinishFailed={onFinishFailed}
|
|
onFinishFailed={onFinishFailed}
|
|
autoComplete='off'
|
|
autoComplete='off'
|
|
>
|
|
>
|
|
- <div className='fromRow' hidden={addInfo.txt === '编辑'}>
|
|
|
|
- <div className='fromRowll'>{addInfo.txt === '新增' ? '父级' : '当前'}分类:</div>
|
|
|
|
|
|
+ <div className='fromRow'>
|
|
|
|
+ <div className='fromRowll'>父级分类:</div>
|
|
<div className='fromRowrr'>
|
|
<div className='fromRowrr'>
|
|
<Cascader
|
|
<Cascader
|
|
style={{ width: 658 }}
|
|
style={{ width: 658 }}
|
|
@@ -139,7 +144,7 @@ function A2add({ addInfo, addFu, closeFu }: Props) {
|
|
changeOnSelect
|
|
changeOnSelect
|
|
fieldNames={{ label: 'name', value: 'id', children: 'children' }}
|
|
fieldNames={{ label: 'name', value: 'id', children: 'children' }}
|
|
options={treeData}
|
|
options={treeData}
|
|
- placeholder='请选择'
|
|
|
|
|
|
+ placeholder={addInfo.txt === '编辑' ? '空' : '请选择'}
|
|
value={parentIdArr ? [...parentIdArr] : []}
|
|
value={parentIdArr ? [...parentIdArr] : []}
|
|
onChange={cardChange}
|
|
onChange={cardChange}
|
|
/>
|
|
/>
|