deviceBom.vue 11 KB

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