Approval.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <!-- 审批组件 -->
  2. <template>
  3. <view class="approval-container">
  4. <view class="approval_btn-wrapper">
  5. <text class="approval-btn refuse" @click="handleRefuse">驳回</text>
  6. <text class="approval-btn primary" @click="handlePass(true)">通过</text>
  7. </view>
  8. <uni-popup ref="inputDialog" type="dialog">
  9. <uni-popup-dialog
  10. ref="inputClose"
  11. mode="input"
  12. title="驳回原因"
  13. placeholder="请输入内容"
  14. :before-close="true"
  15. @close="handleClose"
  16. @confirm="timeoutCauseConfirm"
  17. ></uni-popup-dialog>
  18. </uni-popup>
  19. <uni-popup ref="evaluateDialog" type="dialog" background-color="#fff">
  20. <view class="evaluate_box">
  21. <view class="title">服务评价</view>
  22. <view class="btn_box">
  23. <view v-for="(item,index) in evaluateList" :key="index" :class="[actCode == item.dictCode ? 'actBtn' : '', 'btn']" @click="handleAct(item.dictCode)">
  24. {{item.dictValue}}
  25. </view>
  26. </view>
  27. <view class="btn_ok" @click="handleOk">提交</view>
  28. </view>
  29. </uni-popup>
  30. </view>
  31. </template>
  32. <script>
  33. import { postJ, get, } from '../utils/api'
  34. export default {
  35. props: {
  36. devOpsType: {
  37. type: [Number, String]
  38. },
  39. planType: {
  40. type: [Number, String]
  41. },
  42. myHandleId: {
  43. type: [Number, String]
  44. },
  45. id: {
  46. type: [Number, String]
  47. }
  48. },
  49. data() {
  50. return {
  51. evaluateList: [],
  52. actCode: null
  53. }
  54. },
  55. created () {
  56. this.getEnum()
  57. },
  58. methods: {
  59. handleRefuse () {
  60. this.$refs.inputDialog.open()
  61. },
  62. handleClose () {
  63. this.$refs.inputDialog.close()
  64. },
  65. handlePass (checked, cause) {
  66. const params = {
  67. checked,
  68. handleType: this.devOpsType,
  69. myHandleId: this.myHandleId,
  70. id: this.id,
  71. type: this.planType == 10 ? 10 : this.planType == 3 ? 1 : 2
  72. }
  73. if (cause) {
  74. params.cause = cause
  75. }
  76. postJ(this.apiUrl + '/plan/info/audit', params).then(res => {
  77. if (res?.success) {
  78. if(this.planType == 10 || this.planType == 3) {
  79. this.$refs.evaluateDialog.open()
  80. } else {
  81. uni.navigateTo({
  82. url: `/pages/home/backlog/result?type=${
  83. checked ? 'approve' : 'refuse'
  84. }&status=${this.devOpsType}`
  85. })
  86. }
  87. }
  88. })
  89. },
  90. timeoutCauseConfirm (value) {
  91. if (!value) {
  92. uni.showToast({
  93. title: '请输入驳回原因',
  94. icon: 'none'
  95. })
  96. return
  97. }
  98. this.handlePass(false, value)
  99. this.$refs.inputDialog.close()
  100. },
  101. getEnum() {
  102. get(this.apiUrl + '/enumerationKeyvalue/getListByMainCode/evaluate').then(res => {
  103. if(res?.success) {
  104. this.evaluateList = res.data
  105. }
  106. })
  107. },
  108. handleAct(code) {
  109. this.actCode = code
  110. },
  111. handleOk() {
  112. let params = {
  113. evaluationResult: this.actCode,
  114. id: this.id
  115. }
  116. postJ(this.apiUrl + '/planRepair/evaluation', params).then(res => {
  117. if(res?.success) {
  118. this.$refs.evaluateDialog.close()
  119. uni.navigateTo({
  120. url: `/pages/home/backlog/result?type=approve&status=${this.devOpsType}`
  121. })
  122. }
  123. })
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="scss" scoped>
  129. .approval-container {
  130. width: 100vw;
  131. height: 80rpx;
  132. .approval_btn-wrapper {
  133. display: flex;
  134. position: fixed;
  135. bottom: 0;
  136. width: 100vw;
  137. height: 80rpx;
  138. background-color: #fff;
  139. }
  140. .approval-btn {
  141. flex: 1;
  142. line-height: 78rpx;
  143. text-align: center;
  144. border: 1rpx solid $j-primary-border-green;
  145. &.refuse {
  146. color: red;
  147. }
  148. &.primary {
  149. background-color: $j-primary-border-green;
  150. color: #fff;
  151. }
  152. }
  153. }
  154. .evaluate_box{
  155. width: 600rpx;
  156. min-height: 280rpx;
  157. .title{
  158. margin-top: 32rpx;
  159. text-align: center;
  160. font-size: 40rpx;
  161. font-weight: 600;
  162. }
  163. .btn_box{
  164. width: 400rpx;
  165. display: flex;
  166. flex-direction: row;
  167. margin: auto;
  168. margin-top: 20rpx;
  169. .btn{
  170. width: 260rpx;
  171. height: 46rpx;
  172. border: 2rpx solid #157a2c;
  173. text-align: center;
  174. line-height: 46rpx;
  175. color: #000;
  176. }
  177. .actBtn{
  178. border: 2rpx solid #157a2c;
  179. background: #157a2c;
  180. color: #fff;
  181. }
  182. }
  183. .btn_ok{
  184. width: 200rpx;
  185. height: 60rpx;
  186. background: #157a2c;
  187. color: #fff;
  188. margin: auto;
  189. margin-top: 50rpx;
  190. line-height: 60rpx;
  191. text-align: center;
  192. }
  193. }
  194. </style>