diff --git a/src/pages/InRoadMgm/BusinessMgm/ChargeRules/index.scss b/src/pages/InRoadMgm/BusinessMgm/ChargeRules/index.scss index 4fe3d51..2cbdd09 100644 --- a/src/pages/InRoadMgm/BusinessMgm/ChargeRules/index.scss +++ b/src/pages/InRoadMgm/BusinessMgm/ChargeRules/index.scss @@ -449,4 +449,14 @@ $color-primary : var(--color-primary); border-left: none !important; border-bottom-color: #626b7e !important; } + .bind-btn{ + margin-top: 20px; + display: flex; + .bindBtn{ + margin-left: 30%; + .colorReset{ + margin-left: 30px; + } + } + } } \ No newline at end of file diff --git a/src/pages/InRoadMgm/BusinessMgm/ChargeRules/loadable.jsx b/src/pages/InRoadMgm/BusinessMgm/ChargeRules/loadable.jsx index a7610a2..323c5ee 100644 --- a/src/pages/InRoadMgm/BusinessMgm/ChargeRules/loadable.jsx +++ b/src/pages/InRoadMgm/BusinessMgm/ChargeRules/loadable.jsx @@ -421,6 +421,12 @@ function ChargeRules(props) { const [bindData, setBindData] = useState({}) const bindModal = () => { setBindVisible(false) + setBindCarPark({}) + setBindData({ + vehicle_type:'', + charge_type:'', + name:'' + }) } //车辆类型 const handleCarType = (v) => { @@ -473,18 +479,60 @@ function ChargeRules(props) { const onSelectChange = (newSelectedRowKeys) => { setSelectedRowKeys(newSelectedRowKeys); }; + + const bindCanle = () => { + setBindVisible(false) + setBindCarPark({ + vehicle_type:'', + charge_type:'', + name:'' + }) + setBindData({ + vehicle_type:'', + charge_type:'', + name:'' + }) + } const rowSelection = { selectedRowKeys, onChange: onSelectChange, }; const hasSelected = selectedRowKeys.length > 0; const start = () => { - setLoading(true); - // ajax request after empty completing - setTimeout(() => { - setSelectedRowKeys([]); - }, 1000); + console.log(selectedRowKeys); + let arr = selectedRowKeys + let road_ids = arr.toString() + let data = { + road_ids, + vehicle_type: bindData.vehicle_type, + id: getBindId.id + } + ajax.getBind(data).then(res => { + if (res.status === 20000) { + message.success(res.message) + setSelectedRowKeys([]); + } else { + message.error(res.message) + } + }) }; + const bindBtn = () => { + let arr = selectedRowKeys + let road_ids = arr.toString() + let data = { + road_ids, + vehicle_type: bindData.vehicle_type, + id: getBindId.id + } + ajax.getBind(data).then(res => { + if (res.status === 20000) { + message.success(res.message) + setSelectedRowKeys([]); + } else { + message.error(res.message) + } + }) + } const [getOperationName, setGetOperationName] = useState([]) const operationName = () => { ajax.getOperator().then(res => { @@ -600,14 +648,14 @@ function ChargeRules(props) { { - bindCarPark === 1 || 2 || 3 ? + bindCarPark === 1 || bindCarPark === 2 || bindCarPark === 3 ? <>