PopSparePart.vue 4.1 KB

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