index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  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. skipTask
  126. } from '@/api/pda/workOrder.js'
  127. export default {
  128. components: {
  129. bottomOperate,
  130. stepsNav
  131. },
  132. data() {
  133. return {
  134. title: '',
  135. tabType: 1,
  136. id: null,
  137. stepsList: [],
  138. info: {},
  139. taskId: null,
  140. produceList: [],
  141. feedAllow: true,
  142. currentTaskId: null,
  143. currentTaskName: null,
  144. currentType: 1,
  145. controlReportMethod: null,
  146. }
  147. },
  148. onLoad(options) {
  149. this.title = options.title
  150. this.id = options.id
  151. uni.showLoading({
  152. title: '加载中'
  153. });
  154. },
  155. onShow() {
  156. this.getInfo()
  157. this.getSteps()
  158. this.produce() // 生产明细
  159. },
  160. methods: {
  161. scrolltolower() {},
  162. handTab(type) {
  163. if (type != this.tabType) {
  164. this.tabType = type
  165. }
  166. },
  167. getSteps() {
  168. getTaskInstanceList(this.id).then(res => {
  169. // for(let i = 0; i < res.length; i++) {
  170. // if(res[i].taskTypeName == '自然干燥' ||res[i].taskTypeName == '升温干燥') {
  171. // res[i - 1].btns = [ { name: '更换周转车', type: 'turnover'}]
  172. // }
  173. // }
  174. this.stepsList = res
  175. this.setTypeFn()
  176. })
  177. },
  178. getInfo() {
  179. workorderInfo(this.id).then(res => {
  180. console.log(res)
  181. this.info = res
  182. this.taskId = res.taskId
  183. this.setTypeFn()
  184. this.feedStatus()
  185. uni.hideLoading();
  186. }).catch(() => {
  187. uni.hideLoading();
  188. })
  189. },
  190. setTypeFn() {
  191. this.stepsList.length && this.stepsList.find(f => {
  192. let id = this.currentTaskId || this.taskId
  193. if (f.taskId == id) {
  194. this.currentType = f.type,
  195. this.controlReportMethod = f.controlReportMethod
  196. }
  197. })
  198. },
  199. feedStatus() {
  200. let taskId = this.currentTaskId || this.taskId
  201. checkStatus(this.id, taskId).then(res => {
  202. this.feedAllow = res
  203. })
  204. },
  205. selectStep(item) {
  206. this.currentTaskId = item.taskId
  207. this.currentTaskName = item.taskTypeName
  208. this.currentType = item.type
  209. this.controlReportMethod = item.controlReportMethod
  210. this.feedStatus()
  211. },
  212. operate(type, item) {
  213. if (this.info.outsourceStatus == 2) {
  214. uni.showToast({
  215. title: "工单在委外中",
  216. icon: "none",
  217. })
  218. return false
  219. }
  220. let url
  221. let taskId = this.currentTaskId || this.taskId
  222. let taskName = this.currentTaskName || this.info.taskName
  223. if (type == 'picking') {
  224. url = '/pages/pda/picking/details'
  225. let _arr = JSON.stringify([this.info.id])
  226. url += `?arr=${encodeURIComponent(_arr)}&taskId=${taskId}`
  227. uni.navigateTo({
  228. url
  229. })
  230. } else if (type == 'feeding') {
  231. if (this.feedAllow) {
  232. url = '/pages/pda/feeding/details'
  233. let _arr = JSON.stringify([this.info.id])
  234. url += `?arr=${encodeURIComponent(_arr)}&taskId=${taskId }&taskName=${taskName}`
  235. uni.navigateTo({
  236. url
  237. })
  238. } else {
  239. uni.showToast({
  240. title: "已投料,请先报工",
  241. icon: "none",
  242. })
  243. }
  244. } else if (type == 'jobBooking') {
  245. if (!this.feedAllow) {
  246. url = '/pages/pda/jobBooking/index/index'
  247. url += `?id=${this.info.id}&taskId=${taskId }&taskName=${taskName}&taskType=${this.currentType}`
  248. uni.navigateTo({
  249. url
  250. })
  251. } else {
  252. uni.showToast({
  253. title: "请先投料",
  254. icon: "none",
  255. })
  256. }
  257. } else if (type == 'turnover') {
  258. url = '/pages/pda/turnover/index/index'
  259. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  260. uni.navigateTo({
  261. url
  262. })
  263. } else if (type == 'qualityTurnover') {
  264. url = '/pages/pda/turnover/index/quality'
  265. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  266. uni.navigateTo({
  267. url
  268. })
  269. } else if (type == 'sample') {
  270. url = '/pages/pda/sample/index/index'
  271. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  272. uni.navigateTo({
  273. url
  274. })
  275. } else if (type == 'sampleJob') {
  276. url = '/pages/pda/sample/index/jobBooking'
  277. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  278. uni.navigateTo({
  279. url
  280. })
  281. } else if (type == 'inspection') {
  282. url = '/pages/pda/sample/inspection/index'
  283. url +=
  284. `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}&inspectionId=${item.id}&inspectionName=${item.name}`
  285. uni.navigateTo({
  286. url
  287. })
  288. } else if (type == 'inspectionJob') {
  289. url = '/pages/pda/sample/inspection/job'
  290. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  291. uni.navigateTo({
  292. url
  293. })
  294. } else if (type == 'warehousing') {
  295. url = '/pages/pda/warehousing/index'
  296. url += `?workOrderId=${this.info.id}&taskId=${taskId}`
  297. uni.navigateTo({
  298. url
  299. })
  300. } else if (type == 'skip') {
  301. uni.showModal({
  302. title: '提示',
  303. content: `是否跳过${taskName}工序!`,
  304. confirmText: '确认', //这块是确定按钮的文字
  305. success: rr => {
  306. if (rr.confirm) {
  307. let param = {
  308. taskId: this.currentTaskId || this.taskId,
  309. workOrderId: this.id
  310. }
  311. skipTask(param).then(res => {
  312. console.log(res)
  313. })
  314. } else {
  315. }
  316. }
  317. })
  318. }
  319. },
  320. produce() {
  321. produceDetail(this.id).then(res => {
  322. this.produceList = res.produceDetail
  323. })
  324. },
  325. handleDetails() {
  326. let taskId = this.currentTaskId || this.taskId
  327. let taskName = this.currentTaskName || this.info.taskName
  328. let url = '/pages/pda/workOrder/index/details'
  329. url += `?id=${this.info.id}&taskId=${taskId }&taskName=${taskName}&taskType=${this.currentType}`
  330. uni.navigateTo({
  331. url
  332. })
  333. },
  334. }
  335. }
  336. </script>
  337. <style lang="scss" scoped>
  338. .content-box {
  339. height: 100vh;
  340. overflow: hidden;
  341. display: flex;
  342. flex-direction: column;
  343. background-color: $page-bg;
  344. }
  345. .top-wrapper {
  346. background-color: #fff;
  347. display: flex;
  348. width: 750rpx;
  349. background: #fff;
  350. align-items: center;
  351. }
  352. .tab_box {
  353. width: 100%;
  354. height: 68rpx;
  355. .tab_item {
  356. height: 68rpx;
  357. line-height: 68rpx;
  358. padding: 0 20rpx;
  359. font-size: 32rpx;
  360. color: #979C9E;
  361. }
  362. .active {
  363. box-sizing: border-box;
  364. border-bottom: 6rpx solid $theme-color;
  365. color: $theme-color;
  366. }
  367. }
  368. .list_box {
  369. flex: 1;
  370. overflow: hidden;
  371. padding: 4rpx 0;
  372. .u-list {
  373. height: 100% !important;
  374. }
  375. .item_list {
  376. width: 100%;
  377. height: 80rpx;
  378. box-sizing: border-box;
  379. padding: 0 32rpx;
  380. font-size: 32rpx;
  381. color: #979C9E;
  382. font-weight: 400;
  383. border-bottom: 1rpx solid #E3E5E5;
  384. .lable {
  385. color: #090A0A;
  386. font-weight: 500;
  387. }
  388. }
  389. .detail-list {
  390. line-height: 80rpx;
  391. .name {
  392. color: #090A0A;
  393. font-size: 32rpx;
  394. font-weight: 600;
  395. padding: 0 32rpx;
  396. box-sizing: border-box;
  397. border-bottom: 1rpx solid #E3E5E5;
  398. }
  399. .list {
  400. padding: 0 32rpx;
  401. box-sizing: border-box;
  402. border-bottom: 1rpx solid #E3E5E5;
  403. .title {
  404. font-weight: 400;
  405. color: #090A0A;
  406. }
  407. .icon {
  408. width: 36rpx;
  409. height: 36rpx;
  410. margin-right: 8rpx;
  411. }
  412. .arrow_right2 {
  413. width: 12rpx;
  414. height: 24rpx;
  415. margin-left: 8rpx;
  416. }
  417. }
  418. }
  419. }
  420. .bottom-wrapper {}
  421. .search_btn {
  422. width: 240rpx;
  423. height: 70rpx;
  424. line-height: 70rpx;
  425. padding: 0 24rpx;
  426. background: $theme-color;
  427. font-size: 32rpx;
  428. color: #fff;
  429. margin: 0;
  430. margin-left: 26rpx;
  431. }
  432. </style>