screen.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view>
  3. <u-popup :show="show" closeOnClickOverlay mode="right" @close="closePopup">
  4. <view class="main">
  5. <view class="title-t1" @click="closePopup"> 返回 </view>
  6. <view class="title-t2"> 列表维度 </view>
  7. <listOption
  8. label="name"
  9. value="type"
  10. :list="option.dimension"
  11. v-model="form.dimension"
  12. ></listOption>
  13. <view class="title-t2"> 资产类型 </view>
  14. <listOption
  15. label="name"
  16. value="type"
  17. :list="option.code"
  18. v-model="form.code"
  19. ></listOption>
  20. <view class="title-t2"> 所属仓库 </view>
  21. <listOption_line
  22. label="name"
  23. value="id"
  24. :list="option.warehouseId"
  25. v-model="form.warehouseId"
  26. ></listOption_line>
  27. </view>
  28. <view class="flex-buttom">
  29. <view class="s1 item" @click="reset"> 重置 </view>
  30. <view class="s2 item" @click="submit"> 筛选 </view>
  31. </view>
  32. </u-popup>
  33. </view>
  34. </template>
  35. <script>
  36. import listOption from './listOption'
  37. import listOption_line from './listOption_line'
  38. import { post, get } from '@/utils/api.js'
  39. export default {
  40. components: {
  41. listOption,
  42. listOption_line
  43. },
  44. props: ['dimension', 'code', 'warehouseId'],
  45. data () {
  46. return {
  47. infoData: '',
  48. show: false,
  49. form: {
  50. // 列表维度
  51. dimension: 1,
  52. /* 资产类型 */
  53. code: '',
  54. /* 所属仓库 */
  55. warehouseId: ''
  56. },
  57. option: {
  58. dimension: [
  59. {
  60. name: '物品维度',
  61. type: 1
  62. },
  63. {
  64. name: '批次维度',
  65. type: 2
  66. }
  67. ],
  68. code: [],
  69. warehouseId: []
  70. }
  71. }
  72. },
  73. created () {
  74. this.getwarehouseList()
  75. this.getClassify()
  76. },
  77. methods: {
  78. open () {
  79. this.show = true
  80. for (let key of Object.keys(this.form)) {
  81. this.form[key] = this[key]
  82. }
  83. },
  84. closePopup () {
  85. this.show = false
  86. },
  87. reset () {
  88. this.form.code = this.option.code[0].type
  89. this.form.warehouseId = ''
  90. },
  91. submit () {
  92. this.$emit('succeed', this.form)
  93. this.closePopup()
  94. },
  95. //获取仓库
  96. getwarehouseList () {
  97. post(this.apiUrl + '/warehouseGoodsshelves/select/warehouseList').then(
  98. res => {
  99. if (res.success) {
  100. this.option.warehouseId = res.data
  101. .filter(i => !i.isDelete && !!i.status)
  102. .map(n => {
  103. return {
  104. name: n.name,
  105. id: n.id
  106. }
  107. })
  108. }
  109. }
  110. )
  111. },
  112. // 获取资产类型
  113. getClassify () {
  114. get(this.apiUrl + '/classify/getClassify?id=0').then(res => {
  115. if (res.success) {
  116. this.option.code = res.data.map(n => {
  117. return {
  118. name: n.name,
  119. type: n.type
  120. }
  121. })
  122. this.form.code = this.option.code[0].type
  123. this.submit()
  124. }
  125. })
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. .main {
  132. width: 600rpx;
  133. position: relative;
  134. padding-bottom: 80rpx;
  135. }
  136. .title-t1 {
  137. font-size: 32rpx;
  138. font-weight: bold;
  139. padding: 30rpx;
  140. }
  141. .title-t2 {
  142. font-size: 28rpx;
  143. font-weight: bold;
  144. padding: 20rpx 30rpx;
  145. }
  146. .flex-buttom {
  147. position: absolute;
  148. bottom: 0;
  149. left: 0;
  150. width: 100%;
  151. display: flex;
  152. background-color: #fff;
  153. box-shadow: 0px -5px 5px rgba(0, 0, 0, 0.0901960784313725);
  154. .item {
  155. flex: 1;
  156. height: 80rpx;
  157. color: #157a2c;
  158. font-size: 28rpx;
  159. display: flex;
  160. justify-content: center;
  161. align-items: center;
  162. &.s2 {
  163. background-color: #157a2c;
  164. color: #fff;
  165. }
  166. }
  167. }
  168. </style>