deviceBom.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name">设备信息</view>
  5. <view class="btn_box rx-bc" @click="handleScan(workOrderId)" v-if='workOrderId'>
  6. <image class="scan" src="@/static/pda/ScanIt.svg"></image>
  7. 更换设备
  8. </view>
  9. </view>
  10. <u-list @scrolltolower="scrolltolower" class="z_list2">
  11. <view class="material rx-ss" v-for="(item, index) in list" :key='index'>
  12. <view class="left rx-ss" @click="getDelete(index)" v-if='workOrderId'>
  13. <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
  14. </view>
  15. <view class="content_table">
  16. <view class="item">
  17. <view class="lable rx-cc">工位名称</view>
  18. <view class="content">
  19. {{ item.workstationName || (item.extInfo && item.extInfo.workstationName) }}
  20. </view>
  21. </view>
  22. <view class="item">
  23. <view class="lable rx-cc">设备编码</view>
  24. <view class="content">
  25. {{ item.code }}
  26. </view>
  27. </view>
  28. <view class="item">
  29. <view class="lable rx-cc">设备名称</view>
  30. <view class="content">{{ item.name }}</view>
  31. </view>
  32. <view class="item rx-sc">
  33. <view class="rx ww50">
  34. <view class="lable rx-cc">固资编码</view>
  35. <view class="content">{{ item.extInfo.fixCode }} </view>
  36. </view>
  37. <view class="rx ww50">
  38. <view class="lable ww80 rx-cc">编号</view>
  39. <view class="content">{{ item.extInfo.codeNumber }}</view>
  40. </view>
  41. </view>
  42. <view class="item">
  43. <view class="lable rx-cc">炉次号</view>
  44. <view class="content content_num">
  45. <input class="uni-input" v-model="item.extInfo.heatNumber"></input>
  46. </view>
  47. <view v-if="clientEnvironmentId == 2" class="lable rx-cc"
  48. :style="Object.prototype.hasOwnProperty.call(item.extInfo, 'turnoverList') && item.extInfo.turnoverList.length > 0 ? 'color: #E6A23C' : 'color: #157A2C'"
  49. @click="handleStorage(index)">货位</view>
  50. </view>
  51. <view class="item"
  52. v-if="clientEnvironmentId == 2 && Object.prototype.hasOwnProperty.call(item, 'equipmentLabelJson') && item.equipmentLabelJson.length != 0 && item.equipmentLabelJson[0].SBFL == 1">
  53. <view class="lable rx-cc">是否封炉</view>
  54. <view class="content">
  55. <u-checkbox-group v-model="item.isSBFL" size="15px">
  56. <u-checkbox labelSize="15px" iconSize="10px" activeColor="#157A2C" name="true"
  57. label="是"></u-checkbox>
  58. </u-checkbox-group>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </u-list>
  64. <SearchPopup mode="center" v-if='popupShow'>
  65. <template v-slot:list>
  66. <view class="tab_box">
  67. <view class="tab_item" :style="tabAct == idxx ? 'color: #E6A23C' : ''"
  68. v-for="(idItem, idxx) in turnoverList" :key="idxx" @click="handTab(idxx)">
  69. {{ idItem.name }}{{ idxx + 1 }}
  70. <uni-icons style="margin-left: 10rpx;" custom-prefix="iconfont" @click.native="handDel(idxx)"
  71. v-if="!isDetails" type="icon-shanchu" size="16" color="#fa3534"></uni-icons>
  72. </view>
  73. <view class="tab_add" @click="handTabAdd()" v-if="!isDetails">新增</view>
  74. </view>
  75. <view v-for="(idItem, idxx) in turnoverList" :key="idxx" v-show="tabAct == idxx">
  76. <view class="search_list">
  77. <u-form labelPosition="left" :model="idItem" labelWidth="160" labelAlign="left"
  78. class="baseForm">
  79. <u-form-item label="周转车:" class="required-form" borderBottom prop="">
  80. <zxz-uni-data-select :localdata="turnover" v-model="idItem.turnoverId" dataValue='id'
  81. format='{name}-{code}' dataKey="id" filterable :clear='false'
  82. @change="e => changeTurnover(e, idxx)" v-if="!isDetails"></zxz-uni-data-select>
  83. <text v-else>{{ idItem.turnoverName}} </text>
  84. </u-form-item>
  85. </u-form>
  86. </view>
  87. <view class="content_table2">
  88. <view class="head row rx-sc">
  89. <view class="item ww10">货位</view>
  90. <view class="item ww25">工单编号</view>
  91. <view class="item ww25">产品编码</view>
  92. <view class="item ww20">数量</view>
  93. <view class="item ww20">投料</view>
  94. </view>
  95. <view class="table">
  96. <u-list @scrolltolower="scrolltolower" class="z_list">
  97. <view class="tr row rx-sc" v-for="(it, idx) in idItem.positionList" :key='idx'>
  98. <view class="tr row rx-sc">
  99. <view class="item ww10">
  100. {{ it.code }}
  101. </view>
  102. <view class="item ww25 "
  103. :class="{'color157': it.workOrderCode === wordItem.code}">
  104. {{ it.workOrderCode }}
  105. </view>
  106. <view class="item ww25 "
  107. :class="{'color157': it.workOrderCode === wordItem.code}">
  108. {{ it.categoryCode }}
  109. </view>
  110. <view class="item ww20 ">
  111. <text>{{ it.quantity }} </text>
  112. </view>
  113. <view class="item ww20">
  114. <input
  115. :class="['uni-input', wordItem.code == it.workOrderCode && it.quantity > 0 ? 'content_num' : '']"
  116. v-model="it.feedNum" type="digit"
  117. :disabled="it.quantity <= 0 || wordItem.code != it.workOrderCode || isDetails"
  118. @blur="Number(it.feedNum) > Number(it.quantity) ? it.feedNum = Number(it.quantity) : ''"></input>
  119. </view>
  120. </view>
  121. </view>
  122. </u-list>
  123. </view>
  124. </view>
  125. <u-line color="#2979ff" style="margin: 16rpx 0;"></u-line>
  126. <!-- 卸车 -->
  127. <view class="search_list">
  128. <u-form labelPosition="left" :model="idItem" labelWidth="200" labelAlign="left"
  129. class="baseForm">
  130. <u-form-item label="卸到周转车:" class="required-form" borderBottom prop="">
  131. <zxz-uni-data-select :localdata="unloadTurnover" v-model="idItem.unloadTurnoverId"
  132. dataValue='id' format='{name}-{code}' dataKey="id" filterable :clear='false'
  133. @change="e => changeUnloadTurnover(e, idxx, idItem)"
  134. v-if="!isDetails"></zxz-uni-data-select>
  135. <text v-else>{{ idItem.unloadTurnoverName}} </text>
  136. </u-form-item>
  137. </u-form>
  138. </view>
  139. <view class="content_table2">
  140. <view class="head row rx-sc">
  141. <view class="item ww10">货位</view>
  142. <view class="item ww25">工单编号</view>
  143. <view class="item ww25">产品编码</view>
  144. <view class="item ww20">数量</view>
  145. <view class="item ww20">投料</view>
  146. </view>
  147. <view class="table">
  148. <u-list @scrolltolower="scrolltolower" class="z_list">
  149. <view class="tr row rx-sc" v-for="(it, idx) in idItem.unloadPositionList" :key='idx'>
  150. <view class="tr row rx-sc">
  151. <view class="item ww10">
  152. {{ it.code }}
  153. </view>
  154. <view class="item ww25 "
  155. :class="{'color157': it.workOrderCode === wordItem.code}">
  156. {{ it.workOrderCode }}
  157. </view>
  158. <view class="item ww25 "
  159. :class="{'color157': it.workOrderCode === wordItem.code}">
  160. {{ it.categoryCode }}
  161. </view>
  162. <view class="item ww20 ">
  163. <text>{{ it.quantity }} </text>
  164. </view>
  165. <view class="item ww20">
  166. <input
  167. :class="['uni-input', wordItem.code == it.workOrderCode && it.quantity > 0 ? 'content_num' : '']"
  168. v-model="it.feedNum" type="digit"
  169. :disabled="it.quantity <= 0 || wordItem.code != it.workOrderCode || isDetails"
  170. @blur="Number(it.feedNum) > Number(it.quantity) ? it.feedNum = Number(it.quantity) : ''"></input>
  171. </view>
  172. </view>
  173. </view>
  174. </u-list>
  175. </view>
  176. </view>
  177. </view>
  178. </template>
  179. <template v-slot:operate>
  180. <view class="operate_box rx-bc">
  181. <u-button size="small" class="u-reset-button" @click="handleClose" v-if="ishuoWei">
  182. 清空/取消
  183. </u-button>
  184. <u-button type="success" size="small" class="u-reset-button" @click="handleOk">
  185. 确定
  186. </u-button>
  187. </view>
  188. </template>
  189. </SearchPopup>
  190. </view>
  191. </template>
  192. <script>
  193. import SearchPopup from '../../components/searchPopup.vue'
  194. export default {
  195. components: {
  196. SearchPopup
  197. },
  198. props: {
  199. workOrderId: {
  200. type: String,
  201. default: ''
  202. },
  203. list: {
  204. type: Array,
  205. default: () => []
  206. },
  207. ishuoWei: {
  208. type: Boolean,
  209. default: true
  210. },
  211. wordItem: {
  212. type: Object,
  213. default: () => {}
  214. },
  215. turnover: {
  216. type: Array,
  217. default: () => []
  218. },
  219. isDetails: {
  220. type: Boolean,
  221. default: false
  222. }
  223. },
  224. data() {
  225. return {
  226. popupShow: false,
  227. listIndex: null,
  228. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo").clientEnvironmentId,
  229. turnoverList: [{
  230. name: '周转车',
  231. turnoverId: '',
  232. turnoverName: '',
  233. positionList: [],
  234. unloadTurnoverId: '',
  235. unloadTurnoverName: '',
  236. unloadPositionList: []
  237. }],
  238. unloadTurnover: [],
  239. tabAct: 0
  240. }
  241. },
  242. created() {
  243. },
  244. methods: {
  245. handleScan(id) {
  246. this.$emit('scanIt', id, )
  247. },
  248. getDelete(idx) {
  249. this.list.splice(idx, 1)
  250. },
  251. handleStorage(idx) {
  252. this.listIndex = idx || 0
  253. if (Object.prototype.hasOwnProperty.call(this.list[0].extInfo, 'turnoverList')) {
  254. this.unloadTurnover = this.turnover
  255. this.turnoverList = JSON.parse(JSON.stringify(this.list[0].extInfo.turnoverList)) || this.turnoverList
  256. }
  257. this.popupShow = true
  258. },
  259. handleClose() {
  260. // this.list[this.listIndex].extInfo.turnoverList = []
  261. this.popupShow = false
  262. this.listIndex = 0
  263. },
  264. handleOk() {
  265. this.listIndex = 0
  266. this.$set(this.list[this.listIndex].extInfo, 'turnoverList', this.turnoverList)
  267. this.popupShow = false
  268. },
  269. scrolltolower() {},
  270. changeTurnover(e, idxx) {
  271. let _arr = e.extInfo.positionList || []
  272. console.log(_arr)
  273. let isFalse = _arr.some(it => {
  274. return it.workOrderCode == this.wordItem.code && it.categoryCode == this.wordItem
  275. .productCode && it.quantity > 0
  276. })
  277. if (!isFalse) {
  278. uni.showToast({
  279. title: "该周转车没有此工单",
  280. icon: "none",
  281. })
  282. this.$set(this.turnoverList[idxx], 'turnoverId', '')
  283. this.$set(this.turnoverList[idxx], 'turnoverName', '')
  284. this.$set(this.turnoverList[idxx], 'positionList', [])
  285. return false
  286. }
  287. this.$set(this.turnoverList[idxx], 'turnoverName', e.name + '-' + e.code)
  288. this.$set(this.turnoverList[idxx], 'positionList', JSON.parse(JSON.stringify(e.extInfo.positionList)))
  289. this.$forceUpdate()
  290. },
  291. handTabAdd() {
  292. if (this.turnover.length <= this.turnoverList.length) {
  293. uni.showToast({
  294. title: "超过最大周转车数",
  295. icon: "none",
  296. })
  297. return false
  298. }
  299. this.turnoverList.push({
  300. name: '周转车',
  301. turnoverId: '',
  302. turnoverName: '',
  303. positionList: []
  304. })
  305. console.log(this.list[this.listIndex].extInfo)
  306. this.$forceUpdate()
  307. },
  308. handTab(idxx) {
  309. this.tabAct = idxx
  310. },
  311. handDel(idx) {
  312. if (this.turnoverList.length <= 1) {
  313. uni.showToast({
  314. title: "最少需要一个周转车",
  315. icon: "none",
  316. })
  317. return
  318. }
  319. this.turnoverList.splice(idx, 1)
  320. },
  321. changeUnloadTurnover(e, idxx, idItem) {
  322. let _arr = idItem.positionList
  323. let unloadArr = e.extInfo.positionList || []
  324. for (let obj1 of unloadArr) {
  325. for (let obj2 of _arr) {
  326. if (obj1.code === obj2.code && obj2.workOrderCode === this.wordItem.code && !obj1.workOrderCode && !obj1.quantity) {
  327. obj1.workOrderCode = obj2.workOrderCode;
  328. obj1.categoryCode = obj2.categoryCode;
  329. obj1.quantity = obj2.quantity;
  330. obj1.feedNum = obj2.feedNum;
  331. break;
  332. }
  333. }
  334. }
  335. this.$set(this.turnoverList[idxx], 'unloadTurnoverName', e.name + '-' + e.code)
  336. this.$set(this.turnoverList[idxx], 'unloadPositionList', JSON.parse(JSON.stringify(unloadArr)))
  337. this.$forceUpdate()
  338. },
  339. }
  340. }
  341. </script>
  342. <style lang="scss" scoped>
  343. .title_box {
  344. margin-top: 20rpx;
  345. .name {
  346. font-size: 28rpx;
  347. font-style: normal;
  348. font-weight: 400;
  349. color: $theme-color;
  350. padding-left: 20rpx;
  351. position: relative;
  352. &:before {
  353. position: absolute;
  354. content: '';
  355. left: 0rpx;
  356. top: 0rpx;
  357. bottom: 0rpx;
  358. width: 4rpx;
  359. height: 28rpx;
  360. background: $theme-color;
  361. margin: auto;
  362. }
  363. }
  364. .btn_box {
  365. padding: 0 18rpx;
  366. height: 60rpx;
  367. background: $theme-color;
  368. font-size: 26rpx;
  369. font-style: normal;
  370. font-weight: 400;
  371. font-size: 24rpx;
  372. color: #fff;
  373. border-radius: 4rpx;
  374. .scan {
  375. width: 34rpx;
  376. height: 34rpx;
  377. margin-right: 12rpx;
  378. }
  379. }
  380. }
  381. .material {
  382. margin-top: 10rpx;
  383. .content_table {
  384. width: 674rpx;
  385. border: 2rpx solid $border-color;
  386. margin-bottom: 10rpx;
  387. .item {
  388. display: flex;
  389. border-bottom: 2rpx solid $border-color;
  390. .lable {
  391. width: 132rpx;
  392. text-align: center;
  393. background-color: #F7F9FA;
  394. font-size: 26rpx;
  395. border-right: 2rpx solid $border-color;
  396. flex-shrink: 0;
  397. }
  398. .lable150 {
  399. width: 156rpx !important;
  400. font-size: 24rpx;
  401. }
  402. .ww80 {
  403. width: 80rpx;
  404. }
  405. .content {
  406. width: 518rpx;
  407. min-height: 64rpx;
  408. font-size: 28rpx;
  409. line-height: 28rpx;
  410. font-style: normal;
  411. font-weight: 400;
  412. padding: 18rpx 8rpx;
  413. box-sizing: border-box;
  414. word-wrap: break-word;
  415. flex-grow: 1 !important;
  416. .unit {
  417. padding: 0 4rpx;
  418. font-size: 24rpx;
  419. color: #404446;
  420. }
  421. }
  422. .pd4 {
  423. padding: 4rpx 8rpx;
  424. }
  425. &:last-child {
  426. border-bottom: none;
  427. }
  428. }
  429. .ww50 {
  430. width: 50%;
  431. }
  432. .ww55 {
  433. width: 55%;
  434. }
  435. .ww45 {
  436. width: 45%;
  437. }
  438. }
  439. }
  440. .search_list {
  441. min-height: 100rpx;
  442. width: 96vw;
  443. padding: 0 8rpx;
  444. /deep/ .u-form-item__body {
  445. padding: 6rpx 0rpx !important;
  446. }
  447. }
  448. .content_table2 {
  449. width: 100%;
  450. margin-top: 6rpx;
  451. .row {
  452. width: 100%;
  453. .item {
  454. color: #404446;
  455. font-size: 28rpx;
  456. padding-left: 12rpx;
  457. padding-right: 6rpx;
  458. }
  459. .color157 {
  460. color: $theme-color;
  461. }
  462. .ww20 {
  463. width: 20%;
  464. }
  465. .ww25 {
  466. width: 25%;
  467. }
  468. .ww35 {
  469. width: 35%;
  470. }
  471. .ww10 {
  472. width: 10%;
  473. }
  474. }
  475. .head {
  476. height: 64rpx;
  477. background: #F7F9FA;
  478. border-top: 2rpx solid #E3E5E5;
  479. border-left: 2rpx solid #E3E5E5;
  480. box-sizing: border-box;
  481. .item {
  482. height: 64rpx;
  483. line-height: 64rpx;
  484. border-right: 2rpx solid #E3E5E5;
  485. box-sizing: border-box;
  486. font-size: 24rpx;
  487. }
  488. }
  489. .tr {
  490. border-top: 2rpx solid #E3E5E5;
  491. border-left: 2rpx solid #E3E5E5;
  492. box-sizing: border-box;
  493. .item {
  494. font-size: 24rpx;
  495. min-height: 64rpx;
  496. display: flex;
  497. align-items: center;
  498. border-right: 2rpx solid #E3E5E5;
  499. box-sizing: border-box;
  500. white-space: normal;
  501. word-break: break-all;
  502. }
  503. &:last-child {
  504. border-bottom: 2rpx solid #E3E5E5;
  505. }
  506. }
  507. }
  508. .z_list {
  509. max-height: 350rpx;
  510. }
  511. .z_list2 {
  512. max-height: 700rpx;
  513. }
  514. .content_num {
  515. display: flex;
  516. align-items: center;
  517. padding: 0 4rpx;
  518. /deep/ .uni-input-input {
  519. border: 2rpx solid #F0F8F2;
  520. background: #F0F8F2;
  521. color: $theme-color;
  522. }
  523. }
  524. .tab_box {
  525. margin-top: 14rpx;
  526. margin-left: 8rpx;
  527. display: flex;
  528. align-items: center;
  529. .tab_item {
  530. display: flex;
  531. padding: 0 6rpx;
  532. height: 48rpx;
  533. line-height: 48rpx;
  534. width: 138rpx;
  535. text-align: center;
  536. background: #157A2C;
  537. font-style: normal;
  538. font-weight: 400;
  539. font-size: 24rpx;
  540. color: #fff;
  541. border-radius: 4rpx;
  542. margin-right: 8rpx;
  543. }
  544. .tab_add {
  545. color: #157A2C;
  546. font-size: 34rpx;
  547. }
  548. }
  549. </style>