stock_list.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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="openNumber" min-width="120" show-overflow-tooltip></el-table-column>
  82. <el-table-column align="center" label="经销商预留库存" prop="reservedNum" min-width="140" show-overflow-tooltip></el-table-column>
  83. <el-table-column align="center" label="经销商暂扣库存" prop="temporaryNum" min-width="140" show-overflow-tooltip></el-table-column>
  84. <el-table-column align="center" label="开单未提数量" prop="num" min-width="140" show-overflow-tooltip></el-table-column>
  85. </el-table>
  86. </div>
  87. </div>
  88. <div class="pagination clearfix">
  89. <div class="fr">
  90. <el-pagination
  91. @size-change="handleSizeChange"
  92. @current-change="handleCurrentChange"
  93. :current-page="currentPage"
  94. :page-sizes="[10, 20, 30, 50]"
  95. :page-size="10"
  96. layout="total, sizes, prev, pager, next, jumper"
  97. :total="listTotal">
  98. </el-pagination>
  99. </div>
  100. </div>
  101. </div>
  102. </template>
  103. <script>
  104. import { getStockList, getWarehouseList } from "@/api/stock";
  105. import { getDictList, getSmallList } from '@/api/common'
  106. export default {
  107. data() {
  108. return {
  109. currentPage: 1, // 当前页码
  110. pageSize: 10, // 每页数量
  111. listTotal: 0, // 列表总数
  112. dataList: null, // 列表数据
  113. listLoading: false, // 列表加载loading
  114. screenForm: { // 筛选表单数据
  115. warehouse: '',
  116. position: '',
  117. goodsName: '',
  118. goodsNum: '',
  119. goodsCode: '',
  120. model: '',
  121. type: '',
  122. smallType: '',
  123. },
  124. warehouseList: [],
  125. positionList: [],
  126. typeList: [],
  127. smallList: [],
  128. }
  129. },
  130. computed: {
  131. exParams() {
  132. return {
  133. correspondId: this.screenForm.warehouse,
  134. stockId: this.screenForm.position,
  135. materialName: this.screenForm.goodsName,
  136. materialNumber: this.screenForm.goodsNum,
  137. materialOldNumber: this.screenForm.goodsCode,
  138. specification: this.screenForm.model,
  139. mainNumber: this.screenForm.type,
  140. categoryId: this.screenForm.smallType,
  141. }
  142. },
  143. },
  144. created() {
  145. this.getWarehouseList();
  146. this.getDictList();
  147. this.getList();
  148. },
  149. methods: {
  150. // 查询按钮权限
  151. checkBtnRole(value) {
  152. // let btnRole = this.$route.meta.roles;
  153. // if(!btnRole) {return true}
  154. // let index = btnRole.indexOf(value);
  155. // return index >= 0;
  156. return true
  157. },
  158. // 获取仓库列表
  159. getWarehouseList() {
  160. getWarehouseList({
  161. pageNum: 1,
  162. pageSize: -1
  163. }).then((res) => {
  164. this.warehouseList = res.data.records;
  165. })
  166. },
  167. // 获取产品大类列表
  168. getDictList() {
  169. getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  170. this.typeList = res.data;
  171. })
  172. },
  173. // 获取产品小类列表
  174. getSmallList() {
  175. getSmallList({id: this.screenForm.type}).then(res => {
  176. this.smallList = res.data;
  177. })
  178. },
  179. // 更改大类
  180. changeType() {
  181. this.screenForm.smallType = '';
  182. if(this.screenForm.type) {
  183. this.getSmallList();
  184. }else {
  185. this.smallList = [];
  186. }
  187. },
  188. // 更改仓库
  189. changeWarehouse() {
  190. this.screenForm.position = '';
  191. if(this.screenForm.warehouse) {
  192. let obj = this.warehouseList.find(o => o.id == this.screenForm.warehouse);
  193. this.positionList = obj.kingDeeStocks;
  194. }else {
  195. this.positionList = [];
  196. }
  197. },
  198. // 查询列表
  199. getList() {
  200. this.listLoading = true;
  201. let params = {
  202. pageNum: this.currentPage,
  203. pageSize: this.pageSize,
  204. correspondId: this.screenForm.warehouse,
  205. stockId: this.screenForm.position,
  206. materialName: this.screenForm.goodsName,
  207. materialNumber: this.screenForm.goodsNum,
  208. materialOldNumber: this.screenForm.goodsCode,
  209. specification: this.screenForm.model,
  210. mainNumber: this.screenForm.type,
  211. categoryId: this.screenForm.smallType,
  212. };
  213. getStockList(params).then((res) => {
  214. this.dataList = res.data.records;
  215. this.listTotal = res.data.total;
  216. this.listLoading = false;
  217. })
  218. },
  219. // 提交筛选表单
  220. submitScreenForm() {
  221. this.currentPage = 1;
  222. this.getList();
  223. },
  224. // 重置筛选表单
  225. resetScreenForm() {
  226. this.$refs.screenForm.resetFields();
  227. this.currentPage = 1;
  228. this.getList();
  229. },
  230. // 更改每页数量
  231. handleSizeChange(val) {
  232. this.pageSize = val;
  233. this.currentPage = 1;
  234. this.getList();
  235. },
  236. // 更改当前页
  237. handleCurrentChange(val) {
  238. this.currentPage = val;
  239. this.getList();
  240. },
  241. }
  242. }
  243. </script>
  244. <style lang="scss" scoped>
  245. </style>