jobBom.vue 8.3 KB

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