semiProductBom.vue 12 KB

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