allApp_workFlow.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view class="allApp-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">
  7. </u-search>
  8. </view>
  9. </view>
  10. <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  11. :up="upOption" :bottombar="false" :sticky="false">
  12. <view>
  13. <view class="usualList">
  14. <view class=" caption u-m-b-20">常用流程</view>
  15. <view class="u-flex u-flex-wrap">
  16. <view class="item u-flex-col u-col-center" v-for="(item,i) in usualList" :key="i">
  17. <text class="u-font-40 item-icon" :class="item.icon"
  18. :style="{'background':item.iconBackground||'#008cff'}" @click="Jump(item)" />
  19. <text class="u-font-24 u-line-1 item-text">{{item.fullName}}</text>
  20. </view>
  21. </view>
  22. </view>
  23. <u-sticky>
  24. <CommonTabs :list="categoryList" @change="change" :current="current" ref="CommonTabs" isBoxShadow>
  25. </CommonTabs>
  26. </u-sticky>
  27. <view class="allList u-m-t-20" v-if="allList.length">
  28. <view v-for="(item,i) in allList" :key="i">
  29. <view class="u-flex childList-item ">
  30. <text class="u-font-40 item-icon" :class="item.icon"
  31. :style="{'background':item.iconBackground||'#008cff'}" @click="Jump(item)" />
  32. <text class="item-text u-m-l-28 u-m-r-28 u-line-2">{{item.fullName}}</text>
  33. <view class="btnBox">
  34. <u-button :custom-style="customStyle" @click="handelAdd(item)"
  35. v-if="!item.isCommonFlow">添加
  36. </u-button>
  37. <u-button :custom-style="customStyle" type="error" @click="handelDel(item)" v-else>
  38. 移除
  39. </u-button>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <NoData v-else paddingTop="100"></NoData>
  45. </view>
  46. </mescroll-uni>
  47. </view>
  48. </template>
  49. <script>
  50. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  51. import CommonTabs from '@/components/CommonTabs'
  52. import NoData from '@/components/noData'
  53. import {
  54. getFlowList,
  55. getDataList,
  56. getFlowUsualList,
  57. setCommonFlow,
  58. delUsual
  59. } from '@/api/apply/apply.js'
  60. import resources from '@/libs/resources.js'
  61. export default {
  62. mixins: [MescrollMixin], // 使用mixin
  63. components: {
  64. CommonTabs,
  65. NoData
  66. },
  67. props: {
  68. categoryList: {
  69. type: Array,
  70. default () {
  71. return [];
  72. }
  73. },
  74. },
  75. data() {
  76. return {
  77. usualList: [],
  78. current: 0,
  79. customStyle: {
  80. width: "128rpx",
  81. fontSize: "24rpx",
  82. height: '60rpx'
  83. },
  84. downOption: {
  85. use: true,
  86. auto: true
  87. },
  88. upOption: {
  89. page: {
  90. num: 0,
  91. size: 20,
  92. time: null
  93. },
  94. empty: {
  95. use: false,
  96. icon: resources.message.nodata,
  97. tip: this.$t('common.noData'),
  98. fixed: true,
  99. top: "860rpx",
  100. },
  101. textNoMore: this.$t('app.apply.noMoreData'),
  102. },
  103. category: '',
  104. allList: [],
  105. type: '1',
  106. fullName: '',
  107. keyword: ''
  108. }
  109. },
  110. methods: {
  111. search() {
  112. this.searchTimer && clearTimeout(this.searchTimer);
  113. this.searchTimer = setTimeout(() => {
  114. this.list = [];
  115. this.menuList = [];
  116. this.mescroll.resetUpScroll();
  117. }, 300);
  118. },
  119. init() {
  120. this.getFlowUsualList()
  121. },
  122. getFlowUsualList() {
  123. let query = {
  124. category: 'commonFlow',
  125. flowType: 0
  126. }
  127. getFlowUsualList(query).then(res => {
  128. this.usualList = res.data.list.map(o => {
  129. const objectData = o.objectData ? JSON.parse(o.objectData) : {}
  130. return {
  131. ...o,
  132. ...objectData
  133. }
  134. })
  135. })
  136. },
  137. upCallback(page) {
  138. let query = {
  139. currentPage: page.num,
  140. pageSize: page.size,
  141. category: this.category == 0 ? '' : this.category,
  142. flowType: 0,
  143. keyword: this.keyword
  144. }
  145. getFlowList(query, {
  146. load: page.num == 1
  147. }).then(res => {
  148. this.mescroll.endSuccess(res.data.list.length);
  149. if (page.num == 1) this.allList = [];
  150. const list = res.data.list || [];
  151. this.allList = this.allList.concat(list);
  152. }).catch(() => {
  153. this.mescroll.endSuccess(0);
  154. this.mescroll.endErr();
  155. })
  156. },
  157. Jump(item) {
  158. const config = {
  159. id: "",
  160. flowId: item.id,
  161. opType: "-1",
  162. };
  163. uni.navigateTo({
  164. url: "/pages/workFlow/flowBefore/index?config=" +
  165. this.jnpf.base64.encode(JSON.stringify(config))
  166. });
  167. },
  168. handelAdd(item) {
  169. setCommonFlow(item.id).then(res => {
  170. this.usualList.push(item)
  171. item.isCommonFlow = true
  172. uni.$emit('updateUsualList')
  173. uni.showToast({
  174. title: res.msg
  175. })
  176. })
  177. },
  178. handelDel(item) {
  179. setCommonFlow(item.id).then(res => {
  180. item.isCommonFlow = false
  181. this.getFlowUsualList()
  182. uni.$emit('updateUsualList')
  183. uni.showToast({
  184. title: res.msg
  185. })
  186. })
  187. },
  188. change(index) {
  189. this.current = index;
  190. this.keyword = ""
  191. this.category = !this.categoryList[index].id ? '' : this.categoryList[index].id
  192. this.allList = [];
  193. this.mescroll.resetUpScroll()
  194. }
  195. }
  196. }
  197. </script>
  198. <style lang="scss" scoped>
  199. .allApp-v {
  200. .notice-warp {
  201. height: 114rpx;
  202. .search-box {
  203. padding: 20rpx;
  204. }
  205. }
  206. .caption {
  207. font-size: 36rpx;
  208. line-height: 80rpx;
  209. padding: 0 32rpx;
  210. .tip {
  211. margin-left: 20rpx;
  212. font-size: 24rpx;
  213. color: #c6c6c6;
  214. }
  215. }
  216. .tabs_box {
  217. width: 100%;
  218. .sticky {
  219. width: 750rpx;
  220. height: 120rpx;
  221. color: #fff;
  222. padding-right: 32rpx;
  223. }
  224. }
  225. .usualList {
  226. margin-top: 4.2rem;
  227. margin-bottom: 20rpx;
  228. background-color: #FFFFFF;
  229. .item {
  230. margin-bottom: 32rpx;
  231. width: 25%;
  232. .item-icon {
  233. width: 88rpx;
  234. height: 88rpx;
  235. margin-bottom: 8rpx;
  236. line-height: 88rpx;
  237. text-align: center;
  238. border-radius: 30rpx;
  239. color: #fff;
  240. font-size: 40rpx;
  241. }
  242. .item-text {
  243. width: 100%;
  244. text-align: center;
  245. padding: 0 16rpx;
  246. }
  247. }
  248. }
  249. .allList {
  250. padding: 0rpx 32rpx 28rpx;
  251. background-color: #FFFFFF;
  252. .childList-item {
  253. align-items: center;
  254. padding: 28rpx 0 0 0;
  255. .item-text {
  256. width: calc(100% - 216rpx);
  257. }
  258. .item-icon {
  259. width: 88rpx;
  260. height: 88rpx;
  261. line-height: 88rpx;
  262. text-align: center;
  263. border-radius: 30rpx;
  264. color: #FFFFFF;
  265. flex-shrink: 0;
  266. font-size: 40rpx;
  267. }
  268. }
  269. }
  270. }
  271. </style>