jobBom.vue 8.5 KB

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