|
@ -10,47 +10,64 @@ import IssueHandleModal from '../components/isuue-handle-mdal' |
|
|
import '../style.less' |
|
|
import '../style.less' |
|
|
|
|
|
|
|
|
const { Panel } = Collapse; |
|
|
const { Panel } = Collapse; |
|
|
|
|
|
const ISSUEHANDLE_STATE = [1, 2, 3, 4, 5, 6, 7] |
|
|
|
|
|
const STATE_TEXT = { 1: '待制定计划', 2: '待审核', 3: '计划驳回', 4: '待维修', 5: '待验收', 6: '验收通过', 7: '验收不通过', } |
|
|
|
|
|
|
|
|
const PatrolRecord = (props) => { |
|
|
const PatrolRecord = (props) => { |
|
|
const { dispatch, actions, user } = props |
|
|
const { dispatch, actions, user } = props |
|
|
const { patrolManage } = actions |
|
|
const { patrolManage, issueHandle } = actions |
|
|
const [tableList, settableList] = useState([]) |
|
|
const [tableList, settableList] = useState([]) |
|
|
const [showDetailModal, setShowDetail] = useState(false) |
|
|
const [name, setName] = useState(''); |
|
|
const [modelData, setModelData] = useState({}) |
|
|
const [curState, setCurState] = useState('null'); |
|
|
const [query, setQuery] = useState({ limit: 10, page: 0 }) |
|
|
|
|
|
const [limits, setLimits] = 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' }) |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
record(search) |
|
|
queryData() |
|
|
}, []) |
|
|
}, []) |
|
|
|
|
|
|
|
|
const record = (params) => { |
|
|
const queryData = () => { |
|
|
dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)).then(res => { |
|
|
dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)).then(res => { |
|
|
if (res.success) { |
|
|
if (res.success) { |
|
|
settableList(params.name != null ? res.payload.data?.filter(v => |
|
|
settableList(name != null ? res.payload.data?.filter(v => |
|
|
(v.points.user.name.indexOf(params.name) != -1 || v.points.project.name.indexOf(params.name) != -1)) |
|
|
(v.points.user.name.indexOf(name) != -1 || v.points.project.name.indexOf(name) != -1)) |
|
|
.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 }))) |
|
|
setLimits(res.payload.data?.length) |
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
const onFinish = async (values, editData) => { |
|
|
const onFinish = () => { |
|
|
const dataToSave = { ...values }; |
|
|
|
|
|
if (editData?.patrolRecordIssueHandles?.length > 0) { |
|
|
} |
|
|
let msg = ''; |
|
|
|
|
|
if (editData?.patrolRecordIssueHandles[0]?.state == 3) { |
|
|
|
|
|
dataToSave.state = 2; |
|
|
|
|
|
msg = '维修计划修改'; |
|
|
|
|
|
} |
|
|
|
|
|
return dispatch( |
|
|
|
|
|
issueHandle.modifyPatrolRecordIssueHandle(editData?.patrolRecordIssueHandles[0]?.id, dataToSave, |
|
|
|
|
|
values?.msg || msg), |
|
|
|
|
|
).then(() => { |
|
|
|
|
|
queryData(); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
let state = ISSUEHANDLE_STATE[1]; |
|
|
|
|
|
|
|
|
|
|
|
return dispatch(issueHandle.addPatrolRecordIssueHandle({ |
|
|
|
|
|
...dataToSave, |
|
|
|
|
|
state, |
|
|
|
|
|
patrolRecordId: editData?.id, |
|
|
|
|
|
creator: user, |
|
|
|
|
|
createTime: moment() |
|
|
|
|
|
})).then(() => { |
|
|
|
|
|
queryData(); |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const renderOptionText = (currentState) => { |
|
|
const renderOptionText = (currentState) => { |
|
|
let text = '查看' |
|
|
let text = '查看' |
|
|
if (user?.departmentId == -1) { |
|
|
|
|
|
if (currentState == 1) text = '整改' |
|
|
|
|
|
} else { |
|
|
|
|
|
if (currentState == 2) text = '审批' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return text |
|
|
return STATE_TEXT[currentState] || text |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const columns = [ |
|
|
const columns = [ |
|
@ -117,134 +134,79 @@ const PatrolRecord = (props) => { |
|
|
showInDetail: true, |
|
|
showInDetail: true, |
|
|
render: (text, record, index) => { |
|
|
render: (text, record, index) => { |
|
|
return !record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0 ? '待制定计划' : |
|
|
return !record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0 ? '待制定计划' : |
|
|
record?.patrolRecordIssueHandles[0]?.state |
|
|
renderOptionText(record?.patrolRecordIssueHandles[0]?.state) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
// title: '巡检计划',
|
|
|
|
|
|
// dataIndex: 'name',
|
|
|
|
|
|
// key: 'name',
|
|
|
|
|
|
// width: '10%',
|
|
|
|
|
|
// showInDetail: true,
|
|
|
|
|
|
// render: (text, record, index) => {
|
|
|
|
|
|
// return !record.patrolPlan ? '' : <div>{record.patrolPlan.name}</div>
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }, {
|
|
|
|
|
|
// title: '巡检点位',
|
|
|
|
|
|
// dataIndex: 'type',
|
|
|
|
|
|
// key: 'type',
|
|
|
|
|
|
// showInDetail: true,
|
|
|
|
|
|
// width: '10%',
|
|
|
|
|
|
// render: (text, record, index) => {
|
|
|
|
|
|
// return !record.points?.user ? '' : <div>{record.points.itemData.name}</div>
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }, {
|
|
|
|
|
|
// title: '巡检人',
|
|
|
|
|
|
// dataIndex: 'type',
|
|
|
|
|
|
// key: 'type',
|
|
|
|
|
|
// showInDetail: true,
|
|
|
|
|
|
// width: '10%',
|
|
|
|
|
|
// render: (text, record, index) => {
|
|
|
|
|
|
// return !record.points?.user ? '' : <div>{record.points.user.name}</div>
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }, {
|
|
|
|
|
|
// title: '巡检单位',
|
|
|
|
|
|
// dataIndex: 'type',
|
|
|
|
|
|
// showInDetail: true,
|
|
|
|
|
|
// key: 'type',
|
|
|
|
|
|
// width: '10%',
|
|
|
|
|
|
// render: (text, record, index) => {
|
|
|
|
|
|
// return !record.points?.user ? '' : <div>{record.points.user.department.name}</div>
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }, {
|
|
|
|
|
|
// title: '巡检频次',
|
|
|
|
|
|
// dataIndex: 'describe',
|
|
|
|
|
|
// key: 'describe',
|
|
|
|
|
|
// showInDetail: true,
|
|
|
|
|
|
// width: '10%',
|
|
|
|
|
|
// render: (text, record, index) => {
|
|
|
|
|
|
// return !record.points ? '' : <div>{record.points.frequency}</div>
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }, {
|
|
|
|
|
|
// title: '上次巡检日期',
|
|
|
|
|
|
// dataIndex: 'describe',
|
|
|
|
|
|
// showInDetail: true,
|
|
|
|
|
|
// key: 'describe',
|
|
|
|
|
|
// render: (text, record, index) => record.lastInspectionTime ? moment(record.lastInspectionTime).format('YYYY-MM-DD HH:mm:ss') : '--'
|
|
|
|
|
|
// }, {
|
|
|
|
|
|
// title: '本次巡检日期',
|
|
|
|
|
|
// dataIndex: 'describe',
|
|
|
|
|
|
// key: 'describe',
|
|
|
|
|
|
// showInDetail: true,
|
|
|
|
|
|
// render: (text, record, index) => moment(record.inspectionTime).format('YYYY-MM-DD HH:mm:ss') || '--'
|
|
|
|
|
|
// }, {
|
|
|
|
|
|
// title: '巡检结果',
|
|
|
|
|
|
// dataIndex: 'describe',
|
|
|
|
|
|
// key: 'describe',
|
|
|
|
|
|
// render: (text, record, index) => !record.alarm ? '正常' : '异常'
|
|
|
|
|
|
// },
|
|
|
|
|
|
{ |
|
|
{ |
|
|
title: '操作', |
|
|
title: '操作', |
|
|
dataIndex: 'operation', |
|
|
dataIndex: 'operation', |
|
|
key: 'operation', |
|
|
key: 'operation', |
|
|
render: (text, record, index) => { |
|
|
render: (text, record, index) => { |
|
|
return ( |
|
|
const options = []; |
|
|
<IssueHandleModal |
|
|
if (!record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0) { |
|
|
|
|
|
options.push(<IssueHandleModal |
|
|
|
|
|
editData={record} |
|
|
|
|
|
readOnly={false} |
|
|
|
|
|
key="edit" |
|
|
|
|
|
title="制定计划" |
|
|
|
|
|
triggerRender={<a style={{ marginRight: 6 }}>{renderOptionText(1)}</a>} |
|
|
|
|
|
user={user} |
|
|
|
|
|
onFinish={onFinish} />) |
|
|
|
|
|
} |
|
|
|
|
|
if (record?.patrolRecordIssueHandles[0]?.state == 2) { |
|
|
|
|
|
options.push(<IssueHandleModal |
|
|
editData={record} |
|
|
editData={record} |
|
|
readOnly={true} |
|
|
readOnly={true} |
|
|
key="edit" |
|
|
key="edit" |
|
|
title="置顶计划" |
|
|
title="审核" |
|
|
triggerRender={<a>{renderOptionText(1)}</a>} |
|
|
triggerRender={<a style={{ marginRight: 6 }}>{renderOptionText(2)}</a>} |
|
|
user={{}} |
|
|
user={user} |
|
|
onFinish={onFinish} /> |
|
|
onFinish={onFinish} />) |
|
|
) |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (record?.patrolRecordIssueHandles[0]?.state == 3) { |
|
|
|
|
|
options.push(<IssueHandleModal |
|
|
|
|
|
editData={record} |
|
|
|
|
|
readOnly={false} |
|
|
|
|
|
key="edit" |
|
|
|
|
|
title="修改计划" |
|
|
|
|
|
triggerRender={<a style={{ marginRight: 6 }}>修改计划</a>} |
|
|
|
|
|
user={user} |
|
|
|
|
|
onFinish={onFinish} />) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
options.push(<IssueHandleModal |
|
|
|
|
|
editData={record} |
|
|
|
|
|
readOnly={true} |
|
|
|
|
|
key="edit" |
|
|
|
|
|
title="查看详情" |
|
|
|
|
|
triggerRender={<a>查看详情</a>} |
|
|
|
|
|
user={user} |
|
|
|
|
|
onFinish={onFinish} />) |
|
|
|
|
|
|
|
|
|
|
|
return options; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<div id='patrol-record'> |
|
|
<div id='patrol-record'> |
|
|
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 10px' }}> |
|
|
<div style={{ marginBottom: 20 }}> |
|
|
<Form |
|
|
<Input style={{ width: 240, marginRight: 20 }} |
|
|
style={{ display: 'flex', }} |
|
|
value={name} onChange={e => { setName(e.target.value) }} |
|
|
onFinish={r => { |
|
|
placeholder="请输入结构物名称或上报人" allowClear /> |
|
|
record({ |
|
|
<Select style={{ width: 140, marginRight: 20 }} allowClear |
|
|
name: r.name, |
|
|
options={[ |
|
|
}) |
|
|
{ value: 'null', label: '全部' }, |
|
|
}} |
|
|
{ value: 1, label: '待制定计划' }, |
|
|
> |
|
|
{ value: 2, label: '待审核' }, |
|
|
<Form.Item |
|
|
{ value: 3, label: '计划驳回' }, |
|
|
name="name" |
|
|
{ value: 4, label: '待维修' }, |
|
|
style={{ marginRight: 16, minWidth: 250 }} |
|
|
{ value: 5, label: '待验收' }, |
|
|
> |
|
|
{ value: 6, label: '验收通过' }, |
|
|
<Input placeholder="请输入结构物名称或上报人" allowClear /> |
|
|
{ value: 7, label: '验收不通过' }, |
|
|
</Form.Item> |
|
|
]} /> |
|
|
|
|
|
<Button type='primary' onClick={() => { queryData() }}>搜索</Button> |
|
|
<Form.Item |
|
|
|
|
|
name="state" |
|
|
|
|
|
style={{ marginRight: 16, width: 130 }} |
|
|
|
|
|
initialValue={'null'} |
|
|
|
|
|
> |
|
|
|
|
|
<Select allowClear |
|
|
|
|
|
options={[ |
|
|
|
|
|
{ value: 'null', label: '全部' }, |
|
|
|
|
|
{ value: 1, label: '待制定计划' }, |
|
|
|
|
|
{ value: 2, label: '待审核' }, |
|
|
|
|
|
{ value: 3, label: '计划驳回' }, |
|
|
|
|
|
{ value: 4, label: '待维修' }, |
|
|
|
|
|
{ value: 5, label: '待验收' }, |
|
|
|
|
|
{ value: 6, label: '验收通过' }, |
|
|
|
|
|
{ value: 7, label: '验收不通过' }, |
|
|
|
|
|
]} /> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<Form.Item wrapperCol={{}}> |
|
|
|
|
|
<Button type="primary" htmlType="submit"> |
|
|
|
|
|
搜索 |
|
|
|
|
|
</Button> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
</Form> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
<Table |
|
|
<Table |
|
|
columns={columns} |
|
|
columns={columns} |
|
|