oneJobBom.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  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 " v-for="(it, idx) in list" :key="idx">
  7. <view class="content_table">
  8. <view class="item rx-sc">
  9. <view class="rx">
  10. <view class="lable lable190 rx-cc ">
  11. <view class="round">{{idx + 1}}</view>物料编码
  12. </view>
  13. <view class="content rx-sc">
  14. <view>{{it.code}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="item rx-sc">
  19. <view class="rx">
  20. <view class="lable lable150 rx-cc ">名称</view>
  21. <view class="content rx-sc">
  22. <view>{{it.name}}</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-sc">
  30. <view>{{it.modelType}}</view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="item rx-sc">
  35. <view class="rx ww50 ">
  36. <view class="lable lable150 rx-cc ">物料代号</view>
  37. <view class="content content_num">
  38. <view v-if='isDetails'>{{it.extInfo.materielCode }}</view>
  39. <input class="uni-input" v-else v-model="it.extInfo.materielCode"></input>
  40. </view>
  41. </view>
  42. <view class="rx ww50">
  43. <view class="lable lable150 rx-cc ">客户代号</view>
  44. <view class="content content_num">
  45. <view v-if='isDetails'>{{it.extInfo.clientCode }}</view>
  46. <input class="uni-input" v-else v-model="it.extInfo.clientCode"></input>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="item rx-sc">
  51. <view class="rx ww50 ">
  52. <view class="lable lable150 rx-cc ">刻码</view>
  53. <view class="content content_num ">
  54. <view v-if='isDetails'>{{it.extInfo.engrave }}</view>
  55. <input class="uni-input" v-else v-model="it.extInfo.engrave"></input>
  56. </view>
  57. </view>
  58. <view class="rx ww50">
  59. <view class="lable lable150 rx-cc ">位置</view>
  60. <view class="content content_num">
  61. <view v-if='isDetails'>{{it.extInfo.position }}</view>
  62. <input class="uni-input" v-else v-model="it.extInfo.position"></input>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="content_table2">
  68. <view class="head row rx-sc">
  69. <view class="item ww25">物料重量Kg</view>
  70. <view class="item ww25">报工重量kg</view>
  71. <view class="item ww25">质检结果</view>
  72. <view class="item ww25">处置</view>
  73. </view>
  74. <view class="table">
  75. <view class="tr row rx-sc">
  76. <view class="item ww25">{{it.extInfo.weight}}</view>
  77. <view class="item ww25 content_num">
  78. <view v-if='isDetails'>{{it.extInfo.reportWeight }}</view>
  79. <input class="uni-input" v-else v-model="it.extInfo.reportWeight"></input>
  80. </view>
  81. <view class="item ww25" @click="openNumerate(it, idx)">
  82. <view class="numerate">点击计算</view>
  83. </view>
  84. <view class="item ww25">
  85. {{it.extInfo.taskName }}
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <u-popup :show="show" mode='center' v-if='show' :closeOnClickOverlay='false'>
  92. <view class="popup_box">
  93. <view class="content_table2">
  94. <view class="head row rx-sc">
  95. <view class="item ww25">物料重量Kg</view>
  96. <view class="item ww25">坯体密度</view>
  97. <view class="item ww30">产品密度系数</view>
  98. <view class="item ww20">标准</view>
  99. </view>
  100. <view class="table">
  101. <view class="tr row rx-sc" v-for="(item, index) in rowIt" :key='index'>
  102. <view class="item ww25 rx-bc">
  103. <view>{{item.taskName}}</view>
  104. <view style="margin-right: 12rpx;">{{item.weight}}</view>
  105. </view>
  106. <view class="item ww25 content_num">
  107. <input class="uni-input" v-model="item.billet" type="digit"
  108. @input="changeInp(item, index)"></input>
  109. </view>
  110. <view class="item ww30 content_num">
  111. <input class="uni-input" v-model="item.density" type="digit"
  112. @input="changeInp(item, index)"></input>
  113. </view>
  114. <view class="item ww20">
  115. {{item.result}}
  116. </view>
  117. </view>
  118. </view>
  119. <view class="reportWeight">报工重量: {{reportWeight}}</view>
  120. </view>
  121. <view class="operate_box rx-sc">
  122. <u-button size="small" class="u-reset-button" @click="cancel">取消</u-button>
  123. <u-button size="small" class="u-reset-button" type="success" @click="save">确定</u-button>
  124. </view>
  125. </view>
  126. </u-popup>
  127. </view>
  128. </template>
  129. <script>
  130. import {
  131. getTaskInstanceList
  132. } from '@/api/pda/workOrder.js'
  133. export default {
  134. props: {
  135. item: {
  136. type: Object,
  137. default: () => {}
  138. },
  139. list: {
  140. type: Array,
  141. default: () => []
  142. },
  143. isDetails: {
  144. type: Boolean,
  145. default: false
  146. }
  147. },
  148. watch: {
  149. },
  150. data() {
  151. return {
  152. classificationList: [],
  153. stepsList: [],
  154. positionList: [{
  155. id: '1',
  156. name: '内'
  157. },
  158. {
  159. id: '2',
  160. name: '中'
  161. },
  162. {
  163. id: '1',
  164. name: '外'
  165. }
  166. ],
  167. inspectionList: [{
  168. id: '1',
  169. name: '合格'
  170. },
  171. {
  172. id: '2',
  173. name: '不合格'
  174. },
  175. ],
  176. show: false,
  177. rowIt: [],
  178. reportWeight: 0,
  179. }
  180. },
  181. created() {
  182. this.getSteps()
  183. },
  184. methods: {
  185. getSteps() {
  186. getTaskInstanceList(this.item.workOrderId).then(res => {
  187. this.stepsList = res
  188. })
  189. },
  190. openNumerate(row, idx) {
  191. if (!row.extInfo.reportWeight) {
  192. uni.showToast({
  193. icon: 'none',
  194. title: '请先输入报工重量'
  195. })
  196. return false
  197. }
  198. this.reportWeight = row.extInfo.reportWeight
  199. if (this.isDetails) {
  200. this.rowIt = row.extInfo.calculate
  201. } else {
  202. this.rowIt = [{
  203. weight: row.extInfo.weight,
  204. billet: 0.45,
  205. density: 0.7,
  206. result: (Number(row.extInfo.weight) / 0.45 * 0.7).toFixed(2),
  207. taskName: 'PIP',
  208. taskCode: '1',
  209. idx
  210. },
  211. {
  212. weight: row.extInfo.weight,
  213. billet: 0.46,
  214. density: 1.1,
  215. result: (Number(row.extInfo.weight) / 0.6 * 1.1).toFixed(2),
  216. taskName: '粗车',
  217. taskCode: '2',
  218. idx
  219. },
  220. {
  221. weight: row.extInfo.weight,
  222. billet: 0.47,
  223. density: 1.6,
  224. result: (Number(row.extInfo.weight) / 0.47 * 1.6).toFixed(2),
  225. taskName: '高温',
  226. taskCode: '3',
  227. idx
  228. }
  229. ]
  230. }
  231. this.show = true
  232. },
  233. changeInp(item, index) {
  234. this.rowIt[index]['result'] = (Number(item.weight) / item.billet * item.density).toFixed(2)
  235. },
  236. cancel() {
  237. this.show = false
  238. this.rowIt = []
  239. this.reportWeight = 0
  240. },
  241. save() {
  242. let _idx = this.rowIt[0].idx
  243. let _taskCode = null
  244. let _taskName = null
  245. if (this.reportWeight >= this.rowIt[0].result && this.reportWeight < this.rowIt[1].result) {
  246. _taskCode = this.rowIt[0].taskCode
  247. _taskName = this.rowIt[0].taskName
  248. } else if (this.reportWeight >= this.rowIt[1].result && this.reportWeight < this.rowIt[2].result) {
  249. _taskCode = this.rowIt[1].taskCode
  250. _taskName = this.rowIt[1].taskName
  251. } else if (this.reportWeight >= this.rowIt[2].result) {
  252. _taskCode = this.rowIt[2].taskCode
  253. _taskName = this.rowIt[2].taskName
  254. }
  255. if (_taskCode) {
  256. let _taskId = null
  257. this.stepsList.forEach(e => {
  258. if (e.taskTypeName == _taskName) {
  259. _taskId = e.taskId
  260. }
  261. })
  262. if (_taskId == null) {
  263. uni.showToast({
  264. title: `工序匹配不到${_taskName}`,
  265. icon: 'none'
  266. })
  267. return false
  268. }
  269. this.list[_idx].extInfo.taskCode = _taskCode
  270. this.list[_idx].extInfo.taskName = _taskName
  271. this.list[_idx].extInfo.calculate = this.rowIt
  272. this.list[_idx].extInfo.taskId = _taskId
  273. }
  274. this.cancel()
  275. },
  276. }
  277. }
  278. </script>
  279. <style lang="scss" scoped>
  280. .title_box {
  281. margin-top: 20rpx;
  282. .name {
  283. font-size: 28rpx;
  284. font-style: normal;
  285. font-weight: 400;
  286. color: $theme-color;
  287. padding-left: 20rpx;
  288. position: relative;
  289. &:before {
  290. position: absolute;
  291. content: '';
  292. left: 0rpx;
  293. top: 0rpx;
  294. bottom: 0rpx;
  295. width: 4rpx;
  296. height: 28rpx;
  297. background: $theme-color;
  298. margin: auto;
  299. }
  300. }
  301. }
  302. .material {
  303. margin-top: 10rpx;
  304. .content_table {
  305. width: 100%;
  306. border: 2rpx solid $border-color;
  307. .item {
  308. display: flex;
  309. border-bottom: 2rpx solid $border-color;
  310. .lable {
  311. width: 132rpx;
  312. text-align: center;
  313. background-color: #F7F9FA;
  314. font-size: 26rpx;
  315. border-right: 2rpx solid $border-color;
  316. flex-shrink: 0;
  317. }
  318. .lable150 {
  319. width: 156rpx !important;
  320. font-size: 24rpx;
  321. }
  322. .lable190 {
  323. width: 190rpx !important;
  324. font-size: 24rpx;
  325. }
  326. .ww80 {
  327. width: 80rpx;
  328. }
  329. .content {
  330. width: 518rpx;
  331. min-height: 64rpx;
  332. font-size: 28rpx;
  333. line-height: 28rpx;
  334. font-style: normal;
  335. font-weight: 400;
  336. padding: 18rpx 8rpx;
  337. box-sizing: border-box;
  338. word-wrap: break-word;
  339. flex-grow: 1 !important;
  340. .unit {
  341. padding: 0 4rpx;
  342. font-size: 24rpx;
  343. color: #404446;
  344. }
  345. .penalize {
  346. width: 160rpx;
  347. line-height: 60rpx;
  348. background: $theme-color;
  349. font-size: 24rpx;
  350. text-align: center;
  351. color: #fff;
  352. }
  353. }
  354. .content_H {
  355. min-height: 92rpx;
  356. }
  357. .pd4 {
  358. padding: 4rpx 8rpx;
  359. }
  360. &:last-child {
  361. border-bottom: none;
  362. }
  363. }
  364. .ww55 {
  365. width: 55%;
  366. }
  367. .ww50 {
  368. width: 50%;
  369. }
  370. .ww45 {
  371. width: 45%;
  372. }
  373. }
  374. }
  375. .content_table2 {
  376. width: 100%;
  377. .row {
  378. width: 100%;
  379. .item {
  380. color: #404446;
  381. font-size: 28rpx;
  382. padding-left: 12rpx;
  383. }
  384. .color157 {
  385. color: $theme-color;
  386. }
  387. .ww20 {
  388. width: 20%;
  389. }
  390. .ww35 {
  391. width: 35%;
  392. }
  393. .ww25 {
  394. width: 25%;
  395. }
  396. .ww30 {
  397. width: 30%;
  398. }
  399. }
  400. .head {
  401. height: 64rpx;
  402. background: #F7F9FA;
  403. border-top: 2rpx solid #E3E5E5;
  404. border-left: 2rpx solid #E3E5E5;
  405. .item {
  406. height: 64rpx;
  407. line-height: 64rpx;
  408. border-right: 2rpx solid #E3E5E5;
  409. box-sizing: border-box;
  410. }
  411. }
  412. .tr {
  413. border-top: 2rpx solid #E3E5E5;
  414. border-left: 2rpx solid #E3E5E5;
  415. .item {
  416. font-size: 24rpx;
  417. min-height: 74rpx;
  418. display: flex;
  419. align-items: center;
  420. border-right: 2rpx solid #E3E5E5;
  421. box-sizing: border-box;
  422. white-space: normal;
  423. word-break: break-all;
  424. }
  425. &:last-child {
  426. border-bottom: 2rpx solid #E3E5E5;
  427. }
  428. .numerate {
  429. font-size: 22rpx;
  430. color: $theme-color;
  431. }
  432. }
  433. }
  434. .content_num {
  435. display: flex;
  436. align-items: center;
  437. padding: 0 4rpx;
  438. /deep/ .uni-input-input {
  439. border: 2rpx solid #F0F8F2;
  440. background: #F0F8F2;
  441. color: $theme-color;
  442. }
  443. }
  444. .round {
  445. width: 32rpx;
  446. height: 32rpx;
  447. line-height: 32rpx;
  448. text-align: center;
  449. border-radius: 50%;
  450. background: $theme-color;
  451. font-size: 24rpx;
  452. font-style: normal;
  453. font-weight: 400;
  454. color: #fff;
  455. margin-right: 18rpx;
  456. }
  457. .popup_box {
  458. width: 94vw;
  459. padding: 16rpx 12rpx;
  460. box-sizing: border-box;
  461. }
  462. .operate_box {
  463. margin-top: 32rpx;
  464. padding: 10rpx 100rpx;
  465. /deep/ .u-button {
  466. width: 160rpx;
  467. }
  468. }
  469. .reportWeight {
  470. font-size: 24rpx;
  471. font-style: normal;
  472. font-weight: 400;
  473. margin-top: 12rpx;
  474. }
  475. </style>