instanceBom.vue 11 KB

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