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.
64 lines
1.6 KiB
64 lines
1.6 KiB
import { control } from 'apis/system'
|
|
import { FtMessage } from 'libs/message'
|
|
import { cmdNameMap } from 'libs/utils'
|
|
import { defineStore } from 'pinia'
|
|
import { useSystemStore } from 'stores/systemStore'
|
|
|
|
export const useHomeStore = defineStore('home', {
|
|
state: (): Home.HomeStore => ({
|
|
heatAreaList: [
|
|
{
|
|
label: 'A-1',
|
|
value: 'heat_module_01',
|
|
selected: false,
|
|
},
|
|
{
|
|
label: 'A-2',
|
|
value: 'heat_module_02',
|
|
selected: false,
|
|
},
|
|
{
|
|
label: 'A-3',
|
|
value: 'heat_module_03',
|
|
selected: false,
|
|
},
|
|
{
|
|
label: 'A-4',
|
|
value: 'heat_module_04',
|
|
selected: false,
|
|
},
|
|
{
|
|
label: 'A-5',
|
|
value: 'heat_module_05',
|
|
selected: false,
|
|
},
|
|
{
|
|
label: 'A-6',
|
|
value: 'heat_module_06',
|
|
selected: false,
|
|
},
|
|
],
|
|
}),
|
|
actions: {
|
|
selectChange(index: number) {
|
|
this.heatAreaList[index].selected = !this.heatAreaList[index].selected
|
|
console.log(this.heatAreaList)
|
|
},
|
|
async sendControl(params: System.CmdControlParams<{ [key: string]: any }>) {
|
|
if (!params.commandId) {
|
|
params.commandId = Date.now().toString()
|
|
}
|
|
const systemStore = useSystemStore()
|
|
|
|
systemStore.systemList = []
|
|
|
|
// 使用提取的 key 匹配 cmdNameMap
|
|
const cmdName = cmdNameMap[params.command as keyof typeof cmdNameMap] || params.command
|
|
|
|
await control(params)
|
|
systemStore.updateStreamVisible(true)
|
|
FtMessage.success(`[${cmdName}]已发送`)
|
|
},
|
|
},
|
|
persist: false,
|
|
})
|