stock_list.vue 10 KB

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