24 changed files with 1540 additions and 1017 deletions
			
			
		| @ -0,0 +1,14 @@ | |||||
|  | alter table maintenance_plan | ||||
|  | 	add record_id integer[]; | ||||
|  | 
 | ||||
|  | comment on column maintenance_plan.record_id is '响应记录id'; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | alter table maintenance_record | ||||
|  | 	add files jsonb; | ||||
|  | 
 | ||||
|  | comment on column maintenance_record.files is '文件'; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | 
 | ||||
| @ -0,0 +1,87 @@ | |||||
|  | import React, { useState, useEffect, useRef } from 'react' | ||||
|  | import { connect } from 'react-redux'; | ||||
|  | import moment from 'moment' | ||||
|  | import { Button, Table, Modal, Form } from '@douyinfe/semi-ui'; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | const PlanAddmodal = (props) => { | ||||
|  |    const { visible, onClose, recordRow, actions, dispatch } = props | ||||
|  |    const { service, install } = actions | ||||
|  |    const [pepList, setPepList] = useState([])//角色分配 | ||||
|  | 
 | ||||
|  |    const api = useRef(); | ||||
|  |    const [selectValue, setSelectValue] = useState([]) | ||||
|  | 
 | ||||
|  |    useEffect(() => { | ||||
|  |       dispatch(install.getOrganizationDeps()).then((res) => {//获取项企(PEP)全部部门及其下用户 | ||||
|  |          setPepList(res.payload.data) | ||||
|  |       }) | ||||
|  |    }, []) | ||||
|  |    //编辑和新增的逻辑 | ||||
|  |    const okHandler = () => { | ||||
|  |       api.current.validate().then((res) => { | ||||
|  |          const query = { | ||||
|  |             actualFinishTime: res.realityTime, | ||||
|  |             planFinishTime: res.planTime, | ||||
|  |             remark: res.notes, | ||||
|  |             state: res.status, | ||||
|  |             type: 'period', | ||||
|  |             missionName: res.taskName, | ||||
|  |             manger: res.manger, | ||||
|  |             recordId: [recordRow.id], | ||||
|  |             msg: '添加周期性计划' | ||||
|  |          } | ||||
|  |          dispatch(service.editMaintenancePlan(query)).then((res) => { | ||||
|  |             if (res.success) onClose(); api.current.reset() | ||||
|  | 
 | ||||
|  | 
 | ||||
|  |          }) | ||||
|  | 
 | ||||
|  |       }) | ||||
|  |    } | ||||
|  |    return (<div> | ||||
|  |       <Modal visible={visible} onCancel={() => { onClose() }} title={'添加周期性计划'} | ||||
|  |          onOk={okHandler} | ||||
|  | 
 | ||||
|  |       > | ||||
|  |          <Form | ||||
|  |             getFormApi={formApi => api.current = formApi} | ||||
|  |             labelCol={{ span: 6 }} | ||||
|  |             labelPosition='left' | ||||
|  |          > | ||||
|  |             <Form.Input field='taskName' label='任务名称:' maxLength={30} rules={[ | ||||
|  |                { required: true, message: '请输入任务名称' }, | ||||
|  |             ]} ></Form.Input> | ||||
|  |             <Form.Select field='manger' label='责任人' rules={[{ required: true, message: '请输入责任人' }]} trigger='blur' style={{ width: '100%' }} | ||||
|  |                multiple filter> | ||||
|  |                {pepList?.map((item) => { | ||||
|  |                   return (<Form.Select.OptGroup label={item.name}> | ||||
|  |                      {item.users.map((item1) => { | ||||
|  |                         return <Form.Select.Option value={item1.id} label={item1.name}></Form.Select.Option> | ||||
|  |                      })} | ||||
|  |                   </Form.Select.OptGroup>) | ||||
|  |                })} | ||||
|  |             </Form.Select> | ||||
|  |             <Form.Select label='完成情况' style={{ width: 200 }} field='status'> | ||||
|  |                <Form.Select.Option value='未完成'>未完成</Form.Select.Option> | ||||
|  |                <Form.Select.Option value='进行中'>进行中</Form.Select.Option> | ||||
|  |                <Form.Select.Option value='已完成'>已完成</Form.Select.Option> | ||||
|  |                <Form.Select.Option value='挂起'>挂起</Form.Select.Option> | ||||
|  |             </Form.Select> | ||||
|  |             <Form.TextArea label='备注' field='notes' placeholder='故障发生原因及解决方案'></Form.TextArea> | ||||
|  |             <Form.DatePicker label='计划完成时间:' field='planTime' rules={[{ required: true, message: '请选择计划完成时间' },]}></Form.DatePicker> | ||||
|  |             <Form.DatePicker label='实际完成时间:' field='realityTime'></Form.DatePicker> | ||||
|  |          </Form> | ||||
|  |       </Modal> | ||||
|  | 
 | ||||
|  |    </div>) | ||||
|  | } | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | function mapStateToProps (state) { | ||||
|  |    const { global } = state; | ||||
|  |    return { | ||||
|  |       actions: global.actions, | ||||
|  |    }; | ||||
|  | } | ||||
|  | export default connect(mapStateToProps)(PlanAddmodal) | ||||
					Loading…
					
					
				
		Reference in new issue