jobBom.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name">报工信息</view>
  5. </view>
  6. <view class="material ">
  7. <view class="content_table">
  8. <view class="item rx-sc">
  9. <view class="rx ">
  10. <view class="lable lable220 rx-cc ">上道工序生产数量</view>
  11. <view class="content ">
  12. {{ item.formedNumLast}}
  13. </view>
  14. </view>
  15. </view>
  16. <view class="item rx-sc">
  17. <view class="rx ww55 ">
  18. <view class="lable lable150 rx-cc ">要求生产数量</view>
  19. <view class="content rx-sc">
  20. <view>{{item.formingNum}}</view>
  21. <view class="unit">{{item.unit}}</view>
  22. </view>
  23. </view>
  24. <view class="rx ww45">
  25. <view class="lable rx-cc ww80">重量</view>
  26. <view class="content content_num">
  27. <view>{{item.formingWeight}}</view>
  28. <view class="unit">{{item.weightUnit}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="item rx-sc">
  33. <view class="rx ww55 ">
  34. <view class="lable lable150 rx-cc ">合格品数量</view>
  35. <view class="content content_num">
  36. <input class="uni-input" v-model="item.workReportInfo.formedNum" :disabled="isDetails"
  37. @input="blurNum" type="digit"></input>
  38. <view class="unit">{{item.unit}}</view>
  39. </view>
  40. </view>
  41. <view class="rx ww45">
  42. <view class="lable rx-cc ww80">重量</view>
  43. <view class="content content_num">
  44. <input class="uni-input" v-model="item.workReportInfo.formedWeight" type="digit"
  45. :disabled="isDetails"></input>
  46. <view class="unit">{{item.weightUnit}}</view>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="item rx-sc" v-for="(not,notIndex) in notFormedList" :key='notIndex'>
  51. <view class="rx ww55 ">
  52. <view class="lable lable150 rx-cc ">不合格数量</view>
  53. <view class="content content_num">
  54. <input class="uni-input" v-model="not.notFormedNum" type="digit"
  55. :disabled="isDetails" @input="changeNum"></input>
  56. <view class="unit">{{item.unit}}</view>
  57. </view>
  58. </view>
  59. <view class="rx ww45">
  60. <view class="lable rx-cc ww80">重量</view>
  61. <view class="content content_num">
  62. <input class="uni-input" v-model="not.notFormedWeight" type="digit"
  63. :disabled="isDetails"></input>
  64. <view class="unit">{{item.weightUnit}}</view>
  65. <view class="penalize" v-if='!isDetails'
  66. :style="{ background: not.warehouseId ? '#FFA07A' : ''}" @click="penalize">处置</view>
  67. <view class="penalize" v-if='isDetails'
  68. :style="{ background: not.warehouseId ? '#FFA07A' : ''}"
  69. @click="handleView(isDetails ? not.warehouseName : item.warehouseName)">查看</view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. export default {
  79. props: {
  80. item: {
  81. type: Object,
  82. default: () => {}
  83. },
  84. notFormed: {
  85. type: Array,
  86. default: () => []
  87. },
  88. isDetails: {
  89. type: Boolean,
  90. default: false
  91. },
  92. },
  93. watch: {
  94. notFormed: {
  95. immediate: true,
  96. deep: true,
  97. handler(newVal) {
  98. this.notFormedList = newVal
  99. }
  100. }
  101. },
  102. data() {
  103. return {
  104. notFormedList: []
  105. }
  106. },
  107. created() {
  108. if (this.isDetails) {
  109. this.notFormedList = this.notFormedList.map(m => {
  110. return {
  111. notFormedNum: Number(m.quantity),
  112. notFormedWeight: m.weight,
  113. ...m
  114. }
  115. })
  116. }
  117. },
  118. methods: {
  119. penalize() {
  120. this.$emit('penalize', null)
  121. },
  122. handleView(name) {
  123. uni.showToast({
  124. icon: 'none',
  125. title: name || '未设置'
  126. })
  127. },
  128. blurNum() {
  129. let total = Number(this.item.workReportInfo.formedNum) + Number(this.notFormedList[0].notFormedNum)
  130. this.$emit('modeNum', total)
  131. if (this.item.formedNumLast > 0 && Number(this.item.workReportInfo.formedNum)) {
  132. this.$set(this.notFormedList[0], 'notFormedNum', this.item.formedNumLast - Number(this.item
  133. .workReportInfo.formedNum))
  134. this.notForme()
  135. }
  136. let weight = Number(this.item.workReportInfo.formedNum) * Number(this.item.singleWeight) * Number(this
  137. .item.weightMultiple)
  138. if (this.item.singleWeightUnit == 'G' || this.item.singleWeightUnit == 'g' || this.item
  139. .singleWeightUnit == '克') {
  140. weight = parseFloat((weight / 1000).toFixed(2))
  141. } else {
  142. weight = parseFloat(weight.toFixed(2))
  143. }
  144. this.$set(this.item.workReportInfo, 'formedWeight', weight)
  145. this.$forceUpdate()
  146. },
  147. notForme() {
  148. let weight = Number(this.notFormedList[0].notFormedNum) * Number(this.item.singleWeight) * Number(this
  149. .item.weightMultiple)
  150. if (this.item.singleWeightUnit == 'G' || this.item.singleWeightUnit == 'g' || this.item
  151. .singleWeightUnit == '克') {
  152. weight = parseFloat((weight / 1000).toFixed(2))
  153. } else {
  154. weight = parseFloat(weight.toFixed(2))
  155. }
  156. this.$set(this.notFormedList[0], 'notFormedWeight', weight)
  157. if (this.item.formedNumLast > 0 && Number(this.notFormedList[0].notFormedNum)) {
  158. this.$set(this.item.workReportInfo, 'formedNum', this.item.formedNumLast - Number(this.notFormedList[0]
  159. .notFormedNum))
  160. let weight = Number(this.item.workReportInfo.formedNum) * Number(this.item.singleWeight) * Number(this
  161. .item.weightMultiple)
  162. if (this.item.singleWeightUnit == 'G' || this.item.singleWeightUnit == 'g' || this.item
  163. .singleWeightUnit == '克') {
  164. weight = parseFloat((weight / 1000).toFixed(2))
  165. } else {
  166. weight = parseFloat(weight.toFixed(2))
  167. }
  168. this.$set(this.item.workReportInfo, 'formedWeight', weight)
  169. }
  170. this.$forceUpdate()
  171. },
  172. changeNum() {
  173. this.notForme()
  174. this.blurNum()
  175. },
  176. }
  177. }
  178. </script>
  179. <style lang="scss" scoped>
  180. .title_box {
  181. margin-top: 20rpx;
  182. .name {
  183. font-size: 28rpx;
  184. font-style: normal;
  185. font-weight: 400;
  186. color: $theme-color;
  187. padding-left: 20rpx;
  188. position: relative;
  189. &:before {
  190. position: absolute;
  191. content: '';
  192. left: 0rpx;
  193. top: 0rpx;
  194. bottom: 0rpx;
  195. width: 4rpx;
  196. height: 28rpx;
  197. background: $theme-color;
  198. margin: auto;
  199. }
  200. }
  201. }
  202. .material {
  203. margin-top: 10rpx;
  204. .content_table {
  205. width: 100%;
  206. border: 2rpx solid $border-color;
  207. .item {
  208. display: flex;
  209. border-bottom: 2rpx solid $border-color;
  210. .lable {
  211. width: 132rpx;
  212. text-align: center;
  213. background-color: #F7F9FA;
  214. font-size: 26rpx;
  215. border-right: 2rpx solid $border-color;
  216. flex-shrink: 0;
  217. }
  218. .lable220 {
  219. width: 220rpx !important;
  220. font-size: 24rpx;
  221. }
  222. .lable150 {
  223. width: 156rpx !important;
  224. font-size: 24rpx;
  225. }
  226. .ww80 {
  227. width: 80rpx;
  228. }
  229. .content {
  230. width: 518rpx;
  231. min-height: 64rpx;
  232. font-size: 28rpx;
  233. line-height: 28rpx;
  234. font-style: normal;
  235. font-weight: 400;
  236. padding: 18rpx 8rpx;
  237. box-sizing: border-box;
  238. word-wrap: break-word;
  239. flex-grow: 1 !important;
  240. .unit {
  241. padding: 0 4rpx;
  242. font-size: 24rpx;
  243. color: #404446;
  244. }
  245. .penalize {
  246. width: 160rpx;
  247. line-height: 60rpx;
  248. background: $theme-color;
  249. font-size: 24rpx;
  250. text-align: center;
  251. color: #fff;
  252. }
  253. }
  254. .content_num {
  255. display: flex;
  256. align-items: center;
  257. padding: 0 4rpx;
  258. /deep/ .uni-input-input {
  259. border: 2rpx solid #F0F8F2;
  260. background: #F0F8F2;
  261. color: $theme-color;
  262. }
  263. }
  264. .pd4 {
  265. padding: 4rpx 8rpx;
  266. }
  267. &:last-child {
  268. border-bottom: none;
  269. }
  270. }
  271. .ww55 {
  272. width: 55%;
  273. }
  274. .ww45 {
  275. width: 45%;
  276. }
  277. }
  278. }
  279. </style>