stock_list.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="app-container">
  3. <!-- 筛选条件 -->
  4. <div class="screen-container">
  5. <el-form ref="screenForm" :model="screenForm" label-width="70px" size="small" label-position="left">
  6. <el-row :gutter="20">
  7. <el-col :xs="24" :sm="12" :lg="6">
  8. <el-form-item label="仓库" prop="warehouse">
  9. <el-select v-model="screenForm.warehouse" placeholder="请选择仓库">
  10. <el-option label="全部" value=""></el-option>
  11. <el-option :label="item.name" :value="item.name" v-for="(item, index) in warehouseList" :key="index"></el-option>
  12. </el-select>
  13. </el-form-item>
  14. </el-col>
  15. <el-col :xs="24" :sm="12" :lg="6">
  16. <el-form-item label="产品名称" prop="name">
  17. <el-input v-model="screenForm.name" placeholder="请输入产品名称"></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :xs="24" :sm="12" :lg="6">
  21. <el-form-item label="产品编码" prop="code">
  22. <el-input v-model="screenForm.code" placeholder="请输入产品编码"></el-input>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :xs="24" :sm="12" :lg="6">
  26. <el-form-item label="规格型号" prop="model">
  27. <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :xs="24" :sm="12" :lg="6">
  31. <el-form-item label="品类" prop="type">
  32. <el-select v-model="screenForm.type" placeholder="全部">
  33. <el-option label="全部" value=""></el-option>
  34. <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
  35. </el-select>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :xs="24" :sm="12" :lg="18" class="tr">
  39. <el-form-item label="">
  40. <el-button size="small" @click="resetScreenForm">清空</el-button>
  41. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  42. </el-form-item>
  43. </el-col>
  44. </el-row>
  45. </el-form>
  46. </div>
  47. <div class="mymain-container">
  48. <div class="btn-group clearfix">
  49. <div class="fr">
  50. <ExportButton :exUrl="'admin/user/mch/export'" :exParams="exParams" />
  51. </div>
  52. </div>
  53. <div class="table">
  54. <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  55. <el-table-column align="center" label="产品品类" prop="categoryName" min-width="160" show-overflow-tooltip></el-table-column>
  56. <el-table-column align="center" label="产品编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
  57. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  58. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  59. <el-table-column align="center" label="总库存数量" prop="stockQty" min-width="120" show-overflow-tooltip></el-table-column>
  60. <el-table-column align="center" label="经销商预留库存" prop="reservedNum" min-width="140" show-overflow-tooltip></el-table-column>
  61. <el-table-column align="center" label="经销商暂扣库存" prop="temporaryNum" min-width="140" show-overflow-tooltip></el-table-column>
  62. <el-table-column align="center" label="仓库" prop="name" min-width="160" show-overflow-tooltip></el-table-column>
  63. </el-table>
  64. </div>
  65. </div>
  66. <div class="pagination clearfix">
  67. <div class="fr">
  68. <el-pagination
  69. @size-change="handleSizeChange"
  70. @current-change="handleCurrentChange"
  71. :current-page="currentPage"
  72. :page-sizes="[10, 20, 30, 50]"
  73. :page-size="10"
  74. layout="total, sizes, prev, pager, next, jumper"
  75. :total="listTotal">
  76. </el-pagination>
  77. </div>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import { getStockList, getWarehouseList } from "@/api/stock";
  83. import { getDictList } from '@/api/common'
  84. export default {
  85. data() {
  86. return {
  87. currentPage: 1, // 当前页码
  88. pageSize: 10, // 每页数量
  89. listTotal: 0, // 列表总数
  90. dataList: null, // 列表数据
  91. listLoading: false, // 列表加载loading
  92. screenForm: { // 筛选表单数据
  93. warehouse: '',
  94. name: '',
  95. code: '',
  96. model: '',
  97. type: '',
  98. },
  99. warehouseList: [],
  100. typeList: [],
  101. }
  102. },
  103. computed: {
  104. exParams() {
  105. return {
  106. name: this.screenForm.warehouse,
  107. materialName: this.screenForm.name,
  108. materialNumber: this.screenForm.code,
  109. specification: this.screenForm.model,
  110. categoryName: this.screenForm.type,
  111. }
  112. },
  113. },
  114. created() {
  115. this.getWarehouseList();
  116. this.getDictList();
  117. this.getList();
  118. },
  119. methods: {
  120. // 查询按钮权限
  121. checkBtnRole(value) {
  122. // let btnRole = this.$route.meta.roles;
  123. // if(!btnRole) {return true}
  124. // let index = btnRole.indexOf(value);
  125. // return index >= 0;
  126. return true
  127. },
  128. // 获取仓库列表
  129. getWarehouseList() {
  130. getWarehouseList({
  131. pageNum: 1,
  132. pageSize: -1
  133. }).then((res) => {
  134. this.warehouseList = res.data.records;
  135. })
  136. },
  137. getDictList() {
  138. getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  139. this.typeList = res.data;
  140. })
  141. },
  142. // 查询列表
  143. getList() {
  144. this.listLoading = true;
  145. let params = {
  146. pageNum: this.currentPage,
  147. pageSize: this.pageSize,
  148. name: this.screenForm.warehouse,
  149. materialName: this.screenForm.name,
  150. materialNumber: this.screenForm.code,
  151. specification: this.screenForm.model,
  152. categoryName: this.screenForm.type,
  153. };
  154. getStockList(params).then((res) => {
  155. this.dataList = res.data.records;
  156. this.listTotal = res.data.total;
  157. this.listLoading = false;
  158. })
  159. },
  160. // 提交筛选表单
  161. submitScreenForm() {
  162. this.currentPage = 1;
  163. this.getList();
  164. },
  165. // 重置筛选表单
  166. resetScreenForm() {
  167. this.$refs.screenForm.resetFields();
  168. this.currentPage = 1;
  169. this.getList();
  170. },
  171. // 更改每页数量
  172. handleSizeChange(val) {
  173. this.pageSize = val;
  174. this.currentPage = 1;
  175. this.getList();
  176. },
  177. // 更改当前页
  178. handleCurrentChange(val) {
  179. this.currentPage = val;
  180. this.getList();
  181. },
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. </style>