From a729b6f4a37cba98078d25e83614fff8fc52c5bf Mon Sep 17 00:00:00 2001 From: xiongml Date: Fri, 4 Jun 2021 15:32:51 +0800 Subject: [PATCH 1/5] 'a' --- src/components/face/Face.vue | 190 ++++++++++++++++++----------------- 1 file changed, 96 insertions(+), 94 deletions(-) diff --git a/src/components/face/Face.vue b/src/components/face/Face.vue index 3da3cf2..3034cad 100644 --- a/src/components/face/Face.vue +++ b/src/components/face/Face.vue @@ -56,8 +56,6 @@ - - @@ -99,7 +97,6 @@ }, mounted() { this.getCompetence() - this.getImage() }, methods: { ...mapActions(['faceLogin']), @@ -109,57 +106,62 @@ _this.thisCancas = document.getElementById('canvasCamera') _this.thisContext = this.thisCancas.getContext('2d') _this.thisVideo = document.getElementById('videoCamera') - _this.thisVideo.style.display = 'block' - // 获取媒体属性,旧版本浏览器可能不支持mediaDevices,我们首先设置一个空对象 - if (navigator.mediaDevices === undefined) { - navigator.mediaDevices = {} - } + if(_this.thisVideo.srcObject==null){ + this.$message.info("未检测到摄像头或摄像头损坏") + }else{ + _this.thisVideo.style.display = 'block' + // 获取媒体属性,旧版本浏览器可能不支持mediaDevices,我们首先设置一个空对象 + if (navigator.mediaDevices === undefined) { + navigator.mediaDevices = {} + } - // 一些浏览器实现了部分mediaDevices,我们不能只分配一个对象 - // 使用getUserMedia,因为它会覆盖现有的属性。 - // 这里,如果缺少getUserMedia属性,就添加它。 - if (navigator.mediaDevices.getUserMedia === undefined) { - navigator.mediaDevices.getUserMedia = function(constraints) { - // 首先获取现存的getUserMedia(如果存在) - const getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.getUserMedia - // 有些浏览器不支持,会返回错误信息 - // 保持接口一致 - if (!getUserMedia) {//不存在则报错 - return Promise.reject( - new Error('getUserMedia is not implemented in this browser') - ) + // 一些浏览器实现了部分mediaDevices,我们不能只分配一个对象 + // 使用getUserMedia,因为它会覆盖现有的属性。 + // 这里,如果缺少getUserMedia属性,就添加它。 + if (navigator.mediaDevices.getUserMedia === undefined) { + navigator.mediaDevices.getUserMedia = function(constraints) { + // 首先获取现存的getUserMedia(如果存在) + const getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.getUserMedia + // 有些浏览器不支持,会返回错误信息 + // 保持接口一致 + if (!getUserMedia) {//不存在则报错 + return Promise.reject( + new Error('getUserMedia is not implemented in this browser') + ) + } + // 否则,使用Promise将调用包装到旧的navigator.getUserMedia + return new Promise(function(resolve, reject) { + getUserMedia.call(navigator, constraints, resolve, reject) + }) } - // 否则,使用Promise将调用包装到旧的navigator.getUserMedia - return new Promise(function(resolve, reject) { - getUserMedia.call(navigator, constraints, resolve, reject) - }) } - } - const constraints = { - audio: false, - video: { - width: this.videoWidth, - height: this.videoHeight, - transform: 'scaleX(-1)' + const constraints = { + audio: false, + video: { + width: this.videoWidth, + height: this.videoHeight, + transform: 'scaleX(-1)' + } } + navigator.mediaDevices + .getUserMedia(constraints) + .then(function(stream) { + // 旧的浏览器可能没有srcObject + if ('srcObject' in _this.thisVideo) { + _this.thisVideo.srcObject = stream + } else { + // 避免在新的浏览器中使用它,因为它正在被弃用。 + _this.thisVideo.src = window.URL.createObjectURL(stream) + } + _this.thisVideo.onloadedmetadata = function() { + _this.thisVideo.play() + } + }) + .catch(err => { + console.log(err) + }) + _this.getImage() } - navigator.mediaDevices - .getUserMedia(constraints) - .then(function(stream) { - // 旧的浏览器可能没有srcObject - if ('srcObject' in _this.thisVideo) { - _this.thisVideo.srcObject = stream - } else { - // 避免在新的浏览器中使用它,因为它正在被弃用。 - _this.thisVideo.src = window.URL.createObjectURL(stream) - } - _this.thisVideo.onloadedmetadata = function() { - _this.thisVideo.play() - } - }) - .catch(err => { - console.log(err) - }) }, // 绘制图片(拍照功能) setImage() { @@ -186,7 +188,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: '请录入工号' @@ -224,22 +228,46 @@ 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{ + 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 +287,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() { @@ -328,15 +336,9 @@ this.workNo = user.workNo this.realname = user.realname this.userInfoId = user.id - console.log(typeof user.birthday) - this.age = user.birthday - if (user.birthday != null) { - let time2 = new Date().getTime() - new Date(user.birthday + ' 00:00:00').getTime() - let date = new Date(time2) - this.age = date.getFullYear() - 1970 - } + console.log(typeof user.age) + this.age = user.age this.sex = user.sex - /*console.log(this.workNo+this.realname+this.userInfoId+this.age+this.sex)*/ this.fetchUser(value) } } -- Gitee From c822b22e53d348c5225029b0d206ded261490f54 Mon Sep 17 00:00:00 2001 From: xiongml Date: Fri, 4 Jun 2021 15:49:33 +0800 Subject: [PATCH 2/5] 'a' --- src/components/face/Face.vue | 114 ++++++++++++++++++----------------- 1 file changed, 59 insertions(+), 55 deletions(-) diff --git a/src/components/face/Face.vue b/src/components/face/Face.vue index 3034cad..8c9b5b5 100644 --- a/src/components/face/Face.vue +++ b/src/components/face/Face.vue @@ -56,6 +56,8 @@ + + @@ -97,6 +99,7 @@ }, mounted() { this.getCompetence() + this.getImage() }, methods: { ...mapActions(['faceLogin']), @@ -106,62 +109,57 @@ _this.thisCancas = document.getElementById('canvasCamera') _this.thisContext = this.thisCancas.getContext('2d') _this.thisVideo = document.getElementById('videoCamera') - if(_this.thisVideo.srcObject==null){ - this.$message.info("未检测到摄像头或摄像头损坏") - }else{ - _this.thisVideo.style.display = 'block' - // 获取媒体属性,旧版本浏览器可能不支持mediaDevices,我们首先设置一个空对象 - if (navigator.mediaDevices === undefined) { - navigator.mediaDevices = {} - } + _this.thisVideo.style.display = 'block' + // 获取媒体属性,旧版本浏览器可能不支持mediaDevices,我们首先设置一个空对象 + if (navigator.mediaDevices === undefined) { + navigator.mediaDevices = {} + } - // 一些浏览器实现了部分mediaDevices,我们不能只分配一个对象 - // 使用getUserMedia,因为它会覆盖现有的属性。 - // 这里,如果缺少getUserMedia属性,就添加它。 - if (navigator.mediaDevices.getUserMedia === undefined) { - navigator.mediaDevices.getUserMedia = function(constraints) { - // 首先获取现存的getUserMedia(如果存在) - const getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.getUserMedia - // 有些浏览器不支持,会返回错误信息 - // 保持接口一致 - if (!getUserMedia) {//不存在则报错 - return Promise.reject( - new Error('getUserMedia is not implemented in this browser') - ) - } - // 否则,使用Promise将调用包装到旧的navigator.getUserMedia - return new Promise(function(resolve, reject) { - getUserMedia.call(navigator, constraints, resolve, reject) - }) + // 一些浏览器实现了部分mediaDevices,我们不能只分配一个对象 + // 使用getUserMedia,因为它会覆盖现有的属性。 + // 这里,如果缺少getUserMedia属性,就添加它。 + if (navigator.mediaDevices.getUserMedia === undefined) { + navigator.mediaDevices.getUserMedia = function(constraints) { + // 首先获取现存的getUserMedia(如果存在) + const getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.getUserMedia + // 有些浏览器不支持,会返回错误信息 + // 保持接口一致 + if (!getUserMedia) {//不存在则报错 + return Promise.reject( + new Error('getUserMedia is not implemented in this browser') + ) } + // 否则,使用Promise将调用包装到旧的navigator.getUserMedia + return new Promise(function(resolve, reject) { + getUserMedia.call(navigator, constraints, resolve, reject) + }) } - const constraints = { - audio: false, - video: { - width: this.videoWidth, - height: this.videoHeight, - transform: 'scaleX(-1)' - } + } + const constraints = { + audio: false, + video: { + width: this.videoWidth, + height: this.videoHeight, + transform: 'scaleX(-1)' } - navigator.mediaDevices - .getUserMedia(constraints) - .then(function(stream) { - // 旧的浏览器可能没有srcObject - if ('srcObject' in _this.thisVideo) { - _this.thisVideo.srcObject = stream - } else { - // 避免在新的浏览器中使用它,因为它正在被弃用。 - _this.thisVideo.src = window.URL.createObjectURL(stream) - } - _this.thisVideo.onloadedmetadata = function() { - _this.thisVideo.play() - } - }) - .catch(err => { - console.log(err) - }) - _this.getImage() } + navigator.mediaDevices + .getUserMedia(constraints) + .then(function(stream) { + // 旧的浏览器可能没有srcObject + if ('srcObject' in _this.thisVideo) { + _this.thisVideo.srcObject = stream + } else { + // 避免在新的浏览器中使用它,因为它正在被弃用。 + _this.thisVideo.src = window.URL.createObjectURL(stream) + } + _this.thisVideo.onloadedmetadata = function() { + _this.thisVideo.play() + } + }) + .catch(err => { + console.log(err) + }) }, // 绘制图片(拍照功能) setImage() { @@ -227,10 +225,10 @@ }, searchImage() { - const _this = this 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) @@ -336,9 +334,15 @@ this.workNo = user.workNo this.realname = user.realname this.userInfoId = user.id - console.log(typeof user.age) - this.age = user.age + console.log(typeof user.birthday) + this.age = user.birthday + if (user.birthday != null) { + let time2 = new Date().getTime() - new Date(user.birthday + ' 00:00:00').getTime() + let date = new Date(time2) + this.age = date.getFullYear() - 1970 + } this.sex = user.sex + /*console.log(this.workNo+this.realname+this.userInfoId+this.age+this.sex)*/ this.fetchUser(value) } } @@ -356,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; -- Gitee From f0dbcd276886cfa1cc965f27717b22ee0045ffc1 Mon Sep 17 00:00:00 2001 From: xiongml Date: Fri, 4 Jun 2021 18:00:59 +0800 Subject: [PATCH 3/5] 'a' --- src/views/jobManage/Toolbox.vue | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/views/jobManage/Toolbox.vue b/src/views/jobManage/Toolbox.vue index d4b291f..d2dee2b 100644 --- a/src/views/jobManage/Toolbox.vue +++ b/src/views/jobManage/Toolbox.vue @@ -9,8 +9,9 @@
申请作业 - 更换工具 结束作业 + 更换工具 + 结束更换工具 退出系统 一键开锁 @@ -107,6 +108,7 @@ export default { }, getJobManageStatus() { let that = this + let flag = 0 for (let i = 0; i < that.jobManageList.length; i++) { let jobMangage = that.jobManageList[i] let params = { @@ -132,6 +134,14 @@ export default { } } }) + if(that.jobManageList[i].status!="0"){ + alert(flag) + flag = 1 + } + } + /*alert(flag)*/ + if(flag == 1){ + that.disabled = true } }, @@ -277,15 +287,20 @@ export default { if (res.success) { _this.disabled = true setTimeout(() => { - if (res.result === '') { _this.openAllDoorLoad = false this.$message.success(res.message) - } else { - _this.openAllDoorLoad = false - _this.$message.error('开锁失败' + res.result + '号') - } + 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() + /*this.reload()*/ + }else { + _this.openAllDoorLoad = false + _this.$message.error('开锁失败') } }) } -- Gitee From c18eb183223581c9cb30eb7b874687749e0d13c3 Mon Sep 17 00:00:00 2001 From: xiongml Date: Mon, 7 Jun 2021 10:25:45 +0800 Subject: [PATCH 4/5] 'toolbox' --- src/views/jobManage/Toolbox.vue | 137 +++++++++++++++++++++++--------- 1 file changed, 100 insertions(+), 37 deletions(-) diff --git a/src/views/jobManage/Toolbox.vue b/src/views/jobManage/Toolbox.vue index d2dee2b..4faa9bf 100644 --- a/src/views/jobManage/Toolbox.vue +++ b/src/views/jobManage/Toolbox.vue @@ -4,7 +4,7 @@ - 柜子{{ item.cupboardDoor }} + {{item.cabinetName}}
@@ -19,10 +19,19 @@ {{ 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 } } }) - if(that.jobManageList[i].status!="0"){ + if(that.jobManageList[i].status!="3"){ alert(flag) flag = 1 } @@ -152,26 +166,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 @@ -179,7 +195,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 @@ -188,9 +204,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 + '开锁失败') } @@ -199,18 +215,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 + 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) + this.replaceToolDialog = false + }, + //退出更换工具 + 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('未选择任何工具柜') @@ -220,26 +273,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 + 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) + this.exitReplaceToolDialog = false }, + //结束作业远程请求 endJobOk() { const _this = this this.confirmLoading = true @@ -255,12 +316,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 => { @@ -280,6 +342,7 @@ export default { document.getElementById('all').style.display = 'none' } }, + //一键开锁 openAllDoor() { let _this = this this.openAllDoorLoad = true @@ -339,7 +402,7 @@ export default { width: 200px; height: 85px; margin: 35px; - font-size: 17px; + font-size: 15px; } #job_btn .ant-btn { -- Gitee From 0db4f394c2a84091373cf97eb5f6fae106c81698 Mon Sep 17 00:00:00 2001 From: xiongml Date: Mon, 7 Jun 2021 12:03:17 +0800 Subject: [PATCH 5/5] 'tool' --- src/views/jobManage/Toolbox.vue | 52 ++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/src/views/jobManage/Toolbox.vue b/src/views/jobManage/Toolbox.vue index 4faa9bf..68a925e 100644 --- a/src/views/jobManage/Toolbox.vue +++ b/src/views/jobManage/Toolbox.vue @@ -13,7 +13,7 @@ 更换工具 结束更换工具 退出系统 - 一键开锁 + 一键开锁
{ 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) @@ -248,7 +240,6 @@ export default { _this.jobManageList[_this.index].status = "2"} }) },2000) - this.replaceToolDialog = false }, //退出更换工具 exitReplaceTool(){ @@ -290,6 +281,7 @@ export default { } setTimeout(()=>{ this.exitReplaceLoading = false + this.exitReplaceToolDialog = false putAction(this.url.exitReplace,params).then(res =>{ if(res.success){ _this.$message.success(_this.cabinetName + '中' + _this.toolboxName + '已结束更换工具') @@ -298,7 +290,6 @@ export default { } }) },2000) - this.exitReplaceToolDialog = false }, //结束作业远程请求 endJobOk() { @@ -345,27 +336,42 @@ export default { //一键开锁 openAllDoor() { let _this = this - this.openAllDoorLoad = true - getAction(this.url.openAllDoor).then(res => { - if (res.success) { - _this.disabled = true - setTimeout(() => { + 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) let arr = res.result.split(',') _this.operator = arr[arr.length-1] /*alert(_this.operator)*/ - _this.jobManageList.forEach(job=>{ + /*_this.jobManageList.forEach(job=>{ document.getElementById(job.cupboardDoor).style.backgroundColor = '#FF0000' document.getElementById(job.cupboardDoor).innerText = job.toolboxName + '已借出:' + _this.operator - }) - }, 2000) - /*this.reload()*/ - }else { + })*/ + }, 2000) + this.reload() + }else { _this.openAllDoorLoad = false _this.$message.error('开锁失败') } }) + } } } } -- Gitee