jobBom.vue 8.1 KB

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