xincheng 2 years ago
parent
commit
e0cafc84c2
  1. 21
      api/app/lib/controllers/projectRegime/projectSituation.js
  2. 4
      api/app/lib/models/point.js
  3. 4
      api/app/lib/models/project.js
  4. 26
      api/log/development.log
  5. 18
      script/1.0.0/schema/2.create.project.sql
  6. 2
      web/client/src/sections/auth/containers/login.js
  7. 28
      web/client/src/sections/projectRegime/components/pointModel.js
  8. 30
      web/client/src/sections/projectRegime/components/projectAddModel.js
  9. 31
      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: "获取失败!"

4
api/app/lib/models/point.js

@ -34,7 +34,7 @@ module.exports = dc => {
autoIncrement: false
},
longitude: {
type: DataTypes.INTEGER,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
@ -43,7 +43,7 @@ module.exports = dc => {
autoIncrement: false
},
latitude: {
type: DataTypes.INTEGER,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,

4
api/app/lib/models/project.js

@ -52,7 +52,7 @@ module.exports = dc => {
autoIncrement: false
},
longitude: {
type: DataTypes.DOUBLE,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
@ -61,7 +61,7 @@ module.exports = dc => {
autoIncrement: false
},
latitude: {
type: DataTypes.DOUBLE,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,

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

2
web/client/src/sections/auth/containers/login.js

@ -113,7 +113,7 @@ const Login = props => {
</Form.Item>
<Form.Item label='' name="password" rules={[{ required: true, message: '请输入密码' },]}>
<Input prefix={<LockOutlined className="site-form-item-icon" />} placeholder="密码" />
<Input.Password prefix={<LockOutlined className="site-form-item-icon" />} placeholder="密码" />
</Form.Item>
<Tooltip title='请联系管理员'>
<a style={{ position: 'relative', left: 348, top: -17 }}>忘记密码</a>

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>

31
web/log/development.txt

@ -4310,3 +4310,34 @@
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
2023-01-19 10:20:34.885 - info: extNames
[
'/_file-server/project/e0bd9eaf-e4b9-4e85-aed9-77c668dbb92a/1',
'jpg'
]
2023-01-19 10:22:47.736 - info: extNames
[
'/_file-server/project/e0bd9eaf-e4b9-4e85-aed9-77c668dbb92a/1',
'jpg'
]
2023-01-19 10:25:48.874 - info: extNames
[
'/_file-server/project/e0bd9eaf-e4b9-4e85-aed9-77c668dbb92a/1',
'jpg'
]
2023-01-19 10:31:43.201 - info: extNames
[
'/_file-server/project/e0bd9eaf-e4b9-4e85-aed9-77c668dbb92a/1',
'jpg'
]

Loading…
Cancel
Save