Archer_cdm 2 years ago
parent
commit
a878030421
  1. 20
      api/app/lib/controllers/organization/user.js
  2. 113
      api/app/lib/controllers/patrolPlan/patrolPlan.js
  3. 78
      api/app/lib/controllers/projectRegime/projectSituation.js
  4. 9
      api/app/lib/index.js
  5. 98
      api/app/lib/models/camera.js
  6. 52
      api/app/lib/models/company.js
  7. 130
      api/app/lib/models/coordinate.js
  8. 89
      api/app/lib/models/hide_danger_dispose.js
  9. 107
      api/app/lib/models/hide_danger_rectify.js
  10. 62
      api/app/lib/models/hide_danger_rectify_sites.js
  11. 88
      api/app/lib/models/hide_danger_report.js
  12. 115
      api/app/lib/models/metting.js
  13. 74
      api/app/lib/models/patrol_plan.js
  14. 60
      api/app/lib/models/phone_validate_code.js
  15. 69
      api/app/lib/models/post.js
  16. 59
      api/app/lib/models/problem_report_consult.js
  17. 64
      api/app/lib/models/problem_report_file.js
  18. 70
      api/app/lib/models/project_disclosure.js
  19. 65
      api/app/lib/models/project_disclosure_files.js
  20. 170
      api/app/lib/models/risk_report.js
  21. 74
      api/app/lib/models/role.js
  22. 43
      api/app/lib/models/role_group.js
  23. 47
      api/app/lib/models/role_resource.js
  24. 69
      api/app/lib/models/safety_cultivate.js
  25. 53
      api/app/lib/models/user_deal_todo.js
  26. 51
      api/app/lib/models/user_department.js
  27. 51
      api/app/lib/models/user_post.js
  28. 134
      api/app/lib/models/worker.js
  29. 74
      api/app/lib/models/worker_attendance.js
  30. 124
      api/app/lib/models/xuncheck_task.js
  31. 17
      api/app/lib/routes/patrolPlan/patrolPlan.js
  32. 3
      api/app/lib/routes/projectRegime/index.js
  33. 7
      api/config.js
  34. 32
      api/log/development.log
  35. 6
      script/1.0.0/schema/2.create.project.sql
  36. 20
      script/1.0.0/schema/3.create_patrol_plan.sql
  37. 53
      web/Dockerfile
  38. BIN
      web/client/assets/images/login/login_a.png
  39. BIN
      web/client/assets/images/login/login_b.png
  40. 2
      web/client/src/index.js
  41. 2
      web/client/src/layout/components/header/index.js
  42. 200
      web/client/src/sections/auth/containers/login.js
  43. 3
      web/client/src/sections/organization/containers/user.js
  44. 34
      web/client/src/sections/patrolManage/actions/plan.js
  45. 202
      web/client/src/sections/patrolManage/components/planModal.js
  46. 72
      web/client/src/sections/patrolManage/components/userModal.js
  47. 64
      web/client/src/sections/patrolManage/containers/patrolPlan.js
  48. 10
      web/client/src/sections/projectRegime/actions/projectSituation.js
  49. 6
      web/client/src/sections/projectRegime/containers/information.js
  50. 33
      web/client/src/sections/projectRegime/containers/qrCode.js
  51. 1
      web/client/src/utils/webapi.js
  52. 130
      web/log/development.txt

20
api/app/lib/controllers/organization/user.js

@ -170,8 +170,10 @@ async function delDept(ctx, next) {
async function getUser(ctx, next) {
try {
const models = ctx.fs.dc.models;
const { depId } = ctx.params
const userRes = await models.User.findAll({
const { depId } = ctx.params;
let userRes = null;
if (depId !== 'null') {
userRes = await models.User.findAll({
where: {
departmentId: parseInt(depId),
delete: false
@ -179,6 +181,20 @@ async function getUser(ctx, next) {
attributes: { exclude: ['password'] },
order: [['id', 'asc']],
})
} else {
userRes = await models.User.findAll({
where: {
delete: false
},
attributes: { exclude: ['password'] },
order: [['id', 'asc']],
include: [{
required: true,
model: models.Department,
attributes: ['id', 'name'],
}]
})
}
ctx.status = 200;
ctx.body = userRes

113
api/app/lib/controllers/patrolPlan/patrolPlan.js

@ -0,0 +1,113 @@
'use strict';
async function getPatrolPlan(ctx, next) {
try {
const models = ctx.fs.dc.models;
const { limit, page } = ctx.query;
let options = {
include: [{
required: true,
model: models.User,
attributes: ['id', 'name'],
include: [{
required: true,
model: models.Department,
attributes: ['id', 'name'],
}]
}, {
required: true,
model: models.Project,
attributes: ['id', 'name'],
}]
};
if (limit) {
options.limit = Number(limit);
}
if (page && limit) {
options.offset = Number(page) * Number(limit);
}
let res = await models.PatrolPlan.findAndCountAll(options);
ctx.status = 200;
ctx.body = res;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
"message": "获取巡检计划失败"
}
}
}
async function createPatrolPlan(ctx, next) {
try {
const models = ctx.fs.dc.models;
const data = ctx.request.body;
const { name, way, structureId, startTime, endTime, frequency, points, userId } = data;
let plan = { name, way, structureId, startTime, endTime, frequency, points, userId };
await models.PatrolPlan.create(plan);
ctx.status = 204;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
"message": '新增巡检计划失败'
}
}
}
async function updatePatrolPlan(ctx, next) {
try {
let errMsg = '修改巡检计划失败';
const models = ctx.fs.dc.models;
const data = ctx.request.body;
const { name, way, structureId, startTime, endTime, frequency, points, userId } = data;
let plan = { name, way, structureId, startTime, endTime, frequency, points, userId };
if (data && data.id) {
await models.PatrolPlan.update(plan, {
where: { id: data.id }
})
} else {
errMsg = '请传入巡检计划id';
throw errMsg;
}
ctx.status = 204;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
"message": errMsg
}
}
}
async function delPatrolPlan(ctx, next) {
try {
const models = ctx.fs.dc.models;
const { id } = ctx.params;
await models.PatrolPlan.destroy({
where: { id }
})
ctx.status = 204;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
"message": '删除巡检计划失败'
}
}
}
module.exports = {
getPatrolPlan,
createPatrolPlan,
updatePatrolPlan,
delPatrolPlan,
}

78
api/app/lib/controllers/projectRegime/projectSituation.js

@ -242,6 +242,81 @@ async function qrCodeShow (ctx, next) {
}
async function q(ctx) {
// let error = {
// name: 'FindError',
// message: "获取失败!"
// };
// const models = ctx.fs.dc.models;
// const { devices } = ctx.request.body
// const attachment = ctx.app.fs.qn_attachment
// try {
// if (!Array.isArray(devices)) {
// error = { name: 'paramsError', message: '参数不能为空' };
// ctx.throw(400);
// }
// const devicesArr = await models.Device.findAll({
// attributes: ['deviceNo', 'periodCode', 'qrSrc'],
// where: { deviceNo: { $in: devices } }
// })
// let ids = [], idsMap = {}, qnImages = []
// devicesArr.forEach(d => {
// const qrSrc = d.qrSrc
// const deviceNo = d.deviceNo
// const periodCode = d.periodCode
// if (qrSrc) {
// if (/^\d+$/.test(qrSrc)) {
// ids.push(qrSrc)
// idsMap[qrSrc] = { deviceNo, periodCode }
// } else {
// let domain = globalCache.getQnDomain()
// let imgUrl = `${domain}/${qrSrc}`
// qnImages.push({ src: imgUrl, deviceNo, periodCode })
// }
// }
// })
// const docs = await models.QrcodePng.findAll({
// where: {
// id: { $in: ids }
// },
// attributes: ["id", "base64"]
// })
// let pics = []
// if (docs.length > 0) {
// pics = docs.map((d) => {
// let { deviceNo, periodCode } = idsMap[d.id] || {}
// let base64 = d.base64.replace(/^data:image\/\w+;base64,/, '')
// return {
// url: Buffer.from(base64, 'base64'),
// name: deviceNo,
// periodCode
// }
// })
// }
// if (qnImages.length > 0) {
// let qns = await downloadImgsAsBase64(qnImages)
// pics = pics.concat(qns)
// }
// let fileUrl = await downLoadImageBiz(pics, { zipName: "二维码_" + moment().format("YYYY-MM-DD-HH-mm-ss"), attachment })
// add2CleanCache(fileUrl, attachment)
// ctx.status = 200
// ctx.body = { fileUrl }
// } catch (err) {
// ctx.fs.logger.error(err);
// ctx.status = 400;
// ctx.body = error;
// }
}
module.exports = {
projectList,
postAddProject,
@ -249,5 +324,6 @@ module.exports = {
addPosition,
position,
delPosition,
qrCodeShow
qrCodeShow,
q
}

9
api/app/lib/index.js

@ -53,8 +53,7 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq
require(`./models/${filename}`)(dc)
});
const { Camera, Company, Department, Post, RoleGroup, Role, RoleResource, User, UserDepartment, UserPost, Site, ProjectDisclosure, ProjectDisclosureFiles, Coordinate, ProblemReport, ProblemReportFile, Worker, WorkerAttendance,
RiskReport, Metting, HideDangerRectify, HideDangerRectifySites, HideDangerDispose, UserResource, Resource, Project, Point
const { Department, User, UserResource, Resource, Project, Point, PatrolPlan
} = dc.models;
UserResource.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' });
@ -69,4 +68,10 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq
Point.belongsTo(Project, { foreignKey: 'projectId', targetKey: 'id' });
Project.hasMany(Point, { foreignKey: 'projectId', sourceKey: 'id' });
PatrolPlan.belongsTo(Project, { foreignKey: 'structureId', targetKey: 'id' });
Project.hasMany(PatrolPlan, { foreignKey: 'structureId', sourceKey: 'id' });
PatrolPlan.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' });
User.hasMany(PatrolPlan, { foreignKey: 'userId', sourceKey: 'id' });
};

98
api/app/lib/models/camera.js

@ -1,98 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Camera = sequelize.define("camera", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "camera_id_uindex"
},
siteId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: "工地id",
primaryKey: false,
field: "site_id",
autoIncrement: false,
},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: "工地id",
primaryKey: false,
field: "user_id",
autoIncrement: false,
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
type: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "type",
autoIncrement: false
},
online: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "online",
autoIncrement: false
},
channelNo: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "channelNo",
autoIncrement: false
},
serialNo: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "serialNo",
autoIncrement: false
},
vender: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "vender",
autoIncrement: false
},
}, {
tableName: "camera",
comment: "摄像头",
indexes: []
});
dc.models.Camera = Camera;
return Camera;
};

