|
|
@ -103,6 +103,7 @@ function CarManagement({ id }) { |
|
|
|
<a |
|
|
|
onClick={() => { |
|
|
|
setEditModal({ visible: true, record, status: "edit" }); |
|
|
|
setCurrentId(record.id); |
|
|
|
editForm.setFieldsValue({ |
|
|
|
plate: record.plate, |
|
|
|
plate_color: record.plate_color, |
|
|
@ -110,6 +111,10 @@ function CarManagement({ id }) { |
|
|
|
status: record.status, |
|
|
|
car_owner_name: record.car_owner_name, |
|
|
|
group_id: record.group_id, |
|
|
|
effective_date: [ |
|
|
|
moment(record.effective_begin_date), |
|
|
|
moment(record.effective_end_date), |
|
|
|
], |
|
|
|
note: record.note, |
|
|
|
}); |
|
|
|
}} |
|
|
@ -157,6 +162,7 @@ function CarManagement({ id }) { |
|
|
|
pn: 1, |
|
|
|
page_size: 10, |
|
|
|
}); |
|
|
|
const [currentId, setCurrentId] = useState(""); |
|
|
|
//添加的弹窗 |
|
|
|
const [editModal, setEditModal] = useState({ |
|
|
|
visible: false, |
|
|
@ -164,28 +170,28 @@ function CarManagement({ id }) { |
|
|
|
status: "edit", |
|
|
|
}); |
|
|
|
|
|
|
|
const [batchUploadModal ,setBatchUploadModal] = useState(false) |
|
|
|
const [batchUploadModal, setBatchUploadModal] = useState(false) |
|
|
|
const props = { |
|
|
|
action: process.env.NODE_ENV == "development" ? 'http://10.10.128.65:3001/mock/11/api/ope/coupon/import':`${baseApi}/api/ope/coupon/import`, |
|
|
|
action: process.env.NODE_ENV == "development" ? 'http://10.10.128.65:3001/mock/11/api/ope/coupon/import' : `${baseApi}/api/ope/coupon/import`, |
|
|
|
multiple: false, |
|
|
|
showUploadList: false, |
|
|
|
method: 'post', |
|
|
|
beforeUpload : (file, fileList)=>{ |
|
|
|
beforeUpload: (file, fileList) => { |
|
|
|
console.log(file, 'file') |
|
|
|
if(fileList.length > 1){ |
|
|
|
if (fileList.length > 1) { |
|
|
|
message.error('只支撑同时上传一个文件') |
|
|
|
return |
|
|
|
} |
|
|
|
return true |
|
|
|
}, |
|
|
|
onChange: (res)=>{ |
|
|
|
if(res.file.status == 'done'){ |
|
|
|
onChange: (res) => { |
|
|
|
if (res.file.status == 'done') { |
|
|
|
console.log(res) |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const excuteUploadBatchData = ()=>{ |
|
|
|
const excuteUploadBatchData = () => { |
|
|
|
// ajax.getVehicleList(values).then((res) => { |
|
|
|
// if (res.status === 20000) { |
|
|
|
// setDataSource(res.data.list); |
|
|
@ -215,20 +221,43 @@ function CarManagement({ id }) { |
|
|
|
effective_begin_date: moment(res.effective_date[0]).format("YYYY-MM-DD HH:mm:ss"), |
|
|
|
effective_end_date: moment(res.effective_date[1]).format("YYYY-MM-DD HH:mm:ss") |
|
|
|
}; |
|
|
|
if(new Date(res.effective_date[0]).getTime() < new Date().getTime()){ |
|
|
|
if (res.plate != '' && !utils?.validationPlate(res.plate)) { |
|
|
|
message.error('请输入正确的车牌号') |
|
|
|
return |
|
|
|
} |
|
|
|
let phoneReg = new RegExp(/^(?:(?:\+|00)86)?1[3-9]\d{9}$/) |
|
|
|
if (res.phone && !phoneReg.test(res.phone)) { |
|
|
|
message.error('请输入正确的手机号') |
|
|
|
return |
|
|
|
} |
|
|
|
if (new Date(res.effective_date[0]).getTime() < new Date().getTime()) { |
|
|
|
message.error('生效日期必须为当前时间以后的时间') |
|
|
|
return |
|
|
|
} |
|
|
|
ajax.addVehicle(res).then((res) => { |
|
|
|
if (res.status === 20000) { |
|
|
|
message.success(res.message); |
|
|
|
setEditModal({ visible: false }); |
|
|
|
submit(form.getFieldValue()); |
|
|
|
editForm.resetFields(); |
|
|
|
} else { |
|
|
|
message.error(res.message) |
|
|
|
} |
|
|
|
}); |
|
|
|
if (editModal.status === "add") { |
|
|
|
ajax.addVehicle(res).then((res) => { |
|
|
|
if (res.status === 20000) { |
|
|
|
message.success(res.message); |
|
|
|
setEditModal({ visible: false }); |
|
|
|
submit(form.getFieldValue()); |
|
|
|
editForm.resetFields(); |
|
|
|
} else { |
|
|
|
message.error(res.message) |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
res.id = currentId; |
|
|
|
ajax.editVehicle(res).then((res) => { |
|
|
|
if (res.status === 20000) { |
|
|
|
message.success(res.message); |
|
|
|
setEditModal({ visible: false }); |
|
|
|
submit(form.getFieldValue()); |
|
|
|
editForm.resetFields(); |
|
|
|
} else { |
|
|
|
message.error(res.message) |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.error(err); |
|
|
@ -409,7 +438,7 @@ function CarManagement({ id }) { |
|
|
|
rules={[{ required: true }]} |
|
|
|
name="plate_color" |
|
|
|
> |
|
|
|
<Select disabled={editModal.status === "edit"} options={sysConfig.plateColor} /> |
|
|
|
<Select disabled={editModal.status === "edit"} options={sysConfig.plateColor.slice(1)} /> |
|
|
|
</Form.Item> |
|
|
|
</Col> |
|
|
|
<Col span={12}> |
|
|
@ -486,15 +515,15 @@ function CarManagement({ id }) { |
|
|
|
<Modal |
|
|
|
open={batchUploadModal} |
|
|
|
onCancel={() => { setBatchUploadModal(false) }} |
|
|
|
onOk={() => { }} |
|
|
|
onOk={() => { }} |
|
|
|
//footer={null} |
|
|
|
className="batchUploadModal" |
|
|
|
title='批量上传' |
|
|
|
zIndex={2000} |
|
|
|
> |
|
|
|
<div className="batch-upload-car"> |
|
|
|
<Upload |
|
|
|
{...props} |
|
|
|
<Upload |
|
|
|
{...props} |
|
|
|
// fileList={fileList} |
|
|
|
> |
|
|
|
<Button type="primary">上传</Button> |
|
|
|