Commit ad885796 by SHINDAESUB

1차 완료

parent 5dd66520
...@@ -10,9 +10,6 @@ const bodyParser = require('body-parser'); // ...@@ -10,9 +10,6 @@ const bodyParser = require('body-parser'); //
app.use(express.json({ limit : "50mb" })); app.use(express.json({ limit : "50mb" }));
app.use(express.urlencoded({ limit:"50mb", extended: false })); app.use(express.urlencoded({ limit:"50mb", extended: false }));
let infoMsg = ''
dotenv.config({ dotenv.config({
path: path.resolve( path: path.resolve(
process.cwd(), process.cwd(),
...@@ -140,6 +137,10 @@ app.get('/api/requestManager',wrapper(async (req,res)=>{ ...@@ -140,6 +137,10 @@ app.get('/api/requestManager',wrapper(async (req,res)=>{
case "neuro_check" : case "neuro_check" :
requestMsg = 'neuro_result' requestMsg = 'neuro_result'
break break
// case "neuro_replay" :
// requestMsg = 'neuro_result'
// break
default: default:
res.status(404) res.status(404)
} }
...@@ -170,7 +171,15 @@ function responseManager (requestMsg) { ...@@ -170,7 +171,15 @@ function responseManager (requestMsg) {
let timer = setInterval(() => { let timer = setInterval(() => {
if(requestMsg === JSON.parse(udpResultMsg).cmd ){ if(requestMsg === JSON.parse(udpResultMsg).cmd ){
if(requestMsg === 'capture_done') infoMsg = JSON.parse(udpResultMsg).msg if(requestMsg === 'capture_done'){
let base64 = fs.readFileSync('./public/image/capture.jpg' , 'base64')
let msg = JSON.parse(udpResultMsg)
msg.imageBase64 = base64
udpResultMsg = JSON.stringify(msg)
// console.log("야이 씨벌 :", JSON.parse(udpResultMsg))
// console.log("base64 :",base64)
}
resolve(udpResultMsg) resolve(udpResultMsg)
clearInterval(timer) clearInterval(timer)
}else if(waitingTime === 500000){ }else if(waitingTime === 500000){
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</template> </template>
<script> <script>
import { EventBus } from '@/event-bus' import { EventBus } from '../event-bus'
export default { export default {
......
...@@ -9,16 +9,18 @@ ...@@ -9,16 +9,18 @@
:project="project" :project="project"
/> />
</v-col> </v-col>
<v-col cols=7 class="mx-auto" > <v-col cols="7" >
<Card <Card
:wpo="wpo" :wpo="wpo"
:step="step" :step="step"
:infos="infos" :infos="infos"
:project="project" :project="project"
:counter="counter" :counter="counter"
:result="resultRect"
:captureImage="captureImage"
/> />
</v-col> </v-col>
<v-col> <v-col col="3">
<Chart <Chart
:wpo="wpo" :wpo="wpo"
:step="step" :step="step"
...@@ -70,6 +72,10 @@ export default { ...@@ -70,6 +72,10 @@ export default {
counter:0, counter:0,
result:[], result:[],
resultRect:[],
captureImage:null
} }
}, },
...@@ -92,6 +98,7 @@ export default { ...@@ -92,6 +98,7 @@ export default {
this.infos =[], this.infos =[],
this.counter = 0, this.counter = 0,
this.result =[] this.result =[]
this.captureImage = null
}, },
async getAoi(){ async getAoi(){
...@@ -267,9 +274,10 @@ export default { ...@@ -267,9 +274,10 @@ export default {
const msg = new Object() const msg = new Object()
msg.cmd = "neuro_capture" msg.cmd = "neuro_capture"
let response = await teachingService.requestManager(msg) let response = await teachingService.requestManager(msg)
console.log('캡처 ㅇ데이터 ',response) let data = JSON.parse(response.data)
this.captureImage = data.imageBase64
if(typeof response === 'undefined') throw new Error('서버와 연결 되지 않았습니다.') if(typeof response === 'undefined') throw new Error('서버와 연결 되지 않았습니다.')
if(response.status !== 200) throw new Error('옳지 않은 응답입니다.') if(response.status !== 200) throw new Error('옳지 않은 응답입니다.')
this.step = 5 this.step = 5
...@@ -293,10 +301,20 @@ export default { ...@@ -293,10 +301,20 @@ export default {
msg.teaching_info = teachingInfo msg.teaching_info = teachingInfo
let response = await teachingService.requestManager(msg) let response = await teachingService.requestManager(msg)
console.log('검수 데이터 ',JSON.parse(response.data)) let data = JSON.parse(response.data)
console.log('검수 데이터 ', data)
this.resultRect = []
let order = new Object()
order.counter = this.counter
order.time = Number(data['proc_time'])
order.result = data['result']
this.result.push(JSON.parse(response.data)) this.resultRect = data['check_box']
this.result.push(order)
if(typeof response === 'undefined') throw new Error('서버와 연결 되지 않았습니다.') if(typeof response === 'undefined') throw new Error('서버와 연결 되지 않았습니다.')
if(response.status !== 200) throw new Error('옳지 않은 응답입니다.') if(response.status !== 200) throw new Error('옳지 않은 응답입니다.')
......
<template> <template>
<v-card <v-card
:disabled="this.step < 3" :disabled="this.step <= 4"
width="100%" width="960"
max-width="100%" max-width="960"
height="846" height="846"
max-height="846" max-height="846"
class="elevation-0" class="elevation-0 mx-auto"
> >
<v-img <v-img
:disabled="this.step < 4" v-if="captureImage === null"
height="540" height="540"
max-height="540" max-height="540"
width="100%" width="100%"
max-width="100%" max-width="100%"
src="https://bad.src/not/valid" src="../../../public/image/lazy.png"
lazy-src="../../../public/image/lazy.png" lazy-src="../../../public/image/lazy.png"
contain contain
class="grey darken-4" class="grey darken-4"
> >
</v-img> </v-img>
<v-stage
v-else
class="ma-0 pa-0 "
ref="stage"
:config="stageSize"
>
<v-layer ref="layer"
:config="stageSize"
>
<v-image
:config="{
image: image,
width: 960,
height: 540,
}"/>
<v-rect
v-for="(rec, index) in rect"
:key="index"
:config="{
x: Math.min(rec.startX /1.33, rec.lastX /1.33 ),
y: Math.min(rec.startY /1.33, rec.lastY /1.33),
width: Math.abs(rec.width / 1.33 ),
height: Math.abs(rec.height /1.33),
fill: rec.stroke+'4D',
stroke: rec.stroke,
dash:[8,8],
strokeWidth: 3,
}"
>
<!-- height: Math.abs(rec.height /1.33),
fill: '#2196F34D',
stroke: '#2196F3', -->
</v-rect>
</v-layer>
</v-stage>
<div v-if="Object.keys(project).length !== 0"> <div v-if="Object.keys(project).length !== 0">
<v-card-title>{{project.name}}</v-card-title> <v-card-title>{{project.name}}</v-card-title>
<v-card-subtitle>{{project.createDate}} - {{project.successDate}}</v-card-subtitle> <v-card-subtitle>{{project.createDate}} - {{project.successDate}}</v-card-subtitle>
...@@ -30,7 +69,8 @@ ...@@ -30,7 +69,8 @@
<v-divider class="mx-4"></v-divider> <v-divider class="mx-4"></v-divider>
<v-card-title>진행률</v-card-title> <v-card-title>검수 진행률 </v-card-title>
<v-card-subtitle>{{counter}}/{{project.counter}} </v-card-subtitle>
<v-card-text> <v-card-text>
<v-progress-linear <v-progress-linear
v-model="progressbar" v-model="progressbar"
...@@ -48,25 +88,83 @@ ...@@ -48,25 +88,83 @@
</template> </template>
<script> <script>
// const test = require("../../../public/image/lazy.png");
export default { export default {
data () { data () {
return { return {
loading: true, loading: true,
progressbar: 0, progressbar: 0,
image: null,
rect:[],
check:[],
stageSize: {
width: 960,
height: 540,
},
drwingColor: '#2196F3', // 선 색
thickness: 3, //선 굵기
} }
}, },
created() {
},
props: { props: {
step:Number, step:Number,
wpo:String, wpo:String,
infos:Array, infos:Array,
project:Object, project:Object,
counter:Number counter:Number,
result:Array,
captureImage:String
}, },
watch: { watch: {
counter(current){ counter(current){
this.progressbar = Math.round((100 * current) / this.project.counter); this.progressbar = Math.round((100 * current) / this.project.counter);
},
result(current){
if(current.length !== 0){
this.rect =[]
this.rect = [...this.infos]
for(let i = 0; i < current.length; i++ ){
Number(current[i]) === 0 ? (this.rect[i].fill = '#2196F3' , this.rect[i].stroke = '#2196F3' ) : (this.rect[i].fill = '#F44336' , this.rect[i].stroke = '#F44336' )
}
}
},
step(current){
if(current === 5){
let image = new Image();
image.src = 'data:image/jpeg;base64,'+this.captureImage
image.onload = () => { this.image = image};
// const image = new window.Image();
// image.src = require("../../../public/image/capture.jpg");
// // image.src = require("@/public/image/lazy.png");
// console.log("이미지:", image)
// image.onload = () => {
// // set image only when it is loaded
// this.image = image;
// };
}
if(current === 6){
this.rect =[]
}
} }
} }
} }
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
<v-card <v-card
dense dense
height="400" height="400"
class="elevation-0" class="elevation-0"
:disabled="step < 5" :disabled="step < 4"
> >
<v-toolbar <v-toolbar
class="elevation-0 " class="elevation-0 "
...@@ -13,22 +12,22 @@ ...@@ -13,22 +12,22 @@
<v-toolbar-title>통계</v-toolbar-title> <v-toolbar-title>통계</v-toolbar-title>
<v-spacer></v-spacer> <v-spacer></v-spacer>
</v-toolbar> </v-toolbar>
<div v-if="result.length !== 0" class="mt-3 pa-0 ma-0"> <div v-if="result.length !== 0" class=" pa-0 ma-0">
<DoughnutChart <DoughnutChart
class="mt-3 pa-0 ma-0" class="mt-3 pa-0 ma-0"
:chart-data="totalColl" :chart-data="totalColl"
:height="150" :height="220"
:percent="percent" :percent="percent"
/> />
<v-card-text> <v-card-text>
<v-list-item> <v-list-item>
<v-list-item-subtitle>응답 속도 합계</v-list-item-subtitle> <v-list-item-subtitle>응답 속도 합계</v-list-item-subtitle>
<v-list-item-title>{{total}}</v-list-item-title> <v-list-item-title>{{total === 0 ? 0 +' sec' : total.toFixed(2) + ' sec'}}</v-list-item-title>
</v-list-item> </v-list-item>
<v-list-item> <v-list-item>
<v-list-item-subtitle>응답 속도 평균</v-list-item-subtitle> <v-list-item-subtitle>응답 속도 평균</v-list-item-subtitle>
<v-list-item-title>{{total/counter}}</v-list-item-title> <v-list-item-title>{{total/counter === 0 ? 0 +' sec' : (total/counter).toFixed(2) + ' sec'}} </v-list-item-title>
</v-list-item> </v-list-item>
</v-card-text> </v-card-text>
</div> </div>
...@@ -42,7 +41,6 @@ export default { ...@@ -42,7 +41,6 @@ export default {
data () { data () {
return { return {
total:0, total:0,
avg:0,
totalColl:{}, totalColl:{},
success:0, success:0,
fail:0, fail:0,
...@@ -80,23 +78,10 @@ export default { ...@@ -80,23 +78,10 @@ export default {
if(current.length !== 0){ if(current.length !== 0){
console.log("Tl;qkfg :",current) this.total = this.total + current[current.length-1]['time']
current[current.length-1]['result'] === 0 ? ++ this.fail : ++this.success
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)) this.percent = Math.round((100 * this.success ) / this.counter)
console.log("평균 :", this.avg)
console.log("퍼센트 :", this.percent)
this.totalColl = { this.totalColl = {
labels: ['성공','실패'], labels: ['성공','실패'],
......
<template> <template>
<v-data-table <v-data-table
:disabled="loading" :disabled="loading"
height="422" height="422"
max-height="422" max-height="422"
dense width="100%"
:headers="headers" max-width="100%"
:items="result" dense
:items-per-page="100" :headers="headers"
no-data-text="검수 이력이 없습니다." :items="result"
:sort-by="['counter']" :items-per-page="100"
:sort-desc="[true]" no-data-text="검수 이력이 없습니다."
class="elevation-0 mt-6" :sort-by="['counter']"
hide-default-footer :sort-desc="[true]"
class="elevation-0 mt-6"
> hide-default-footer
<template v-slot:[`item.state`]="{ item }"> >
<v-chip <template v-slot:[`item.counter`]="{ item }">
:color="item.state === 0 ? 'error' : 'success'" {{item.counter}}
dark </template>
> <template v-slot:[`item.state`]="{ item }">
{{ item.state === 0 ? 'Fail' : 'Success' }} <v-chip
</v-chip> :color="item.result === 0 ? 'error' : 'success'"
</template> small
dark
>
{{ item.result === 0 ? '실패' :'성공' }}
</v-chip>
</template>
<template v-slot:[`item.time`]="{ item }">
{{item.time.toFixed(2)}}
</template>
</v-data-table> </v-data-table>
</template> </template>
...@@ -32,8 +40,8 @@ export default { ...@@ -32,8 +40,8 @@ export default {
loading: true, loading: true,
headers: [ headers: [
{ text: '횟수', align: 'start', sortable: false, value: 'counter',}, { text: '횟수', align: 'start', sortable: false, value: 'counter',},
{ text: '상태', value: 'state' }, { text: '검수 결과', align: 'center', value: 'state' },
{ text: '응답 속도', value: 'response' }, { text: '응답 속도 (sec)',align: 'center', value: 'time' },
], ],
} }
}, },
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
vertical vertical
style="height:100%" style="height:100%"
class="font-weight-black" class="font-weight-black"
width="100%"
max-width="100%"
> >
<v-toolbar <v-toolbar
color="blue darken-1" color="blue darken-1"
...@@ -29,7 +30,7 @@ ...@@ -29,7 +30,7 @@
<v-stepper-content step="1" > <v-stepper-content step="1" >
<div class="text-center"> <div class="text-center">
<v-progress-circular <v-progress-circular
:size="150" :size="100"
color="primary" color="primary"
indeterminate indeterminate
></v-progress-circular> ></v-progress-circular>
...@@ -112,7 +113,7 @@ ...@@ -112,7 +113,7 @@
<v-stepper-content step="3"> <v-stepper-content step="3">
<div class="text-center"> <div class="text-center">
<v-progress-circular <v-progress-circular
:size="150" :size="100"
color="primary" color="primary"
indeterminate indeterminate
></v-progress-circular> ></v-progress-circular>
...@@ -131,7 +132,7 @@ ...@@ -131,7 +132,7 @@
<v-stepper-content step="4"> <v-stepper-content step="4">
<div class="text-center"> <div class="text-center">
<v-progress-circular <v-progress-circular
:size="150" :size="100"
color="primary" color="primary"
indeterminate indeterminate
></v-progress-circular> ></v-progress-circular>
...@@ -150,7 +151,7 @@ ...@@ -150,7 +151,7 @@
<v-stepper-content step="5"> <v-stepper-content step="5">
<div class="text-center"> <div class="text-center">
<v-progress-circular <v-progress-circular
:size="150" :size="100"
color="primary" color="primary"
indeterminate indeterminate
></v-progress-circular> ></v-progress-circular>
......
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