52
api/app/lib/models/company.js

@ -1,52 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Company = sequelize.define("company", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "company_id_uindex"
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
relateSites: {
type: DataTypes.ARRAY(DataTypes.INTEGER),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "relate_sites",
autoIncrement: false
},
del: {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "del",
autoIncrement: false
}
}, {
tableName: "company",
comment: "",
indexes: []
});
dc.models.Company = Company;
return Company;
};

130
api/app/lib/models/coordinate.js

@ -1,130 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Coordinate = sequelize.define("coordinate", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
},
siteId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: '工地id',
primaryKey: false,
field: "site_id",
autoIncrement: false
},
title: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: '申请协调标题',
primaryKey: false,
field: "title",
},
emergencyDegree: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: '紧急程度',
primaryKey: false,
field: "emergency_degree",
},
status: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: '协调状态',
primaryKey: false,
field: "status",
},
time: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: '申请时间',
primaryKey: false,
field: "time",
},
describe: {
type: DataTypes.TEXT,
allowNull: false,
defaultValue: null,
comment: '申请描述',
primaryKey: false,
field: "describe",
},
accessory: {
type: DataTypes.JSON,
allowNull: true,
defaultValue: null,
comment: '附件',
primaryKey: false,
field: "accessory",
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: '申请人',
primaryKey: false,
field: "name",
},
applySite: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: '申请工地',
primaryKey: false,
field: "apply_site",
},
coordinateTime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: '协调时间',
primaryKey: false,
field: "coordinate_time",
},
coordinator: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '协调人',
primaryKey: false,
field: "coordinator",
},
coordinateDescribe: {
type: DataTypes.TEXT,
allowNull: true,
defaultValue: null,
comment: '协调描述',
primaryKey: false,
field: "coordinate_describe",
},
coordinateFile: {
type: DataTypes.JSON,
allowNull: true,
defaultValue: null,
comment: '协调附件',
primaryKey: false,
field: "coordinate_file",
},
}, {
tableName: "coordinate",
comment: "",
indexes: []
});
dc.models.Coordinate = Coordinate;
return Coordinate;
};

89
api/app/lib/models/hide_danger_dispose.js

@ -1,89 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const HideDangerDispose = sequelize.define("hideDangerDispose", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "hide_danger_dispose_id_uindex"
},
rectifySiteId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "rectify_site_id",
autoIncrement: false
},
disposeUser: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "dispose_user",
autoIncrement: false
},
disposeTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "dispose_time",
autoIncrement: false
},
describe: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "describe",
autoIncrement: false
},
file: {
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "file",
autoIncrement: false
},
type: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: "1:整改 2:审核 3:复审",
primaryKey: false,
field: "type",
autoIncrement: false
},
admit: {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: null,
comment: "是否通过审核",
primaryKey: false,
field: "admit",
autoIncrement: false
}
}, {
tableName: "hide_danger_dispose",
comment: "",
indexes: []
});
dc.models.HideDangerDispose = HideDangerDispose;
return HideDangerDispose;
};

107
api/app/lib/models/hide_danger_rectify.js

@ -1,107 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const HideDangerRectify = sequelize.define("hideDangerRectify", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "hide_danger_rectify_id_uindex"
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
places: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "places",
autoIncrement: false
},
type: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "type",
autoIncrement: false
},
level: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "level",
autoIncrement: false
},
desc: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "desc",
autoIncrement: false
},
deadline: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "deadline",
autoIncrement: false
},
user: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "user",
autoIncrement: false
},
createTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "create_time",
autoIncrement: false
},
from: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: "1:集团 2:公司 3:项目",
primaryKey: false,
field: "from",
autoIncrement: false
}
}, {
tableName: "hide_danger_rectify",
comment: "",
indexes: []
});
dc.models.HideDangerRectify = HideDangerRectify;
return HideDangerRectify;
};

62
api/app/lib/models/hide_danger_rectify_sites.js

@ -1,62 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const HideDangerRectifySites = sequelize.define("hideDangerRectifySites", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "hide_danger_rectify_sites_id_uindex"
},
rectifyId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "rectify_id",
autoIncrement: false
},
siteId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "site_id",
autoIncrement: false
},
status: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: "0: 已下发, 待整改,\n1: 已整改, 待审核,\n2: 审核通过, 待复审,\n3: 审核未通过, 待重新整改,\n4: 复审未通过, 待重新整改,\n5: 整改完成",
primaryKey: false,
field: "status",
autoIncrement: false
},
lastDisposeTime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "last_dispose_time",
autoIncrement: false
}
}, {
tableName: "hide_danger_rectify_sites",
comment: "",
indexes: []
});
dc.models.HideDangerRectifySites = HideDangerRectifySites;
return HideDangerRectifySites;
};

88
api/app/lib/models/hide_danger_report.js

@ -1,88 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const HideDangerReport = sequelize.define("hideDangerReport", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "hide_danger_report_id_uindex"
},
siteCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: "0",
comment: null,
primaryKey: false,
field: "site_count",
autoIncrement: false
},
rectifyCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: "0",
comment: null,
primaryKey: false,
field: "rectify_count",
autoIncrement: false
},
completedRectifyCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: "0",
comment: null,
primaryKey: false,
field: "completed_rectify_count",
autoIncrement: false
},
uncompletedRectifyCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: "0",
comment: null,
primaryKey: false,
field: "uncompleted_rectify_count",
autoIncrement: false
},
report: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "report",
autoIncrement: false
},
type: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "month 月 / quarter 季度 / year 年",
primaryKey: false,
field: "type",
autoIncrement: false
},
time: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "time",
autoIncrement: false
}
}, {
tableName: "hide_danger_report",
comment: "",
indexes: []
});
dc.models.HideDangerReport = HideDangerReport;
return HideDangerReport;
};

115
api/app/lib/models/metting.js

