index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="生产报工"
  8. @clickLeft="back"
  9. >
  10. </uni-nav-bar>
  11. <view class="search-box">
  12. 订单编号
  13. <uni-easyinput placeholder='请输入订单编号'
  14. @change='handleSearch'
  15. clearSize='36px'
  16. :clearable='true' v-model="searchKey"></uni-easyinput>
  17. <uni-icons type="scan" size="40px" @click='handleScan'></uni-icons>
  18. </view>
  19. <view class="report-view" >
  20. <card title='订单信息'>
  21. <view slot='right' class='detail-btn' @click="goOrder" v-if="orderInfo.aufnr">订单详情</view>
  22. <view class="card-list" :class="colorOpt[orderInfo.orderStatus]">
  23. <view class="list-item" v-for="(item, index) in msgList" :key='index'>
  24. <view class="label">{{item.label}}</view>
  25. <view>{{orderInfo[item.key]}}</view>
  26. </view>
  27. </view>
  28. </card>
  29. <processes :processesList='processesList' :canReport='canReport' :orderStatus='orderInfo.orderStatus' :orderId='orderInfo.orderId'/>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import card from "@/components/card/card"
  35. import processes from "./components/processes"
  36. import { getOrderInfo,getProcessRoute,getPostingDate } from "@/api/report/index"
  37. export default {
  38. components:{card, processes},
  39. data(){
  40. return {
  41. msgList:[
  42. { label: '状态', key: 'orderStatus'},
  43. { label: '生产订单', key: 'aufnr'},
  44. { label: '牌号', key: 'zph'},
  45. { label: '型号', key: 'zxh'},
  46. { label: '目标数量', key: 'gamng'},
  47. { label: '投料数量', key: 'feed'},
  48. { label: '收货数量', key: 'oneReciver'},
  49. { label: '在制品数量', key: 'workProgress'},
  50. ],
  51. searchKey:"",
  52. orderInfo:{},
  53. processesList:[],
  54. colorOpt:{
  55. '在制':'text-primary-deep',
  56. '关闭': 'text-danger'
  57. },
  58. canReport: false
  59. }
  60. },
  61. onShow(){
  62. this._getPostingDate()
  63. this.handleSearch()
  64. },
  65. onLoad(){
  66. const _this = this
  67. uni.$off("scancodedate"); // 每次进来先 移除全局自定义事件监听器
  68. uni.$on("scancodedate", function (data) {
  69. _this.searchKey = data.code.trim();
  70. _this.handleSearch()
  71. });
  72. uni.$on('chargeOff', function(){
  73. console.log('chargeOff');
  74. _this.handleSearch(false)
  75. })
  76. },
  77. onUnload() {
  78. uni.$off("scancodedate");
  79. },
  80. onHide() {
  81. uni.$off("scancodedate");
  82. },
  83. methods:{
  84. async _getPostingDate(){
  85. const res = await getPostingDate()
  86. console.log(res);
  87. this.canReport = res.prohibitReport === '0'
  88. },
  89. goOrder(){
  90. uni.navigateTo({
  91. url:"/pages/production/report/orderMsg?orderCode=" + this.orderInfo.aufnr
  92. })
  93. },
  94. async handleSearch(loading = true){
  95. setTimeout(async () => {
  96. if (!this.searchKey) {
  97. return
  98. }
  99. this.orderInfo = {}
  100. this.processesList =[]
  101. const res = await getOrderInfo(this.searchKey, false)
  102. if(res){
  103. this.orderInfo = res
  104. this._getProcessRoute(this.orderInfo.orderId, loading)
  105. }else{
  106. uni.showToast({
  107. title:'该生产订单不存在!',
  108. icon:'none'
  109. })
  110. }
  111. }, 100);
  112. },
  113. async _getProcessRoute(orderId, loading = true){
  114. const res = await getProcessRoute(orderId, loading)
  115. this.processesList = res
  116. },
  117. handleScan() {
  118. const _this = this;
  119. uni.scanCode({
  120. onlyFromCamera: true,
  121. success: function (res) {
  122. console.log("条码类型:" + res.scanType);
  123. console.log("条码内容:" + res.result);
  124. _this.searchKey = res.result.trim();
  125. _this.handleSearch()
  126. },
  127. });
  128. },
  129. },
  130. };
  131. </script>
  132. <style lang='scss' scoped>
  133. .mainBox{
  134. background: $page-bg;
  135. height: 100vh;
  136. overflow: auto;
  137. position: relative;
  138. }
  139. .search-box{
  140. position: fixed;
  141. top: 64px;
  142. background: $page-bg;
  143. left: 0;
  144. right: 0;
  145. z-index: 1;
  146. display: flex;
  147. justify-content: space-around;
  148. align-items: center;
  149. font-size: $uni-font-size-lg;
  150. padding: 10rpx;
  151. /deep/.uni-easyinput {
  152. width: 80%;
  153. flex-grow: .8;
  154. .uni-easyinput__placeholder-class{
  155. font-size: $uni-font-size-lg;
  156. }
  157. .uni-easyinput__content-input{
  158. height: 60rpx;
  159. }
  160. .uni-icons{
  161. font-size: $uni-font-size-lg;
  162. }
  163. }
  164. /deep/.uni-icons{
  165. // font-size: $uni-font-size-lg !important;
  166. }
  167. }
  168. .report-view{
  169. margin-top: 54px;
  170. padding: 16rpx;
  171. .detail-btn{
  172. color: $j-primary-border-green;
  173. font-size: $uni-font-size-lg;
  174. }
  175. }
  176. .card-list{
  177. padding: 30rpx;
  178. font-size: $uni-font-size-lg;
  179. .list-item{
  180. display: flex;
  181. justify-content: space-between;
  182. align-items: center;
  183. padding: 10rpx 0;
  184. }
  185. }
  186. </style>