index.vue 15 KB

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