Commit 5dd66520 by SHINDAESUB

수정

parent 126b6cd7
TEACHING_RESOLUTION=(3840x2160)
TEACHING_IMAGE_PATH=/home/firefly/2001_0033_neuromorphic/falinux/old_2020/sds/backend/public/image/capture.jpg
\ No newline at end of file
TEACHING_IMAGE_PATH=/home/falinux/sds/backend/public/image/capture.jpg
WPO=1003_AOI01
\ No newline at end of file
TEACHING_RESOLUTION=(3840x2160)
TEACHING_IMAGE_PATH=/home/firefly/2001_0033_neuromorphic/falinux/old_2020/sds/backend/public/image/capture.jpg
TEACHING_IMAGE_PATH=/home/falinux/sds/backend/public/image/capture.jpg
WPO=1003_AOI01
\ No newline at end of file
......@@ -7,6 +7,10 @@ const dotenv = require('dotenv');
const app = express()
const bodyParser = require('body-parser'); //
app.use(express.json({ limit : "50mb" }));
app.use(express.urlencoded({ limit:"50mb", extended: false }));
let infoMsg = ''
dotenv.config({
......@@ -25,8 +29,11 @@ server.on('listening', function() {
});
server.on('message', function(msg, rinfo) {
server.on('message', function(msg ) {
udpResultMsg = msg.toString();
console.log("케켘", udpResultMsg)
});
server.on('close', function() {
......@@ -38,19 +45,19 @@ const clientPort= 9300;
// const clientPort= 4403;
// const clientHost = '192.168.52.122'; //inet
const clientHost ='127.0.0.1';
const clientHost ='192.168.52.38';
// Error [ERR_SOCKET_DGRAM_NOT_RUNNING]: Not running
client.on('close', function() {
console.log('Client UDP socket close')
});
const jsonFile = fs.readFileSync('./json/projects.json', 'utf8');
// const jsonFile = fs.readFileSync('./json/projects.json', 'utf8');
// console.log(jsonFile);
const jsonData = JSON.parse(jsonFile);
// const jsonData = JSON.parse(jsonFile);
console.table(jsonData);
// console.table(jsonData);
//Post 방식은 Get 과 다르기 때문에 body-parser 를 설치해서 사용해야한다.
app.use(bodyParser.json());
......@@ -70,132 +77,36 @@ let udpAwaitTime = 0
let newProjectNum = 0
//json 파일 불러오기
app.get('/api/getProjectList',(req,res) => {
res.send(jsonData)
app.get('/api/getWpoId',(req,res) => {
let id = process.env.WPO
res.send(id)
})
//USER - 검수 완료후 티칭 정보 수정
app.post('/api/teachingInfoModify',(req,res) => {
console.log("수정할 번호 req.body.project_num :"+ req.body.project_num)
fs.readFile('./json/projects.json', 'utf8',(err ,data) => {
let showData = JSON.parse(data)
for(var key in showData){
if(showData[key].project_num === req.body.project_num){
if(req.body.result){
showData[key].current_done++
}else{
showData[key].current_reject++
}
showData[key].current_counter++
}
}
fs.writeFile('./json/projects.json', JSON.stringify(showData), (err)=>{
if (err) throw err;
console.log('JSON File Update Complete');
});
})
}),
//ADMIN - project 새 번호 가져오기 : 캡처 이미지 이름과 프로젝트 생성하기 위함
app.get('/api/projectCreateNum',(req,res) => {
fs.readFile('./json/project_num_seq.json', 'utf8', (err ,data) => {
let showData = JSON.parse(data)
newProjectNum = ++showData[0].project_num_seq
console.log("newProjectNum : ",newProjectNum)
if(err)
console.error("읽어오기 실패")
res.json(newProjectNum)
});
}),
// ADMIN - 프로젝트 생성
app.post('/api/projectCreate',(req,res) => {
console.log(" ------------------------- ")
console.log(" 메시지 뭐냐? ",req.body)
console.log(" ------------------------- ")
fs.readFile('./json/projects.json', 'utf8',(err ,data) => {
let showData = JSON.parse(data)
let retrunMsg = ''
showData[newProjectNum-1] = {
project_num: newProjectNum,
project_name: req.body.project.project_name,
total_num: req.body.project.total_num,
project_user: req.body.project.project_user,
project_admin: req.body.project.project_admin,
current_counter: req.body.project.current_counter,
current_done: req.body.project.current_done,
current_reject: req.body.project.current_reject,
image_path: req.body.project.image_path,
start_date: req.body.project.start_date,
end_date: req.body.project.end_date,
project_state: '',
success_teaching:req.body.successRect,
fail_teaching:req.body.failRect
},
retrunMsg = `${req.body.project_name} 저장 되었습니다.`
console.log('showData :' ,showData)
console.log("newProjectNum :",newProjectNum)
fs.writeFile('./json/projects.json', JSON.stringify(showData), (err)=>{
if (err) throw res.send(err)
console.log('"projects.json" File Update Complete');
// res.status(200)
res.send( {result:true ,project_num:newProjectNum })
});
fs.readFile('./json/project_num_seq.json', 'utf8',(err ,data) => {
let showData = JSON.parse(data)
console.log('RESULT newProjectNum :' ,newProjectNum)
console.log('RESULT showData :' ,showData[0].project_num_seq)
showData[0].project_num_seq = newProjectNum
app.post('/api/projectInfo',async (req,res) => {
const dataBuffer = fs.readFileSync('./json/project.json')
const project = JSON.parse(dataBuffer.toString())
console.log('로컬 프로젝트 :' , project)
fs.writeFile('./json/project_num_seq.json', JSON.stringify(showData), (err)=>{
if (err) throw res.send(err)
console.log('"project_num_seq.json" File Update Complete');
});
// 받아온 값이 있을경우
if(Object.keys(req.body).length !== 0 ){
project.admin = req.body.admin
project.aoiUid = req.body.aoiUid
project.counter = req.body.counter
project.createDate = req.body.createDate
project.name = req.body.name
project.state = req.body.state
project.successDate = req.body.successDate
project.uid = req.body.uid
project.user = req.body.user
project.infos = req.body.infos
project.updateDate = new Date()
fs.writeFileSync('./json/project.json',JSON.stringify(project) , (err) =>{
if ( err ) return err;
})
})
})
}
//ADMIN - project 상태 (삭제 ,수정 )변경
app.post('/api/projectUpdate',(req,res) => {
console.log(" ------------------------- ")
console.log(" projectUpdate : ? ",req.body.msg)
console.log(" ------------------------- ")
fs.readFile('./json/projects.json', 'utf8',(err ,data) => {
let showData = JSON.parse(data)
let retrunMsg = ''
for(var key in showData){
if(showData[key].project_num === req.body.project_num){
if(req.body.msg === "remove"){
showData[key].project_state = "req.body.msg"
retrunMsg = `${req.body.project_name} 삭제 되었습니다.`
}else if(req.body.msg === "update"){
showData[key].project_admin = req.body.project_admin
showData[key].project_user = req.body.project_user
showData[key].total_num = req.body.total_num
showData[key].start_date = req.body.start_date
showData[key].end_date = req.body.end_date
retrunMsg = `${req.body.project_name} 수정 되었습니다.`
}else {
res.send(err)
}
}
}
fs.writeFile('./json/projects.json', JSON.stringify(showData), (err)=>{
if (err) throw res.send(err)
console.log('JSON File Update Complete');
// res.status(200)
res.send(retrunMsg)
});
})
res.status(200).json(project)
})
const wrapper = asyncFn => { return (async (req, res, next) => { try { return await asyncFn(req, res, next); } catch (error) { return next(error); } }); };
......@@ -234,6 +145,7 @@ app.get('/api/requestManager',wrapper(async (req,res)=>{
}
await responseManager(requestMsg)
.then(data => {
res.status(200).json(data)
})
......@@ -258,7 +170,6 @@ function responseManager (requestMsg) {
let timer = setInterval(() => {
if(requestMsg === JSON.parse(udpResultMsg).cmd ){
console.log(`json 데이터는 ? ${JSON.parse(udpResultMsg).cmd}`)
if(requestMsg === 'capture_done') infoMsg = JSON.parse(udpResultMsg).msg
resolve(udpResultMsg)
clearInterval(timer)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
[{"project_num":1,"project_name":"프로젝트 1","total_num":5,"project_user":"테스트 유저","project_admin":"테스트 관리자","current_counter":7,"current_done":0,"current_reject":7,"image_path":"/image/capture.png","start_date":"2020-10-30","end_date":"2020-10-30","project_state":"","teaching":[{"id":0,"x":336,"y":149,"width":122,"height":80,"stroke":"#4689B3","listening":false,"state":null,"lx":458,"ly":229},{"id":1,"x":540,"y":309,"width":87,"height":143,"stroke":"#B3468B","listening":false,"state":null,"lx":627,"ly":452},{"id":2,"x":246,"y":245,"width":118,"height":164,"stroke":"#46A9B3","listening":false,"state":null,"lx":364,"ly":409},{"id":3,"x":544,"y":57,"width":114,"height":116,"stroke":"#76B346","listening":false,"state":null,"lx":658,"ly":173}]},{"project_num":2,"project_name":"프로젝트 2","total_num":7,"project_user":"테스트 유저","project_admin":"테스트 관리자","current_counter":0,"current_done":0,"current_reject":0,"image_path":"/image/capture.png","start_date":"2020-10-30","end_date":"2020-10-30","project_state":"","teaching":[{"id":0,"x":468,"y":140,"width":133,"height":120,"stroke":"#F90081","listening":false,"state":null,"lx":601,"ly":260},{"id":1,"x":237,"y":268,"width":139,"height":127,"stroke":"#00F9A9","listening":false,"state":null,"lx":376,"ly":395},{"id":2,"x":458,"y":336,"width":116,"height":110,"stroke":"#00A2F9","listening":false,"state":null,"lx":574,"ly":446}]},{"project_num":3,"project_name":"프로젝트 3","total_num":10,"project_user":"테스트 유저","project_admin":"테스트 관리자","current_counter":0,"current_done":0,"current_reject":0,"image_path":"/image/capture.png","start_date":"2020-10-30","end_date":"2020-10-30","project_state":"","teaching":[]},{"project_num":4,"project_name":"테스트","total_num":15,"project_user":"테스트 유저","project_admin":"테스트 관리자","current_counter":1,"current_done":0,"current_reject":1,"image_path":"/image/capture.png","start_date":"2020-10-30","end_date":"2020-10-30","project_state":"","teaching":[{"id":0,"x":530,"y":78,"width":63,"height":80,"stroke":"#F9001F","listening":false,"state":null,"lx":593,"ly":158},{"id":1,"x":201,"y":245,"width":171,"height":118,"stroke":"#F300F9","listening":false,"state":null,"lx":372,"ly":363},{"id":2,"x":172,"y":71,"width":169,"height":122,"stroke":"#00F939","listening":false,"state":null,"lx":341,"ly":193}]}]
\ No newline at end of file
{
"name": "backend",
"version": "1.0.0",
"lockfileVersion": 2,
"lockfileVersion": 1,
"requires": true,
"packages": {
"": {
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"connect-history-api-fallback": "^1.6.0",
"dotenv": "^10.0.0",
"express": "^4.17.1"
}
},
"node_modules/accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
"dependencies": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"node_modules/body-parser": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
"integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
"dependencies": {
"bytes": "3.1.0",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "1.7.2",
"iconv-lite": "0.4.24",
"on-finished": "~2.3.0",
"qs": "6.7.0",
"raw-body": "2.4.0",
"type-is": "~1.6.17"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/connect-history-api-fallback": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz",
"integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/content-disposition": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
"integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
"dependencies": {
"safe-buffer": "5.1.2"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/content-type": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
"integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
"node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/destroy": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"node_modules/dotenv": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==",
"engines": {
"node": ">=10"
}
},
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"node_modules/encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
},
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/express": {
"version": "4.17.1",
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
"integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
"dependencies": {
"accepts": "~1.3.7",
"array-flatten": "1.1.1",
"body-parser": "1.19.0",
"content-disposition": "0.5.3",
"content-type": "~1.0.4",
"cookie": "0.4.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "~1.1.2",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "~1.1.2",
"fresh": "0.5.2",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "~2.3.0",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.5",
"qs": "6.7.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.1.2",
"send": "0.17.1",
"serve-static": "1.14.1",
"setprototypeof": "1.1.1",
"statuses": "~1.5.0",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"engines": {
"node": ">= 0.10.0"
}
},
"node_modules/finalhandler": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
"integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
"dependencies": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"on-finished": "~2.3.0",
"parseurl": "~1.3.3",
"statuses": "~1.5.0",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/forwarded": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/http-errors": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
"integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
"dependencies": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.1",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"node_modules/ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
"engines": {
"node": ">= 0.10"
}
},
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
},
"node_modules/methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
"bin": {
"mime": "cli.js"
},
"engines": {
"node": ">=4"
}
},
"node_modules/mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"dependencies": {
"mime-db": "1.44.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"node_modules/negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
},
"node_modules/proxy-addr": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
"integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==",
"dependencies": {
"forwarded": "~0.1.2",
"ipaddr.js": "1.9.1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
"engines": {
"node": ">=0.6"
}
},
"node_modules/range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/raw-body": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
"integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
"dependencies": {
"bytes": "3.1.0",
"http-errors": "1.7.2",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/send": {
"version": "0.17.1",
"resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
"integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
"dependencies": {
"debug": "2.6.9",
"depd": "~1.1.2",
"destroy": "~1.0.4",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "~1.7.2",
"mime": "1.6.0",
"ms": "2.1.1",
"on-finished": "~2.3.0",
"range-parser": "~1.2.1",
"statuses": "~1.5.0"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/send/node_modules/ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
},
"node_modules/serve-static": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
"integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
"dependencies": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "0.17.1"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/setprototypeof": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
},
"node_modules/statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
"engines": {
"node": ">=0.6"
}
},
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"dependencies": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=",
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
"engines": {
"node": ">= 0.8"
}
}
},
"dependencies": {
"accepts": {
"version": "1.3.7",
......
<template>
<v-app>
<v-main>
<Alert
:open="alertOpen"
:message="message"
:type="type"
/>
<Alert
:open="alertOpen"
:message="message"
:type="type"
/>
<router-view/>
</v-main>
</v-app>
</template>
<script>
import EventBus from './event-bus'
import gql from 'graphql-tag'
import { EventBus } from '@/event-bus'
import Alert from './components/Alert.vue'
......@@ -31,9 +30,7 @@ export default {
this.type = type
}),
EventBus.$on('closeAlert',() => {
this.alertOpen = false
})
EventBus.$on('closeAlert',() => { this.alertOpen = false })
},
......@@ -41,76 +38,14 @@ export default {
alertOpen: false ,
message:'',
type:'',
projects:[],
}),
mounted(){
// this.$store.dispatch('getProjectList')
},
methods: {
async getProjects(){
await this.$apollo.query({
query: gql`
{
neuroProjects{
uid
name
user
admin
createDate
successDate
counter
listId
state
}
}
`
})
.then((response) => {
this.projects = response.data.neuroProjects
})
.catch((error) => { console.error(error) })
},
async getInfos(uid){
await this.$apollo.query({
query: gql`
query neuroInfos($projectUid: Int!) {
neuroInfos(projectUid: $projectUid) {
projectUid
order
type
startX
startY
lastX
lastY
width
height
goodImage
missingImage
goodPath
missingPath
}
}`,
variables: { projectUid: uid }
})
.then((response) => {
let index = this.projects.findIndex( project => project.uid === uid )
this.projects[index].info = response.data.neuroInfos
})
.catch((error) => { console.error(error)})
},
async projectMerge(){
console.log(this.projects)
await this.projects.forEach(project => {
this.getInfos(project.uid)
});
await this.$store.dispatch('getProjectList',this.projects )
}
beforeDestroy(){
EventBus.$off('openAlert');
EventBus.$off('closeAlert');
}
};
</script>
......
......@@ -3,20 +3,20 @@
:value="openAlert"
:z-index="20"
>
<v-alert
:type="type"
dismissible
@click="closeAlert()"
>
{{ message }}
</v-alert>
<v-alert
:type="type"
dismissible
@click="closeAlert()"
>
{{ message }}
</v-alert>
</v-overlay>
</template>
<script>
import EventBus from '../event-bus'
import { EventBus } from '@/event-bus'
export default {
......@@ -25,7 +25,6 @@ export default {
message:String,
type:String,
},
watch: {
open(newVal) {
if (newVal) {
......@@ -35,7 +34,6 @@ export default {
}
},
},
computed: {
openAlert: {
get() {
......
import Vue from 'vue'
const eventBus = new Vue({})
export default eventBus
export const EventBus = new Vue()
<template>
<v-overlay v-if="open" :z-index="10">
<v-card width="1200" color="grey lighten-3" class="d-flex flex-column mx-auto">
<v-toolbar
color="#66bb6a"
elevation="0"
>
<v-toolbar-title class="font-weight-black">
Teaching
</v-toolbar-title>
</v-toolbar>
<v-card-text>
<v-row>
<v-col cols="6">
<Info
:counter="totalCounter"
:info="info"
:list="teachingList"
/>
</v-col>
<v-col>
<Stepper
:counter="totalCounter"
:step="step"
:roading="roading"
:errorMessage="errorMessage"
:percent="percent"
:fail="failResult"
:success="successResult"
:fpga="fpgaResult"
:response="responseResult"
/>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer/>
<v-btn
class="font-weight-bold"
text
color="primary"
:disabled="step === 5 ? false : true"
@click="save()"
>
save
</v-btn>
<v-btn
light
text
:disabled="step === 5 || step === 1 ? false : true"
@click="close()"
>
close
</v-btn>
</v-card-actions>
</v-card>
</v-overlay>
</template>
<script>
import EventBus from '../event-bus'
import Info from './TeachungModal/Info.vue'
import Stepper from './TeachungModal/Stepper.vue'
import teachingService from '@/service/teaching'
export default {
props: {
open:Boolean,
info:Object,
totalCounter:Number
},
data () {
return {
step:1,
counter:0,
roading:false,
errorMessage:'',
teachingList: [],
failResult:0,
successResult:0,
fpgaResult:0,
responseResult:0,
percent:0
}
},
components:{
Info,
Stepper
},
created () {
EventBus.$on('start',() =>{ this.neuroStart()})
EventBus.$on('retry',(step) => {this.retry(step)})
},
methods:{
retry(step){
this.requestInit()
switch (step){
case 2:
this.neuroReady()
break;
case 3:
this.neuroCapture()
break;
case 4:
this.neuroCheck()
break;
case 5:
this.step = 1
this.teachingList = []
this.counter = 0
break;
}
},
requestFail(message){
this.roading = false
this.errorMessage = `Error : ${message}`
},
requestInit(){
this.roading = true
this.errorMessage = ''
},
async neuroStart(){
let msg = new Object()
msg.cmd = "neuro_start"
msg.project_num = this.info.uid
await teachingService.requestManager(msg)
.then(data => {
console.log(data)
this.step = 2
})
.catch(error =>{
console.log(error.response)
error.response.data !== undefined ? this.requestFail(error.response.data) : this.requestFail(error.response.status)
})
},
async neuroReady(){
let msg = new Object()
msg.cmd = "neuro_ready"
await teachingService.requestManager(msg)
.then(data => {
console.log(data)
this.step = 3
})
.catch(error =>{
console.log(error.response)
error.response.data !== undefined ? this.requestFail(error.response.data) : this.requestFail(error.response.status)
})
},
async neuroCapture(){
let msg = new Object()
msg.cmd = "neuro_capture"
await teachingService.requestManager(msg)
.then(data => {
console.log(data)
this.step = 4
})
.catch(error =>{
console.log(error.response)
error.response.data !== undefined ? this.requestFail(error.response.data) : this.requestFail(error.response.status)
})
},
async neuroCheck(){
let teachingInfo = ''
this.info.info.forEach((rect) => {
let str = `(${Math.ceil(rect.startX * 1.5)},${Math.ceil(rect.startY * 1.5)},${Math.ceil(rect.lastX * 1.5)},${Math.ceil( rect.lastY * 1.5) })`
teachingInfo= teachingInfo + "-" + str
})
let msg = new Object()
msg.cmd = "neuro_check"
msg.project_num = this.info.uid
msg.teaching_info = teachingInfo
await teachingService.requestManager(msg)
.then(data => {
this.counter = ++this.counter
let teaching = JSON.parse(data.data)
let result = new Object()
result.counter = this.counter
result.state = teaching['result']
result.response = parseFloat(teaching['proc_time'])
result.fpga = 0
this.teachingList.push(result)
this.counter === this.totalCounter ? this.step = 5 : this.step = 2
})
.catch(error =>{
error.response.data !== undefined ? this.requestFail(error.response.data) : this.requestFail(error.response.status)
})
},
resultCounter(){
this.failResult = 0
this.successResult = 0
this.fpgaResult = 0
this.responseResult = 0
this.percent =0
let stateArr = this.teachingList.map(teaching => { return teaching['state']})
let responseArr = this.teachingList.map(teaching => { return teaching['response']})
let fpgaArr = this.teachingList.map(teaching => { return teaching['fpga'] })
stateArr.forEach(state => { state === 0 ? ++this.failResult : ++this.successResult})
this.fpgaResult = fpgaArr.reduce((stack, el)=>{ return stack + el }, 0)
this.responseResult = responseArr.reduce((stack, el)=>{ return stack + el}, 0)
this.fpgaResult = this.fpgaResult > 0 ? Number(this.fpgaResult.toFixed(7)) : 0
this.responseResult =this.responseResult > 0 ? Number(this.responseResult.toFixed(7)) : 0
this.percent = this.success / this.totalCounter * 100 > 0 ? Number((this.success/ this.totalCounter * 100).toFixed(0)) : 0
},
close(){
this.counter = 0
this.step = 1
this.teachingList = []
EventBus.$emit('projectModalClose')
}
},
watch:{
'step': function(newVal){
if(newVal === 2){
this.requestInit()
this.neuroReady()
}else if(newVal === 3){
this.requestInit()
this.neuroCapture()
}else if(newVal === 4){
this.requestInit()
this.neuroCheck()
}else if(newVal === 5){
this.resultCounter()
}
}
},
beforeDestroy(){
EventBus.$off('start');
EventBus.$off('requestRetry');
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<v-card
light
max-height="600"
min-height="600"
>
<v-card-text>
<v-row no-gutters>
<v-col cols='6' class="ma-0 pa-0">
<div class="text-h5 font-weight-black">{{info.name}}</div>
<p>{{info.createDate}} - {{info.successDate}} </p>
<p>관리자 <span>: {{info.admin }}</span></p>
<p>작업자 <span >: {{info.user }}</span></p>
<p>검수 횟수 :<span class="primary--text font-weight-bold"> {{counter }}</span></p>
</v-col>
<v-col cols='6' class="ma-0 pa-0">
<v-img
:src="host"
contain
width="350"
height="190"
color="grey"
>
</v-img>
</v-col>
</v-row>
<v-data-table
light
height="300"
max-height="300"
min-height="300"
:headers="headers"
:items="list"
:items-per-page="5"
no-data-text="검수 이력이 없습니다."
class="elevation-1 mt-5"
:sort-by="['counter']"
:sort-desc="[true]"
:footer-props="{
'items-per-page-text':'페이지 수'
}"
>
<template v-slot:[`item.state`]="{ item }">
<v-chip
:color="item.state === 0 ? 'error' : 'success'"
dark
>
{{ item.state === 0 ? 'Fail' : 'Success' }}
</v-chip>
</template>
</v-data-table>
</v-card-text>
</v-card>
</template>
<script>
export default {
props: {
info:Object,
list:Array,
counter:Number,
},
data () {
return {
headers: [
{ text: '횟수', align: 'start', sortable: false, value: 'counter',},
{ text: '상태', value: 'state' },
{ text: '응답 속도', value: 'response' },
{ text: 'FPGA 속도', value: 'fpga' },
],
}
},
computed:{
host(){
let protocol = location.protocol;
let hostName = location.hostname === 'localhost' ? '192.168.50.133': location.hostname
return protocol+'//'+hostName+':'+8081
}
},
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<v-stepper v-model="step" light>
<v-stepper-header >
<v-stepper-step color="#98ee99" :complete="step > 1" step="1"><span class="font-weight-bold">START</span></v-stepper-step>
<v-divider></v-divider>
<v-stepper-step color="#98ee99" :complete="step > 2" step="2"><span class="font-weight-bold">SETTING</span> </v-stepper-step>
<v-divider></v-divider>
<v-stepper-step color="#98ee99" :complete="step > 3" step="3"><span class="font-weight-bold">CAPTURE</span> </v-stepper-step>
<v-divider></v-divider>
<v-stepper-step color="#98ee99" :complete="step > 4" step="4"><span class="font-weight-bold">TEACHING</span></v-stepper-step>
<v-divider></v-divider>
<v-stepper-step color="#98ee99" step="5"><span class="font-weight-bold">END</span></v-stepper-step>
</v-stepper-header>
<v-stepper-items>
<v-stepper-content step="1" >
<v-card
class="mb-12"
elevation="0"
height="405px"
>
<v-card-text >
<v-timeline
dense
>
<v-timeline-item
v-for="line in timeline"
:key="line.id"
>
<template v-slot:icon>
<v-btn small fab color="#98ee99" elevation="0"><span class="white--text"> {{line.id}}</span></v-btn>
</template>
<v-row class="pt-1">
<v-col cols="3">
<strong>{{line.title}}</strong>
</v-col>
<v-col>
<strong>{{line.text}}</strong>
<div class="text-caption">
{{line.caption}}
</div>
</v-col>
</v-row>
</v-timeline-item>
</v-timeline>
</v-card-text>
</v-card>
<v-row no-gutters>
<v-spacer/>
<v-btn
outlined
color="primary"
@click="teachingStart()"
>
start
</v-btn>
</v-row>
</v-stepper-content>
<v-stepper-content step="2">
<v-card
class="mb-12"
elevation="0"
height="405px"
>
<v-card-text class="headline font-weight-bold grey--text text-center " >
<v-progress-circular
v-if="roading"
:size="300"
:width="20"
color="primary"
indeterminate
> <div class="headline font-weight-bold primary--text">Capture...</div></v-progress-circular>
<div v-else class="font-weight-bold #009624--text">{{errorMessage}}</div>
</v-card-text>
</v-card>
<v-row no-gutters>
<v-spacer/>
<v-btn
outlined
color="primary"
:disabled="roading"
@click="requestRetry(step)"
>
retry
</v-btn>
</v-row>
</v-stepper-content>
<v-stepper-content step="3">
<v-card
class="mb-12"
elevation="0"
height="405px"
>
<v-card-text class="headline font-weight-bold grey--text text-center " >
<v-progress-circular
v-if="roading"
:size="300"
:width="20"
color="primary"
indeterminate
> <div class="headline font-weight-bold primary--text">Capture...</div></v-progress-circular>
<div v-else class="font-weight-bold #009624--text">{{errorMessage}}</div>
</v-card-text>
</v-card>
<v-row no-gutters>
<v-spacer/>
<v-btn
outlined
color="primary"
:disabled="roading"
@click="requestRetry(step)"
>
retry
</v-btn>
</v-row>
</v-stepper-content>
<v-stepper-content step="4">
<v-card
class="mb-12"
elevation="0"
height="405px"
>
<v-card-text class="headline font-weight-bold grey--text text-center " >
<v-progress-circular
v-if="roading"
:size="300"
:width="20"
color="primary"
indeterminate
> <div class="headline font-weight-bold primary--text">Teaching...</div></v-progress-circular>
<div v-else class="font-weight-bold #009624--text">{{errorMessage}}</div>
</v-card-text>
</v-card>
<v-row no-gutters>
<v-spacer/>
<v-btn
outlined
color="primary"
:disabled="roading"
@click="requestRetry(step)"
>
retry
</v-btn>
</v-row>
</v-stepper-content>
<v-stepper-content step="5">
<v-card
class="mb-12"
elevation="0"
height="405px"
>
<v-card-text class="headline font-weight-bold grey--text" >
<p class="black--text text-center">결과 </p>
<v-row>
<v-col cols="6" class="title font-weight-bold text-center">검수 성공률</v-col>
<v-col cols="6" class="title font-weight-bold text-center">검수 속도</v-col>
</v-row>
<v-row>
<v-col cols="6">
<DoughnutChart
v-if="step === 5"
:chart-data="totalColl"
:height="200"
:percent=percent
/>
</v-col>
<v-col cols="6">
<v-simple-table dense>
<template v-slot:default>
<thead>
<tr>
<th class="text-left">
속도
</th>
<th class="text-left">
합계
</th>
</tr>
</thead>
<tbody>
<tr
>
<td>응답</td>
<td>{{response}}</td>
</tr>
<tr
>
<td>FPGA</td>
<td>{{fpga}}</td>
</tr>
</tbody>
</template>
</v-simple-table>
</v-col>
</v-row>
</v-card-text>
</v-card>
<v-row no-gutters>
<v-spacer/>
<v-btn
outlined
color="primary"
@click="requestRetry(step)"
>
retry
</v-btn>
</v-row>
</v-stepper-content>
</v-stepper-items>
</v-stepper>
</template>
<script>
import EventBus from '../../event-bus'
import DoughnutChart from '../../components/DoughnutChart.vue'
export default {
props: {
step:Number,
counter:Number,
roading:Boolean,
errorMessage:String,
fail:Number,
success:Number,
fpga:Number,
response:Number,
percent:Number,
},
data () {
return {
timeline:[
{id:1,title:"START",text:`'START' 버튼을 시작하면 검수를 시작합니다.` , caption:`${this.counter} 회 자동 실행 됩니다.`},
{id:2,title:"SETTING",text:`검수할 보드를 세팅 합니다.`,caption:``},
{id:3,title:"CAPTURE",text:`보드를 찍습니다.`,caption:``},
{id:4,title:"TEACHING",text:`보드를 검수합니다.`, caption:``},
{id:5,title:"END",text:`검수 결과를 확인합니다.`, caption:`성공,실패 유무 및 응답 속도 `},
],
totalColl:{}
}
},
components: {
DoughnutChart,
},
methods:{
teachingStart(){
EventBus.$emit('start')
},
requestRetry(step){
EventBus.$emit('retry',step)
}
},
watch:{
step(val){
if(val === 5){
this.totalColl = {
labels: ['성공','실패'],
datasets: [
{
backgroundColor: ['#4CAF50' ,'#F44336'],
data: [ this.success ,this.fail],
}
],
}
}
}
}
}
</script>
<style>
</style>
\ No newline at end of file
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import List from '../views/User/List.vue'
Vue.use(VueRouter)
const routes = [
......@@ -10,11 +9,7 @@ Vue.use(VueRouter)
name: 'home',
component: Home
},
{
path: '/list',
name: 'list',
component: List
},
]
const router = new VueRouter({
......
import axios from 'axios'
export default {
getProjectList () {
return new Promise((resolve,reject) =>{
axios.get('/getProjectList')
.then(({data}) => {
resolve(data)})
.catch((error) => {
reject(new Error(`${error} 요청 실패입니다.`));
})
})
},
projectModify (data) {
console.log("파라미터 : " ,data)
return new Promise((resolve,reject) =>{
axios.post('/teachingInfoModify',data)
.then(({data}) => {
resolve(data)})
.catch((error) => {
reject(new Error(`${error} 요청 실패입니다.`));
})
})
async projectInfo (project , infos ) {
if(Object.keys(project).length !== 0) project.infos = infos
try{
let repsone = await axios.post('/projectInfo',project)
return repsone
}catch(e){
console.error(e.message)
}
}
}
\ No newline at end of file
......@@ -4,10 +4,10 @@ import axios from 'axios'
export default{
async requestManager (param) {
try{
const result = await axios.get('/requestManager',{ params: param })
return Promise.resolve(result)
} catch (error) {
return Promise.reject(error)
}
let repsone = await axios.get('/requestManager',{ params: param })
return repsone
}catch(e){
console.error(e.message)
}
},
}
\ No newline at end of file
import axios from 'axios'
export default {
async getWpoId () {
try{
let repsone = await axios.get('/getWpoId')
return repsone
}catch(e){
console.error(e.message)
}
},
}
\ No newline at end of file
<template>
<v-container >
<v-row class="mt-12" >
<v-container class="home d-flex align-center justify-center" >
<v-row >
<v-col col="2">
<Stepper
:wpo="wpo"
......@@ -15,6 +15,7 @@
:step="step"
:infos="infos"
:project="project"
:counter="counter"
/>
</v-col>
<v-col>
......@@ -23,12 +24,16 @@
:step="step"
:infos="infos"
:project="project"
:counter="counter"
:result="result"
/>
<List
:wpo="wpo"
:step="step"
:infos="infos"
:project="project"
:result="result"
/>
</v-col>
</v-row>
......@@ -36,6 +41,12 @@
</template>
<script>
import wpoService from '../service/wpo'
import projectService from '../service/project'
import teachingService from '@/service/teaching'
import { EventBus } from '@/event-bus'
import Stepper from '../views/main/Stepper.vue'
import Chart from '../views/main/Chart.vue'
import Card from '../views/main/Card.vue'
......@@ -46,17 +57,19 @@ import gql from 'graphql-tag'
export default {
data () {
return {
step:1,
loading:true,
wpo:'1003_AOI01',
step:0,
wpo:'',
project:{},
aoi:{},
infos:[],
counter:0,
result:[],
}
},
......@@ -68,11 +81,19 @@ export default {
},
mounted(){
// this.getAoi()
this.step =2
this.step = 1
},
methods: {
dataInit(){
this.step = 0,
this.project = {},
this.aoi = {},
this.infos =[],
this.counter = 0,
this.result =[]
},
async getAoi(){
try{
const response = await this.$apollo.query({
......@@ -186,51 +207,139 @@ export default {
}
},
async getData(){
async getWpoId(){
try{
let response = await wpoService.getWpoId()
if(typeof response === 'undefined') throw new Error('서버와 연결 되지 않았습니다.')
this.wpo= response.data
this.step = 2
}catch(e){
EventBus.$emit('openAlert',`${e.message}`, 'error')
}
},
async dataSetting(){
let result1 = await this.getAoi()
let result2 = await this.getProject()
let result3 = await this.getInfos()
console.log(result1)
console.log(result2)
console.log(result3)
let test = await projectService.projectInfo(this.project ,this.infos )
console.log('받아온 데이터',test)
if(result1 === true && result2 === true && result3 === true ) this.step = 3
}
},
async teachingCheck(){
try{
const msg = new Object()
msg.cmd = "neuro_start"
msg.project_num = this.project.uid
let response = await teachingService.requestManager(msg)
if(typeof response === 'undefined') throw new Error('서버와 연결 되지 않았습니다.')
if(response.status !== 200) throw new Error('옳지 않은 응답입니다.')
this.step = 4
}catch(e){
EventBus.$emit('openAlert',`${e.message}`, 'error')
}
},
async captureReady(){
try{
const msg = new Object()
msg.cmd = "neuro_ready"
let response = await teachingService.requestManager(msg)
if(typeof response === 'undefined') throw new Error('서버와 연결 되지 않았습니다.')
if(response.status !== 200) throw new Error('옳지 않은 응답입니다.')
this.imageCapture()
}catch(e){
EventBus.$emit('openAlert',`${e.message}`, 'error')
}
},
async imageCapture(){
try{
const msg = new Object()
msg.cmd = "neuro_capture"
let response = await teachingService.requestManager(msg)
console.log('캡처 ㅇ데이터 ',response)
if(typeof response === 'undefined') throw new Error('서버와 연결 되지 않았습니다.')
if(response.status !== 200) throw new Error('옳지 않은 응답입니다.')
this.step = 5
}catch(e){
EventBus.$emit('openAlert',`${e.message}`, 'error')
}
},
async inspection(){
try{
let teachingInfo = ''
this.infos.forEach((rect) => {
let str = `(${Math.ceil(rect.startX * 1.5)},${Math.ceil(rect.startY * 1.5)},${Math.ceil(rect.lastX * 1.5)},${Math.ceil( rect.lastY * 1.5) })`
teachingInfo= teachingInfo + "-" + str
})
let msg = new Object()
msg.cmd = "neuro_check"
msg.project_num = this.project.uid
msg.teaching_info = teachingInfo
let response = await teachingService.requestManager(msg)
console.log('검수 데이터 ',JSON.parse(response.data))
this.result.push(JSON.parse(response.data))
if(typeof response === 'undefined') throw new Error('서버와 연결 되지 않았습니다.')
if(response.status !== 200) throw new Error('옳지 않은 응답입니다.')
this.counter === this.project.counter ? this.step = 6 : this.step = 4
}catch(e){
EventBus.$emit('openAlert',`${e.message}`, 'error')
}
}
},
watch:{
step(current) {
async step(current) {
console.log("현재 스텝 :", current)
if(current === 1){
console.log("1번 입니다.")
this.dataInit()
this.wpo === '' ? this.getWpoId() : this.step = 2
}else if(current === 2){
console.log("2번 입니다.")
this.getData()
this.dataSetting()
}else if(current === 3){
console.log("3번 입니다.")
this.teachingCheck()
}else if(current === 4){
console.log("4번 입니다.")
this.captureReady()
}else if(current === 5){
console.log("5번 입니다.")
++this.counter
console.log(this.counter)
this.inspection()
}else if(current === 6){
console.log("6번 입니다.")
}
}
},
}
</script>
<style lang="scss">
.home{
height: 100vh;
}
</style>
\ No newline at end of file
<template>
<div class="pj-list d-flex justify-center align-center">
<v-container class="d-flex justify-center align-center">
<v-card
width="1800"
min-height="800"
color="grey lighten-3"
>
<v-toolbar
color="#66bb6a"
elevation="0"
>
<v-toolbar-title class="font-weight-black white--text" >
PROJECT
</v-toolbar-title>
</v-toolbar>
<v-card-text>
<v-row>
<v-col cols="6">
<List
:projects="projects"
/>
</v-col>
<v-col cols="6">
<No v-if="Object.keys(project).length === 0 && JSON.stringify(project) === JSON.stringify({})"/>
<Info v-else
:project="project"
/>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-container>
<TeachingModal
:open="teachingModal"
:info="teachingInfo"
:totalCounter="teachingCounter"
/>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import teachingService from '@/service/teaching'
import EventBus from '../../event-bus'
import List from '../User/List/List.vue'
import Info from '../User/List/Info.vue'
import No from './List/No.vue'
import TeachingModal from '@/modal/TeachingModal'
export default {
data () {
return {
project:{},
teachingInfo:{},
teachingCounter:0,
teachingModal:false
}
},
components: {
TeachingModal,
List,
Info,
No
},
created () {
EventBus.$on('projectSelected',(project) =>{
console.log(project)
this.project = project
})
EventBus.$on('projectListReload',() =>{
this.project = {}
this.reload()
})
EventBus.$on('projectTeachingStart',(project,counter) => {
this.teachingStart(project,counter)
})
EventBus.$on('projectModalClose',() => {
this.teachingModal = false
})
},
computed: {
...mapGetters([
'projects'
]),
},
methods: {
reload(){
this.$store.dispatch('getProjectList')
},
async teachingStart(project,counter){
this.teachingInfo = project,
this.teachingCounter = counter,
this.teachingModal = true
},
start (item) {
console.log("save 아이템 : "+JSON.stringify(item))
const startTeaching=confirm('작업을 시작하시겠습니까?')
if(startTeaching){
const msg = new Object()
msg.cmd = "neuro_start"
msg.project_num = item.project_num
this.$router.push({ name: 'teaching', params: item});
teachingService.requestManager(msg)
this.close()
}
},
},
}
</script>
<style lang="scss">
.pj-list{
background-color: var(--user-color);
height: 100vh;
}
</style>
\ No newline at end of file
<template>
<v-card class="d-flex flex-column mx-auto" height="770" light>
<v-card-title class="text-h5 font-weight-black">
{{project.name}}
</v-card-title>
<v-card-subtitle>
{{project.createDate}} - {{project.successDate}}
</v-card-subtitle>
<v-card-text>
<v-row>
<v-col>
<v-text-field
label="관리자"
readonly
outlined
:value="project.admin"
>
</v-text-field>
</v-col>
<v-col>
<v-text-field
label="사용자"
readonly
outlined
:value="project.user"
>
</v-text-field>
</v-col>
<v-col>
<v-text-field
label="검수 횟수"
ref="counterInput"
v-model.number="project.counter"
outlined
type="number"
min="0"
>
</v-text-field>
</v-col>
</v-row>
<v-sheet
class="mx-auto"
max-width="800"
max-height="500"
>
<v-slide-group
v-model="model"
class="pa-4"
mandatory
show-arrows
>
<v-slide-item
v-for="info in project.info"
:key="info.order"
v-slot="{ active, toggle }"
>
<v-card
:color="active ? 'primary' : 'grey lighten-4'"
class="ma-4"
height="270"
width="250"
@click="toggle"
>
<v-img
:contain="true"
height="100%"
width="100%"
:src="'data:image/gif;base64,'+ info.goodImage"
@click="toggle"
class="grey darken-4 mr-1"
>
</v-img>
</v-card>
</v-slide-item>
</v-slide-group>
</v-sheet>
</v-card-text>
<v-card-actions>
<v-spacer/>
<v-btn
class="font-weight-bold"
outlined
color="primary"
@click="teaching(project)"
>
Teaching
</v-btn>
</v-card-actions>
</v-card>
</template>
<script>
import EventBus from '../../../event-bus'
export default {
props:{
project:Object,
},
data () {
return {
model: null,
}
},
methods:{
teaching(project){
if(this.project.counter === 0){
EventBus.$emit('openAlert',`검수 횟수를 '0' 이상의 값을 입력해주세요 ` , 'error')
return this.$refs.counterInput.focus()
}else{
EventBus.$emit('projectTeachingStart',project,this.project.counter)
}
}
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<v-card max-height="770" light>
<v-toolbar
color="#98ee99"
>
<v-toolbar-title class="font-weight-bold white--text ">
List
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn icon @click="reload()">
<v-icon>mdi-refresh</v-icon>
</v-btn>
</v-toolbar>
<v-data-table
height="646"
max-height="646"
min-height="646"
:headers="projectHeader"
:items="projects"
no-data-text="프로젝트가 없습니다"
sort-by="createDate"
class="elevation-1"
>
<template v-slot:[`item.actions`]="{ item }">
<v-chip
color="#80d8ff"
@click="selected(item)"
dark
:disabled="item.info.length > 0 ? false : true"
>
조회
</v-chip>
</template>
</v-data-table>
</v-card>
</template>
<script>
import EventBus from '../../../event-bus'
export default {
data () {
return {
projectHeader: [
{
text: '이름',
align: 'start',
sortable: false,
value: 'name',
},
{ text: '관리자', value: 'admin', sortable: false,},
{ text: '사용자', value: 'user', sortable: false,},
{ text: '생성일자', value: 'createDate', sortable: false,},
{ text: '완료일자', value: 'successDate', sortable: false, },
{ text: '조회', value: 'actions', sortable: false },
],
}
},
props:{
projects:Array,
},
methods:{
reload(){
EventBus.$emit('projectListReload')
},
selected(project){
EventBus.$emit('projectSelected',project)
}
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<v-card class="d-flex justify-center align-center" color="grey lighten-2" height="770">
<div class="title font-weight-bold">조회 하실 프로젝트를 선택해주세요</div>
</v-card>
</template>
<script>
export default {
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<v-card
:loading="loading"
:disabled="loading"
:disabled="this.step < 3"
width="100%"
max-width="100%"
height="900"
max-height="900"
height="846"
max-height="846"
class="elevation-0"
>
<template slot="progress">
<v-progress-linear
color="deep-purple"
height="10"
indeterminate
></v-progress-linear>
</template>
<v-img
:disabled="this.step < 4"
height="540"
max-height="540"
width="100%"
......@@ -25,55 +18,31 @@
contain
class="grey darken-4"
>
<template v-slot:placeholder>
<v-row
class="fill-height ma-0"
align="center"
justify="center"
>
<v-progress-circular
indeterminate
color="grey lighten-5"
></v-progress-circular>
</v-row>
</template>
</v-img>
<v-card-title>{{project.name}}</v-card-title>
<v-card-subtitle>{{project.createDate}} - {{project.successDate}}</v-card-subtitle>
<v-card-text>
<v-list-item >
<v-list-item-subtitle> 관리자 </v-list-item-subtitle>
<v-list-item-title>{{project.admin}} </v-list-item-title>
</v-list-item>
<v-list-item>
<v-list-item-subtitle> 사용자 </v-list-item-subtitle>
<v-list-item-title>{{project.user}} </v-list-item-title>
</v-list-item>
</v-card-text>
<v-divider class="mx-4"></v-divider>
<v-card-title>진행률</v-card-title>
<v-card-text>
<!-- <v-chip-group
v-model="selection"
active-class="deep-purple accent-4 white--text"
column
>
<v-chip>5:30PM</v-chip>
<v-chip>7:30PM</v-chip>
<v-chip>8:00PM</v-chip>
<v-chip>9:00PM</v-chip>
</v-chip-group> -->
</v-card-text>
<div v-if="Object.keys(project).length !== 0">
<v-card-title>{{project.name}}</v-card-title>
<v-card-subtitle>{{project.createDate}} - {{project.successDate}}</v-card-subtitle>
<v-card-text class="text--primary">
<div>검수 : {{project.counter}}</div>
<div>관리자 : {{project.admin}}</div>
<div>사용자 : {{project.user}}</div>
</v-card-text>
<v-divider class="mx-4"></v-divider>
<v-card-title>진행률</v-card-title>
<v-card-text>
<v-progress-linear
v-model="progressbar"
height="25"
dark
reactive
@click.prevent.self
>
<strong>{{ progressbar }} %</strong>
</v-progress-linear>
</v-card-text>
</div>
</v-card>
</template>
......@@ -83,6 +52,7 @@ export default {
data () {
return {
loading: true,
progressbar: 0,
}
},
......@@ -91,8 +61,14 @@ export default {
wpo:String,
infos:Array,
project:Object,
counter:Number
},
watch: {
counter(current){
this.progressbar = Math.round((100 * current) / this.project.counter);
}
}
}
</script>
......
<template>
<v-card color="red">
wqkeqwekjqw
<v-card
dense
height="400"
class="elevation-0"
:disabled="step < 5"
>
<v-toolbar
class="elevation-0 "
dense
>
<v-toolbar-title>통계</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<div v-if="result.length !== 0" class="mt-3 pa-0 ma-0">
<DoughnutChart
class="mt-3 pa-0 ma-0"
:chart-data="totalColl"
:height="150"
:percent="percent"
/>
<v-card-text>
<v-list-item>
<v-list-item-subtitle>응답 속도 합계</v-list-item-subtitle>
<v-list-item-title>{{total}}</v-list-item-title>
</v-list-item>
<v-list-item>
<v-list-item-subtitle>응답 속도 평균</v-list-item-subtitle>
<v-list-item-title>{{total/counter}}</v-list-item-title>
</v-list-item>
</v-card-text>
</div>
</v-card>
</template>
<script>
import DoughnutChart from '../../components/DoughnutChart.vue'
export default {
data () {
return {
e13: 2,
loading: true,
headers: [
{ text: '횟수', align: 'start', sortable: false, value: 'counter',},
{ text: '상태', value: 'state' },
{ text: '응답 속도', value: 'response' },
],
total:0,
avg:0,
totalColl:{},
success:0,
fail:0,
percent:0
}
},
props: {
step:Number,
wpo:String,
infos:Array,
project:Object,
result:Array,
counter:Number
},
mounted(){
this.totalColl = {
labels: ['성공','실패'],
datasets: [
{
backgroundColor: ['#4CAF50' ,'#F44336'],
data: [ this.success ,this.fail],
}
],
}
},
components: {
DoughnutChart,
},
watch:{
result(current){
if(current.length !== 0){
console.log("Tl;qkfg :",current)
current.forEach(result => {
this.total = this.total + Number(result['proc_time'])
result.result === 0 ? ++this.success : ++ this.fail
});
console.log(this.counter)
console.log(this.total)
this.avg = this.total / this.counter
this.percent = Math.round((100 * this.success ) / Number(this.counter))
console.log("평균 :", this.avg)
console.log("퍼센트 :", this.percent)
this.totalColl = {
labels: ['성공','실패'],
datasets: [
{
backgroundColor: ['#4CAF50' ,'#F44336'],
data: [ this.success ,this.fail],
}
],
}
}
}
}
}
</script>
......
<template>
<v-data-table
:loading="loading"
:disabled="loading"
height="300"
height="422"
max-height="422"
dense
max-height="300"
:headers="headers"
:items="list"
:items="result"
:items-per-page="100"
no-data-text="검수 이력이 없습니다."
:sort-by="['counter']"
:sort-desc="[true]"
class="elevation-0 "
class="elevation-0 mt-6"
hide-default-footer
>
<template v-slot:[`item.state`]="{ item }">
<v-chip
......@@ -30,16 +29,23 @@
export default {
data () {
return {
e13: 2,
loading: true,
loading: true,
headers: [
{ text: '횟수', align: 'start', sortable: false, value: 'counter',},
{ text: '상태', value: 'state' },
{ text: '응답 속도', value: 'response' },
],
list:[],
}
},
props: {
step:Number,
wpo:String,
infos:Array,
project:Object,
result:Array
},
}
</script>
......
......@@ -5,16 +5,15 @@
vertical
style="height:100%"
class="font-weight-black"
>
<v-toolbar
color="indigo"
color="blue darken-1"
dark
class="elevation-0 "
>
<v-toolbar-title>{{wpo}}</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-title>{{wpo}}</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-stepper-step
......@@ -24,7 +23,7 @@
class="font-weight-black"
>
<small class="font-weight-bold">Step 1</small>
WPO ID 확인
세팅
</v-stepper-step>
<v-stepper-content step="1" >
......@@ -35,12 +34,6 @@
indeterminate
></v-progress-circular>
</div>
<v-btn
color="primary"
@click="step = 2"
>
Continue
</v-btn>
</v-stepper-content>
<v-stepper-step
......@@ -119,25 +112,17 @@
<v-stepper-content step="3">
<div class="text-center">
<v-progress-circular
:size="50"
:size="150"
color="primary"
indeterminate
></v-progress-circular>
</div>
<v-btn
color="primary"
@click="step = 4"
>
Continue
</v-btn>
</v-stepper-content>
<v-stepper-step
:color="step > 4 ? 'success' : 'primary'"
:complete="step > 4"
step="3"
step="4"
>
<small class="font-weight-bold">Step 4</small>
보드 사진 촬영
......@@ -146,21 +131,11 @@
<v-stepper-content step="4">
<div class="text-center">
<v-progress-circular
:size="50"
:size="150"
color="primary"
indeterminate
></v-progress-circular>
</div>
<v-btn
color="primary"
@click="step = 5"
>
Continue
</v-btn>
<v-btn text>
Cancel
</v-btn>
</v-stepper-content>
<v-stepper-step
......@@ -173,28 +148,19 @@
</v-stepper-step>
<v-stepper-content step="5">
<div class="text-center">
<v-progress-circular
:size="50"
:size="150"
color="primary"
indeterminate
></v-progress-circular>
</div>
<v-btn
color="primary"
@click="step = 6"
>
Continue
</v-btn>
</v-stepper-content>
<v-stepper-step
:color="step > 6 ? 'success' : 'primary'"
:complete="step > 6"
step="5"
:color="step === 6 ? 'success' : 'primary'"
:complete="step === 6"
step="6"
>
<small class="font-weight-bold">Step 6</small>
결과
......@@ -202,15 +168,6 @@
<v-stepper-content step="6">
<v-btn
block
color="primary"
@click="step = 1"
>
재시작
</v-btn>
</v-stepper-content>
</v-stepper>
</template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment