index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <div class="educationStatistics">
  3. <NavBar />
  4. <div class="statistics-container">
  5. <org-tree v-model="query.orgId" @change="getDataList"></org-tree>
  6. <div class="search-flex-box">
  7. <select-cell title="教育计划名称" v-model="query.planId" :dataList="planList" :prop="prop" @change="getDataList"/>
  8. <date-cell title="统计月份" v-model="query.date" date-type="year-month" @change="getDataList"/>
  9. </div>
  10. <div class="card-list">
  11. <van-empty description="暂无数据" v-if="!dataList || dataList.length === 0" />
  12. <!-- <van-cell-group v-for="(v,i) in dataList" :key="i">-->
  13. <!-- <van-cell :title="v.orgName" >-->
  14. <!-- <template #extra>-->
  15. <!-- <div class="card-num">-->
  16. <!-- {{v.finishRate}}-->
  17. <!-- </div>-->
  18. <!-- </template>-->
  19. <!-- <template #label>-->
  20. <!-- <div class="flex-box">-->
  21. <!-- <div>应培训数:{{v.shouldFinish}}</div>-->
  22. <!-- <div>已培训数:{{v.finish}}</div>-->
  23. <!-- </div>-->
  24. <!-- </template>-->
  25. <!-- </van-cell>-->
  26. <!-- </van-cell-group>-->
  27. <ve-table
  28. v-else
  29. :border-x="true"
  30. :border-y="true"
  31. :border-around="true"
  32. :columns="columns"
  33. :fixed-header="true"
  34. maxHeight="calc(100vh - 240px)"
  35. :table-data="dataList" />
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import NavBar from '@/components/NavBar'
  42. import OrgTree from '@/components/orgTree'
  43. import DateCell from '@/components/dateCell'
  44. import SelectCell from '@/components/selectCell'
  45. import Tables from '@/components/table'
  46. import {dataList,planList} from './api'
  47. import {mapGetters} from "vuex";
  48. import {formatDate} from "@/filters/filter";
  49. export default {
  50. components: {
  51. NavBar,
  52. OrgTree,
  53. DateCell,
  54. SelectCell,
  55. Tables
  56. },
  57. data() {
  58. return {
  59. query:{
  60. date:null,
  61. orgId:null,
  62. planId:null,
  63. },
  64. planList:[],
  65. prop:{
  66. label:'name',
  67. value:'id',
  68. },
  69. loading:false,
  70. columns:[
  71. {
  72. field: "index",
  73. key: "index",
  74. title: "序号",
  75. width: 50,
  76. align: "center",
  77. fixed: "left",
  78. renderBodyCell: ({ row, column, rowIndex }, h) => {
  79. return ++rowIndex;
  80. },
  81. },
  82. {field:'orgName',key:'2',title:'单位名称',align: "center" },
  83. {field:'finish',key:'3',title:'应培训数',align: "center" },
  84. {field:'shouldFinish',key:'4',title:'已培训数',align: "center" },
  85. {field:'finishRate',key:'5',title:'完成率',align: "center" },
  86. ],
  87. dataList:[],
  88. }
  89. },
  90. mounted() {
  91. this.initData();
  92. },
  93. computed:{
  94. ...mapGetters(['orgId']),
  95. },
  96. methods: {
  97. initData(){
  98. this.query.orgId = this.orgId;
  99. this.getPlanList();
  100. },
  101. getPlanList(){
  102. planList(this.query.orgId).then(res=>{
  103. this.planList = res.data;
  104. if(res.data.length === 0) return this.$toast('暂无教育计划');
  105. this.query.planId = res.data[0].id;
  106. this.query.date = formatDate(new Date(),'YYYY-MM');
  107. this.getDataList();
  108. })
  109. },
  110. getDataList(){
  111. let data = {
  112. ...this.query
  113. }
  114. data.date = this.query.date && `${this.query.date}-01`;
  115. if(!this.query.orgId) return this.$toast('请选择机构');
  116. dataList(data).then(res=>{
  117. this.dataList = res.data;
  118. })
  119. }
  120. }
  121. }
  122. </script>
  123. <style lang="scss">
  124. .van-cell-group{
  125. margin-bottom: 20px;
  126. }
  127. .van-cell-group:last-child{
  128. margin-bottom: 0;
  129. }
  130. .vue-table-root{
  131. tr,th,td{
  132. font-size: 25px!important;
  133. color:#666!important;
  134. }
  135. }
  136. </style>
  137. <style lang="scss" scoped>
  138. .educationStatistics{
  139. }
  140. .statistics-container{
  141. }
  142. .search-flex-box{
  143. display: flex;
  144. align-items: center;
  145. justify-content: space-between;
  146. >div{
  147. width: 50%;
  148. border-right: 1px solid #eaeaea ;
  149. }
  150. }
  151. .card-list{
  152. padding: 20px;
  153. -height: calc(100vh - 410px);
  154. overflow: auto;
  155. }
  156. .card-num{
  157. display: flex;
  158. align-items: center;
  159. font-size: 28px;
  160. color: #009dff;
  161. }
  162. .flex-box{
  163. display: flex;
  164. align-items: center;
  165. >div{
  166. margin-right: 40px;
  167. }
  168. }
  169. </style>