Browse Source

问题处理功能完善

master
peng.peng 2 years ago
parent
commit
355aa4797e
  1. 2
      script/1.0.3/schema/8.create_patrol_record_issue_handle.sql
  2. 91
      web/client/src/sections/issueHandle/components/isuue-handle-mdal.js
  3. 57
      web/client/src/sections/issueHandle/containers/patrolRecord.js
  4. 8
      web/client/src/sections/issueHandle/nav-item.js
  5. 2
      web/client/src/sections/issueHandle/routes.js

2
script/1.0.3/schema/8.create_patrol_record_issue_handle.sql

@ -18,7 +18,7 @@ create table patrol_record_issue_handle
repair_desc varchar(255), repair_desc varchar(255),
repair_image jsonb, repair_image jsonb,
creator jsonb, creator jsonb,
create_time timestamp(6) with time zone, create_time timestamp(6) with time zone
); );
comment on column patrol_record_issue_handle.patrol_record_id is '巡检记录id'; comment on column patrol_record_issue_handle.patrol_record_id is '巡检记录id';

91
web/client/src/sections/issueHandle/components/isuue-handle-mdal.js

@ -20,32 +20,23 @@ export default (props) => {
const initialValues = editData ? { const initialValues = editData ? {
...editData, ...editData,
...editData?.patrolRecordIssueHandles[0], ...editData?.patrolRecordIssueHandles[0],
approvePerson: editData?.patrolRecordIssueHandles[0]?.approvePerson?.name || '',
approveDate: editData?.patrolRecordIssueHandles[0]?.approveDate ? moment(editData?.patrolRecordIssueHandles[0]?.approveDate).format('YYYY-MM-DD HH:mm:ss') : ""
} : {}; } : {};
if (editData?.patrolRecordIssueHandles?.length > 0) { if (editData?.patrolRecordIssueHandles?.length > 0) {
initialValues.dateRange = [editData?.patrolRecordIssueHandles[0]?.startTime, editData?.patrolRecordIssueHandles[0]?.endTime] initialValues.dateRange = [editData?.patrolRecordIssueHandles[0]?.startTime, editData?.patrolRecordIssueHandles[0]?.endTime]
} }
const [reason, setReason] = useState('') const [approve, setApprove] = useState('')
const approve = async (approve) => {
formRef.current.validateFields().then(async (values) => {
onFinish && await onFinish({
msg: approve ? '计划同意' : '计划驳回',
state: approve ? 4 : 3,
approveOpinion: values?.approveOpinion,
approvePerson: user,
approveDate: moment()
}, editData)
return true;
})
.catch((errors) => {
if (errors) {
}
});
const approveHandle = async (values) => {
onFinish && await onFinish({
msg: approve ? '计划同意' : '计划驳回',
state: approve ? 4 : 3,
approveOpinion: values?.approveOpinion,
approvePerson: user,
approveDate: moment()
}, editData)
return true;
} }
const renderPlanInfo = () => { const renderPlanInfo = () => {
@ -84,7 +75,7 @@ export default (props) => {
<Col span={18}> <Col span={18}>
{ {
Object.keys(editData?.points?.inspectContent).map(key => { editData?.points?.inspectContent && Object.keys(editData?.points?.inspectContent).map(key => {
if (editData?.points?.inspectContent[key]?.isNormal == false) { if (editData?.points?.inspectContent[key]?.isNormal == false) {
return <Row style={{ marginBottom: 15 }}> return <Row style={{ marginBottom: 15 }}>
<Col span={12}> <Col span={12}>
@ -144,28 +135,38 @@ export default (props) => {
{title || ''} {title || ''}
</Button> </Button>
} }
width={1200} width={1300}
layout="horizontal" layout="horizontal"
// grid={true} // grid={true}
{...formItemLayout} {...formItemLayout}
modalProps={{ modalProps={{
destroyOnClose: true, destroyOnClose: true,
// onCancel: () => { }, // onCancel: () => { },
bodyStyle: { height: 720, overflowY: 'auto' } bodyStyle: { height: 620, overflowY: 'auto' }
}} }}
onFinish={async (values) => { onFinish={async (values) => {
values.startTime = values?.dateRange[0]; if (editData?.patrolRecordIssueHandles[0]?.state === 2) {
values.endTime = values?.dateRange[1]; approveHandle(values)
onFinish && await onFinish(values, editData) } else {
//message.success('提交成功'); values.startTime = values?.dateRange[0];
return true; values.endTime = values?.dateRange[1];
onFinish && await onFinish(values, editData)
//message.success('提交成功');
return true;
}
}} }}
submitter={editData?.patrolRecordIssueHandles[0]?.state === 2 ? { submitter={editData?.patrolRecordIssueHandles[0]?.state === 2 && title != '修改计划' ? {
render: (props, defaultDoms) => { render: (props, defaultDoms) => {
return [ return [
<Button onClick={() => { approve(1); }} type='primary'>确定</Button>, <Button onClick={() => {
<Button onClick={() => { approve(0); }}>驳回</Button> setApprove(1)
props.submit();
}} type='primary'>确定</Button>,
<Button onClick={() => {
setApprove(0)
props.submit();
}}>驳回</Button>
]; ];
} }
} : !readOnly} } : !readOnly}
@ -174,7 +175,7 @@ export default (props) => {
{/*问题记录信息*/} {/*问题记录信息*/}
{renderPlanInfo()} {renderPlanInfo()}
{/*维修处理计划表单*/} {/*问题处理计划表单*/}
{ {
((editData?.patrolRecordIssueHandles?.length == 0 && !readOnly) || editData?.patrolRecordIssueHandles?.length > 0) && ((editData?.patrolRecordIssueHandles?.length == 0 && !readOnly) || editData?.patrolRecordIssueHandles?.length > 0) &&
<> <>
@ -204,7 +205,7 @@ export default (props) => {
{ {
whitespace: true, message: '请勿输入空格' whitespace: true, message: '请勿输入空格'
}]} }]}
placeholder="请输入维修单位" placeholder=""
/> />
</Col> </Col>
@ -240,15 +241,26 @@ export default (props) => {
{ {
whitespace: true, message: '请勿输入空格' whitespace: true, message: '请勿输入空格'
}]} }]}
placeholder="请输入维修要求" placeholder=""
/></Col> /></Col>
<Col span={12}></Col> {editData?.patrolRecordIssueHandles[0]?.state && editData?.patrolRecordIssueHandles[0]?.state > 3 && <Col span={12}>
<ProFormText
name="approvePerson"
label="制定人:"
disabled={true}
/>
<ProFormText
name="approveDate"
label="制定时间:"
disabled={true}
/>
</Col>}
</Row> </Row>
</> </>
} }
{ {
editData?.patrolRecordIssueHandles[0]?.state === 2 && ((editData?.patrolRecordIssueHandles[0]?.state !== 1 || editData?.patrolRecordIssueHandles[0]?.state !== 3) && title != '修改计划' && editData?.patrolRecordIssueHandles?.length > 0) &&
<> <>
<div className="item-title">{"维修计划审批"}</div> <div className="item-title">{"维修计划审批"}</div>
<div> <div>
@ -257,7 +269,7 @@ export default (props) => {
wrapperCol={{ span: 16 }} wrapperCol={{ span: 16 }}
name="approveOpinion" name="approveOpinion"
label="审批意见:" label="审批意见:"
disabled={editData?.patrolRecordIssueHandles[0]?.state !== 2} disabled={title != '审核'}
rules={[ rules={[
{ required: true, message: '请输入审批意见' }, { required: true, message: '请输入审批意见' },
{ {
@ -272,9 +284,6 @@ export default (props) => {
</> </>
} }
</div> </div>
</ ModalForm> </ ModalForm>
); );
}; };

57
web/client/src/sections/issueHandle/containers/patrolRecord.js

@ -8,7 +8,7 @@ import moment from "moment";
import Uploads from '$components/Uploads'; import Uploads from '$components/Uploads';
import IssueHandleModal from '../components/isuue-handle-mdal' import IssueHandleModal from '../components/isuue-handle-mdal'
import '../style.less' import '../style.less'
import { Func } from '$utils';
const { Panel } = Collapse; const { Panel } = Collapse;
const ISSUEHANDLE_STATE = [1, 2, 3, 4, 5, 6, 7] const ISSUEHANDLE_STATE = [1, 2, 3, 4, 5, 6, 7]
const STATE_TEXT = { 1: '待制定计划', 2: '待审核', 3: '计划驳回', 4: '待维修', 5: '待验收', 6: '验收通过', 7: '验收不通过', } const STATE_TEXT = { 1: '待制定计划', 2: '待审核', 3: '计划驳回', 4: '待维修', 5: '待验收', 6: '验收通过', 7: '验收不通过', }
@ -18,7 +18,7 @@ const PatrolRecord = (props) => {
const { patrolManage, issueHandle } = actions const { patrolManage, issueHandle } = actions
const [tableList, settableList] = useState([]) const [tableList, settableList] = useState([])
const [name, setName] = useState(''); const [name, setName] = useState('');
const [curState, setCurState] = useState('null'); const [curState, setCurState] = useState('全部');
const format = 'YYYY-MM-DD HH:mm:ss' const format = 'YYYY-MM-DD HH:mm:ss'
const times = [moment().subtract(70, 'years').format(format), moment().format(format)] const times = [moment().subtract(70, 'years').format(format), moment().format(format)]
const [search, setSearch] = useState({ name: null, time: [times[0], times[1]], state: 'null' }) const [search, setSearch] = useState({ name: null, time: [times[0], times[1]], state: 'null' })
@ -32,6 +32,7 @@ const PatrolRecord = (props) => {
if (res.success) { if (res.success) {
settableList(name != null ? res.payload.data?.filter(v => settableList(name != null ? res.payload.data?.filter(v =>
(v.points.user.name.indexOf(name) != -1 || v.points.project.name.indexOf(name) != -1)) (v.points.user.name.indexOf(name) != -1 || v.points.project.name.indexOf(name) != -1))
.filter(x => curState == '全部' || curState == renderOptionText(x?.patrolRecordIssueHandles[0]?.state))
.map(v => ({ ...v, key: v.id })) : res.payload.data?.map(v => ({ ...v, key: v.id }))) .map(v => ({ ...v, key: v.id })) : res.payload.data?.map(v => ({ ...v, key: v.id })))
} }
}) })
@ -65,7 +66,7 @@ const PatrolRecord = (props) => {
}; };
const renderOptionText = (currentState) => { const renderOptionText = (currentState) => {
let text = '查看' let text = '待制定计划'
return STATE_TEXT[currentState] || text return STATE_TEXT[currentState] || text
} }
@ -119,11 +120,11 @@ const PatrolRecord = (props) => {
render: (text, record, index) => { render: (text, record, index) => {
const LEVELS_ = ['严重', '中度', '轻微']; const LEVELS_ = ['严重', '中度', '轻微'];
const recordLevels = [] const recordLevels = []
Object.keys(record?.points?.inspectContent).map(key => { record?.points?.inspectContent ? Object.keys(record?.points?.inspectContent).map(key => {
recordLevels.push(record?.points?.inspectContent[key]?.level) recordLevels.push(record?.points?.inspectContent[key]?.level)
}) }) : ''
const level = LEVELS_.find(s => recordLevels.find(x => x == s)) const level = LEVELS_.find(s => recordLevels.find(x => x == s))
return level; return level || '-';
} }
}, },
{ {
@ -143,39 +144,41 @@ const PatrolRecord = (props) => {
key: 'operation', key: 'operation',
render: (text, record, index) => { render: (text, record, index) => {
const options = []; const options = [];
if (!record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0) { if (Func.isAuthorized('ZHIDINGJIHUA') && (!record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0)) {
options.push(<IssueHandleModal options.push(<IssueHandleModal
editData={record} editData={record}
readOnly={false} readOnly={false}
key="edit" key="edit"
title="制定计划" title="制定计划"
triggerRender={<a style={{ marginRight: 6 }}>{renderOptionText(1)}</a>} triggerRender={<a style={{ marginRight: 8 }}>制定计划</a>}
user={user} user={user}
onFinish={onFinish} />) onFinish={onFinish} />)
} }
if (record?.patrolRecordIssueHandles[0]?.state == 2) {
if (Func.isAuthorized('XIUGAIJIUHA') && (record?.patrolRecordIssueHandles[0]?.state == 3 || record?.patrolRecordIssueHandles[0]?.state == 2)) {
options.push(<IssueHandleModal options.push(<IssueHandleModal
editData={record} editData={record}
readOnly={true} readOnly={false}
key="edit" key="edit"
title="审核" title="修改计划"
triggerRender={<a style={{ marginRight: 6 }}>{renderOptionText(2)}</a>} triggerRender={<a style={{ marginRight: 8 }}>修改计划</a>}
user={user} user={user}
onFinish={onFinish} />) onFinish={onFinish} />)
} }
if (record?.patrolRecordIssueHandles[0]?.state == 3) { if (Func.isAuthorized('SHENHE') && record?.patrolRecordIssueHandles[0]?.state == 2) {
options.push(<IssueHandleModal options.push(<IssueHandleModal
editData={record} editData={record}
readOnly={false} readOnly={true}
key="edit" key="edit"
title="修改计划" title="审核"
triggerRender={<a style={{ marginRight: 6 }}>修改计划</a>} triggerRender={<a style={{ marginRight: 8 }}>审核</a>}
user={user} user={user}
onFinish={onFinish} />) onFinish={onFinish} />)
} }
options.push(<IssueHandleModal
Func.isAuthorized('CHAKANXIANGQING') && options.push(<IssueHandleModal
editData={record} editData={record}
readOnly={true} readOnly={true}
key="edit" key="edit"
@ -195,17 +198,15 @@ const PatrolRecord = (props) => {
<Input style={{ width: 240, marginRight: 20 }} <Input style={{ width: 240, marginRight: 20 }}
value={name} onChange={e => { setName(e.target.value) }} value={name} onChange={e => { setName(e.target.value) }}
placeholder="请输入结构物名称或上报人" allowClear /> placeholder="请输入结构物名称或上报人" allowClear />
<Select style={{ width: 140, marginRight: 20 }} allowClear <Select
value={curState}
onChange={e => { setCurState(e) }}
style={{ width: 140, marginRight: 20 }}
options={[ options={[
{ value: 'null', label: '全部' }, { value: '全部', label: '全部' },
{ value: 1, label: '待制定计划' }, ].concat(ISSUEHANDLE_STATE.map(s => {
{ value: 2, label: '待审核' }, return { value: renderOptionText(s), label: renderOptionText(s) }
{ value: 3, label: '计划驳回' }, }))} />
{ value: 4, label: '待维修' },
{ value: 5, label: '待验收' },
{ value: 6, label: '验收通过' },
{ value: 7, label: '验收不通过' },
]} />
<Button type='primary' onClick={() => { queryData() }}>搜索</Button> <Button type='primary' onClick={() => { queryData() }}>搜索</Button>
</div> </div>
<Table <Table
@ -217,8 +218,6 @@ const PatrolRecord = (props) => {
}} }}
/> />
</div> </div>
) )
} }

8
web/client/src/sections/issueHandle/nav-item.js

@ -2,7 +2,7 @@ import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Menu } from 'antd'; import { Menu } from 'antd';
import { SettingOutlined } from '@ant-design/icons'; import { SettingOutlined } from '@ant-design/icons';
import { Func } from '$utils';
const SubMenu = Menu.SubMenu; const SubMenu = Menu.SubMenu;
export function getNavItem(user, dispatch) { export function getNavItem(user, dispatch) {
@ -10,8 +10,12 @@ export function getNavItem(user, dispatch) {
// return null // return null
// } // }
return ( return (
(Func.isAuthorized("XIUGAIJIUHA")
|| Func.isAuthorized("SHENHE")
|| Func.isAuthorized("ZHIDINGJIHUA")
|| Func.isAuthorized("CHAKANXIANGQING")) &&
<Menu.Item icon={<SettingOutlined />} key="issueHandle"> <Menu.Item icon={<SettingOutlined />} key="issueHandle">
<Link to="/issueHandle">维修处理</Link> <Link to="/issueHandle">问题处理</Link>
</Menu.Item> </Menu.Item>
); );

2
web/client/src/sections/issueHandle/routes.js

@ -6,7 +6,7 @@ export default [{
route: { route: {
path: '/issueHandle', path: '/issueHandle',
key: 'issueHandle', key: 'issueHandle',
breadcrumb: '维修处理', breadcrumb: '问题处理',
component: PatrolReocrd, component: PatrolReocrd,
} }

Loading…
Cancel
Save