index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="title" background-color="#157A2C"
  4. color="#fff" @clickLeft="back"></uni-nav-bar>
  5. <view class="top-wrapper cx">
  6. <stepsNav v-if='info.taskId && stepsList.length' :stepsList="stepsList" :taskId="info.taskId"
  7. @selectStep='selectStep'></stepsNav>
  8. <view class="tab_box rx-sc">
  9. <view class="tab_item" :class="{active: tabType == 1}" @click="handTab(1)">基本信息</view>
  10. <view class="tab_item" :class="{active: tabType == 2}" @click="handTab(2)">生产明细</view>
  11. <view class="tab_item" :class="{active: tabType == 3}" @click="handTab(3)">详情</view>
  12. </view>
  13. </view>
  14. <view class="list_box">
  15. <u-list @scrolltolower="scrolltolower" key="info" v-if="tabType == 1">
  16. <view class="item_list rx-bc">
  17. <text class="lable">生产工单号</text>
  18. <text>{{ info.code }}</text>
  19. </view>
  20. <view class="item_list rx-bc">
  21. <text class="lable">计划编号</text>
  22. <text>{{ info.productionPlanCode }}</text>
  23. </view>
  24. <view class="item_list rx-bc">
  25. <text class="lable">工艺路线版本</text>
  26. <text>{{ info.routingVersion }}</text>
  27. </view>
  28. <view class="item_list rx-bc">
  29. <text class="lable">产品编码</text>
  30. <text> {{ info.productCode }}</text>
  31. </view>
  32. <view class="item_list rx-bc">
  33. <text class="lable">产品名称</text>
  34. <text>{{ info.productName }}</text>
  35. </view>
  36. <view class="item_list rx-bc">
  37. <text class="lable">牌号</text>
  38. <text>{{ info.brandNo }}</text>
  39. </view>
  40. <view class="item_list rx-bc">
  41. <text class="lable">型号</text>
  42. <text>{{info.model}}</text>
  43. </view>
  44. <view class="item_list rx-bc">
  45. <text class="lable">要求生产数量</text>
  46. <text>{{info.formingNum }} {{info.weightUnit}} </text>
  47. </view>
  48. <view class="item_list rx-bc">
  49. <text class="lable">要求生产重量</text>
  50. <text>{{ info.formingWeight }} {{info.weightUnit}}</text>
  51. </view>
  52. <view class="item_list rx-bc">
  53. <text class="lable">已完成生产数量</text>
  54. <text></text>
  55. </view>
  56. <view class="item_list rx-bc">
  57. <text class="lable">已完成生产重量</text>
  58. <text></text>
  59. </view>
  60. <view class="item_list rx-bc">
  61. <text class="lable">计划开始时间</text>
  62. <text>{{ info.planStartTime }}</text>
  63. </view>
  64. </u-list>
  65. <u-list @scrolltolower="scrolltolower" key="detail" v-if="tabType == 2">
  66. <view v-for="(item,index) in produceList" :key="index" class="detail-list">
  67. <view class="name">{{item.taskName}}</view>
  68. <view class="list rx-bc">
  69. <view class="title rx-sc">
  70. <image class="icon" src="~@/static/pda/layers.svg"></image>
  71. 待投料数量
  72. </view>
  73. <view class="rx-ec">
  74. {{item.waitFeedNum}}
  75. <image class="arrow_right2" src="~@/static/pda/arrow_right2.svg"></image>
  76. </view>
  77. </view>
  78. <view class="list rx-bc">
  79. <view class="title rx-sc">
  80. <image class="icon" src="~@/static/pda/check-square.svg"></image>
  81. 生产中数量
  82. </view>
  83. <view class="rx-ec">
  84. 0
  85. <image class="arrow_right2" src="~@/static/pda/arrow_right2.svg"></image>
  86. </view>
  87. </view>
  88. <view class="list rx-bc">
  89. <view class="title rx-sc">
  90. <image class="icon" src="~@/static/pda/target.svg"></image>
  91. 待投料数量
  92. </view>
  93. <view class="rx-ec">
  94. {{item.waitFeedNum}}
  95. <image class="arrow_right2" src="~@/static/pda/arrow_right2.svg"></image>
  96. </view>
  97. </view>
  98. </view>
  99. </u-list>
  100. <u-list @scrolltolower="scrolltolower" key="btnDeatils" v-if="tabType == 3">
  101. <view style="margin-top: 15px;">
  102. <button class="search_btn" @click="handleDetails">报工详情</button>
  103. </view>
  104. </u-list>
  105. </view>
  106. <view class="bottom-wrapper">
  107. <bottomOperate @operate='operate' :state='currentType'></bottomOperate>
  108. </view>
  109. </view>
  110. </template>
  111. <script>
  112. import bottomOperate from '../../components/bottomOperate.vue'
  113. import stepsNav from '../../components/stepsNav.vue'
  114. import {
  115. getTaskInstanceList,
  116. workorderInfo,
  117. produceDetail,
  118. checkStatus
  119. } from '@/api/pda/workOrder.js'
  120. import {
  121. noop
  122. } from 'lodash'
  123. export default {
  124. components: {
  125. bottomOperate,
  126. stepsNav
  127. },
  128. data() {
  129. return {
  130. title: '',
  131. tabType: 1,
  132. id: null,
  133. stepsList: [],
  134. info: {},
  135. taskId: null,
  136. produceList: [],
  137. feedAllow: true,
  138. currentTaskId: null,
  139. currentTaskName: null,
  140. currentType: 1,
  141. }
  142. },
  143. onLoad(options) {
  144. this.title = options.title
  145. this.id = options.id
  146. uni.showLoading({
  147. title: '加载中'
  148. });
  149. },
  150. onShow() {
  151. this.getSteps()
  152. this.getInfo()
  153. this.produce()
  154. },
  155. methods: {
  156. scrolltolower() {},
  157. handTab(type) {
  158. if (type != this.tabType) {
  159. this.tabType = type
  160. }
  161. },
  162. getSteps() {
  163. getTaskInstanceList(this.id).then(res => {
  164. // for(let i = 0; i < res.length; i++) {
  165. // if(res[i].taskTypeName == '自然干燥' ||res[i].taskTypeName == '升温干燥') {
  166. // res[i - 1].btns = [ { name: '更换周转车', type: 'turnover'}]
  167. // }
  168. // }
  169. this.stepsList = res
  170. this.setTypeFn()
  171. })
  172. },
  173. getInfo() {
  174. workorderInfo(this.id).then(res => {
  175. this.info = res
  176. this.taskId = res.taskId
  177. this.setTypeFn()
  178. this.feedStatus()
  179. uni.hideLoading();
  180. }).catch(() => {
  181. uni.hideLoading();
  182. })
  183. },
  184. setTypeFn() {
  185. this.stepsList.length && this.stepsList.find(f => {
  186. if (f.taskId == this.taskId) {
  187. this.currentType = f.type
  188. }
  189. })
  190. },
  191. feedStatus() {
  192. let taskId = this.currentTaskId || this.taskId
  193. checkStatus(this.id, taskId).then(res => {
  194. this.feedAllow = res
  195. })
  196. },
  197. selectStep(item) {
  198. this.currentTaskId = item.taskId
  199. this.currentTaskName = item.taskTypeName
  200. this.currentType = item.type
  201. this.feedStatus()
  202. },
  203. operate(type) {
  204. let url
  205. let taskId = this.currentTaskId || this.taskId
  206. let taskName = this.currentTaskName || this.info.taskName
  207. if (type == 'picking') {
  208. url = '/pages/pda/picking/details'
  209. let _arr = JSON.stringify([this.info.id])
  210. url += `?arr=${encodeURIComponent(_arr)}&taskId=${taskId}`
  211. uni.navigateTo({
  212. url
  213. })
  214. } else if (type == 'feeding') {
  215. if (this.feedAllow) {
  216. url = '/pages/pda/feeding/details'
  217. let _arr = JSON.stringify([this.info.id])
  218. url += `?arr=${encodeURIComponent(_arr)}&taskId=${taskId }&taskName=${taskName}`
  219. uni.navigateTo({
  220. url
  221. })
  222. } else {
  223. uni.showToast({
  224. title: "已投料,请先报工",
  225. icon: "none",
  226. })
  227. }
  228. } else if (type == 'jobBooking') {
  229. if (!this.feedAllow) {
  230. url = '/pages/pda/jobBooking/index/index'
  231. url += `?id=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  232. uni.navigateTo({
  233. url
  234. })
  235. } else {
  236. uni.showToast({
  237. title: "请先投料",
  238. icon: "none",
  239. })
  240. }
  241. } else if (type == 'turnover') {
  242. url = '/pages/pda/turnover/index/index'
  243. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  244. uni.navigateTo({
  245. url
  246. })
  247. } else if (type == 'sample') {
  248. url = '/pages/pda/sample/index/index'
  249. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  250. uni.navigateTo({
  251. url
  252. })
  253. }
  254. },
  255. produce() {
  256. produceDetail(this.id).then(res => {
  257. this.produceList = res.produceDetail
  258. })
  259. },
  260. handleDetails() {
  261. let taskId = this.currentTaskId || this.taskId
  262. let taskName = this.currentTaskName || this.info.taskName
  263. let url = '/pages/pda/workOrder/index/details'
  264. url += `?id=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  265. uni.navigateTo({
  266. url
  267. })
  268. },
  269. }
  270. }
  271. </script>
  272. <style lang="scss" scoped>
  273. .content-box {
  274. height: 100vh;
  275. overflow: hidden;
  276. display: flex;
  277. flex-direction: column;
  278. background-color: $page-bg;
  279. }
  280. .top-wrapper {
  281. background-color: #fff;
  282. display: flex;
  283. width: 750rpx;
  284. background: #fff;
  285. align-items: center;
  286. }
  287. .tab_box {
  288. width: 100%;
  289. height: 68rpx;
  290. .tab_item {
  291. height: 68rpx;
  292. line-height: 68rpx;
  293. padding: 0 20rpx;
  294. font-size: 32rpx;
  295. color: #979C9E;
  296. }
  297. .active {
  298. box-sizing: border-box;
  299. border-bottom: 6rpx solid $theme-color;
  300. color: $theme-color;
  301. }
  302. }
  303. .list_box {
  304. flex: 1;
  305. overflow: hidden;
  306. padding: 4rpx 0;
  307. .u-list {
  308. height: 100% !important;
  309. }
  310. .item_list {
  311. width: 100%;
  312. height: 80rpx;
  313. box-sizing: border-box;
  314. padding: 0 32rpx;
  315. font-size: 32rpx;
  316. color: #979C9E;
  317. font-weight: 400;
  318. border-bottom: 1rpx solid #E3E5E5;
  319. .lable {
  320. color: #090A0A;
  321. font-weight: 500;
  322. }
  323. }
  324. .detail-list {
  325. line-height: 80rpx;
  326. .name {
  327. color: #090A0A;
  328. font-size: 32rpx;
  329. font-weight: 600;
  330. padding: 0 32rpx;
  331. box-sizing: border-box;
  332. border-bottom: 1rpx solid #E3E5E5;
  333. }
  334. .list {
  335. padding: 0 32rpx;
  336. box-sizing: border-box;
  337. border-bottom: 1rpx solid #E3E5E5;
  338. .title {
  339. font-weight: 400;
  340. color: #090A0A;
  341. }
  342. .icon {
  343. width: 36rpx;
  344. height: 36rpx;
  345. margin-right: 8rpx;
  346. }
  347. .arrow_right2 {
  348. width: 12rpx;
  349. height: 24rpx;
  350. margin-left: 8rpx;
  351. }
  352. }
  353. }
  354. }
  355. .bottom-wrapper {}
  356. .search_btn {
  357. width: 240rpx;
  358. height: 70rpx;
  359. line-height: 70rpx;
  360. padding: 0 24rpx;
  361. background: $theme-color;
  362. font-size: 32rpx;
  363. color: #fff;
  364. margin: 0;
  365. margin-left: 26rpx;
  366. }
  367. </style>