dashboardTable.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div class="commit-table">
  3. <div class="commit-table-title">
  4. 需收款项目
  5. </div>
  6. <div class="log">
  7. <el-table
  8. :data="projectList"
  9. max-height="400"
  10. >
  11. <el-table-column
  12. prop="name"
  13. label="项目名称"
  14. align="center"
  15. />
  16. <el-table-column
  17. prop="price"
  18. label="项目总金额"
  19. align="center"
  20. />
  21. <el-table-column
  22. label="已收款金额"
  23. align="center"
  24. >
  25. <template #default="scope">
  26. {{ already(scope.row) }}
  27. </template>
  28. </el-table-column>
  29. <el-table-column
  30. label="还需收款金额"
  31. align="center"
  32. >
  33. <template #default="scope">
  34. {{ isTo(scope.row) }}
  35. </template>
  36. </el-table-column>
  37. <el-table-column
  38. prop="collectionTime"
  39. label="完成日期"
  40. align="center"
  41. />
  42. </el-table>
  43. </div>
  44. </div>
  45. </template>
  46. <script setup>
  47. import { onMounted, reactive, ref } from 'vue'
  48. import { getProjectList } from '@/api/project'
  49. const projectList = ref()
  50. const condition = reactive({
  51. pageInfo: {
  52. page: 1,
  53. pageSize: 1000
  54. },
  55. name: '',
  56. time: '',
  57. state: 3
  58. })
  59. const queryData = async() => {
  60. await getProjectList(condition).then(res => {
  61. projectList.value = res.data.list
  62. })
  63. }
  64. // 计算
  65. const already = (val) => {
  66. console.log(val.collection)
  67. let sum = 0
  68. for (const key in val.collection) {
  69. sum = sum + Number(val.collection[key].collectionPrice)
  70. }
  71. return sum
  72. }
  73. const isTo = (val) => {
  74. let sum = 0
  75. for (const key in val.collection) {
  76. sum = sum + Number(val.collection[key].collectionPrice)
  77. }
  78. return Number(val.price) - sum
  79. }
  80. defineOptions({
  81. name: 'DashboardTable',
  82. })
  83. onMounted(() => {
  84. queryData()
  85. })
  86. </script>
  87. <style lang="scss" scoped>
  88. .commit-table{
  89. background-color: #fff;
  90. height: 400px;
  91. &-title{
  92. font-weight: 600;
  93. margin-bottom: 12px;
  94. }
  95. .log{
  96. &-item{
  97. display: flex;
  98. justify-content: space-between;
  99. margin-top: 14px;
  100. .key-box{
  101. justify-content: center;
  102. }
  103. .key{
  104. &.top{
  105. background: #314659;
  106. color: #FFFFFF;;
  107. }
  108. display: inline-flex;
  109. justify-content: center;
  110. align-items: center;
  111. width: 20px;
  112. height: 20px;
  113. border-radius: 50%;
  114. background: #F0F2F5;
  115. text-align: center;
  116. color:rgba($color: #000000, $alpha: 0.65)
  117. }
  118. .message{
  119. color: rgba(0, 0, 0, 0.65);
  120. }
  121. .form{
  122. color: rgba(0, 0, 0, 0.65);
  123. margin-left: 12px;
  124. }
  125. .flex{
  126. line-height: 20px;
  127. overflow: hidden;
  128. text-overflow: ellipsis;
  129. white-space: nowrap;
  130. }
  131. .flex-1{
  132. flex:1;
  133. }
  134. .flex-2{
  135. flex:2;
  136. }
  137. .flex-3{
  138. flex:3;
  139. }
  140. .flex-4{
  141. flex:4;
  142. }
  143. .flex-5{
  144. flex:5;
  145. }
  146. }
  147. }
  148. }
  149. </style>