diff --git a/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx b/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx index c8b6e7a..5c280bb 100644 --- a/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx +++ b/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx @@ -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 : '', @@ -146,7 +150,7 @@ function PersonInfo() { // 点击编辑 获取人员信息 const getPersonAllRoad = (data) => { - + } // 重置密码 const resetPersonPwd = (id) => { @@ -211,53 +215,66 @@ function PersonInfo() { }) } 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 { - 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) => { - 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 { - 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 [getOperatorId, setGetOperatorId] = useState('0') 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) => { @@ -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]) /** @@ -443,13 +462,13 @@ function PersonInfo() { useEffect(() => { getAllOperator() return () => setGetEdit(false) - + // getPersonAllRoad() }, []) - useEffect(()=>{ + useEffect(() => { console.log(getEdit); - },[getEdit]) + }, [getEdit]) useEffect(() => { if (!showEdit) { setCurrentPersonInfo({ @@ -549,24 +568,30 @@ function PersonInfo() { showClose={false} onChange={e => { changeOperator(e) }} /> - { setFormData({ depart_id: e }) }} - /> - { setFormData({ property_id: e }) }} - /> + { + getOperatorId == '0' ? '' : + <> + { setFormData({ depart_id: e }) }} + /> + { setFormData({ property_id: e }) }} + /> + + } +
@@ -772,7 +797,7 @@ function PersonInfo() {
  - +
} diff --git a/src/pages/OperationCenter/ArrearsRecover/ArrearsCarTask/loadable.jsx b/src/pages/OperationCenter/ArrearsRecover/ArrearsCarTask/loadable.jsx index b8dc039..0369c1a 100644 --- a/src/pages/OperationCenter/ArrearsRecover/ArrearsCarTask/loadable.jsx +++ b/src/pages/OperationCenter/ArrearsRecover/ArrearsCarTask/loadable.jsx @@ -282,11 +282,15 @@ function ArrearsCarTask(props) { // 表格选中 const [checkIds, setCheckIds] = useState([]); const [checkValue, setCheckValue] = useState({}); + const [getArrValue, setGetArrValue] = useState([]); const rowSelection = { selectedRowKeys: checkIds, onChange: (keys, item) => { + let arr=[] item.map(res => { setCheckValue(res); + arr.push(res.car_id) + setGetArrValue(arr) }) setCheckIds(keys); }, @@ -315,13 +319,14 @@ function ArrearsCarTask(props) { } //发送追缴短信 const sendTaskData = () => { + let str =getArrValue.toString() if (checkIds.length == []) { message.error('请先选择欠费车辆') } else if (checkValue.real_amount > checkValue.amount) { message.error(`选择车辆中存在欠费金额不足${checkValue.real_amount}元的车辆`) } else { let data = { - car_ids: checkValue.car_id, + car_ids: str, start_out_time: formData.start_out_time, end_out_time: formData.end_out_time } @@ -336,8 +341,9 @@ function ArrearsCarTask(props) { } //确定发送短信 const handlesendTask = () => { + let str =getArrValue.toString() let data = { - car_ids: checkValue.car_id, + car_ids:str, start_out_time: formData.start_out_time, end_out_time: formData.end_out_time } @@ -353,8 +359,9 @@ function ArrearsCarTask(props) { } //确定创建追缴任务 const handleCreat=()=>{ + let str =getArrValue.toString() let data = { - car_ids: checkValue.car_id, + car_ids: str, start_out_time: formData.start_out_time, end_out_time: formData.end_out_time }