PopSparePart copy.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <!-- 备品备件弹窗 -->
  3. <u-popup :show="popShow" @close="close" mode="bottom" class="u-popup">
  4. <view class="bpbj">
  5. <view class="title"> 备件登记 </view>
  6. <!-- <view>
  7. <uni-easyinput v-model="searchKey"></uni-easyinput>
  8. </view> -->
  9. <view class="detail-content">
  10. <template v-if="InfoList.length > 0">
  11. <view class="col" v-for="item in InfoList" :key="item.id">
  12. <checkbox-group
  13. @change="e => (item.checked = e.detail.value[0] === '1')"
  14. >
  15. <label>
  16. <view class="tit">备件编码:{{ item.assetCode }}</view>
  17. <view class="item">备件名称:{{ item.informationName }}</view>
  18. <view class="item">型号/规格:{{ item.informationName }}</view>
  19. <view class="item"
  20. >单位 :<uni-easyinput
  21. type="number"
  22. v-if="item.isUnpack"
  23. v-model.number="item.num"
  24. ></uni-easyinput
  25. >{{ item.minPackUnit }}</view
  26. >
  27. <view class="item" v-if="!item.isUnpack"
  28. >包装单元:{{ item.informationName }}/{{
  29. item.minPackUnit
  30. }}</view
  31. >
  32. <checkbox value="1" :checked="item.checked" />
  33. </label>
  34. </checkbox-group>
  35. </view>
  36. </template>
  37. <view class="nodata" v-else> 暂无数据 </view>
  38. </view>
  39. <view class="close">
  40. <u-button text="关闭" @click="close"></u-button>
  41. <u-button text="保存" type="success" @click="submit"></u-button>
  42. </view>
  43. </view>
  44. </u-popup>
  45. </template>
  46. <script>
  47. import { post, postJ, get } from '@/utils/api.js'
  48. export default {
  49. props: {
  50. workOrderCode: {
  51. type: String,
  52. default () {
  53. return ''
  54. }
  55. },
  56. equipmentCode: {
  57. type: String,
  58. default () {
  59. return ''
  60. }
  61. }
  62. },
  63. data () {
  64. return {
  65. popShow: false,
  66. searchKey: '',
  67. workOrderId: '',
  68. InfoList: [],
  69. title: ''
  70. }
  71. },
  72. methods: {
  73. open (value, code) {
  74. this.popShow = true
  75. this.getList()
  76. },
  77. close () {
  78. this.popShow = false
  79. },
  80. submit () {
  81. const list = this.InfoList.filter(item => item.checked)
  82. this.$emit('success', list)
  83. },
  84. // 获取备品备件
  85. getList () {
  86. let par = {
  87. sourceCode: this.workOrderCode
  88. // equipmentCode: this.equipmentCode,
  89. }
  90. postJ(this.apiUrl + `/sparePartsApply/getSparePartsExpend`, par).then(
  91. res => {
  92. if (res?.success) {
  93. this.InfoList = res.data.map(i => ({
  94. ...i,
  95. num: i.measurementUnit,
  96. checked: false
  97. }))
  98. }
  99. }
  100. )
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .nodata {
  107. text-align: center;
  108. padding: 30rpx 0;
  109. }
  110. .close {
  111. position: absolute;
  112. bottom: 0;
  113. right: 0;
  114. left: 0;
  115. display: flex;
  116. justify-content: space-between;
  117. }
  118. .bpbj {
  119. width: 100vw;
  120. height: 90vh;
  121. padding-bottom: 80rpx;
  122. .title {
  123. margin-bottom: 7px;
  124. background-color: $j-primary-border-green;
  125. text-align: center;
  126. color: #fff;
  127. padding: 10rpx 0;
  128. }
  129. .detail-content {
  130. border: 1rpx solid rgba(242, 242, 242, 1);
  131. overflow: auto;
  132. .tit {
  133. font-weight: bold;
  134. }
  135. .col {
  136. margin: 20rpx;
  137. border: 1rpx solid rgba(242, 242, 242, 1);
  138. font-size: 28rpx;
  139. border-bottom: 1rpx solid rgba(242, 242, 242, 1);
  140. padding: 20rpx;
  141. align-items: center;
  142. flex-direction: column;
  143. justify-content: space-between;
  144. background-color: rgba(242, 242, 242, 0.372549019607843);
  145. position: relative;
  146. .item {
  147. margin-top: 20rpx;
  148. // display: flex;
  149. // justify-content: flex-start;
  150. // align-items: center;
  151. // flex-shrink: 1;
  152. .uni-easyinput {
  153. display: inline-block;
  154. width: 200rpx;
  155. margin: 0 10rpx;
  156. }
  157. }
  158. & + .col {
  159. margin-top: 20rpx;
  160. }
  161. uni-checkbox {
  162. position: absolute;
  163. top: 30rpx;
  164. right: 20rpx;
  165. }
  166. }
  167. .plus {
  168. width: 40rpx;
  169. height: 40rpx;
  170. line-height: 38rpx;
  171. text-align: center;
  172. background-color: $j-primary-border-green;
  173. color: #fff;
  174. margin: 16rpx 0 0 16rpx;
  175. }
  176. }
  177. /deep/.u-number-box {
  178. .u-number-box__minus,
  179. .u-number-box__plus,
  180. .u-number-box__input {
  181. font-size: 30rpx;
  182. height: 1.6em !important;
  183. }
  184. .u-number-box__input {
  185. width: 2em !important;
  186. }
  187. .u-number-box__minus,
  188. .u-number-box__plus {
  189. background-color: $j-primary-border-green !important;
  190. .u-icon__icon {
  191. color: #fff !important;
  192. }
  193. }
  194. }
  195. }
  196. </style>