瀏覽代碼

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	web/src/api/cost.js
#	web/src/view/dashboard/index.vue
2545307760@qq.com 7 月之前
父節點
當前提交
f14df68e9f

+ 66 - 0
server/api/v1/admin/finance.go

@@ -65,6 +65,16 @@ func (fa *FinanceApi) QueryExpensesGenre(c *gin.Context) {
 	response.OkWithData(genre, c)
 }
 
+func (fa *FinanceApi) QueryProjectFeeGenre(c *gin.Context) {
+	genre, err := financeService.QueryProjectFeeGenre()
+	if err != nil {
+		response.FailWithMessage("失败", c)
+		global.GVA_LOG.Error("QueryProjectFeeGenre ====== " + err.Error())
+		return
+	}
+	response.OkWithData(genre, c)
+}
+
 func (fa *FinanceApi) QueryBorrowingList(c *gin.Context) {
 	var info request.SearchNameTime
 	err := c.ShouldBindJSON(&info)
@@ -171,6 +181,23 @@ func (fa *FinanceApi) CreateExpensesGenre(c *gin.Context) {
 	response.OkWithMessage("新增成功", c)
 }
 
+func (fa *FinanceApi) CreateProjectFeeGenre(c *gin.Context) {
+	var projectFeeGenre dao.ProjectFeeGenre
+	err := c.ShouldBindJSON(&projectFeeGenre)
+	if err != nil {
+		response.FailWithMessage("失败", c)
+		global.GVA_LOG.Error("CreateProjectFeeGenre ====== " + err.Error())
+		return
+	}
+	err = financeService.CreateProjectFeeGenre(projectFeeGenre)
+	if err != nil {
+		response.FailWithMessage("失败", c)
+		global.GVA_LOG.Error("CreateProjectFeeGenre ====== " + err.Error())
+		return
+	}
+	response.OkWithMessage("新增成功", c)
+}
+
 func (fa *FinanceApi) CreateBorrowing(c *gin.Context) {
 	var borrowing dao.Borrowing
 	err := c.ShouldBindJSON(&borrowing)
@@ -281,6 +308,23 @@ func (fa *FinanceApi) UpdateExpensesGenre(c *gin.Context) {
 	response.OkWithMessage("更新成功", c)
 }
 
+func (fa *FinanceApi) UpdateProjectFeeGenre(c *gin.Context) {
+	var projectFeeGenre dao.ProjectFeeGenre
+	err := c.ShouldBindJSON(&projectFeeGenre)
+	if err != nil {
+		response.FailWithMessage("失败", c)
+		global.GVA_LOG.Error("UpdateProjectFeeGenre ====== " + err.Error())
+		return
+	}
+	err = financeService.UpdateProjectFeeGenre(projectFeeGenre)
+	if err != nil {
+		response.FailWithMessage("失败", c)
+		global.GVA_LOG.Error("UpdateProjectFeeGenre ====== " + err.Error())
+		return
+	}
+	response.OkWithMessage("更新成功", c)
+}
+
 func (fa *FinanceApi) UpdateBorrowing(c *gin.Context) {
 	var borrowing dao.Borrowing
 	err := c.ShouldBindJSON(&borrowing)
@@ -337,6 +381,28 @@ func (fa *FinanceApi) DeleteExpensesGenre(c *gin.Context) {
 	response.OkWithMessage("删除成功", c)
 }
 
+func (fa *FinanceApi) DeleteProjectFeeGenre(c *gin.Context) {
+	var projectFeeGenre dao.ProjectFeeGenre
+	err := c.ShouldBindJSON(&projectFeeGenre)
+	if err != nil {
+		response.FailWithMessage("失败", c)
+		global.GVA_LOG.Error("DeleteProjectFeeGenre ====== " + err.Error())
+		return
+	}
+	err = financeService.DeleteProjectFeeGenre(projectFeeGenre)
+	if err != nil {
+		if err.Error() == "项目收费类型正在被使用" {
+			response.FailWithMessage("项目收费类型正在被使用", c)
+			global.GVA_LOG.Error("DeleteProjectFeeGenre ====== " + err.Error())
+			return
+		}
+		response.FailWithMessage("失败", c)
+		global.GVA_LOG.Error("DeleteProjectFeeGenre ====== " + err.Error())
+		return
+	}
+	response.OkWithMessage("删除成功", c)
+}
+
 func (fa *FinanceApi) DeleteBorrowing(c *gin.Context) {
 	var borrowing dao.Borrowing
 	err := c.ShouldBindJSON(&borrowing)

+ 2 - 1
server/api/v1/admin/project.go

@@ -236,7 +236,8 @@ func (pa *ProjectApi) QueryReimbursement(c *gin.Context) {
 }
 
 func (pa *ProjectApi) QueryProjectSum(c *gin.Context) {
-	sum, err := projectService.QueryProjectSum()
+	code := c.Query("code")
+	sum, err := projectService.QueryProjectSum(code)
 	if err != nil {
 		response.FailWithMessage("失败", c)
 		global.GVA_LOG.Error("QueryProjectSum ====== " + err.Error())

+ 10 - 8
server/dao/monthExpenses.go

@@ -7,11 +7,13 @@ import (
 
 type MonthExpenses struct {
 	global.GVA_MODEL
-	DepartmentId     int        `json:"departmentId" form:"departmentId" gorm:"comment:部门id"`
-	Department       Department `json:"department" form:"department" gorm:"foreignKey:DepartmentId;references:id;"`
-	TotalDeposit     float64    `json:"totalDeposit" form:"totalDeposit" gorm:"comment:总支入;type:double(10,2)"`
-	TotalExpenditure float64    `json:"totalExpenditure" form:"totalExpenditure" gorm:"comment:总支出;type:double(10,2)"`
-	SettlementMonth  string     `json:"settlementMonth" form:"settlementMonth" gorm:"comment:结算月份"`
+	DepartmentId     int           `json:"departmentId" form:"departmentId" gorm:"comment:部门id"`
+	Department       Department    `json:"department" form:"department" gorm:"foreignKey:DepartmentId;references:id;"`
+	Genre            int           `json:"genre" form:"genre" gorm:"comment:费用类型Id"`
+	ExpensesGenre    ExpensesGenre `json:"expensesGenre" form:"expensesGenre" gorm:"foreignKey:Genre;references:id;"`
+	TotalDeposit     float64       `json:"totalDeposit" form:"totalDeposit" gorm:"comment:总支入;type:double(10,2)"`
+	TotalExpenditure float64       `json:"totalExpenditure" form:"totalExpenditure" gorm:"comment:总支出;type:double(10,2)"`
+	SettlementMonth  string        `json:"settlementMonth" form:"settlementMonth" gorm:"comment:结算月份"`
 }
 
 func (MonthExpenses) TableName() string {
@@ -19,14 +21,14 @@ func (MonthExpenses) TableName() string {
 }
 
 func QueryMonthExpenses(monthTime, yearTime string) (monthExpenses []MonthExpenses, err error) {
-	db := global.GVA_DB.Model(&MonthExpenses{}).Debug().Select("department_id, SUM(total_deposit) AS total_deposit, SUM(total_expenditure) AS total_expenditure")
+	db := global.GVA_DB.Debug().Model(&MonthExpenses{}).Select("department_id, SUM(total_deposit) AS total_deposit, SUM(total_expenditure) AS total_expenditure")
 	if monthTime != "" {
 		db = db.Where("DATE_FORMAT(CONCAT(settlement_month, '-01'), '%Y-%m') = ?", monthTime)
 	}
 	if yearTime != "" {
 		db = db.Where("DATE_FORMAT(CONCAT(settlement_month, '-01'), '%Y') = ?", yearTime)
 	}
-	err = db.Group("department_id").Preload("Department").Find(&monthExpenses).Error
+	err = db.Group("department_id").Preload("ExpensesGenre").Preload("Department").Find(&monthExpenses).Error
 	return monthExpenses, err
 }
 
@@ -38,7 +40,7 @@ func CreateMonthExpenses() error {
 			return txErr
 		}
 		var fees []MonthExpenses
-		txErr = tx.Raw(`SELECT DATE_FORMAT(fee_time, '%Y-%m') AS settlement_month,department_id, SUM(deposit_amount) AS total_deposit, SUM(expenditure_amount) AS total_expenditure FROM  expenses GROUP BY DATE_FORMAT(fee_time, '%Y-%m'),department_id`).Scan(&fees).Error
+		txErr = tx.Raw(`SELECT DATE_FORMAT(fee_time, '%Y-%m') AS settlement_month,department_id, genre, SUM(deposit_amount) AS total_deposit, SUM(expenditure_amount) AS total_expenditure FROM  expenses GROUP BY DATE_FORMAT(fee_time, '%Y-%m'),department_id,genre`).Scan(&fees).Error
 		if txErr != nil {
 			return txErr
 		}

+ 10 - 3
server/dao/project.go

@@ -113,13 +113,20 @@ type ProjectSum struct {
 }
 
 // QueryProjectSum 查询项目总
-func QueryProjectSum() (projectSum ProjectSum, err error) {
+func QueryProjectSum(code string) (projectSum ProjectSum, err error) {
 	err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
-		txErr := tx.Model(&Project{}).Select("SUM(project_price) AS total_project_amount").First(&projectSum).Error
+		projectDB := tx.Model(&Project{}).Select("SUM(project_price) AS total_project_amount")
+		collectionDB := tx.Model(&Collection{}).Select("SUM(collection_price) AS total_collection_amount")
+		if code != "" {
+			projectDB = projectDB.Where("code =?", code)
+			collectionDB = collectionDB.Where("project_code =?", code)
+		}
+
+		txErr := projectDB.First(&projectSum).Error
 		if txErr != nil {
 			return txErr
 		}
-		txErr = tx.Model(&Collection{}).Select("SUM(collection_price) AS total_collection_amount").First(&projectSum).Error
+		txErr = collectionDB.First(&projectSum).Error
 		if txErr != nil {
 			return txErr
 		}

+ 5 - 0
server/dao/projectFee.go

@@ -54,6 +54,11 @@ func QueryProjectFeeList(limit, offset, genre, name int, code, dayTime, monthTim
 	return projectFee, total, err
 }
 
+func QueryProjectFeeByGenre(genre int) (projectFee []ProjectFee, err error) {
+	err = global.GVA_DB.Model(&ProjectFee{}).Where("genre = ?", genre).Find(&projectFee).Error
+	return projectFee, err
+}
+
 func (e ProjectFee) CreateProjectFee() error {
 	return global.GVA_DB.Create(&e).Error
 }

+ 5 - 3
server/dao/projectMonthFee.go

@@ -7,6 +7,8 @@ import (
 
 type ProjectMonthFee struct {
 	global.GVA_MODEL
+	ProjectCode      string          `json:"projectCode" form:"projectCode" gorm:"comment:项目编码"`
+	Project          Project         `json:"project" form:"project" gorm:"foreignKey:ProjectCode;references:code;"`
 	Genre            int             `json:"genre" form:"genre" gorm:"comment:费用类型Id"`
 	ProjectFeeGenre  ProjectFeeGenre `json:"projectFeeGenre" form:"projectFeeGenre" gorm:"foreignKey:Genre;references:id;"`
 	TotalDeposit     float64         `json:"totalDeposit" form:"totalDeposit" gorm:"comment:总支入;type:double(10,2)"`
@@ -19,14 +21,14 @@ func (ProjectMonthFee) TableName() string {
 }
 
 func QueryProjectMonthFee(monthTime, yearTime string) (monthFees []ProjectMonthFee, err error) {
-	db := global.GVA_DB.Model(&ProjectMonthFee{}).Debug().Select("genre, SUM(total_deposit) AS total_deposit, SUM(total_expenditure) AS total_expenditure")
+	db := global.GVA_DB.Model(&ProjectMonthFee{}).Select("genre, SUM(total_deposit) AS total_deposit, SUM(total_expenditure) AS total_expenditure")
 	if monthTime != "" {
 		db = db.Where("DATE_FORMAT(CONCAT(settlement_month, '-01'), '%Y-%m') = ?", monthTime)
 	}
 	if yearTime != "" {
 		db = db.Where("DATE_FORMAT(CONCAT(settlement_month, '-01'), '%Y') = ?", yearTime)
 	}
-	err = db.Group("genre").Preload("ProjectFeeGenre").Find(&monthFees).Error
+	err = db.Group("genre").Preload("ProjectFeeGenre").Preload("Project").Find(&monthFees).Error
 	return monthFees, err
 }
 
@@ -38,7 +40,7 @@ func CreateProjectMonthFee() error {
 			return txErr
 		}
 		var fees []ProjectMonthFee
-		txErr = tx.Raw(`SELECT DATE_FORMAT(fee_time, '%Y-%m') AS settlement_month,genre, SUM(deposit_amount) AS total_deposit, SUM(expenditure_amount) AS total_expenditure FROM  project_fee GROUP BY DATE_FORMAT(fee_time, '%Y-%m'),genre`).Scan(&fees).Error
+		txErr = tx.Raw(`SELECT DATE_FORMAT(fee_time, '%Y-%m') AS settlement_month,genre, project_code, SUM(deposit_amount) AS total_deposit, SUM(expenditure_amount) AS total_expenditure FROM  project_fee GROUP BY DATE_FORMAT(fee_time, '%Y-%m'),genre,project_code`).Scan(&fees).Error
 		if txErr != nil {
 			return txErr
 		}

+ 3 - 0
server/initialize/gorm.go

@@ -64,6 +64,9 @@ func RegisterTables() {
 		dao.Constructor{},
 		dao.Expenses{},
 		dao.MonthExpenses{},
+		dao.ProjectFee{},
+		dao.ProjectFeeGenre{},
+		dao.ProjectMonthFee{},
 	)
 	if err != nil {
 		global.GVA_LOG.Error("register table failed", zap.Error(err))

+ 1 - 1
server/initialize/job.go

@@ -9,7 +9,7 @@ import (
 func MyJob() {
 	c := cron.New()
 
-	c.AddFunc("0 0/5 * * * ?", func() {
+	c.AddFunc("0 0/2 * * * ?", func() {
 		err := dao.CreateProjectMonthFee()
 		if err != nil {
 			global.GVA_LOG.Error("CreateProjectMonthFee ====== " + err.Error())

+ 4 - 0
server/router/admin/finance.go

@@ -15,15 +15,18 @@ func (s *ProjectRouter) InitFinanceRouter(Router *gin.RouterGroup) {
 	{
 		financeRouter.POST("createDailyExpenses", financeApi.CreateDailyExpenses)
 		financeRouter.POST("createExpensesGenre", financeApi.CreateExpensesGenre)
+		financeRouter.POST("createProjectFeeGenre", financeApi.CreateProjectFeeGenre)
 		financeRouter.POST("createBorrowing", financeApi.CreateBorrowing)
 		financeRouter.POST("createDailyFile", financeApi.CreateDailyFile)
 
 		financeRouter.PUT("updateDailyExpenses", financeApi.UpdateDailyExpenses)
 		financeRouter.PUT("updateExpensesGenre", financeApi.UpdateExpensesGenre)
+		financeRouter.PUT("updateProjectFeeGenre", financeApi.UpdateProjectFeeGenre)
 		financeRouter.PUT("updateBorrowing", financeApi.UpdateBorrowing)
 
 		financeRouter.DELETE("deleteDailyExpenses", financeApi.DeleteDailyExpenses)
 		financeRouter.DELETE("deleteExpensesGenre", financeApi.DeleteExpensesGenre)
+		financeRouter.DELETE("deleteProjectFeeGenre", financeApi.DeleteProjectFeeGenre)
 		financeRouter.DELETE("deleteBorrowing", financeApi.DeleteBorrowing)
 		financeRouter.DELETE("deleteDailyFile", financeApi.DeleteDailyFile)
 	}
@@ -31,6 +34,7 @@ func (s *ProjectRouter) InitFinanceRouter(Router *gin.RouterGroup) {
 		financeRouterWithoutRecord.POST("queryDailyExpensesList", financeApi.QueryDailyExpensesList)
 		financeRouterWithoutRecord.GET("queryDailyExpenses", financeApi.QueryDailyExpenses)
 		financeRouterWithoutRecord.GET("queryExpensesGenre", financeApi.QueryExpensesGenre)
+		financeRouterWithoutRecord.GET("queryProjectFeeGenre", financeApi.QueryProjectFeeGenre)
 		financeRouterWithoutRecord.POST("queryBorrowingList", financeApi.QueryBorrowingList)
 		financeRouterWithoutRecord.GET("queryBorrowing", financeApi.QueryBorrowing)
 		financeRouterWithoutRecord.POST("queryDailyFileList", financeApi.QueryDailyFileList)

+ 20 - 0
server/service/admin/finance.go

@@ -41,6 +41,10 @@ func (fs *FinanceService) QueryExpensesGenre() ([]dao.ExpensesGenre, error) {
 	return dao.QueryExpensesGenre()
 }
 
+func (fs *FinanceService) QueryProjectFeeGenre() ([]dao.ProjectFeeGenre, error) {
+	return dao.QueryProjectFeeGenre()
+}
+
 func (fs *FinanceService) QueryBorrowingList(info request.SearchNameTime) (list interface{}, total int64, err error) {
 	limit := info.PageInfo.PageSize
 	offset := info.PageInfo.PageSize * (info.PageInfo.Page - 1)
@@ -111,6 +115,10 @@ func (fs *FinanceService) CreateExpensesGenre(genre dao.ExpensesGenre) error {
 	return genre.CreateExpensesGenre()
 }
 
+func (fs *FinanceService) CreateProjectFeeGenre(genre dao.ProjectFeeGenre) error {
+	return genre.CreateProjectFeeGenre()
+}
+
 func (fs *FinanceService) CreateBorrowing(borrowing dao.Borrowing) error {
 	return borrowing.CreateBorrowing()
 }
@@ -127,6 +135,10 @@ func (fs *FinanceService) UpdateExpensesGenre(genre dao.ExpensesGenre) error {
 	return genre.UpdateExpensesGenre()
 }
 
+func (fs *FinanceService) UpdateProjectFeeGenre(genre dao.ProjectFeeGenre) error {
+	return genre.UpdateProjectFeeGenre()
+}
+
 func (fs *FinanceService) UpdateBorrowing(borrowing dao.Borrowing) error {
 	return borrowing.UpdateBorrowing()
 }
@@ -143,6 +155,14 @@ func (fs *FinanceService) DeleteExpensesGenre(genre dao.ExpensesGenre) error {
 	return genre.DeleteExpensesGenre()
 }
 
+func (fs *FinanceService) DeleteProjectFeeGenre(genre dao.ProjectFeeGenre) error {
+	fee, _ := dao.QueryProjectFeeByGenre(int(genre.ID))
+	if len(fee) > 0 {
+		return fmt.Errorf("费用类型正在被使用")
+	}
+	return genre.DeleteProjectFeeGenre()
+}
+
 func (fs *FinanceService) DeleteBorrowing(borrowing dao.Borrowing) error {
 	return borrowing.DeleteBorrowing()
 }

+ 2 - 2
server/service/admin/project.go

@@ -130,8 +130,8 @@ func (ps *ProjectService) QueryReimbursement(code string) ([]dao.Reimbursement,
 	return reimbursements, err
 }
 
-func (ps *ProjectService) QueryProjectSum() (dao.ProjectSum, error) {
-	return dao.QueryProjectSum()
+func (ps *ProjectService) QueryProjectSum(code string) (dao.ProjectSum, error) {
+	return dao.QueryProjectSum(code)
 }
 
 func (ps *ProjectService) CreateProject(project dao.Project) error {

+ 12 - 40
web/src/api/cost.js

@@ -57,74 +57,46 @@ export const queryProjectMonthFee = (month, year) => {
   })
 }
 
-// 查询项目费用类型列表
-export const projectCostTypeList = () => {
+// 查询公司月费用
+export const queryMonthExpenses = (month, year) => {
   return service({
-    url: '/finance/queryProjectFeeGenre',
-    method: 'get'
-  })
-}
-
-// 新增项目费用类型
-export const addProjectCostType = (data) => {
-  return service({
-    url: '/finance/createProjectFeeGenre',
-    method: 'post',
-    data: data
-  })
-}
-
-// 修改项目费用类型
-export const putProjectCostType = (data) => {
-  return service({
-    url: '/finance/updateProjectFeeGenre',
-    method: 'put',
-    data: data
-  })
-}
-
-// 删除项目费用类型
-export const delProjectCostType = (data) => {
-  return service({
-    url: '/finance/deleteProjectFeeGenre',
-    method: 'delete',
-    data: data
+    url: '/expenses/queryMonthExpenses?monthTime=' + month + '&yearTime=' + year,
+    method: 'get',
   })
 }
 
 // 查询项目费用列表
-export const projectCostList = (data) => {
+export const queryProjectCost = (data) => {
   return service({
     url: '/expenses/queryProjectFeeList',
     method: 'post',
-    data
+    data: data
   })
 }
 
 // 新增项目费用
-export const postProjectCost = (data) => {
+export const createProjectCost = (data) => {
   return service({
     url: '/expenses/createProjectFee',
     method: 'post',
-    data
+    data: data
   })
 }
 
 // 修改项目费用
-export const putProjectCost = (data) => {
+export const updateProjectCost = (data) => {
   return service({
     url: '/expenses/updateProjectFee',
     method: 'put',
-    data
+    data: data
   })
 }
 
 // 删除项目费用
-export const delProjectCost = (data) => {
+export const deleteProjectCost = (data) => {
   return service({
     url: '/expenses/deleteProjectFee',
     method: 'delete',
-    data
+    data: data
   })
 }
-

+ 2 - 2
web/src/api/project.js

@@ -109,9 +109,9 @@ export const queryProjectExpense = (code) => {
 }
 
 // 查询项目总金
-export const queryProjectSum = () => {
+export const queryProjectSum = (code) => {
   return service({
-    url: '/project/queryProjectSum',
+    url: '/project/queryProjectSum?code=' + code,
     method: 'GET'
   })
 }

+ 74 - 17
web/src/view/dashboard/index.vue

@@ -1,12 +1,30 @@
 <template>
   <div class="page">
     <div class="gva-card-box">
-      <div
-        id="main"
-        class="gva-card"
-        style="width: 100%; height: 300px;"
-        @click="handleChartClick"
-      />
+      <div class="gva-card">
+        <div>
+          <el-select
+            v-model="project1"
+            style="width: 200px;margin-bottom: 20px"
+            clearable
+            filterable
+            value-on-clear=""
+            @change="changeCode"
+          >
+            <el-option
+              v-for="item in projectData"
+              :key="item.code"
+              :label="item.name"
+              :value="item.code"
+            />
+          </el-select>
+        </div>
+        <div
+          id="main"
+          style="width: 100%; height: 300px;"
+          @click="handleChartClick"
+        />
+      </div>
     </div>
 
     <div class="gva-card-box">
@@ -28,6 +46,7 @@
                 type="month"
                 placeholder="选择月份"
                 value-format="YYYY-MM"
+                value-on-clear=""
                 @change="choiceMonth"
               />
             </el-col>
@@ -40,6 +59,7 @@
                 type="year"
                 placeholder="选择年份"
                 value-format="YYYY"
+                value-on-clear=""
                 @change="choiceYear"
               />
             </el-col>
@@ -55,7 +75,11 @@
               :xs="24"
               :sm="12"
             >
-              <el-table :data="projectMonthFee">
+              <el-table
+                :data="projectMonthFee"
+                max-height="400px"
+                height="400px"
+              >
                 <el-table-column
                   prop="projectFeeGenre.name"
                   label="费用类型"
@@ -75,7 +99,25 @@
               :xs="24"
               :sm="12"
             >
-              <dashboard-table />
+              <el-table
+                :data="monthFee"
+                max-height="400px"
+                height="400px"
+              >
+                <el-table-column
+                  prop="department.name"
+                  label="部门"
+                  width="200"
+                />
+                <el-table-column
+                  prop="totalExpenditure"
+                  label="支出金额"
+                />
+                <el-table-column
+                  prop="totalDeposit"
+                  label="支入金额"
+                />
+              </el-table>
             </el-col>
           </el-row>
         </div>
@@ -85,15 +127,19 @@
 </template>
 
 <script setup>
-import DashboardTable from '@/view/dashboard/dashboardTable/dashboardTable.vue'
 import { ref, onMounted } from 'vue'
-import { queryProjectSum } from '@/api/project'
+import { getAllProject, queryProjectSum } from '@/api/project'
 import * as echarts from 'echarts'
-import { queryProjectMonthFee } from '@/api/cost'
+import { queryMonthExpenses, queryProjectMonthFee } from '@/api/cost'
+
+let myChart = null
 
 const initChart = () => {
   const chartDom = document.getElementById('main')
-  const myChart = echarts.init(chartDom)
+  if (myChart) {
+    myChart.dispose() // 销毁图表实例
+  }
+  myChart = echarts.init(chartDom)
   myChart.setOption({
     title: {
       text: '项目总表'
@@ -123,24 +169,31 @@ const initChart = () => {
 // 筛选数据
 const monthData = ref('')
 const yearData = ref('')
+const project1 = ref('')
 
 const projectSum = ref()
 const projectMonthFee = ref()
+const monthFee = ref()
+const projectData = ref()
 
 const xData = ref([])
 const queryData = async() => {
-  await queryProjectSum().then(res => {
+  await queryProjectSum(project1.value).then(res => {
     projectSum.value = res.data
-    console.log(res.data)
+    xData.value.length = 0
     for (const key in projectSum.value) {
       xData.value.push(projectSum.value[key])
-      console.log(xData.value)
     }
   })
   await queryProjectMonthFee(monthData.value, yearData.value).then(res => {
-    console.log(res.data)
     projectMonthFee.value = res.data
   })
+  await queryMonthExpenses(monthData.value, yearData.value).then(res => {
+    monthFee.value = res.data
+  })
+  await getAllProject().then(res => {
+    projectData.value = res.data
+  })
   initChart()
 }
 
@@ -153,13 +206,17 @@ const choiceYear = () => {
   monthData.value = ''
   queryData()
 }
+
+const changeCode = () => {
+  queryData()
+}
+
 const choiceMonth = () => {
   yearData.value = ''
   queryData()
 }
 onMounted(() => {
   queryData()
-  initChart()
 })
 
 </script>