| | |
| | | import { ref, computed } from 'vue' |
| | | import { defineStore } from 'pinia' |
| | | import { defineStore } from 'pinia'; |
| | | |
| | | export const useCounterStore = defineStore('counter', () => { |
| | | const count = ref(0) |
| | | const doubleCount = computed(() => count.value * 2) |
| | | function increment() { |
| | | count.value++ |
| | | export const useCounterStore = defineStore('enterprise', { |
| | | |
| | | state: () => { |
| | | return { |
| | | companyId: window.sessionStorage.getItem('companyId'), |
| | | departId: window.sessionStorage.getItem('departId'), |
| | | delayNum: 0, // 延期计划数 |
| | | deviceNum: 0, // 今日生产设备数 |
| | | ingNum: 0, // 执行中计划数 |
| | | prouserNum: 0, // 今日生产人数 |
| | | unqualifiedRate: 0, // 今日不良品率 |
| | | procedureName: '' // 工序名称 |
| | | }; |
| | | }, |
| | | |
| | | actions: { |
| | | // 设置企业id |
| | | setCompanyId(companyId) { |
| | | this.companyId = companyId; |
| | | window.sessionStorage.setItem('companyId', companyId); |
| | | }, |
| | | // 设置组织id |
| | | setDepartId(departId) { |
| | | this.departId = departId; |
| | | window.sessionStorage.setItem('departId', departId); |
| | | }, |
| | | setNum(num) { |
| | | this.delayNum = num.delayNum |
| | | this.deviceNum = num.deviceNum |
| | | this.ingNum = num.ingNum |
| | | this.prouserNum = num.prouserNum |
| | | this.unqualifiedRate = num.unqualifiedRate |
| | | }, |
| | | setProcedureName(title) { |
| | | this.procedureName = title |
| | | } |
| | | } |
| | | |
| | | return { count, doubleCount, increment } |
| | | }) |