inventoryQueryExport1.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="container">
  3. <u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
  4. :placeholder="true" title="库存查询"></u-navbar>
  5. <view class="content">
  6. <!-- <view class="radio-container">
  7. <u-tabs :list="typeList" @click="tabChange" lineColor="#2C6FF3" :scrollable="true"></u-tabs>
  8. </view> -->
  9. <!-- <view class="flex justify-end radio-container">
  10. <view class="flex-sub"></view>
  11. <view class="">
  12. <xbutton size="large">查询</xbutton>
  13. </view>
  14. </view> -->
  15. <view class="tab-list flex flex-wrap">
  16. <block v-for="(item,index) in typeList" :key="item.name">
  17. <view :class="[type==item.name?'tab-item tab-show':'tab-item']" @click="tabClick(item.name)">
  18. {{item.name}}
  19. </view>
  20. </block>
  21. </view>
  22. <view class="title">按<text style="color: #2C6FF3;">{{type}}</text>盘点<text style="color:red;font-size: 24rpx;">(左右滑动查看更多数据)</text></view>
  23. <view class="table card">
  24. <uni-table border stripe emptyText="暂无更多数据" v-if="type=='商品'">
  25. <!-- 表头行 -->
  26. <uni-tr>
  27. <uni-th align="left">商品名称</uni-th>
  28. <uni-th align="center">库存数量</uni-th>
  29. <uni-th align="center">缺货数量</uni-th>
  30. <uni-th align="center">库存容量</uni-th>
  31. <uni-th align="center">缺货占比</uni-th>
  32. </uni-tr>
  33. <!-- 表格数据行 -->
  34. <uni-tr v-for="(item,index) in listA" :key="item.goodsId">
  35. <uni-td>{{item.goodsName}}</uni-td>
  36. <uni-td align="center">{{item.stockSum}}</uni-td>
  37. <uni-td align="center">{{item.lackSum}}</uni-td>
  38. <uni-td align="center">{{item.capacitySum}}</uni-td>
  39. <uni-td align="center">{{item.percentText}}</uni-td>
  40. </uni-tr>
  41. </uni-table>
  42. <uni-table border stripe emptyText="暂无更多数据" v-if="type=='设备'">
  43. <!-- 表头行 -->
  44. <uni-tr>
  45. <uni-th align="left">设备名称</uni-th>
  46. <uni-th align="center">库存数量</uni-th>
  47. <uni-th align="center">缺货数量</uni-th>
  48. <uni-th align="center">库存容量</uni-th>
  49. <uni-th align="center">缺货占比</uni-th>
  50. </uni-tr>
  51. <!-- 表格数据行 -->
  52. <uni-tr v-for="(item,index) in listB" :key="item.deviceId">
  53. <uni-td>{{item.deviceName?item.deviceName:item.deviceId}}</uni-td>
  54. <uni-td align="center">{{item.stockSum}}</uni-td>
  55. <uni-td align="center">{{item.lackSum}}</uni-td>
  56. <uni-td align="center">{{item.capacitySum}}</uni-td>
  57. <uni-td align="center">{{item.percentText}}</uni-td>
  58. </uni-tr>
  59. </uni-table>
  60. <uni-table border stripe emptyText="暂无更多数据" v-if="type=='线路'">
  61. <!-- 表头行 -->
  62. <uni-tr>
  63. <uni-th align="left">线路名称</uni-th>
  64. <uni-th align="left">库存数量</uni-th>
  65. <uni-th align="left">缺货数量</uni-th>
  66. <uni-th align="left">库存容量</uni-th>
  67. </uni-tr>
  68. <!-- 表格数据行 -->
  69. <uni-tr v-for="(item,index) in listC" :key="item.placeLineId">
  70. <uni-td>{{item.placeLineName&&item.placeLineName!=null?item.placeLineName:item.placeLineId}}</uni-td>
  71. <uni-td>{{item.stockSum}}</uni-td>
  72. <uni-td>{{item.lackSum}}</uni-td>
  73. <uni-td>{{item.capacitySum}}</uni-td>
  74. </uni-tr>
  75. </uni-table>
  76. <uni-table border stripe emptyText="暂无更多数据" v-if="type=='设备+商品'">
  77. <!-- 表头行 -->
  78. <uni-tr>
  79. <uni-th align="left">设备名称</uni-th>
  80. <uni-th align="left">商品名称</uni-th>
  81. <uni-th align="left">库存数量</uni-th>
  82. <uni-th align="left">缺货数量</uni-th>
  83. <uni-th align="left">库存容量</uni-th>
  84. </uni-tr>
  85. <!-- 表格数据行 -->
  86. <uni-tr v-for="(item,index) in listD" :key="item.goodsId">
  87. <uni-td>{{item.deviceName?item.deviceName:item.deviceId}}</uni-td>
  88. <uni-td>{{item.goodsName}}</uni-td>
  89. <uni-td>{{item.stockSum}}</uni-td>
  90. <uni-td>{{item.lackSum}}</uni-td>
  91. <uni-td>{{item.capacitySum}}</uni-td>
  92. </uni-tr>
  93. </uni-table>
  94. <uni-table border stripe emptyText="暂无更多数据" v-if="type=='线路+商品'">
  95. <!-- 表头行 -->
  96. <uni-tr>
  97. <uni-th align="left">线路名称</uni-th>
  98. <uni-th align="left">商品名称</uni-th>
  99. <uni-th align="left">库存数量</uni-th>
  100. <uni-th align="left">缺货数量</uni-th>
  101. <uni-th align="left">库存容量</uni-th>
  102. </uni-tr>
  103. <!-- 表格数据行 -->
  104. <uni-tr v-for="(item,index) in listE" :key="item.goodsId">
  105. <uni-td>{{item.placeLineName&&item.placeLineName!=null?item.placeLineName:item.placeLineId}}</uni-td>
  106. <uni-td>{{item.goodsName}}</uni-td>
  107. <uni-td>{{item.stockSum}}</uni-td>
  108. <uni-td>{{item.lackSum}}</uni-td>
  109. <uni-td>{{item.capacitySum}}</uni-td>
  110. </uni-tr>
  111. </uni-table>
  112. </view>
  113. </view>
  114. </view>
  115. </template>
  116. <script>
  117. import {
  118. stockByLineAndGoods, //按线路+商品分组
  119. stockByDeviceAndGoods, // 按设备+商品分组
  120. stockByDevice, //按设备分组
  121. stockByGoods, // 按商品分组
  122. stockByLine, //按线路分组
  123. } from '@/api/replenishment/replenishment.js'
  124. export default {
  125. data() {
  126. return {
  127. // 基本案列数据
  128. typeList: [{
  129. name: '商品'
  130. },
  131. {
  132. name: '设备'
  133. },
  134. // {
  135. // name: '线路'
  136. // }, {
  137. // name: '设备+商品'
  138. // }, {
  139. // name: '线路+商品'
  140. // }
  141. ],
  142. type: '商品',
  143. listA: [],
  144. listB: [],
  145. listC: [],
  146. listD: [],
  147. listE: [],
  148. }
  149. },
  150. onShow() {
  151. this.getData()
  152. },
  153. methods: {
  154. tabClick(name) {
  155. this.type = name;
  156. this.getData()
  157. },
  158. getData() {
  159. switch (this.type) {
  160. case '商品':
  161. this.getListA()
  162. break;
  163. case '设备':
  164. this.getListB()
  165. break;
  166. case '线路':
  167. this.getListC()
  168. break;
  169. case '设备+商品':
  170. this.getListD()
  171. break;
  172. case '线路+商品':
  173. this.getListE()
  174. break;
  175. default:
  176. break;
  177. }
  178. },
  179. //按商品分组
  180. getListA() {
  181. stockByGoods({
  182. orderBy:'',
  183. orderByKey:''
  184. }).then(res => {
  185. if (res.code == 200) {
  186. if (res.data && res.data.length > 0) {
  187. this.listA = res.data
  188. } else {
  189. this.listA = []
  190. }
  191. } else {
  192. this.listA = []
  193. }
  194. })
  195. },
  196. //按设备分组
  197. getListB() {
  198. stockByDevice({
  199. orderBy:'',
  200. orderByKey:''
  201. }).then(res => {
  202. if (res.code == 200) {
  203. if (res.data && res.data.length > 0) {
  204. this.listB = res.data
  205. } else {
  206. this.listB = []
  207. }
  208. } else {
  209. this.listB = []
  210. }
  211. })
  212. },
  213. //按线路分组
  214. getListC() {
  215. stockByLine().then(res => {
  216. if (res.code == 200) {
  217. if (res.data && res.data.length > 0) {
  218. this.listC = res.data
  219. } else {
  220. this.listC = []
  221. }
  222. } else {
  223. this.listC = []
  224. }
  225. })
  226. },
  227. //按设备+商品分组
  228. getListD() {
  229. stockByDeviceAndGoods().then(res => {
  230. if (res.code == 200) {
  231. if (res.data && res.data.length > 0) {
  232. this.listD = res.data
  233. } else {
  234. this.listD = []
  235. }
  236. } else {
  237. this.listD = []
  238. }
  239. })
  240. },
  241. //按线路+商品分组
  242. getListE() {
  243. stockByLineAndGoods().then(res => {
  244. if (res.code == 200) {
  245. if (res.data && res.data.length > 0) {
  246. this.listE = res.data
  247. this.isEmpty = false
  248. } else {
  249. this.listE = []
  250. this.isEmpty = false
  251. }
  252. } else {
  253. this.listE = []
  254. this.isEmpty = true
  255. }
  256. })
  257. },
  258. }
  259. }
  260. </script>
  261. <style scoped lang="scss">
  262. .container {
  263. min-height: 100vh;
  264. background-color: #fff;
  265. padding-bottom: 24rpx;
  266. // padding-top: 120rpx;
  267. .tab-list {
  268. width: 100%;
  269. background-color: #fff;
  270. padding: 12rpx;
  271. .tab-item {
  272. padding: 0 64rpx;
  273. height: 62rpx;
  274. background: #F7F7F7;
  275. border-radius: 10rpx;
  276. font-size: 28rpx;
  277. font-weight: 500;
  278. color: #777777;
  279. margin-right: 20rpx;
  280. line-height: 62rpx;
  281. margin-bottom: 14rpx;
  282. &.tab-show {
  283. background: #F4F8FF;
  284. color: #2C6FF3;
  285. }
  286. }
  287. }
  288. .title {
  289. font-size: 32rpx;
  290. line-height: 32rpx;
  291. font-weight: bold;
  292. padding: 12rpx 24rpx 12rpx 36rpx;
  293. margin-top: 24rpx;
  294. }
  295. .card {
  296. width: 724rpx;
  297. margin-left: 13rpx;
  298. margin-top: 28rpx;
  299. background-color: #fff;
  300. margin-top: 20rpx;
  301. box-shadow: 0px 0px 10rpx 0px rgba(174, 201, 255, 0.2);
  302. border-radius: 14rpx;
  303. }
  304. /deep/.uni-table-th {
  305. font-size: 30rpx;
  306. color: #555;
  307. }
  308. /deep/.uni-table-td {
  309. color: #555;
  310. }
  311. /deep/.uni-table-scroll {
  312. border: none;
  313. }
  314. /deep/.table--border {
  315. border-right: none;
  316. }
  317. }
  318. </style>