123456789101112131415161718192021222324252627282930313233343536 |
- import { defineStore } from 'pinia'
- import { reactive, ref } from 'vue'
- import { queryProjectCost } from '@/api/cost'
- export const payData = defineStore('expenses', () => {
- const projectCostList = reactive([])
- const costListTotal = ref(0)
- const getCostList = (data) => {
- queryProjectCost(data).then(res => {
- if (res.code === 0) {
- projectCostList.length = 0
- const list = res.data.list === null ? [] : res.data.list
- console.log('查询项目费用', list)
- projectCostList.push(...list)
- costListTotal.value = res.data.total
- }
- })
- }
- const changeCostList = (list) => {
- costListTotal.value = list.length
- if (list.length > 8) {
- list = list.slice(0, 8)
- }
- projectCostList.length = 0
- projectCostList.push(...list)
- }
- const changeCostTotal = (total) => {
- costListTotal.value = total
- }
- return {
- projectCostList,
- changeCostList,
- costListTotal,
- changeCostTotal,
- getCostList
- }
- })
|