semiProductBom.vue 11 KB

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