Browse Source

registry.anxinyun.cn

master
wenlele 2 years ago
parent
commit
4eb6d10c3e
  1. 6
      api/app/lib/controllers/projectRegime/projectSituation.js
  2. 75
      api/log/development.log
  3. 12
      web/client/src/sections/projectRegime/containers/point.js
  4. 9
      web/client/src/sections/projectRegime/containers/qrCode.js
  5. 13
      web/log/development.txt

6
api/app/lib/controllers/projectRegime/projectSituation.js

@ -55,7 +55,7 @@ async function postAddProject (ctx, next) {
const data = ctx.request.body; const data = ctx.request.body;
const { img, longitude, latitude, name, type, describe } = data const { img, longitude, latitude, name, type, describe } = data
let errMsg = data.id ? '工程编辑失败' : '工程新增失败' let errMsg = data.id ? '结构物编辑失败' : '结构物新增失败'
let project = { img, longitude, latitude, name, type, describe, userId: userInfo.id } let project = { img, longitude, latitude, name, type, describe, userId: userInfo.id }
const alikeProject = await models.Project.findOne({ const alikeProject = await models.Project.findOne({
@ -127,7 +127,7 @@ async function addPosition (ctx, next) {
let errMsg = data.id ? '点位编辑失败' : '点位新增失败' let errMsg = data.id ? '点位编辑失败' : '点位新增失败'
let pointData = { longitude, latitude, name, describe, qrCode, projectId } let pointData = { longitude, latitude, name, describe, qrCode, projectId }
const alikeProject = await models.Project.findOne({ const alikeProject = await models.Point.findOne({
where: { where: {
id: data.id, id: data.id,
} }
@ -141,7 +141,7 @@ async function addPosition (ctx, next) {
} }
}) })
} else { } else {
await models.Point.update(pointData, { await models.Point.update({ pointData }, {
where: { where: {
id: data.id, id: data.id,
} }

75
api/log/development.log

@ -3923,3 +3923,78 @@ notNull Violation: project.describe cannot be null
2023-01-18 19:52:34.921 - debug: [FS-LOGGER] Init. 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-ATTACHMENT] Inject attachment mw into router.
2023-01-18 19:52:35.378 - info: [FS-AUTH] Inject auth and api mv into router. 2023-01-18 19:52:35.378 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-19 10:19:30.018 - debug: [FS-LOGGER] Init.
2023-01-19 10:19:30.254 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-19 10:19:30.254 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-19 11:12:29.093 - debug: [FS-LOGGER] Init.
2023-01-19 11:12:29.308 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-19 11:12:29.308 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-29 08:53:24.105 - debug: [FS-LOGGER] Init.
2023-01-29 08:53:24.877 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-29 08:53:24.877 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-29 09:23:28.370 - debug: [FS-LOGGER] Init.
2023-01-29 09:23:29.168 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-29 09:23:29.168 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-29 10:56:35.533 - debug: [FS-LOGGER] Init.
2023-01-29 10:56:36.287 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-29 10:56:36.287 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-29 11:05:25.089 - debug: [FS-LOGGER] Init.
2023-01-29 11:05:25.251 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-29 11:05:25.251 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-29 11:05:53.247 - error: path: /position, error: TypeError: Cannot read property 'qrCode' of null
2023-01-29 11:05:53.250 - 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)\n' +
' at async auth (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\middlewares\\authenticator.js:144:13)'
}
2023-01-29 11:08:12.648 - error: path: /position, error: TypeError: Cannot read property 'qrCode' of null
2023-01-29 11:08:12.651 - 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)\n' +
' at async auth (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\middlewares\\authenticator.js:144:13)'
}
2023-01-29 11:08:16.060 - debug: [FS-LOGGER] Init.
2023-01-29 11:08:16.208 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-29 11:08:16.209 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-29 11:09:22.122 - error: path: /position, error: TypeError: Cannot read property 'qrCode' of null
2023-01-29 11:09:22.125 - 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:164:21)\n' +
' at async auth (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\middlewares\\authenticator.js:144:13)'
}
2023-01-29 11:09:25.672 - debug: [FS-LOGGER] Init.
2023-01-29 11:09:25.819 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-29 11:09:25.820 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-29 11:09:49.260 - error: path: /position, error: TypeError: Cannot read property 'qrCode' of null
2023-01-29 11:09:49.263 - 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:164:21)\n' +
' at async auth (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\middlewares\\authenticator.js:144:13)'
}
2023-01-29 11:14:00.761 - error: path: /position, error: TypeError: Cannot read property 'qrCode' of null
2023-01-29 11:14:00.763 - 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:164:21)\n' +
' at async auth (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\middlewares\\authenticator.js:144:13)'
}
2023-01-29 11:14:02.686 - error: path: /position, error: TypeError: Cannot read property 'qrCode' of null
2023-01-29 11:14:02.689 - 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:164:21)\n' +
' at async auth (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\middlewares\\authenticator.js:144:13)'
}
2023-01-29 11:14:09.493 - debug: [FS-LOGGER] Init.
2023-01-29 11:14:09.640 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-29 11:14:09.640 - info: [FS-AUTH] Inject auth and api mv into router.

