Browse Source

维修处理完善

master
peng.peng 2 years ago
parent
commit
2d6927b941
  1. 1
      api/app/lib/controllers/patrolManage/patrolRecord.js
  2. 2
      api/app/lib/models/patrol_record_issue_handle.js
  3. 18
      api/app/lib/models/user.js
  4. 78
      web/client/src/sections/issueHandle/actions/checkItems.js
  5. 10
      web/client/src/sections/issueHandle/actions/index.js
  6. 80
      web/client/src/sections/issueHandle/actions/plan.js
  7. 33
      web/client/src/sections/issueHandle/actions/record.js
  8. 47
      web/client/src/sections/issueHandle/actions/template.js
  9. 377
      web/client/src/sections/issueHandle/components/isuue-handle-mdal.js
  10. 226
      web/client/src/sections/issueHandle/containers/patrolRecord.js

1
api/app/lib/controllers/patrolManage/patrolRecord.js

@ -150,6 +150,7 @@ async function addPatrolRecord(ctx, next) {
const curPlanRecord = await models.PatrolRecord.findAndCountAll({ const curPlanRecord = await models.PatrolRecord.findAndCountAll({
where: { patrolPlanId } where: { patrolPlanId }
}); });
const patrolCount = curPlanRecord.count; const patrolCount = curPlanRecord.count;
await models.PatrolPlan.update({ patrolCount }, { await models.PatrolPlan.update({ patrolCount }, {
where: { id: patrolPlanId }, where: { id: patrolPlanId },

2
api/app/lib/models/patrol_record_issue_handle.js

@ -148,7 +148,7 @@ module.exports = dc => {
defaultValue: null, defaultValue: null,
comment: "制定日期", comment: "制定日期",
primaryKey: false, primaryKey: false,
field: "approve_date", field: "create_time",
autoIncrement: false autoIncrement: false
}, },
}, { }, {

18
api/app/lib/models/user.js

@ -96,15 +96,15 @@ module.exports = dc => {
field: "post", field: "post",
autoIncrement: false autoIncrement: false
}, },
structure: { // structure: {
type: DataTypes.STRING, // type: DataTypes.STRING,
allowNull: true, // allowNull: true,
defaultValue: null, // defaultValue: null,
comment: "结构物", // comment: "结构物",
primaryKey: false, // primaryKey: false,
field: "structure", // field: "structure",
autoIncrement: false // autoIncrement: false
} // }
}, { }, {
tableName: "user", tableName: "user",
comment: "", comment: "",

78
web/client/src/sections/issueHandle/actions/checkItems.js

@ -1,78 +0,0 @@
'use strict';
import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
export function getCheckItemsGroup() {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_CHECK_ITEMS_GRROUP',
url: ApiTable.checkItemsGroup,
msg: { error: '获取检查项分组失败' },
reducer:{name:'checkItemsGroup'}
});
}
export function createCheckItemsGroup(data) {
return dispatch => basicAction({
type: 'post',
data,
dispatch: dispatch,
actionType: 'CREATE_CHECK_ITEMS_GRROUP',
url: ApiTable.checkItemsGroup,
msg: { option: '创建检查项分组' },
});
}
export function getCheckItems(query) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
query: query,
actionType: 'GET_CHECK_ITEMS',
url: ApiTable.checkItems,
msg: { error: '获取检查项失败' }
});
}
export function createCheckItems(data) {
return dispatch => basicAction({
type: 'post',
data,
dispatch: dispatch,
actionType: 'CREATE_CHECK_ITEMS',
url: ApiTable.checkItems,
msg: { option: '新建检查项' },
});
}
export function updateCheckItems(id, data) {
return dispatch => basicAction({
type: 'put',
data,
dispatch: dispatch,
actionType: 'UPDATE_CHECK_ITEMS',
url: ApiTable.updateCheckItems.replace('{id}', id),
msg: { option: '修改检查项' },
});
}
export function delCheckItems(ids) {
return dispatch => basicAction({
type: 'del',
dispatch: dispatch,
actionType: 'DEL_CHECK_ITEMS',
url: ApiTable.delCheckItems.replace('{ids}', ids),
msg: { option: '删除检查项' },
});
}
export default {
getCheckItemsGroup,
createCheckItemsGroup,
getCheckItems,
createCheckItems,
updateCheckItems,
delCheckItems,
}

