deviceBom.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  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 v-if="type!=='feeding'">
  128. <view class="search_list">
  129. <u-form labelPosition="left" :model="idItem" labelWidth="200" labelAlign="left"
  130. class="baseForm">
  131. <u-form-item label="卸到周转车:" class="required-form" borderBottom prop="">
  132. <zxz-uni-data-select :localdata="unloadTurnover" v-model="idItem.unloadTurnoverId"
  133. dataValue='id' format='{name}-{code}' dataKey="id" filterable :clear='false'
  134. @change="e => changeUnloadTurnover(e, idxx, idItem)"
  135. v-if="!isDetails"></zxz-uni-data-select>
  136. <text v-else>{{ idItem.unloadTurnoverName}} </text>
  137. </u-form-item>
  138. </u-form>
  139. </view>
  140. <view class="content_table2">
  141. <view class="head row rx-sc">
  142. <view class="item ww10">货位</view>
  143. <view class="item ww25">工单编号</view>
  144. <view class="item ww25">产品编码</view>
  145. <view class="item ww20">数量</view>
  146. <view class="item ww20">投料</view>
  147. </view>
  148. <view class="table">
  149. <u-list @scrolltolower="scrolltolower" class="z_list">
  150. <view class="tr row rx-sc" v-for="(it, idx) in idItem.unloadPositionList" :key='idx'>
  151. <view class="tr row rx-sc">
  152. <view class="item ww10">
  153. {{ it.code }}
  154. </view>
  155. <view class="item ww25 "
  156. :class="{'color157': it.workOrderCode === wordItem.code}">
  157. {{ it.workOrderCode }}
  158. </view>
  159. <view class="item ww25 "
  160. :class="{'color157': it.workOrderCode === wordItem.code}">
  161. {{ it.categoryCode }}
  162. </view>
  163. <view class="item ww20 ">
  164. <text>{{ it.quantity }} </text>
  165. </view>
  166. <view class="item ww20">
  167. <input
  168. :class="['uni-input', wordItem.code == it.workOrderCode && it.quantity > 0 ? 'content_num' : '']"
  169. v-model="it.feedNum" type="digit"
  170. :disabled="it.quantity <= 0 || wordItem.code != it.workOrderCode || isDetails"
  171. @blur="Number(it.feedNum) > Number(it.quantity) ? it.feedNum = Number(it.quantity) : ''"></input>
  172. </view>
  173. </view>
  174. </view>
  175. </u-list>
  176. </view>
  177. </view>
  178. </view>
  179. </view>
  180. </template>
  181. <template v-slot:operate>
  182. <view style="margin-bottom: 10px;">
  183. 和:{{ feedingSumNum }}
  184. </view>
  185. <view class="operate_box rx-bc">
  186. <u-button size="small" class="u-reset-button" @click="handleClose" v-if="ishuoWei">
  187. 清空/取消
  188. </u-button>
  189. <u-button type="success" size="small" class="u-reset-button" @click="handleOk">
  190. 确定
  191. </u-button>
  192. </view>
  193. </template>
  194. </SearchPopup>
  195. </view>
  196. </template>
  197. <script>
  198. import SearchPopup from '../../components/searchPopup.vue'
  199. export default {
  200. components: {
  201. SearchPopup
  202. },
  203. props: {
  204. workOrderId: {
  205. type: String,
  206. default: ''
  207. },
  208. type: {
  209. type: String,
  210. default: ''
  211. },
  212. list: {
  213. type: Array,
  214. default: () => []
  215. },
  216. ishuoWei: {
  217. type: Boolean,
  218. default: true
  219. },
  220. wordItem: {
  221. type: Object,
  222. default: () => {}
  223. },
  224. turnover: {
  225. type: Array,
  226. default: () => []
  227. },
  228. isDetails: {
  229. type: Boolean,
  230. default: false
  231. }
  232. },
  233. data() {
  234. return {
  235. popupShow: false,
  236. listIndex: null,
  237. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo").clientEnvironmentId,// *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  238. turnoverList: [{
  239. name: '周转车',
  240. turnoverId: '',
  241. turnoverName: '',
  242. positionList: [],
  243. unloadTurnoverId: '',
  244. unloadTurnoverName: '',
  245. unloadPositionList: []
  246. }],
  247. unloadTurnover: [],
  248. feedingSumNum: 0,
  249. tabAct: 0
  250. }
  251. },
  252. created() {
  253. },
  254. methods: {
  255. handleScan(id) {
  256. this.$emit('scanIt', id, )
  257. },
  258. getDelete(idx) {
  259. this.list.splice(idx, 1)
  260. },
  261. handleStorage(idx) {
  262. this.listIndex = idx || 0
  263. this.feedingSumNum = 0;
  264. if (Object.prototype.hasOwnProperty.call(this.list[0].extInfo, 'turnoverList')) {
  265. this.unloadTurnover = this.turnover
  266. this.turnoverList = JSON.parse(JSON.stringify(this.list[0].extInfo.turnoverList)) || this.turnoverList
  267. }
  268. console.log(this.turnoverList,'this.turnoverList');
  269. this.turnoverList.forEach(v=>{
  270. v.positionList.forEach(d=>{
  271. if(d.feedNum){
  272. this.feedingSumNum += Number(d.feedNum)
  273. }
  274. })
  275. })
  276. this.popupShow = true
  277. },
  278. handleClose() {
  279. // this.list[this.listIndex].extInfo.turnoverList = []
  280. this.popupShow = false
  281. this.listIndex = 0
  282. },
  283. handleOk() {
  284. this.listIndex = 0
  285. this.$set(this.list[this.listIndex].extInfo, 'turnoverList', this.turnoverList)
  286. this.popupShow = false
  287. },
  288. scrolltolower() {},
  289. changeTurnover(e, idxx) {
  290. let _arr = e.extInfo.positionList || []
  291. console.log(_arr)
  292. let isFalse = _arr.some(it => {
  293. return it.workOrderCode == this.wordItem.code && it.categoryCode == this.wordItem
  294. .productCode && it.quantity > 0
  295. })
  296. if (!isFalse) {
  297. uni.showToast({
  298. title: "该周转车没有此工单",
  299. icon: "none",
  300. })
  301. this.$set(this.turnoverList[idxx], 'turnoverId', '')
  302. this.$set(this.turnoverList[idxx], 'turnoverName', '')
  303. this.$set(this.turnoverList[idxx], 'positionList', [])
  304. return false
  305. }
  306. this.$set(this.turnoverList[idxx], 'turnoverName', e.name + '-' + e.code)
  307. this.$set(this.turnoverList[idxx], 'positionList', JSON.parse(JSON.stringify(e.extInfo.positionList)))
  308. this.$forceUpdate()
  309. },
  310. handTabAdd() {
  311. if (this.turnover.length <= this.turnoverList.length) {
  312. uni.showToast({
  313. title: "超过最大周转车数",
  314. icon: "none",
  315. })
  316. return false
  317. }
  318. this.turnoverList.push({
  319. name: '周转车',
  320. turnoverId: '',
  321. turnoverName: '',
  322. positionList: []
  323. })
  324. console.log(this.list[this.listIndex].extInfo)
  325. this.$forceUpdate()
  326. },
  327. handTab(idxx) {
  328. this.tabAct = idxx
  329. },
  330. handDel(idx) {
  331. if (this.turnoverList.length <= 1) {
  332. uni.showToast({
  333. title: "最少需要一个周转车",
  334. icon: "none",
  335. })
  336. return
  337. }
  338. this.turnoverList.splice(idx, 1)
  339. },
  340. changeUnloadTurnover(e, idxx, idItem) {
  341. let _arr = idItem.positionList
  342. let unloadArr = e.extInfo.positionList || []
  343. for (let obj1 of unloadArr) {
  344. for (let obj2 of _arr) {
  345. if (obj1.code === obj2.code && obj2.workOrderCode === this.wordItem.code && !obj1.workOrderCode && !obj1.quantity) {
  346. obj1.workOrderCode = obj2.workOrderCode;
  347. obj1.categoryCode = obj2.categoryCode;
  348. obj1.quantity = obj2.quantity;
  349. obj1.feedNum = obj2.feedNum;
  350. break;
  351. }
  352. }
  353. }
  354. this.$set(this.turnoverList[idxx], 'unloadTurnoverName', e.name + '-' + e.code)
  355. this.$set(this.turnoverList[idxx], 'unloadPositionList', JSON.parse(JSON.stringify(unloadArr)))
  356. this.$forceUpdate()
  357. },
  358. }
  359. }
  360. </script>
  361. <style lang="scss" scoped>
  362. .title_box {
  363. margin-top: 20rpx;
  364. .name {
  365. font-size: 28rpx;
  366. font-style: normal;
  367. font-weight: 400;
  368. color: $theme-color;
  369. padding-left: 20rpx;
  370. position: relative;
  371. &:before {
  372. position: absolute;
  373. content: '';
  374. left: 0rpx;
  375. top: 0rpx;
  376. bottom: 0rpx;
  377. width: 4rpx;
  378. height: 28rpx;
  379. background: $theme-color;
  380. margin: auto;
  381. }
  382. }
  383. .btn_box {
  384. padding: 0 18rpx;
  385. height: 60rpx;
  386. background: $theme-color;
  387. font-size: 26rpx;
  388. font-style: normal;
  389. font-weight: 400;
  390. font-size: 24rpx;
  391. color: #fff;
  392. border-radius: 4rpx;
  393. .scan {
  394. width: 34rpx;
  395. height: 34rpx;
  396. margin-right: 12rpx;
  397. }
  398. }
  399. }
  400. .material {
  401. margin-top: 10rpx;
  402. .content_table {
  403. width: 674rpx;
  404. border: 2rpx solid $border-color;
  405. margin-bottom: 10rpx;
  406. .item {
  407. display: flex;
  408. border-bottom: 2rpx solid $border-color;
  409. .lable {
  410. width: 132rpx;
  411. text-align: center;
  412. background-color: #F7F9FA;
  413. font-size: 26rpx;
  414. border-right: 2rpx solid $border-color;
  415. flex-shrink: 0;
  416. }
  417. .lable150 {
  418. width: 156rpx !important;
  419. font-size: 24rpx;
  420. }
  421. .ww80 {
  422. width: 80rpx;
  423. }
  424. .content {
  425. width: 518rpx;
  426. min-height: 64rpx;
  427. font-size: 28rpx;
  428. line-height: 28rpx;
  429. font-style: normal;
  430. font-weight: 400;
  431. padding: 18rpx 8rpx;
  432. box-sizing: border-box;
  433. word-wrap: break-word;
  434. flex-grow: 1 !important;
  435. .unit {
  436. padding: 0 4rpx;
  437. font-size: 24rpx;
  438. color: #404446;
  439. }
  440. }
  441. .pd4 {
  442. padding: 4rpx 8rpx;
  443. }
  444. &:last-child {
  445. border-bottom: none;
  446. }
  447. }
  448. .ww50 {
  449. width: 50%;
  450. }
  451. .ww55 {
  452. width: 55%;
  453. }
  454. .ww45 {
  455. width: 45%;
  456. }
  457. }
  458. }
  459. .search_list {
  460. min-height: 100rpx;
  461. width: 96vw;
  462. padding: 0 8rpx;
  463. /deep/ .u-form-item__body {
  464. padding: 6rpx 0rpx !important;
  465. }
  466. }
  467. .content_table2 {
  468. width: 100%;
  469. margin-top: 6rpx;
  470. .row {
  471. width: 100%;
  472. .item {
  473. color: #404446;
  474. font-size: 28rpx;
  475. padding-left: 12rpx;
  476. padding-right: 6rpx;
  477. }
  478. .color157 {
  479. color: $theme-color;
  480. }
  481. .ww20 {
  482. width: 20%;
  483. }
  484. .ww25 {
  485. width: 25%;
  486. }
  487. .ww35 {
  488. width: 35%;
  489. }
  490. .ww10 {
  491. width: 10%;
  492. }
  493. }
  494. .head {
  495. height: 64rpx;
  496. background: #F7F9FA;
  497. border-top: 2rpx solid #E3E5E5;
  498. border-left: 2rpx solid #E3E5E5;
  499. box-sizing: border-box;
  500. .item {
  501. height: 64rpx;
  502. line-height: 64rpx;
  503. border-right: 2rpx solid #E3E5E5;
  504. box-sizing: border-box;
  505. font-size: 24rpx;
  506. }
  507. }
  508. .tr {
  509. border-top: 2rpx solid #E3E5E5;
  510. border-left: 2rpx solid #E3E5E5;
  511. box-sizing: border-box;
  512. .item {
  513. font-size: 24rpx;
  514. min-height: 64rpx;
  515. display: flex;
  516. align-items: center;
  517. border-right: 2rpx solid #E3E5E5;
  518. box-sizing: border-box;
  519. white-space: normal;
  520. word-break: break-all;
  521. }
  522. &:last-child {
  523. border-bottom: 2rpx solid #E3E5E5;
  524. }
  525. }
  526. }
  527. .z_list {
  528. max-height: 350rpx;
  529. }
  530. .z_list2 {
  531. max-height: 700rpx;
  532. }
  533. .content_num {
  534. display: flex;
  535. align-items: center;
  536. padding: 0 4rpx;
  537. /deep/ .uni-input-input {
  538. border: 2rpx solid #F0F8F2;
  539. background: #F0F8F2;
  540. color: $theme-color;
  541. }
  542. }
  543. .tab_box {
  544. margin-top: 14rpx;
  545. margin-left: 8rpx;
  546. display: flex;
  547. align-items: center;
  548. .tab_item {
  549. display: flex;
  550. padding: 0 6rpx;
  551. height: 48rpx;
  552. line-height: 48rpx;
  553. width: 138rpx;
  554. text-align: center;
  555. background: #157A2C;
  556. font-style: normal;
  557. font-weight: 400;
  558. font-size: 24rpx;
  559. color: #fff;
  560. border-radius: 4rpx;
  561. margin-right: 8rpx;
  562. }
  563. .tab_add {
  564. color: #157A2C;
  565. font-size: 34rpx;
  566. }
  567. }
  568. </style>