jobBom.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  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. <view class="rx ">
  10. <view class="lable lable220 rx-cc ">上道工序生产数量</view>
  11. <view class="content ">
  12. {{ item.formedNumLast}}
  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" @blur="blurNum"
  55. :disabled="isDetails" @input="notForme"></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 class='content_table' v-for="(item,index) in palletList" :key='index'>
  75. <view class="item" @click="handleType" v-if="!isDetails">
  76. <view class="lable rx-cc">舟皿类型</view>
  77. <view class="content content_num">
  78. <input class="uni-input" v-model="item.categoryLevelName"></input>
  79. </view>
  80. </view>
  81. <view class="item" @click="handleType" v-if="isDetails">
  82. <view class="lable rx-cc">舟皿类型</view>
  83. <view class="content ">
  84. {{item.name}}
  85. </view>
  86. </view>
  87. <view class="item">
  88. <view class="lable rx-cc">舟皿名称</view>
  89. <view class="content ">
  90. <zxz-uni-data-select :localdata="boatList" v-model="item.categoryId" dataValue='id'
  91. format='{name}-{code}' dataKey="code" filterable :clear='false' v-if="!isDetails"
  92. @change='inputChange'></zxz-uni-data-select>
  93. <view v-if="isDetails">{{item.code }} </view>
  94. </view>
  95. </view>
  96. <view class="item">
  97. <view class="lable rx-cc">舟皿型号</view>
  98. <view class="content">
  99. {{item.modelType}}
  100. </view>
  101. </view>
  102. <view class="item">
  103. <view class="lable rx-cc">舟皿数量</view>
  104. <view class="content content_num">
  105. <input class="uni-input" v-model="item.quantity" type='digit' :disabled="isDetails"></input>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. <ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择分类"
  111. :localdata="classificationList" valueKey="id" textKey="name" childrenKey="children" />
  112. </view>
  113. </template>
  114. <script>
  115. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  116. import {
  117. treeByPid,
  118. pageeLedgerMain,
  119. assetPage,
  120. } from '@/api/pda/workOrder.js'
  121. import {
  122. number
  123. } from 'echarts'
  124. export default {
  125. props: {
  126. item: {
  127. type: Object,
  128. default: () => {}
  129. },
  130. notFormed: {
  131. type: Array,
  132. default: () => []
  133. },
  134. isDetails: {
  135. type: Boolean,
  136. default: false
  137. },
  138. palletList: {
  139. type: Array,
  140. default: () => []
  141. }
  142. },
  143. watch: {
  144. notFormed: {
  145. immediate: true,
  146. deep: true,
  147. handler(newVal) {
  148. this.notFormedList = newVal
  149. }
  150. }
  151. },
  152. data() {
  153. return {
  154. classificationList: [],
  155. boatList: [],
  156. notFormedList: []
  157. }
  158. },
  159. created() {
  160. this.getTreeList()
  161. if (this.isDetails) {
  162. this.notFormedList = this.notFormedList.map(m => {
  163. return {
  164. notFormedNum: Number(m.quantity),
  165. notFormedWeight: m.weight,
  166. ...m
  167. }
  168. })
  169. }
  170. },
  171. methods: {
  172. getTreeList() {
  173. let params = {
  174. ids: [8]
  175. }
  176. treeByPid(params).then(res => {
  177. this.classificationList = res
  178. })
  179. },
  180. confirm(id, name, rootCategoryLevelId) {
  181. this.$set(this.palletList[0], 'categoryLevelId', id[0])
  182. this.$set(this.palletList[0], 'categoryLevelName', name)
  183. this.$set(this.palletList[0], 'rootCategoryLevelId', rootCategoryLevelId)
  184. let param = {
  185. categoryLevelId: id,
  186. pageNum: 1,
  187. size: -1,
  188. }
  189. assetPage(param).then(res => {
  190. this.boatList = res.list
  191. })
  192. },
  193. inputChange(e) {
  194. this.$set(this.palletList[0], 'categoryId', e.id)
  195. this.$set(this.palletList[0], 'code', e.code)
  196. this.$set(this.palletList[0], 'name', e.name)
  197. this.$set(this.palletList[0], 'specification', e.specification)
  198. this.$set(this.palletList[0], 'categoryId', e.id)
  199. this.$set(this.palletList[0], 'brandNum', e.brandNum)
  200. this.$set(this.palletList[0], 'modelType', e.modelType)
  201. this.$set(this.palletList[0], 'quantity', e.quantity)
  202. this.$set(this.palletList[0], 'unit', e.unit)
  203. this.$forceUpdate()
  204. },
  205. handleType() {
  206. this.$refs.treePicker._show()
  207. },
  208. penalize() {
  209. this.$emit('penalize', null)
  210. },
  211. handleView(name) {
  212. uni.showToast({
  213. icon: 'none',
  214. title: name || '未设置'
  215. })
  216. },
  217. blurNum() {
  218. let total = Number(this.item.workReportInfo.formedNum) + Number(this.notFormedList[0].notFormedNum)
  219. this.$emit('modeNum', total)
  220. if (this.item.formedNumLast > 0 && Number(this.item.workReportInfo.formedNum)) {
  221. this.$set(this.notFormedList[0], 'notFormedNum', this.item.formedNumLast - Number(this.item
  222. .workReportInfo.formedNum))
  223. this.notForme()
  224. }
  225. let weight = Number(this.item.workReportInfo.formedNum) * Number(this.item.singleWeight) * Number(this
  226. .item.weightMultiple)
  227. if (this.item.singleWeightUnit == 'G' || this.item.singleWeightUnit == 'g' || this.item
  228. .singleWeightUnit == '克') {
  229. weight = parseFloat((weight / 1000).toFixed(2))
  230. } else {
  231. weight = parseFloat(weight.toFixed(2))
  232. }
  233. this.$set(this.item.workReportInfo, 'formedWeight', weight)
  234. this.$forceUpdate()
  235. },
  236. notForme() {
  237. let weight = Number(this.notFormedList[0].notFormedNum) * Number(this.item.singleWeight) * Number(this
  238. .item.weightMultiple)
  239. if (this.item.singleWeightUnit == 'G' || this.item.singleWeightUnit == 'g' || this.item
  240. .singleWeightUnit == '克') {
  241. weight = parseFloat((weight / 1000).toFixed(2))
  242. } else {
  243. weight = parseFloat(weight.toFixed(2))
  244. }
  245. this.$set(this.notFormedList[0], 'notFormedWeight', weight)
  246. if (this.item.formedNumLast > 0 && Number(this.notFormedList[0].notFormedNum)) {
  247. this.$set(this.item.workReportInfo, 'formedNum', this.item.formedNumLast - Number(this.notFormedList[0]
  248. .notFormedNum))
  249. let weight = Number(this.item.workReportInfo.formedNum) * Number(this.item.singleWeight) * Number(this
  250. .item.weightMultiple)
  251. if (this.item.singleWeightUnit == 'G' || this.item.singleWeightUnit == 'g' || this.item
  252. .singleWeightUnit == '克') {
  253. weight = parseFloat((weight / 1000).toFixed(2))
  254. } else {
  255. weight = parseFloat(weight.toFixed(2))
  256. }
  257. this.$set(this.item.workReportInfo, 'formedWeight', weight)
  258. }
  259. this.$forceUpdate()
  260. },
  261. }
  262. }
  263. </script>
  264. <style lang="scss" scoped>
  265. .title_box {
  266. margin-top: 20rpx;
  267. .name {
  268. font-size: 28rpx;
  269. font-style: normal;
  270. font-weight: 400;
  271. color: $theme-color;
  272. padding-left: 20rpx;
  273. position: relative;
  274. &:before {
  275. position: absolute;
  276. content: '';
  277. left: 0rpx;
  278. top: 0rpx;
  279. bottom: 0rpx;
  280. width: 4rpx;
  281. height: 28rpx;
  282. background: $theme-color;
  283. margin: auto;
  284. }
  285. }
  286. }
  287. .material {
  288. margin-top: 10rpx;
  289. .content_table {
  290. width: 100%;
  291. border: 2rpx solid $border-color;
  292. .item {
  293. display: flex;
  294. border-bottom: 2rpx solid $border-color;
  295. .lable {
  296. width: 132rpx;
  297. text-align: center;
  298. background-color: #F7F9FA;
  299. font-size: 26rpx;
  300. border-right: 2rpx solid $border-color;
  301. flex-shrink: 0;
  302. }
  303. .lable220 {
  304. width: 220rpx !important;
  305. font-size: 24rpx;
  306. }
  307. .lable150 {
  308. width: 156rpx !important;
  309. font-size: 24rpx;
  310. }
  311. .ww80 {
  312. width: 80rpx;
  313. }
  314. .content {
  315. width: 518rpx;
  316. min-height: 64rpx;
  317. font-size: 28rpx;
  318. line-height: 28rpx;
  319. font-style: normal;
  320. font-weight: 400;
  321. padding: 18rpx 8rpx;
  322. box-sizing: border-box;
  323. word-wrap: break-word;
  324. flex-grow: 1 !important;
  325. .unit {
  326. padding: 0 4rpx;
  327. font-size: 24rpx;
  328. color: #404446;
  329. }
  330. .penalize {
  331. width: 160rpx;
  332. line-height: 60rpx;
  333. background: $theme-color;
  334. font-size: 24rpx;
  335. text-align: center;
  336. color: #fff;
  337. }
  338. }
  339. .content_num {
  340. display: flex;
  341. align-items: center;
  342. padding: 0 4rpx;
  343. /deep/ .uni-input-input {
  344. border: 2rpx solid #F0F8F2;
  345. background: #F0F8F2;
  346. color: $theme-color;
  347. }
  348. }
  349. .pd4 {
  350. padding: 4rpx 8rpx;
  351. }
  352. &:last-child {
  353. border-bottom: none;
  354. }
  355. }
  356. .ww55 {
  357. width: 55%;
  358. }
  359. .ww45 {
  360. width: 45%;
  361. }
  362. }
  363. }
  364. </style>