@ -1,115 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Metting = sequelize.define("metting", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "metting_id_uindex"
},
siteId: {
type: DataTypes.INTEGER,
//allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "site_id",
autoIncrement: false
},
name: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
type: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "type",
autoIncrement: false
},
desc: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "desc",
autoIncrement: false
},
signFile: {
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "sign_file",
autoIncrement: false
},
recordingVideo: {
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "recording_video",
autoIncrement: false
},
attachments: {
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "attachments",
autoIncrement: false
},
submitUser: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "submit_user",
autoIncrement: false
},
submitTime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "submit_time",
autoIncrement: false
},
date: {
type: DataTypes.DATEONLY,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "date",
autoIncrement: false
}
}, {
tableName: "metting",
comment: "",
indexes: []
});
dc.models.Metting = Metting;
return Metting;
};

74
api/app/lib/models/problem_report.js → api/app/lib/models/patrol_plan.js

@ -4,7 +4,7 @@
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const ProblemReport = sequelize.define("problemReport", {
const PatrolPlan = sequelize.define("PatrolPlan", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
@ -12,98 +12,94 @@ module.exports = dc => {
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true
autoIncrement: true,
unique: "patrol_plan_id_uindex"
},
siteId: {
type: DataTypes.INTEGER,
allowNull: true,
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "siteId",
field: "name",
autoIncrement: false
},
type: {
type: DataTypes.INTEGER,
way: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "type",
field: "way",
autoIncrement: false
},
title: {
type: DataTypes.STRING,
structureId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "title",
field: "structure_id",
autoIncrement: false
},
describe: {
type: DataTypes.STRING,
startTime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "describe",
field: "start_time",
autoIncrement: false
},
urgencyDegree: {
type: DataTypes.STRING,
endTime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "urgency_degree",
field: "end_time",
autoIncrement: false
},
isReaded: {
type: DataTypes.BOOLEAN,
frequency: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "isReaded",
field: "frequency",
autoIncrement: false
},
reportTime: {
type: DataTypes.DATE,
points: {
type: DataTypes.JSONB,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "report_time",
field: "points",
autoIncrement: false
},
reporter: {
userId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "reporter",
field: "user_id",
autoIncrement: false,
references: {
key: "id",
model: "tUser"
}
},
source: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
patrolCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
comment: null,
primaryKey: false,
field: "source",
field: "patrol_count",
autoIncrement: false
},
}, {
tableName: "problem_report",
tableName: "patrol_plan",
comment: "",
indexes: []
});
dc.models.ProblemReport = ProblemReport;
return ProblemReport;
dc.models.PatrolPlan = PatrolPlan;
return PatrolPlan;
};

60
api/app/lib/models/phone_validate_code.js

@ -1,60 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const PhoneValidateCode = sequelize.define("phoneValidateCode", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true
},
phone: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "phone",
autoIncrement: false
},
code: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "code",
autoIncrement: false
},
sig: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "sig",
autoIncrement: false
},
expired: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "expired",
autoIncrement: false
}
}, {
tableName: "phone_validate_code",
comment: "",
indexes: []
});
dc.models.PhoneValidateCode = PhoneValidateCode;
return PhoneValidateCode;
};

69
api/app/lib/models/post.js

@ -1,69 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Post = sequelize.define("post", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "post_id_uindex"
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
companyId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "company_id",
autoIncrement: false,
references: {
key: "id",
model: "tCompany"
}
},
departmentId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "department_id",
autoIncrement: false,
references: {
key: "id",
model: "tDepartment"
}
},
del: {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "del",
autoIncrement: false
}
}, {
tableName: "post",
comment: "",
indexes: []
});
dc.models.Post = Post;
return Post;
};

59
api/app/lib/models/problem_report_consult.js

@ -1,59 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const ProblemReportConsult = sequelize.define("problemReportConsult", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
},
siteId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: '工地id',
primaryKey: false,
field: "site_id",
autoIncrement: false
},
problemId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: '问题id',
primaryKey: false,
field: "problem_id",
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: '查阅人员',
primaryKey: false,
field: "name",
},
time: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: '查阅时间',
primaryKey: false,
field: "time",
},
}, {
tableName: "problem_report_consult",
comment: "",
indexes: []
});
dc.models.ProblemReportConsult = ProblemReportConsult;
return ProblemReportConsult;
};

64
api/app/lib/models/problem_report_file.js

@ -1,64 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const ProblemReportFile = sequelize.define("problemReportFile", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true
},
reportId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "reportId",
autoIncrement: false,
references: {
key: "id",
model: "tProblemReport"
}
},
filePath: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "filePath",
autoIncrement: false
},
fileSize: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "fileSize",
autoIncrement: false
},
fileName: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "fileName",
autoIncrement: false
}
}, {
tableName: "problem_report_file",
comment: "",
indexes: []
});
dc.models.ProblemReportFile = ProblemReportFile;
return ProblemReportFile;
};

70
api/app/lib/models/project_disclosure.js

@ -1,70 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const ProjectDisclosure = sequelize.define("projectDisclosure", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "project_disclosure_id_uindex"
},
siteId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "site_id",
autoIncrement: false
},
type: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "type",
autoIncrement: false
},
desc: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "desc",
autoIncrement: false
},
submiter: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "submiter",
autoIncrement: false
},
submitTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "submit_time",
autoIncrement: false
}
}, {
tableName: "project_disclosure",
comment: "",
indexes: []
});
dc.models.ProjectDisclosure = ProjectDisclosure;
return ProjectDisclosure;
};

65
api/app/lib/models/project_disclosure_files.js

@ -1,65 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const ProjectDisclosureFiles = sequelize.define("projectDisclosureFiles", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "project_disclosure_files_id_uindex"
},
projectDisclosureId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "project_disclosure_id",
autoIncrement: false,
references: {
key: "id",
model: "projectDisclosure"
}
},
fileName: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "file_name",
autoIncrement: false
},
fileSize: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "file_size",
autoIncrement: false
},
fileLink: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "file_link",
autoIncrement: false
}
}, {
tableName: "project_disclosure_files",
comment: "",
indexes: []
});
dc.models.ProjectDisclosureFiles = ProjectDisclosureFiles;
return ProjectDisclosureFiles;
};

170
api/app/lib/models/risk_report.js

@ -1,170 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const RiskReport = sequelize.define("riskReport", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "table_name_id_uindex"
},
siteId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "site_id",
autoIncrement: false
},
name: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
riskLevel: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "风险等级",
primaryKey: false,
field: "risk_level",
autoIncrement: false
},
specialType: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "特种作业类型",
primaryKey: false,
field: "special_type",
autoIncrement: false
},
contentFiles: {
type: DataTypes.JSON,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "content_files",
autoIncrement: false
},
content: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "施工内容描述",
primaryKey: false,
field: "content",
autoIncrement: false
},
phone: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "联系方式",
primaryKey: false,
field: "phone",
autoIncrement: false
},
guardian: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "现场监护人",
primaryKey: false,
field: "guardian",
autoIncrement: false
},
controlMeasuresFiles: {
type: DataTypes.JSON,
allowNull: false,
defaultValue: null,
comment: "管控措施附件",
primaryKey: false,
field: "control_measures_files",
autoIncrement: false
},
saftyMeasuresFiles: {
type: DataTypes.JSON,
allowNull: false,
defaultValue: null,
comment: "安全措施附件",
primaryKey: false,
field: "safty_measures_files",
autoIncrement: false
},
operationTicketFiles: {
type: DataTypes.JSON,
allowNull: false,
defaultValue: null,
comment: "作业票附件",
primaryKey: false,
field: "operation_ticket_files",
autoIncrement: false
},
controlMeasures: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "管控措施描述",
primaryKey: false,
field: "control_measures",
autoIncrement: false
},
saftyMeasures: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "安全措施描述",
primaryKey: false,
field: "safty_measures",
autoIncrement: false
},
operationTicket: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "作业票描述",
primaryKey: false,
field: "operation_ticket",
autoIncrement: false
},
state: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "登记状态",
primaryKey: false,
field: "state",
autoIncrement: false
},
createTime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "create_time",
autoIncrement: false
}
}, {
tableName: "risk_report",
comment: "",
indexes: []
});
dc.models.RiskReport = RiskReport;
return RiskReport;
};

74
api/app/lib/models/role.js

