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
{/* /^\d+$|^\d*\.\d+$/g */} { + const sjh = /^\d+$|^\d*\.\d+$/g; + if (value) { + let valid = sjh.test(value); + if (!valid) { + return callback([new Error("横坐标填写错误")]); + } + callback(); + } + return callback([new Error("请输入横坐标")]); + } + }]} > ~ { + const sjh = /^\d+$|^\d*\.\d+$/g; + if (value) { + let valid = sjh.test(value); + if (!valid) { + return callback([new Error("纵坐标填写错误")]); + } + callback(); + } + return callback([new Error("请输入纵坐标")]); + } + }]} > diff --git a/web/client/src/sections/projectRegime/components/projectAddModel.js b/web/client/src/sections/projectRegime/components/projectAddModel.js index 1ea607d..5c2f24a 100644 --- a/web/client/src/sections/projectRegime/components/projectAddModel.js +++ b/web/client/src/sections/projectRegime/components/projectAddModel.js @@ -70,15 +70,39 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, f { value: '管廊', label: '管廊' }]} />
- {/* /^\d+$|^\d*\.\d+$/g */} + { + const sjh = /^\d+$|^\d*\.\d+$/g; + if (value) { + let valid = sjh.test(value); + if (!valid) { + return callback([new Error("横坐标填写错误")]); + } + callback(); + } + return callback([new Error("请输入横坐标")]); + } + }]} > ~ { + const sjh = /^\d+$|^\d*\.\d+$/g; + if (value) { + let valid = sjh.test(value); + if (!valid) { + return callback([new Error("纵坐标填写错误")]); + } + callback(); + } + return callback([new Error("请输入纵坐标")]); + } + }]} > diff --git a/web/log/development.txt b/web/log/development.txt index 2eeb4a4..d43f2ae 100644 --- a/web/log/development.txt +++ b/web/log/development.txt @@ -4310,3 +4310,14 @@ 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 +2023-01-18 18:51:45.704 - info: extNames +[ + '/_file-server/project/e0bd9eaf-e4b9-4e85-aed9-77c668dbb92a/1', + 'jpg' +] +2023-01-18 19:29:40.992 - debug: [FS-LOGGER] Init. +2023-01-18 19:29:40.997 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-01-18 19:29:46.439 - info: [Router] Inject api: attachment/index +2023-01-18 23:40:18.330 - debug: [FS-LOGGER] Init. +2023-01-18 23:40:18.338 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-01-18 23:40:18.674 - info: [Router] Inject api: attachment/index