jobBom.vue 7.7 KB

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