index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class='purchase-list'>
  3. <my-tabs @change="tapChange" :initIndex="initIndex"></my-tabs>
  4. <scroll-view class="purchase-body" scroll-y="true" @scrolltolower="scrolltolower" @scroll="scroll">
  5. <view v-if="initIndex === 0">
  6. <!-- <form-Create></form-Create> -->
  7. <form-Edit @popupClose="popupClose"></form-Edit>
  8. </view>
  9. <view v-if="initIndex === 1">
  10. <data-List v-for="(item,index) in listData" :key="index" :info="item" @faClick="handdle"></data-List>
  11. <!-- 普通弹窗 -->
  12. <uni-popup ref="popup" background-color="#fff" border-radius="10px 10px 0 0">
  13. <view class="popup-body">
  14. <view class="popup-close">
  15. <uni-icons type="closeempty" size="20" @click="popupClose"></uni-icons>
  16. </view>
  17. <view class="popup-content">
  18. <form-Edit :id="id" v-if="status=='暂存'" @popupClose="popupClose"></form-Edit>
  19. <form-Detail :id="id" v-else @popupClose="popupClose"></form-Detail>
  20. </view>
  21. </view>
  22. </uni-popup>
  23. </view>
  24. </scroll-view>
  25. </view>
  26. </template>
  27. <script>
  28. import { getListData } from "@/api/oa/universal"
  29. import myTabs from '../myTabs.vue'
  30. import dataList from '../dataList.vue'
  31. import formDetail from './detail.vue'
  32. import formEdit from './edit.vue'
  33. import myPull from '@/static/js/myPull.js'
  34. export default {
  35. components:{myTabs,dataList,formEdit,formDetail},
  36. data() {
  37. return {
  38. id:'',
  39. status:'',
  40. initIndex: 0,
  41. pageNo: 1,
  42. pageSize: 10,
  43. horizontal: 'right',
  44. vertical: 'bottom',
  45. direction: 'horizontal',
  46. pattern: {
  47. color: '#7A7E83',
  48. backgroundColor: '#fff',
  49. selectedColor: '#007AFF',
  50. buttonColor: '#007AFF',
  51. iconColor: '#fff'
  52. },
  53. }
  54. },
  55. onLoad(){
  56. this.refresh();
  57. },
  58. methods: {
  59. popupClose(){
  60. this.$refs.popup.close();
  61. this.page = 1;
  62. this.getList(this.page,this.__pulldone)
  63. },
  64. handdle(row) {
  65. this.$refs.popup.open('bottom');
  66. this.id = row.id;
  67. this.status = row.status;
  68. },
  69. fabClick() {
  70. this.initIndex = 0;
  71. },
  72. /**
  73. * @name 获取列表
  74. */
  75. getList(page,done){
  76. if(this.initIndex==1){
  77. getListData({pageNo:page,pageSize: this.pageSize}).then(response => {
  78. let dataList = response.data.list;
  79. let list = []
  80. dataList.forEach(v => {
  81. list.push({
  82. id:v.id,
  83. oaType:v.employeeName+'提交的通用审批',
  84. time:v.createTime,
  85. title:v.title,
  86. remarks:v.remarks,
  87. status: v.auditStatusDesc,
  88. nickname:v.currentAuditEmployeeName
  89. })
  90. })
  91. done(list);
  92. });
  93. }
  94. },
  95. /**
  96. * @name 触底加载
  97. */
  98. scrolltolower(event){
  99. this.getList(this.page,this.__pulldone)
  100. },
  101. scroll(e){
  102. // 重新设置pulldown
  103. this.setPullDown(e.detail.scrollTop<10)
  104. },
  105. /**
  106. * @name 改变tab
  107. * @param val 索引
  108. */
  109. tapChange(val){
  110. this.initIndex=val;
  111. this.page = 1;
  112. this.getList(this.page,this.__pulldone)
  113. }
  114. },
  115. mixins:[myPull({})],
  116. }
  117. </script>
  118. <style lang='scss' scoped>
  119. .popup-body{
  120. z-index: 99;
  121. }
  122. .popup-close{
  123. cursor: pointer;
  124. height: 40px;
  125. line-height: 40px;
  126. padding-left: 10px;
  127. border-bottom: 1px solid #eaecef;
  128. }
  129. .popup-content{
  130. height: 450px;
  131. overflow-x: auto;
  132. }
  133. .purchase-list {
  134. background-color: #f5f5f5;
  135. height: 100%;
  136. overflow: hidden;
  137. .purchase-body{
  138. height: calc(100% - 88upx);
  139. overflow: auto
  140. }
  141. }
  142. </style>