Browse Source

经纬度

master
wenlele 2 years ago
parent
commit
6575f277f4
  1. 21
      api/app/lib/controllers/projectRegime/projectSituation.js
  2. 26
      api/log/development.log
  3. 18
      script/1.0.0/schema/2.create.project.sql
  4. 28
      web/client/src/sections/projectRegime/components/pointModel.js
  5. 30
      web/client/src/sections/projectRegime/components/projectAddModel.js
  6. 11
      web/log/development.txt

21
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: "获取失败!"

26
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.

18
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
)
)
-- 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);

28
web/client/src/sections/projectRegime/components/pointModel.js

@ -57,13 +57,37 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, q
<div style={{}}>
{/* /^\d+$|^\d*\.\d+$/g */}
<Form.Item label="所在地区:" labelCol={{ span: 11 }} labelAlign='right' name="longitude" initialValue={modelData?.longitude} style={{ display: 'inline-block', width: 'calc(60% - 30px)', }}
rules={[{ required: true, message: '请输入横坐标', },]}
rules={[{ required: true, message: '请输入横坐标', },{
validator: (rule, value, callback) => {
const sjh = /^\d+$|^\d*\.\d+$/g;
if (value) {
let valid = sjh.test(value);
if (!valid) {
return callback([new Error("横坐标填写错误")]);
}
callback();
}
return callback([new Error("请输入横坐标")]);
}
}]}
>
<Input placeholder="经度支持数字" />
</Form.Item>
~
<Form.Item name="latitude" initialValue={modelData?.latitude} style={{ display: 'inline-block', width: 'calc(40% + 15px)', }}
rules={[{ required: true, message: '请输入纵坐标', },]}
rules={[{ required: true, message: '请输入纵坐标', },{
validator: (rule, value, callback) => {
const sjh = /^\d+$|^\d*\.\d+$/g;
if (value) {
let valid = sjh.test(value);
if (!valid) {
return callback([new Error("纵坐标填写错误")]);
}
callback();
}
return callback([new Error("请输入纵坐标")]);
}
}]}
>
<Input placeholder="维度支持数字" />
</Form.Item>

30
web/client/src/sections/projectRegime/components/projectAddModel.js

@ -70,15 +70,39 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, f
{ value: '管廊', label: '管廊' }]} />
</Form.Item>
<div style={{}}>
{/* /^\d+$|^\d*\.\d+$/g */}
<Form.Item label="所在地区:" labelCol={{ span: 11 }} labelAlign='right' name="longitude" initialValue={modelData?.longitude} style={{ display: 'inline-block', width: 'calc(60% - 30px)', }}
// rules={[{ required: true, message: '请输入横坐标', },]}
rules={[{ required: true, message: '请输入横坐标',},{
validator: (rule, value, callback) => {
const sjh = /^\d+$|^\d*\.\d+$/g;
if (value) {
let valid = sjh.test(value);
if (!valid) {
return callback([new Error("横坐标填写错误")]);
}
callback();
}
return callback([new Error("请输入横坐标")]);
}
}]}
>
<Input placeholder="经度支持数字" />
</Form.Item>
~
<Form.Item name="latitude" initialValue={modelData?.latitude} style={{ display: 'inline-block', width: 'calc(40% + 15px)', }}
// rules={[{ required: true, message: '请输入纵坐标', },]}
rules={[{ required: true, message: '请输入纵坐标', }, {
validator: (rule, value, callback) => {
const sjh = /^\d+$|^\d*\.\d+$/g;
if (value) {
let valid = sjh.test(value);
if (!valid) {
return callback([new Error("纵坐标填写错误")]);
}
callback();
}
return callback([new Error("请输入纵坐标")]);
}
}]}
>
<Input placeholder="维度支持数字" />
</Form.Item>

11
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

Loading…
Cancel
Save