flowBtn.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view class="flowBefore-actions" :style="{'height': '88rpx'}"
  3. v-if="hasComment || (actionList.length || rightBtnList.length) ">
  4. <CustomButton v-if="showMoreBtn" btnText="更多" btnType="more" iconName="more-dot-fill" size="28"
  5. @handleBtn="showAction = $event" :btnLoading="loading" class="u-flex-col buttom-btn-left-inner" />
  6. <template v-if="opType != 2">
  7. <CustomButton v-if="showSaveBtn" :btnText="saveBtnText || '暂存'" customIcon
  8. class="u-flex-col buttom-btn-left-inner" btnIcon="icon-ym icon-ym-extend-save" size="28"
  9. @handleBtn="handleBtn('save')" btnType="save" :btnLoading="loading" />
  10. <CustomButton v-if="showRejectBtn" btnText="拒绝" iconName="minus-circle" size="28"
  11. @handleBtn="handleBtn('reject')" btnType="reject" :btnLoading="loading"
  12. class="u-flex-col buttom-btn-left-inner" />
  13. </template>
  14. <view class="rightBtn u-flex">
  15. <u-button class="buttom-btn" @click.stop="handleBtn('comment')" v-if="!rightBtnList.length"
  16. :loading="loading">
  17. 评论
  18. </u-button>
  19. <template v-if="opType != 2">
  20. <u-button v-for="btn,index in rightBtnList" :key="index" class="buttom-btn"
  21. @click.stop="handleBtn(btn.id)" :style="{'width':btn.width}"
  22. :class="{'delegate-submit-btn':btn.id === 'delegateSubmit'}" :loading="loading" :type="btn?.type">
  23. {{ btn.fullName}}
  24. </u-button>
  25. </template>
  26. <template class="" v-else>
  27. <u-button v-for="btn,index in todoBtnList" :key="index" class="buttom-btn"
  28. @click.stop="handleBtn(btn.id)" :style="{'width':btn.width}" :loading="loading" :type="btn?.type">
  29. {{ btn.fullName}}
  30. </u-button>
  31. </template>
  32. </view>
  33. <u-action-sheet v-model="showAction" :list="actionList" @click="handleAction" />
  34. </view>
  35. </template>
  36. <script>
  37. import CustomButton from '@/components/CustomButton'
  38. export default {
  39. components: {
  40. CustomButton
  41. },
  42. props: {
  43. actionList: {
  44. type: Array,
  45. default: () => ([])
  46. },
  47. rightBtnList: {
  48. type: Array,
  49. default: () => ([])
  50. },
  51. todoBtnList: {
  52. type: Array,
  53. default: () => ([])
  54. },
  55. btnInfo: {
  56. type: Object,
  57. default: () => ({})
  58. },
  59. opType: {
  60. type: [String, Number],
  61. default: ''
  62. },
  63. saveBtnText: {
  64. type: String,
  65. default: ''
  66. },
  67. btnLoading: {
  68. type: Boolean,
  69. default: false
  70. },
  71. hideSaveBtn: {
  72. type: Boolean,
  73. default: false
  74. },
  75. hasSignFor: {
  76. type: Boolean,
  77. default: false
  78. },
  79. hasComment: {
  80. type: Boolean,
  81. default: false
  82. },
  83. isProcessing: {
  84. type: [String, Number],
  85. default: ''
  86. }
  87. },
  88. computed: {
  89. loading() {
  90. return this.btnLoading
  91. },
  92. showMoreBtn() {
  93. if (this.actionList.length) return true
  94. return false
  95. },
  96. showRejectBtn() {
  97. if (this.btnInfo?.hasRejectBtn && !this.isProcessing && this.opType != 2) return true
  98. return false
  99. },
  100. showSaveBtn() {
  101. if (this.btnInfo?.hasSaveBtn && !this.hideSaveBtn) return true
  102. return false
  103. }
  104. },
  105. data() {
  106. return {
  107. showAction: false
  108. }
  109. },
  110. methods: {
  111. handleBtn(type, item) {
  112. if (!this.loading) this.$emit('handleBtn', type, item)
  113. },
  114. //更多按钮
  115. handleAction(index) {
  116. this.handleBtn(this.actionList[index].id, this.actionList[index])
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss">
  122. .flowBefore-actions {
  123. .poup-btn {
  124. background-color: #fff;
  125. width: 100%;
  126. height: 88rpx;
  127. padding: 0 20rpx;
  128. color: #7f7f7f;
  129. border-bottom: 1rpx solid #d7d7d7;
  130. .btn {
  131. background-color: #f2f2f2;
  132. border-radius: 8rpx;
  133. height: 60rpx;
  134. padding-left: 10rpx;
  135. width: 100%;
  136. line-height: 60rpx;
  137. }
  138. }
  139. }
  140. .delegate-submit-btn {
  141. background-color: #50abf6;
  142. button {
  143. background-color: #50abf6 !important;
  144. }
  145. }
  146. </style>