deviceBom.vue 12 KB

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