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.
 
 
 
 
 

291 lines
9.3 KiB

import { logout } from 'apis/login'
import { delToken } from 'libs/token'
import { defineStore } from 'pinia'
import router from '@/router'
export const useSystemStore = defineStore('system', {
state: (): System.SystemStore => ({
systemStatus: {
virtual: false,
initComplete: true,
selfTest: true,
emergencyStop: false,
currentUser: {
id: 1,
username: 'admin',
nickname: '管理员',
fixedUser: 'ENABLE',
},
currentTasks: null,
doorModule: {
open: false,
},
transferModule: {
idle: true,
trayStatus: false,
},
solutionModule: {
idle: true,
feedAreaTrayStatus: false,
pumping: false,
valveState: {
state: 1,
},
solutionContainer: [
{
containerCode: 1,
type: 'solution',
empty: false,
full: false,
filledSolution: false,
},
{
containerCode: 2,
type: 'solution',
empty: false,
full: false,
filledSolution: false,
},
{
containerCode: 3,
type: 'solution',
empty: false,
full: false,
filledSolution: false,
},
{
containerCode: 4,
type: 'solution',
empty: false,
full: false,
filledSolution: false,
},
],
},
heatModule: [
{
moduleCode: 'heat_module_01',
enable: true,
trayStatus: true,
heatingType: 'heating',
fanOpen: false,
targetTemperature: 0,
temperature: 0,
startHeatTime: 1749126403564,
targetTime: 1800,
},
{
moduleCode: 'heat_module_02',
enable: true,
trayStatus: true,
heatingType: 'stop',
fanOpen: true,
dryTemperature: 0,
annealTemperature: 0,
heatTemperature: 0,
targetTemperature: 0,
temperature: 0,
},
{
moduleCode: 'heat_module_03',
enable: true,
trayStatus: true,
heatingType: 'drying',
fanOpen: false,
dryTemperature: 0,
annealTemperature: 0,
heatTemperature: 0,
targetTemperature: 0,
temperature: 0,
},
{
moduleCode: 'heat_module_04',
enable: true,
trayStatus: true,
heatingType: 'annealing',
fanOpen: false,
dryTemperature: 0,
annealTemperature: 0,
heatTemperature: 0,
targetTemperature: 0,
temperature: 0,
},
],
trays: [
{
uuid: '22',
heatModuleCode: 'heat_module_01',
inFeedArea: false,
inSolutionPositon: false,
inHeatModule: true,
useArm: true,
tubes: [
{
columnNum: 1,
addSolution: true,
exists: true,
},
{
columnNum: 2,
addSolution: true,
exists: true,
},
{
columnNum: 3,
addSolution: true,
exists: false,
},
{
columnNum: 4,
addSolution: true,
exists: true,
},
{
columnNum: 5,
addSolution: true,
exists: true,
},
],
crafts: {
craft: {
id: 1,
name: '菱锌矿硫酸溶解法',
steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
},
state: 'RUNNING',
currentIndex: 1,
},
},
{
uuid: '3',
heatModuleCode: 'heat_module_02',
inFeedArea: false,
inSolutionPositon: true,
inHeatModule: false,
tubes: [
{
columnNum: 1,
addSolution: true,
exists: true,
},
{
columnNum: 2,
addSolution: true,
exists: true,
},
{
columnNum: 3,
addSolution: true,
exists: false,
},
{
columnNum: 4,
addSolution: true,
exists: true,
},
{
columnNum: 5,
addSolution: true,
exists: true,
},
],
// crafts: {
// craft: {
// id: 1,
// name: '菱锌矿硫酸溶解法',
// steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
// },
// state: 'RUNNING',
// currentIndex: 1,
// },
},
{
uuid: '5',
heatModuleCode: 'heat_module_03',
inFeedArea: false,
inSolutionPositon: false,
inHeatModule: true,
tubes: [
{
columnNum: 1,
addSolution: true,
exists: true,
},
],
// crafts: {
// craft: {
// id: 1,
// name: '菱锌矿硫酸溶解法',
// steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
// },
// state: 'RUNNING',
// currentIndex: 1,
// },
},
{
uuid: '5',
heatModuleCode: 'heat_module_04',
inFeedArea: false,
inSolutionPositon: false,
inHeatModule: true,
tubes: [
],
// crafts: {
// craft: {
// id: 1,
// name: '菱锌矿硫酸溶解法',
// steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
// },
// state: 'RUNNING',
// currentIndex: 1,
// },
},
],
},
systemUser: {
username: '111',
},
loginForm: {
username: import.meta.env.FT_NODE_ENV !== 'prod' ? 'admin' : '',
password: import.meta.env.FT_NODE_ENV !== 'prod' ? '123456' : '',
},
menuExpand: true,
isDebug: import.meta.env.FT_NODE_ENV !== 'prod',
streamVisible: false,
errorCraft: false,
systemList: [],
systemLogList: [],
currentTime: '0000-00-00 00:00:00',
}),
actions: {
insertLog(log: System.SystemLog) {
this.systemLogList.unshift(log)
this.systemLogList = this.systemLogList.slice(0, 200)
},
updateDebug() {
this.isDebug = !this.isDebug
},
updateSystemStatus(data: System.SystemStatus) {
this.systemStatus = data
},
updateStreamVisible(bool: boolean) {
this.streamVisible = bool
},
updateMenuExpand() {
this.menuExpand = !this.menuExpand
},
updateSystemUser(data: System.SystemUser) {
this.systemUser = data
},
pushSystemList(text: any) {
this.systemList.push(text)
},
logout() {
logout().then(() => {
delToken()
router.push('/login').then(() => {})
})
},
},
persist: import.meta.env.FT_NODE_ENV === 'prod',
})