stock_list.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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="请选择仓库" @change="changeWarehouse" clearable>
  10. <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
  11. </el-select>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :xs="24" :sm="12" :lg="6">
  15. <el-form-item label="仓位" prop="position">
  16. <el-select v-model="screenForm.position" placeholder="请选择仓位" clearable>
  17. <el-option :label="item.name" :value="item.id" v-for="(item, index) in positionList" :key="index"></el-option>
  18. </el-select>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :xs="24" :sm="12" :lg="6">
  22. <el-form-item label="物料代码" prop="goodsCode">
  23. <el-input v-model="screenForm.goodsCode" placeholder="请输入物料代码"></el-input>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :xs="24" :sm="12" :lg="6">
  27. <el-form-item label="产品名称" prop="goodsName">
  28. <el-input v-model="screenForm.goodsName" placeholder="请输入产品名称"></el-input>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :xs="24" :sm="12" :lg="6">
  32. <el-form-item label="产品大类" prop="type">
  33. <el-select v-model="screenForm.type" placeholder="请选择产品大类" @change="changeType" clearable>
  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="6">
  39. <el-form-item label="产品类别" prop="smallType">
  40. <el-select v-model="screenForm.smallType" placeholder="请选择产品类别" clearable>
  41. <el-option v-for="item in smallList" :key="item.kingDeeCategoryId" :label="item.kingDeeCategoryName" :value="item.kingDeeCategoryId"></el-option>
  42. </el-select>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :xs="24" :sm="12" :lg="6">
  46. <el-form-item label="产品编码" prop="goodsNum">
  47. <el-input v-model="screenForm.goodsNum" placeholder="请输入产品编码"></el-input>
  48. </el-form-item>
  49. </el-col>
  50. <el-col :xs="24" :sm="12" :lg="6">
  51. <el-form-item label="规格型号" prop="model">
  52. <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
  53. </el-form-item>
  54. </el-col>
  55. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  56. <el-form-item label="">
  57. <el-button size="small" @click="resetScreenForm">清空</el-button>
  58. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  59. </el-form-item>
  60. </el-col>
  61. </el-row>
  62. </el-form>
  63. </div>
  64. <div class="mymain-container">
  65. <div class="btn-group clearfix">
  66. <div class="fr">
  67. <ExportButton :exUrl="'stock/manager/export'" :exParams="exParams" />
  68. </div>
  69. </div>
  70. <div class="table">
  71. <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  72. <el-table-column align="center" label="产品大类" prop="mainName" min-width="120" show-overflow-tooltip></el-table-column>
  73. <el-table-column align="center" label="产品类别" prop="categoryName" min-width="120" show-overflow-tooltip></el-table-column>
  74. <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
  75. <el-table-column align="center" label="产品编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
  76. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  77. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  78. <el-table-column align="center" label="单位" prop="baseUnitId" min-width="100" show-overflow-tooltip></el-table-column>
  79. <el-table-column align="center" label="总库存数量" prop="stockQty" min-width="120" show-overflow-tooltip></el-table-column>
  80. <el-table-column align="center" label="可用库数" prop="stockAdequate" min-width="120" show-overflow-tooltip></el-table-column>
  81. <el-table-column align="center" label="经销商预留库存" prop="reservedNum" min-width="140" show-overflow-tooltip></el-table-column>
  82. <el-table-column align="center" label="经销商暂扣库存" prop="temporaryNum" min-width="140" show-overflow-tooltip></el-table-column>
  83. <el-table-column align="center" label="开单未提数量" prop="num" min-width="140" show-overflow-tooltip></el-table-column>
  84. </el-table>
  85. </div>
  86. </div>
  87. <div class="pagination clearfix">
  88. <div class="fr">
  89. <el-pagination
  90. @size-change="handleSizeChange"
  91. @current-change="handleCurrentChange"
  92. :current-page="currentPage"
  93. :page-sizes="[10, 20, 30, 50]"
  94. :page-size="10"
  95. layout="total, sizes, prev, pager, next, jumper"
  96. :total="listTotal">
  97. </el-pagination>
  98. </div>
  99. </div>
  100. </div>
  101. </template>
  102. <script>
  103. import { getStockList, getWarehouseList } from "@/api/stock";
  104. import { getDictList, getSmallList } from '@/api/common'
  105. export default {
  106. data() {
  107. return {
  108. currentPage: 1, // 当前页码
  109. pageSize: 10, // 每页数量
  110. listTotal: 0, // 列表总数
  111. dataList: null, // 列表数据
  112. listLoading: false, // 列表加载loading
  113. screenForm: { // 筛选表单数据
  114. warehouse: '',
  115. position: '',
  116. goodsName: '',
  117. goodsNum: '',
  118. goodsCode: '',
  119. model: '',
  120. type: '',
  121. smallType: '',
  122. },
  123. warehouseList: [],
  124. positionList: [],
  125. typeList: [],
  126. smallList: [],
  127. }
  128. },
  129. computed: {
  130. exParams() {
  131. return {
  132. correspondId: this.screenForm.warehouse,
  133. stockId: this.screenForm.position,
  134. materialName: this.screenForm.goodsName,
  135. materialNumber: this.screenForm.goodsNum,
  136. materialOldNumber: this.screenForm.goodsCode,
  137. specification: this.screenForm.model,
  138. mainNumber: this.screenForm.type,
  139. categoryId: this.screenForm.smallType,
  140. }
  141. },
  142. },
  143. created() {
  144. this.getWarehouseList();
  145. this.getDictList();
  146. this.getList();
  147. },
  148. methods: {
  149. // 查询按钮权限
  150. checkBtnRole(value) {
  151. // let btnRole = this.$route.meta.roles;
  152. // if(!btnRole) {return true}
  153. // let index = btnRole.indexOf(value);
  154. // return index >= 0;
  155. return true
  156. },
  157. // 获取仓库列表
  158. getWarehouseList() {
  159. getWarehouseList({
  160. pageNum: 1,
  161. pageSize: -1
  162. }).then((res) => {
  163. this.warehouseList = res.data.records;
  164. })
  165. },
  166. // 获取产品大类列表
  167. getDictList() {
  168. getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  169. this.typeList = res.data;
  170. })
  171. },
  172. // 获取产品小类列表
  173. getSmallList() {
  174. getSmallList({id: this.screenForm.type}).then(res => {
  175. this.smallList = res.data;
  176. })
  177. },
  178. // 更改大类
  179. changeType() {
  180. this.screenForm.smallType = '';
  181. if(this.screenForm.type) {
  182. this.getSmallList();
  183. }else {
  184. this.smallList = [];
  185. }
  186. },
  187. // 更改仓库
  188. changeWarehouse() {
  189. this.screenForm.position = '';
  190. if(this.screenForm.warehouse) {
  191. let obj = this.warehouseList.find(o => o.id == this.screenForm.warehouse);
  192. this.positionList = obj.kingDeeStocks;
  193. }else {
  194. this.positionList = [];
  195. }
  196. },
  197. // 查询列表
  198. getList() {
  199. this.listLoading = true;
  200. let params = {
  201. pageNum: this.currentPage,
  202. pageSize: this.pageSize,
  203. correspondId: this.screenForm.warehouse,
  204. stockId: this.screenForm.position,
  205. materialName: this.screenForm.goodsName,
  206. materialNumber: this.screenForm.goodsNum,
  207. materialOldNumber: this.screenForm.goodsCode,
  208. specification: this.screenForm.model,
  209. mainNumber: this.screenForm.type,
  210. categoryId: this.screenForm.smallType,
  211. };
  212. getStockList(params).then((res) => {
  213. this.dataList = res.data.records;
  214. this.listTotal = res.data.total;
  215. this.listLoading = false;
  216. })
  217. },
  218. // 提交筛选表单
  219. submitScreenForm() {
  220. this.currentPage = 1;
  221. this.getList();
  222. },
  223. // 重置筛选表单
  224. resetScreenForm() {
  225. this.$refs.screenForm.resetFields();
  226. this.currentPage = 1;
  227. this.getList();
  228. },
  229. // 更改每页数量
  230. handleSizeChange(val) {
  231. this.pageSize = val;
  232. this.currentPage = 1;
  233. this.getList();
  234. },
  235. // 更改当前页
  236. handleCurrentChange(val) {
  237. this.currentPage = val;
  238. this.getList();
  239. },
  240. }
  241. }
  242. </script>
  243. <style lang="scss" scoped>
  244. </style>