Browse Source

fix():修改路内BUG

tags/PMS_Frontend_v1.0.6-develop
guoxin 1 year ago
parent
commit
6a8fa8e9d2
  1. 141
      src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx
  2. 13
      src/pages/OperationCenter/ArrearsRecover/ArrearsCarTask/loadable.jsx

141
src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx

@ -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>&emsp; <Button onClick={submitPersonInfo} type="primary" className="colorBtn">提交</Button>&emsp;
<Button onClick={() => { setShowEdit(false) }} className="colorReset">取消</Button>
<Button onClick={handleReset} className="colorReset">取消</Button>
</div> </div>
</div> </div>
} }

13
src/pages/OperationCenter/ArrearsRecover/ArrearsCarTask/loadable.jsx

@ -282,11 +282,15 @@ function ArrearsCarTask(props) {
// //
const [checkIds, setCheckIds] = useState([]); const [checkIds, setCheckIds] = useState([]);
const [checkValue, setCheckValue] = useState({}); const [checkValue, setCheckValue] = useState({});
const [getArrValue, setGetArrValue] = useState([]);
const rowSelection = { const rowSelection = {
selectedRowKeys: checkIds, selectedRowKeys: checkIds,
onChange: (keys, item) => { onChange: (keys, item) => {
let arr=[]
item.map(res => { item.map(res => {
setCheckValue(res); setCheckValue(res);
arr.push(res.car_id)
setGetArrValue(arr)
}) })
setCheckIds(keys); setCheckIds(keys);
}, },
@ -315,13 +319,14 @@ function ArrearsCarTask(props) {
} }
// //
const sendTaskData = () => { const sendTaskData = () => {
let str =getArrValue.toString()
if (checkIds.length == []) { if (checkIds.length == []) {
message.error('请先选择欠费车辆') message.error('请先选择欠费车辆')
} else if (checkValue.real_amount > checkValue.amount) { } else if (checkValue.real_amount > checkValue.amount) {
message.error(`选择车辆中存在欠费金额不足${checkValue.real_amount}元的车辆`) message.error(`选择车辆中存在欠费金额不足${checkValue.real_amount}元的车辆`)
} else { } else {
let data = { let data = {
car_ids: checkValue.car_id,
car_ids: str,
start_out_time: formData.start_out_time, start_out_time: formData.start_out_time,
end_out_time: formData.end_out_time end_out_time: formData.end_out_time
} }
@ -336,8 +341,9 @@ function ArrearsCarTask(props) {
} }
// //
const handlesendTask = () => { const handlesendTask = () => {
let str =getArrValue.toString()
let data = { let data = {
car_ids: checkValue.car_id,
car_ids:str,
start_out_time: formData.start_out_time, start_out_time: formData.start_out_time,
end_out_time: formData.end_out_time end_out_time: formData.end_out_time
} }
@ -353,8 +359,9 @@ function ArrearsCarTask(props) {
} }
// //
const handleCreat=()=>{ const handleCreat=()=>{
let str =getArrValue.toString()
let data = { let data = {
car_ids: checkValue.car_id,
car_ids: str,
start_out_time: formData.start_out_time, start_out_time: formData.start_out_time,
end_out_time: formData.end_out_time end_out_time: formData.end_out_time
} }

Loading…
Cancel
Save