deviceBom.vue 12 KB

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