semiProductBom.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name">物料明细 ({{list.length || 0}})个</view>
  5. <view class="btn_box rx-cc" v-if="deviceList.length > 1" @click="bindDevice">绑定设备</view>
  6. </view>
  7. <u-list @scrolltolower="scrolltolower" class="z_list" style="height: 100% !important;">
  8. <view class="material rx-ss" v-for="(mate, idx) in list" :key="idx">
  9. <view class="left rx-ss" @click="getDelete(idx)" v-if='workOrderId'>
  10. <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
  11. </view>
  12. <view class="content_table">
  13. <view class="item rx-sc"
  14. v-if='([23,2,9,28].includes(Number(mate.rootCategoryLevelId))) && mate.isConsumable == 1'>
  15. <view class="rx ">
  16. <view class="lable rx-cc">编码</view>
  17. <view class="content rx-bc">
  18. <view>{{it.code}} </view>
  19. <view class="tag_box"
  20. v-if="Object.prototype.hasOwnProperty.call(it, 'extInfo') && Object.prototype.hasOwnProperty.call(it.extInfo, 'productionTimes') && Object.prototype.hasOwnProperty.call(it.extInfo.productionTimes,item.currentTaskDiagram.taskId) ">
  21. {{ it.extInfo.productionTimes[item.currentTaskDiagram.taskId]}}
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="item rx-bc"
  27. v-if='([23,2,9,28].includes(Number(mate.rootCategoryLevelId))) && mate.isConsumable == 0'
  28. @click="handleCheck(idx, mate)">
  29. <view class="rx ">
  30. <view class="lable rx-cc">编码</view>
  31. <view class="content rx-bc">
  32. <view>{{ mate.code }}</view>
  33. <view class='tag_box' v-if="mate.isCache" style="margin-right: -36rpx;" >缓</view>
  34. </view>
  35. </view>
  36. <view class="rx-cc ww20" v-if="deviceList.length > 1">
  37. <image class="check" v-if="mate.check" src='../../../../static/check.png'></image>
  38. <image class="check" v-if="!mate.check" src='../../../../static/check_no.png'></image>
  39. </view>
  40. </view>
  41. <view class="item">
  42. <view class="lable rx-cc">名称</view>
  43. <view class="content">{{mate.name}} <text
  44. v-if="[2, 23,9,28].includes(Number(mate.rootCategoryLevelId))">
  45. ({{mate.rootCategoryLevelId == 2 ? '在制品' : mate.rootCategoryLevelId == 23 ? '半成品' : mate.rootCategoryLevelId == 9 ? '产品' : mate.rootCategoryLevelId == 28 ? '废品' : '' }})
  46. </text></view>
  47. </view>
  48. <view class="item" v-for="(itm, index) in tableH(mate.rootCategoryLevelId)" :key="index">
  49. <view class="lable rx-cc">{{ itm.label }}</view>
  50. <view class="content">{{ mate[itm.prop] }}</view>
  51. </view>
  52. <view class="item" v-if='mate.isConsumable == 1'>
  53. <view class="lable rx-cc">包装库存</view>
  54. <view class="content">{{ mate.packingCountBase }}/ {{ mate.minUnit}}</view>
  55. </view>
  56. <view class="item rx-sc" v-if='mate.isConsumable == 0'>
  57. <view class="rx ww50">
  58. <view class="lable rx-cc">{{ currentTaskDiagram.isFirstTask == 1 ? '物料重量': '上道重量' }}</view>
  59. <view class="content" v-if="currentTaskDiagram.isFirstTask == 1">
  60. {{mate.extInfo.weight || 0}} {{ mate.extInfo.weightUnit}}
  61. </view>
  62. <view class="content" v-if="currentTaskDiagram.isFirstTask == 0">
  63. {{mate.extInfo.newWeight || 0}} {{ mate.extInfo.weightUnit}}
  64. </view>
  65. </view>
  66. <view class="rx ww50">
  67. <view class="lable ww80 rx-cc">刻码</view>
  68. <view class="content">{{mate.extInfo.engrave}}</view>
  69. </view>
  70. </view>
  71. <view class="item" v-if='mate.isConsumable == 0'>
  72. <view class="lable rx-cc">物料代号</view>
  73. <view class="content">{{mate.extInfo.materielCode}}</view>
  74. </view>
  75. <view class="item" v-if='mate.isConsumable == 0'>
  76. <view class="lable rx-cc">客户代号</view>
  77. <view class="content">{{mate.extInfo.clientCode}}</view>
  78. </view>
  79. <view class="item" v-if='mate.isConsumable == 0 && deviceList.length > 0'>
  80. <view class="rx ww70">
  81. <view class="lable rx-cc">设备</view>
  82. <view class="content content_num">
  83. <zxz-uni-data-select v-if="!isDetails" :localdata="deviceList" v-model="mate.deviceId"
  84. dataValue='id' format='{name}-{codeNumber}' @change="e => selectVal(e, mate, idx)"
  85. dataKey="id" filterable :clear='false'></zxz-uni-data-select>
  86. <span v-if="isDetails">{{mate.deviceName}}</span>
  87. </view>
  88. </view>
  89. <view class="rx ww30">
  90. <view class="lable rx-cc ww80">炉次号</view>
  91. <view class="content content_num ">
  92. <input class="uni-input" style="width: 120rpx;"
  93. v-model="mate.extInfo.heatNumber"></input>
  94. </view>
  95. </view>
  96. </view>
  97. <view class="item rx-sc" v-if='mate.isConsumable == 0'>
  98. <view class="rx ww50">
  99. <view class="lable rx-cc">位置</view>
  100. <view class="content content_num ">
  101. <input class="uni-input" v-model='mate.extInfo.position'></input>
  102. </view>
  103. </view>
  104. <view class="rx ww50">
  105. <view class="lable rx-cc ww80">数量</view>
  106. <view class="content content_num ">
  107. <input class="uni-input" style="width: 160rpx;" v-model="mate.feedQuantity"
  108. type="digit"></input>
  109. <view class="unit ">/{{mate.unit}}</view>
  110. </view>
  111. </view>
  112. </view>
  113. <view class="item" v-if='mate.isConsumable == 1'>
  114. <view class="lable rx-cc">数量</view>
  115. <view class="content content_num">
  116. <input class="uni-input" v-model="mate.feedQuantity" type="digit"></input>
  117. <view class="unit">/{{mate.unit}}</view>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </u-list>
  123. <SearchPopup mode="center" v-if='deviveShow'>
  124. <template v-slot:list>
  125. <view class="search_list">
  126. <u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
  127. <u-form-item label="绑定设备:" class="required-form" borderBottom prop="assetType">
  128. <zxz-uni-data-select :localdata="deviceList" v-model="formData.deviceId" dataValue='id'
  129. format='{name}-{codeNumber}' @change="e => formData.deviceName = e.name + e.codeNumber"
  130. dataKey="id" filterable :clear='false'></zxz-uni-data-select>
  131. </u-form-item>
  132. </u-form>
  133. </view>
  134. </template>
  135. <template v-slot:operate>
  136. <view class="operate_box rx-bc">
  137. <u-button size="small" class="u-reset-button" @click="deviceClose">
  138. 取消
  139. </u-button>
  140. <u-button type="success" size="small" class="u-reset-button" @click="deviceOk">
  141. 确定
  142. </u-button>
  143. </view>
  144. </template>
  145. </SearchPopup>
  146. </view>
  147. </template>
  148. <script>
  149. import {
  150. tableHeader
  151. } from './feedBom.js'
  152. import SearchPopup from '../../components/searchPopup.vue'
  153. export default {
  154. components: {
  155. SearchPopup
  156. },
  157. props: {
  158. workOrderId: {
  159. type: String,
  160. default: ''
  161. },
  162. list: {
  163. type: Array,
  164. default: () => []
  165. },
  166. equipmentList: {
  167. type: Array,
  168. default: () => []
  169. },
  170. currentTaskDiagram: {
  171. type: Object,
  172. default: () => {}
  173. },
  174. isDetails: {
  175. type: Boolean,
  176. default: false
  177. }
  178. },
  179. watch: {
  180. equipmentList: {
  181. immediate: true,
  182. deep: true,
  183. handler(newVal) {
  184. this.deviceList = newVal
  185. this.changeHeatNumber()
  186. }
  187. },
  188. },
  189. data() {
  190. return {
  191. deviceList: [],
  192. deviveShow: false,
  193. formData: {
  194. deviceId: null,
  195. deviceName: null,
  196. }
  197. }
  198. },
  199. created() {
  200. },
  201. methods: {
  202. tableH(type) {
  203. return tableHeader(type)
  204. },
  205. getDelete(idx) {
  206. this.list.splice(idx, 1)
  207. },
  208. scrolltolower() {},
  209. handleCheck(idx, it) {
  210. this.$set(this.list[idx], 'check', !it.check)
  211. },
  212. selectVal(e, item, idx) {
  213. this.$set(this.list[idx], 'deviceName', e.name + '-' + e.codeNumber)
  214. this.$set(this.list[idx]['extInfo'], 'heatNumber', e.extInfo.heatNumber)
  215. },
  216. changeHeatNumber() {
  217. this.deviceList.forEach(f => {
  218. this.list.forEach(o => {
  219. if (o.deviceId && f.id == o.deviceId && this.deviceList.length > 1) {
  220. o.extInfo.heatNumber = f.extInfo.heatNumber
  221. o['workstationName'] = f.workstationName
  222. } else if (this.deviceList.length == 1) {
  223. o['deviceName'] = this.deviceList[0].name
  224. o['deviceId'] = this.deviceList[0].id
  225. o['workstationName'] = this.deviceList[0].workstationName
  226. o.extInfo.heatNumber = this.deviceList[0].extInfo.heatNumber
  227. this.$forceUpdate()
  228. }
  229. })
  230. })
  231. },
  232. bindDevice() {
  233. this.deviveShow = true
  234. },
  235. deviceOk() {
  236. let arr = this.list.filter(e => {
  237. return e.check
  238. })
  239. if (arr.length <= 0) {
  240. uni.showToast({
  241. icon: 'none',
  242. title: '请先勾选半成品'
  243. })
  244. return false
  245. }
  246. if (!this.formData.deviceId) {
  247. uni.showToast({
  248. icon: 'none',
  249. title: '请先选择设备'
  250. })
  251. return false
  252. }
  253. this.list.forEach(e => {
  254. if (e.check) {
  255. e['deviceId'] = this.formData.deviceId
  256. e['deviceName'] = this.formData.deviceName
  257. }
  258. })
  259. this.$forceUpdate()
  260. this.deviceClose()
  261. },
  262. deviceClose() {
  263. this.formData.deviceName = null
  264. this.formData.deviceId = null
  265. this.deviveShow = false
  266. },
  267. }
  268. }
  269. </script>
  270. <style lang="scss" scoped>
  271. .title_box {
  272. margin-top: 20rpx;
  273. .name {
  274. font-size: 28rpx;
  275. font-style: normal;
  276. font-weight: 400;
  277. color: $theme-color;
  278. padding-left: 20rpx;
  279. position: relative;
  280. &:before {
  281. position: absolute;
  282. content: '';
  283. left: 0rpx;
  284. top: 0rpx;
  285. bottom: 0rpx;
  286. width: 4rpx;
  287. height: 28rpx;
  288. background: $theme-color;
  289. margin: auto;
  290. }
  291. }
  292. .btn_box {
  293. padding: 0 18rpx;
  294. height: 48rpx;
  295. background: $theme-color;
  296. font-size: 26rpx;
  297. font-style: normal;
  298. font-weight: 400;
  299. font-size: 24rpx;
  300. color: #fff;
  301. border-radius: 4rpx;
  302. .scan {
  303. width: 34rpx;
  304. height: 34rpx;
  305. margin-right: 12rpx;
  306. }
  307. }
  308. }
  309. .material {
  310. margin-top: 10rpx;
  311. .left {
  312. width: 40rpx;
  313. }
  314. .zdy_check {
  315. width: 30rpx;
  316. height: 30rpx;
  317. border: 2rpx solid #c8c9cc;
  318. border-radius: 4rpx;
  319. }
  320. .check_active {
  321. background: $theme-color;
  322. border: 2rpx solid $theme-color;
  323. /deep/ .u-icon__icon {
  324. color: #fff !important;
  325. }
  326. }
  327. .content_table {
  328. width: 670rpx;
  329. border: 2rpx solid $border-color;
  330. .item {
  331. display: flex;
  332. border-bottom: 2rpx solid $border-color;
  333. .lable {
  334. width: 132rpx;
  335. text-align: center;
  336. background-color: #F7F9FA;
  337. font-size: 26rpx;
  338. border-right: 2rpx solid $border-color;
  339. flex-shrink: 0;
  340. }
  341. .ww80 {
  342. width: 80rpx;
  343. }
  344. .content {
  345. width: 500rpx;
  346. min-height: 64rpx;
  347. font-size: 28rpx;
  348. line-height: 28rpx;
  349. font-style: normal;
  350. font-weight: 400;
  351. padding: 18rpx 8rpx;
  352. box-sizing: border-box;
  353. word-wrap: break-word;
  354. flex-grow: 1 !important;
  355. }
  356. .content_num {
  357. display: flex;
  358. align-items: center;
  359. padding: 0 4rpx;
  360. /deep/ .uni-input-input {
  361. width: 200rpx;
  362. border: 2rpx solid #F0F8F2;
  363. background: #F0F8F2;
  364. color: $theme-color;
  365. }
  366. .unit {
  367. padding: 0 4rpx;
  368. font-size: 24rpx;
  369. color: #404446;
  370. }
  371. }
  372. .ww400 {
  373. /deep/ .uni-input-input {
  374. width: 400rpx;
  375. }
  376. }
  377. .pd4 {
  378. padding: 4rpx 8rpx;
  379. }
  380. &:last-child {
  381. border-bottom: none;
  382. }
  383. }
  384. .ww55 {
  385. width: 55%;
  386. }
  387. .ww45 {
  388. width: 45%;
  389. }
  390. .ww50 {
  391. width: 50%;
  392. }
  393. .ww30 {
  394. width: 30%;
  395. }
  396. .ww70 {
  397. width: 70%;
  398. }
  399. .ww80 {
  400. width: 80%;
  401. }
  402. .ww20 {
  403. width: 20%;
  404. }
  405. .check {
  406. width: 30rpx;
  407. height: 30rpx;
  408. }
  409. .tag_box {
  410. padding: 2rpx 10rpx;
  411. margin-right: 12rpx;
  412. background: #E6A23C;
  413. font-size: 22rpx;
  414. color: #fff;
  415. border-radius: 4rpx;
  416. }
  417. }
  418. }
  419. .z_list {
  420. max-height: 2000rpx;
  421. }
  422. .search_list {
  423. min-height: 100rpx;
  424. width: 90vw;
  425. /deep/ .baseForm {
  426. padding: 0 20rpx;
  427. }
  428. }
  429. .operate_box {
  430. padding: 10rpx 32rpx;
  431. /deep/ .u-button {
  432. width: 40%;
  433. }
  434. }
  435. </style>