@ -1,74 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Role = sequelize.define("role", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "role_id_uindex"
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
roleGroupId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "role_group_id",
autoIncrement: false,
references: {
key: "id",
model: "tRoleGroup"
}
},
type: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: "1:集团 2:公司 3:项目",
primaryKey: false,
field: "type",
autoIncrement: false
},
dataRange: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: "1:全公司 2:本人 3:本部门 ",
primaryKey: false,
field: "data_range",
autoIncrement: false
},
del: {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "del",
autoIncrement: false
}
}, {
tableName: "role",
comment: "",
indexes: []
});
dc.models.Role = Role;
return Role;
};

43
api/app/lib/models/role_group.js

@ -1,43 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const RoleGroup = sequelize.define("roleGroup", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "role_group_id_uindex"
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
del: {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "del",
autoIncrement: false
}
}, {
tableName: "role_group",
comment: "",
indexes: []
});
dc.models.RoleGroup = RoleGroup;
return RoleGroup;
};

47
api/app/lib/models/role_resource.js

@ -1,47 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const RoleResource = sequelize.define("roleResource", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "role_resource_id_uindex"
},
roleId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "role_id",
autoIncrement: false,
references: {
key: "id",
model: "tRole"
}
},
resourceCode: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "resource_code",
autoIncrement: false
}
}, {
tableName: "role_resource",
comment: "",
indexes: []
});
dc.models.RoleResource = RoleResource;
return RoleResource;
};

69
api/app/lib/models/safety_cultivate.js

@ -1,69 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const SafetyCultivate = sequelize.define("safety_cultivate", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
interlinkage: {
type: DataTypes.JSON,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "interlinkage",
autoIncrement: false
} ,
type: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "type",
autoIncrement: false
},
time: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "time",
autoIncrement: false
},
siteId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "site_id",
autoIncrement: false
},
}, {
tableName: "safety_cultivate",
comment: "",
indexes: []
});
dc.models.SafetyCultivate = SafetyCultivate;
return SafetyCultivate;
};

53
api/app/lib/models/user_deal_todo.js

@ -1,53 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const UserDealTodo = sequelize.define("userDealTodo", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "user_deal_todo_id_uindex"
},
userId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "user_id",
autoIncrement: false
},
moduleId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "module_id",
autoIncrement: false
},
module: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "module",
autoIncrement: false
}
}, {
tableName: "user_deal_todo",
comment: "",
indexes: []
});
dc.models.UserDealTodo = UserDealTodo;
return UserDealTodo;
};

51
api/app/lib/models/user_department.js

@ -1,51 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const UserDepartment = sequelize.define("userDepartment", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "user_department_id_uindex"
},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "user_id",
autoIncrement: false,
references: {
key: "id",
model: "tUser"
}
},
departmentId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "department_id",
autoIncrement: false,
references: {
key: "id",
model: "tDepartment"
}
}
}, {
tableName: "user_department",
comment: "",
indexes: []
});
dc.models.UserDepartment = UserDepartment;
return UserDepartment;
};

51
api/app/lib/models/user_post.js

@ -1,51 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const UserPost = sequelize.define("userPost", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "user_post_id_uindex"
},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "user_id",
autoIncrement: false,
references: {
key: "id",
model: "tUser"
}
},
postId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "post_id",
autoIncrement: false,
references: {
key: "id",
model: "tPost"
}
}
}, {
tableName: "user_post",
comment: "",
indexes: []
});
dc.models.UserPost = UserPost;
return UserPost;
};

134
api/app/lib/models/worker.js

@ -1,134 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Worker = sequelize.define("worker", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "worker_id_uindex"
},
siteId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "site_id",
autoIncrement: false
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
gender: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "gender",
autoIncrement: false
},
photo: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "photo",
autoIncrement: false
},
nation: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "nation",
autoIncrement: false
},
nativePlace: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "native_place",
autoIncrement: false
},
idCard: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "id_card",
autoIncrement: false
},
tel: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "tel",
autoIncrement: false
},
groupId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "group_id",
autoIncrement: false
},
workTypeId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "work_type_id",
autoIncrement: false
},
isLeader: {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "is_leader",
autoIncrement: false
},
status: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: "1:在册,0:已退场",
primaryKey: false,
field: "status",
autoIncrement: false
}
}, {
tableName: "worker",
comment: "",
indexes: []
});
dc.models.Worker = Worker;
return Worker;
};

74
api/app/lib/models/worker_attendance.js

@ -1,74 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const WorkerAttendance = sequelize.define("workerAttendance", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
},
siteId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: '工地id',
primaryKey: false,
field: "site_id",
autoIncrement: false
},
workerId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: '工人id',
primaryKey: false,
field: "worker_id",
},
temperature: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: '体温',
primaryKey: false,
field: "temperature",
},
code: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: '健康码',
primaryKey: false,
field: "code",
},
type: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: '进出类型',
primaryKey: false,
field: "type",
},
time: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: '通行时间',
primaryKey: false,
field: "time",
}
}, {
tableName: "worker_attendance",
comment: "",
indexes: []
});
dc.models.WorkerAttendance = WorkerAttendance;
return WorkerAttendance;
};

124
api/app/lib/models/xuncheck_task.js

@ -1,124 +0,0 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const xunCheckTask = sequelize.define("xuncheckTask", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true
},
inspectiontaskname: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "inspectiontaskname",
comment: "巡检任务名",
autoIncrement: false
},
inspectionnum: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "inspectionnum",
comment: "巡检频次",
autoIncrement: false
},
taskperiod: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "taskperiod",
comment: "任务周期",
autoIncrement: false
},
checkContent: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "checkContent",
comment: "巡检点",
autoIncrement: false
},
contentList: {
type: DataTypes.JSONB,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
comment: "巡检点列表",
field: "contentList",
autoIncrement: false
},
insectionuser: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "insectionuser",
comment: "巡检人员",
autoIncrement: false
},
status: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "status",
comment: "巡检状态",
autoIncrement: false
},
starTime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: null,
comment: "巡检开始时间",
primaryKey: false,
field: "star_time",
autoIncrement: false
},
endTime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "end_time",
comment: "巡检结束时间",
autoIncrement: false
},
path: {
type: DataTypes.JSONB,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "path",
comment: "文件路径",
autoIncrement: false
},
}, {
tableName: "t_xuncheck_tasks",
comment: "",
indexes: []
});
dc.models.xunCheckTask = xunCheckTask;
return xunCheckTask;
};

17
api/app/lib/routes/patrolPlan/patrolPlan.js

@ -0,0 +1,17 @@
'use strict';
const patrolPlan = require('../../controllers/patrolPlan/patrolPlan');
module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/patrolPlan'] = { content: '获取巡检计划', visible: false };
router.get('/patrolPlan', patrolPlan.getPatrolPlan);
app.fs.api.logAttr['POST/patrolPlan'] = { content: '新增巡检计划', visible: true };
router.post('/patrolPlan', patrolPlan.createPatrolPlan);
app.fs.api.logAttr['PUT/patrolPlan'] = { content: '修改巡检计划', visible: true };
router.put('/patrolPlan', patrolPlan.updatePatrolPlan);
app.fs.api.logAttr['DELETE/patrolPlan/:id'] = { content: '删除巡检计划', visible: true };
router.del('/patrolPlan/:id', patrolPlan.delPatrolPlan);
};

3
api/app/lib/routes/projectRegime/index.js

@ -25,4 +25,7 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/qrCodeShow'] = { content: '获取二维码列表', visible: false };
router.get('/qrCodeShow', projectSituation.qrCodeShow);
app.fs.api.logAttr['GET/q'] = { content: '获取二维码列表', visible: false };
router.get('/q', projectSituation.q);
}

7
api/config.js

