instanceBom.vue 9.1 KB

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