diff --git a/web/client/src/sections/auth/containers/login.js b/web/client/src/sections/auth/containers/login.js index f8a6685f..5bb5ca5e 100644 --- a/web/client/src/sections/auth/containers/login.js +++ b/web/client/src/sections/auth/containers/login.js @@ -50,7 +50,7 @@ const Login = props => { return } setInputChanged(false) - dispatch(login("12345678912564589", "123456789")) + dispatch(login(username, password)) } @@ -60,34 +60,36 @@ const Login = props => {

南昌县智慧交通监管系统

-
- -
用户名
- { - setUserName(e.target.value) - setInputChanged(true) - }} - /> -
-
密码
- - + +
用户名
+ { + console.log('e.target.value', e.target.value) + setUserName(e.target.value) + setInputChanged(true) + }} + /> +
+
密码
+ + { - setPassword(e.target.value) - setInputChanged(true) - }} - /> - - + onChange={e => { + console.log('setPassword', e.target.value) + setPassword(e.target.value) + setInputChanged(true) + }} + /> +
+
diff --git a/web/client/src/sections/fillion/actions/task.js b/web/client/src/sections/fillion/actions/task.js new file mode 100644 index 00000000..e32fbf5b --- /dev/null +++ b/web/client/src/sections/fillion/actions/task.js @@ -0,0 +1,35 @@ +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' + +export function getTask(query) { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + query: query, + actionType: 'GET_TASK', + url: ApiTable.getTask, + msg: { error: '获取任务信息' }, + reducer: { name: 'task' } + }); +} + +export function delTask(query) { + return dispatch => basicAction({ + type: 'del', + dispatch: dispatch, + actionType: 'DEL_TASK', + url: ApiTable.delTask.replace("{taskId}", query?.id), + msg: { option: '删除任务信息' }, + }); +} + +export function editTask(query) { + return dispatch => basicAction({ + type: 'put', + dispatch: dispatch, + data: query, + actionType: 'GET_TASK', + url: ApiTable.editTask, + msg: { error: '编辑或新增任务信息' }, + }); +} \ No newline at end of file diff --git a/web/client/src/sections/fillion/components/task/addTaskModal.js b/web/client/src/sections/fillion/components/task/addTaskModal.js new file mode 100644 index 00000000..60e4495d --- /dev/null +++ b/web/client/src/sections/fillion/components/task/addTaskModal.js @@ -0,0 +1,152 @@ +import React, { useState, useEffect, useRef } from 'react'; +import { Modal, Form, Input, Select, Button } from 'antd'; +import { connect } from 'react-redux'; +import { getRoadway } from '../../actions/infor' +import { getUserList } from '../../actions/patrol'; +import { editTask } from '../../actions/task'; + +const AddModal = (props) => { + const { dispatch, recordRow, visible, onClose, user, lookVal } = props + const { TextArea } = Input + const [form] = Form.useForm() + const [inputVal, setIputVal] = useState(undefined) + const [selectVal, setSelectVal] = useState('') + const [roadRes, setRoadRes] = useState([])//路线列表 + const [userList, setUserList] = useState([])//用户列表 + useEffect(async () => { + const res = await dispatch(getUserList()) + setUserList(res?.payload.data) + }, [true]) + + const onChange = () => { + form.resetFields(['code'])//清空具体某个表单的值 + } + useEffect(() => { + form.setFieldsValue(recordRow ? { 'name': recordRow?.road.routeName, 'code': recordRow?.road.routeCode, 'danger': recordRow?.dangerDescription, 'user': recordRow?.user.name } : {}) + }, [recordRow]) + useEffect(async () => { + const res = await dispatch(getRoadway({})) + setRoadRes(res?.payload.data) + }, []) + //新增和修改 + const handleSaveUpdate = () => { + form.validateFields().then((values) => { + console.log('VALUES', values) + const val = { + routeCode: values.code, + dangerDescription: values.danger, + name: values.user, + id: recordRow?.id + } + dispatch(editTask(val)).then(res => { + if (res.success) { + onClose() + form.resetFields() + } + }) + }) + } + + return ( + { + onClose() + form.resetFields()//清空所有个表单的值 + setSelectVal('')//置空路线代码的选择 + }} + onOk={ + handleSaveUpdate + } + okButtonProps={{ + disabled: lookVal ? true : false, + }} + cancelButtonProps={{ + disabled: lookVal ? true : false, + }} + > +
+ + + {selectVal} + + + +