flowList.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="flowLaunch-v">
  3. <view class="flow-list" v-if="list.length > 0">
  4. <view class="flow-list-box">
  5. <u-swipe-action :show="item.show" :index="index" v-for="(item, index) in list" :key="item.id"
  6. @click="handleClick(index)" @open="open" :options="options" :btnWidth="160" :vibrateShort="true"
  7. :disabled="item.swipeAction">
  8. <view class="item" @click="goDetail(item)" :id="'item'+index" ref="mydom">
  9. <view class="item-left">
  10. <view class="item-left-top">
  11. <view class='common-lable-entrust' v-if="item.delegateUser">
  12. {{!category ? '委托' : '代理' }}
  13. </view>
  14. <view class='common-lable'
  15. :class="{'urgent-lable':item.flowUrgent==2,'important-lable':item.flowUrgent==3}">
  16. {{getLableValue(item.flowUrgent)}}
  17. </view>
  18. <text class="title u-font-28 u-line-1">{{item.fullName}}</text>
  19. </view>
  20. <text class="title u-line-1 u-font-24">审批节点:{{item.currentNodeName}}<text
  21. class="titInner">{{item.thisStep ? item.thisStep : ''}}</text></text>
  22. <text class="time title u-font-24">发起时间:<text
  23. class="titInner">{{item.startTime?$u.timeFormat(item.startTime, 'yyyy-mm-dd hh:MM:ss'):''}}</text></text>
  24. </view>
  25. <view class="item-right">
  26. <image :src="item.flowStatus" mode="widthFix" class="item-right-img">
  27. </image>
  28. </view>
  29. </view>
  30. </u-swipe-action>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. delFlowLaunch
  38. } from '@/api/workFlow/template'
  39. export default {
  40. name: "FlowList",
  41. props: {
  42. list: {
  43. type: Array,
  44. default: () => []
  45. },
  46. swipeAction: {
  47. type: Boolean,
  48. default: false
  49. },
  50. category: {
  51. type: [String, Number],
  52. default: '0'
  53. },
  54. },
  55. data() {
  56. return {
  57. options: [{
  58. text: '删除',
  59. style: {
  60. backgroundColor: '#dd524d'
  61. }
  62. }],
  63. title: '',
  64. };
  65. },
  66. methods: {
  67. open(index) {
  68. // 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
  69. // 原本为'false',再次设置为'false'会无效
  70. this.list[index].show = true;
  71. this.list.map((val, idx) => {
  72. if (index != idx) this.list[idx].show = false;
  73. })
  74. },
  75. goDetail(item) {
  76. const config = {
  77. opType: item.opType,
  78. operatorId: item.id,
  79. category: this.category,
  80. ...item
  81. }
  82. uni.navigateTo({
  83. url: '/pages/workFlow/flowBefore/index?config=' +
  84. this.jnpf.base64.encode(JSON.stringify(config))
  85. })
  86. },
  87. handleClick(index) {
  88. const item = this.list[index]
  89. if ([1, 2, 3, 5].includes(item.status)) {
  90. this.$u.toast("流程正在审核,请勿删除")
  91. this.list[index].show = false
  92. return
  93. }
  94. delFlowLaunch(item.id).then(res => {
  95. this.$u.toast(res.msg)
  96. this.list.splice(index, 1)
  97. })
  98. },
  99. getLableValue(value) {
  100. var lableValue = ''
  101. switch (value) {
  102. case 1:
  103. lableValue = '普通'
  104. break;
  105. case 2:
  106. lableValue = '重要'
  107. break;
  108. case 3:
  109. lableValue = '紧急'
  110. break;
  111. default:
  112. lableValue = '普通'
  113. break;
  114. }
  115. return lableValue
  116. }
  117. }
  118. };
  119. </script>
  120. <style scoped lang="scss">
  121. .flowLaunch-v {
  122. width: 100%;
  123. .flow-list-box {
  124. width: 95%;
  125. .item-left-top {
  126. display: flex;
  127. width: 100%;
  128. .common-lable {
  129. font-size: 24rpx;
  130. padding: 2rpx 8rpx;
  131. margin-right: 8rpx;
  132. border-radius: 8rpx;
  133. color: #409EFF;
  134. border: 1px solid #409EFF;
  135. background-color: #e5f3fe;
  136. &-entrust {
  137. margin-right: 8rpx;
  138. font-size: 24rpx;
  139. padding: 2rpx 8rpx;
  140. border-radius: 8rpx;
  141. background-color: #dbf1e1;
  142. color: #19be6b;
  143. border: 1px solid #19be6b;
  144. }
  145. }
  146. .urgent-lable {
  147. color: #E6A23C;
  148. border: 1px solid #E6A23C;
  149. background-color: #fef6e5;
  150. }
  151. .important-lable {
  152. color: #F56C6C;
  153. border: 1px solid #F56C6C;
  154. background-color: #fee5e5;
  155. }
  156. .title {
  157. width: unset;
  158. flex: 1;
  159. min-width: 0;
  160. }
  161. }
  162. }
  163. }
  164. </style>