|
|
@ -1,12 +1,12 @@ |
|
|
|
import React, { useEffect, useState } from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { Form, Spin, Table } from 'antd'; |
|
|
|
import { DrawerForm, ProForm, ProFormText, ProFormSelect } from '@ant-design/pro-form'; |
|
|
|
import { DrawerForm, ProForm, ProFormText, ProFormSelect,ProFormDatePicker } from '@ant-design/pro-form'; |
|
|
|
import { putRoadway, putSpecificVehicle, putHouseholds, putCircuit, putVehicle, putPurchase } from "../../actions/infor" |
|
|
|
import { putBridge } from "../../actions/infor" |
|
|
|
import _ from 'lodash' |
|
|
|
import _ from 'lodash' |
|
|
|
const UserModal = (props) => { |
|
|
|
const { visible, onVisibleChange, typecard, rewkeys, data, recortd, sitename, dispatch, setRecortd, setMonitor,setDelet,whichofits } = props |
|
|
|
const { visible, onVisibleChange, typecard, rewkeys, data, recortd, sitename, dispatch, setRecortd, setMonitor, setDelet, whichofits } = props |
|
|
|
const [newlys, setNewlys] = useState() //必填数据
|
|
|
|
const [newlysay, setNewlysay] = useState() //处理hou
|
|
|
|
const [records, setRecords] = useState()//处理
|
|
|
@ -70,6 +70,7 @@ const UserModal = (props) => { |
|
|
|
array.push({ name: value, type: key }) |
|
|
|
}); |
|
|
|
setNewlys(array?.splice(0, 2)) |
|
|
|
array?.splice(6, 1) |
|
|
|
setNewlysay(array) |
|
|
|
} |
|
|
|
}, []) |
|
|
@ -150,54 +151,74 @@ const UserModal = (props) => { |
|
|
|
onFinish={(values) => { |
|
|
|
if (Object.values(values).length > 0) { |
|
|
|
if (rewkeys === 'transportation') { |
|
|
|
|
|
|
|
if (typecard == '111') { |
|
|
|
|
|
|
|
if (typecard == '111') { |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, level: whichofits, roadId: records?.[0]?.value || '' } |
|
|
|
dispatch(putRoadway(query)).then((res) => { |
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
}) |
|
|
|
} else { |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, level: whichofits } |
|
|
|
dispatch(putRoadway(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return true |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (rewkeys === 'bridge') { |
|
|
|
if (typecard == '111') { |
|
|
|
setDelet(values) |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, roadId: records?.[0]?.value || '' } |
|
|
|
dispatch(putBridge(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} else { |
|
|
|
setDelet(values) |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values } |
|
|
|
dispatch(putBridge(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
if (rewkeys === 'weihuo' || rewkeys === 'chuzu') { |
|
|
|
if (rewkeys === 'weihuo') { |
|
|
|
if (typecard == '111') { |
|
|
|
|
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, vehicleId: records?.[0]?.value || '', type: rewkeys == 'chuzu' ? '出租车' : '危货' } |
|
|
|
const query = { ...values, vehicleId: records?.[0]?.value || '', type: '危货' } |
|
|
|
dispatch(putSpecificVehicle(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} else { |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, type: rewkeys == 'chuzu' ? '出租车' : '危货' } |
|
|
|
|
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, type: '危货' } |
|
|
|
dispatch(putSpecificVehicle(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
if (rewkeys === 'chuzu') { |
|
|
|
if (typecard == '111') { |
|
|
|
|
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, vehicleId: records?.[0]?.value || '', type: '出租车' } |
|
|
|
dispatch(putSpecificVehicle(query)).then((res) => { |
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} else { |
|
|
|
|
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, type: '出租车' } |
|
|
|
dispatch(putSpecificVehicle(query)).then((res) => { |
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} |
|
|
@ -205,16 +226,16 @@ const UserModal = (props) => { |
|
|
|
if (rewkeys === 'yehu') { |
|
|
|
if (typecard == '111') { |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, businessId: records?.[0]?.value, type: rewkeys == 'chuzu' ? '出租车' : '危货' } |
|
|
|
const query = { ...values, businessId: records?.[0]?.value, type: values.type } |
|
|
|
dispatch(putHouseholds(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} else { |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, type: rewkeys === 'chuzu' ? '出租车' : '危货' } |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, type: values.type } |
|
|
|
dispatch(putHouseholds(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} |
|
|
@ -223,14 +244,14 @@ const UserModal = (props) => { |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, lineId: records?.[0]?.value || '' } |
|
|
|
dispatch(putCircuit(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} else { |
|
|
|
setDelet(values) |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values } |
|
|
|
dispatch(putCircuit(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} |
|
|
@ -240,14 +261,14 @@ const UserModal = (props) => { |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, carId: records?.[0]?.value || '' } |
|
|
|
dispatch(putVehicle(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} else { |
|
|
|
setDelet(values) |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values } |
|
|
|
dispatch(putVehicle(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
return true |
|
|
|
} |
|
|
@ -257,15 +278,15 @@ const UserModal = (props) => { |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values, overspeedId: records?.[0]?.value || '' } |
|
|
|
dispatch(putPurchase(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
setMonitor(res) |
|
|
|
}) |
|
|
|
return true |
|
|
|
} else { |
|
|
|
setDelet(values) |
|
|
|
setDelet(values) |
|
|
|
const query = { ...values } |
|
|
|
dispatch(putPurchase(query)).then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
setMonitor(res) |
|
|
|
}) |
|
|
|
return true |
|
|
@ -283,7 +304,6 @@ const UserModal = (props) => { |
|
|
|
name={newlys?.[0]?.type} |
|
|
|
width="md" |
|
|
|
label={newlys?.[0]?.name} |
|
|
|
|
|
|
|
placeholder="请输入名称" |
|
|
|
value={recordsay?.[0]?.value} |
|
|
|
// rules={[{ required: true, message: "必填" }]}
|
|
|
@ -291,7 +311,7 @@ const UserModal = (props) => { |
|
|
|
name={newlys?.[1]?.type} |
|
|
|
width="md" |
|
|
|
label={newlys?.[1]?.name} |
|
|
|
|
|
|
|
|
|
|
|
placeholder="请输入名称" |
|
|
|
value={recordsay?.[1]?.value} |
|
|
|
// rules={[{ required: true, message: "必填" }]}
|
|
|
@ -312,6 +332,7 @@ const UserModal = (props) => { |
|
|
|
label='类型' |
|
|
|
/> : null |
|
|
|
} |
|
|
|
{rewkeys === 'zhichao'?<ProFormDatePicker name="testTime" label="检测时间" />:''} |
|
|
|
{newlysay?.map((item, index) => { |
|
|
|
return <ProFormText width="md" |
|
|
|
name={item?.type} label={newlysay[index]?.name} placeholder="请输入名称" |
|
|
@ -325,7 +346,7 @@ const UserModal = (props) => { |
|
|
|
name={newlys?.[0]?.type} |
|
|
|
width="md" |
|
|
|
label={newlys?.[0]?.name} |
|
|
|
|
|
|
|
|
|
|
|
placeholder="请输入名称" |
|
|
|
// value={recordssy?.[0]?.value}
|
|
|
|
// rules={[{ required: true, message: "必填" }]}
|
|
|
@ -333,7 +354,7 @@ const UserModal = (props) => { |
|
|
|
name={newlys?.[1]?.type} |
|
|
|
width="md" |
|
|
|
label={newlys?.[1]?.name} |
|
|
|
|
|
|
|
|
|
|
|
placeholder="请输入名称" |
|
|
|
// value={recordssy?.[1]?.value}
|
|
|
|
// rules={[{ required: true, message: "必填" }]}
|
|
|
@ -354,10 +375,11 @@ const UserModal = (props) => { |
|
|
|
label='类型' |
|
|
|
/> : null |
|
|
|
} |
|
|
|
{rewkeys === 'zhichao'?<ProFormDatePicker name="testTime" label="检测时间" />:''} |
|
|
|
{newlysay?.map((item, index) => { |
|
|
|
return <ProFormText width="md" |
|
|
|
name={item?.type} label={newlysay[index]?.name} placeholder="请输入名称" key={index} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/> |
|
|
|
})} |
|
|
|