|
|
@ -20,7 +20,11 @@ function PersonInfo() { |
|
|
|
const [noParams, setNoParams] = useState(true) |
|
|
|
const [showEdit, setShowEdit] = useState(false) |
|
|
|
const [getEdit, setGetEdit] = useState(false) |
|
|
|
|
|
|
|
const handleReset = () => { |
|
|
|
setShowEdit(false) |
|
|
|
setTranferAllData([]) |
|
|
|
setCurrentPersonId("") |
|
|
|
} |
|
|
|
const [formData, setFormData] = useSetState({ |
|
|
|
name: defaultParams ? defaultParams.name : '', |
|
|
|
pda_number: defaultParams ? defaultParams.pda_number : '', |
|
|
@ -211,6 +215,7 @@ function PersonInfo() { |
|
|
|
}) |
|
|
|
} |
|
|
|
const getDeparts = (id, editFlag) => { |
|
|
|
if (id) { |
|
|
|
ajax.getDeparts({ id: id }).then(res => { |
|
|
|
if (res.status == 20000) { |
|
|
|
if (showEdit || editFlag) { |
|
|
@ -229,7 +234,10 @@ function PersonInfo() { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const getAssets = (id, editFlag) => { |
|
|
|
if (id) { |
|
|
|
ajax.getAssets({ id: id }).then(res => { |
|
|
|
if (res.status == 20000) { |
|
|
|
if (showEdit || editFlag) { |
|
|
@ -253,13 +261,22 @@ function PersonInfo() { |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
const [getPersonId, setGetPersonId] = useState('') |
|
|
|
const [getOperatorId, setGetOperatorId] = useState('0') |
|
|
|
const changeOperator = (e) => { |
|
|
|
if(e=='0'){ |
|
|
|
setFormData({ operator_id: e }); |
|
|
|
}else{ |
|
|
|
setFormData({ operator_id: e }); |
|
|
|
getDeparts(e) |
|
|
|
getAssets(e) |
|
|
|
} |
|
|
|
|
|
|
|
setGetOperatorId(e) |
|
|
|
} |
|
|
|
|
|
|
|
const changeEditOperator = (e) => { |
|
|
|
setCurrentPersonInfo({ ...currentPersonInfo, operator: e }) |
|
|
|
getDeparts(e) |
|
|
@ -267,7 +284,7 @@ function PersonInfo() { |
|
|
|
setGetPersonId(e) |
|
|
|
} |
|
|
|
useEffect(() => { |
|
|
|
if (getPersonId !='') { |
|
|
|
if (getPersonId) { |
|
|
|
let data = { |
|
|
|
operator_id: getPersonId |
|
|
|
} |
|
|
@ -288,6 +305,8 @@ function PersonInfo() { |
|
|
|
console.log(err) |
|
|
|
}).finally(() => { |
|
|
|
}) |
|
|
|
} else { |
|
|
|
setTranferAllData([]) |
|
|
|
} |
|
|
|
}, [getPersonId]) |
|
|
|
/** |
|
|
@ -446,10 +465,10 @@ function PersonInfo() { |
|
|
|
|
|
|
|
// getPersonAllRoad() |
|
|
|
}, []) |
|
|
|
useEffect(()=>{ |
|
|
|
useEffect(() => { |
|
|
|
console.log(getEdit); |
|
|
|
|
|
|
|
},[getEdit]) |
|
|
|
}, [getEdit]) |
|
|
|
useEffect(() => { |
|
|
|
if (!showEdit) { |
|
|
|
setCurrentPersonInfo({ |
|
|
@ -549,6 +568,9 @@ function PersonInfo() { |
|
|
|
showClose={false} |
|
|
|
onChange={e => { changeOperator(e) }} |
|
|
|
/> |
|
|
|
{ |
|
|
|
getOperatorId == '0' ? '' : |
|
|
|
<> |
|
|
|
<FormSelect |
|
|
|
yisaLabel="所属部门" |
|
|
|
yisaData={departOptions} |
|
|
@ -567,6 +589,9 @@ function PersonInfo() { |
|
|
|
showClose={false} |
|
|
|
onChange={e => { setFormData({ property_id: e }) }} |
|
|
|
/> |
|
|
|
</> |
|
|
|
} |
|
|
|
|
|
|
|
<div className="bottomBox"> |
|
|
|
<Button type="primary" className="colorReset" onClick={reset}>重置</Button> |
|
|
|
<Button type="primary" className="colorBtn" onClick={addPersonInfo}>添加</Button> |
|
|
@ -772,7 +797,7 @@ function PersonInfo() { |
|
|
|
</div> |
|
|
|
<div className="btn-wrapper"> |
|
|
|
<Button onClick={submitPersonInfo} type="primary" className="colorBtn">提交</Button>  |
|
|
|
<Button onClick={() => { setShowEdit(false) }} className="colorReset">取消</Button> |
|
|
|
<Button onClick={handleReset} className="colorReset">取消</Button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
} |
|
|
|