index.vue 12 KB

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