semiProductJobBomPL.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name"> 报工信息: ({{list.length || 0}})个</view>
  5. </view>
  6. <view :class="['material', it.extInfo.reportWeight && it.extInfo.reportWeight && 'materialBor']"
  7. v-for="(it, idx) in list" :key="it.id + idx">
  8. <view class="content_table">
  9. <view class="item rx-sc">
  10. <view class="rx">
  11. <view class="lable lable190 rx-cc " @click="getDelete2(idx)">
  12. <view class="round">{{idx + 1}}</view>
  13. <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="16"
  14. color="#fa3534"></uni-icons>
  15. 物料编码
  16. </view>
  17. <view class="content rx-bc">
  18. <view>{{it.code}} </view>
  19. <view class="tag_box"
  20. v-if="Object.prototype.hasOwnProperty.call(it, 'extInfo') && Object.prototype.hasOwnProperty.call(it.extInfo, 'productionTimes') && Object.prototype.hasOwnProperty.call(it.extInfo.productionTimes,item.currentTaskDiagram.taskId) ">
  21. {{ it.extInfo.productionTimes[item.currentTaskDiagram.taskId]}}
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="item rx-sc">
  27. <view class="rx">
  28. <view class="lable lable150 rx-cc ">名称</view>
  29. <view class="content rx-bc">
  30. <view>{{it.name}} <text v-if="[2, 23,9,28].includes(Number(it.rootCategoryLevelId))">
  31. ({{it.rootCategoryLevelId == 2 ? '在制品' : it.rootCategoryLevelId == 23 ? '半成品' : it.rootCategoryLevelId == 9 ? '产品' : it.rootCategoryLevelId == 28 ? '废品' : '' }})
  32. </text> </view>
  33. <view class="tag_box " v-if="it.isCache" style="margin-right: -36rpx;">缓</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="item rx-sc">
  38. <view class="rx">
  39. <view class="lable lable150 rx-cc ">型号</view>
  40. <view class="content rx-sc">
  41. <view>{{it.modelType}}</view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="item rx-sc">
  46. <view class="rx ww50">
  47. <view class="lable lable150 rx-cc ">设备</view>
  48. <view class="content rx-sc">
  49. <view>{{ it.deviceName || it.extInfo.deviceName }}</view>
  50. </view>
  51. </view>
  52. <view class="rx ww50">
  53. <view class="lable lable150 rx-cc ">炉次号</view>
  54. <view class="content content_num ">
  55. <view v-if='isDetails'>{{it.extInfo.heatNumber }}</view>
  56. <input class="uni-input" v-else v-model="it.extInfo.heatNumber"></input>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="item rx-sc">
  61. <view class="rx">
  62. <view class="lable lable190 rx-cc ">{{ it.extInfo.newWeight ? '上道工序总重量' : '物料总重量' }}(
  63. {{it.extInfo.weightUnit}})
  64. </view>
  65. <view class="content content_num rx-sc">
  66. <view v-if="it.extInfo.newWeight">{{it.extInfo.newWeight }}
  67. </view>
  68. <input v-else class="uni-input" size="mini" v-model="it.extInfo.weight"></input>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="item rx-sc">
  73. <view class="rx ww50">
  74. <view class="lable lable150 rx-cc ">投料数量</view>
  75. <view class="content content_num ">
  76. <view style="color:#157A2C;">{{it.feedQuantity }}</view>
  77. </view>
  78. </view>
  79. <view class="rx ww50">
  80. <view class="lable lable150 rx-cc ">投料类型</view>
  81. <view class="content rx-sc" style="color:#157A2C;">
  82. <view>批量投料</view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="content_table2">
  88. <view class="head row rx-sc">
  89. <view class="item ww25" style="font-size: 20rpx;">
  90. 合格品数量
  91. </view>
  92. <view class="item ww25">报工总重量/{{it.extInfo.weightUnit}} </view>
  93. <view class="item ww40 rx-bc">
  94. <text>处置</text>
  95. <image v-if='!isDetails' class="icon" @click="handAddListPL(it, idx)"
  96. src="~@/static/pda/add.svg" style="width: 46rpx;height: 46rpx;margin-right: 12rpx;"></image>
  97. </view>
  98. <view class="item ww10 ">
  99. 操作
  100. </view>
  101. </view>
  102. <view class="table">
  103. <view class="tr row rx-sc" v-for="(yy, yyIdx) in it.extInfo.batchReportInfo">
  104. <view class="item ww25 content_num">
  105. <view v-if='isDetails'>{{yy.allFeedQuantity }}</view>
  106. <input class="uni-input" v-else v-model="yy.allFeedQuantity"
  107. @input="blurNum($event,idx, yyIdx)" type='number'></input>
  108. </view>
  109. <view class="item ww25 content_num">
  110. <view v-if='isDetails'>{{yy.allReportWeight }}</view>
  111. <input class="uni-input" v-else v-model="yy.allReportWeight" type='digit'></input>
  112. </view>
  113. <view class="item ww40" v-if='isDetails'>
  114. {{ yy.taskName}}
  115. </view>
  116. <view class="item ww40" v-else>
  117. <zxz-uni-data-select :localdata="stepsList" v-model="yy.taskId" dataValue='taskId'
  118. format='{taskTypeName}' dataKey="taskId" filterable
  119. @change=" e => yy.taskName = e.taskTypeName" :clear='false'></zxz-uni-data-select>
  120. </view>
  121. <view class="item ww10">
  122. <uni-icons v-if='!isDetails' custom-prefix="iconfont" type="icon-shanchu" size="16"
  123. @click="handDel3(idx, yyIdx)" color="#fa3534"></uni-icons>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. <view class="content_table2">
  129. <view class="head row rx-sc">
  130. <view class="item ww15" style="font-size: 20rpx;">
  131. 不合格数
  132. </view>
  133. <view class="item ww15" style="font-size: 20rpx;">
  134. 重量
  135. </view>
  136. <view class="item ww25">类型</view>
  137. <view class="item ww35 rx-bc">
  138. <text>处置/原因</text>
  139. <image v-if='!isDetails' class="icon" @click="handAddListPL4(it, idx)"
  140. src="~@/static/pda/add.svg" style="width: 46rpx;height: 46rpx;margin-right: 12rpx;"></image>
  141. </view>
  142. <view class="item ww10 ">
  143. 操作
  144. </view>
  145. </view>
  146. <view class="table">
  147. <view class="tr row rx-sc" v-for="(yy, yyIdx) in it.extInfo.notBatchReportInfo" :key="'not'+ idx + yyIdx">
  148. <view class="item ww15 content_num">
  149. <view v-if='isDetails'>{{yy.allFeedQuantity }}</view>
  150. <input class="uni-input" v-else v-model="yy.allFeedQuantity"
  151. @input="blurNum2($event,idx, yyIdx)" type='number'></input>
  152. </view>
  153. <view class="item ww15 content_num">
  154. <view v-if='isDetails'>{{yy.allReportWeight }}</view>
  155. <input class="uni-input" v-else v-model="yy.allReportWeight"
  156. type='number'></input>
  157. </view>
  158. <view class="item ww25 content_num">
  159. <zxz-uni-data-select :localdata="notTypeList" v-model="yy.notType" dataValue='code'
  160. format='{name}' dataKey="code" filterable :disabled="isDetails" @change="handLoad()"
  161. :clear='false'></zxz-uni-data-select>
  162. </view>
  163. <view class="item ww35" v-if='isDetails'>
  164. {{ yy.notType == 5 ? yy.taskName : yy.notReason}}
  165. </view>
  166. <view class="item ww35 content_num" v-if="!isDetails && yy.notType == 5">
  167. <zxz-uni-data-select :localdata="stepsList" v-model="yy.taskId" dataValue='taskId'
  168. format='{taskTypeName}' dataKey="taskId" filterable
  169. @change=" e => yy.taskName = e.taskTypeName" :clear='false'></zxz-uni-data-select>
  170. </view>
  171. <view class="item ww35 content_num" v-if="!isDetails && yy.notType != 5">
  172. <input class="uni-input" v-if="yy.notType != 5 " v-model="yy.notReason"></input>
  173. </view>
  174. <view class="item ww10">
  175. <uni-icons v-if='!isDetails' custom-prefix="iconfont" type="icon-shanchu" size="16"
  176. @click="handDel4(idx, yyIdx)" color="#fa3534"></uni-icons>
  177. </view>
  178. </view>
  179. </view>
  180. </view>
  181. </view>
  182. </view>
  183. </template>
  184. <script>
  185. import {
  186. getTaskInstanceList
  187. } from '@/api/pda/workOrder.js'
  188. export default {
  189. props: {
  190. item: {
  191. type: Object,
  192. default: () => {}
  193. },
  194. list: {
  195. type: Array,
  196. default: () => []
  197. },
  198. isDetails: {
  199. type: Boolean,
  200. default: false
  201. },
  202. equipmentList: {
  203. type: Array,
  204. default: () => []
  205. },
  206. },
  207. watch: {
  208. equipmentList: {
  209. immediate: true,
  210. deep: true,
  211. handler(newVal) {
  212. this.deviceList = newVal
  213. this.changeHeatNumber()
  214. }
  215. },
  216. },
  217. data() {
  218. return {
  219. stepsList: [],
  220. deviceList: [],
  221. notTypeList: [{
  222. code: "1",
  223. name: '返工'
  224. },
  225. {
  226. code: "2",
  227. name: '返修'
  228. },
  229. {
  230. code: "3",
  231. name: '报废'
  232. },
  233. {
  234. code: '4',
  235. name: '降级使用'
  236. },
  237. {
  238. code: "5",
  239. name: '让步接收'
  240. }
  241. ]
  242. }
  243. },
  244. created() {
  245. this.getSteps()
  246. console.log(this.list)
  247. },
  248. methods: {
  249. getSteps() {
  250. getTaskInstanceList(this.item.workOrderId).then(res => {
  251. if (this.item.singleReport == 1) {
  252. this.stepsList = res
  253. } else {
  254. this.stepsList = res.filter(f => f.type != 6);
  255. }
  256. })
  257. },
  258. handAddListPL(it, idx) {
  259. this.list[idx].extInfo.batchReportInfo.push({
  260. allFeedQuantity: '',
  261. allReportWeight: '',
  262. taskId: '',
  263. taskName: ''
  264. })
  265. this.$forceUpdate()
  266. },
  267. handDel3(idx, yyIdx) {
  268. this.list[idx].extInfo.batchReportInfo.splice(yyIdx, 1)
  269. },
  270. blurNum(event, idx, yyIdx) {
  271. let value = event.target.value;
  272. value = value.replace(/\./g, '');
  273. this.$set(this.list[idx].extInfo.batchReportInfo[yyIdx], 'allFeedQuantity', value);
  274. let count = 0
  275. this.list[idx].extInfo.batchReportInfo.forEach(m => {
  276. count = count + Number(m.allFeedQuantity || 0)
  277. })
  278. let count2 = 0
  279. this.list[idx].extInfo.notBatchReportInfo.forEach(m => {
  280. count2 = count2 + Number(m.allFeedQuantity || 0)
  281. })
  282. if (Number(count + count2) > this.list[idx].feedQuantity) {
  283. this.$set(this.list[idx].extInfo.batchReportInfo[yyIdx], 'allFeedQuantity', 0)
  284. this.$forceUpdate()
  285. uni.showToast({
  286. title: `投料数不能大于投料数量`,
  287. icon: 'none'
  288. })
  289. }
  290. },
  291. blurNum2(event, idx, yyIdx) {
  292. let value = event.target.value;
  293. value = value.replace(/\./g, '');
  294. this.$set(this.list[idx].extInfo.notBatchReportInfo[yyIdx], 'allFeedQuantity', value);
  295. let count = 0
  296. this.list[idx].extInfo.batchReportInfo.forEach(m => {
  297. count = count + Number(m.allFeedQuantity || 0)
  298. })
  299. let count2 = 0
  300. this.list[idx].extInfo.notBatchReportInfo.forEach(m => {
  301. count2 = count2 + Number(m.allFeedQuantity || 0)
  302. })
  303. if (Number(count + count2) > this.list[idx].feedQuantity) {
  304. this.$set(this.list[idx].extInfo.notBatchReportInfo[yyIdx], 'allFeedQuantity', 0)
  305. this.$forceUpdate()
  306. uni.showToast({
  307. title: `投料数不能大于投料数量`,
  308. icon: 'none'
  309. })
  310. }
  311. },
  312. getDelete2(idx) {
  313. uni.showModal({
  314. title: '删除',
  315. content: '是否确实删除此物料!',
  316. confirmText: '确认', //这块是确定按钮的文字
  317. success: rr => {
  318. if (rr.confirm) {
  319. this.list.splice(idx, 1)
  320. }
  321. }
  322. })
  323. },
  324. handAddListPL4(it, idx) {
  325. this.list[idx].extInfo.notBatchReportInfo.push({
  326. allFeedQuantity: '',
  327. allReportWeight: '',
  328. notType: '',
  329. taskId: '',
  330. taskName: '',
  331. notReason: ''
  332. })
  333. this.$forceUpdate()
  334. },
  335. handDel4(idx, yyIdx) {
  336. this.list[idx].extInfo.notBatchReportInfo.splice(yyIdx, 1)
  337. this.$forceUpdate()
  338. },
  339. handLoad() {
  340. this.$forceUpdate()
  341. },
  342. changeHeatNumber() {
  343. this.deviceList.forEach(f => {
  344. this.list.forEach(o => {
  345. if (o.deviceId && f.instanceId == o.deviceId && this.deviceList.length > 1) {
  346. o.extInfo.heatNumber = f.extInfo.heatNumber
  347. this.$forceUpdate()
  348. } else if (this.deviceList.length == 1) {
  349. o.extInfo.heatNumber = this.deviceList[0].extInfo.heatNumber
  350. this.$forceUpdate()
  351. }
  352. })
  353. })
  354. },
  355. toFixedFn(weight, num) {
  356. let total = Number(weight) * Number(num)
  357. return total.toFixed(2)
  358. }
  359. }
  360. }
  361. </script>
  362. <style lang="scss" scoped>
  363. .title_box {
  364. margin-top: 20rpx;
  365. .name {
  366. font-size: 28rpx;
  367. font-style: normal;
  368. font-weight: 400;
  369. color: $theme-color;
  370. padding-left: 20rpx;
  371. position: relative;
  372. &:before {
  373. position: absolute;
  374. content: '';
  375. left: 0rpx;
  376. top: 0rpx;
  377. bottom: 0rpx;
  378. width: 4rpx;
  379. height: 28rpx;
  380. background: $theme-color;
  381. margin: auto;
  382. }
  383. }
  384. .btn_box {
  385. .btn {
  386. padding: 0 18rpx;
  387. height: 50rpx;
  388. line-height: 50rpx;
  389. background: $theme-color;
  390. font-size: 26rpx;
  391. font-style: normal;
  392. font-weight: 400;
  393. font-size: 24rpx;
  394. color: #fff;
  395. border-radius: 4rpx;
  396. margin-left: 24rpx;
  397. }
  398. }
  399. }
  400. .material {
  401. margin-top: 16rpx;
  402. border: 1rpx solid transparent;
  403. .content_table {
  404. width: 100%;
  405. border: 2rpx solid $border-color;
  406. box-sizing: border-box;
  407. .item {
  408. display: flex;
  409. border-bottom: 2rpx solid $border-color;
  410. .lable {
  411. width: 132rpx;
  412. text-align: center;
  413. background-color: #F7F9FA;
  414. font-size: 26rpx;
  415. border-right: 2rpx solid $border-color;
  416. flex-shrink: 0;
  417. }
  418. .lable150 {
  419. width: 156rpx !important;
  420. font-size: 24rpx;
  421. }
  422. .lable190 {
  423. width: 230rpx !important;
  424. font-size: 24rpx;
  425. }
  426. .ww80 {
  427. width: 80rpx;
  428. }
  429. .content {
  430. width: 500rpx;
  431. min-height: 64rpx;
  432. font-size: 28rpx;
  433. line-height: 28rpx;
  434. font-style: normal;
  435. font-weight: 400;
  436. padding: 18rpx 8rpx;
  437. box-sizing: border-box;
  438. word-wrap: break-word;
  439. flex-grow: 1 !important;
  440. .unit {
  441. padding: 0 4rpx;
  442. font-size: 24rpx;
  443. color: #404446;
  444. }
  445. .penalize {
  446. width: 160rpx;
  447. line-height: 60rpx;
  448. background: $theme-color;
  449. font-size: 24rpx;
  450. text-align: center;
  451. color: #fff;
  452. }
  453. }
  454. .content_H {
  455. min-height: 92rpx;
  456. }
  457. .pd4 {
  458. padding: 4rpx 8rpx;
  459. }
  460. &:last-child {
  461. border-bottom: none;
  462. }
  463. }
  464. .ww55 {
  465. width: 55%;
  466. }
  467. .ww10 {
  468. width: 10%;
  469. }
  470. .ww40 {
  471. width: 40%;
  472. }
  473. .ww50 {
  474. width: 50%;
  475. }
  476. .ww45 {
  477. width: 45%;
  478. }
  479. .tag_box {
  480. padding: 2rpx 10rpx;
  481. margin-right: 12rpx;
  482. background: #E6A23C;
  483. font-size: 22rpx;
  484. color: #fff;
  485. border-radius: 4rpx;
  486. }
  487. }
  488. }
  489. .materialBor {
  490. border: 1rpx solid #157A2C
  491. }
  492. .content_table2 {
  493. width: 100%;
  494. .row {
  495. width: 100%;
  496. .item {
  497. color: #404446;
  498. font-size: 28rpx;
  499. padding-left: 12rpx;
  500. }
  501. .color157 {
  502. color: $theme-color;
  503. }
  504. .ww30 {
  505. width: 30%;
  506. }
  507. .ww20 {
  508. width: 20%;
  509. }
  510. .ww15 {
  511. width: 15%;
  512. }
  513. .ww25 {
  514. width: 25%;
  515. }
  516. .ww35 {
  517. width: 35%;
  518. }
  519. .ww50 {
  520. width: 50%;
  521. }
  522. .ww10 {
  523. width: 10%;
  524. }
  525. .ww40 {
  526. width: 40%;
  527. }
  528. }
  529. .head {
  530. height: 64rpx;
  531. background: #F7F9FA;
  532. // border-top: 2rpx solid #E3E5E5;
  533. border-left: 2rpx solid #E3E5E5;
  534. box-sizing: border-box;
  535. .item {
  536. height: 64rpx;
  537. line-height: 64rpx;
  538. border-right: 2rpx solid #E3E5E5;
  539. box-sizing: border-box;
  540. font-size: 22rpx;
  541. }
  542. }
  543. .tr {
  544. border-top: 2rpx solid #E3E5E5;
  545. border-left: 2rpx solid #E3E5E5;
  546. .item {
  547. font-size: 24rpx;
  548. min-height: 74rpx;
  549. display: flex;
  550. align-items: center;
  551. border-right: 2rpx solid #E3E5E5;
  552. box-sizing: border-box;
  553. white-space: normal;
  554. word-break: break-all;
  555. }
  556. &:last-child {
  557. border-bottom: 2rpx solid #E3E5E5;
  558. }
  559. .numerate {
  560. font-size: 22rpx;
  561. color: $theme-color;
  562. }
  563. }
  564. }
  565. .content_num {
  566. display: flex;
  567. align-items: center;
  568. padding: 0 4rpx;
  569. /deep/ .uni-input-input {
  570. border: 2rpx solid #F0F8F2;
  571. box-sizing: border-box;
  572. background: #F0F8F2;
  573. color: $theme-color;
  574. }
  575. }
  576. .round {
  577. width: 32rpx;
  578. height: 32rpx;
  579. line-height: 30rpx;
  580. text-align: center;
  581. border-radius: 50%;
  582. background: $theme-color;
  583. font-size: 24rpx;
  584. font-style: normal;
  585. font-weight: 400;
  586. color: #fff;
  587. margin-right: 10rpx;
  588. }
  589. </style>