oneJobQualityBom.vue 16 KB

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