semiProductBom.vue 12 KB

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