instanceBom.vue 11 KB

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