detail.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class='replenishment-device-detail'>
  3. <div class="kitbox plr15 ptb10">
  4. <div class="box-flex-1 box-v-middle fs-14">
  5. <span>从上往下数</span>
  6. <div class="color-block"></div>
  7. <span class="ml5 fs-12">已关闭</span>
  8. <div class="color-block ml10 red"></div>
  9. <span class="ml5 fs-12">故障</span>
  10. </div>
  11. <div><van-button @click="gotoUrl('/replenishment/start/deviceDetail', {deviceId: deviceId})" type="info" size="small">点击设置药品</van-button></div>
  12. </div>
  13. <div class="list ">
  14. <div v-for="(item, i) in list" :key="i" class="item plr15 bt-e1e1e1 bb-e1e1e1">
  15. <div class="pt10">第{{i+1}}层</div>
  16. <div class="item-list ptb10">
  17. <div v-for="(data, k) in item.list" :key="k" :class="{'pitem-full':data.cargoCapacity==data.qty, 'pitem-close': data.cargoState!=1, 'pitem-fault': data.faultState==1}" class="pitem">
  18. <div :style="'height: '+ (formatRate(data)) +'%'" class="pitem-bg"></div>
  19. <div class="pitem-inner">
  20. <div class="kitbox ">
  21. <div class="box-flex-1">{{k+1}}号位</div>
  22. <div>{{data.qty}}/{{data.cargoCapacity}}</div>
  23. </div>
  24. <template v-if="data.shelfStatus==1">
  25. <div class="ellipsis tc pt8">{{data.drugName}}</div>
  26. <div class="tc pt5">¥{{data.price}}</div>
  27. </template>
  28. <div v-else class="ellipsis tc pt8 ">未设药品</div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. import medicineAbinetApi from '@/api/api-medicineAbinet'
  38. export default{
  39. name: 'replenishmentDeviceDetail',
  40. data(){
  41. return {
  42. deviceId: this.$route.query.deviceId,
  43. list: []
  44. }
  45. },
  46. created() {
  47. this.findMediicinecabinetInventoryByDeviceId()
  48. },
  49. methods:{
  50. findMediicinecabinetInventoryByDeviceId(){
  51. this.$loading('加载中..')
  52. let p = {
  53. deviceId: this.deviceId
  54. }
  55. console.log('params', p)
  56. medicineAbinetApi
  57. .findMediicinecabinetInventoryByDeviceId(p)
  58. .then(res=>{
  59. console.log('findMediicinecabinetInventoryByDeviceId', res)
  60. this.$toast.clear()
  61. if(res.detailModelList && res.detailModelList.length){
  62. var list = _.map(res.detailModelList, v=>{
  63. var key = _.keys(v)[0]
  64. return {
  65. index: key,
  66. list: v[key],
  67. }
  68. })
  69. list = _.sortBy(list, 'index')
  70. this.list = list
  71. console.log(list, this.curItem)
  72. }
  73. })
  74. .catch(err=>{
  75. console.error(err)
  76. })
  77. },
  78. formatRate(data){
  79. return (data.qty||0) / (data.cargoCapacity||5) * 100
  80. },
  81. },
  82. }
  83. </script>
  84. <style lang='scss' scoped>
  85. .replenishment-device-detail{
  86. .color-block{
  87. background: #ff9526;
  88. width: 10px;
  89. height: 10px;
  90. display: inline-block;
  91. margin-left: 20px;
  92. border-radius: 2px;
  93. &.red{
  94. background: #ff5e6c;
  95. }
  96. }
  97. .list{
  98. .item{
  99. margin-bottom: 10px;
  100. background: #fff;
  101. .item-list{
  102. overflow-y: scroll;
  103. width: 100%;
  104. display: flex;
  105. // ::v-deep .components-product-item{
  106. // overflow: initial;
  107. // width: 100px;
  108. // }
  109. .pitem{
  110. width: 100px;
  111. height: 80px;
  112. background: rgb(238, 238, 238);
  113. border-radius: 10px;
  114. margin-left: 10px;
  115. padding: 5px;
  116. font-size: 14px;
  117. position: relative;
  118. &.pitem-full{
  119. color: #fff;
  120. }
  121. &:first-child{
  122. margin-left: 0;
  123. }
  124. .pitem-inner{
  125. width: 80px;
  126. position: relative;
  127. z-index: 1;
  128. background: transparent;
  129. }
  130. .pitem-bg{
  131. background: #17b3ec;
  132. position: absolute;
  133. z-index: 0;
  134. width: 100%;
  135. bottom: 0;
  136. left: 0;
  137. border-bottom-left-radius: 10px;
  138. border-bottom-right-radius: 10px;
  139. &.orange{
  140. background: #ff9526;
  141. }
  142. &.red{
  143. background: #ff5e6c;
  144. }
  145. }
  146. &.pitem-close{
  147. background-color: #ff9526;
  148. color: #fff;
  149. .pitem-bg{
  150. display: none;
  151. }
  152. }
  153. &.pitem-fault{
  154. background-color: #ff5e6c;
  155. color: #fff;
  156. .pitem-bg{
  157. display: none;
  158. }
  159. }
  160. }
  161. }
  162. }
  163. }
  164. }
  165. </style>