deviceBom.vue 12 KB

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