index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. <view class="searchBox">
  11. <uni-search-bar placeholder="请输入搜索内容" @confirm="search" @blur="blur" @cancel="cancel" @clear="clear">
  12. </uni-search-bar>
  13. </view>
  14. <data-List v-for="(item,index) in listData" :key="index" :info="item" @faClick="handdle"></data-List>
  15. <uni-fab :pattern="pattern" :horizontal="horizontal" :vertical="vertical"
  16. :direction="direction" @fabClick="fabClick" />
  17. <!-- 普通弹窗 -->
  18. <uni-popup ref="popup" background-color="#fff" border-radius="10px 10px 0 0">
  19. <view class="popup-body">
  20. <view class="popup-close">
  21. <uni-icons type="closeempty" size="20" @click="popupClose"></uni-icons>
  22. </view>
  23. <view class="popup-content">
  24. <form-Edit :id="id" v-if="status=='暂存'" @popupClose="popupClose"></form-Edit>
  25. <form-Detail :id="id" v-else @popupClose="popupClose"></form-Detail>
  26. </view>
  27. </view>
  28. </uni-popup>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. </template>
  33. <script>
  34. import { getListData } from "@/api/oa/out"
  35. import myTabs from '../myTabs.vue'
  36. import dataList from './dataList.vue'
  37. import formDetail from './detail.vue'
  38. import formEdit from './edit.vue'
  39. import myPull from '@/static/js/myPull.js'
  40. export default {
  41. components:{myTabs,dataList,formEdit,formDetail},
  42. data() {
  43. return {
  44. id:'',
  45. status:'',
  46. initIndex: 0,
  47. searchStr:'',
  48. pageNo: 1,
  49. pageSize: 10,
  50. horizontal: 'right',
  51. vertical: 'bottom',
  52. direction: 'horizontal',
  53. pattern: {
  54. color: '#7A7E83',
  55. backgroundColor: '#fff',
  56. selectedColor: '#007AFF',
  57. buttonColor: '#007AFF',
  58. iconColor: '#fff'
  59. },
  60. }
  61. },
  62. onLoad(){
  63. this.refresh();
  64. },
  65. methods: {
  66. fabClick() {
  67. this.initIndex = 0;
  68. },
  69. search(res) {
  70. this.searchStr = res.value;
  71. this.page = 1;
  72. this.getList(this.page,this.__pulldone)
  73. },
  74. clear(res) {
  75. this.searchStr = '';
  76. this.page = 1;
  77. this.getList(this.page,this.__pulldone)
  78. },
  79. blur(res) {
  80. this.searchStr = res.value;
  81. this.page = 1;
  82. this.getList(this.page,this.__pulldone)
  83. },
  84. cancel(res) {
  85. this.searchStr = '';
  86. this.page = 1;
  87. this.getList(this.page,this.__pulldone)
  88. },
  89. popupClose(){
  90. this.$refs.popup.close();
  91. this.page = 1;
  92. this.getList(this.page,this.__pulldone)
  93. },
  94. handdle(row) {
  95. this.$refs.popup.open('bottom');
  96. this.id = row.id;
  97. this.status = row.status;
  98. },
  99. fabClick() {
  100. this.initIndex = 0;
  101. },
  102. /**
  103. * @name 获取列表
  104. */
  105. getList(page,done){
  106. if(this.initIndex==1){
  107. getListData({pageNo:page,pageSize: this.pageSize,str:this.searchStr}).then(response => {
  108. let dataList = response.data.list;
  109. let list = []
  110. dataList.forEach(v => {
  111. list.push({
  112. id:v.id,
  113. oaType:v.applyEmployeeName+'提交的公务外出',
  114. time:v.createTime,
  115. title:v.employeeName,
  116. remarks:v.destination,
  117. status: v.auditStatusDesc,
  118. nickname:v.currentAuditEmployeeName
  119. })
  120. })
  121. done(list);
  122. });
  123. }
  124. },
  125. /**
  126. * @name 触底加载
  127. */
  128. scrolltolower(event){
  129. this.getList(this.page,this.__pulldone)
  130. },
  131. scroll(e){
  132. // 重新设置pulldown
  133. this.setPullDown(e.detail.scrollTop<10)
  134. },
  135. /**
  136. * @name 改变tab
  137. * @param val 索引
  138. */
  139. tapChange(val){
  140. this.initIndex=val;
  141. this.page = 1;
  142. this.getList(this.page,this.__pulldone)
  143. }
  144. },
  145. mixins:[myPull({})],
  146. }
  147. </script>
  148. <style lang='scss' scoped>
  149. .searchBox{
  150. background-color: #fff;
  151. position: -webkit-sticky; /* Safari */
  152. position: sticky;
  153. top: 0; /* 设置元素距离顶部的位置 */
  154. width: 100%;
  155. }
  156. .popup-body{
  157. z-index: 99;
  158. }
  159. .popup-close{
  160. cursor: pointer;
  161. height: 40px;
  162. line-height: 40px;
  163. padding-left: 10px;
  164. border-bottom: 1px solid #eaecef;
  165. }
  166. .popup-content{
  167. height: 450px;
  168. overflow-x: auto;
  169. }
  170. .purchase-list {
  171. background-color: #f5f5f5;
  172. height: 100%;
  173. overflow: hidden;
  174. .purchase-body{
  175. height: calc(100% - 88upx);
  176. overflow: auto
  177. }
  178. }
  179. </style>