index.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  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. let id = this.currentTaskId || this.taskId
  187. if (f.taskId == id) {
  188. this.currentType = f.type
  189. }
  190. })
  191. },
  192. feedStatus() {
  193. let taskId = this.currentTaskId || this.taskId
  194. checkStatus(this.id, taskId).then(res => {
  195. this.feedAllow = res
  196. })
  197. },
  198. selectStep(item) {
  199. this.currentTaskId = item.taskId
  200. this.currentTaskName = item.taskTypeName
  201. this.currentType = item.type
  202. this.feedStatus()
  203. },
  204. operate(type) {
  205. let url
  206. let taskId = this.currentTaskId || this.taskId
  207. let taskName = this.currentTaskName || this.info.taskName
  208. if (type == 'picking') {
  209. url = '/pages/pda/picking/details'
  210. let _arr = JSON.stringify([this.info.id])
  211. url += `?arr=${encodeURIComponent(_arr)}&taskId=${taskId}`
  212. uni.navigateTo({
  213. url
  214. })
  215. } else if (type == 'feeding') {
  216. if (this.feedAllow) {
  217. url = '/pages/pda/feeding/details'
  218. let _arr = JSON.stringify([this.info.id])
  219. url += `?arr=${encodeURIComponent(_arr)}&taskId=${taskId }&taskName=${taskName}`
  220. uni.navigateTo({
  221. url
  222. })
  223. } else {
  224. uni.showToast({
  225. title: "已投料,请先报工",
  226. icon: "none",
  227. })
  228. }
  229. } else if (type == 'jobBooking') {
  230. if (!this.feedAllow) {
  231. url = '/pages/pda/jobBooking/index/index'
  232. url += `?id=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  233. uni.navigateTo({
  234. url
  235. })
  236. } else {
  237. uni.showToast({
  238. title: "请先投料",
  239. icon: "none",
  240. })
  241. }
  242. } else if (type == 'turnover') {
  243. url = '/pages/pda/turnover/index/index'
  244. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  245. uni.navigateTo({
  246. url
  247. })
  248. } else if (type == 'sample') {
  249. url = '/pages/pda/sample/index/index'
  250. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  251. uni.navigateTo({
  252. url
  253. })
  254. } else if (type == 'sampleJob') {
  255. url = '/pages/pda/sample/index/jobBooking'
  256. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  257. uni.navigateTo({
  258. url
  259. })
  260. } else if (type == 'inspection') {
  261. url = '/pages/pda/sample/inspection/index'
  262. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  263. uni.navigateTo({
  264. url
  265. })
  266. }
  267. },
  268. produce() {
  269. produceDetail(this.id).then(res => {
  270. this.produceList = res.produceDetail
  271. })
  272. },
  273. handleDetails() {
  274. let taskId = this.currentTaskId || this.taskId
  275. let taskName = this.currentTaskName || this.info.taskName
  276. let url = '/pages/pda/workOrder/index/details'
  277. url += `?id=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  278. uni.navigateTo({
  279. url
  280. })
  281. },
  282. }
  283. }
  284. </script>
  285. <style lang="scss" scoped>
  286. .content-box {
  287. height: 100vh;
  288. overflow: hidden;
  289. display: flex;
  290. flex-direction: column;
  291. background-color: $page-bg;
  292. }
  293. .top-wrapper {
  294. background-color: #fff;
  295. display: flex;
  296. width: 750rpx;
  297. background: #fff;
  298. align-items: center;
  299. }
  300. .tab_box {
  301. width: 100%;
  302. height: 68rpx;
  303. .tab_item {
  304. height: 68rpx;
  305. line-height: 68rpx;
  306. padding: 0 20rpx;
  307. font-size: 32rpx;
  308. color: #979C9E;
  309. }
  310. .active {
  311. box-sizing: border-box;
  312. border-bottom: 6rpx solid $theme-color;
  313. color: $theme-color;
  314. }
  315. }
  316. .list_box {
  317. flex: 1;
  318. overflow: hidden;
  319. padding: 4rpx 0;
  320. .u-list {
  321. height: 100% !important;
  322. }
  323. .item_list {
  324. width: 100%;
  325. height: 80rpx;
  326. box-sizing: border-box;
  327. padding: 0 32rpx;
  328. font-size: 32rpx;
  329. color: #979C9E;
  330. font-weight: 400;
  331. border-bottom: 1rpx solid #E3E5E5;
  332. .lable {
  333. color: #090A0A;
  334. font-weight: 500;
  335. }
  336. }
  337. .detail-list {
  338. line-height: 80rpx;
  339. .name {
  340. color: #090A0A;
  341. font-size: 32rpx;
  342. font-weight: 600;
  343. padding: 0 32rpx;
  344. box-sizing: border-box;
  345. border-bottom: 1rpx solid #E3E5E5;
  346. }
  347. .list {
  348. padding: 0 32rpx;
  349. box-sizing: border-box;
  350. border-bottom: 1rpx solid #E3E5E5;
  351. .title {
  352. font-weight: 400;
  353. color: #090A0A;
  354. }
  355. .icon {
  356. width: 36rpx;
  357. height: 36rpx;
  358. margin-right: 8rpx;
  359. }
  360. .arrow_right2 {
  361. width: 12rpx;
  362. height: 24rpx;
  363. margin-left: 8rpx;
  364. }
  365. }
  366. }
  367. }
  368. .bottom-wrapper {}
  369. .search_btn {
  370. width: 240rpx;
  371. height: 70rpx;
  372. line-height: 70rpx;
  373. padding: 0 24rpx;
  374. background: $theme-color;
  375. font-size: 32rpx;
  376. color: #fff;
  377. margin: 0;
  378. margin-left: 26rpx;
  379. }
  380. </style>