jobBom.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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" v-if="Object.prototype.hasOwnProperty.call(item, 'product')">
  9. <view class="rx ">
  10. <view class="lable lable220 rx-cc ">投料数量</view>
  11. <view class="content">
  12. {{ item.product[0] && item.product[0].feedQuantity }}
  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.product[0] && this.item.product[0].feedQuantity > 0 && Number(this.item.workReportInfo.formedNum)) {
  132. this.$set(this.notFormedList[0], 'notFormedNum', this.item.product[0].feedQuantity - 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 (['G', 'g', '克' ].includes(this.item.singleWeightUnit)) {
  139. weight = parseFloat((weight / 1000).toFixed(2))
  140. } else {
  141. weight = parseFloat(weight.toFixed(2))
  142. }
  143. this.$set(this.item.workReportInfo, 'formedWeight', weight)
  144. this.$forceUpdate()
  145. },
  146. notForme() {
  147. let weight = Number(this.notFormedList[0].notFormedNum) * Number(this.item.singleWeight) * Number(this
  148. .item.weightMultiple)
  149. if (this.item.singleWeightUnit == 'G' || this.item.singleWeightUnit == 'g' || this.item.singleWeightUnit == '克') {
  150. weight = parseFloat((weight / 1000).toFixed(2))
  151. } else {
  152. weight = parseFloat(weight.toFixed(2))
  153. }
  154. this.$set(this.notFormedList[0], 'notFormedWeight', weight)
  155. if (this.item.product[0].feedQuantity > 0 && Number(this.notFormedList[0].notFormedNum)) {
  156. this.$set(this.item.workReportInfo, 'formedNum', this.item.product[0].feedQuantity - Number(this.notFormedList[0]
  157. .notFormedNum))
  158. let weight = Number(this.item.workReportInfo.formedNum) * Number(this.item.singleWeight) * Number(this
  159. .item.weightMultiple)
  160. if (this.item.singleWeightUnit == 'G' || this.item.singleWeightUnit == 'g' || this.item
  161. .singleWeightUnit == '克') {
  162. weight = parseFloat((weight / 1000).toFixed(2))
  163. } else {
  164. weight = parseFloat(weight.toFixed(2))
  165. }
  166. this.$set(this.item.workReportInfo, 'formedWeight', weight)
  167. }
  168. this.$forceUpdate()
  169. },
  170. changeNum() {
  171. this.notForme()
  172. // this.blurNum()
  173. },
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .title_box {
  179. margin-top: 20rpx;
  180. .name {
  181. font-size: 28rpx;
  182. font-style: normal;
  183. font-weight: 400;
  184. color: $theme-color;
  185. padding-left: 20rpx;
  186. position: relative;
  187. &:before {
  188. position: absolute;
  189. content: '';
  190. left: 0rpx;
  191. top: 0rpx;
  192. bottom: 0rpx;
  193. width: 4rpx;
  194. height: 28rpx;
  195. background: $theme-color;
  196. margin: auto;
  197. }
  198. }
  199. }
  200. .material {
  201. margin-top: 10rpx;
  202. .content_table {
  203. width: 100%;
  204. border: 2rpx solid $border-color;
  205. .item {
  206. display: flex;
  207. border-bottom: 2rpx solid $border-color;
  208. .lable {
  209. width: 132rpx;
  210. text-align: center;
  211. background-color: #F7F9FA;
  212. font-size: 26rpx;
  213. border-right: 2rpx solid $border-color;
  214. flex-shrink: 0;
  215. }
  216. .lable220 {
  217. width: 220rpx !important;
  218. font-size: 24rpx;
  219. }
  220. .lable150 {
  221. width: 156rpx !important;
  222. font-size: 24rpx;
  223. }
  224. .ww80 {
  225. width: 80rpx;
  226. }
  227. .content {
  228. width: 518rpx;
  229. min-height: 64rpx;
  230. font-size: 28rpx;
  231. line-height: 28rpx;
  232. font-style: normal;
  233. font-weight: 400;
  234. padding: 18rpx 8rpx;
  235. box-sizing: border-box;
  236. word-wrap: break-word;
  237. flex-grow: 1 !important;
  238. .unit {
  239. padding: 0 4rpx;
  240. font-size: 24rpx;
  241. color: #404446;
  242. }
  243. .penalize {
  244. width: 160rpx;
  245. line-height: 60rpx;
  246. background: $theme-color;
  247. font-size: 24rpx;
  248. text-align: center;
  249. color: #fff;
  250. }
  251. }
  252. .content_num {
  253. display: flex;
  254. align-items: center;
  255. padding: 0 4rpx;
  256. /deep/ .uni-input-input {
  257. border: 2rpx solid #F0F8F2;
  258. background: #F0F8F2;
  259. color: $theme-color;
  260. }
  261. }
  262. .pd4 {
  263. padding: 4rpx 8rpx;
  264. }
  265. &:last-child {
  266. border-bottom: none;
  267. }
  268. }
  269. .ww55 {
  270. width: 55%;
  271. }
  272. .ww45 {
  273. width: 45%;
  274. }
  275. }
  276. }
  277. </style>