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