@ -23,7 +23,7 @@ args.option('aliOssRegion', '阿里OSS Region');
const flags = args.parse(process.argv);
const ZHONGDING_DB = process.env.ZHONGDING_DB || flags.pg;
const XUNJIAN_DB = process.env.XUNJIAN_DB || flags.pg;
// 七牛云存储参数
const QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || flags.qndmn;
@ -37,7 +37,8 @@ const ALI_OSS_SECRETKET = process.env.ALI_OSS_SECRETKET || flags.aliOssSecretKey
const ALI_OSS_BUCKET = process.env.ALI_OSS_BUCKET || flags.aliOssBucket;
const ALI_OSS_REGION = process.env.ALI_OSS_REGION || flags.aliOssRegion;
if (!ZHONGDING_DB || !QINIU_DOMAIN_QNDMN_RESOURCE || !QINIU_BUCKET_RESOURCE || !QINIU_AK || !QINIU_SK) {
if (!XUNJIAN_DB || !QINIU_DOMAIN_QNDMN_RESOURCE || !QINIU_BUCKET_RESOURCE || !QINIU_AK || !QINIU_SK) {
console.log('缺少启动参数,异常退出');
args.showHelp();
process.exit(-1);
@ -96,7 +97,7 @@ const product = {
}
],
dc: {
url: ZHONGDING_DB,
url: XUNJIAN_DB,
opts: {
pool: {
max: 80,

32
api/log/development.log

@ -3865,3 +3865,35 @@ notNull Violation: project.describe cannot be null
2023-01-17 11:00:49.835 - debug: [FS-LOGGER] Init.
2023-01-17 11:00:50.799 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-17 11:00:50.799 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-17 16:24:18.099 - debug: [FS-LOGGER] Init.
2023-01-17 16:24:19.169 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-17 16:24:19.169 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-17 16:29:24.545 - error: path: /patrolPlan, error: SequelizeDatabaseError: relation "patrol_plan" does not exist
2023-01-17 16:30:55.708 - error: path: /patrolPlan, error: SequelizeDatabaseError: relation "patrol_plan" does not exist
2023-01-17 17:04:11.489 - error: path: /patrolPlan, error: SequelizeDatabaseError: relation "patrol_plan" does not exist
2023-01-17 17:34:08.720 - debug: [FS-LOGGER] Init.
2023-01-17 17:34:09.424 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-17 17:34:09.425 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-17 17:54:21.406 - error: [FS-ERRHD]
{
message: 'transaction is not defined',
stack: 'ReferenceError: transaction is not defined\n' +
' at login (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)\n' +
' at async auth (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\middlewares\\authenticator.js:144:13)'
}
2023-01-17 17:54:32.256 - error: [FS-ERRHD]
{
message: 'transaction is not defined',
stack: 'ReferenceError: transaction is not defined\n' +
' at login (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)\n' +
' at async auth (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\middlewares\\authenticator.js:144:13)'
}
2023-01-17 17:54:56.524 - debug: [FS-LOGGER] Init.
2023-01-17 17:54:57.554 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-17 17:54:57.555 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-17 17:55:16.799 - debug: [FS-LOGGER] Init.
2023-01-17 17:55:16.964 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-17 17:55:16.965 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-17 18:19:08.094 - debug: [FS-LOGGER] Init.
2023-01-17 18:19:08.273 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-17 18:19:08.273 - info: [FS-AUTH] Inject auth and api mv into router.

6
script/1.0.0/schema/2.create.project.sql

@ -10,7 +10,7 @@ create table project
describe varchar(255),
user_id integer,
img character varying[],
qr_code varchar(255)
qr_code varchar
);
create table point
@ -22,6 +22,6 @@ create table point
longitude integer,
latitude integer,
describe varchar(255),
qr_code varchar(255),
qr_code varchar,
project_id integer
);
)

20
script/1.0.0/schema/3.create_patrol_plan.sql

@ -0,0 +1,20 @@
DROP SEQUENCE if EXISTS "public"."patrol_plan_id_seq";
CREATE SEQUENCE "public"."patrol_plan_id_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
DROP TABLE IF EXISTS "public"."patrol_plan";
CREATE TABLE "public"."patrol_plan" (
"id" int4 NOT NULL PRIMARY KEY DEFAULT nextval('patrol_plan_id_seq'::regclass),
"name" varchar(128) NOT NULL,
"way" varchar(128),
"structure_id" int4,
"start_time" timestamp(6),
"end_time" timestamp(6),
"frequency" varchar(64),
"points" jsonb,
"user_id" int4,
"patrol_count" int4 NOT NULL DEFAULT 0
);

53
web/Dockerfile

@ -1,21 +1,56 @@
#FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2
FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2
COPY . /var/app
WORKDIR /var/app
EXPOSE 8080
RUN apk update && apk add --no-cache \
sudo \
curl \
build-base \
g++ \
libpng \
libpng-dev \
jpeg-dev \
pango-dev \
cairo-dev \
giflib-dev \
python \
;
RUN npm config set registry=http://10.8.30.22:7000
RUN npm cache clean -f
RUN npm install --registry http://10.8.30.22:7000 --legacy-peer-deps
RUN export NODE_OPTIONS=--max_old_space_size=4096&&npm run build
#RUN npm install -g node-gyp
RUN rm -rf package-lock.json
RUN npm install --registry http://10.8.30.22:7000
RUN npm run build
RUN rm -rf client/src
RUN rm -rf node_modules
RUN npm install --production --registry http://10.8.30.22:7000
#RUN npm cache clean -f && npm install --production --force --registry http://10.8.30.22:7000
CMD ["-u", "http://localhost:8088"]
ENTRYPOINT [ "node", "server.js" ]
# FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder
# COPY . /var/app
# WORKDIR /var/app
# EXPOSE 8080
# RUN npm config set registry=http://10.8.30.22:7000
# RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json
# RUN npm cache clean -f
# RUN rm -rf package-lock.json
# RUN npm install --registry http://10.8.30.22:7000
# RUN npm run build
# RUN rm -rf client/src
# RUN rm -rf node_modules
# RUN npm install --production --force --registry http://10.8.30.22:7000
# FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12
# COPY --from=builder --chown=node /var/app /home/node/app
# WORKDIR /home/node/app
# CMD ["node", "server.js"]

BIN
web/client/assets/images/login/login_a.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
web/client/assets/images/login/login_b.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

2
web/client/src/index.js

@ -4,4 +4,4 @@ import React from 'react';
import { render } from 'react-dom';
import App from './app';
render((<App projectName="巡检WEB" />), document.getElementById('App'));
render((<App projectName="运维巡检平台" />), document.getElementById('App'));

2
web/client/src/layout/components/header/index.js

@ -38,7 +38,7 @@ const Header = props => {
</span>
<div className={styles['header-title']} style={{}}>
{/* <img src='/assets/images/logo.png' style={{ margin: '0 12px 4px 12px', height: 42, borderRadius: 4 }} /> */}
巡检WEB
运维巡检平台
</div>
</div>
<div id="nav" className={styles['header-nav']}>

200
web/client/src/sections/auth/containers/login.js

@ -6,10 +6,11 @@ import SHA1 from 'crypto-js/sha1';
import Hex from 'crypto-js/enc-hex';
import { ApiTable } from '$utils'
import { Request } from '@peace/utils'
import { Button, Input, Form, Row, Col, message, Tabs } from 'antd';
import { Button, Input, Form, Row, Col, message, Tabs, Tooltip } from 'antd';
import { login, LOGIN_ERROR } from '../actions/auth';
import { ExclamationCircleOutlined } from '@ant-design/icons';
import { Uploads } from '$components'
import { LockOutlined, UserOutlined } from '@ant-design/icons';
import '../style.less';
const FormItem = Form.Item;
@ -26,7 +27,7 @@ const Login = props => {
const [codSending, setCodSending] = useState(false)
const [codCountDown, setCodeCountDown] = useState(60)
const codCountDownRef = useRef(0)
const [form] = Form.useForm();
useEffect(() => {
}, [])
@ -62,30 +63,7 @@ const Login = props => {
}
}, [codSending])
const doLogin = () => {
if (curTabKey == 1) {
if (!username || !password)
dispatch({
type: LOGIN_ERROR,
payload: { error: '请输入账号名和密码' }
});
setInputChanged(false)
dispatch(login({ username, password }));
} else {
if (!phone || !code)
dispatch({
type: LOGIN_ERROR,
payload: { error: '请输入手机号和验证码' }
});
dispatch(login({ phone, code }));
}
}
const enterHandler = e => {
if (e.key === 'Enter') {
doLogin()
}
};
return (
<div
@ -96,153 +74,63 @@ const Login = props => {
alignItems: 'center',
justifyContent: 'center',
color: 'aliceblue',
backgroundImage: 'url(/assets/images/login_bg.png)'
backgroundImage: 'url(/assets/images/login/login_b.png)',
backgroundSize: 'cover',
position: 'relative',
}}
>
<img src='/assets/images/logo.png' style={{ height: 42, borderRadius: 4, position: 'fixed', top: 32, left: 32 }} />
{/* <img src='/assets/images/logo.png' style={{ height: 42, borderRadius: 4, position: 'fixed', top: 32, left: 32 }} /> */}
<div style={{ width: 1000, backgroundColor: '#01316d', borderRadius: 24 }}>
<Row>
<Col span={12} style={{}}>
<img src='/assets/images/login.png' width={'100%'} />
</Col>
<Col span={12}>
<div style={{
width: '100%',
height: '100%',
padding: 30,
display: 'flex',
flexDirection: 'column',
justifyContent: 'space-around'
width: 556, height: 434, backgroundColor: '#rgba(255,255,255,0.50)',
borderRadius: '2px 2px 0 0', boxShadow: 'inset 0 0 8px 0 rgba(50,131,255,0.25)',
display: 'flex', alignItems: 'center', justifyContent: 'center', position: 'absolute', right: 150, top: 'calc(50% - 217px)'
}}>
<p style={{ fontSize: 30, fontWeight: 'bold', textAlign: 'center' }}>
中鼎国际工程项目指挥调度系统
</p>
<Tabs defaultActiveKey="1" animated={true} onChange={(k) => {
setCurTabKey(k)
<div style={{
width: 410,
height: 322,
backgroundColor: ''
}}>
<Tabs.TabPane tab="用户名登录" key="1">
<Form onKeyDown={enterHandler}>
<div style={{ fontSize: 10, fontWeight: 'bold' }}>
用户名
</div>
<FormItem name="username">
<Input
type="text"
size="large"
value={username}
placeholder="用户名"
onChange={e => {
setUserName(e.target.value)
setInputChanged(true)
}}
/>
</FormItem>
<div style={{ fontSize: 10, fontWeight: 'bold' }}>
密码
</div>
<FormItem name="password">
<Input
type="password"
size="large"
value={password}
placeholder="密码"
onChange={e => {
setPassword(e.target.value)
setInputChanged(true)
}}
/>
</FormItem>
</Form>
</Tabs.TabPane>
<Tabs.TabPane tab="手机登录" key="2" disabled>
<Form onKeyDown={enterHandler}>
<div style={{ fontSize: 10, fontWeight: 'bold' }}>
手机号
</div>
<FormItem name="phone" rules={[{ pattern: /^1[3|4|5|7|8|9]\d{9}$/, message: '请输入正确的手机号码' }]}>
<Input
type="text"
size="large"
value={username}
onChange={e => {
setPhone(e.target.value)
setInputChanged(true)
}}
/>
</FormItem>
<div style={{ fontSize: 10, fontWeight: 'bold' }}>
验证码
</div>
<FormItem name="code">
<Input.Group compact>
<Input
size="large"
style={{ width: 'calc(100% - 112px)' }}
onChange={e => {
setCode(e.target.value)
setInputChanged(true)
}}
/>
<Button
size="large"
onClick={() => {
setCodSending(true)
const random = Math.floor(Math.random() * Math.pow(10, 4));
const sig = Hex.stringify(SHA1(phone + random));
setInputChanged(false)
Request.post(ApiTable.validatePhone, {
phone: phone,
r: random,
sig: sig
}).then(res => {
<img src={'/assets/images/login/login_a.png'} style={{ width: 124, height: 37, display: 'inline-block', marginBottom: 40 }} />
}, err => {
let message = err.response.body?.message
console.log(message);
<Form
form={form}
onFinish={r => {
form.validateFields().then(r => {
dispatch(login({ username: r.username, password: r.password }));
})
.catch(err => {
dispatch({
type: LOGIN_ERROR,
payload: { error: message || '获取验证码失败' }
});
setCodSending(false)
});
payload: { error: '请输入账号名和密码' }
})
})
}}
loading={codSending}
style={{ width: 112 }}
>
{codSending ? codCountDown + ' s' : '发送验证码'}
</Button>
</Input.Group>
</FormItem>
</Form>
</Tabs.TabPane>
</Tabs>
<Form.Item label='' name="username" rules={[{ required: true, message: '请输入用户名' },]}>
<Input prefix={<UserOutlined className="site-form-item-icon" />} placeholder="用户名" />
</Form.Item>
<Row style={{
textAlign: 'left'
}}>
{
inputChanged || !error ?
<span style={{
visibility: 'hidden'
}}>-</span> :
<span>
<ExclamationCircleOutlined style={{ color: 'red' }} />{error}
</span>
}
</Row>
<Button
shape="round"
size="large"
style={{ width: '100%' }}
loading={isRequesting}
onClick={doLogin}
<Form.Item label='' name="password" rules={[{ required: true, message: '请输入密码' },]}>
<Input prefix={<LockOutlined className="site-form-item-icon" />} placeholder="密码" />
</Form.Item>
<Tooltip title='请联系管理员'>
<a style={{ position: 'relative', left: 348, top: -17 }}>忘记密码</a>
</Tooltip>
<Form.Item
>
<Button type="primary" htmlType="submit" style={{ width: 410, height: 50 }}>
登录
</Button>
</Form.Item>
</Form>
</div>
</Col>
</Row>
</div>
</div >
);

3
web/client/src/sections/organization/containers/user.js

@ -9,9 +9,10 @@ import ResetPwd from '../components/resetPwd';
import DeptModal from '../components/deptModal';
const TreeNode = Tree.TreeNode;
const user = JSON.parse(sessionStorage.getItem('user'));
const UserManage = (props) => {
const user = JSON.parse(sessionStorage.getItem('user'));
const { dispatch, loading, depMessage, depUser, clientHeight } = props;
// 部门
const [deptModalVisible, setDeptModalVisible] = useState(false);

34
web/client/src/sections/patrolManage/actions/plan.js

@ -44,3 +44,37 @@ export function updatePatrolPlan(data) {
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: '获取点位列表失败', },
});
}

