diff --git a/api/app/lib/controllers/maintenancePlan/index.js b/api/app/lib/controllers/maintenancePlan/index.js index 4d80b96..de93934 100644 --- a/api/app/lib/controllers/maintenancePlan/index.js +++ b/api/app/lib/controllers/maintenancePlan/index.js @@ -46,7 +46,7 @@ async function getMaintenancePlan(ctx) { state: item.state, maintenancePlanExecuteUsers: item.maintenancePlanExecuteUsers.map((item1) => { - const nameArr = userRes.filter((ac) => { return ac.id == item1.pepUserId })[0] + const nameArr = userRes.find((ac) => { return ac.id == item1.pepUserId }) return { id: item1.id, maintenancePlanId: item1.maintenancePlanId, @@ -99,10 +99,10 @@ async function delMaintenancePlan(ctx) { } async function editMaintenancePlan(ctx) { + const data = ctx.request.body const transaction = await ctx.fs.dc.orm.transaction(); try { const { models } = ctx.fs.dc - const data = ctx.request.body //console.log('data1', data) //存在id为编辑,否则是添加 if (data.id) { diff --git a/api/app/lib/controllers/record/index.js b/api/app/lib/controllers/record/index.js index 2d45570..a0f8974 100644 --- a/api/app/lib/controllers/record/index.js +++ b/api/app/lib/controllers/record/index.js @@ -54,7 +54,7 @@ async function getRecord(ctx) { type: item.type, maintenanceRecordExecuteUsers: item.maintenanceRecordExecuteUsers.map((item1) => { - const userArr = userRes.filter((ac) => { return ac.id == item1.pepUserId })[0] + const userArr = userRes.find((ac) => { return ac.id == item1.pepUserId }) return { id: item1.id, maintenanceRecordId: item1.maintenanceRecordId, diff --git a/api/app/lib/models/maintenance_plan.js b/api/app/lib/models/maintenance_plan.js index d31d614..d5a381f 100644 --- a/api/app/lib/models/maintenance_plan.js +++ b/api/app/lib/models/maintenance_plan.js @@ -72,7 +72,7 @@ module.exports = dc => { }, state: { type: DataTypes.STRING, - allowNull: false, + allowNull: true, defaultValue: null, comment: "完成状态 unfinished 未完成 / underway 进行中 / completed 已完成 / suspend 挂起暂停 / inspected 已检查", primaryKey: false, diff --git a/script/0.26/schema/2.update_maintenance_plan.sql b/script/0.26/schema/2.update_maintenance_plan.sql new file mode 100644 index 0000000..922f4f8 --- /dev/null +++ b/script/0.26/schema/2.update_maintenance_plan.sql @@ -0,0 +1,2 @@ +alter table public.maintenance_plan + alter column state drop not null; \ No newline at end of file diff --git a/web/client/src/sections/service/components/cycAddmodal.jsx b/web/client/src/sections/service/components/cycAddmodal.jsx index cd6c178..53e119d 100644 --- a/web/client/src/sections/service/components/cycAddmodal.jsx +++ b/web/client/src/sections/service/components/cycAddmodal.jsx @@ -70,7 +70,7 @@ const okHandler=()=>{