index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div class="safetyBook">
  3. <NavBar />
  4. <div class="page-container">
  5. <div class="search-box">
  6. <org-tree v-model="query.partyBOrg" placeholder="选择检查机构" @change="refreshData"></org-tree>
  7. </div>
  8. <div class="scroll-box">
  9. <Scroll
  10. ref="Scroll"
  11. :pullupDownFn="refreshData"
  12. :pullupFn="getDataList"
  13. :pullup="pullup">
  14. <empty v-if="!dataList.length" />
  15. <card class="list-item" v-else v-for="(v,i) in dataList" :key="i">
  16. <p class="item-title">{{getDictLabel(v.type,'safety_book_type')}}</p>
  17. <div :title="v.orgName" @click="clickItem(v)">
  18. <van-cell class="item-cell" title="甲方姓名" :value="v.partyA" ></van-cell>
  19. <van-cell class="item-cell" title="甲方机构" :value="v.partyAOrgName"></van-cell>
  20. <van-cell class="item-cell" title="乙方姓名" :value="v.partyB" ></van-cell>
  21. <van-cell class="item-cell" title="乙方机构" :value="v.partyBOrgName" ></van-cell>
  22. <van-cell class="item-cell" title="所属年份" :value="`${v.year} 年`" >
  23. </van-cell>
  24. <!-- <van-cell class="item-cell" title="添加时间" :value="dayjs(v.createTime).format('YYYY-MM-DD HH:mm')">-->
  25. <!-- </van-cell>-->
  26. </div>
  27. </card>
  28. </Scroll>
  29. </div>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import {mapGetters} from "vuex";
  35. import NavBar from '@/components/NavBar'
  36. import OrgTree from '@/components/orgTree'
  37. import Scroll from '@/components/scroll/scroll'
  38. import Card from '@/components/card'
  39. import {dataList} from './api'
  40. import {formatDate} from "@/filters/filter";
  41. import {msgList} from "@/views/menu/message/api";
  42. import dayjs from "dayjs"
  43. export default {
  44. name: "safetyBook",
  45. components: {
  46. NavBar,
  47. OrgTree,
  48. Scroll,
  49. Card
  50. },
  51. data(){
  52. return {
  53. pullup:true,
  54. query:{
  55. partyBOrg:null,
  56. pageNum:1,
  57. pageSize:10,
  58. },
  59. total:0,
  60. dataList:[],
  61. dicts:['safety_book_type'],
  62. }
  63. },
  64. computed:{
  65. ...mapGetters(['orgId','dictionary'])
  66. },
  67. mounted(){
  68. this.query.partyBOrg = this.orgId;
  69. },
  70. methods:{
  71. dayjs,
  72. clickItem(item){
  73. this.$router.push({
  74. path:'/safetyBookDetail',query:{id:item.id}
  75. })
  76. },
  77. refreshData(){
  78. this.pullup = true;
  79. this.query.pageNum = 1;
  80. this.total = 0;
  81. this.dataList = [];
  82. this.getDataList();
  83. },
  84. getDataList(){
  85. if( this.dataList.length !== 0 && this.dataList.length >= this.total) {
  86. this.pullup = false;
  87. this.$toast('已加载完毕');
  88. return;
  89. }
  90. dataList(this.query).then(res=>{
  91. if(res.total === '0'){
  92. this.pullup = false;
  93. this.$toast('已加载完毕');
  94. return
  95. }
  96. this.total = res.total;
  97. if(this.dataList.length < res.total) {
  98. this.dataList = [...this.dataList,...res.rows] ;
  99. this.pullup = true;
  100. this.query.pageNum++;
  101. this.$refs.Scroll.refresh();
  102. }
  103. })
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss">
  109. .safetyBook{
  110. .van-cell-group__title{
  111. background-color: #fff;
  112. color: #333;
  113. }
  114. .list-item{
  115. .item-cell{
  116. -padding: 20px 0;
  117. .van-cell__title{
  118. color: #969799;
  119. }
  120. }
  121. }
  122. }
  123. </style>
  124. <style lang="scss" scoped>
  125. .safetyBook{
  126. }
  127. .scroll-box{
  128. padding:0 20px;
  129. width: 100%;
  130. height:calc(100vh - 284px);
  131. overflow: auto;
  132. }
  133. .list-item{
  134. .item-title{
  135. font-size: 28px;
  136. color: #1989fa;
  137. padding-bottom: 20px ;
  138. border-bottom: 1px solid #f4f4f4;
  139. }
  140. }
  141. </style>