10
web/client/src/sections/issueHandle/actions/index.js

@ -1,13 +1,11 @@
'use strict'; 'use strict';
import * as plan from './plan'
import * as record from './record' import * as record from './record'
import * as template from './template'
import * as checkItems from './checkItems'
export default { export default {
...plan,
...record, ...record,
...template,
...checkItems,
} }

80
web/client/src/sections/issueHandle/actions/plan.js

@ -1,80 +0,0 @@
'use strict';
import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
export function getPatrolPlan() {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_PATROL_PLAN',
url: ApiTable.patrolPlan,
msg: { error: '获取巡检计划失败' },
});
}
export function createPatrolPlan(data) {
return dispatch => basicAction({
type: 'post',
data,
dispatch: dispatch,
actionType: 'CREATE_PATROL_PLAN',
url: ApiTable.patrolPlan,
msg: { error: '新增巡检计划失败' },
});
}
export function delPatrolPlan(id) {
return dispatch => basicAction({
type: 'del',
dispatch: dispatch,
actionType: 'DEL_PATROL_PLAN',
url: ApiTable.delPatrolPlan.replace('{id}', id),
msg: { error: '删除巡检计划失败' },
});
}
export function updatePatrolPlan(data) {
return dispatch => basicAction({
type: 'put',
data,
dispatch: dispatch,
actionType: 'UPDATE_PATROL_PLAN',
url: ApiTable.patrolPlan,
msg: { error: '修改巡检计划失败' },
});
}
export function getUserList() {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_USER_LIST',
url: ApiTable.getDepUser.replace('{depId}', null),
msg: { error: '获取人员列表失败' },
reducer: { name: 'userList' }
});
}
export function getProjectList(query) {
return (dispatch) => basicAction({
type: 'get',
query,
dispatch,
actionType: 'GET_PROJEECT_LIST',
url: ApiTable.getProjectList,
msg: { error: '获取结构物列表失败', },
reducer: { name: 'structureList' }
});
}
export function positionList(query) {
return (dispatch) => basicAction({
type: 'get',
query,
dispatch,
actionType: 'POSITION_LIST',
url: ApiTable.position,
msg: { error: '获取点位列表失败', },
});
}

33
web/client/src/sections/issueHandle/actions/record.js

