oneJobBom.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  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">{{isFirstTask == 1 ? '物料重量' : '工序重量'}} {{it.extInfo.weightUnit}}</view>
  70. <view class="item ww25">报工重量{{it.extInfo.weightUnit}}</view>
  71. <view class="item ww25" v-if="isFirstTask == 1">质检结果
  72. </view>
  73. <view class="item ww25" :class="[ isFirstTask == 1 ? 'ww25' : 'ww50' ]">处置
  74. </view>
  75. </view>
  76. <view class="table">
  77. <view class="tr row rx-sc">
  78. <view class="item ww25">{{isFirstTask == 1 ? it.extInfo.weight : it.extInfo.newWeight }}
  79. </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="isFirstTask == 1">
  85. <view class="numerate">点击计算</view>
  86. </view>
  87. <view class="item" v-if='isDetails' :class="[ isFirstTask == 1 ? 'ww25' : 'ww50' ]">
  88. {{it.extInfo.taskName}}
  89. </view>
  90. <view class="item " v-else :class="[ isFirstTask == 1 ? 'ww25' : 'ww50' ]">
  91. <zxz-uni-data-select :localdata="stepsList" v-model="it.extInfo.taskId" dataValue='taskId'
  92. format='{taskTypeName}' dataKey="taskId" filterable
  93. @change=" e => it.extInfo.taskName = e.taskTypeName"
  94. :clear='false'></zxz-uni-data-select>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. <u-popup :show="show" mode='center' v-if='show' :closeOnClickOverlay='false'>
  101. <view class="popup_box">
  102. <view class="title_box rx-bc">
  103. <view class="name">工序计算列表</view>
  104. <view class="btn_box rx-ec">
  105. <view class="btn" @click="handAddParam">新增</view>
  106. </view>
  107. </view>
  108. <view class="content_table2">
  109. <view class="head row rx-sc">
  110. <view class="item ww30">工序名称</view>
  111. <view class="item ww20">坯体密度</view>
  112. <view class="item ww20">密度系数</view>
  113. <view class="item ww20">重量</view>
  114. <view class="item ww10">操作</view>
  115. </view>
  116. <view class="table">
  117. <view class="tr row rx-sc" v-for="(it, idx) in paramList" :key='idx'>
  118. <view class="item rx-bc ww30">
  119. <zxz-uni-data-select :localdata="stepsList" v-model="it.taskId" dataValue='taskId'
  120. format='{taskTypeName}' dataKey="taskId" filterable
  121. @change=" e => it.taskName = e.taskTypeName" :clear='false'></zxz-uni-data-select>
  122. </view>
  123. <view class="item ww20 content_num">
  124. <input class="uni-input" v-model="it.billet" type="digit"
  125. @input="changeInp(it, idx)"></input>
  126. </view>
  127. <view class="item ww20 content_num">
  128. <input class="uni-input" v-model="it.density" type="digit"
  129. @input="changeInp(it, idx)"></input>
  130. </view>
  131. <view class="item ww20" v-if=" (idx == 0 || idx != paramList.length - 1)">
  132. > {{it.CVIWeight}} </view>
  133. <view class="item ww20" v-if=" paramList.length > 1 && idx == paramList.length - 1">
  134. ≥ {{it.CVIWeight }}
  135. </view>
  136. <view class="item ww10 rx-cc" @click="getDelete(idx)">
  137. <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20"
  138. color="#fa3534"></uni-icons>
  139. </view>
  140. </view>
  141. </view>
  142. <view class="formula_box">计算公式: 物料重量/坯体密度*密度系数 </view>
  143. <view class="rx-cc">
  144. <u-button size="small" class="u-reset-button" style="width: 300rpx;margin: 20rpx;"
  145. type="success" @click="paramSave">工序列表保存</u-button>
  146. </view>
  147. <view class="reportWeight rx-sc">
  148. 物料重量: {{weight}} ;
  149. 报工重量: {{reportWeight}}
  150. </view>
  151. </view>
  152. <view class="operate_box rx-sc">
  153. <u-button size="small" class="u-reset-button" @click="cancel">取消</u-button>
  154. <u-button size="small" class="u-reset-button" type="success" @click="save">确定</u-button>
  155. </view>
  156. </view>
  157. </u-popup>
  158. </view>
  159. </template>
  160. <script>
  161. import {
  162. getTaskInstanceList
  163. } from '@/api/pda/workOrder.js'
  164. import {
  165. saveParam,
  166. getComputeParam
  167. } from '@/api/pda/tangu.js'
  168. export default {
  169. props: {
  170. item: {
  171. type: Object,
  172. default: () => {}
  173. },
  174. list: {
  175. type: Array,
  176. default: () => []
  177. },
  178. isDetails: {
  179. type: Boolean,
  180. default: false
  181. }
  182. },
  183. watch: {
  184. },
  185. data() {
  186. return {
  187. taskTypeName: null,
  188. isFirstTask: null,
  189. stepsList: [],
  190. show: false,
  191. rowIt: [],
  192. paramList: [],
  193. paramObj: {},
  194. weight: 0,
  195. reportWeight: 0,
  196. resultObj: {},
  197. resultIdx: 0,
  198. }
  199. },
  200. created() {
  201. this.taskTypeName = this.item.currentTaskDiagram.taskTypeName
  202. this.isFirstTask = this.item.currentTaskDiagram.isFirstTask
  203. this.getSteps()
  204. this.getCompute()
  205. },
  206. methods: {
  207. getSteps() {
  208. getTaskInstanceList(this.item.workOrderId).then(res => {
  209. this.stepsList = res
  210. })
  211. },
  212. getCompute() {
  213. getComputeParam(this.item.workOrderId, this.item.currentTaskDiagram.taskId).then(res => {
  214. this.paramList = []
  215. this.paramList = res.paramList
  216. this.paramObj = res || {}
  217. })
  218. },
  219. handAddParam() {
  220. // billet: null,
  221. // density: null,
  222. // result: null,
  223. // PIPDensity: null,
  224. // volume: null,
  225. // coefficient: null
  226. if (this.isFirstTask == 1) {
  227. this.paramList.push({
  228. taskId: null,
  229. taskName: null,
  230. })
  231. }
  232. },
  233. getDelete(idx) {
  234. this.paramList.splice(idx, 1)
  235. },
  236. changeInp(item, index) {
  237. if (Number(item.billet) && Number(item.density)) {
  238. this.paramList[index].CVIWeight = (Number(this.weight) / item.billet * item.density).toFixed(2)
  239. }
  240. },
  241. paramSave() {
  242. if (this.isFirstTask == 1 && this.paramList.length > 0) {
  243. let bol
  244. let _i
  245. bol = this.paramList.every((e, i) => {
  246. _i = i + 1
  247. return e.taskId && e.billet && e.density
  248. })
  249. if (!bol) {
  250. uni.showToast({
  251. title: `请完善第${_i}计算数据`,
  252. icon: 'none'
  253. })
  254. return false
  255. }
  256. if (this.paramList.length < 1) {
  257. uni.showToast({
  258. title: `请输入二个以上计算数据`,
  259. icon: 'none'
  260. })
  261. return false
  262. }
  263. }
  264. let param = {}
  265. if (!Object.prototype.hasOwnProperty.call(this.paramObj, 'id')) {
  266. param = {
  267. paramList: this.paramList,
  268. workOrderId: this.item.workOrderId,
  269. taskId: this.item.currentTaskDiagram.taskId
  270. }
  271. } else {
  272. this.paramObj.paramList = this.paramList
  273. param = this.paramObj
  274. }
  275. saveParam(param).then(res => {
  276. uni.showToast({
  277. icon: 'none',
  278. title: '操作成功'
  279. })
  280. this.getCompute()
  281. })
  282. },
  283. openNumerate(row, idx) {
  284. if (!row.extInfo.reportWeight) {
  285. uni.showToast({
  286. icon: 'none',
  287. title: '请先输入报工重量'
  288. })
  289. return false
  290. }
  291. this.weight = row.extInfo.weight
  292. this.reportWeight = row.extInfo.reportWeight
  293. this.resultIdx = idx
  294. this.show = true
  295. },
  296. cancel() {
  297. this.show = false
  298. this.reportWeight = 0
  299. this.weight = 0
  300. },
  301. taskChange(e) {
  302. console.log(e)
  303. },
  304. save() {
  305. if (this.isFirstTask == 1) {
  306. this.resultObj = {}
  307. if (Number(this.reportWeight) < this.paramList[0].CVIWeight) {
  308. this.resultObj = this.stepsList[0]
  309. this.setDataSave()
  310. return false
  311. }
  312. if (Number(this.reportWeight) >= this.paramList[this.paramList.length - 1].CVIWeight) {
  313. this.resultObj = this.paramList[this.paramList.length - 1]
  314. this.setDataSave()
  315. return false
  316. }
  317. let _arr = JSON.parse(JSON.stringify(this.paramList))
  318. _arr = _arr.reverse()
  319. for (let i = 1; i < _arr.length; i++) {
  320. if (Number(this.reportWeight) > Number(_arr[i].CVIWeight)) {
  321. this.resultObj = _arr[i]
  322. break;
  323. }
  324. }
  325. this.setDataSave()
  326. }
  327. },
  328. setDataSave() {
  329. this.$set(this.list[this.resultIdx].extInfo, 'taskId', this.resultObj.taskId)
  330. this.$set(this.list[this.resultIdx].extInfo, 'density', this.resultObj.density)
  331. this.$set(this.list[this.resultIdx].extInfo, 'billet', this.resultObj.billet)
  332. this.$set(this.list[this.resultIdx].extInfo, 'taskName', this.resultObj.taskName)
  333. this.cancel()
  334. },
  335. }
  336. }
  337. </script>
  338. <style lang="scss" scoped>
  339. .title_box {
  340. margin-top: 20rpx;
  341. .name {
  342. font-size: 28rpx;
  343. font-style: normal;
  344. font-weight: 400;
  345. color: $theme-color;
  346. padding-left: 20rpx;
  347. position: relative;
  348. &:before {
  349. position: absolute;
  350. content: '';
  351. left: 0rpx;
  352. top: 0rpx;
  353. bottom: 0rpx;
  354. width: 4rpx;
  355. height: 28rpx;
  356. background: $theme-color;
  357. margin: auto;
  358. }
  359. }
  360. .btn_box {
  361. .btn {
  362. padding: 0 18rpx;
  363. height: 50rpx;
  364. line-height: 50rpx;
  365. background: $theme-color;
  366. font-size: 26rpx;
  367. font-style: normal;
  368. font-weight: 400;
  369. font-size: 24rpx;
  370. color: #fff;
  371. border-radius: 4rpx;
  372. margin-left: 24rpx;
  373. }
  374. }
  375. }
  376. .material {
  377. margin-top: 10rpx;
  378. .content_table {
  379. width: 100%;
  380. border: 2rpx solid $border-color;
  381. .item {
  382. display: flex;
  383. border-bottom: 2rpx solid $border-color;
  384. .lable {
  385. width: 132rpx;
  386. text-align: center;
  387. background-color: #F7F9FA;
  388. font-size: 26rpx;
  389. border-right: 2rpx solid $border-color;
  390. flex-shrink: 0;
  391. }
  392. .lable150 {
  393. width: 156rpx !important;
  394. font-size: 24rpx;
  395. }
  396. .lable190 {
  397. width: 190rpx !important;
  398. font-size: 24rpx;
  399. }
  400. .ww80 {
  401. width: 80rpx;
  402. }
  403. .content {
  404. width: 518rpx;
  405. min-height: 64rpx;
  406. font-size: 28rpx;
  407. line-height: 28rpx;
  408. font-style: normal;
  409. font-weight: 400;
  410. padding: 18rpx 8rpx;
  411. box-sizing: border-box;
  412. word-wrap: break-word;
  413. flex-grow: 1 !important;
  414. .unit {
  415. padding: 0 4rpx;
  416. font-size: 24rpx;
  417. color: #404446;
  418. }
  419. .penalize {
  420. width: 160rpx;
  421. line-height: 60rpx;
  422. background: $theme-color;
  423. font-size: 24rpx;
  424. text-align: center;
  425. color: #fff;
  426. }
  427. }
  428. .content_H {
  429. min-height: 92rpx;
  430. }
  431. .pd4 {
  432. padding: 4rpx 8rpx;
  433. }
  434. &:last-child {
  435. border-bottom: none;
  436. }
  437. }
  438. .ww55 {
  439. width: 55%;
  440. }
  441. .ww50 {
  442. width: 50%;
  443. }
  444. .ww45 {
  445. width: 45%;
  446. }
  447. }
  448. }
  449. .content_table2 {
  450. width: 100%;
  451. margin-top: 16rpx;
  452. .row {
  453. width: 100%;
  454. .item {
  455. color: #404446;
  456. font-size: 28rpx;
  457. padding-left: 12rpx;
  458. }
  459. .color157 {
  460. color: $theme-color;
  461. }
  462. .ww30 {
  463. width: 30%;
  464. }
  465. .ww20 {
  466. width: 20%;
  467. }
  468. .ww15 {
  469. width: 15%;
  470. }
  471. .ww25 {
  472. width: 25%;
  473. }
  474. .ww50 {
  475. width: 50%;
  476. }
  477. .ww10 {
  478. width: 10%;
  479. }
  480. }
  481. .head {
  482. height: 64rpx;
  483. background: #F7F9FA;
  484. border-top: 2rpx solid #E3E5E5;
  485. border-left: 2rpx solid #E3E5E5;
  486. .item {
  487. height: 64rpx;
  488. line-height: 64rpx;
  489. border-right: 2rpx solid #E3E5E5;
  490. box-sizing: border-box;
  491. font-size: 22rpx;
  492. }
  493. }
  494. .tr {
  495. border-top: 2rpx solid #E3E5E5;
  496. border-left: 2rpx solid #E3E5E5;
  497. .item {
  498. font-size: 24rpx;
  499. min-height: 74rpx;
  500. display: flex;
  501. align-items: center;
  502. border-right: 2rpx solid #E3E5E5;
  503. box-sizing: border-box;
  504. white-space: normal;
  505. word-break: break-all;
  506. }
  507. &:last-child {
  508. border-bottom: 2rpx solid #E3E5E5;
  509. }
  510. .numerate {
  511. font-size: 22rpx;
  512. color: $theme-color;
  513. }
  514. }
  515. }
  516. .content_num {
  517. display: flex;
  518. align-items: center;
  519. padding: 0 4rpx;
  520. /deep/ .uni-input-input {
  521. border: 2rpx solid #F0F8F2;
  522. background: #F0F8F2;
  523. color: $theme-color;
  524. }
  525. }
  526. .round {
  527. width: 32rpx;
  528. height: 32rpx;
  529. line-height: 32rpx;
  530. text-align: center;
  531. border-radius: 50%;
  532. background: $theme-color;
  533. font-size: 24rpx;
  534. font-style: normal;
  535. font-weight: 400;
  536. color: #fff;
  537. margin-right: 18rpx;
  538. }
  539. .popup_box {
  540. width: 94vw;
  541. padding: 16rpx 12rpx;
  542. box-sizing: border-box;
  543. }
  544. .operate_box {
  545. margin-top: 32rpx;
  546. padding: 10rpx 100rpx;
  547. /deep/ .u-button {
  548. width: 160rpx;
  549. }
  550. }
  551. .formula_box {
  552. font-size: 24rpx;
  553. font-style: normal;
  554. font-weight: 400;
  555. margin-top: 12rpx;
  556. }
  557. .reportWeight {
  558. font-size: 24rpx;
  559. font-style: normal;
  560. font-weight: 400;
  561. margin-top: 30rpx;
  562. text {
  563. color: $theme-color;
  564. }
  565. }
  566. </style>