index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class='purchase-list'>
  3. <my-tabs @change="tapChange" :modelData="modelData" :initIndex="initIndex"></my-tabs>
  4. <scroll-view class="purchase-body" scroll-y="true" @scrolltolower="scrolltolower" @scrolltoupper="scrolltoupper" @scroll="scroll" @touchstart="touchstart" @touchend="touchend">
  5. <my-unit v-for="(item,index) in listData" :key="index" :info="item" :initIndex="initIndex" @faClick="handdle"></my-unit>
  6. </scroll-view>
  7. <!-- 底部弹窗 -->
  8. <uni-popup ref="popup" background-color="#fff" border-radius="10px 10px 0 0">
  9. <view class="popup-body">
  10. <view class="popup-close">
  11. <uni-icons type="closeempty" size="20" @click="popupClose"></uni-icons>
  12. </view>
  13. <view class="popup-content">
  14. <async-form-component :id="businessKey" :name="initIndex.toString()" @popupClose="popupClose"></async-form-component>
  15. </view>
  16. </view>
  17. </uni-popup>
  18. </view>
  19. </template>
  20. <script>
  21. import Vue from 'vue'
  22. import { getTodoTaskPage, getDoneTaskPage,getMyProcessInstancePage } from "@/api/work/index"
  23. import myTabs from '@/components/myTabs/myTabs.vue'
  24. import myUnit from '@/components/myUnits/purchaseUnit/unit.vue'
  25. import myPull from '@/static/js/myPull.js'
  26. export default {
  27. components:{myTabs,myUnit},
  28. data() {
  29. return {
  30. businessKey:'',
  31. initIndex:0,
  32. pageNo: 1,
  33. pageSize: 10
  34. }
  35. },
  36. onShow(){
  37. let option = uni.getStorageSync('option');
  38. this.initIndex = option.initIndex;
  39. this.refresh();
  40. },
  41. methods: {
  42. handdle(row) {
  43. this.businessKey = row.businessKey;
  44. //将业务表单,注册为动态组件
  45. const path = row.path;
  46. console.log("path:" + path)
  47. Vue.component("async-form-component", function (resolve) {
  48. require([`@/pages${path}`], resolve);
  49. });
  50. this.$refs.popup.open('bottom');
  51. },
  52. popupClose(){
  53. this.$refs.popup.close();
  54. this.page = 1;
  55. this.getList(this.page,this.__pulldone)
  56. },
  57. /**
  58. * @name 获取列表
  59. */
  60. getList(page,done){
  61. console.log(`获取第${page}页数据`);
  62. if(this.initIndex==0){
  63. getTodoTaskPage({pageNo:page,pageSize: this.pageSize}).then(response => {
  64. let dataList = response.data.list;
  65. let list = []
  66. dataList.forEach(v => {
  67. list.push({
  68. businessKey:v.processInstance.businessKey,
  69. path:v.taskDefinitionKey == 'modifyApply' ? v.processDefinition.formCustomCreatePath : v.processDefinition.formCustomViewPath,
  70. title:v.processInstance.name,
  71. status: v.name,
  72. time:v.createTime,
  73. nickname:v.processInstance.startUser.nickname
  74. })
  75. })
  76. done(list);
  77. });
  78. }
  79. if(this.initIndex==1){
  80. getDoneTaskPage({pageNo:page,pageSize: this.pageSize}).then(response => {
  81. let dataList = response.data.list;
  82. let list = []
  83. dataList.forEach(v => {
  84. list.push({
  85. businessKey:v.processInstance.businessKey,
  86. path:v.processDefinition.formCustomViewPath,
  87. title:v.processInstance.name,
  88. status: v.name,
  89. time:v.createTime,
  90. nickname:v.processInstance.startUser.nickname
  91. })
  92. })
  93. done(list);
  94. });
  95. }
  96. if(this.initIndex==2){
  97. getMyProcessInstancePage({pageNo:page,pageSize: this.pageSize}).then(response => {
  98. let dataList = response.data.list;
  99. let list = []
  100. dataList.forEach(v => {
  101. list.push({
  102. businessKey:v.businessKey,
  103. path:v.processDefinition.formCustomViewPath,
  104. title:v.name,
  105. status: v.status,
  106. time:v.startTime,
  107. nickname:v.currentAuditUser?v.currentAuditUser.nickname:''
  108. })
  109. })
  110. done(list);
  111. });
  112. }
  113. },
  114. /**
  115. * @name 触底加载
  116. */
  117. scrolltolower(event){
  118. this.getList(this.page,this.__pulldone)
  119. },
  120. scroll(e){
  121. // 重新设置pulldown
  122. this.setPullDown(e.detail.scrollTop<10)
  123. },
  124. scrolltoupper(){
  125. },
  126. /**
  127. * @name 改变tab
  128. * @param val 索引
  129. */
  130. tapChange(val){
  131. this.initIndex=val;
  132. uni.setStorageSync('option',{initIndex:val, val:'switchTab'})
  133. this.page = 1;
  134. this.getList(this.page,this.__pulldone)
  135. }
  136. },
  137. mixins:[myPull({})],
  138. }
  139. </script>
  140. <style lang='scss' scoped>
  141. .popup-body{
  142. z-index: 99;
  143. }
  144. .popup-close{
  145. cursor: pointer;
  146. height: 40px;
  147. line-height: 40px;
  148. padding-left: 10px;
  149. border-bottom: 1px solid #eaecef;
  150. }
  151. .popup-content{
  152. height: 450px;
  153. overflow-x: auto;
  154. padding-bottom: 50px;
  155. }
  156. .purchase-list {
  157. background-color: #f5f5f5;
  158. height: 100%;
  159. overflow: hidden;
  160. .purchase-body{
  161. height: calc(100% - 88upx);
  162. overflow: auto
  163. }
  164. }
  165. </style>