202
web/client/src/sections/patrolManage/components/planModal.js

@ -0,0 +1,202 @@
import { Button, Form, Input, Modal, Select, DatePicker } from 'antd';
import React, { useState, useEffect } from 'react';
import { connect } from 'react-redux';
import { getUserList, getProjectList, positionList } from '../actions/plan';
import moment from 'moment';
const { RangePicker } = DatePicker;
const PlanModal = ({ visible, onCreate, onCancel, dispatch, userLoading, userList, structureList, struLoading, type, curRecord }) => {
const [userOpt, setUserOpt] = useState();
const [struOpt, setStruOpt] = useState();
const [pointOpt, setPointOpt] = useState();
const [points, setPoints] = useState();
const [unit, setUnit] = useState('次/天');
const [form] = Form.useForm();
useEffect(() => {
if (type === 'view') {
} else {
dispatch(getUserList())
dispatch(getProjectList())
}
if (type === 'edit') {
dispatch(positionList({ projectId: curRecord?.project?.id })).then(res => {
if (res.success) {
setPoints(res.payload.data?.rows)
setPointOpt(res.payload.data?.rows[0]?.points?.map(p => ({ label: p.name, value: p.id })))
}
})
}
}, [])
useEffect(() => {
if (userList.length) {
setUserOpt(userList.map(u => ({ label: u.name, value: u.id })))
}
}, [userList])
useEffect(() => {
if (structureList?.rows?.length) {
setStruOpt(structureList?.rows?.map(s => ({ label: s.name, value: s.id })))
}
}, [structureList])
const selectAfter = (
<Select defaultValue="次/天" onChange={value => setUnit(value)}>
<Option value="次/天">/</Option>
<Option value="次/周">/</Option>
<Option value="次/月">/</Option>
</Select>
);
return (
<Modal
visible={visible}
title="新增巡检计划"
okText="确定"
cancelText="取消"
onCancel={() => {
form.resetFields();
onCancel();
}}
onOk={() => {
if (type === 'view') {
form.resetFields();
onCancel();
return;
}
form
.validateFields()
.then((values) => {
form.resetFields();
const params = {
...values,
frequency: values.frequency + unit,
startTime: values.time[0],
endTime: values.time[1],
points: points[0]?.points?.filter(p => values?.points?.includes(p.id))
}
onCreate(params);
})
.catch((info) => {
console.log('Validate Failed:', info);
});
}}
>
<Form
form={form}
layout="vertical"
name="form_in_modal"
initialValues={{
...curRecord,
time: [moment(curRecord?.startTime), moment(curRecord?.startTime)],
points: curRecord?.points?.map(p => p.id),
userDept: curRecord?.user?.department?.name,
frequency: curRecord?.frequency?.split('次')[0]
}}
disabled={type === 'view'}
>
<Form.Item
name="structureId"
label="结构物名称"
rules={[
{ required: true, message: '请选择结构物' },
]}
>
<Select disabled={type === 'view'} options={struOpt} loading={struLoading} onChange={(value) => {
dispatch(positionList({ projectId: value })).then(res => {
if (res.success) {
setPoints(res.payload.data?.rows)
setPointOpt(res.payload.data?.rows[0]?.points?.map(p => ({ label: p.name, value: p.id })))
}
})
}} />
</Form.Item>
<Form.Item
name="name"
label="巡检任务名称"
rules={[
{ required: true, message: '请输入巡检任务名称' },
]}
>
<Input disabled={type === 'view'} />
</Form.Item>
<Form.Item
name="way"
label="巡检方式"
rules={[
{ required: true, message: '请选择巡检方式' },
]}
initialValue='周期巡检'
>
<Select options={[{
label: '周期巡检',
value: '周期巡检'
}]} disabled />
</Form.Item>
<Form.Item
name="frequency"
label="巡检频次"
rules={[
{ required: true, message: '请选择巡检频次' },
]}
>
<Input addonAfter={selectAfter} disabled={type === 'view'} />
</Form.Item>
<Form.Item
name="time"
label="任务周期"
rules={[
{ required: true, message: '请选择任务周期' },
]}
>
<RangePicker disabled={type === 'view'} />
</Form.Item>
<Form.Item
name="points"
label="巡检点"
rules={[
{ required: true, message: '请选择巡检点' },
]}
>
<Select mode="multiple" options={pointOpt} disabled={!pointOpt || type === 'view'} />
</Form.Item>
<Form.Item
name="userId"
label="巡检人员"
rules={[
{ required: true, message: '请选择巡检人员' },
]}
>
<Select disabled={type === 'view'} options={userOpt} loading={userLoading} onChange={(value) => {
const curUser = userList.filter(u => u.id == value)
if (curUser.length) {
form.setFieldsValue({
userDept: curUser[0].department.name
});
}
}} />
</Form.Item>
<Form.Item
name="userDept"
label="巡检单位"
>
<Input disabled />
</Form.Item>
</Form>
</Modal >
);
};
function mapStateToProps(state) {
const { auth, userList, structureList } = state
return {
user: auth.user,
userList: userList.data || [],
structureList: structureList.data || [],
userLoading: userList.isRequesting,
struLoading: structureList.isRequesting
}
}
export default connect(mapStateToProps)(PlanModal);

