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. 165
      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 = [{
model: models.PatrolPlan,
attributes: ['name']
}]
},
{
model: models.PatrolRecordIssueHandle
}
]
if (patrolPlanId == 'all') {
/* 如果有startTime && endTime,查询所有符合条件的数据 */
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,
PatrolPlan, PatrolRecord,
CheckItems, CheckItemsGroup,
PatrolTemplate, PatrolTemplateCheckItems
PatrolTemplate, PatrolTemplateCheckItems, PatrolRecordIssueHandle
} = dc.models;
PatrolRecord.belongsTo(PatrolPlan, { foreignKey: 'patrolPlanId', targetKey: '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' });
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;
};

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

@ -28,7 +28,7 @@ const PatrolRecord = (props) => {
}, [])
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) {
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))
@ -53,7 +53,8 @@ const PatrolRecord = (props) => {
return text
}
const columns = [{
const columns = [
{
title: '结构物名称',
dataIndex: 'name',
key: 'name',
@ -62,26 +63,9 @@ const PatrolRecord = (props) => {
render: (text, record, index) => {
return !record.points?.project ? '' : <div>{record.points.project.name}</div>
}
}, {
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: '巡检人',
},
{
title: '上报人',
dataIndex: 'type',
key: 'type',
showInDetail: true,
@ -89,42 +73,119 @@ const PatrolRecord = (props) => {
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: 'type',
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,
key: 'type',
width: '10%',
render: (text, record, index) => {
return !record.points?.user ? '' : <div>{record.points.user.department.name}</div>
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: 'describe',
key: 'describe',
showInDetail: true,
},
{
title: '当前状态',
dataIndex: 'state',
key: 'name',
width: '10%',
showInDetail: true,
render: (text, record, index) => {
return !record.points ? '' : <div>{record.points.frequency}</div>
return !record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0 ? '待制定计划' :
record?.patrolRecordIssueHandles[0]?.state
}
}, {
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: '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: '操作',
dataIndex: 'operation',
key: 'operation',
@ -158,7 +219,7 @@ const PatrolRecord = (props) => {
name="name"
style={{ marginRight: 16, minWidth: 250 }}
>
<Input placeholder="请输入结构物名称或巡检人" allowClear />
<Input placeholder="请输入结构物名称或上报人" allowClear />
</Form.Item>
<Form.Item

Loading…
Cancel
Save