index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="mould-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>工单名称:</view>
  8. <view>{{item.taskName}}</view>
  9. </view>
  10. <view class="item-text flex-box">
  11. <view>工单编号:</view>
  12. <view>{{item.orderNum}}</view>
  13. </view>
  14. <view class="item-text flex-box">
  15. <view>工序名称:</view>
  16. <view style="width: calc(100% - 150rpx);">
  17. <uni-data-select
  18. v-model="item.processId"
  19. :localdata="productProcessData"
  20. @change="change"
  21. ></uni-data-select>
  22. </view>
  23. </view>
  24. <view class="item-text flex-box">
  25. <view>工单数量:</view>
  26. <view>{{item.orderAmounts || 0}}</view>
  27. </view>
  28. <!-- <view class="item-text flex-box">
  29. <view>剩余数量:</view>
  30. <view>{{Number(item.orderAmounts) - Number(item.productNum) || 0}}</view>
  31. </view> -->
  32. <view class="btn-box">
  33. <view class="btn-item" @click="reportingforwork(item)">
  34. <view>报工</view>
  35. </view>
  36. <!-- <view class="btn-item" >
  37. <view>换模</view>
  38. </view> -->
  39. </view>
  40. </view>
  41. </view>
  42. <empty v-else text="暂无数据"></empty>
  43. <view v-if="total !== 0 && dataList.length != 0" style="height: 60rpx;">
  44. <u-loadmore :status="status" />
  45. </view>
  46. <!-- 输入框示例 -->
  47. <uni-popup ref="inputDialog" type="dialog">
  48. <uni-popup-dialog ref="inputClose" mode="input" title="报工" v-model="popform.productNum"
  49. placeholder="请填写报工数量" @confirm="dialogInputConfirm">
  50. </uni-popup-dialog>
  51. </uni-popup>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. data() {
  57. return {
  58. // 请求传递的参数
  59. form:{
  60. current:1,
  61. size:10,
  62. orderStatus:1
  63. },
  64. // 列表数据
  65. dataList:[],
  66. total:0,
  67. status: 'loadmore',
  68. // 工序名称
  69. productProcessData:[],
  70. popform:{
  71. productNum:null
  72. }
  73. }
  74. },
  75. onShow() {
  76. this.productOrderListfun()
  77. this.productProcesslistfun()
  78. },
  79. onReachBottom() {
  80. this.status = 'loading'
  81. if (this.dataList.length < this.total) {
  82. this.page.current++
  83. this.productOrderListfun()
  84. } else {
  85. this.status = 'nomore'
  86. }
  87. },
  88. methods: {
  89. // 报工
  90. reportingforwork(item){
  91. if (!item.processId) {
  92. uni.showToast({
  93. title: '请先选择工序名称!',
  94. duration: 2000
  95. });
  96. return
  97. }
  98. this.popform.orderId = item.id
  99. this.popform.processId = item.processId
  100. this.popform.taskId = item.taskId
  101. this.$refs.inputDialog.open()
  102. },
  103. // 报工确认
  104. dialogInputConfirm(e){
  105. console.log(e,104);
  106. this.popform.productNum = e
  107. console.log(this.popform,107);
  108. this.$api.productOrderDetailAddNonautomatic(this.popform).then(res=>{
  109. uni.showToast({
  110. title: '操作成功!',
  111. duration: 2000
  112. });
  113. setTimeout(()=> {
  114. this.dataList = []
  115. this.form.current = 1
  116. this.productOrderListfun()
  117. }, 2000);
  118. })
  119. },
  120. // 获取列表接口
  121. productOrderListfun(){
  122. uni.showLoading({
  123. title: '加载中',
  124. mask: true
  125. });
  126. this.$api.productOrderList(this.form).then(res=>{
  127. this.dataList = this.dataList.concat(res.rows)
  128. this.total = res.total
  129. if (this.dataList.length == res.total) {
  130. this.status = 'nomore'
  131. }
  132. uni.hideLoading();
  133. })
  134. },
  135. // 获取工序的下拉数据
  136. productProcesslistfun(){
  137. this.$api.productProcesslist().then(res=>{
  138. this.productProcessData = res.rows.map(item=>{
  139. return {
  140. value:item.id,
  141. text:item.processName
  142. }
  143. })
  144. })
  145. },
  146. // 工序的下拉回调
  147. change(e){
  148. console.log(e);
  149. // for(let res of this.productProcessData) {
  150. // console.log(res,139);
  151. // console.log(item.processName);
  152. // if (res.text == item.processName) {
  153. // item.processId = res.value
  154. // }
  155. // }
  156. },
  157. }
  158. }
  159. </script>
  160. <style lang="scss" scoped>
  161. .mould-page {
  162. .white-card {
  163. background-color: $uni-bg-color;
  164. }
  165. .list-box {
  166. padding: 0 20rpx;
  167. color: $uni-text-color-list; // #666
  168. .list-item {
  169. background-color: $uni-bg-color; // #ffffff
  170. padding: 20rpx;
  171. border-radius: 20rpx;
  172. margin-top: 28rpx;
  173. .item-text {
  174. margin-top: 10rpx;
  175. font-size: 30rpx;
  176. padding: 10rpx 0;
  177. border-bottom: 1rpx solid rgba(0, 0, 0, .1);
  178. &:last-child {
  179. border: 0;
  180. }
  181. }
  182. .flex-box {
  183. display: flex;
  184. align-items: center;
  185. justify-content: space-between;
  186. }
  187. }
  188. .btn-box {
  189. display: flex;
  190. justify-content: flex-end;
  191. margin-top: 20rpx;
  192. .btn-item {
  193. width: 175rpx;
  194. height: 50rpx;
  195. line-height: 50rpx;
  196. text-align: center;
  197. border-radius: 24rpx;
  198. margin-left: 20rpx;
  199. border: 1px solid #3d6df0;
  200. color: #fff;
  201. background: #3d6df0;
  202. }
  203. }
  204. }
  205. }
  206. </style>