diff --git a/api/app/lib/controllers/patrolManage/patrolRecord.js b/api/app/lib/controllers/patrolManage/patrolRecord.js index 4c4b15b..204177a 100644 --- a/api/app/lib/controllers/patrolManage/patrolRecord.js +++ b/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') { diff --git a/api/app/lib/index.js b/api/app/lib/index.js index faf68b5..6f6cb92 100644 --- a/api/app/lib/index.js +++ b/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' }); diff --git a/api/app/lib/models/patrol_record_issue_handle.js b/api/app/lib/models/patrol_record_issue_handle.js new file mode 100644 index 0000000..a46ddba --- /dev/null +++ b/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; +}; \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/containers/patrolRecord.js b/web/client/src/sections/issueHandle/containers/patrolRecord.js index 938dae2..9e84532 100644 --- a/web/client/src/sections/issueHandle/containers/patrolRecord.js +++ b/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,94 +53,155 @@ const PatrolRecord = (props) => { return text } - const columns = [{ - title: '结构物名称', - dataIndex: 'name', - key: 'name', - width: '10%', - showInDetail: true, - render: (text, record, index) => { - return !record.points?.project ? '' :