diff --git a/api/app/lib/controllers/patrolManage/checkItems.js b/api/app/lib/controllers/patrolManage/checkItems.js index dc7da16..738987c 100644 --- a/api/app/lib/controllers/patrolManage/checkItems.js +++ b/api/app/lib/controllers/patrolManage/checkItems.js @@ -50,6 +50,8 @@ async function getCheckItems(ctx, next) { required: true, model: models.CheckItemsGroup, attributes: ['id', 'name'], + }, { + model: models.PatrolTemplate }] } if (name) { diff --git a/api/app/lib/index.js b/api/app/lib/index.js index 5b95ba3..faf68b5 100644 --- a/api/app/lib/index.js +++ b/api/app/lib/index.js @@ -71,7 +71,7 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq PatrolTemplate.belongsTo(User, { foreignKey: 'createUserId', targetKey: 'id' }); User.hasMany(PatrolTemplate, { foreignKey: 'createUserId', sourceKey: 'id' }); - CheckItems.belongsToMany(PatrolTemplate, { through: PatrolTemplateCheckItems, foreignKey: 'templateId', otherKey: 'checkItemsId' }); + CheckItems.belongsToMany(PatrolTemplate, { through: PatrolTemplateCheckItems, foreignKey: 'checkItemsId', otherKey: 'templateId' }); PatrolTemplate.belongsToMany(CheckItems, { through: PatrolTemplateCheckItems, foreignKey: 'templateId', otherKey: 'checkItemsId' }); UserResource.belongsTo(Resource, { foreignKey: 'resourceId', targetKey: 'code' }); diff --git a/api/app/lib/models/check_items.js b/api/app/lib/models/check_items.js index eee21a5..3ea26ba 100644 --- a/api/app/lib/models/check_items.js +++ b/api/app/lib/models/check_items.js @@ -4,7 +4,7 @@ module.exports = dc => { const DataTypes = dc.ORM; const sequelize = dc.orm; - const CheckItems = sequelize.define("check_items", { + const CheckItems = sequelize.define("checkItems", { id: { field: "id", type: DataTypes.INTEGER, diff --git a/api/app/lib/models/check_items_group.js b/api/app/lib/models/check_items_group.js index 3cb1399..aa19b0e 100644 --- a/api/app/lib/models/check_items_group.js +++ b/api/app/lib/models/check_items_group.js @@ -4,7 +4,7 @@ module.exports = dc => { const DataTypes = dc.ORM; const sequelize = dc.orm; - const CheckItemsGroup = sequelize.define("check_items_group", { + const CheckItemsGroup = sequelize.define("checkItemsGroup", { id: { field: "id", type: DataTypes.INTEGER, diff --git a/weapp/package/inspectionInput/inspectionInput.js b/weapp/package/inspectionInput/inspectionInput.js index cf00504..513b84c 100644 --- a/weapp/package/inspectionInput/inspectionInput.js +++ b/weapp/package/inspectionInput/inspectionInput.js @@ -63,7 +63,7 @@ Page({ // 获取巡检模板 getPatrolTemplate(templateId) { Request.get(getPatrolTemplate(templateId)).then(res => { - const checkItems = res.rows[0].check_items; + const checkItems = res.rows[0].checkItems; const inspectContent = {}; for (const c of checkItems) { inspectContent[c.name] = { diff --git a/web/client/src/sections/patrolManage/containers/checkItems.js b/web/client/src/sections/patrolManage/containers/checkItems.js index eda9181..d596ba2 100644 --- a/web/client/src/sections/patrolManage/containers/checkItems.js +++ b/web/client/src/sections/patrolManage/containers/checkItems.js @@ -67,7 +67,7 @@ function CheckItems(props) { search: false, width: 150, render: (_, record) => { - return