deviceBom.vue 17 KB

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