index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <view class="flowLaunch-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. </view>
  8. <u-tabs :list="entrustList" v-model="current" @change="change" :is-scroll='false' name="fullName">
  9. </u-tabs>
  10. </view>
  11. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  12. :up="upOption" :bottombar="false" top="200">
  13. <view class="flow-list">
  14. <view class="flow-list-box">
  15. <uni-swipe-action ref="swipeAction">
  16. <uni-swipe-action-item v-for="(item, index) in list" :key="item.id" :threshold="0"
  17. :right-options="options" @click="handleClick(index)" :disabled="actionItemDisabled(item)">
  18. <view class="item" :id="'item'+index" ref="mydom" @click="goDetail(item)">
  19. <view class="item-left">
  20. <text class="title u-line-1 u-font-24 u-m-b-18">
  21. {{titleList[current]}}:
  22. <text
  23. class="titInner">{{current == '0' || current == '2' ? item.toUserName : item.userName }}</text>
  24. </text>
  25. <text class="title u-line-1 u-font-24 u-m-b-18">
  26. {{current == 2 ? '代理流程:' :'委托流程:' }}
  27. <text class="titInner">{{item.flowName ? item.flowName : ''}}</text>
  28. </text>
  29. <text class="time title u-font-24 u-m-b-18">
  30. 开始时间:
  31. <text
  32. class="titInner">{{item.startTime?$u.timeFormat(item.startTime, 'yyyy-mm-dd hh:MM:ss'):''}}</text>
  33. </text>
  34. <text class="time title u-font-24 "
  35. :class="current == 1 || current == 3 ?'u-m-b-18': ''">
  36. 结束时间:
  37. <text
  38. class="titInner">{{item.endTime?$u.timeFormat(item.endTime, 'yyyy-mm-dd hh:MM:ss'):''}}</text>
  39. </text>
  40. <view class="time title u-font-24" v-if="current == 1 || current == 3 ">
  41. 确认状态:
  42. <u-tag
  43. :type="item.confirmStatus == 0 ? 'info' : item.confirmStatus == 1 ? 'success' : 'error'"
  44. :text="item.confirmStatus == 0 ? '待确认' : item.confirmStatus == 1 ? '已接受' : '已拒绝'"
  45. size="mini" />
  46. </view>
  47. </view>
  48. <view class="item-right">
  49. <image :src="item.entrustStatus.flowStatus" mode="widthFix"
  50. class="item-right-img" />
  51. </view>
  52. </view>
  53. </uni-swipe-action-item>
  54. </uni-swipe-action>
  55. </view>
  56. </view>
  57. </mescroll-body>
  58. <view class="com-addBtn" v-if="current == 0 || current == 2" @click="addPage()">
  59. <u-icon name="plus" size="48" color="#fff" />
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import resources from '@/libs/resources.js'
  65. import {
  66. FlowDelegateList,
  67. DeleteDelagate,
  68. getDelegateUser
  69. } from '@/api/workFlow/entrust.js'
  70. import {
  71. getFlowLaunchList,
  72. delFlowLaunch
  73. } from '@/api/workFlow/template'
  74. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  75. import flowlist from '../../workFlow/flowTodo/flowList.vue'
  76. export default {
  77. components: {
  78. flowlist
  79. },
  80. mixins: [MescrollMixin],
  81. data() {
  82. return {
  83. keyword: '',
  84. list: [],
  85. downOption: {
  86. use: true,
  87. auto: true
  88. },
  89. upOption: {
  90. page: {
  91. num: 0,
  92. size: 20,
  93. time: null
  94. },
  95. empty: {
  96. use: true,
  97. icon: resources.message.nodata,
  98. tip: this.$t('common.noData'),
  99. fixed: true,
  100. top: "450rpx",
  101. },
  102. textNoMore: this.$t('app.apply.noMoreData'),
  103. },
  104. entrustList: [{
  105. fullName: this.$t('app.my.myEntrust')
  106. },
  107. {
  108. fullName: this.$t('app.my.entrustMe')
  109. },
  110. {
  111. fullName: this.$t('app.my.myAgency')
  112. },
  113. {
  114. fullName: this.$t('app.my.agencyMe')
  115. }
  116. ],
  117. titleList: ['受委托人', '委托人', '代理人', '被代理人'],
  118. current: 0,
  119. options: [{
  120. text: '删除',
  121. style: {
  122. backgroundColor: '#dd524d'
  123. }
  124. }]
  125. }
  126. },
  127. onLoad(e) {
  128. uni.$on('refresh', () => {
  129. this.list = [];
  130. this.mescroll.resetUpScroll();
  131. })
  132. if (e.index) this.current = Number(e.index)
  133. },
  134. onShow() {
  135. uni.$on('refreshDetail', () => {
  136. this.list = [];
  137. this.mescroll.resetUpScroll();
  138. })
  139. },
  140. methods: {
  141. actionItemDisabled(item) {
  142. if (this.current == 1 || this.current == 3) return true
  143. return !(item.status == 0 || item.status == 2)
  144. },
  145. addPage() {
  146. let url = '/entrustAgent/form'
  147. const data = {
  148. current: this.current,
  149. type: this.current == 0 ? 0 : 1
  150. }
  151. uni.navigateTo({
  152. url: `/pages/my${url}?data=${encodeURIComponent(JSON.stringify(data))}`
  153. })
  154. },
  155. handleClick(index) {
  156. const item = this.list[index]
  157. DeleteDelagate(item.id).then(res => {
  158. this.$u.toast(res.msg)
  159. this.mescroll.resetUpScroll()
  160. })
  161. },
  162. upCallback(page) {
  163. let query = {
  164. currentPage: page.num,
  165. pageSize: page.size,
  166. keyword: this.keyword,
  167. type: this.current + 1
  168. }
  169. FlowDelegateList(query, {
  170. load: page.num == 1
  171. }).then(res => {
  172. this.mescroll.endSuccess(res.data.list.length);
  173. if (page.num == 1) this.list = [];
  174. // #ifndef APP-HARMONY
  175. const list = res.data.list.map(o => ({
  176. 'entrustStatus': this.getEntrustStatus(o),
  177. ...o
  178. }))
  179. // #endif
  180. // #ifdef APP-HARMONY
  181. const list = res.data.list.map(o =>
  182. Object.assign({}, {
  183. 'entrustStatus': this.getEntrustStatus(o)
  184. }, o)
  185. );
  186. // #endif
  187. this.list = this.list.concat(list);
  188. }).catch(() => {
  189. this.mescroll.endErr();
  190. })
  191. },
  192. // 状态
  193. getEntrustStatus(o) {
  194. let status = o.status;
  195. let flowStatus;
  196. switch (status) {
  197. case 0: //未生效
  198. flowStatus = resources.status.notEffective
  199. break;
  200. case 1: //生效中
  201. flowStatus = resources.status.effectuate
  202. break;
  203. default: //已失效
  204. flowStatus = resources.status.expired
  205. break;
  206. }
  207. return {
  208. flowStatus,
  209. status
  210. }
  211. },
  212. search() {
  213. // 节流,避免输入过快多次请求
  214. this.searchTimer && clearTimeout(this.searchTimer)
  215. this.searchTimer = setTimeout(() => {
  216. this.list = [];
  217. this.mescroll.resetUpScroll();
  218. }, 300)
  219. },
  220. change(index) {
  221. this.keyword = ''
  222. this.current = index;
  223. this.list = [];
  224. this.search()
  225. },
  226. // 详情
  227. goDetail(item) {
  228. const data = {
  229. ...item,
  230. current: this.current,
  231. type: this.current == 0 ? 0 : 1
  232. };
  233. uni.navigateTo({
  234. url: `/pages/my/entrustAgent/detail?data=${encodeURIComponent(JSON.stringify(data))}`
  235. });
  236. }
  237. }
  238. }
  239. </script>
  240. <style lang="scss">
  241. page {
  242. background-color: #f0f2f6;
  243. }
  244. .search_sticky {
  245. z-index: 990;
  246. position: sticky;
  247. background-color: #fff;
  248. }
  249. .flowLaunch-v {
  250. width: 100%;
  251. .flow-list-box {
  252. width: 95%;
  253. .item {
  254. display: flex;
  255. width: 100%;
  256. height: 100%;
  257. .common-lable {
  258. font-size: 24rpx;
  259. border-radius: 8rpx;
  260. color: #409EFF;
  261. border: 1px solid #409EFF;
  262. background-color: #e5f3fe;
  263. }
  264. .urgent-lable {
  265. color: #E6A23C;
  266. border: 1px solid #E6A23C;
  267. background-color: #fef6e5;
  268. }
  269. .important-lable {
  270. color: #F56C6C;
  271. border: 1px solid #F56C6C;
  272. background-color: #fee5e5;
  273. }
  274. .item-right {
  275. display: flex;
  276. justify-content: flex-end;
  277. height: 88rpx;
  278. .item-right-img {
  279. width: 102rpx;
  280. }
  281. }
  282. }
  283. }
  284. .item-left-top {
  285. display: flex;
  286. width: 100%;
  287. align-items: baseline;
  288. .common-lable {
  289. font-size: 24rpx;
  290. padding: 2rpx 8rpx;
  291. border-radius: 8rpx;
  292. color: #409EFF;
  293. border: 1px solid #409EFF;
  294. background-color: #e5f3fe;
  295. // margin-bottom: 16rpx;
  296. }
  297. .urgent-lable {
  298. color: #E6A23C;
  299. border: 1px solid #E6A23C;
  300. background-color: #fef6e5;
  301. }
  302. .important-lable {
  303. color: #F56C6C;
  304. border: 1px solid #F56C6C;
  305. background-color: #fee5e5;
  306. }
  307. .title {
  308. width: unset;
  309. flex: 1;
  310. min-width: 0;
  311. }
  312. }
  313. }
  314. </style>