oneJobBom.vue 12 KB

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