|
|
@ -38,6 +38,7 @@ function ChargeRules(props) { |
|
|
|
const [countAddIntervalNum, setCountAddIntervalNum] = useState([0]) |
|
|
|
const [effectNum, setEffectNum] = useState([0]) |
|
|
|
const [countNum, setCountNum] = useState([0]) |
|
|
|
const [bindVisible, setBindVisible] = useState(false) |
|
|
|
const addTime = () => { |
|
|
|
setCount([...count, count.length + 1]) |
|
|
|
} |
|
|
@ -228,6 +229,34 @@ function ChargeRules(props) { |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
//绑定车场列表 |
|
|
|
const columns = () => { |
|
|
|
let result = [...handleBindColumns] |
|
|
|
return result; |
|
|
|
} |
|
|
|
let handleBindColumns = [ |
|
|
|
{ |
|
|
|
title: '车场名称', |
|
|
|
dataIndex: 'road_name', |
|
|
|
key: 'road_name', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '计费类型', |
|
|
|
dataIndex: 'charge_type_name', |
|
|
|
key: 'charge_type_name', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '计费规则', |
|
|
|
dataIndex: 'rule_name', |
|
|
|
key: 'rule_name', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '区域', |
|
|
|
dataIndex: 'area_name', |
|
|
|
key: 'area_name', |
|
|
|
}, |
|
|
|
] |
|
|
|
const onChangeMin = (e) => { |
|
|
|
if (e.target.checked == true) { |
|
|
|
setGetAddData({ ...getAddData, freeTimeAble: 0 }) |
|
|
@ -291,6 +320,7 @@ function ChargeRules(props) { |
|
|
|
<div className="black"> |
|
|
|
<div onClick={() => { deleteApplyBtn(record) }}>编辑</div> |
|
|
|
<div onClick={() => { applyBtn(record) }}>删除</div> |
|
|
|
<div onClick={() => { bindPark(record) }}>绑定车场</div> |
|
|
|
</div>}> |
|
|
|
<button className="blackRecordBtn colorBtn">操作</button> |
|
|
|
</Popover> |
|
|
@ -309,6 +339,12 @@ function ChargeRules(props) { |
|
|
|
setGetDeleteData(record) |
|
|
|
setDeleteVisible(true) |
|
|
|
} |
|
|
|
//绑定车场 |
|
|
|
const [getBindId, setGetBindId] = useState({}) |
|
|
|
const bindPark = (record) => { |
|
|
|
setBindVisible(true) |
|
|
|
setGetBindId(record) |
|
|
|
} |
|
|
|
const deleteModal = () => { |
|
|
|
setDeleteVisible(false) |
|
|
|
} |
|
|
@ -337,7 +373,7 @@ function ChargeRules(props) { |
|
|
|
setResultData({ |
|
|
|
...resultData, |
|
|
|
data: resDataArr, |
|
|
|
total_records: res.data.total_records |
|
|
|
total_records: res.data.total |
|
|
|
}) |
|
|
|
} else { |
|
|
|
setResultData({ |
|
|
@ -380,6 +416,75 @@ function ChargeRules(props) { |
|
|
|
const editModal = () => { |
|
|
|
setGetEditVisible(false) |
|
|
|
} |
|
|
|
//绑定车场 |
|
|
|
const [bindCarPark, setBindCarPark] = useState({}) |
|
|
|
const [bindData, setBindData] = useState({}) |
|
|
|
const bindModal = () => { |
|
|
|
setBindVisible(false) |
|
|
|
} |
|
|
|
//车辆类型 |
|
|
|
const handleCarType = (v) => { |
|
|
|
setBindCarPark(v) |
|
|
|
setBindData({ |
|
|
|
...bindData, |
|
|
|
vehicle_type: v |
|
|
|
}) |
|
|
|
} |
|
|
|
//停车场计费类型 |
|
|
|
const handleParkPay = (v) => { |
|
|
|
setBindData({ |
|
|
|
...bindData, |
|
|
|
charge_type: v |
|
|
|
}) |
|
|
|
} |
|
|
|
//父车场名称 |
|
|
|
const handleName = (v) => { |
|
|
|
setBindData({ |
|
|
|
...bindData, |
|
|
|
road_parent_id: v.target.value |
|
|
|
}) |
|
|
|
} |
|
|
|
//绑定车场查询 |
|
|
|
const [getColumnList, setGetColumnList] = useState([]) |
|
|
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]); |
|
|
|
const [getStatus, setGetStatus] = useState(false) |
|
|
|
const getBindData = () => { |
|
|
|
let data = { |
|
|
|
...bindData, |
|
|
|
id: getBindId.id |
|
|
|
} |
|
|
|
ajax.getRoadList(data).then(res => { |
|
|
|
if (res.status === 20000) { |
|
|
|
let resDataArr = res.data.list.map((item) => { |
|
|
|
item.key = item.id |
|
|
|
return item |
|
|
|
}) |
|
|
|
setGetColumnList({ |
|
|
|
...getColumnList, |
|
|
|
data: resDataArr, |
|
|
|
total_records: res.data.total |
|
|
|
}) |
|
|
|
setGetStatus(true) |
|
|
|
} else { |
|
|
|
message.error(res.message) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const onSelectChange = (newSelectedRowKeys) => { |
|
|
|
setSelectedRowKeys(newSelectedRowKeys); |
|
|
|
}; |
|
|
|
const rowSelection = { |
|
|
|
selectedRowKeys, |
|
|
|
onChange: onSelectChange, |
|
|
|
}; |
|
|
|
const hasSelected = selectedRowKeys.length > 0; |
|
|
|
const start = () => { |
|
|
|
setLoading(true); |
|
|
|
// ajax request after empty completing |
|
|
|
setTimeout(() => { |
|
|
|
setSelectedRowKeys([]); |
|
|
|
}, 1000); |
|
|
|
}; |
|
|
|
const [getOperationName, setGetOperationName] = useState([]) |
|
|
|
const operationName = () => { |
|
|
|
ajax.getOperator().then(res => { |
|
|
@ -438,7 +543,7 @@ function ChargeRules(props) { |
|
|
|
</div> |
|
|
|
<div className="paid-result"> |
|
|
|
<div className="result"> |
|
|
|
<span className="font">共检索到<em>{resultData.total_records}</em>条结果</span> |
|
|
|
<span className="font">共检索到<em>{resultData.total}</em>条结果</span> |
|
|
|
<ResultFlowResult ajaxLoad={ajaxLoading} resultData={resultData.data ? resultData.data : []}> |
|
|
|
<Table |
|
|
|
bordered |
|
|
@ -468,7 +573,7 @@ function ChargeRules(props) { |
|
|
|
|
|
|
|
</div> |
|
|
|
<FormModal addVisible={addVisible} setGetAddVisible={setGetAddVisible} closAddModal={closAddModal} /> |
|
|
|
<EditModal editVisible={editVisible} editModal={editModal} yisaData={getEditData}/> |
|
|
|
<EditModal editVisible={editVisible} editModal={editModal} yisaData={getEditData} /> |
|
|
|
<Modal |
|
|
|
visible={deleteVisible} |
|
|
|
onCancel={deleteModal} |
|
|
@ -484,6 +589,72 @@ function ChargeRules(props) { |
|
|
|
<button className="cancel colorReset" onClick={() => { cancel() }}>取消</button> |
|
|
|
</div> |
|
|
|
</Modal> |
|
|
|
<Modal |
|
|
|
visible={bindVisible} |
|
|
|
onCancel={bindModal} |
|
|
|
footer={null} |
|
|
|
className="bindModal" |
|
|
|
title='绑定规则' |
|
|
|
> |
|
|
|
<div className="yisa-search selectChange"> |
|
|
|
<label>请先选择要绑定的车辆类型</label> |
|
|
|
<Select |
|
|
|
style={{ width: 200, marginLeft: 14 }} |
|
|
|
value={bindData.bindData} |
|
|
|
options={sysConfig.vehicleTypeNOAll} |
|
|
|
onChange={handleCarType} |
|
|
|
placeholder="请选择" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
{ |
|
|
|
bindCarPark === 1 || 2 || 3 ? |
|
|
|
<> |
|
|
|
<div className="patkPay"> |
|
|
|
<div className="yisa-search"> |
|
|
|
<label>停车场计费类型</label> |
|
|
|
<Select |
|
|
|
style={{ width: 200, marginLeft: 14 }} |
|
|
|
value={bindData.charge_type} |
|
|
|
options={sysConfig.chargeType} |
|
|
|
onChange={handleParkPay} |
|
|
|
placeholder="请选择" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<div className="yisa-search bind"> |
|
|
|
<label>父车场名称</label> |
|
|
|
<Input |
|
|
|
placeholder="请输入" |
|
|
|
value={bindData.name} |
|
|
|
style={{ width: 200, marginLeft: 14 }} |
|
|
|
onChange={handleName} |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<div className="yisa-search bind"> |
|
|
|
<Button type="primary" className=" colorBtn" icon={<SearchOutlined />} onClick={() => { getBindData() }}> |
|
|
|
查询 |
|
|
|
</Button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{ |
|
|
|
getStatus == true ? |
|
|
|
<div className="table-list"> |
|
|
|
<Table |
|
|
|
className="bindTable" |
|
|
|
rowSelection={rowSelection} |
|
|
|
columns={columns()} |
|
|
|
dataSource={getColumnList.data} |
|
|
|
/> |
|
|
|
<Button type="primary" onClick={start} disabled={!hasSelected} > |
|
|
|
Reload |
|
|
|
</Button> |
|
|
|
</div> : '' |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
</> |
|
|
|
: '' |
|
|
|
} |
|
|
|
</Modal> |
|
|
|
</> |
|
|
|
} |
|
|
|
|