instanceBom.vue 10 KB

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