|
@ -16,6 +16,8 @@ const { TextArea } = Input; |
|
|
function CarGroupMgm({ id }) { |
|
|
function CarGroupMgm({ id }) { |
|
|
const [searchForm] = Form.useForm(); |
|
|
const [searchForm] = Form.useForm(); |
|
|
const [editForm] = Form.useForm(); |
|
|
const [editForm] = Form.useForm(); |
|
|
|
|
|
const [total, setTotal] = useState(0); |
|
|
|
|
|
const [deleteModal, setDeleteModal] = useState(false); |
|
|
const columns = [ |
|
|
const columns = [ |
|
|
{ |
|
|
{ |
|
|
title: "车辆组名称", |
|
|
title: "车辆组名称", |
|
@ -25,8 +27,8 @@ function CarGroupMgm({ id }) { |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "车辆类型", |
|
|
title: "车辆类型", |
|
|
dataIndex: "vehicle_type", |
|
|
dataIndex: "vehicle_type_name", |
|
|
key: "vehicle_type", |
|
|
key: "vehicle_type_name", |
|
|
align: "center", |
|
|
align: "center", |
|
|
}, |
|
|
}, |
|
|
// [ |
|
|
// [ |
|
@ -54,14 +56,19 @@ function CarGroupMgm({ id }) { |
|
|
align: "center", |
|
|
align: "center", |
|
|
render: (_, record) => { |
|
|
render: (_, record) => { |
|
|
return ( |
|
|
return ( |
|
|
<Button |
|
|
<Popover |
|
|
type="primary" |
|
|
trigger="hover" |
|
|
|
|
|
content={ |
|
|
|
|
|
<> |
|
|
|
|
|
<div> |
|
|
|
|
|
<a |
|
|
onClick={() => { |
|
|
onClick={() => { |
|
|
setEditModal({ |
|
|
setEditModal({ |
|
|
visible: true, |
|
|
visible: true, |
|
|
data: record, |
|
|
data: record, |
|
|
add: 0, |
|
|
add: 0, |
|
|
}); |
|
|
}); |
|
|
|
|
|
setCurrentId(record.id) |
|
|
editForm.setFieldsValue({ |
|
|
editForm.setFieldsValue({ |
|
|
name: record.name, |
|
|
name: record.name, |
|
|
vehicle_type: record.vehicle_type, |
|
|
vehicle_type: record.vehicle_type, |
|
@ -71,7 +78,27 @@ function CarGroupMgm({ id }) { |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
编辑 |
|
|
编辑 |
|
|
</Button> |
|
|
</a> |
|
|
|
|
|
</div> |
|
|
|
|
|
{ |
|
|
|
|
|
record.can_del == 1 ? |
|
|
|
|
|
<div> |
|
|
|
|
|
<a |
|
|
|
|
|
onClick={() => { |
|
|
|
|
|
setCurrentId(record.id); |
|
|
|
|
|
setDeleteModal(true) |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
删除 |
|
|
|
|
|
</a> |
|
|
|
|
|
</div> |
|
|
|
|
|
: null |
|
|
|
|
|
} |
|
|
|
|
|
</> |
|
|
|
|
|
} |
|
|
|
|
|
> |
|
|
|
|
|
<Button type="primary">编辑</Button> |
|
|
|
|
|
</Popover> |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
@ -88,6 +115,7 @@ function CarGroupMgm({ id }) { |
|
|
page_size: 10, |
|
|
page_size: 10, |
|
|
total: 0, |
|
|
total: 0, |
|
|
}); |
|
|
}); |
|
|
|
|
|
const [currentId, setCurrentId] = useState(""); |
|
|
const getVehicleGroup = () => { |
|
|
const getVehicleGroup = () => { |
|
|
const params = { ...searchForm.getFieldsValue(), ...pageData, road_id: id }; |
|
|
const params = { ...searchForm.getFieldsValue(), ...pageData, road_id: id }; |
|
|
ajax |
|
|
ajax |
|
@ -95,6 +123,7 @@ function CarGroupMgm({ id }) { |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
if (res.status === 20000) { |
|
|
if (res.status === 20000) { |
|
|
setCarList(res.data.list); |
|
|
setCarList(res.data.list); |
|
|
|
|
|
setTotal(res.data.total) |
|
|
} else { |
|
|
} else { |
|
|
message.error(res.message); |
|
|
message.error(res.message); |
|
|
} |
|
|
} |
|
@ -103,7 +132,18 @@ function CarGroupMgm({ id }) { |
|
|
console.log(err); |
|
|
console.log(err); |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
//删除接口 |
|
|
|
|
|
const getDelCarGroup = (id) => { |
|
|
|
|
|
ajax.getDelCarGroup({ id }).then((res) => { |
|
|
|
|
|
if (res.status === 20000) { |
|
|
|
|
|
message.success("删除成功"); |
|
|
|
|
|
setDeleteModal(false); |
|
|
|
|
|
getVehicleGroup(); |
|
|
|
|
|
} else { |
|
|
|
|
|
message.error(res.message); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
function changePage(pn, page_size) { |
|
|
function changePage(pn, page_size) { |
|
|
setPageData({ |
|
|
setPageData({ |
|
|
pn, |
|
|
pn, |
|
@ -154,7 +194,7 @@ function CarGroupMgm({ id }) { |
|
|
}) |
|
|
}) |
|
|
: |
|
|
: |
|
|
ajax |
|
|
ajax |
|
|
.getEditCarGroup({ ...data, road_id: id }) |
|
|
.getEditCarGroup({ ...data, road_id: id, id: currentId }) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
if (res.status === 20000) { |
|
|
if (res.status === 20000) { |
|
|
message.success(res.message) |
|
|
message.success(res.message) |
|
@ -271,7 +311,7 @@ function CarGroupMgm({ id }) { |
|
|
position: ["bottomCenter"], |
|
|
position: ["bottomCenter"], |
|
|
current: pageData.pn, |
|
|
current: pageData.pn, |
|
|
pageSize: pageData.page_size, |
|
|
pageSize: pageData.page_size, |
|
|
total: pageData.total, |
|
|
total: total, |
|
|
pageSizeOptions: dictionary?.pageSizeOptions, |
|
|
pageSizeOptions: dictionary?.pageSizeOptions, |
|
|
onChange: changePage, |
|
|
onChange: changePage, |
|
|
onShowSizeChange: changePage, |
|
|
onShowSizeChange: changePage, |
|
@ -309,8 +349,8 @@ function CarGroupMgm({ id }) { |
|
|
<Form.Item label="状态" name="status" rules={[{ required: true }]}> |
|
|
<Form.Item label="状态" name="status" rules={[{ required: true }]}> |
|
|
<Select |
|
|
<Select |
|
|
options={[ |
|
|
options={[ |
|
|
{ label: "启用", value: 2 }, |
|
|
{ label: "启用", value: '2' }, |
|
|
{ label: "禁用", value: 1 }, |
|
|
{ label: "禁用", value: '1' }, |
|
|
]} |
|
|
]} |
|
|
/> |
|
|
/> |
|
|
</Form.Item> |
|
|
</Form.Item> |
|
@ -323,6 +363,18 @@ function CarGroupMgm({ id }) { |
|
|
</Row> |
|
|
</Row> |
|
|
</Form> |
|
|
</Form> |
|
|
</Modal> |
|
|
</Modal> |
|
|
|
|
|
<Modal |
|
|
|
|
|
open={deleteModal} |
|
|
|
|
|
onCancel={() => { setDeleteModal(false) }} |
|
|
|
|
|
onOk={() => { getDelCarGroup(currentId) }} |
|
|
|
|
|
//footer={null} |
|
|
|
|
|
className="applyCopyModal" |
|
|
|
|
|
title='提示' |
|
|
|
|
|
> |
|
|
|
|
|
<div className="enableStatus"> |
|
|
|
|
|
确认是否删除该记录! |
|
|
|
|
|
</div> |
|
|
|
|
|
</Modal> |
|
|
</div> |
|
|
</div> |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
xxxxxxxxxx