oneJobQualityBom.vue 15 KB

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