12
web/client/src/sections/projectRegime/containers/point.js

@ -129,18 +129,12 @@ const Information = (props) => {
</Popconfirm> </Popconfirm>
{/* <Button type="link" danger >二维码生成</Button> */} {/* <Button type="link" danger >二维码生成</Button> */}
<Button type="link" onClick={() => { <Button type="link" onClick={() => {
let url = createQrCode(record.name + record.id) let url = createQrCode('FS' + Date.now() + record.id)
console.log(url); console.log(url);
dispatch(projectRegime.addPosition({ dispatch(projectRegime.addPosition({
qrCode: url, qrCode: url,
id: record.id, id: record.id,
}, true)).then(res => { }, true))
if (res.success) {
setQuery({ limit: 10, page: 0 });
projectList({ limit: 10, page: 0 })
}
})
}} >二维码生成</Button> }} >二维码生成</Button>
</div> </div>
) )
@ -158,7 +152,7 @@ const Information = (props) => {
}}>新建点位</Button> }}>新建点位</Button>
<Button type="primary" style={{ marginLeft: 20 }} onClick={() => { <Button type="primary" style={{ marginLeft: 20 }} onClick={() => {
select?.map(v => { select?.map(v => {
let url = createQrCode(v.name + v.id) let url = createQrCode('FS' + Date.now() + v.id)
console.log(url); console.log(url);
dispatch(projectRegime.addPosition({ dispatch(projectRegime.addPosition({
qrCode: url, qrCode: url,

9
web/client/src/sections/projectRegime/containers/qrCode.js

@ -4,7 +4,7 @@ import { Spin, Card, Form, Input, Select, Button, Table, Modal, Popconfirm, Tool
import moment from "moment"; import moment from "moment";
import '../style.less'; import '../style.less';
import ProjectAddModel from '../components/projectAddModel' import ProjectAddModel from '../components/projectAddModel'
import { Model } from 'echarts'; import QRCode from 'qrcode';
import { login } from '../../auth/actions/auth'; import { login } from '../../auth/actions/auth';
import { createCanvas, loadImage, registerFont } from 'canvas' import { createCanvas, loadImage, registerFont } from 'canvas'
import { dataURItoBlob } from 'react-jsonschema-form/lib/utils'; import { dataURItoBlob } from 'react-jsonschema-form/lib/utils';
@ -97,6 +97,13 @@ const QrCode = (props) => {
<a href={`${v.qrCode}.png`}> <a href={`${v.qrCode}.png`}>
<Button type="primary" onClick={() => { <Button type="primary" onClick={() => {
const a = document.createElement('a')
const filename = 'picName.jpeg'
a.href = v.qrCode // picSrc 是图片 base64 码,可以直接给 img 的 src 属性,展示图片
a.download = filename
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
}}>下载二维码</Button> }}>下载二维码</Button>
</a> </a>

13
web/log/development.txt

@ -4341,3 +4341,16 @@
'/_file-server/project/e0bd9eaf-e4b9-4e85-aed9-77c668dbb92a/1', '/_file-server/project/e0bd9eaf-e4b9-4e85-aed9-77c668dbb92a/1',
'jpg' 'jpg'
] ]
2023-01-19 11:12:39.455 - info: extNames
[
'/_file-server/project/e0bd9eaf-e4b9-4e85-aed9-77c668dbb92a/1',
'jpg'
]
2023-01-19 11:16:31.633 - info: extNames
[
'/_file-server/project/e0bd9eaf-e4b9-4e85-aed9-77c668dbb92a/1',
'jpg'
]
2023-01-29 08:53:31.576 - debug: [FS-LOGGER] Init.
2023-01-29 08:53:31.580 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment)
2023-01-29 08:53:33.314 - info: [Router] Inject api: attachment/index

Loading…
Cancel
Save