Browse Source

新增编辑问题修改

dev
xingyongchun 3 years ago
parent
commit
d3d19bafbe
  1. 46
      web/client/src/sections/fillion/components/infor/details.js
  2. 12
      web/client/src/sections/fillion/components/operationalTable.js

46
web/client/src/sections/fillion/components/infor/details.js

@ -2,11 +2,11 @@ import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Form, Spin, Table } from 'antd'; import { Form, Spin, Table } from 'antd';
import { DrawerForm, ProForm, ProFormText, ProFormSelect } from '@ant-design/pro-form'; import { DrawerForm, ProForm, ProFormText, ProFormSelect } from '@ant-design/pro-form';
import { putRoadway, putSpecificVehicle, putHouseholds,putCircuit,putVehicle } from "../../actions/infor" import { putRoadway, putSpecificVehicle, putHouseholds,putCircuit,putVehicle,putPurchase } from "../../actions/infor"
import { putBridge } from "../../actions/infor" import { putBridge } from "../../actions/infor"
import _ from 'lodash' import _ from 'lodash'
const UserModal = (props) => { const UserModal = (props) => {
const { visible, onVisibleChange, typecard, rewkeys, data, recortd, sitename, dispatch, setRecortd, engineering } = props const { visible, onVisibleChange, typecard, rewkeys, data, recortd, sitename,setDelet, dispatch, setRecortd, engineering,whichofits } = props
const [newlys, setNewlys] = useState() //必填数据 const [newlys, setNewlys] = useState() //必填数据
const [newlysay, setNewlysay] = useState() //处理hou const [newlysay, setNewlysay] = useState() //处理hou
const [records, setRecords] = useState()//处理 const [records, setRecords] = useState()//处理
@ -64,6 +64,12 @@ const UserModal = (props) => {
}); });
setNewlys(array?.splice(0, 2)) setNewlys(array?.splice(0, 2))
setNewlysay(array) setNewlysay(array)
}if (rewkeys === 'zhichao') {
_.forIn(data, function (value, key) {
array.push({ name: value, type: key })
});
setNewlys(array?.splice(0, 2))
setNewlysay(array)
} }
}, []) }, [])
useEffect(() => { useEffect(() => {
@ -136,8 +142,7 @@ const UserModal = (props) => {
onFinish={(values) => { onFinish={(values) => {
if (Object.values(values).length > 0) { if (Object.values(values).length > 0) {
if (rewkeys === 'transportation') { if (rewkeys === 'transportation') {
if (typecard == 'compile') {
if (typecard == '111') {
setDelet(values) setDelet(values)
const query = { ...values, level: whichofits, roadId: records?.[0]?.value || '' } const query = { ...values, level: whichofits, roadId: records?.[0]?.value || '' }
dispatch(putRoadway(query)).then((res) => { dispatch(putRoadway(query)).then((res) => {
@ -155,7 +160,7 @@ const UserModal = (props) => {
} }
} }
if (rewkeys === 'bridge') { if (rewkeys === 'bridge') {
if (typecard == '111') { if (typecard == 'compile') {
setDelet(values) setDelet(values)
const query = { ...values, roadId: records?.[0]?.value || '' } const query = { ...values, roadId: records?.[0]?.value || '' }
dispatch(putBridge(query)).then((res) => { dispatch(putBridge(query)).then((res) => {
@ -172,7 +177,7 @@ const UserModal = (props) => {
} }
} }
if (rewkeys === 'weihuo' || rewkeys === 'chuzu') { if (rewkeys === 'weihuo' || rewkeys === 'chuzu') {
if (typecard == '111') { if (typecard == 'compile') {
setDelet(values) setDelet(values)
const query = { ...values, vehicleId: records?.[0]?.value || '', type: rewkeys == 'chuzu' ? '出租车' : '危货' } const query = { ...values, vehicleId: records?.[0]?.value || '', type: rewkeys == 'chuzu' ? '出租车' : '危货' }
dispatch(putSpecificVehicle(query)).then((res) => { dispatch(putSpecificVehicle(query)).then((res) => {
@ -189,7 +194,7 @@ const UserModal = (props) => {
} }
} }
if (rewkeys === 'yehu') { if (rewkeys === 'yehu') {
if (typecard == '111') { if (typecard == 'compile') {
setDelet(values) setDelet(values)
const query = { ...values, businessId: records?.[0]?.value, type: rewkeys == 'chuzu' ? '出租车' : '危货' } const query = { ...values, businessId: records?.[0]?.value, type: rewkeys == 'chuzu' ? '出租车' : '危货' }
dispatch(putHouseholds(query)).then((res) => { dispatch(putHouseholds(query)).then((res) => {
@ -205,7 +210,7 @@ const UserModal = (props) => {
return true return true
} }
} if (rewkeys === 'xianlu') { } if (rewkeys === 'xianlu') {
if (typecard == '111') { if (typecard == 'compile') {
setDelet(values) setDelet(values)
const query = { ...values, lineId: records?.[0]?.value || '' } const query = { ...values, lineId: records?.[0]?.value || '' }
dispatch(putCircuit(query)).then((res) => { dispatch(putCircuit(query)).then((res) => {
@ -222,7 +227,7 @@ const UserModal = (props) => {
} }
} }
if (rewkeys === 'cheliang') { if (rewkeys === 'cheliang') {
if (typecard == '111') { if (typecard == 'compile') {
setDelet(values) setDelet(values)
const query = { ...values, carId: records?.[0]?.value || '' } const query = { ...values, carId: records?.[0]?.value || '' }
dispatch(putVehicle(query)).then((res) => { dispatch(putVehicle(query)).then((res) => {
@ -234,6 +239,27 @@ const UserModal = (props) => {
const query = { ...values } const query = { ...values }
dispatch(putVehicle(query)).then((res) => { dispatch(putVehicle(query)).then((res) => {
})
return true
}
}
if (rewkeys == 'zhichao') {
if (typecard == 'compile') {
console.log(typecard)
setDelet(values)
const query = { ...values, overspeedId: records?.[0]?.value || '' }
dispatch(putPurchase(query)).then((res) => {
console.log(res)
})
return true
} else {
setDelet(values)
const query = { ...values }
dispatch(putPurchase(query)).then((res) => {
console.log(res)
}) })
return true return true
} }
@ -243,7 +269,7 @@ const UserModal = (props) => {
}} }}
initialValues={recortd} initialValues={recortd}
> >
{typecard == '111' ? {typecard == 'compile' ?
<ProForm.Group <ProForm.Group
> >
<ProFormText <ProFormText

12
web/client/src/sections/fillion/components/operationalTable.js

@ -108,7 +108,7 @@ const [genre,setGenre]=useState()
return <div><Button type="link" return <div><Button type="link"
onClick={() => { onClick={() => {
hightModal('edit', record) hightModal('edit', record)
setTypecard('111') setTypecard('compile')
setRecortd(record) setRecortd(record)
}} }}
>编辑</Button></div> >编辑</Button></div>
@ -161,7 +161,7 @@ const [genre,setGenre]=useState()
return <div><Button type="link" return <div><Button type="link"
onClick={() => { onClick={() => {
hightModal('edit', record) hightModal('edit', record)
setTypecard('111') setTypecard('compile')
setRecortd(record) setRecortd(record)
}} }}
>编辑</Button></div> >编辑</Button></div>
@ -749,7 +749,7 @@ const [genre,setGenre]=useState()
return <div><Button type="link" return <div><Button type="link"
onClick={() => { onClick={() => {
openModal('edit', record) openModal('edit', record)
setTypecard('111') setTypecard('compile')
setRecortd(record) setRecortd(record)
}} }}
>编辑</Button> <Popconfirm title='' onConfirm={() => { deldata(record.id) }}> >编辑</Button> <Popconfirm title='' onConfirm={() => { deldata(record.id) }}>
@ -1382,7 +1382,7 @@ const [genre,setGenre]=useState()
return <div><Button type="link" return <div><Button type="link"
onClick={() => { onClick={() => {
openModal('edit', record) openModal('edit', record)
setTypecard('111') setTypecard('compile')
setRecortd(record) setRecortd(record)
}} }}
>编辑</Button> <Popconfirm title='' onConfirm={() => { deldata(record.id) }}> >编辑</Button> <Popconfirm title='' onConfirm={() => { deldata(record.id) }}>
@ -1851,7 +1851,9 @@ const [genre,setGenre]=useState()
render: (dom, record) => { render: (dom, record) => {
return <div><Button type="link" return <div><Button type="link"
onClick={() => { onClick={() => {
// dispatch(push(`article/update/post`)); openModal('edit', record)
setTypecard('compile')
setRecortd(record)
}} }}
>编辑</Button><Popconfirm title='' onConfirm={() => { deldatas(record.id) }}> >编辑</Button><Popconfirm title='' onConfirm={() => { deldatas(record.id) }}>
<Button type="link">删除</Button> <Button type="link">删除</Button>

Loading…
Cancel
Save