deviceBom.vue 11 KB

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