4人一屏 通过watch来解决失败
This commit is contained in:
parent
9c0e859f2f
commit
195bcdba6c
@ -19,8 +19,8 @@ const getters = {
|
||||
onlineUserNum: (state) => state.socket.onlineNum,
|
||||
noticeList: (state) => state.socket.noticeList,
|
||||
//质量管理模块
|
||||
currentWorkOrder_first: (state) => state.socket.currentWorkOrder_first,
|
||||
currentWorkOrder_again: (state) => state.socket.currentWorkOrder_again,
|
||||
currentWorkOrder_thirty: (state) => state.socket.currentWorkOrder_thirty,
|
||||
currentWorkOrder_first: (state) => state.quality.currentWorkOrder_first,
|
||||
currentWorkOrder_again: (state) => state.quality.currentWorkOrder_again,
|
||||
currentWorkOrder_thirty: (state) => state.quality.currentWorkOrder_thirty,
|
||||
}
|
||||
export default getters
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
// 质量模块 共享变量
|
||||
|
||||
import { get_next_current_workorder, get_previous_current_workorder } from '@/api/qualityManagement/firstFQC.js'
|
||||
import { Message, Notify } from 'element-ui'
|
||||
|
||||
const state = {
|
||||
currentWorkOrder_first: null, // 当前工单(首检)
|
||||
currentWorkOrder_again: null, // 当前工单(二检)
|
||||
@ -18,21 +22,47 @@ const mutations = {
|
||||
}
|
||||
|
||||
const actions = {
|
||||
change__currentWorkOrder_first({ commit }, data) {
|
||||
commit('SET_currentWorkOrder_first', data)
|
||||
/* 首检 */
|
||||
|
||||
// 获取上一个工单
|
||||
Get_previous_currentWorkOrder_first({ commit }, data) {
|
||||
get_previous_current_workorder().then((res) => {
|
||||
if (res.code == 200) {
|
||||
if (res.data != null) {
|
||||
commit('SET_currentWorkOrder_first', res.data)
|
||||
Message.success('获取工单号成功')
|
||||
} else {
|
||||
Notify.warning('没有生产工单')
|
||||
}
|
||||
} else if (res.code == 210) {
|
||||
Notify.warning('没有生产工单')
|
||||
}
|
||||
})
|
||||
},
|
||||
change__currentWorkOrder_again({ commit }, data) {
|
||||
commit('SET_currentWorkOrder_again', data)
|
||||
//获取下一个工单
|
||||
Get_next_current_workorder_first({ commit }, data) {
|
||||
get_next_current_workorder().then((res) => {
|
||||
if (res.code == 200) {
|
||||
if (res.data != null) {
|
||||
commit('SET_currentWorkOrder_first', res.data)
|
||||
Message.success('获取工单号成功')
|
||||
} else {
|
||||
Notify.warning('已经是最后一个工单,没有工单了')
|
||||
}
|
||||
} else if (res.code == 210) {
|
||||
Notify.warning('已经是最后一个工单,没有工单了')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
change__currentWorkOrder_thirty({ commit }, data) {
|
||||
commit('SET_currentWorkOrder_thirty', data)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions,
|
||||
}
|
||||
|
||||
@ -546,13 +546,35 @@ export default {
|
||||
toUpdateNum: 0, //弹窗更新值
|
||||
toname: '',
|
||||
toindex: 0, //索引
|
||||
timer: null,//定时器
|
||||
timer: null, //定时器
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getcurrentWorkorder()
|
||||
},
|
||||
mounted() {},
|
||||
watch: {
|
||||
'$store.getters.currentWorkOrder_first': {
|
||||
handler(newValue, oldValue) {
|
||||
this.CurrentWorkorder = newValue
|
||||
//获取检测项
|
||||
GetcheckItemTable({ workorderID: this.CurrentWorkorder.clientWorkorder }).then((result) => {
|
||||
if (result.code == 200) {
|
||||
this.paint = result.data.paint
|
||||
|
||||
this.device = result.data.device
|
||||
|
||||
this.blank = result.data.blank
|
||||
|
||||
this.program = result.data.program
|
||||
|
||||
this.team = result.data.team
|
||||
this.$loading().close()
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
// 计算合格数
|
||||
calculate_firstPassNumber() {
|
||||
@ -683,9 +705,8 @@ export default {
|
||||
return this.CurrentWorkorder.defectNumber
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions({ change_polish_total_number: 'inspection/change_polish_total_number' }),
|
||||
|
||||
methods: {
|
||||
//todo 获取当前工单检测项及其数量
|
||||
/* getCheckItemList() {
|
||||
// 1.拿到工单
|
||||
@ -726,7 +747,6 @@ export default {
|
||||
if (res.code == 200) {
|
||||
if (res.data != undefined) {
|
||||
this.CurrentWorkorder = res.data
|
||||
|
||||
this.$message.success('更新今日工单号成功')
|
||||
this.$loading()
|
||||
return GetcheckItemTable({ workorderID: this.CurrentWorkorder.clientWorkorder })
|
||||
@ -738,13 +758,9 @@ export default {
|
||||
.then((result) => {
|
||||
if (result.code == 200) {
|
||||
this.paint = result.data.paint
|
||||
|
||||
this.device = result.data.device
|
||||
|
||||
this.blank = result.data.blank
|
||||
|
||||
this.program = result.data.program
|
||||
|
||||
this.team = result.data.team
|
||||
this.$loading().close()
|
||||
}
|
||||
@ -758,64 +774,13 @@ export default {
|
||||
},
|
||||
//todo 获取下一个工单号
|
||||
getNext_current_workorder() {
|
||||
get_next_current_workorder()
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
if (res.data != null) {
|
||||
this.CurrentWorkorder = res.data
|
||||
this.$loading()
|
||||
this.$message.success('获取工单号成功')
|
||||
|
||||
return GetcheckItemTable({ workorderID: this.CurrentWorkorder.clientWorkorder })
|
||||
} else {
|
||||
this.$notify.warning('已经是最后一个工单,没有工单了')
|
||||
}
|
||||
} else if (res.code == 210) {
|
||||
this.$notify.warning('已经是最后一个工单,没有工单了')
|
||||
}
|
||||
})
|
||||
.then((result) => {
|
||||
if (result.code == 200) {
|
||||
this.paint = result.data.paint
|
||||
|
||||
this.device = result.data.device
|
||||
|
||||
this.blank = result.data.blank
|
||||
|
||||
this.program = result.data.program
|
||||
|
||||
this.team = result.data.team
|
||||
this.$loading().close()
|
||||
}
|
||||
})
|
||||
this.$store.dispatch('quality/Get_next_current_workorder_first')
|
||||
this.$loading()
|
||||
},
|
||||
//todo 获取上一个工单号
|
||||
getPrevious_current_workorder() {
|
||||
get_previous_current_workorder()
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
if (res.data != null) {
|
||||
this.CurrentWorkorder = res.data
|
||||
this.$loading()
|
||||
this.$message.success('获取工单号成功')
|
||||
return GetcheckItemTable({ workorderID: this.CurrentWorkorder.clientWorkorder })
|
||||
} else {
|
||||
this.$notify.warning('没有生产工单')
|
||||
}
|
||||
} else if (res.code == 210) {
|
||||
this.$notify.warning('没有生产工单')
|
||||
}
|
||||
})
|
||||
.then((result) => {
|
||||
if (result.code == 200) {
|
||||
this.paint = result.data.paint
|
||||
this.device = result.data.device
|
||||
this.blank = result.data.blank
|
||||
this.program = result.data.program
|
||||
this.team = result.data.team
|
||||
this.$loading().close()
|
||||
}
|
||||
})
|
||||
this.$store.dispatch('quality/Get_previous_currentWorkOrder_first')
|
||||
this.$loading()
|
||||
},
|
||||
|
||||
//todo 累加器 这里是值传递还是引用传递??????????????????????????????
|
||||
@ -918,12 +883,11 @@ export default {
|
||||
this.DMLdialog.visiable = false
|
||||
},
|
||||
|
||||
//todo 定时任务 ,每4s 获取一次当前工单
|
||||
//todo 定时任务 ,每4s 获取一次当前工单
|
||||
|
||||
startTimer() {
|
||||
this.timer = setInterval(() => {
|
||||
//this.getcurrentWorkorder()
|
||||
|
||||
}, 4000)
|
||||
},
|
||||
stopTimer() {
|
||||
@ -933,7 +897,6 @@ export default {
|
||||
beforeDestroy() {
|
||||
this.stopTimer()
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user