jobBom.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  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. weight = parseFloat(weight.toFixed(2))
  228. this.$set(this.item.workReportInfo, 'formedWeight', weight)
  229. this.$forceUpdate()
  230. },
  231. notForme() {
  232. let weight = Number(this.notFormedList[0].notFormedNum) * Number(this.item.singleWeight) * Number(this
  233. .item.weightMultiple)
  234. weight = parseFloat(weight.toFixed(2))
  235. this.$set(this.notFormedList[0], 'notFormedWeight', weight)
  236. if (this.item.formedNumLast > 0 && Number(this.notFormedList[0].notFormedNum)) {
  237. this.$set(this.item.workReportInfo, 'formedNum', this.item.formedNumLast - Number(this.notFormedList[0]
  238. .notFormedNum))
  239. let weight = Number(this.item.workReportInfo.formedNum) * Number(this.item.singleWeight) * Number(this
  240. .item.weightMultiple)
  241. weight = parseFloat(weight.toFixed(2))
  242. this.$set(this.item.workReportInfo, 'formedWeight', weight)
  243. }
  244. this.$forceUpdate()
  245. },
  246. }
  247. }
  248. </script>
  249. <style lang="scss" scoped>
  250. .title_box {
  251. margin-top: 20rpx;
  252. .name {
  253. font-size: 28rpx;
  254. font-style: normal;
  255. font-weight: 400;
  256. color: $theme-color;
  257. padding-left: 20rpx;
  258. position: relative;
  259. &:before {
  260. position: absolute;
  261. content: '';
  262. left: 0rpx;
  263. top: 0rpx;
  264. bottom: 0rpx;
  265. width: 4rpx;
  266. height: 28rpx;
  267. background: $theme-color;
  268. margin: auto;
  269. }
  270. }
  271. }
  272. .material {
  273. margin-top: 10rpx;
  274. .content_table {
  275. width: 100%;
  276. border: 2rpx solid $border-color;
  277. .item {
  278. display: flex;
  279. border-bottom: 2rpx solid $border-color;
  280. .lable {
  281. width: 132rpx;
  282. text-align: center;
  283. background-color: #F7F9FA;
  284. font-size: 26rpx;
  285. border-right: 2rpx solid $border-color;
  286. flex-shrink: 0;
  287. }
  288. .lable220 {
  289. width: 220rpx !important;
  290. font-size: 24rpx;
  291. }
  292. .lable150 {
  293. width: 156rpx !important;
  294. font-size: 24rpx;
  295. }
  296. .ww80 {
  297. width: 80rpx;
  298. }
  299. .content {
  300. width: 518rpx;
  301. min-height: 64rpx;
  302. font-size: 28rpx;
  303. line-height: 28rpx;
  304. font-style: normal;
  305. font-weight: 400;
  306. padding: 18rpx 8rpx;
  307. box-sizing: border-box;
  308. word-wrap: break-word;
  309. flex-grow: 1 !important;
  310. .unit {
  311. padding: 0 4rpx;
  312. font-size: 24rpx;
  313. color: #404446;
  314. }
  315. .penalize {
  316. width: 160rpx;
  317. line-height: 60rpx;
  318. background: $theme-color;
  319. font-size: 24rpx;
  320. text-align: center;
  321. color: #fff;
  322. }
  323. }
  324. .content_num {
  325. display: flex;
  326. align-items: center;
  327. padding: 0 4rpx;
  328. /deep/ .uni-input-input {
  329. border: 2rpx solid #F0F8F2;
  330. background: #F0F8F2;
  331. color: $theme-color;
  332. }
  333. }
  334. .pd4 {
  335. padding: 4rpx 8rpx;
  336. }
  337. &:last-child {
  338. border-bottom: none;
  339. }
  340. }
  341. .ww55 {
  342. width: 55%;
  343. }
  344. .ww45 {
  345. width: 45%;
  346. }
  347. }
  348. }
  349. </style>