semiProductBom.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  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.categoryCode }} </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.categoryCode }}</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. console.log('112233',newVal)
  202. this.deviceList = newVal
  203. this.changeHeatNumber()
  204. }
  205. },
  206. },
  207. data() {
  208. return {
  209. deviceList: [],
  210. deviveShow: false,
  211. formData: {
  212. deviceId: null,
  213. deviceName: null,
  214. }
  215. }
  216. },
  217. created() {
  218. },
  219. methods: {
  220. tableH(type) {
  221. return tableHeader(type)
  222. },
  223. getDelete(idx) {
  224. this.list.splice(idx, 1)
  225. },
  226. scrolltolower() { },
  227. handleCheck(idx, it) {
  228. this.$set(this.list[idx], 'check', !it.check)
  229. },
  230. selectVal(e, item, idx) {
  231. this.$set(this.list[idx], 'deviceName', e.name + '-' + e.codeNumber)
  232. this.$set(this.list[idx]['extInfo'], 'heatNumber', e.extInfo.heatNumber)
  233. },
  234. changeHeatNumber() {
  235. this.deviceList.forEach(f => {
  236. this.list.forEach(o => {
  237. if (o.deviceId && f.id == o.deviceId && this.deviceList.length > 1) {
  238. o.extInfo.heatNumber = f.extInfo.heatNumber
  239. o['workstationName'] = f.workstationName
  240. } else if (this.deviceList.length == 1) {
  241. o['deviceName'] = this.deviceList[0].name
  242. o['deviceId'] = this.deviceList[0].id
  243. o['workstationName'] = this.deviceList[0].workstationName
  244. o.extInfo.heatNumber = this.deviceList[0].extInfo.heatNumber
  245. this.$forceUpdate()
  246. }
  247. })
  248. })
  249. },
  250. bindDevice() {
  251. this.deviveShow = true
  252. },
  253. deviceOk() {
  254. let arr = this.list.filter(e => {
  255. return e.check
  256. })
  257. if (arr.length <= 0) {
  258. uni.showToast({
  259. icon: 'none',
  260. title: '请先勾选半成品'
  261. })
  262. return false
  263. }
  264. if (!this.formData.deviceId) {
  265. uni.showToast({
  266. icon: 'none',
  267. title: '请先选择设备'
  268. })
  269. return false
  270. }
  271. this.list.forEach(e => {
  272. if (e.check) {
  273. e['deviceId'] = this.formData.deviceId
  274. e['deviceName'] = this.formData.deviceName
  275. }
  276. })
  277. this.$forceUpdate()
  278. this.deviceClose()
  279. },
  280. deviceClose() {
  281. this.formData.deviceName = null
  282. this.formData.deviceId = null
  283. this.deviveShow = false
  284. },
  285. }
  286. }
  287. </script>
  288. <style lang="scss" scoped>
  289. .title_box {
  290. margin-top: 20rpx;
  291. .name {
  292. font-size: 28rpx;
  293. font-style: normal;
  294. font-weight: 400;
  295. color: $theme-color;
  296. padding-left: 20rpx;
  297. position: relative;
  298. &:before {
  299. position: absolute;
  300. content: '';
  301. left: 0rpx;
  302. top: 0rpx;
  303. bottom: 0rpx;
  304. width: 4rpx;
  305. height: 28rpx;
  306. background: $theme-color;
  307. margin: auto;
  308. }
  309. }
  310. .btn_box {
  311. padding: 0 18rpx;
  312. height: 48rpx;
  313. background: $theme-color;
  314. font-size: 26rpx;
  315. font-style: normal;
  316. font-weight: 400;
  317. font-size: 24rpx;
  318. color: #fff;
  319. border-radius: 4rpx;
  320. .scan {
  321. width: 34rpx;
  322. height: 34rpx;
  323. margin-right: 12rpx;
  324. }
  325. }
  326. }
  327. .material {
  328. margin-top: 10rpx;
  329. .left {
  330. width: 40rpx;
  331. }
  332. .zdy_check {
  333. width: 30rpx;
  334. height: 30rpx;
  335. border: 2rpx solid #c8c9cc;
  336. border-radius: 4rpx;
  337. }
  338. .check_active {
  339. background: $theme-color;
  340. border: 2rpx solid $theme-color;
  341. /deep/ .u-icon__icon {
  342. color: #fff !important;
  343. }
  344. }
  345. .content_table {
  346. width: 670rpx;
  347. border: 2rpx solid $border-color;
  348. .item {
  349. display: flex;
  350. border-bottom: 2rpx solid $border-color;
  351. .lable {
  352. width: 132rpx;
  353. text-align: center;
  354. background-color: #F7F9FA;
  355. font-size: 26rpx;
  356. border-right: 2rpx solid $border-color;
  357. flex-shrink: 0;
  358. }
  359. .ww80 {
  360. width: 80rpx;
  361. }
  362. .content {
  363. width: 500rpx;
  364. min-height: 64rpx;
  365. font-size: 28rpx;
  366. line-height: 28rpx;
  367. font-style: normal;
  368. font-weight: 400;
  369. padding: 18rpx 8rpx;
  370. box-sizing: border-box;
  371. word-wrap: break-word;
  372. flex-grow: 1 !important;
  373. }
  374. .content_num {
  375. display: flex;
  376. align-items: center;
  377. padding: 0 4rpx;
  378. /deep/ .uni-input-input {
  379. width: 200rpx;
  380. border: 2rpx solid #F0F8F2;
  381. background: #F0F8F2;
  382. color: $theme-color;
  383. }
  384. .unit {
  385. padding: 0 4rpx;
  386. font-size: 24rpx;
  387. color: #404446;
  388. }
  389. }
  390. .ww400 {
  391. /deep/ .uni-input-input {
  392. width: 400rpx;
  393. }
  394. }
  395. .pd4 {
  396. padding: 4rpx 8rpx;
  397. }
  398. &:last-child {
  399. border-bottom: none;
  400. }
  401. }
  402. .ww55 {
  403. width: 55%;
  404. }
  405. .ww45 {
  406. width: 45%;
  407. }
  408. .ww50 {
  409. width: 50%;
  410. }
  411. .ww30 {
  412. width: 30%;
  413. }
  414. .ww70 {
  415. width: 70%;
  416. }
  417. .ww80 {
  418. width: 80%;
  419. }
  420. .ww20 {
  421. width: 20%;
  422. }
  423. .check {
  424. width: 30rpx;
  425. height: 30rpx;
  426. }
  427. .tag_box {
  428. padding: 2rpx 10rpx;
  429. margin-right: 12rpx;
  430. background: #E6A23C;
  431. font-size: 22rpx;
  432. color: #fff;
  433. border-radius: 4rpx;
  434. }
  435. }
  436. }
  437. .z_list {
  438. max-height: 2000rpx;
  439. }
  440. .search_list {
  441. min-height: 100rpx;
  442. width: 90vw;
  443. /deep/ .baseForm {
  444. padding: 0 20rpx;
  445. }
  446. }
  447. .operate_box {
  448. padding: 10rpx 32rpx;
  449. /deep/ .u-button {
  450. width: 40%;
  451. }
  452. }
  453. </style>