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