72
web/client/src/sections/patrolManage/components/userModal.js

@ -1,72 +0,0 @@
import { Button, Form, Input, Modal } from 'antd';
import React, { useState } from 'react';
const UserModal = ({ visible, onCreate, onCancel }) => {
const [form] = Form.useForm();
const reg_tel = /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/;
return (
<Modal
visible={visible}
title="新建用户"
okText="新建"
cancelText="取消"
onCancel={() => {
form.resetFields();
onCancel();
}}
onOk={() => {
form
.validateFields()
.then((values) => {
form.resetFields();
onCreate(values);
})
.catch((info) => {
console.log('Validate Failed:', info);
});
}}
>
<Form
form={form}
layout="vertical"
name="form_in_modal"
initialValues={{
modifier: 'public',
}}
>
<Form.Item
name="name"
label="姓名"
rules={[
{ required: true, message: '请输入姓名' },
{ max: 24, message: '姓名不能大于24个字符' },
]}
>
<Input />
</Form.Item>
<Form.Item
name="phone"
label="用户名(手机号)"
rules={[
{ required: true, message: '请输入正确的手机号' },
{ pattern: reg_tel, message: '请输入正确的手机号' },
]}
>
<Input />
</Form.Item>
<Form.Item
name="password"
label="密码"
rules={[
{ required: true, message: '请填写密码' },
{ min: 6, message: '请填写至少6位密码' },
]}
>
<Input type="password" />
</Form.Item>
</Form>
</Modal>
);
};
export default UserModal;

64
web/client/src/sections/patrolManage/containers/patrolPlan.js

