4 changed files with 60 additions and 17 deletions
@ -1,6 +1,7 @@ |
|||
import { createPinia } from 'pinia' |
|||
import { useAccountStore } from './modules/account' |
|||
import { useTaskStore } from './modules/task' |
|||
const store = createPinia() |
|||
|
|||
export default store |
|||
export { useAccountStore } |
|||
export { useAccountStore, useTaskStore } |
@ -0,0 +1,32 @@ |
|||
import { defineStore } from 'pinia' |
|||
import { getNuclearExcelApi } from '@/api' |
|||
export const useTaskStore = defineStore({ |
|||
id: 'task', // id必填,且需要唯一
|
|||
state: () => { |
|||
return { |
|||
type: 0, // 0为实时数据 1为历史数据
|
|||
excelData: [], |
|||
} |
|||
}, |
|||
// actions
|
|||
actions: { |
|||
updateType(type) { |
|||
this.type = type |
|||
}, |
|||
updateExcelData(excelData) { |
|||
this.excelData = excelData |
|||
}, |
|||
async getExcelList(taskId) { |
|||
const res = await getNuclearExcelApi(taskId) |
|||
if (res?.code == 200) { |
|||
// 根据data的serialNumber算出序列号
|
|||
const list = res.data.list |
|||
list.map(item => { |
|||
const arr = item.serialNumber.split('-') |
|||
item.num = parseInt(arr[0]) * 14 + parseInt(arr[1]) + 1 |
|||
}) |
|||
this.excelData = list |
|||
} |
|||
}, |
|||
}, |
|||
}) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue