diff --git a/api/app/lib/controllers/projectRegime/projectSituation.js b/api/app/lib/controllers/projectRegime/projectSituation.js index 1069f83..6c547e4 100644 --- a/api/app/lib/controllers/projectRegime/projectSituation.js +++ b/api/app/lib/controllers/projectRegime/projectSituation.js @@ -134,11 +134,20 @@ async function addPosition (ctx, next) { }) if (data && data.id) { - await models.Point.update({ qrCode }, { - where: { - id: data.id, - } - }) + if (qrCode) { + await models.Point.update({ ...alikeProject, qrCode }, { + where: { + id: data.id, + } + }) + } else { + await models.Point.update(pointData, { + where: { + id: data.id, + } + }) + } + } else { await models.Point.create(pointData) } @@ -242,7 +251,7 @@ async function qrCodeShow (ctx, next) { } -async function q(ctx) { +async function q (ctx) { // let error = { // name: 'FindError', // message: "获取失败!" diff --git a/api/log/development.log b/api/log/development.log index 2033b4b..efaae58 100644 --- a/api/log/development.log +++ b/api/log/development.log @@ -3897,3 +3897,29 @@ notNull Violation: project.describe cannot be null 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. +2023-01-17 18:40:28.864 - debug: [FS-LOGGER] Init. +2023-01-17 18:40:29.065 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-01-17 18:40:29.065 - info: [FS-AUTH] Inject auth and api mv into router. +2023-01-18 19:28:53.617 - debug: [FS-LOGGER] Init. +2023-01-18 19:28:56.758 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-01-18 19:28:56.759 - info: [FS-AUTH] Inject auth and api mv into router. +2023-01-18 19:47:26.316 - debug: [FS-LOGGER] Init. +2023-01-18 19:47:26.516 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-01-18 19:47:26.517 - info: [FS-AUTH] Inject auth and api mv into router. +2023-01-18 19:47:44.075 - error: path: /position, error: SequelizeDatabaseError: invalid input syntax for type integer: "22.22" +2023-01-18 19:47:44.077 - error: [FS-ERRHD] +{ + message: 'errMsg is not defined', + stack: 'ReferenceError: errMsg is not defined\n' + + ' at addPosition (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\controllers\\projectRegime\\projectSituation.js:161:21)' +} +2023-01-18 19:52:22.974 - error: path: /position, error: SequelizeDatabaseError: invalid input syntax for type integer: "22.22" +2023-01-18 19:52:22.975 - error: [FS-ERRHD] +{ + message: 'errMsg is not defined', + stack: 'ReferenceError: errMsg is not defined\n' + + ' at addPosition (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\controllers\\projectRegime\\projectSituation.js:161:21)' +} +2023-01-18 19:52:34.921 - debug: [FS-LOGGER] Init. +2023-01-18 19:52:35.378 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-01-18 19:52:35.378 - info: [FS-AUTH] Inject auth and api mv into router. diff --git a/script/1.0.0/schema/2.create.project.sql b/script/1.0.0/schema/2.create.project.sql index eec307e..de25ab4 100644 --- a/script/1.0.0/schema/2.create.project.sql +++ b/script/1.0.0/schema/2.create.project.sql @@ -5,8 +5,8 @@ create table project primary key, name varchar(255), type varchar(255), - longitude integer, - latitude integer, + longitude varchar(255), + latitude varchar(255), describe varchar(255), user_id integer, img character varying[], @@ -19,9 +19,17 @@ create table point constraint point_pk primary key, name varchar(255), - longitude integer, - latitude integer, + longitude intvarchar(255)eger, + latitude varchar(255), describe varchar(255), qr_code varchar, project_id integer -) \ No newline at end of file +) + + +-- alter table project alter column longitude type varchar(255) using longitude::varchar(255); +-- alter table project alter column latitude type varchar(255) using latitude::varchar(255); + +-- alter table point alter column longitude type varchar(255) using longitude::varchar(255); + +-- alter table point alter column latitude type varchar(255) using latitude::varchar(255); \ No newline at end of file diff --git a/web/client/src/sections/projectRegime/components/pointModel.js b/web/client/src/sections/projectRegime/components/pointModel.js index c28cb36..4246a75 100644 --- a/web/client/src/sections/projectRegime/components/pointModel.js +++ b/web/client/src/sections/projectRegime/components/pointModel.js @@ -57,13 +57,37 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, q