semiProductBom.vue 12 KB

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