PopSparePart.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <!-- 备品备件弹窗 -->
  3. <u-popup :show="popShow" @close="close" mode="center" class="u-popup">
  4. <view class="bpbj">
  5. <view class="title"> 备件使用明细 </view>
  6. <view class="detail-content">
  7. <template v-if="InfoList.length > 0">
  8. <view class="col" v-for="item in InfoList" :key="item.id">
  9. <view class="tt">{{ item.assetCode }}</view>
  10. {{ item.informationName }}({{
  11. (item.specification ? item.specification : '-') +
  12. '/' +
  13. item.modelType
  14. }})
  15. <text
  16. >{{ item.isUnpack ? 1 : item.num
  17. }}{{ item.unit || item.measuringUnit }}</text
  18. >
  19. </view>
  20. </template>
  21. <view class="nodata" v-else> 暂无数据 </view>
  22. </view>
  23. <view class="close" @click="close">
  24. <u-button text="关闭"></u-button>
  25. </view>
  26. </view>
  27. </u-popup>
  28. </template>
  29. <script>
  30. import { post, postJ, get } from '@/utils/api.js'
  31. export default {
  32. props: {
  33. workOrderCode: {
  34. type: String,
  35. default () {
  36. return ''
  37. }
  38. },
  39. equipmentCode: {
  40. type: String,
  41. default () {
  42. return ''
  43. }
  44. }
  45. },
  46. data () {
  47. return {
  48. popShow: false,
  49. workOrderId: '',
  50. InfoList: [],
  51. title: ''
  52. }
  53. },
  54. methods: {
  55. open (value, code) {
  56. this.popShow = true
  57. this.InfoList = JSON.parse(
  58. this.$store.state.maintenance.sparePartsJson || '[]'
  59. )
  60. console.log(this.InfoList)
  61. // this.getList()
  62. },
  63. close () {
  64. this.popShow = false
  65. },
  66. // 获取备品备件
  67. getList () {
  68. let par = {
  69. sourceCode: this.workOrderCode,
  70. equipmentCode: this.equipmentCode
  71. }
  72. postJ(this.apiUrl + `/sparePartsApply/getSparePartsExpend`, par).then(
  73. res => {
  74. if (res?.success) {
  75. this.InfoList = res.data
  76. this.InfoList.map(item => {
  77. item.num = 1
  78. })
  79. }
  80. }
  81. )
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .nodata {
  88. text-align: center;
  89. padding: 30rpx 0;
  90. }
  91. .bpbj {
  92. width: 600rpx;
  93. .title {
  94. margin-bottom: 7px;
  95. background-color: #333333;
  96. text-align: center;
  97. color: #fff;
  98. padding: 10rpx 0;
  99. }
  100. .detail-content {
  101. border: 1rpx solid rgba(242, 242, 242, 1);
  102. max-height: 60vh;
  103. overflow: auto;
  104. .col {
  105. font-size: 28rpx;
  106. border-bottom: 1rpx solid rgba(242, 242, 242, 1);
  107. display: flex;
  108. padding: 10rpx;
  109. flex-wrap: wrap;
  110. align-items: center;
  111. justify-content: space-between;
  112. background-color: rgba(242, 242, 242, 0.372549019607843);
  113. .tt {
  114. width: 100%;
  115. }
  116. }
  117. .plus {
  118. width: 40rpx;
  119. height: 40rpx;
  120. line-height: 38rpx;
  121. text-align: center;
  122. background-color: $j-primary-border-green;
  123. color: #fff;
  124. margin: 16rpx 0 0 16rpx;
  125. }
  126. }
  127. /deep/.u-number-box {
  128. .u-number-box__minus,
  129. .u-number-box__plus,
  130. .u-number-box__input {
  131. font-size: 30rpx;
  132. height: 1.6em !important;
  133. }
  134. .u-number-box__input {
  135. width: 2em !important;
  136. }
  137. .u-number-box__minus,
  138. .u-number-box__plus {
  139. background-color: $j-primary-border-green !important;
  140. .u-icon__icon {
  141. color: #fff !important;
  142. }
  143. }
  144. }
  145. }
  146. </style>