@ -1,17 +1,32 @@
'use strict'; 'use strict';
import { basicAction } from '@peace/utils' import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
export const GET_PATROL_RECORD_LIST = 'GET_PATROL_RECORD_LIST';
export const GET_PATROL_RECORD_LIST_SUCCESS = 'GET_PATROL_RECORD_LIST_SUCCESS'; export function addPatrolRecordIssueHandle(params) {
export const GET_PATROL_RECORD_LIST_ERROR = 'GET_PATROL_RECORD_LIST_ERROR';
export function records(url) {
return (dispatch) => basicAction({ return (dispatch) => basicAction({
type: 'get', type: 'post',
data: params,
dispatch, dispatch,
actionType: GET_PATROL_RECORD_LIST, actionType: 'ADD_PatrolRecordIssueHandle_REPORT',
url: url, url: ApiTable.addPatrolRecordIssueHandle,
msg: { error: '获取巡检记录失败', }, msg: {
reducer: { name: 'record' } 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 || '维修计划审批',
},
});
}

47
web/client/src/sections/issueHandle/actions/template.js

@ -1,47 +0,0 @@
'use strict';
import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
export function getPatrolTemplate () {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_PATROL_TEMPLATE',
url: ApiTable.patrolTemplate,
msg: { error: '获取巡检模板失败' },
reducer: { name: 'patrolTemplate' }
});
}
export function createPatrolTemplate (data) {
return dispatch => basicAction({
type: 'post',
data,
dispatch: dispatch,
actionType: 'CREATE_PATROL_TEMPLATE',
url: ApiTable.patrolTemplate,
msg: { option: '新增巡检模板' },
});
}
export function delPatrolTemplate (id) {
return dispatch => basicAction({
type: 'del',
dispatch: dispatch,
actionType: 'DEL_PATROL_TEMPLATE',
url: ApiTable.delPatrolTemplate.replace('{id}', id),
msg: { option: '删除巡检模板' },
});
}
export function updatePatrolTemplate (data) {
return dispatch => basicAction({
type: 'put',
data,
dispatch: dispatch,
actionType: 'UPDATE_PATROL_TEMPLATE',
url: ApiTable.patrolTemplate,
msg: { option: '修改巡检模板' },
});
}

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

@ -5,7 +5,8 @@ import {
ProFormText, ProFormText,
ProFormSelect, ProFormSelect,
ProFormTextArea, ProFormTextArea,
ProFormDatePicker ProFormDatePicker,
ProFormDateRangePicker
} from '@ant-design/pro-form'; } from '@ant-design/pro-form';
import Uploads from '$components/Uploads'; import Uploads from '$components/Uploads';
import moment from 'moment'; import moment from 'moment';
@ -13,81 +14,129 @@ const FormItem = Form.Item;
//state: 1下发未上报 2已上报待审批 3整改完成 上报结果result: status 0 已上报未审批 1 审批通过 2 审批驳回 //state: 1下发未上报 2已上报待审批 3整改完成 上报结果result: status 0 已上报未审批 1 审批通过 2 审批驳回
export default (props) => { export default (props) => {
const { title, triggerRender, editData = null, onFinish, readOnly, companyList, user } = props; const { title, triggerRender, editData = null, onFinish, readOnly, companyList, user } = props;
const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } }; const formItemLayout = { labelCol: { span: 7 }, wrapperCol: { span: 16 } };
const formRef = useRef();
const initialValues = editData ? { const initialValues = editData ? {
...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 [reason, setReason] = useState('')
const columns = [ const approve = async (approve) => {
{ formRef.current.validateFields().then(async (values) => {
title: '序号',
dataIndex: 'index', onFinish && await onFinish({
key: 'index', msg: approve ? '计划同意' : '计划驳回',
render: (text, record, index) => index + 1 state: approve ? 4 : 3,
}, approveOpinion: values?.approveOpinion,
{ approvePerson: user,
title: '提交时间', approveDate: moment()
dataIndex: 'time', }, editData)
key: 'time', return true;
}, })
{ .catch((errors) => {
title: '整改附件', if (errors) {
dataIndex: 'file',
key: 'file', }
render: (text, record) => { });
return <Uploads
className='upload' }
maxFilesNum={1}//没有固定个数
maxFileSize={200} const renderPlanInfo = () => {
isQiniu={true} return <>
fileTypes={['rar', 'zip']} {/* <Card title={'巡检信息'}> */}
defaultValue={record?.file || []} <div className="item-title">{"巡检信息"}</div>
disabled={true} <Form>
/> <Row>
} <Col span={12}>
}, <Form.Item label="结构物名称:" {...formItemLayout}>
{ <Input value={editData?.points?.project?.name} readOnly />
title: '结论', </Form.Item>
dataIndex: 'status', <Form.Item label="巡检人:" {...formItemLayout}>
key: 'status', <Input value={editData?.points?.user?.name} readOnly />
// 0 未审批 1 通过 2驳回 </Form.Item>
render: (text, record) => { </Col>
return user?.departmentId != -1 && record?.status === 0 ? <> <Col span={12}>
<Popconfirm icon={null} title={<>驳回原因<Input onChange={(e) => { <Form.Item label="巡检单位:" {...formItemLayout}>
setReason(e.target.value) <Input value={editData?.points?.user?.department?.name} readOnly title={222} />
}} /></>} </Form.Item>
onConfirm={() => {
if (!reason) { <Form.Item label="巡检时间:" {...formItemLayout}>
message.warning('未填写驳回原因'); <Input value={editData?.inspectionTime && moment(editData?.inspectionTime).format('YYYY-MM-DD HH:mm:ss')} readOnly />
return; </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>
} }
handleResult(false) })
}} > }
<Button style={{ marginRight: 10 }}>驳回</Button> </Col>
</Popconfirm> </Row></>
<Button onClick={() => { handleResult(true) }} type='primary'>通过</Button></>
: record?.status === 1 ? "整改完成" : record?.reason
}
},
];
const handleResult = (approve) => {
const results = JSON.parse(JSON.stringify(editData?.result || []))
results[results.length - 1] = {
...results[results.length - 1], status: approve ? 1 : 2,
reason
}
onFinish && onFinish({
msg: approve ? '任务审批' : '任务驳回',
state: approve ? 3 : 1,
result: results
}, editData)
} }
return ( return (
<ModalForm <ModalForm
formRef={formRef}
title={title || ''} title={title || ''}
initialValues={initialValues} initialValues={initialValues}
trigger={ trigger={
@ -101,107 +150,131 @@ export default (props) => {
{...formItemLayout} {...formItemLayout}
modalProps={{ modalProps={{
destroyOnClose: true, destroyOnClose: true,
onCancel: () => { }, // onCancel: () => { },
bodyStyle: { height: 720, overflowY: 'auto' } bodyStyle: { height: 720, overflowY: 'auto' }
}} }}
onFinish={async (values) => { onFinish={async (values) => {
values.startTime = values?.dateRange[0];
values.endTime = values?.dateRange[1];
onFinish && await onFinish(values, editData) onFinish && await onFinish(values, editData)
//message.success('提交成功'); //message.success('提交成功');
return true; return true;
}} }}
submitter={!readOnly}
submitter={editData?.patrolRecordIssueHandles[0]?.state === 2 ? {
render: (props, defaultDoms) => {
return [
<Button onClick={() => { approve(1); }} type='primary'>确定</Button>,
<Button onClick={() => { approve(0); }}>驳回</Button>
];
}
} : !readOnly}
> >
<div> <div>
{/* <Card title={'巡检信息'}> */} {/*问题记录信息*/}
<div className="item-title">{"巡检信息"}</div> {renderPlanInfo()}
<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 => { ((editData?.patrolRecordIssueHandles?.length == 0 && !readOnly) || editData?.patrolRecordIssueHandles?.length > 0) &&
if (editData?.points?.inspectContent[key]?.isNormal == false) { <>
return <Row style={{ marginBottom: 15 }}> <div className="item-title">{"维修计划信息"}</div>
<Col span={12}> <Row>
<Form.Item label="检查项:" {...formItemLayout}> <Col span={12}>
<Input value={key} readOnly /> <ProFormSelect
</Form.Item> rules={[{ required: true, message: '请选择维修人' }]}
<Form.Item label="异常等级:" {...formItemLayout}> options={[{ value: 1, label: '维修工1' }, { value: 2, label: '维修工2' }]}
<Input value={editData?.points?.inspectContent[key]?.level} readOnly /> disabled={readOnly}
</Form.Item> name="repairPerson"
</Col> label="选择维修人"
<Col span={12}> fieldProps={{
<Form.Item label="问题描述:" {...formItemLayout}> showSearch: true
<Input value={editData?.points?.inspectContent[key]?.msgInp} readOnly title={222} /> }}
</Form.Item> />
</Col>
<Form.Item label="现场图片:" {...formItemLayout}> <Col span={12}>
<Uploads <ProFormText
listType='picture-card' name="repairUnit"
uploadType='project' label="维修单位:"
maxFilesNum={1} disabled={readOnly}
maxFileSize={10} rules={[
isQiniu={true} {
disabled={true} max: 50, message: '维修单位长度不能大于50个字符'
fileTypes={["png", "jpg"]} },
defaultValue={ {
(() => { whitespace: true, message: '请勿输入空格'
let nextV = [] }]}
for (let s of (editData?.points?.inspectContent[key].imgs || [])) { placeholder="请输入维修单位"
if (s) { />
nextV.push({ </Col>
storageUrl: s
})
}
}
return nextV
})()
}
/>
</Form.Item>
</Col>
</Row>
}
})
}
</Col>
</Row>
<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>
</>
}
<div className="item-title">{"维修计划信息"}</div> {
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> </div>
</ModalForm> </ ModalForm>
); );
}; };

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

@ -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}

Loading…
Cancel
Save