instanceBom.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name">物料清单</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. }
  200. })
  201. this.$forceUpdate()
  202. this.deviceClose()
  203. },
  204. deviceClose() {
  205. this.formData.deviceName = null
  206. this.formData.deviceId = null
  207. this.deviveShow = false
  208. },
  209. }
  210. }
  211. </script>
  212. <style lang="scss" scoped>
  213. .title_box {
  214. margin-top: 20rpx;
  215. .name {
  216. font-size: 28rpx;
  217. font-style: normal;
  218. font-weight: 400;
  219. color: $theme-color;
  220. padding-left: 20rpx;
  221. position: relative;
  222. &:before {
  223. position: absolute;
  224. content: '';
  225. left: 0rpx;
  226. top: 0rpx;
  227. bottom: 0rpx;
  228. width: 4rpx;
  229. height: 28rpx;
  230. background: $theme-color;
  231. margin: auto;
  232. }
  233. }
  234. .btn_box {
  235. padding: 0 18rpx;
  236. height: 48rpx;
  237. background: $theme-color;
  238. font-size: 26rpx;
  239. font-style: normal;
  240. font-weight: 400;
  241. font-size: 24rpx;
  242. color: #fff;
  243. border-radius: 4rpx;
  244. .scan {
  245. width: 34rpx;
  246. height: 34rpx;
  247. margin-right: 12rpx;
  248. }
  249. }
  250. }
  251. .material {
  252. margin-top: 10rpx;
  253. .left {
  254. width: 40rpx;
  255. }
  256. .zdy_check {
  257. width: 30rpx;
  258. height: 30rpx;
  259. border: 2rpx solid #c8c9cc;
  260. border-radius: 4rpx;
  261. }
  262. .check_active {
  263. background: $theme-color;
  264. border: 2rpx solid $theme-color;
  265. /deep/ .u-icon__icon {
  266. color: #fff !important;
  267. }
  268. }
  269. .content_table {
  270. width: 680rpx;
  271. border: 2rpx solid $border-color;
  272. .item {
  273. display: flex;
  274. border-bottom: 2rpx solid $border-color;
  275. .lable {
  276. width: 132rpx;
  277. text-align: center;
  278. background-color: #F7F9FA;
  279. font-size: 26rpx;
  280. border-right: 2rpx solid $border-color;
  281. flex-shrink: 0;
  282. }
  283. .ww80 {
  284. width: 80rpx;
  285. }
  286. .content {
  287. width: 518rpx;
  288. min-height: 64rpx;
  289. font-size: 28rpx;
  290. line-height: 28rpx;
  291. font-style: normal;
  292. font-weight: 400;
  293. padding: 18rpx 8rpx;
  294. box-sizing: border-box;
  295. word-wrap: break-word;
  296. flex-grow: 1 !important;
  297. }
  298. .content_num {
  299. display: flex;
  300. align-items: center;
  301. padding: 0 4rpx;
  302. /deep/ .uni-input-input {
  303. width: 200rpx;
  304. border: 2rpx solid #F0F8F2;
  305. background: #F0F8F2;
  306. color: $theme-color;
  307. }
  308. .unit {
  309. padding: 0 4rpx;
  310. font-size: 24rpx;
  311. color: #404446;
  312. }
  313. }
  314. .ww400 {
  315. /deep/ .uni-input-input {
  316. width: 400rpx;
  317. }
  318. }
  319. .pd4 {
  320. padding: 4rpx 8rpx;
  321. }
  322. &:last-child {
  323. border-bottom: none;
  324. }
  325. }
  326. .ww55 {
  327. width: 55%;
  328. }
  329. .ww45 {
  330. width: 45%;
  331. }
  332. .ww50 {
  333. width: 50%;
  334. }
  335. .ww80 {
  336. width: 80%;
  337. }
  338. .ww20 {
  339. width: 20%;
  340. }
  341. .check {
  342. width: 30rpx;
  343. height: 30rpx;
  344. }
  345. }
  346. }
  347. .z_list {
  348. max-height: 2000rpx;
  349. }
  350. .search_list {
  351. min-height: 100rpx;
  352. width: 90vw;
  353. /deep/ .baseForm {
  354. padding: 0 20rpx;
  355. }
  356. }
  357. .operate_box {
  358. padding: 10rpx 32rpx;
  359. /deep/ .u-button {
  360. width: 40%;
  361. }
  362. }
  363. </style>