instanceBom.vue 9.5 KB

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