Commit ad885796 by SHINDAESUB

1차 완료

parent 5dd66520
......@@ -10,9 +10,6 @@ const bodyParser = require('body-parser'); //
app.use(express.json({ limit : "50mb" }));
app.use(express.urlencoded({ limit:"50mb", extended: false }));
let infoMsg = ''
dotenv.config({
path: path.resolve(
process.cwd(),
......@@ -140,6 +137,10 @@ app.get('/api/requestManager',wrapper(async (req,res)=>{
case "neuro_check" :
requestMsg = 'neuro_result'
break
// case "neuro_replay" :
// requestMsg = 'neuro_result'
// break
default:
res.status(404)
}
......@@ -170,7 +171,15 @@ function responseManager (requestMsg) {
let timer = setInterval(() => {
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)
clearInterval(timer)
}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 @@
</template>
<script>
import { EventBus } from '@/event-bus'
import { EventBus } from '../event-bus'
export default {
......
......@@ -9,16 +9,18 @@
:project="project"
/>
</v-col>
<v-col cols=7 class="mx-auto" >
<v-col cols="7" >
<Card
:wpo="wpo"
:step="step"
:infos="infos"
:project="project"
:counter="counter"
:result="resultRect"
:captureImage="captureImage"
/>
</v-col>
<v-col>
<v-col col="3">
<Chart
:wpo="wpo"
:step="step"
......@@ -70,6 +72,10 @@ export default {
counter:0,
result:[],
resultRect:[],
captureImage:null
}
},
......@@ -92,6 +98,7 @@ export default {
this.infos =[],
this.counter = 0,
this.result =[]
this.captureImage = null
},
async getAoi(){
......@@ -267,9 +274,10 @@ export default {
const msg = new Object()
msg.cmd = "neuro_capture"
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(response.status !== 200) throw new Error('옳지 않은 응답입니다.')
this.step = 5
......@@ -293,10 +301,20 @@ export default {
msg.teaching_info = teachingInfo
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(response.status !== 200) throw new Error('옳지 않은 응답입니다.')
......
<template>
<v-card
:disabled="this.step < 3"
width="100%"
max-width="100%"
:disabled="this.step <= 4"
width="960"
max-width="960"
height="846"
max-height="846"
class="elevation-0"
class="elevation-0 mx-auto"
>
<v-img
:disabled="this.step < 4"
v-if="captureImage === null"
height="540"
max-height="540"
width="100%"
max-width="100%"
src="https://bad.src/not/valid"
src="../../../public/image/lazy.png"
lazy-src="../../../public/image/lazy.png"
contain
class="grey darken-4"
>
</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">
<v-card-title>{{project.name}}</v-card-title>
<v-card-subtitle>{{project.createDate}} - {{project.successDate}}</v-card-subtitle>
......@@ -30,7 +69,8 @@
<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-progress-linear
v-model="progressbar"
......@@ -48,25 +88,83 @@
</template>
<script>
// const test = require("../../../public/image/lazy.png");
export default {
data () {
return {
loading: true,
progressbar: 0,
image: null,
rect:[],
check:[],
stageSize: {
width: 960,
height: 540,
},
drwingColor: '#2196F3', // 선 색
thickness: 3, //선 굵기
}
},
created() {
},
props: {
step:Number,
wpo:String,
infos:Array,
project:Object,
counter:Number
counter:Number,
result:Array,
captureImage:String
},
watch: {
counter(current){
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 @@
<v-card
dense
height="400"
class="elevation-0"
:disabled="step < 5"
:disabled="step < 4"
>
<v-toolbar
class="elevation-0 "
......@@ -13,22 +12,22 @@
<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">
<div v-if="result.length !== 0" class=" pa-0 ma-0">
<DoughnutChart
class="mt-3 pa-0 ma-0"
:chart-data="totalColl"
:height="150"
:height="220"
: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-title>{{total === 0 ? 0 +' sec' : total.toFixed(2) + ' sec'}}</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-title>{{total/counter === 0 ? 0 +' sec' : (total/counter).toFixed(2) + ' sec'}} </v-list-item-title>
</v-list-item>
</v-card-text>
</div>
......@@ -42,7 +41,6 @@ export default {
data () {
return {
total:0,
avg:0,
totalColl:{},
success:0,
fail:0,
......@@ -80,23 +78,10 @@ export default {
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.total = this.total + current[current.length-1]['time']
current[current.length-1]['result'] === 0 ? ++ this.fail : ++this.success
this.percent = Math.round((100 * this.success ) / Number(this.counter))
console.log("평균 :", this.avg)
console.log("퍼센트 :", this.percent)
this.percent = Math.round((100 * this.success ) / this.counter)
this.totalColl = {
labels: ['성공','실패'],
......
<template>
<v-data-table
:disabled="loading"
height="422"
max-height="422"
dense
:headers="headers"
:items="result"
:items-per-page="100"
no-data-text="검수 이력이 없습니다."
:sort-by="['counter']"
:sort-desc="[true]"
class="elevation-0 mt-6"
hide-default-footer
>
<template v-slot:[`item.state`]="{ item }">
<v-chip
:color="item.state === 0 ? 'error' : 'success'"
dark
>
{{ item.state === 0 ? 'Fail' : 'Success' }}
</v-chip>
</template>
height="422"
max-height="422"
width="100%"
max-width="100%"
dense
:headers="headers"
:items="result"
:items-per-page="100"
no-data-text="검수 이력이 없습니다."
:sort-by="['counter']"
:sort-desc="[true]"
class="elevation-0 mt-6"
hide-default-footer
>
<template v-slot:[`item.counter`]="{ item }">
{{item.counter}}
</template>
<template v-slot:[`item.state`]="{ item }">
<v-chip
:color="item.result === 0 ? 'error' : 'success'"
small
dark
>
{{ item.result === 0 ? '실패' :'성공' }}
</v-chip>
</template>
<template v-slot:[`item.time`]="{ item }">
{{item.time.toFixed(2)}}
</template>
</v-data-table>
</template>
......@@ -32,8 +40,8 @@ export default {
loading: true,
headers: [
{ text: '횟수', align: 'start', sortable: false, value: 'counter',},
{ text: '상태', value: 'state' },
{ text: '응답 속도', value: 'response' },
{ text: '검수 결과', align: 'center', value: 'state' },
{ text: '응답 속도 (sec)',align: 'center', value: 'time' },
],
}
},
......
......@@ -5,7 +5,8 @@
vertical
style="height:100%"
class="font-weight-black"
width="100%"
max-width="100%"
>
<v-toolbar
color="blue darken-1"
......@@ -29,7 +30,7 @@
<v-stepper-content step="1" >
<div class="text-center">
<v-progress-circular
:size="150"
:size="100"
color="primary"
indeterminate
></v-progress-circular>
......@@ -112,7 +113,7 @@
<v-stepper-content step="3">
<div class="text-center">
<v-progress-circular
:size="150"
:size="100"
color="primary"
indeterminate
></v-progress-circular>
......@@ -131,7 +132,7 @@
<v-stepper-content step="4">
<div class="text-center">
<v-progress-circular
:size="150"
:size="100"
color="primary"
indeterminate
></v-progress-circular>
......@@ -150,7 +151,7 @@
<v-stepper-content step="5">
<div class="text-center">
<v-progress-circular
:size="150"
:size="100"
color="primary"
indeterminate
></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