diff --git a/src/components/face/Face.vue b/src/components/face/Face.vue
index 3da3cf218230df3e7d90a5f1fccb6e54528a8027..8c9b5b54bf31d9695178b40da8c1fe2dbc9e9c8a 100644
--- a/src/components/face/Face.vue
+++ b/src/components/face/Face.vue
@@ -186,7 +186,9 @@
this.thisVideo.srcObject.getTracks()[0].stop()
},
register() {
- if (this.userInfoId === undefined) {
+ if(this.thisVideo.srcObject==null){
+ this.$message.info("未检测到摄像头或摄像头损坏")
+ }else if (this.userInfoId === undefined) {
this.$notification.open({
message: '注册失败',
description: '请录入工号'
@@ -223,23 +225,47 @@
},
searchImage() {
- const _this = this
- let params = { groupId: 101, file: this.imgSrc }
- this.faceLogin(params).then((res) => {
- console.log(res)
- if (res.success) {
- this.$notification.open({
- message: '登陆成功',
- description: '相似度为' + res.result.faceSearchResDto.similarValue + '%,用户获得登录许可!',
- onClick: () => {
- console.log('用户搜索')
+ if(this.thisVideo.srcObject==null){
+ this.$message.info("未检测到摄像头或摄像头损坏")
+ }else{
+ const _this = this
+ let params = { groupId: 101, file: this.imgSrc }
+ this.faceLogin(params).then((res) => {
+ console.log(res)
+ if (res.success) {
+ this.$notification.open({
+ message: '登陆成功',
+ description: '相似度为' + res.result.faceSearchResDto.similarValue + '%,用户获得登录许可!',
+ onClick: () => {
+ console.log('用户搜索')
+ }
+ })
+ Vue.ls.set('ACCESS_TOKEN', res.result.token)
+ //this.mutations.SET_TOKEN()
+ user.state.token = res.result.token
+ this.$router.push('/toolbox')
+ } else {
+ this.loginFailed = this.loginFailed + 1
+ const model = this.$error({
+ title: '错误',
+ content: '登陆失败!请重试',
+ okText: '重新登陆',
+ onOk: () => {
+ model.destroy()
+ _this.stopNavigator()
+ _this.getCompetence()
+ _this.getImage()
+
+ }
+ })
+ if (this.loginFailed === 5) {
+ this.$message.error('登陆失败' + this.loginFailed + '次,请使用账号密码登陆')
+ setTimeout(() => {
+ this.$router.push('/login')
+ }, 2000)
}
- })
- Vue.ls.set('ACCESS_TOKEN', res.result.token)
- //this.mutations.SET_TOKEN()
- user.state.token = res.result.token
- this.$router.push('/toolbox')
- } else {
+ }
+ }).catch(error => {
this.loginFailed = this.loginFailed + 1
const model = this.$error({
title: '错误',
@@ -259,28 +285,8 @@
this.$router.push('/login')
}, 2000)
}
- }
- }).catch(error => {
- this.loginFailed = this.loginFailed + 1
- const model = this.$error({
- title: '错误',
- content: '登陆失败!请重试',
- okText: '重新登陆',
- onOk: () => {
- model.destroy()
- _this.stopNavigator()
- _this.getCompetence()
- _this.getImage()
-
- }
})
- if (this.loginFailed === 5) {
- this.$message.error('登陆失败' + this.loginFailed + '次,请使用账号密码登陆')
- setTimeout(() => {
- this.$router.push('/login')
- }, 2000)
- }
- })
+ }
},
saveImageToLocal() {
@@ -354,7 +360,7 @@
height: 100%;
background-color: #030409;
color: #fff;
- background-image: url('../../assets/bg.png');
+ background-image: url('../../assets/bg.png');;
background-size: 100% 100%;
box-shadow: 0 0 3px blue;
display: flex;
diff --git a/src/views/jobManage/Toolbox.vue b/src/views/jobManage/Toolbox.vue
index d4b291f5422a62ba2e63bdfc7f4b4429cf56c734..68a925ed511f5d5677ecf8e62aecc9470101d397 100644
--- a/src/views/jobManage/Toolbox.vue
+++ b/src/views/jobManage/Toolbox.vue
@@ -4,24 +4,34 @@
- 柜子{{ item.cupboardDoor }}
+ {{item.cabinetName}}
申请作业
-
更换工具
结束作业
+
更换工具
+
结束更换工具
退出系统
-
一键开锁
+ 一键开锁
{{ replaceToolText }}
+
+ {{ exitReplaceToolText }}
+
+
{
if (res.result != null) {
let job = res.result
- // that.jobManageList[i].operator = job.operator
+ that.jobManageList[i].operator = job.operator
if (job.status === '1') {
that.jobManageList[i].status = '1'
document.getElementById(job.cupboardDoor).style.backgroundColor = '#FF0000'
- document.getElementById(job.cupboardDoor).innerText = jobMangage.toolboxName + '已借出:' + job.operator
+ document.getElementById(job.cupboardDoor).innerText = jobMangage.toolboxName + '作业中:' + job.operator
} else if (job.status === '2') {
that.jobManageList[i].status = '2'
document.getElementById(job.cupboardDoor).style.backgroundColor = '#FF0000'
- document.getElementById(job.cupboardDoor).innerText = jobMangage.toolboxName + '更换工具中'
+ document.getElementById(job.cupboardDoor).innerText = jobMangage.toolboxName + '更换工具中:'+ job.operator
} else {
- that.jobManageList[i].status = '0'
+ that.jobManageList[i].status = "3"
document.getElementById(jobMangage.cupboardDoor).style.backgroundColor = '#1890FF'
document.getElementById(jobMangage.cupboardDoor).innerText = jobMangage.cabinetName
}
}
})
}
-
},
click(item, index) {
this.equipmentNum = item.equipmentNum
@@ -142,26 +157,28 @@ export default {
this.cabinetName = item.cabinetName
this.toolboxName = item.toolboxName
this.index = index
- //this.operator = item.operator
+ this.operator = item.operator
},
+ //申请作业
applyJob() {
if (this.equipmentNum === '') {
this.$message.info('未选择任何工具柜')
} else {
let _this = this
if (_this.status === '1') {
- _this.$message.info(_this.cabinetName + '中的' + _this.toolboxName + '已借出')
+ _this.$message.info(_this.cabinetName + '中的' + _this.toolboxName + '作业中')
} else if (_this.status === '2') {
_this.$message.info(_this.cabinetName + '中的' + _this.toolboxName + '更换工具中')
- } else if (_this.status === '0') {
+ } else if (_this.status === "3") {
this.applyJobDialog = true
- this.applyJobgDialogText = '请确认是否要申请' + this.cabinetName + '中的' + this.toolboxName
+ this.applyJobgDialogText = this.operator+':请确认是否要申请' + this.cabinetName + '中的' + this.toolboxName
} else {
_this.$message.info('不支持本操作')
}
}
},
+ //申请作业远程请求
applyForJob() {
let _this = this
this.applyLoading = true
@@ -169,7 +186,7 @@ export default {
cupboardDoor: _this.cupboardDoor,
equipmentNum: _this.equipmentNum
}
- document.getElementById(_this.cupboardDoor).innerText = '开启中'
+ /*document.getElementById(_this.cupboardDoor).innerText = '开启中'*/
setTimeout(() => {
_this.applyJobDialog = false
_this.applyLoading = false
@@ -178,9 +195,9 @@ export default {
_this.operator = res.result.operator
_this.jobManageList[_this.index].operator = res.result.operator
_this.$set(_this.jobManageList[_this.index], 'status', '1')
- _this.$message.success(_this.cabinetName + '中的' + _this.cabinetName + '已借出')
+ _this.$message.success(_this.cabinetName + '中的' + _this.toolboxName + '作业中')
document.getElementById(_this.cupboardDoor).style.backgroundColor = '#FF0000'
- document.getElementById(_this.cupboardDoor).innerText = _this.toolboxName + '已借出:' + _this.operator
+ document.getElementById(_this.cupboardDoor).innerText = _this.toolboxName + '作业中:' + _this.operator
} else {
_this.$message.error(_this.cabinetName + '开锁失败')
}
@@ -189,18 +206,55 @@ export default {
})
}, 2000)
},
+ // 更换工具
replaceTool() {
if (this.equipmentNum === '') {
this.$message.info('未选择任何工具柜')
} else {
- if (this.status === '0' || this.status === '3') {
- this.$message.warn(this.cabinetName + '中的' + this.toolboxName + '未被借出')
- } else {
- this.replaceToolText = '请确认是否要更换' + this.cabinetName + '中' + this.toolboxName + '中的工具'
- this.replaceToolDialog = true
+ if (this.status === '1') {
+ this.replaceToolText = this.operator+':请确认是否要更换' + this.cabinetName + '中' + this.toolboxName + '中的工具'
+ this.replaceToolDialog = true
+ } else if(this.status === '2') {
+ this.$message.warn(this.cabinetName + '中的' + this.toolboxName + '更换工具中')
+ }else{
+ this.$message.warn(this.cabinetName + '中的' + this.toolboxName + '未参与作业')
+ }
+ }
+ },
+ // 更换工具远程请求
+ replaceToolOk() {
+ this.replaceLoading = true
+ let _this = this
+ let params = {
+ equipmentNum:this.equipmentNum,
+ cupboardDoor:this.cupboardDoor,
+ userName:this.operator,
}
+ setTimeout(()=>{
+ this.replaceLoading = false
+ this.replaceToolDialog = false
+ putAction(this.url.replace, params).then(res => {
+ if (res.success){
+ _this.$message.info(_this.cabinetName + '中的' + _this.toolboxName + '更换工具中:'+_this.operator)
+ document.getElementById(_this.cupboardDoor).innerText = _this.toolboxName + '更换工具中:' + _this.operator
+ _this.jobManageList[_this.index].status = "2"}
+ })
+ },2000)
+ },
+ //退出更换工具
+ exitReplaceTool(){
+ if(this.equipmentNum === ''){
+ this.$message.info('未选择任何工具柜')
+ }else{
+ if(this.status == "2"){
+ this.exitReplaceToolText = '请确认是否要结束更换' + this.cabinetName + '中' + this.toolboxName + '中的工具'
+ this.exitReplaceToolDialog = true
+ }else{
+ this.$message.warn(this.cabinetName+'中的'+this.toolboxName+'未在更换工具')
+ }
}
},
+ //结束作业
exit() {
if (this.equipmentNum === '') {
this.$message.info('未选择任何工具柜')
@@ -210,26 +264,34 @@ export default {
this.endJobgDialogText = '请确认' + this.cabinetName + '中' + this.toolboxName + '工具、手环是否完好'
this.endJobDialog = true
} else if (_this.status === '2') {
- this.endJobgDialogText = '请确认' + this.cabinetName + '中' + this.toolboxName + '是否更换工具完毕'
- this.endJobDialog = true
+ this.$message.warn(_this.cabinetName + '中' + _this.toolboxName + '正在更换工具中,请先结束更换工具')
} else {
- this.$message.warn(_this.cabinetName + '中' + _this.toolboxName + '未被借出')
+ this.$message.warn(_this.cabinetName + '中' + _this.toolboxName + '未参与作业')
}
}
},
- replaceToolOk() {
+ //结束更换工具远程请求
+ exitReplaceToolOk(){
+ let _this = this
+ this.exitReplaceLoading = true
let params = {
- equipmentNum:this.equipmentNum,
- cupboardDoor:this.cupboardDoor,
- userName:this.operator,
+ equipmentNum:this.equipmentNum,
+ cupboardDoor:this.cupboardDoor,
+ userName:this.operator,
}
- putAction(this.url.replace, params).then(res => {
- if (res.success){
- this.$message.success(res.message)
- }
- })
- this.replaceToolDialog = false
+ setTimeout(()=>{
+ this.exitReplaceLoading = false
+ this.exitReplaceToolDialog = false
+ putAction(this.url.exitReplace,params).then(res =>{
+ if(res.success){
+ _this.$message.success(_this.cabinetName + '中' + _this.toolboxName + '已结束更换工具')
+ document.getElementById(_this.cupboardDoor).innerText = _this.toolboxName + '作业中:' + _this.operator
+ _this.jobManageList[_this.index].status = "1"
+ }
+ })
+ },2000)
},
+ //结束作业远程请求
endJobOk() {
const _this = this
this.confirmLoading = true
@@ -245,12 +307,13 @@ export default {
/*_this.$message.success(res.result)*/
_this.$message.success(_this.cabinetName + '中' + _this.toolboxName + '已归还')
document.getElementById(_this.cupboardDoor).innerText = _this.cabinetName
- _this.jobManageList[_this.index].status = '0'
+ _this.jobManageList[_this.index].status = "3"
document.getElementById(_this.cupboardDoor).removeAttribute('style')
}
})
}, 2000)
},
+ //退出系统
logout() {
const that = this
that.Logout({}).then(res => {
@@ -270,24 +333,45 @@ export default {
document.getElementById('all').style.display = 'none'
}
},
+ //一键开锁
openAllDoor() {
let _this = this
- this.openAllDoorLoad = true
- getAction(this.url.openAllDoor).then(res => {
- if (res.success) {
- _this.disabled = true
- setTimeout(() => {
- if (res.result === '') {
+ let flag = 0
+ let params = {
+ cabinetCode:''
+ }
+ this.jobManageList.forEach(item=>{
+ console.log("status:"+item.status)
+ if(item.status == "3"){
+ flag = 1
+ params.cabinetCode = params.cabinetCode+item.cupboardDoor+','
+ }
+ })
+ if(flag == 0){
+ this.$message.info("当前所有柜门均为打开状态")
+ }else{
+ this.openAllDoorLoad = true
+ postAction(this.url.openAllDoor,params).then(res => {
+ if (res.success) {
+ /*_this.disabled = true*/
+ setTimeout(() => {
_this.openAllDoorLoad = false
this.$message.success(res.message)
- } else {
- _this.openAllDoorLoad = false
- _this.$message.error('开锁失败' + res.result + '号')
- }
- }, 2000)
+ let arr = res.result.split(',')
+ _this.operator = arr[arr.length-1]
+ /*alert(_this.operator)*/
+ /*_this.jobManageList.forEach(job=>{
+ document.getElementById(job.cupboardDoor).style.backgroundColor = '#FF0000'
+ document.getElementById(job.cupboardDoor).innerText = job.toolboxName + '已借出:' + _this.operator
+ })*/
+ }, 2000)
this.reload()
+ }else {
+ _this.openAllDoorLoad = false
+ _this.$message.error('开锁失败')
}
})
+ }
}
}
}
@@ -324,7 +408,7 @@ export default {
width: 200px;
height: 85px;
margin: 35px;
- font-size: 17px;
+ font-size: 15px;
}
#job_btn .ant-btn {