executableworkorder.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="executableworkorder-page">
  3. <navigation title="可执行工单"></navigation>
  4. <view class="list-box" v-if="dataList.length>0">
  5. <view class="list-item" v-for="(item, index) in dataList" :key="index">
  6. <view class="item-text flex-box">
  7. <view class="item-text-left">工单名称:</view>
  8. <view class="item-text-right">{{ item.taskName || '-' }}</view>
  9. </view>
  10. <view class="item-text flex-box">
  11. <view class="item-text-left">工单编号:</view>
  12. <view class="item-text-right">{{ item.orderNum || '-' }}</view>
  13. </view>
  14. <view class="item-text flex-box">
  15. <view class="item-text-left">计划数量:</view>
  16. <view class="item-text-right">{{ item.orderAmounts || 0 }}</view>
  17. </view>
  18. <view class="item-text flex-box">
  19. <view class="item-text-left">待生产数量:</view>
  20. <view class="item-text-right">{{ item.orderAmounts - (item.orderFinishNum || 0)}}</view>
  21. </view>
  22. <view class="item-text flex-box">
  23. <view class="item-text-left">已完成数量:</view>
  24. <view class="item-text-right">{{ item.orderFinishNum || 0 }}</view>
  25. </view>
  26. <view class="positioning-box">
  27. <view style="color: #3d6df0;" v-if="item.processStatus == 0">未执行</view>
  28. <view style="color: lawngreen;" v-if="item.processStatus == 1 && item.stopTime == null">执行中</view>
  29. <view style="color: red;" v-if="item.processStatus == 1 && item.stopTime != null">已送检</view>
  30. </view>
  31. <view class="btn-box">
  32. <view class="btn-item"
  33. :style="item.processStatus == 0 || (item.processStatus == 1 && item.stopTime != null)?'':'opacity:.5'"
  34. @click="carryout(item)">
  35. <view>执行</view>
  36. </view>
  37. <view class="btn-item btn-item-red"
  38. :style="item.processStatus == 1 && item.stopTime == null?'':'opacity:.5'" @click="suspend(item)">
  39. <view>送检</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <empty v-else text="暂无数据"></empty>
  45. <!-- 执行确认框 -->
  46. <uni-popup ref="alertDialog" type="dialog">
  47. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="提示" content="确认执行该工单吗?"
  48. @confirm="dialogConfirm"></uni-popup-dialog>
  49. </uni-popup>
  50. <!-- 暂停确认框 -->
  51. <uni-popup ref="suspendRef" type="dialog">
  52. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="提示" content="确认暂停该工单吗?"
  53. @confirm="suspendConfirm"></uni-popup-dialog>
  54. </uni-popup>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. dataList: [],
  62. equipmentId: '',
  63. // 执行事件需要的参数
  64. carryoutForm:{},
  65. // 暂停事件需要的参数
  66. suspendForm:{}
  67. }
  68. },
  69. onLoad(option) {
  70. this.equipmentId = option.id
  71. this.getList()
  72. },
  73. methods: {
  74. getList() {
  75. uni.showLoading({
  76. title: '正在加载...'
  77. })
  78. this.$api.listExecuteOrder(this.equipmentId).then(res => {
  79. this.dataList = res.data
  80. uni.hideLoading()
  81. }).catch(err => {})
  82. },
  83. // 执行
  84. carryout(e) {
  85. // 判断是否可以点击执行按钮
  86. if (e.processStatus == 0 || (e.processStatus == 1 && e.stopTime != null)) {
  87. }else {
  88. return
  89. }
  90. this.carryoutForm = {
  91. orderId:e.id,
  92. processId:e.processId,
  93. taskId:e.taskId,
  94. tenant:'fb4a88d6f6f24d67953f68c4fe829f63'
  95. }
  96. this.$refs.alertDialog.open()
  97. },
  98. // 暂停
  99. suspend(e){
  100. // 判断如果不是执行中不能点
  101. if (e.processStatus == 1 && e.stopTime == null) {
  102. }else {
  103. return
  104. }
  105. this.suspendForm = {
  106. equipmentId:e.equipmentId,
  107. taskId:e.taskId,
  108. tenant:'fb4a88d6f6f24d67953f68c4fe829f63'
  109. }
  110. this.$refs.suspendRef.open()
  111. },
  112. // 执行事件
  113. dialogConfirm() {
  114. let params = {
  115. equipmentId: this.equipmentId,
  116. ...this.carryoutForm
  117. }
  118. let that = this
  119. this.$api.productOrderDetail(params).then(res => {
  120. uni.showToast({
  121. title: '操作成功!',
  122. duration: 2000
  123. });
  124. setTimeout(function() {
  125. that.getList()
  126. }, 2000);
  127. }).catch(err => {})
  128. },
  129. // 暂停事件
  130. suspendConfirm(){
  131. this.$api.productOrderDetailStop(this.suspendForm).then(res => {
  132. uni.showToast({
  133. title: '操作成功!',
  134. duration: 2000
  135. });
  136. setTimeout(()=> {
  137. this.getList()
  138. }, 2000);
  139. }).catch(err => {})
  140. },
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .executableworkorder-page {
  146. .list-box {
  147. padding: 0 20rpx;
  148. color: $uni-text-color-list;
  149. .list-item {
  150. background-color: $uni-bg-color;
  151. padding: 20rpx;
  152. border-radius: 20rpx;
  153. margin-top: 28rpx;
  154. position: relative;
  155. .item-text {
  156. margin-top: 10rpx;
  157. font-size: 28rpx;
  158. .item-text-left {
  159. width: 170rpx;
  160. text-align: right;
  161. }
  162. .item-text-right {
  163. font-size: 30rpx;
  164. }
  165. }
  166. .flex-box {
  167. display: flex;
  168. align-items: center;
  169. }
  170. .positioning-box {
  171. font-size: 28rpx;
  172. position: absolute;
  173. right: 5%;
  174. top: 10%;
  175. }
  176. }
  177. .btn-box {
  178. display: flex;
  179. justify-content: flex-end;
  180. margin-top: 10rpx;
  181. .btn-item {
  182. width: 175rpx;
  183. height: 50rpx;
  184. line-height: 50rpx;
  185. text-align: center;
  186. border-radius: 24rpx;
  187. margin-left: 20rpx;
  188. border: 1px solid #3d6df0;
  189. color: #fff;
  190. background: #3d6df0;
  191. }
  192. .btn-item-red {
  193. background: red;
  194. border: 1px solid red;
  195. color: #fff;
  196. }
  197. .btn-text {
  198. width: 175rpx;
  199. height: 50rpx;
  200. line-height: 50rpx;
  201. text-align: center;
  202. color: #aaa;
  203. }
  204. }
  205. }
  206. }
  207. </style>