@ -2,30 +2,43 @@ import React, { useState, useRef } from 'react';
import { connect } from 'react-redux';
import { Button, Popconfirm } from 'antd';
import ProTable from '@ant-design/pro-table';
import UserModal from '../components/userModal';
import PlanModal from '../components/planModal';
import { createPatrolPlan, delPatrolPlan, updatePatrolPlan, getPatrolPlan } from '../actions/plan';
import moment from 'moment';
function PatrolPlan(props) {
const { dispatch, user } = props;
const tableRef = useRef();
const [dataSource, setDataSource] = useState([{}]);
const [visible, setVisible] = useState(false);
const [type, setType] = useState();
const [curRecord, setCurRecord] = useState();
const onCreate = (values) => {
console.log(values, 'values')
// dispatch(createEarthquakeUser(values)).then(res => {
// if (res.success) {
// tableRef.current.reload();
// }
// })
// setVisible(false);
if (type === 'create') {
dispatch(createPatrolPlan(values)).then(res => {
if (res.success) {
tableRef.current.reload();
}
})
} else {
dispatch(updatePatrolPlan({ ...values, id: curRecord.id })).then(res => {
if (res.success) {
tableRef.current.reload();
}
})
}
setVisible(false);
};
const columns = [{
title: '结构物名称',
dataIndex: 'struName',
key: 'struName',
ellipsis: true
ellipsis: true,
render: (_, record) => {
return <div>{record?.project?.name}</div>
}
}, {
title: '巡检任务名称',
dataIndex: 'name',
@ -36,11 +49,14 @@ function PatrolPlan(props) {
dataIndex: 'startTime',
key: 'startTime',
ellipsis: true,
render: (_, record) => moment(record.startTime).format('YYYY-MM-DD')
}, {
title: '结束时间',
dataIndex: 'endTime',
key: 'endTime',
ellipsis: true,
render: (_, record) => moment(record.endTime).format('YYYY-MM-DD')
}, {
title: '巡检频次',
dataIndex: 'frequency',
@ -51,12 +67,13 @@ function PatrolPlan(props) {
dataIndex: 'patrolPoints',
key: 'patrolPoints',
ellipsis: true,
render: (_, record) => <div>{record?.points?.length ? record?.points?.map(p => p.name).join() : '-'}</div>
}, {
title: '巡检人',
dataIndex: 'patrolPerson',
key: 'patrolPerson',
ellipsis: true,
render: (_, record) => <div></div>
render: (_, record) => <div>{record?.user?.name}</div>
}, {
title: '巡检次数统计',
dataIndex: 'patrolCount',
@ -69,8 +86,16 @@ function PatrolPlan(props) {
search: false,
render: (_, record) => {
return <>
<Button type="link">修改</Button>
<Button type="link">查看</Button>
<Button type="link" onClick={() => {
setType('edit')
setCurRecord(record)
setVisible(true)
}}>修改</Button>
<Button type="link" onClick={() => {
setType('view')
setCurRecord(record)
setVisible(true)
}}>查看</Button>
<Popconfirm
title="确认删除?"
onConfirm={() => {
@ -98,7 +123,6 @@ function PatrolPlan(props) {
search={false}
request={async (params = {}) => {
const res = await dispatch(getPatrolPlan(params));
console.log(res, 'res')
setDataSource(res?.payload.data?.rows);
return { ...res };
}}
@ -107,17 +131,25 @@ function PatrolPlan(props) {
<Button
type="primary"
key="primary"
onClick={() => { setVisible(true) }}
onClick={() => {
setType('create')
setVisible(true)
}}
>新增巡检计划</Button>
]}
/>
<UserModal
{
visible ?
<PlanModal
visible={visible}
onCreate={onCreate}
type={type}
curRecord={curRecord}
onCancel={() => {
setVisible(false);
}}
/>
/> : null
}
</>
)
}

10
web/client/src/sections/projectRegime/actions/projectSituation.js

@ -88,3 +88,13 @@ export function qrCodeShow (query) {
});
}
export function q () {
return (dispatch) => basicAction({
type: 'get',
dispatch,
actionType: 'GET_CODE',
url: ApiTable.q,
msg: { error: '获取二维码列表失败', },
});
}

6
web/client/src/sections/projectRegime/containers/information.js

@ -95,7 +95,7 @@ const Information = (props) => {
key: 'operation',
render: (text, record, index) => {
return (
<div style={{ width: 180 }}>
<div style={{ width: 190 }}>
<Button type="link" onClick={() => {
setAddModel(true)
setModelData(record)
@ -144,11 +144,11 @@ const Information = (props) => {
}}
>
<Form.Item
label='项目名称'
label='结构物名称'
name="name"
style={{ marginRight: 16, minWidth: 180 }}
>
<Input placeholder="请输入项目名称" allowClear />
<Input placeholder="请输入结构物名称" allowClear />
</Form.Item>
<Form.Item wrapperCol={{}}>
<Button type="primary" htmlType="submit">

33
web/client/src/sections/projectRegime/containers/qrCode.js

@ -7,6 +7,7 @@ import ProjectAddModel from '../components/projectAddModel'
import { Model } from 'echarts';
import { login } from '../../auth/actions/auth';
import { createCanvas, loadImage, registerFont } from 'canvas'
import { dataURItoBlob } from 'react-jsonschema-form/lib/utils';
const QrCode = (props) => {
@ -33,6 +34,8 @@ const QrCode = (props) => {
}
})
projectList({})
// dispatch(projectRegime.q())
}, [])
const projectList = (obj) => {
@ -84,42 +87,18 @@ const QrCode = (props) => {
marginLeft: 20, width: 220, borderBottom: '1px solid #3c383824'
}}>
<span>结构物名称{firmList?.filter(u => u.value == v.projectId)[0]?.label}</span>
<span>结构物名称{v.name}</span>
<span>点位名称{v.name}</span>
</div>
<img src={v.qrCode} style={{ display: 'inline-block', width: 260 }} />
<div style={{
width: 260, height: 60, background: '#e1d4d42e', display: 'flex',
justifyContent: 'center', alignItems: 'center', borderTop: '1px solid #3c383824'
}}>
{/* <a href={`${v.qrCode + '?filename=' + encodeURIComponent(v.name)}.png`}> */}
<a href={`${v.qrCode}.png`}>
<Button type="primary" onClick={() => {
const aa = (v) => {
const img = new Image(),
canvas = createCanvas(460, 490),
ctx = canvas.getContext('2d')
img.crossOrigin = 'anonymous'
img.onload = function () {
const w = 460, h = 490
ctx.drawImage(img, 0, 0,460,490)
ctx.beginPath()
ctx.font = 'dcscsdcsd'
ctx.fillStyle = '#000'
ctx.fillText('5315', w, h)
ctx.closePath()
const save_link = document.createElement('a')
save_link.href = canvas.toDataURl('image/png')
save_link.download = 'dcscds.png'
document.body.appendChild(save_link)
save_link.click()
save_link.remove()
}
img.src = v
}
aa(v.qrCode)
}}>下载二维码</Button>
{/* </a> */}
</a>
</div>
</div>

1
web/client/src/utils/webapi.js

@ -102,6 +102,7 @@ export const ApiTable = {
position: 'position',
delPosition: 'delPosition/{id}',
qrCodeShow: 'qrCodeShow',
q:'q',
//视频接入配置
siteList: 'siteList',

130
web/log/development.txt

@ -4180,3 +4180,133 @@
2023-01-16 20:44:31.875 - debug: [FS-LOGGER] Init.
2023-01-16 20:44:31.879 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment)
2023-01-16 20:44:32.175 - info: [Router] Inject api: attachment/index
2023-01-17 09:24:10.150 - error: [FS-ERRHD]
{
message: 'Error: connect ECONNREFUSED 127.0.0.1:4900',
name: 'RequestError',
cause: {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 4900
},
error: { '$ref': '$["cause"]' },
options: {
jar: false,
url: 'http://127.0.0.1:4900/projectList?token=01c8ff18-8aa8-4027-9021-b618f5935c09&limit=10&page=0',
headers: {
host: '127.0.0.1:4900',
connection: 'keep-alive',
'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
expires: '-1',
'cache-control': 'no-cache,no-store,must-revalidate,max-age=-1,private',
'x-requested-with': 'XMLHttpRequest',
'sec-ch-ua-mobile': '?0',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
'sec-ch-ua-platform': '"Windows"',
accept: '*/*',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
referer: 'http://localhost:5900/projectRegime/information',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9'
},
encoding: null,
followRedirect: true,
method: 'GET',
body: '[object Object]',
simple: false,
resolveWithFullResponse: true,
callback: [Function: RP$callback],
transform: undefined,
transform2xxOnly: false
},
response: undefined,
stack: 'RequestError: Error: connect ECONNREFUSED 127.0.0.1:4900\n' +
' at new RequestError (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\errors.js:14:15)\n' +
' at Request.plumbing.callback (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\plumbing.js:87:29)\n' +
' at Request.RP$callback [as _callback] (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\plumbing.js:46:31)\n' +
' at self.callback (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request\\request.js:185:22)\n' +
' at Request.emit (events.js:314:20)\n' +
' at Request.onRequestError (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request\\request.js:877:8)\n' +
' at ClientRequest.emit (events.js:314:20)\n' +
' at Socket.socketErrorListener (_http_client.js:427:9)\n' +
' at Socket.emit (events.js:314:20)\n' +
' at emitErrorNT (internal/streams/destroy.js:92:8)\n' +
' at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:84:21)'
}
2023-01-17 11:00:38.475 - error: [FS-ERRHD]
{
message: 'Error: connect ECONNREFUSED 127.0.0.1:4900',
name: 'RequestError',
cause: {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 4900
},
error: { '$ref': '$["cause"]' },
options: {
jar: false,
url: 'http://127.0.0.1:4900/projectList?token=01c8ff18-8aa8-4027-9021-b618f5935c09&limit=10&page=0',
headers: {
host: '127.0.0.1:4900',
connection: 'keep-alive',
'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
expires: '-1',
'cache-control': 'no-cache,no-store,must-revalidate,max-age=-1,private',
'x-requested-with': 'XMLHttpRequest',
'sec-ch-ua-mobile': '?0',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
'sec-ch-ua-platform': '"Windows"',
accept: '*/*',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
referer: 'http://localhost:5900/projectRegime/information',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9'
},
encoding: null,
followRedirect: true,
method: 'GET',
body: '[object Object]',
simple: false,
resolveWithFullResponse: true,
callback: [Function: RP$callback],
transform: undefined,
transform2xxOnly: false
},
response: undefined,
stack: 'RequestError: Error: connect ECONNREFUSED 127.0.0.1:4900\n' +
' at new RequestError (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\errors.js:14:15)\n' +
' at Request.plumbing.callback (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\plumbing.js:87:29)\n' +
' at Request.RP$callback [as _callback] (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\plumbing.js:46:31)\n' +
' at self.callback (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request\\request.js:185:22)\n' +
' at Request.emit (events.js:314:20)\n' +
' at Request.onRequestError (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request\\request.js:877:8)\n' +
' at ClientRequest.emit (events.js:314:20)\n' +
' at Socket.socketErrorListener (_http_client.js:427:9)\n' +
' at Socket.emit (events.js:314:20)\n' +
' at emitErrorNT (internal/streams/destroy.js:92:8)\n' +
' at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:84:21)'
}
2023-01-17 11:01:32.542 - info: extNames
[
'/_file-server/project/e0bd9eaf-e4b9-4e85-aed9-77c668dbb92a/1',
'jpg'
]
2023-01-17 16:24:43.098 - debug: [FS-LOGGER] Init.
2023-01-17 16:24:43.101 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment)
2023-01-17 16:24:45.513 - info: [Router] Inject api: attachment/index
2023-01-17 17:35:01.801 - debug: [FS-LOGGER] Init.
2023-01-17 17:35:01.805 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment)
2023-01-17 17:35:04.036 - info: [Router] Inject api: attachment/index
2023-01-17 17:55:44.472 - debug: [FS-LOGGER] Init.
2023-01-17 17:55:44.484 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment)
2023-01-17 17:55:52.434 - info: [Router] Inject api: attachment/index

Loading…
Cancel
Save