index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  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.produceRoutingName }}</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.unit}} </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. <view class="item_list rx-bc">
  65. <text class="lable">计划结束时间</text>
  66. <text>{{ info.planCompleteTime }}</text>
  67. </view>
  68. </u-list>
  69. <u-list @scrolltolower="scrolltolower" key="detail" v-if="tabType == 2">
  70. <view v-for="(item,index) in produceList" :key="index" class="detail-list">
  71. <view class="name">{{item.taskName}}</view>
  72. <view class="list rx-bc">
  73. <view class="title rx-sc">
  74. <image class="icon" src="~@/static/pda/layers.svg"></image>
  75. 待投料数量
  76. </view>
  77. <view class="rx-ec">
  78. {{item.waitFeedNum}}
  79. <image class="arrow_right2" src="~@/static/pda/arrow_right2.svg"></image>
  80. </view>
  81. </view>
  82. <view class="list rx-bc">
  83. <view class="title rx-sc">
  84. <image class="icon" src="~@/static/pda/check-square.svg"></image>
  85. 生产中数量
  86. </view>
  87. <view class="rx-ec">
  88. 0
  89. <image class="arrow_right2" src="~@/static/pda/arrow_right2.svg"></image>
  90. </view>
  91. </view>
  92. <view class="list rx-bc">
  93. <view class="title rx-sc">
  94. <image class="icon" src="~@/static/pda/target.svg"></image>
  95. 待投料数量
  96. </view>
  97. <view class="rx-ec">
  98. {{item.waitFeedNum}}
  99. <image class="arrow_right2" src="~@/static/pda/arrow_right2.svg"></image>
  100. </view>
  101. </view>
  102. </view>
  103. </u-list>
  104. <u-list @scrolltolower="scrolltolower" key="btnDeatils" v-if="tabType == 3">
  105. <view style="margin-top: 15px;">
  106. <button class="search_btn" @click="handleDetails">报工详情</button>
  107. </view>
  108. </u-list>
  109. </view>
  110. <view class="bottom-wrapper">
  111. <bottomOperate @operate='operate'
  112. :taskObj="{'currentTaskName': currentTaskName || info.taskName, 'currentTaskId': currentTaskId || info.taskId, 'workOrderId' : id }"
  113. :state='currentType' :controlReportMethod='controlReportMethod'></bottomOperate>
  114. </view>
  115. </view>
  116. </template>
  117. <script>
  118. import bottomOperate from '../../components/bottomOperate.vue'
  119. import stepsNav from '../../components/stepsNav.vue'
  120. import {
  121. getTaskInstanceList,
  122. workorderInfo,
  123. produceDetail,
  124. checkStatus
  125. } from '@/api/pda/workOrder.js'
  126. export default {
  127. components: {
  128. bottomOperate,
  129. stepsNav
  130. },
  131. data() {
  132. return {
  133. title: '',
  134. tabType: 1,
  135. id: null,
  136. stepsList: [],
  137. info: {},
  138. taskId: null,
  139. produceList: [],
  140. feedAllow: true,
  141. currentTaskId: null,
  142. currentTaskName: null,
  143. currentType: 1,
  144. controlReportMethod: null,
  145. }
  146. },
  147. onLoad(options) {
  148. this.title = options.title
  149. this.id = options.id
  150. uni.showLoading({
  151. title: '加载中'
  152. });
  153. },
  154. onShow() {
  155. this.getInfo()
  156. this.getSteps()
  157. this.produce() // 生产明细
  158. },
  159. methods: {
  160. scrolltolower() {},
  161. handTab(type) {
  162. if (type != this.tabType) {
  163. this.tabType = type
  164. }
  165. },
  166. getSteps() {
  167. getTaskInstanceList(this.id).then(res => {
  168. // for(let i = 0; i < res.length; i++) {
  169. // if(res[i].taskTypeName == '自然干燥' ||res[i].taskTypeName == '升温干燥') {
  170. // res[i - 1].btns = [ { name: '更换周转车', type: 'turnover'}]
  171. // }
  172. // }
  173. this.stepsList = res
  174. this.setTypeFn()
  175. })
  176. },
  177. getInfo() {
  178. workorderInfo(this.id).then(res => {
  179. console.log(res)
  180. this.info = res
  181. this.taskId = res.taskId
  182. this.setTypeFn()
  183. this.feedStatus()
  184. uni.hideLoading();
  185. }).catch(() => {
  186. uni.hideLoading();
  187. })
  188. },
  189. setTypeFn() {
  190. this.stepsList.length && this.stepsList.find(f => {
  191. let id = this.currentTaskId || this.taskId
  192. if (f.taskId == id) {
  193. this.currentType = f.type,
  194. this.controlReportMethod = f.controlReportMethod
  195. }
  196. })
  197. },
  198. feedStatus() {
  199. let taskId = this.currentTaskId || this.taskId
  200. checkStatus(this.id, taskId).then(res => {
  201. this.feedAllow = res
  202. })
  203. },
  204. selectStep(item) {
  205. this.currentTaskId = item.taskId
  206. this.currentTaskName = item.taskTypeName
  207. this.currentType = item.type
  208. this.controlReportMethod = item.controlReportMethod
  209. this.feedStatus()
  210. },
  211. operate(type, item) {
  212. if (this.info.outsourceStatus == 2) {
  213. uni.showToast({
  214. title: "工单在委外中",
  215. icon: "none",
  216. })
  217. return false
  218. }
  219. let url
  220. let taskId = this.currentTaskId || this.taskId
  221. let taskName = this.currentTaskName || this.info.taskName
  222. if (type == 'picking') {
  223. url = '/pages/pda/picking/details'
  224. let _arr = JSON.stringify([this.info.id])
  225. url += `?arr=${encodeURIComponent(_arr)}&taskId=${taskId}`
  226. uni.navigateTo({
  227. url
  228. })
  229. } else if (type == 'feeding') {
  230. if (this.feedAllow) {
  231. url = '/pages/pda/feeding/details'
  232. let _arr = JSON.stringify([this.info.id])
  233. url += `?arr=${encodeURIComponent(_arr)}&taskId=${taskId }&taskName=${taskName}`
  234. uni.navigateTo({
  235. url
  236. })
  237. } else {
  238. uni.showToast({
  239. title: "已投料,请先报工",
  240. icon: "none",
  241. })
  242. }
  243. } else if (type == 'jobBooking') {
  244. if (!this.feedAllow) {
  245. url = '/pages/pda/jobBooking/index/index'
  246. url += `?id=${this.info.id}&taskId=${taskId }&taskName=${taskName}&taskType=${this.currentType}`
  247. uni.navigateTo({
  248. url
  249. })
  250. } else {
  251. uni.showToast({
  252. title: "请先投料",
  253. icon: "none",
  254. })
  255. }
  256. } else if (type == 'turnover') {
  257. url = '/pages/pda/turnover/index/index'
  258. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  259. uni.navigateTo({
  260. url
  261. })
  262. } else if (type == 'sample') {
  263. url = '/pages/pda/sample/index/index'
  264. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  265. uni.navigateTo({
  266. url
  267. })
  268. } else if (type == 'sampleJob') {
  269. url = '/pages/pda/sample/index/jobBooking'
  270. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  271. uni.navigateTo({
  272. url
  273. })
  274. } else if (type == 'inspection') {
  275. url = '/pages/pda/sample/inspection/index'
  276. url +=
  277. `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}&inspectionId=${item.id}&inspectionName=${item.name}`
  278. uni.navigateTo({
  279. url
  280. })
  281. } else if (type == 'inspectionJob') {
  282. url = '/pages/pda/sample/inspection/job'
  283. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  284. uni.navigateTo({
  285. url
  286. })
  287. } else if (type == 'warehousing') {
  288. url = '/pages/pda/warehousing/index'
  289. url += `?workOrderId=${this.info.id}&taskId=${taskId}`
  290. uni.navigateTo({
  291. url
  292. })
  293. }
  294. },
  295. produce() {
  296. produceDetail(this.id).then(res => {
  297. this.produceList = res.produceDetail
  298. })
  299. },
  300. handleDetails() {
  301. let taskId = this.currentTaskId || this.taskId
  302. let taskName = this.currentTaskName || this.info.taskName
  303. let url = '/pages/pda/workOrder/index/details'
  304. url += `?id=${this.info.id}&taskId=${taskId }&taskName=${taskName}&taskType=${this.currentType}`
  305. uni.navigateTo({
  306. url
  307. })
  308. },
  309. }
  310. }
  311. </script>
  312. <style lang="scss" scoped>
  313. .content-box {
  314. height: 100vh;
  315. overflow: hidden;
  316. display: flex;
  317. flex-direction: column;
  318. background-color: $page-bg;
  319. }
  320. .top-wrapper {
  321. background-color: #fff;
  322. display: flex;
  323. width: 750rpx;
  324. background: #fff;
  325. align-items: center;
  326. }
  327. .tab_box {
  328. width: 100%;
  329. height: 68rpx;
  330. .tab_item {
  331. height: 68rpx;
  332. line-height: 68rpx;
  333. padding: 0 20rpx;
  334. font-size: 32rpx;
  335. color: #979C9E;
  336. }
  337. .active {
  338. box-sizing: border-box;
  339. border-bottom: 6rpx solid $theme-color;
  340. color: $theme-color;
  341. }
  342. }
  343. .list_box {
  344. flex: 1;
  345. overflow: hidden;
  346. padding: 4rpx 0;
  347. .u-list {
  348. height: 100% !important;
  349. }
  350. .item_list {
  351. width: 100%;
  352. height: 80rpx;
  353. box-sizing: border-box;
  354. padding: 0 32rpx;
  355. font-size: 32rpx;
  356. color: #979C9E;
  357. font-weight: 400;
  358. border-bottom: 1rpx solid #E3E5E5;
  359. .lable {
  360. color: #090A0A;
  361. font-weight: 500;
  362. }
  363. }
  364. .detail-list {
  365. line-height: 80rpx;
  366. .name {
  367. color: #090A0A;
  368. font-size: 32rpx;
  369. font-weight: 600;
  370. padding: 0 32rpx;
  371. box-sizing: border-box;
  372. border-bottom: 1rpx solid #E3E5E5;
  373. }
  374. .list {
  375. padding: 0 32rpx;
  376. box-sizing: border-box;
  377. border-bottom: 1rpx solid #E3E5E5;
  378. .title {
  379. font-weight: 400;
  380. color: #090A0A;
  381. }
  382. .icon {
  383. width: 36rpx;
  384. height: 36rpx;
  385. margin-right: 8rpx;
  386. }
  387. .arrow_right2 {
  388. width: 12rpx;
  389. height: 24rpx;
  390. margin-left: 8rpx;
  391. }
  392. }
  393. }
  394. }
  395. .bottom-wrapper {}
  396. .search_btn {
  397. width: 240rpx;
  398. height: 70rpx;
  399. line-height: 70rpx;
  400. padding: 0 24rpx;
  401. background: $theme-color;
  402. font-size: 32rpx;
  403. color: #fff;
  404. margin: 0;
  405. margin-left: 26rpx;
  406. }
  407. </style>