|
@ -20,7 +20,11 @@ function PersonInfo() { |
|
|
const [noParams, setNoParams] = useState(true) |
|
|
const [noParams, setNoParams] = useState(true) |
|
|
const [showEdit, setShowEdit] = useState(false) |
|
|
const [showEdit, setShowEdit] = useState(false) |
|
|
const [getEdit, setGetEdit] = useState(false) |
|
|
const [getEdit, setGetEdit] = useState(false) |
|
|
|
|
|
|
|
|
|
|
|
const handleReset = () => { |
|
|
|
|
|
setShowEdit(false) |
|
|
|
|
|
setTranferAllData([]) |
|
|
|
|
|
setCurrentPersonId("") |
|
|
|
|
|
} |
|
|
const [formData, setFormData] = useSetState({ |
|
|
const [formData, setFormData] = useSetState({ |
|
|
name: defaultParams ? defaultParams.name : '', |
|
|
name: defaultParams ? defaultParams.name : '', |
|
|
pda_number: defaultParams ? defaultParams.pda_number : '', |
|
|
pda_number: defaultParams ? defaultParams.pda_number : '', |
|
@ -146,7 +150,7 @@ function PersonInfo() { |
|
|
|
|
|
|
|
|
// 点击编辑 获取人员信息 |
|
|
// 点击编辑 获取人员信息 |
|
|
const getPersonAllRoad = (data) => { |
|
|
const getPersonAllRoad = (data) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
// 重置密码 |
|
|
// 重置密码 |
|
|
const resetPersonPwd = (id) => { |
|
|
const resetPersonPwd = (id) => { |
|
@ -211,53 +215,66 @@ function PersonInfo() { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
const getDeparts = (id, editFlag) => { |
|
|
const getDeparts = (id, editFlag) => { |
|
|
ajax.getDeparts({ id: id }).then(res => { |
|
|
|
|
|
if (res.status == 20000) { |
|
|
|
|
|
if (showEdit || editFlag) { |
|
|
|
|
|
|
|
|
if (id) { |
|
|
|
|
|
ajax.getDeparts({ id: id }).then(res => { |
|
|
|
|
|
if (res.status == 20000) { |
|
|
|
|
|
if (showEdit || editFlag) { |
|
|
|
|
|
|
|
|
setDepartEditOptions(res.data) |
|
|
|
|
|
|
|
|
setDepartEditOptions(res.data) |
|
|
|
|
|
} else { |
|
|
|
|
|
setDepartOptions(res.data) |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
setDepartOptions(res.data) |
|
|
|
|
|
|
|
|
message.error(res.message) |
|
|
} |
|
|
} |
|
|
} else { |
|
|
|
|
|
message.error(res.message) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}).finally(() => { |
|
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}).finally(() => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const getAssets = (id, editFlag) => { |
|
|
const getAssets = (id, editFlag) => { |
|
|
ajax.getAssets({ id: id }).then(res => { |
|
|
|
|
|
if (res.status == 20000) { |
|
|
|
|
|
if (showEdit || editFlag) { |
|
|
|
|
|
let temparr = []; |
|
|
|
|
|
res.data.map(item => { |
|
|
|
|
|
temparr.push({ |
|
|
|
|
|
value: item.value + '', |
|
|
|
|
|
label: item.label |
|
|
|
|
|
|
|
|
if (id) { |
|
|
|
|
|
ajax.getAssets({ id: id }).then(res => { |
|
|
|
|
|
if (res.status == 20000) { |
|
|
|
|
|
if (showEdit || editFlag) { |
|
|
|
|
|
let temparr = []; |
|
|
|
|
|
res.data.map(item => { |
|
|
|
|
|
temparr.push({ |
|
|
|
|
|
value: item.value + '', |
|
|
|
|
|
label: item.label |
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
setAssetsEditOptions(temparr) |
|
|
|
|
|
|
|
|
setAssetsEditOptions(temparr) |
|
|
|
|
|
} else { |
|
|
|
|
|
setAssetsOptions(res.data) |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
setAssetsOptions(res.data) |
|
|
|
|
|
|
|
|
message.error(res.message) |
|
|
} |
|
|
} |
|
|
} else { |
|
|
|
|
|
message.error(res.message) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}).finally(() => { |
|
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}).finally(() => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
const [getPersonId, setGetPersonId] = useState('') |
|
|
const [getPersonId, setGetPersonId] = useState('') |
|
|
|
|
|
const [getOperatorId, setGetOperatorId] = useState('0') |
|
|
const changeOperator = (e) => { |
|
|
const changeOperator = (e) => { |
|
|
setFormData({ operator_id: e }); |
|
|
|
|
|
getDeparts(e) |
|
|
|
|
|
getAssets(e) |
|
|
|
|
|
|
|
|
if(e=='0'){ |
|
|
|
|
|
setFormData({ operator_id: e }); |
|
|
|
|
|
}else{ |
|
|
|
|
|
setFormData({ operator_id: e }); |
|
|
|
|
|
getDeparts(e) |
|
|
|
|
|
getAssets(e) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setGetOperatorId(e) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const changeEditOperator = (e) => { |
|
|
const changeEditOperator = (e) => { |
|
@ -267,7 +284,7 @@ function PersonInfo() { |
|
|
setGetPersonId(e) |
|
|
setGetPersonId(e) |
|
|
} |
|
|
} |
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
if (getPersonId !='') { |
|
|
|
|
|
|
|
|
if (getPersonId) { |
|
|
let data = { |
|
|
let data = { |
|
|
operator_id: getPersonId |
|
|
operator_id: getPersonId |
|
|
} |
|
|
} |
|
@ -288,6 +305,8 @@ function PersonInfo() { |
|
|
console.log(err) |
|
|
console.log(err) |
|
|
}).finally(() => { |
|
|
}).finally(() => { |
|
|
}) |
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
setTranferAllData([]) |
|
|
} |
|
|
} |
|
|
}, [getPersonId]) |
|
|
}, [getPersonId]) |
|
|
/** |
|
|
/** |
|
@ -443,13 +462,13 @@ function PersonInfo() { |
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
getAllOperator() |
|
|
getAllOperator() |
|
|
return () => setGetEdit(false) |
|
|
return () => setGetEdit(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// getPersonAllRoad() |
|
|
// getPersonAllRoad() |
|
|
}, []) |
|
|
}, []) |
|
|
useEffect(()=>{ |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
console.log(getEdit); |
|
|
console.log(getEdit); |
|
|
|
|
|
|
|
|
},[getEdit]) |
|
|
|
|
|
|
|
|
}, [getEdit]) |
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
if (!showEdit) { |
|
|
if (!showEdit) { |
|
|
setCurrentPersonInfo({ |
|
|
setCurrentPersonInfo({ |
|
@ -549,24 +568,30 @@ function PersonInfo() { |
|
|
showClose={false} |
|
|
showClose={false} |
|
|
onChange={e => { changeOperator(e) }} |
|
|
onChange={e => { changeOperator(e) }} |
|
|
/> |
|
|
/> |
|
|
<FormSelect |
|
|
|
|
|
yisaLabel="所属部门" |
|
|
|
|
|
yisaData={departOptions} |
|
|
|
|
|
defaultValue={formData.depart_id || null} |
|
|
|
|
|
placeholder="" |
|
|
|
|
|
hasUnlimited={false} |
|
|
|
|
|
showClose={false} |
|
|
|
|
|
onChange={e => { setFormData({ depart_id: e }) }} |
|
|
|
|
|
/> |
|
|
|
|
|
<FormSelect |
|
|
|
|
|
yisaLabel="资产名称" |
|
|
|
|
|
yisaData={assetOptions} |
|
|
|
|
|
defaultValue={formData.property_id || null} |
|
|
|
|
|
placeholder="" |
|
|
|
|
|
hasUnlimited={false} |
|
|
|
|
|
showClose={false} |
|
|
|
|
|
onChange={e => { setFormData({ property_id: e }) }} |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
getOperatorId == '0' ? '' : |
|
|
|
|
|
<> |
|
|
|
|
|
<FormSelect |
|
|
|
|
|
yisaLabel="所属部门" |
|
|
|
|
|
yisaData={departOptions} |
|
|
|
|
|
defaultValue={formData.depart_id || null} |
|
|
|
|
|
placeholder="" |
|
|
|
|
|
hasUnlimited={false} |
|
|
|
|
|
showClose={false} |
|
|
|
|
|
onChange={e => { setFormData({ depart_id: e }) }} |
|
|
|
|
|
/> |
|
|
|
|
|
<FormSelect |
|
|
|
|
|
yisaLabel="资产名称" |
|
|
|
|
|
yisaData={assetOptions} |
|
|
|
|
|
defaultValue={formData.property_id || null} |
|
|
|
|
|
placeholder="" |
|
|
|
|
|
hasUnlimited={false} |
|
|
|
|
|
showClose={false} |
|
|
|
|
|
onChange={e => { setFormData({ property_id: e }) }} |
|
|
|
|
|
/> |
|
|
|
|
|
</> |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
<div className="bottomBox"> |
|
|
<div className="bottomBox"> |
|
|
<Button type="primary" className="colorReset" onClick={reset}>重置</Button> |
|
|
<Button type="primary" className="colorReset" onClick={reset}>重置</Button> |
|
|
<Button type="primary" className="colorBtn" onClick={addPersonInfo}>添加</Button> |
|
|
<Button type="primary" className="colorBtn" onClick={addPersonInfo}>添加</Button> |
|
@ -772,7 +797,7 @@ function PersonInfo() { |
|
|
</div> |
|
|
</div> |
|
|
<div className="btn-wrapper"> |
|
|
<div className="btn-wrapper"> |
|
|
<Button onClick={submitPersonInfo} type="primary" className="colorBtn">提交</Button>  |
|
|
<Button onClick={submitPersonInfo} type="primary" className="colorBtn">提交</Button>  |
|
|
<Button onClick={() => { setShowEdit(false) }} className="colorReset">取消</Button> |
|
|
|
|
|
|
|
|
<Button onClick={handleReset} className="colorReset">取消</Button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
} |
|
|
} |
|
|