departmentList.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-col :span="3">
  5. <el-date-picker
  6. v-model="monthData"
  7. type="month"
  8. placeholder="选择月份"
  9. value-format="YYYY-MM"
  10. value-on-clear=""
  11. @change="choiceMonth"
  12. />
  13. </el-col>
  14. <el-col
  15. :span="3"
  16. :offset="1"
  17. >
  18. <el-date-picker
  19. v-model="yearData"
  20. type="year"
  21. placeholder="选择年份"
  22. value-format="YYYY"
  23. value-on-clear=""
  24. @change="choiceYear"
  25. />
  26. </el-col>
  27. <el-col
  28. :span="3"
  29. :offset="1"
  30. >
  31. <el-select
  32. v-model="feeGenre"
  33. clearable
  34. filterable
  35. value-on-clear=""
  36. placeholder="请选择公司费用类型"
  37. @change="changeFeeGenre"
  38. >
  39. <el-option
  40. v-for="item in feeGenreData"
  41. :key="item.ID"
  42. :label="item.name"
  43. :value="item.ID"
  44. />
  45. </el-select>
  46. </el-col>
  47. <el-col
  48. :span="2"
  49. :offset="1"
  50. >
  51. <el-button
  52. type="primary"
  53. icon="Refresh"
  54. @click="costListReset"
  55. >重置</el-button>
  56. </el-col>
  57. </el-row>
  58. <el-row style="margin-top: 20px">
  59. <el-col :span="12">
  60. <el-table
  61. :data="monthFee"
  62. max-height="400px"
  63. height="400px"
  64. table-layout="auto"
  65. show-summary
  66. >
  67. <el-table-column
  68. prop="department.name"
  69. label="部门"
  70. width="200"
  71. align="center"
  72. />
  73. <el-table-column
  74. prop="totalExpenditure"
  75. label="支出金额"
  76. align="center"
  77. />
  78. <el-table-column
  79. prop="totalDeposit"
  80. label="支入金额"
  81. align="center"
  82. />
  83. </el-table>
  84. </el-col>
  85. </el-row>
  86. </div>
  87. </template>
  88. <script setup>
  89. import { ref, reactive, onMounted } from 'vue'
  90. import { queryMonthExpenses } from '@/api/cost'
  91. import { queryExpensesGenre } from '@/api/finance'
  92. defineOptions({
  93. name: 'DepartmentList'
  94. })
  95. onMounted(() => {
  96. queryData()
  97. })
  98. const feeGenre = ref('')
  99. const feeGenreData = reactive([])
  100. const monthFee = reactive([])
  101. const monthData = ref('')
  102. const yearData = ref('')
  103. const changeFeeGenre = () => {
  104. queryData()
  105. }
  106. const choiceMonth = () => {
  107. queryData()
  108. }
  109. const choiceYear = () => {
  110. queryData()
  111. }
  112. const costListReset = () => {
  113. feeGenre.value = ''
  114. monthData.value = ''
  115. yearData.value = ''
  116. queryData()
  117. }
  118. const queryData = () => {
  119. queryMonthExpenses(monthData.value, yearData.value, feeGenre.value).then(res => {
  120. if (res.code === 0) {
  121. monthFee.length = 0
  122. monthFee.push(...res.data)
  123. }
  124. })
  125. queryExpensesGenre().then(res => {
  126. if (res.code === 0) {
  127. feeGenreData.length = 0
  128. feeGenreData.push(...res.data)
  129. }
  130. })
  131. }
  132. </script>
  133. <style scoped>
  134. </style>