semiProductBom.vue 13 KB

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