dengyinhuan
2 years ago
21 changed files with 955 additions and 5 deletions
@ -0,0 +1,161 @@ |
|||
/* eslint-disable*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = dc => { |
|||
const DataTypes = dc.ORM; |
|||
const sequelize = dc.orm; |
|||
const PatrolRecordIssueHandle = sequelize.define("patrolRecordIssueHandle", { |
|||
id: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: true, |
|||
field: "id", |
|||
autoIncrement: true, |
|||
unique: "patrol_record_issue_handle_id_uindex" |
|||
}, |
|||
patrolRecordId: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "巡检记录id", |
|||
primaryKey: false, |
|||
field: "patrol_record_id", |
|||
autoIncrement: false |
|||
}, |
|||
repairPerson: { |
|||
type: DataTypes.JSONB, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "维修人", |
|||
primaryKey: false, |
|||
field: "repair_person", |
|||
autoIncrement: false |
|||
}, |
|||
repairUnit: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "维修单位", |
|||
primaryKey: false, |
|||
field: "repair_unit", |
|||
autoIncrement: false |
|||
}, |
|||
startTime: { |
|||
type: DataTypes.DATE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "start_time", |
|||
autoIncrement: false |
|||
}, |
|||
endTime: { |
|||
type: DataTypes.DATE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "end_time", |
|||
autoIncrement: false |
|||
}, |
|||
repairAsk: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "维修要求", |
|||
primaryKey: false, |
|||
field: "repair_ask", |
|||
autoIncrement: false |
|||
}, |
|||
checkPerson: { |
|||
type: DataTypes.JSONB, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "质检验收人", |
|||
primaryKey: false, |
|||
field: "check_person", |
|||
autoIncrement: false |
|||
}, |
|||
state: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "流程状态 \n1 制定计划 待审核\n2 \n3\n4\n5\n6\n7", |
|||
primaryKey: false, |
|||
field: "state", |
|||
autoIncrement: false |
|||
}, |
|||
approvePerson: { |
|||
type: DataTypes.JSONB, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "审批人", |
|||
primaryKey: false, |
|||
field: "approve_person", |
|||
autoIncrement: false |
|||
}, |
|||
approveDate: { |
|||
type: DataTypes.DATE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "审批日期", |
|||
primaryKey: false, |
|||
field: "approve_date", |
|||
autoIncrement: false |
|||
}, |
|||
approveOpinion: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "审批意见", |
|||
primaryKey: false, |
|||
field: "approve_opinion", |
|||
autoIncrement: false |
|||
}, |
|||
repairDesc: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "维修情况描述", |
|||
primaryKey: false, |
|||
field: "repair_desc", |
|||
autoIncrement: false |
|||
}, |
|||
repairImage: { |
|||
type: DataTypes.JSONB, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "repair_image", |
|||
autoIncrement: false |
|||
}, |
|||
creator: { |
|||
type: DataTypes.JSONB, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "审批人", |
|||
primaryKey: false, |
|||
field: "creator", |
|||
autoIncrement: false |
|||
}, |
|||
createTime: { |
|||
type: DataTypes.DATE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "制定日期", |
|||
primaryKey: false, |
|||
field: "create_time", |
|||
autoIncrement: false |
|||
}, |
|||
}, { |
|||
tableName: "patrol_record_issue_handle", |
|||
comment: "", |
|||
indexes: [] |
|||
}); |
|||
dc.models.PatrolRecordIssueHandle = PatrolRecordIssueHandle; |
|||
return PatrolRecordIssueHandle; |
|||
}; |
@ -0,0 +1,60 @@ |
|||
DROP TABLE IF EXISTS "public"."patrol_record_issue_handle"; |
|||
create table patrol_record_issue_handle |
|||
( |
|||
id serial |
|||
constraint patrol_record_issue_handle_pk |
|||
primary key, |
|||
patrol_record_id integer, |
|||
repair_person jsonb, |
|||
repair_unit varchar(255), |
|||
start_time timestamp(6) with time zone, |
|||
end_time timestamp(6) with time zone, |
|||
repair_ask varchar(255), |
|||
check_person jsonb, |
|||
state integer, |
|||
approve_person jsonb, |
|||
approve_date timestamp(6) with time zone, |
|||
approve_opinion varchar(255), |
|||
repair_desc varchar(255), |
|||
repair_image jsonb, |
|||
creator jsonb, |
|||
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.repair_person is '维修人'; |
|||
|
|||
comment on column patrol_record_issue_handle.repair_unit is '维修单位'; |
|||
|
|||
comment on column patrol_record_issue_handle.repair_ask is '维修要求'; |
|||
|
|||
comment on column patrol_record_issue_handle.check_person is '质检验收人'; |
|||
|
|||
comment on column patrol_record_issue_handle.state is '流程状态 |
|||
1 待制定计划 |
|||
2 待审核 |
|||
3 计划驳回 |
|||
4 待维修 |
|||
5 待验收 |
|||
6 验收通过 |
|||
7 验收不通过'; |
|||
|
|||
comment on column patrol_record_issue_handle.approve_person is '审批人'; |
|||
|
|||
comment on column patrol_record_issue_handle.approve_date is '审批日期'; |
|||
|
|||
comment on column patrol_record_issue_handle.approve_opinion is '审批意见'; |
|||
|
|||
comment on column patrol_record_issue_handle.repair_desc is '维修情况描述'; |
|||
|
|||
comment on column patrol_record_issue_handle.creator is '制定人'; |
|||
|
|||
comment on column patrol_record_issue_handle.create_time is '制定日期'; |
|||
|
|||
alter table patrol_record_issue_handle |
|||
owner to "FashionAdmin"; |
|||
|
|||
create unique index patrol_record_issue_handle_id_uindex |
|||
on patrol_record_issue_handle (id); |
|||
|
@ -0,0 +1,11 @@ |
|||
'use strict'; |
|||
|
|||
|
|||
import * as record from './record' |
|||
|
|||
|
|||
export default { |
|||
|
|||
...record, |
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
|
|||
export function addPatrolRecordIssueHandle(params) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'post', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'ADD_PatrolRecordIssueHandle_REPORT', |
|||
url: ApiTable.addPatrolRecordIssueHandle, |
|||
msg: { |
|||
option: '维修计划新增', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function modifyPatrolRecordIssueHandle(id, params, msg) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'put', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'MODIFY_PatrolRecordIssueHandle_REPORT', |
|||
url: ApiTable.modifyPatrolRecordIssueHandle.replace('{id}', id), |
|||
msg: { |
|||
option: msg || '维修计划审批', |
|||
}, |
|||
}); |
|||
} |
|||
|
@ -0,0 +1,280 @@ |
|||
import React, { useState, useRef } from 'react'; |
|||
import { Button, Form, Row, Col, Table, Popconfirm, Input, message } from 'antd'; |
|||
import { |
|||
ModalForm, |
|||
ProFormText, |
|||
ProFormSelect, |
|||
ProFormTextArea, |
|||
ProFormDatePicker, |
|||
ProFormDateRangePicker |
|||
} from '@ant-design/pro-form'; |
|||
import Uploads from '$components/Uploads'; |
|||
import moment from 'moment'; |
|||
const FormItem = Form.Item; |
|||
//state: 1下发未上报 2已上报待审批 3整改完成 上报结果result: status 0 已上报未审批 1 审批通过 2 审批驳回
|
|||
export default (props) => { |
|||
const { title, triggerRender, editData = null, onFinish, readOnly, companyList, user } = props; |
|||
const formItemLayout = { labelCol: { span: 7 }, wrapperCol: { span: 16 } }; |
|||
const formRef = useRef(); |
|||
|
|||
const initialValues = editData ? { |
|||
...editData, |
|||
...editData?.patrolRecordIssueHandles[0], |
|||
|
|||
} : {}; |
|||
if (editData?.patrolRecordIssueHandles?.length > 0) { |
|||
initialValues.dateRange = [editData?.patrolRecordIssueHandles[0]?.startTime, editData?.patrolRecordIssueHandles[0]?.endTime] |
|||
} |
|||
const [reason, setReason] = 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 renderPlanInfo = () => { |
|||
return <> |
|||
{/* <Card title={'巡检信息'}> */} |
|||
<div className="item-title">{"巡检信息"}</div> |
|||
<Form> |
|||
<Row> |
|||
<Col span={12}> |
|||
<Form.Item label="结构物名称:" {...formItemLayout}> |
|||
<Input value={editData?.points?.project?.name} readOnly /> |
|||
</Form.Item> |
|||
<Form.Item label="巡检人:" {...formItemLayout}> |
|||
<Input value={editData?.points?.user?.name} readOnly /> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
<Form.Item label="巡检单位:" {...formItemLayout}> |
|||
<Input value={editData?.points?.user?.department?.name} readOnly title={222} /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item label="巡检时间:" {...formItemLayout}> |
|||
<Input value={editData?.inspectionTime && moment(editData?.inspectionTime).format('YYYY-MM-DD HH:mm:ss')} readOnly /> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
</Form> |
|||
|
|||
<div className="item-title">{"问题详情"}</div> |
|||
<Row> |
|||
<Col span={6}> |
|||
<Form.Item label="点位名称:" {...formItemLayout}> |
|||
<Input value={editData?.points?.itemData?.name} readOnly /> |
|||
</Form.Item> |
|||
</Col> |
|||
|
|||
<Col span={18}> |
|||
{ |
|||
Object.keys(editData?.points?.inspectContent).map(key => { |
|||
if (editData?.points?.inspectContent[key]?.isNormal == false) { |
|||
return <Row style={{ marginBottom: 15 }}> |
|||
<Col span={12}> |
|||
<Form.Item label="检查项:" {...formItemLayout}> |
|||
<Input value={key} readOnly /> |
|||
</Form.Item> |
|||
<Form.Item label="异常等级:" {...formItemLayout}> |
|||
<Input value={editData?.points?.inspectContent[key]?.level} readOnly /> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
<Form.Item label="问题描述:" {...formItemLayout}> |
|||
<Input value={editData?.points?.inspectContent[key]?.msgInp} readOnly title={222} /> |
|||
</Form.Item> |
|||
|
|||
<Form.Item label="现场图片:" {...formItemLayout}> |
|||
<Uploads |
|||
listType='picture-card' |
|||
uploadType='project' |
|||
maxFilesNum={1} |
|||
maxFileSize={10} |
|||
isQiniu={true} |
|||
disabled={true} |
|||
fileTypes={["png", "jpg"]} |
|||
defaultValue={ |
|||
(() => { |
|||
let nextV = [] |
|||
for (let s of (editData?.points?.inspectContent[key].imgs || [])) { |
|||
if (s) { |
|||
nextV.push({ |
|||
storageUrl: s |
|||
}) |
|||
} |
|||
} |
|||
return nextV |
|||
})() |
|||
} |
|||
/> |
|||
|
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
} |
|||
}) |
|||
} |
|||
</Col> |
|||
</Row></> |
|||
} |
|||
|
|||
return ( |
|||
<ModalForm |
|||
formRef={formRef} |
|||
title={title || ''} |
|||
initialValues={initialValues} |
|||
trigger={ |
|||
triggerRender ? triggerRender : <Button type="primary" > |
|||
{title || ''} |
|||
</Button> |
|||
} |
|||
width={1200} |
|||
layout="horizontal" |
|||
// grid={true}
|
|||
{...formItemLayout} |
|||
modalProps={{ |
|||
destroyOnClose: true, |
|||
// onCancel: () => { },
|
|||
bodyStyle: { height: 720, overflowY: 'auto' } |
|||
}} |
|||
onFinish={async (values) => { |
|||
values.startTime = values?.dateRange[0]; |
|||
values.endTime = values?.dateRange[1]; |
|||
onFinish && await onFinish(values, editData) |
|||
//message.success('提交成功');
|
|||
return true; |
|||
}} |
|||
|
|||
submitter={editData?.patrolRecordIssueHandles[0]?.state === 2 ? { |
|||
render: (props, defaultDoms) => { |
|||
return [ |
|||
<Button onClick={() => { approve(1); }} type='primary'>确定</Button>, |
|||
<Button onClick={() => { approve(0); }}>驳回</Button> |
|||
]; |
|||
} |
|||
} : !readOnly} |
|||
> |
|||
<div> |
|||
{/*问题记录信息*/} |
|||
{renderPlanInfo()} |
|||
|
|||
{/*维修处理计划表单*/} |
|||
{ |
|||
((editData?.patrolRecordIssueHandles?.length == 0 && !readOnly) || editData?.patrolRecordIssueHandles?.length > 0) && |
|||
<> |
|||
<div className="item-title">{"维修计划信息"}</div> |
|||
<Row> |
|||
<Col span={12}> |
|||
<ProFormSelect |
|||
rules={[{ required: true, message: '请选择维修人' }]} |
|||
options={[{ value: 1, label: '维修工1' }, { value: 2, label: '维修工2' }]} |
|||
disabled={readOnly} |
|||
name="repairPerson" |
|||
label="选择维修人" |
|||
fieldProps={{ |
|||
showSearch: true |
|||
}} |
|||
/> |
|||
</Col> |
|||
<Col span={12}> |
|||
<ProFormText |
|||
name="repairUnit" |
|||
label="维修单位:" |
|||
disabled={readOnly} |
|||
rules={[ |
|||
{ |
|||
max: 50, message: '维修单位长度不能大于50个字符' |
|||
}, |
|||
{ |
|||
whitespace: true, message: '请勿输入空格' |
|||
}]} |
|||
placeholder="请输入维修单位" |
|||
/> |
|||
</Col> |
|||
|
|||
<Col span={12}> |
|||
<ProFormDateRangePicker |
|||
disabled={readOnly} |
|||
name="dateRange" |
|||
label="计划开始时间~结束时间:" |
|||
rules={[{ required: true, message: '请选择计划时间范围' }]} |
|||
/> |
|||
</Col> |
|||
<Col span={12}> |
|||
<ProFormSelect |
|||
rules={[{ required: true, message: '请选择质检人' }]} |
|||
options={[{ value: 3, label: '质检人1' }, { value: 4, label: '质检人2' }]} |
|||
disabled={readOnly} |
|||
name="checkPerson" |
|||
label="选择质检人" |
|||
fieldProps={{ |
|||
showSearch: true |
|||
}} |
|||
/> |
|||
</Col> |
|||
<Col span={12}> |
|||
<ProFormTextArea |
|||
name="repairAsk" |
|||
label="维修要求:" |
|||
disabled={readOnly} |
|||
rules={[ |
|||
{ |
|||
max: 200, message: '维修要求长度不能大于200个字符' |
|||
}, |
|||
{ |
|||
whitespace: true, message: '请勿输入空格' |
|||
}]} |
|||
placeholder="请输入维修要求" |
|||
/></Col> |
|||
<Col span={12}></Col> |
|||
</Row> |
|||
</> |
|||
} |
|||
|
|||
{ |
|||
editData?.patrolRecordIssueHandles[0]?.state === 2 && |
|||
<> |
|||
<div className="item-title">{"维修计划审批"}</div> |
|||
<div> |
|||
<ProFormTextArea |
|||
labelCol={{ span: 5 }} |
|||
wrapperCol={{ span: 16 }} |
|||
name="approveOpinion" |
|||
label="审批意见:" |
|||
disabled={editData?.patrolRecordIssueHandles[0]?.state !== 2} |
|||
rules={[ |
|||
{ required: true, message: '请输入审批意见' }, |
|||
{ |
|||
max: 200, message: '审批意见长度不能大于200个字符' |
|||
}, |
|||
{ |
|||
whitespace: true, message: '请勿输入空格' |
|||
}]} |
|||
placeholder="请输入审批意见" |
|||
/> |
|||
</div> |
|||
</> |
|||
} |
|||
</div> |
|||
|
|||
|
|||
|
|||
</ ModalForm> |
|||
); |
|||
}; |
@ -0,0 +1,5 @@ |
|||
'use strict'; |
|||
|
|||
import PatrolReocrd from './patrolRecord'; |
|||
|
|||
export { PatrolReocrd }; |
@ -0,0 +1,234 @@ |
|||
|
|||
'use strict' |
|||
|
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Form, Input, Select, Button, Table, Modal, DatePicker, Checkbox, Row, Col, Collapse } from 'antd'; |
|||
import moment from "moment"; |
|||
import Uploads from '$components/Uploads'; |
|||
import IssueHandleModal from '../components/isuue-handle-mdal' |
|||
import '../style.less' |
|||
|
|||
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 { dispatch, actions, user } = props |
|||
const { patrolManage, issueHandle } = actions |
|||
const [tableList, settableList] = useState([]) |
|||
const [name, setName] = useState(''); |
|||
const [curState, setCurState] = useState('null'); |
|||
const format = 'YYYY-MM-DD HH:mm:ss' |
|||
const times = [moment().subtract(70, 'years').format(format), moment().format(format)] |
|||
const [search, setSearch] = useState({ name: null, time: [times[0], times[1]], state: 'null' }) |
|||
|
|||
useEffect(() => { |
|||
queryData() |
|||
}, []) |
|||
|
|||
const queryData = () => { |
|||
dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)).then(res => { |
|||
if (res.success) { |
|||
settableList(name != null ? res.payload.data?.filter(v => |
|||
(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 }))) |
|||
} |
|||
}) |
|||
} |
|||
const onFinish = async (values, editData) => { |
|||
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) => { |
|||
let text = '查看' |
|||
|
|||
return STATE_TEXT[currentState] || text |
|||
} |
|||
|
|||
const columns = [ |
|||
{ |
|||
title: '结构物名称', |
|||
dataIndex: 'name', |
|||
key: 'name', |
|||
width: '10%', |
|||
showInDetail: true, |
|||
render: (text, record, index) => { |
|||
return !record.points?.project ? '' : <div>{record.points.project.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: 'time', |
|||
key: 'time', |
|||
showInDetail: true, |
|||
render: (text, record, index) => moment(record.inspectionTime).format('YYYY-MM-DD HH:mm:ss') || '--' |
|||
}, { |
|||
title: '点位名称', |
|||
dataIndex: 'station', |
|||
key: 'station', |
|||
showInDetail: true, |
|||
render: (text, record, index) => record?.points?.itemData?.name |
|||
}, |
|||
{ |
|||
title: '问题来源', |
|||
dataIndex: 'source', |
|||
key: 'source', |
|||
showInDetail: true, |
|||
render: (text, record, index) => '巡检上报' //暂定巡检上报 后续会增加平台录入
|
|||
}, |
|||
{ |
|||
title: '严重等级', |
|||
dataIndex: 'level', |
|||
key: 'level', |
|||
showInDetail: true, |
|||
render: (text, record, index) => { |
|||
const LEVELS_ = ['严重', '中度', '轻微']; |
|||
const recordLevels = [] |
|||
Object.keys(record?.points?.inspectContent).map(key => { |
|||
recordLevels.push(record?.points?.inspectContent[key]?.level) |
|||
}) |
|||
const level = LEVELS_.find(s => recordLevels.find(x => x == s)) |
|||
return level; |
|||
} |
|||
}, |
|||
{ |
|||
title: '当前状态', |
|||
dataIndex: 'state', |
|||
key: 'name', |
|||
width: '10%', |
|||
showInDetail: true, |
|||
render: (text, record, index) => { |
|||
return !record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0 ? '待制定计划' : |
|||
renderOptionText(record?.patrolRecordIssueHandles[0]?.state) |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
dataIndex: 'operation', |
|||
key: 'operation', |
|||
render: (text, record, index) => { |
|||
const options = []; |
|||
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} |
|||
readOnly={true} |
|||
key="edit" |
|||
title="审核" |
|||
triggerRender={<a style={{ marginRight: 6 }}>{renderOptionText(2)}</a>} |
|||
user={user} |
|||
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 ( |
|||
<div id='patrol-record'> |
|||
<div style={{ marginBottom: 20 }}> |
|||
<Input style={{ width: 240, marginRight: 20 }} |
|||
value={name} onChange={e => { setName(e.target.value) }} |
|||
placeholder="请输入结构物名称或上报人" allowClear /> |
|||
<Select style={{ width: 140, marginRight: 20 }} 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: '验收不通过' }, |
|||
]} /> |
|||
<Button type='primary' onClick={() => { queryData() }}>搜索</Button> |
|||
</div> |
|||
<Table |
|||
columns={columns} |
|||
dataSource={tableList} |
|||
pagination={{ |
|||
showSizeChanger: true, |
|||
pageSizeOptions: [10, 20, 50], |
|||
|
|||
}} |
|||
/> |
|||
|
|||
|
|||
</div> |
|||
) |
|||
} |
|||
|
|||
function mapStateToProps(state) { |
|||
const { auth, global } = state; |
|||
return { |
|||
user: auth.user, |
|||
actions: global.actions, |
|||
}; |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(PatrolRecord); |
@ -0,0 +1,15 @@ |
|||
'use strict'; |
|||
|
|||
import reducers from './reducers'; |
|||
import routes from './routes'; |
|||
import actions from './actions'; |
|||
import { getNavItem } from './nav-item'; |
|||
|
|||
export default { |
|||
key: 'issueHandle', |
|||
name: '', |
|||
reducers: reducers, |
|||
routes: routes, |
|||
actions: actions, |
|||
getNavItem: getNavItem |
|||
}; |
@ -0,0 +1,18 @@ |
|||
import React from 'react'; |
|||
import { Link } from 'react-router-dom'; |
|||
import { Menu } from 'antd'; |
|||
import { SettingOutlined } from '@ant-design/icons'; |
|||
|
|||
const SubMenu = Menu.SubMenu; |
|||
|
|||
export function getNavItem(user, dispatch) { |
|||
// if (!Func.isAuthorized("ORG_MANAGE")) {
|
|||
// return null
|
|||
// }
|
|||
return ( |
|||
<Menu.Item icon={<SettingOutlined />} key="issueHandle"> |
|||
<Link to="/issueHandle">维修处理</Link> |
|||
</Menu.Item> |
|||
|
|||
); |
|||
} |
@ -0,0 +1,5 @@ |
|||
'use strict'; |
|||
|
|||
export default { |
|||
|
|||
}; |
@ -0,0 +1,32 @@ |
|||
'use strict'; |
|||
import * as actionTypes from '../actions/record'; |
|||
import Immutable from 'immutable'; |
|||
|
|||
const initState = { |
|||
data: {}, |
|||
isRequesting: false, |
|||
error: null |
|||
}; |
|||
|
|||
function record(state = initState, action) { |
|||
const payload = action.payload; |
|||
switch (action.type){ |
|||
case actionTypes.GET_PATROL_RECORD_LIST: |
|||
return Immutable.fromJS(state).set('data', |
|||
payload.data).toJS(); |
|||
case actionTypes.GET_PATROL_RECORD_LIST_SUCCESS: |
|||
return Immutable.fromJS(state).merge({ |
|||
isRequesting: false, |
|||
data: payload.data |
|||
}).toJS(); |
|||
case actionTypes.GET_PATROL_RECORD_LIST_ERROR: |
|||
return Immutable.fromJS(state).merge({ |
|||
isRequesting: false, |
|||
error: payload.error |
|||
}).toJS(); |
|||
default: |
|||
return state; |
|||
} |
|||
} |
|||
|
|||
export default record; |
@ -0,0 +1,13 @@ |
|||
'use strict'; |
|||
import { PatrolReocrd } from './containers'; |
|||
|
|||
export default [{ |
|||
type: 'inner', |
|||
route: { |
|||
path: '/issueHandle', |
|||
key: 'issueHandle', |
|||
breadcrumb: '维修处理', |
|||
component: PatrolReocrd, |
|||
|
|||
} |
|||
}]; |
@ -0,0 +1,13 @@ |
|||
.patrol-record-detail-modal { |
|||
.ant-collapse>.ant-collapse-item>.ant-collapse-header { |
|||
padding: 0 |
|||
} |
|||
} |
|||
|
|||
.item-title { |
|||
background-color: #4A93DF; |
|||
padding: 10px; |
|||
color: #fff; |
|||
margin-bottom: 20px; |
|||
padding-left: 20px; |
|||
} |
Loading…
Reference in new issue