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