PopSparePart.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <!-- 备品备件弹窗 -->
  3. <u-popup :show="popShow" @close="close" mode="center" class="u-popup">
  4. <view class="bpbj">
  5. <view class="title">
  6. {{ title }}
  7. </view>
  8. <view class="detail-content">
  9. <template v-if="InfoList.length > 0">
  10. <view class="col" v-for="item in InfoList" :key="item.id">
  11. <view class="tt">备件物品编码: {{ item.code }}</view>
  12. <view class="tt">备件名称: {{ item.name }}</view>
  13. <view class="tt">所属分类: 备品备件</view>
  14. <view class="tt">型号: {{ item.modelType }}</view>
  15. <view class="tt">使用数量: {{ item.packingCountBase }}</view>
  16. <!-- <view class="tt">{{ item.assetCode }}</view>
  17. {{ item.informationName }}({{ (item.specification ? item.specification : '-') + '/' + item.modelType }})
  18. <text v-if="title == '备件使用明细'">{{ item.isUnpack ? 1 : item.num }}{{ item.unit || item.measuringUnit }}</text> -->
  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. sparePartsJson: {
  40. type: Array,
  41. default() {
  42. return [null]
  43. }
  44. },
  45. noRequest: {
  46. type: Boolean,
  47. default: false
  48. },
  49. equipmentCode: {
  50. type: String,
  51. default() {
  52. return ''
  53. }
  54. }
  55. },
  56. data() {
  57. return {
  58. popShow: false,
  59. workOrderId: '',
  60. InfoList: [],
  61. title: ''
  62. }
  63. },
  64. methods: {
  65. open(value, list) {
  66. this.popShow = true
  67. this.title = value
  68. if (this.noRequest) {
  69. this.InfoList = list
  70. } else {
  71. if (value == '备件使用明细') {
  72. this.getList(workOrderCode)
  73. } else {
  74. this.getInfo(code)
  75. }
  76. }
  77. },
  78. close() {
  79. this.popShow = false
  80. this.$emit('close')
  81. },
  82. // 获取备品备件
  83. getList(workOrderCode) {
  84. let par = {
  85. sourceCode: workOrderCode || this.workOrderCode
  86. }
  87. if (this.equipmentCode) {
  88. par.equipmentCode = this.equipmentCode
  89. }
  90. postJ(this.apiUrl + `/sparePartsApply/getSparePartsExpendList`, par).then(res => {
  91. if (res?.success) {
  92. this.InfoList = res.data
  93. this.InfoList.map(item => {
  94. if (item.isUnpack) {
  95. item.num = item.unusedNum
  96. } else {
  97. item.num = item.measurementUnit - item.unusedNum
  98. }
  99. })
  100. }
  101. })
  102. },
  103. getInfo(code) {
  104. get(this.apiUrl + `/sparePartsApply/detail/${code}`).then(res => {
  105. if (res?.success) {
  106. this.InfoList = res.data.sparePartsApplyDetailList
  107. }
  108. })
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .nodata {
  115. text-align: center;
  116. padding: 30rpx 0;
  117. }
  118. .bpbj {
  119. width: 600rpx;
  120. .title {
  121. margin-bottom: 7px;
  122. background-color: #333333;
  123. text-align: center;
  124. color: #fff;
  125. padding: 10rpx 0;
  126. }
  127. .detail-content {
  128. border: 1rpx solid rgba(242, 242, 242, 1);
  129. max-height: 60vh;
  130. overflow: auto;
  131. .col {
  132. font-size: 28rpx;
  133. border-bottom: 1rpx solid rgba(242, 242, 242, 1);
  134. display: flex;
  135. padding: 10rpx;
  136. flex-wrap: wrap;
  137. align-items: center;
  138. justify-content: space-between;
  139. background-color: rgba(242, 242, 242, 0.372549019607843);
  140. .tt {
  141. width: 100%;
  142. }
  143. }
  144. .plus {
  145. width: 40rpx;
  146. height: 40rpx;
  147. line-height: 38rpx;
  148. text-align: center;
  149. background-color: $j-primary-border-green;
  150. color: #fff;
  151. margin: 16rpx 0 0 16rpx;
  152. }
  153. }
  154. /deep/.u-number-box {
  155. .u-number-box__minus,
  156. .u-number-box__plus,
  157. .u-number-box__input {
  158. font-size: 30rpx;
  159. height: 1.6em !important;
  160. }
  161. .u-number-box__input {
  162. width: 2em !important;
  163. }
  164. .u-number-box__minus,
  165. .u-number-box__plus {
  166. background-color: $j-primary-border-green !important;
  167. .u-icon__icon {
  168. color: #fff !important;
  169. }
  170. }
  171. }
  172. }
  173. </style>