You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.2 KiB
70 lines
2.2 KiB
import { defineStore } from 'pinia'
|
|
export const useSealStore = defineStore({
|
|
id: 'seal', // id必填,且需要唯一
|
|
// state
|
|
state: () => {
|
|
return {
|
|
// 0~800kPa
|
|
currentAirPressure: 0,
|
|
isStartTest: false,
|
|
oldAirPressure: null,
|
|
airInletProportionalValue: 0,
|
|
airOutletProportionalValue: 0,
|
|
// 初始化的机器阀门信息
|
|
airInletProportionalInitVal: 0,
|
|
airOutletProportionalInitVal: 0,
|
|
allPressure: [0, 0, 0, 0],
|
|
airCompressorValve1: 0,
|
|
airCompressorValve2: 0,
|
|
airCompressorChannelSelectVal: 1,
|
|
}
|
|
},
|
|
// actions
|
|
actions: {
|
|
updateAirCompressorChannelSelectVal(airCompressorChannelSelectVal) {
|
|
this.airCompressorChannelSelectVal = airCompressorChannelSelectVal
|
|
},
|
|
updateAirCompressorValve1(airCompressorValve1) {
|
|
this.airCompressorValve1 = airCompressorValve1
|
|
},
|
|
updateAirCompressorValve2(airCompressorValve2) {
|
|
this.airCompressorValve2 = airCompressorValve2
|
|
},
|
|
updateAllPressure(allPressure) {
|
|
this.allPressure = allPressure
|
|
},
|
|
updateAirInletProportionalInitVal(airInletProportionalInitVal) {
|
|
this.airInletProportionalInitVal = airInletProportionalInitVal
|
|
},
|
|
updateAirOutletProportionalInitVal(airOutletProportionalInitVal) {
|
|
this.airOutletProportionalInitVal = airOutletProportionalInitVal
|
|
},
|
|
updateAirInletProportionalValue(airInletProportionalValue) {
|
|
this.airInletProportionalValue = airInletProportionalValue
|
|
},
|
|
updateAirOutletProportionalValue(airOutletProportionalValue) {
|
|
this.airOutletProportionalValue = airOutletProportionalValue
|
|
},
|
|
updateCurrentAirPressure(currentAirPressure) {
|
|
this.currentAirPressure = currentAirPressure
|
|
},
|
|
updateIsStartTest(isStartTest) {
|
|
this.isStartTest = isStartTest
|
|
},
|
|
updateOldAirPressure(oldAirPressure) {
|
|
this.oldAirPressure = oldAirPressure
|
|
},
|
|
},
|
|
getters: {
|
|
differenceValue(state) {
|
|
if (state.isStartTest) {
|
|
if (state.oldAirPressure != null && state.currentAirPressure != null) {
|
|
return Math.abs(
|
|
state.oldAirPressure - state.currentAirPressure,
|
|
).toFixed(1)
|
|
}
|
|
}
|
|
return null
|
|
},
|
|
},
|
|
})
|