index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  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.batchNo }}</text>
  35. </view>
  36. <view class="item_list rx-bc">
  37. <text class="lable">产品名称</text>
  38. <text>{{ info.productName }}</text>
  39. </view>
  40. <view class="item_list rx-bc">
  41. <text class="lable">牌号</text>
  42. <text>{{ info.brandNo }}</text>
  43. </view>
  44. <view class="item_list rx-bc">
  45. <text class="lable">型号</text>
  46. <text>{{info.model}}</text>
  47. </view>
  48. <view class="item_list rx-bc">
  49. <text class="lable">要求生产数量</text>
  50. <text>{{info.formingNum }} {{info.unit}} </text>
  51. </view>
  52. <view class="item_list rx-bc">
  53. <text class="lable">要求生产重量</text>
  54. <text>{{ info.formingWeight }} {{info.weightUnit}}</text>
  55. </view>
  56. <view class="item_list rx-bc">
  57. <text class="lable">报工类型</text>
  58. <text>{{info.singleReport == 1 ? '单个报工' : '批量报工'}}</text>
  59. </view>
  60. <view class="item_list rx-bc">
  61. <text class="lable">已完成生产数量</text>
  62. <text></text>
  63. </view>
  64. <view class="item_list rx-bc">
  65. <text class="lable">已完成生产重量</text>
  66. <text></text>
  67. </view>
  68. <view class="item_list rx-bc">
  69. <text class="lable">计划开始时间</text>
  70. <text>{{ info.planStartTime }}</text>
  71. </view>
  72. <view class="item_list rx-bc">
  73. <text class="lable">计划结束时间</text>
  74. <text>{{ info.planCompleteTime }}</text>
  75. </view>
  76. </u-list>
  77. <u-list @scrolltolower="scrolltolower" key="detail" v-if="tabType == 2">
  78. <view v-for="(item,index) in produceList" :key="index" class="detail-list">
  79. <view class="name">{{item.taskName}} <text v-if="index == 0" style="color: #157A2C; font-size: 32rpx;"> (首工序)</text> </view>
  80. <view class="list rx-bc" @click="handDetails(item)">
  81. <view class="title rx-sc" >
  82. <image class="icon" src="~@/static/pda/layers.svg"></image>
  83. 待投料数量
  84. </view>
  85. <view class="rx-ec" v-if="item.firstTaskDetails.length > 0">
  86. <text style="color: #157A2C; font-size: 24rpx;"> 明细</text>
  87. <image class="arrow_right2" src="~@/static/pda/arrow_right2.svg"></image>
  88. </view>
  89. <view class="rx-ec" v-else>
  90. {{item.waitFeedNum}}
  91. <image class="arrow_right2" src="~@/static/pda/arrow_right2.svg"></image>
  92. </view>
  93. </view>
  94. <view class="list rx-bc" @click="handDetails(item)">
  95. <view class="title rx-sc">
  96. <image class="icon" src="~@/static/pda/check-square.svg"></image>
  97. 已投料数量
  98. </view>
  99. <view class="rx-ec" v-if="item.firstTaskDetails.length > 0">
  100. <text style="color: #157A2C; font-size: 24rpx;"> 明细</text>
  101. <image class="arrow_right2" src="~@/static/pda/arrow_right2.svg"></image>
  102. </view>
  103. <view class="rx-ec" v-else>
  104. {{item.feedNum}}
  105. <image class="arrow_right2" src="~@/static/pda/arrow_right2.svg"></image>
  106. </view>
  107. </view>
  108. <view class="list rx-bc">
  109. <view class="title rx-sc">
  110. <image class="icon" src="~@/static/pda/target.svg"></image>
  111. 已报工数量
  112. </view>
  113. <view class="rx-ec">
  114. {{item.reportedNum}}
  115. <image class="arrow_right2" src="~@/static/pda/arrow_right2.svg"></image>
  116. </view>
  117. </view>
  118. </view>
  119. </u-list>
  120. <u-list @scrolltolower="scrolltolower" key="btnDeatils" v-if="tabType == 3">
  121. <view style="margin-top: 15px;">
  122. <button class="search_btn" @click="handleDetails">报工详情</button>
  123. </view>
  124. <view style="margin-top: 15px;">
  125. <button class="search_btn" @click="handleFeedDetails">投料详情</button>
  126. </view>
  127. </u-list>
  128. </view>
  129. <view class="bottom-wrapper">
  130. <bottomOperate @operate='operate' @refresh='refresh'
  131. :taskObj="{'currentTaskName': currentTaskName || info.taskName, 'currentTaskId': currentTaskId || info.taskId, 'workOrderId' : id , 'existOutsource': existOutsource }"
  132. :state='currentType' :gdStatus='info.status' :controlReportMethod='controlReportMethod'
  133. :stepsList="stepsList"></bottomOperate>
  134. </view>
  135. <productionDetailed ref="productionDetailedRef"> </productionDetailed>
  136. </view>
  137. </template>
  138. <script>
  139. import bottomOperate from '../../components/bottomOperate.vue'
  140. import stepsNav from '../../components/stepsNav.vue'
  141. import productionDetailed from './productionDetailed.vue'
  142. import {
  143. getTaskInstanceList,
  144. workorderInfo,
  145. produceDetail,
  146. checkStatus,
  147. skipTask
  148. } from '@/api/pda/workOrder.js'
  149. export default {
  150. components: {
  151. bottomOperate,
  152. stepsNav,
  153. productionDetailed
  154. },
  155. data() {
  156. return {
  157. title: '',
  158. tabType: 1,
  159. id: null,
  160. stepsList: [],
  161. info: {},
  162. taskId: null,
  163. produceList: [],
  164. feedAllow: true,
  165. currentTaskId: null,
  166. currentTaskName: null,
  167. currentType: 1,
  168. existOutsource: 0,
  169. controlReportMethod: null,
  170. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  171. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  172. }
  173. },
  174. onLoad(options) {
  175. this.title = options.title
  176. this.id = options.id
  177. uni.showLoading({
  178. title: '加载中'
  179. });
  180. },
  181. onShow() {
  182. this.getInfo()
  183. this.getSteps()
  184. this.produce() // 生产明细
  185. },
  186. methods: {
  187. scrolltolower() {},
  188. handTab(type) {
  189. if (type != this.tabType) {
  190. this.tabType = type
  191. }
  192. },
  193. getSteps() {
  194. getTaskInstanceList(this.id).then(res => {
  195. // for(let i = 0; i < res.length; i++) {
  196. // if(res[i].taskTypeName == '自然干燥' ||res[i].taskTypeName == '升温干燥') {
  197. // res[i - 1].btns = [ { name: '更换周转车', type: 'turnover'}]
  198. // }
  199. // }
  200. this.stepsList = res
  201. this.setTypeFn()
  202. })
  203. },
  204. refresh() {
  205. console.log(1)
  206. this.getInfo()
  207. },
  208. getInfo() {
  209. workorderInfo(this.id).then(res => {
  210. console.log(res)
  211. this.info = res
  212. this.taskId = res.taskId
  213. this.setTypeFn()
  214. this.feedStatus()
  215. uni.hideLoading();
  216. }).catch(() => {
  217. uni.hideLoading();
  218. })
  219. },
  220. setTypeFn() {
  221. this.stepsList.length && this.stepsList.find(f => {
  222. let id = this.currentTaskId || this.taskId
  223. if (f.taskId == id) {
  224. this.currentType = f.type,
  225. this.existOutsource = f.existOutsource
  226. this.controlReportMethod = f.controlReportMethod
  227. }
  228. })
  229. },
  230. feedStatus() {
  231. let taskId = this.currentTaskId || this.taskId
  232. checkStatus(this.id, taskId).then(res => {
  233. this.feedAllow = res
  234. })
  235. },
  236. selectStep(item) {
  237. this.currentTaskId = item.taskId
  238. this.currentTaskName = item.taskTypeName
  239. this.existOutsource = item.existOutsource
  240. this.currentType = item.type
  241. this.controlReportMethod = item.controlReportMethod
  242. this.feedStatus()
  243. },
  244. operate(type, item) {
  245. console.log(4444, type)
  246. // if (this.info.outsourceStatus == 2) {
  247. // uni.showToast({
  248. // title: "工单在委外中",
  249. // icon: "none",
  250. // })
  251. // return false
  252. // }
  253. if (this.info.status == 9) {
  254. uni.showToast({
  255. title: "工单在暂停中",
  256. icon: "none",
  257. })
  258. return false
  259. }
  260. if (this.info.status == 10) {
  261. uni.showToast({
  262. title: "工单已终止",
  263. icon: "none",
  264. })
  265. return false
  266. }
  267. let url
  268. let taskId = this.currentTaskId || this.taskId
  269. let taskName = this.currentTaskName || this.info.taskName
  270. if (type == 'picking') {
  271. url = '/pages/pda/picking/details'
  272. let _arr = JSON.stringify([this.info.id])
  273. url += `?arr=${encodeURIComponent(_arr)}&taskId=${taskId}`
  274. uni.navigateTo({
  275. url
  276. })
  277. } else if (type == 'feeding') {
  278. // if (this.feedAllow || this.clientEnvironmentId == 3) {
  279. // } else {
  280. // uni.showToast({
  281. // title: "已投料,请先报工",
  282. // icon: "none",
  283. // })
  284. // }
  285. url = '/pages/pda/feeding/details'
  286. let _arr = JSON.stringify([this.info.id])
  287. url += `?arr=${encodeURIComponent(_arr)}&taskId=${taskId }&taskName=${taskName}`
  288. uni.navigateTo({
  289. url
  290. })
  291. } else if (type == 'jobBooking') {
  292. // if (!this.feedAllow || this.clientEnvironmentId == 3) {
  293. // } else {
  294. // uni.showToast({
  295. // title: "请先投料",
  296. // icon: "none",
  297. // })
  298. // }
  299. url = '/pages/pda/jobBooking/index/index'
  300. url += `?id=${this.info.id}&taskId=${taskId }&taskName=${taskName}&taskType=${this.currentType}&isOutsource=${item.isOutsource}`
  301. uni.navigateTo({
  302. url
  303. })
  304. } else if (type == 'turnover') {
  305. url = '/pages/pda/turnover/index/index'
  306. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  307. uni.navigateTo({
  308. url
  309. })
  310. } else if (type == 'qualityTurnover') {
  311. url = '/pages/pda/turnover/index/quality'
  312. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  313. uni.navigateTo({
  314. url
  315. })
  316. } else if (type == 'sample') {
  317. url = '/pages/pda/sample/index/index'
  318. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  319. uni.navigateTo({
  320. url
  321. })
  322. } else if (type == 'sampleJob') {
  323. url = '/pages/pda/sample/index/jobBooking'
  324. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  325. uni.navigateTo({
  326. url
  327. })
  328. } else if (type == 'inspection') {
  329. url = '/pages/pda/sample/inspection/index'
  330. url +=
  331. `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  332. uni.navigateTo({
  333. url
  334. })
  335. } else if (type == 'inspectionJob') {
  336. url = '/pages/pda/sample/inspection/job'
  337. url += `?workOrderId=${this.info.id}&taskId=${taskId }&taskName=${taskName}`
  338. uni.navigateTo({
  339. url
  340. })
  341. } else if (type == 'warehousing') {
  342. url = '/pages/pda/warehousing/index'
  343. url += `?workOrderId=${this.info.id}&taskId=${taskId}`
  344. uni.navigateTo({
  345. url
  346. })
  347. } else if (type == 'skip') {
  348. uni.showModal({
  349. title: '提示',
  350. content: `是否跳过${taskName}工序!`,
  351. confirmText: '确认', //这块是确定按钮的文字
  352. success: rr => {
  353. if (rr.confirm) {
  354. let param = {
  355. taskId: this.currentTaskId || this.taskId,
  356. workOrderId: this.id
  357. }
  358. skipTask(param).then(res => {
  359. console.log(res)
  360. })
  361. } else {
  362. }
  363. }
  364. })
  365. } else if (type == 'outPicking') {
  366. url = '/pages/pda/picking/details'
  367. let _arr = JSON.stringify([this.info.id])
  368. url += `?arr=${encodeURIComponent(_arr)}&taskId=${taskId}&isOutsource=1`
  369. uni.navigateTo({
  370. url
  371. })
  372. }
  373. },
  374. produce() {
  375. produceDetail(this.id).then(res => {
  376. this.produceList = res.produceDetail
  377. })
  378. },
  379. handleDetails() {
  380. let taskId = this.currentTaskId || this.taskId
  381. let taskName = this.currentTaskName || this.info.taskName
  382. let url = '/pages/pda/workOrder/index/details'
  383. url += `?id=${this.info.id}&taskId=${taskId }&taskName=${taskName}&taskType=${this.currentType}`
  384. uni.navigateTo({
  385. url
  386. })
  387. },
  388. handleFeedDetails() {
  389. let taskId = this.currentTaskId || this.taskId
  390. let url = '/pages/pda/feeding/bill/index'
  391. url += `?id=${this.info.id}&taskId=${taskId}`
  392. uni.navigateTo({
  393. url
  394. })
  395. },
  396. handDetails(item) {
  397. if(this.clientEnvironmentId == 2 ) {
  398. if( item.firstTaskDetails.length > 0) {
  399. this.$refs.productionDetailedRef.open(item)
  400. } else {
  401. uni.showToast({
  402. title: "暂无明细",
  403. icon: "none",
  404. })
  405. }
  406. }
  407. }
  408. }
  409. }
  410. </script>
  411. <style lang="scss" scoped>
  412. .content-box {
  413. height: 100vh;
  414. overflow: hidden;
  415. display: flex;
  416. flex-direction: column;
  417. background-color: $page-bg;
  418. }
  419. .top-wrapper {
  420. background-color: #fff;
  421. display: flex;
  422. width: 750rpx;
  423. background: #fff;
  424. align-items: center;
  425. }
  426. .tab_box {
  427. width: 100%;
  428. height: 68rpx;
  429. .tab_item {
  430. height: 68rpx;
  431. line-height: 68rpx;
  432. padding: 0 20rpx;
  433. font-size: 32rpx;
  434. color: #979C9E;
  435. }
  436. .active {
  437. box-sizing: border-box;
  438. border-bottom: 6rpx solid $theme-color;
  439. color: $theme-color;
  440. }
  441. }
  442. .list_box {
  443. flex: 1;
  444. overflow: hidden;
  445. padding: 4rpx 0;
  446. .u-list {
  447. height: 100% !important;
  448. }
  449. .item_list {
  450. width: 100%;
  451. height: 80rpx;
  452. box-sizing: border-box;
  453. padding: 0 32rpx;
  454. font-size: 32rpx;
  455. color: #979C9E;
  456. font-weight: 400;
  457. border-bottom: 1rpx solid #E3E5E5;
  458. .lable {
  459. color: #090A0A;
  460. font-weight: 500;
  461. }
  462. }
  463. .detail-list {
  464. line-height: 80rpx;
  465. .name {
  466. color: #090A0A;
  467. font-size: 32rpx;
  468. font-weight: 600;
  469. padding: 0 32rpx;
  470. box-sizing: border-box;
  471. border-bottom: 1rpx solid #E3E5E5;
  472. }
  473. .list {
  474. padding: 0 32rpx;
  475. box-sizing: border-box;
  476. border-bottom: 1rpx solid #E3E5E5;
  477. .title {
  478. font-weight: 400;
  479. color: #090A0A;
  480. }
  481. .icon {
  482. width: 36rpx;
  483. height: 36rpx;
  484. margin-right: 8rpx;
  485. }
  486. .arrow_right2 {
  487. width: 12rpx;
  488. height: 24rpx;
  489. margin-left: 8rpx;
  490. }
  491. }
  492. }
  493. }
  494. .bottom-wrapper {}
  495. .search_btn {
  496. width: 240rpx;
  497. height: 70rpx;
  498. line-height: 70rpx;
  499. padding: 0 24rpx;
  500. background: $theme-color;
  501. font-size: 32rpx;
  502. color: #fff;
  503. margin: 0;
  504. margin-left: 26rpx;
  505. }
  506. </style>