index.vue 4.2 KB

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