allCommonFlow.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="workFlow-v">
  3. <view class="notice-warp">
  4. <view class="search-box">
  5. <u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="keyword" height="72"
  6. :show-action="false" @change="search" bg-color="#f0f2f6" shape="square" @clear="clear" />
  7. </view>
  8. <view class="commonTabs-box">
  9. <CommonTabs :list="categoryTree" @change="change" :current="current" ref="CommonTabs"
  10. :isScroll="categoryTree.length >= 4 ? true : false">
  11. </CommonTabs>
  12. </view>
  13. </view>
  14. <view class="workFlow-list" style="">
  15. <view class="part" v-if="list.length">
  16. <view class="caption u-line-1">
  17. {{fullName }}
  18. </view>
  19. <view class="u-flex u-flex-wrap">
  20. <view class="item u-flex-col u-col-center" v-for="(child, ii) in list" :key="ii"
  21. @click="Jump(child)">
  22. <text class="u-font-40 item-icon" :class="child.icon"
  23. :style="{ background: child.iconBackground || '#008cff' }" />
  24. <text class="u-font-24 u-line-1 item-text">{{ child.fullName }}</text>
  25. </view>
  26. </view>
  27. </view>
  28. <NoData v-else></NoData>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import NoData from '@/components/noData'
  34. import CommonTabs from '@/components/CommonTabs'
  35. import {
  36. getCommonFlowTree
  37. } from "@/api/apply/apply.js";
  38. export default {
  39. components: {
  40. CommonTabs,
  41. NoData
  42. },
  43. data() {
  44. return {
  45. activeFlow: {},
  46. keyword: "",
  47. category: "",
  48. current: 0,
  49. categoryTree: [],
  50. fullName: '',
  51. list: [],
  52. searchCategoryTree: []
  53. };
  54. },
  55. created() {
  56. uni.showLoading()
  57. this.getFlowUsualList();
  58. },
  59. methods: {
  60. getFlowUsualList() {
  61. this.keyword = ''
  62. getCommonFlowTree().then((res) => {
  63. this.categoryTree = res?.data?.list || [];
  64. this.searchCategoryTree = JSON.parse(JSON.stringify(this.categoryTree))
  65. this.list = []
  66. this.$nextTick(() => {
  67. this.list = this.categoryTree[this.current]?.children || []
  68. this.fullName = this.categoryTree[this.current]?.fullName;
  69. })
  70. uni.hideLoading()
  71. }).catch(() => {
  72. this.categoryTree = []
  73. this.list = []
  74. })
  75. },
  76. search() {
  77. this.searchTimer && clearTimeout(this.searchTimer);
  78. this.searchTimer = setTimeout(() => {
  79. if (!this.keyword) return this.clear()
  80. let children = this.searchCategoryTree[this.current].children.filter(o => o.fullName.includes(
  81. this.keyword))
  82. this.$set(this.categoryTree[this.current], 'children', children)
  83. this.list = this.categoryTree[this.current].children
  84. }, 300);
  85. },
  86. clear() {
  87. this.getFlowUsualList();
  88. },
  89. change(i) {
  90. this.list = this.categoryTree[i].children
  91. this.fullName = this.categoryTree[i].fullName;
  92. this.keyword = ''
  93. this.current = i
  94. },
  95. Jump(item) {
  96. const config = {
  97. id: "",
  98. flowId: item.id,
  99. opType: "-1",
  100. };
  101. this.current = 0
  102. this.category = ""
  103. uni.navigateTo({
  104. url: "/pages/workFlow/flowBefore/index?config=" +
  105. this.jnpf.base64.encode(JSON.stringify(config))
  106. });
  107. }
  108. },
  109. };
  110. </script>
  111. <style lang="scss" scoped>
  112. page {
  113. background-color: #f0f2f6;
  114. }
  115. .workFlow-v {
  116. height: 100%;
  117. .workFlow-list {
  118. margin-top: 120px;
  119. }
  120. .notice-warp {
  121. height: 115rpx !important;
  122. .search-box {
  123. padding: 20rpx;
  124. }
  125. }
  126. .commonTabs-box {
  127. height: 2.8rem;
  128. }
  129. }
  130. </style>