Browse Source

维修处理功能完善

master
peng.peng 2 years ago
parent
commit
f03b4aa187
  1. 6
      api/app/lib/controllers/patrolManage/patrolRecord.js
  2. 5
      api/app/lib/index.js
  3. 143
      api/app/lib/models/patrol_record_issue_handle.js
  4. 239
      web/client/src/sections/issueHandle/containers/patrolRecord.js

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

@ -10,7 +10,11 @@ async function findPatrolRecord(ctx, next) {
let generalInclude = [{ let generalInclude = [{
model: models.PatrolPlan, model: models.PatrolPlan,
attributes: ['name'] attributes: ['name']
}] },
{
model: models.PatrolRecordIssueHandle
}
]
if (patrolPlanId == 'all') { if (patrolPlanId == 'all') {
/* 如果有startTime && endTime,查询所有符合条件的数据 */ /* 如果有startTime && endTime,查询所有符合条件的数据 */
if (startTime !== 'null' && endTime !== 'null') { if (startTime !== 'null' && endTime !== 'null') {

5
api/app/lib/index.js

@ -56,12 +56,15 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq
const { Department, User, UserResource, Resource, Project, Point, const { Department, User, UserResource, Resource, Project, Point,
PatrolPlan, PatrolRecord, PatrolPlan, PatrolRecord,
CheckItems, CheckItemsGroup, CheckItems, CheckItemsGroup,
PatrolTemplate, PatrolTemplateCheckItems PatrolTemplate, PatrolTemplateCheckItems, PatrolRecordIssueHandle
} = dc.models; } = dc.models;
PatrolRecord.belongsTo(PatrolPlan, { foreignKey: 'patrolPlanId', targetKey: 'id' }); PatrolRecord.belongsTo(PatrolPlan, { foreignKey: 'patrolPlanId', targetKey: 'id' });
PatrolPlan.hasMany(PatrolRecord, { foreignKey: 'patrolPlanId', sourceKey: 'id' }); PatrolPlan.hasMany(PatrolRecord, { foreignKey: 'patrolPlanId', sourceKey: 'id' });
PatrolRecordIssueHandle.belongsTo(PatrolRecord, { foreignKey: 'patrolRecordId', targetKey: 'id' });
PatrolRecord.hasMany(PatrolRecordIssueHandle, { foreignKey: 'patrolRecordId', sourceKey: 'id' });
UserResource.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' }); UserResource.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' });
User.hasMany(UserResource, { foreignKey: 'userId', sourceKey: 'id' }); User.hasMany(UserResource, { foreignKey: 'userId', sourceKey: 'id' });

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

@ -0,0 +1,143 @@
/* 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.INTEGER,
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
}
}, {
tableName: "patrol_record_issue_handle",
comment: "",
indexes: []
});
dc.models.PatrolRecordIssueHandle = PatrolRecordIssueHandle;
return PatrolRecordIssueHandle;
};

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

@ -28,7 +28,7 @@ const PatrolRecord = (props) => {
}, []) }, [])
const record = (params) => { const record = (params) => {
dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/null/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(params.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(params.name) != -1 || v.points.project.name.indexOf(params.name) != -1))
@ -53,94 +53,155 @@ const PatrolRecord = (props) => {
return text return text
} }
const columns = [{ const columns = [
title: '结构物名称', {
dataIndex: 'name', title: '结构物名称',
key: 'name', dataIndex: 'name',
width: '10%', key: 'name',
showInDetail: true, width: '10%',
render: (text, record, index) => { showInDetail: true,
return !record.points?.project ? '' : <div>{record.points.project.name}</div> render: (text, record, index) => {
} return !record.points?.project ? '' : <div>{record.points.project.name}</div>
}, { }
title: '巡检计划', },
dataIndex: 'name', {
key: 'name', title: '上报人',
width: '10%', dataIndex: 'type',
showInDetail: true, key: 'type',
render: (text, record, index) => { showInDetail: true,
return !record.patrolPlan ? '' : <div>{record.patrolPlan.name}</div> width: '10%',
} render: (text, record, index) => {
}, { return !record.points?.user ? '' : <div>{record.points.user.name}</div>
title: '巡检点位', }
dataIndex: 'type', },
key: 'type', {
showInDetail: true, title: '上报时间',
width: '10%', dataIndex: 'time',
render: (text, record, index) => { key: 'time',
return !record.points?.user ? '' : <div>{record.points.itemData.name}</div> showInDetail: true,
} render: (text, record, index) => moment(record.inspectionTime).format('YYYY-MM-DD HH:mm:ss') || '--'
}, { }, {
title: '巡检人', title: '点位名称',
dataIndex: 'type', dataIndex: 'station',
key: 'type', key: 'station',
showInDetail: true, showInDetail: true,
width: '10%', render: (text, record, index) => record?.points?.itemData?.name
render: (text, record, index) => { },
return !record.points?.user ? '' : <div>{record.points.user.name}</div> {
} title: '问题来源',
}, { dataIndex: 'source',
title: '巡检单位', key: 'source',
dataIndex: 'type', showInDetail: true,
showInDetail: true, render: (text, record, index) => '巡检上报' //暂定巡检上报 后续会增加平台录入
key: 'type', },
width: '10%', {
render: (text, record, index) => { title: '严重等级',
return !record.points?.user ? '' : <div>{record.points.user.department.name}</div> dataIndex: 'level',
} key: 'level',
}, { showInDetail: true,
title: '巡检频次', render: (text, record, index) => {
dataIndex: 'describe', const LEVELS_ = ['严重', '中度', '轻微'];
key: 'describe', const recordLevels = []
showInDetail: true, Object.keys(record?.points?.inspectContent).map(key => {
width: '10%', recordLevels.push(record?.points?.inspectContent[key]?.level)
render: (text, record, index) => { })
return !record.points ? '' : <div>{record.points.frequency}</div> const level = LEVELS_.find(s => recordLevels.find(x => x == s))
} return level;
}, { }
title: '上次巡检日期', },
dataIndex: 'describe', {
showInDetail: true, title: '当前状态',
key: 'describe', dataIndex: 'state',
render: (text, record, index) => record.lastInspectionTime ? moment(record.lastInspectionTime).format('YYYY-MM-DD HH:mm:ss') : '--' key: 'name',
}, { width: '10%',
title: '本次巡检日期', showInDetail: true,
dataIndex: 'describe', render: (text, record, index) => {
key: 'describe', return !record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0 ? '待制定计划' :
showInDetail: true, record?.patrolRecordIssueHandles[0]?.state
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: '巡检计划',
}, { // dataIndex: 'name',
title: '操作', // key: 'name',
dataIndex: 'operation', // width: '10%',
key: 'operation', // showInDetail: true,
render: (text, record, index) => { // render: (text, record, index) => {
return ( // return !record.patrolPlan ? '' : <div>{record.patrolPlan.name}</div>
<IssueHandleModal // }
editData={record} // }, {
readOnly={true} // title: '巡检点位',
key="edit" // dataIndex: 'type',
title="置顶计划" // key: 'type',
triggerRender={<a>{renderOptionText(1)}</a>} // showInDetail: true,
user={{}} // width: '10%',
onFinish={onFinish} /> // 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: '操作',
dataIndex: 'operation',
key: 'operation',
render: (text, record, index) => {
return (
<IssueHandleModal
editData={record}
readOnly={true}
key="edit"
title="置顶计划"
triggerRender={<a>{renderOptionText(1)}</a>}
user={{}}
onFinish={onFinish} />
)
}
} }
}
] ]
return ( return (
@ -158,7 +219,7 @@ const PatrolRecord = (props) => {
name="name" name="name"
style={{ marginRight: 16, minWidth: 250 }} style={{ marginRight: 16, minWidth: 250 }}
> >
<Input placeholder="请输入结构物名称或巡检人" allowClear /> <Input placeholder="请输入结构物名称或上报人" allowClear />
</Form.Item> </Form.Item>
<Form.Item <Form.Item

Loading…
Cancel
Save