instanceBom.vue 10 KB

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