index.vue 15 KB

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