stock_list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <div class="app-container">
  3. <!-- 筛选条件 -->
  4. <div class="screen-container">
  5. <Collapse :screen-form="screenForm">
  6. <template #right_btn>
  7. <el-button size="mini" @click="resetScreenForm">清空</el-button>
  8. <el-button size="mini" type="primary" @click="submitScreenForm">搜索</el-button>
  9. </template>
  10. <template #search>
  11. <el-form ref="screenForm" :model="screenForm" label-width="70px" size="mini" label-position="left">
  12. <el-row :gutter="20">
  13. <el-col :xs="24" :sm="12" :lg="6">
  14. <el-form-item label="仓库" prop="warehouse">
  15. <el-select
  16. v-model="screenForm.warehouse"
  17. placeholder="请选择仓库"
  18. @change="changeWarehouse"
  19. clearable
  20. multiple
  21. collapse-tags
  22. >
  23. <el-option
  24. :label="item.name"
  25. :value="item.id"
  26. v-for="(item, index) in warehouseList"
  27. :key="index"
  28. ></el-option>
  29. </el-select>
  30. </el-form-item>
  31. </el-col>
  32. <!-- <el-col :xs="24" :sm="12" :lg="6">
  33. <el-form-item label="仓位" prop="position">
  34. <el-select v-model="screenForm.position" placeholder="请选择仓位" clearable>
  35. <el-option :label="item.name" :value="item.id" v-for="(item, index) in positionList" :key="index"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. </el-col> -->
  39. <!-- <el-col :xs="24" :sm="12" :lg="6">
  40. <el-form-item label="产品大类" prop="type">
  41. <el-select v-model="screenForm.type" placeholder="请选择产品大类" @change="changeType" clearable>
  42. <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
  43. </el-select>
  44. </el-form-item>
  45. </el-col> -->
  46. <el-col :xs="24" :sm="12" :lg="6">
  47. <el-form-item label="产品类别" prop="categoryId">
  48. <el-select
  49. v-model="screenForm.categoryId"
  50. placeholder="请选择产品类别"
  51. filterable
  52. clearable
  53. multiple
  54. collapse-tags
  55. >
  56. <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  57. </el-select>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :xs="24" :sm="12" :lg="6">
  61. <el-form-item label="物料编码" prop="goodsCode">
  62. <el-input v-model="screenForm.goodsCode" placeholder="请输入物料编码"></el-input>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :xs="24" :sm="12" :lg="6">
  66. <el-form-item label="产品编码" prop="goodsNum">
  67. <el-input v-model="screenForm.goodsNum" placeholder="请输入产品编码"></el-input>
  68. </el-form-item>
  69. </el-col>
  70. <el-col :xs="24" :sm="12" :lg="6">
  71. <el-form-item label="产品名称" prop="goodsName">
  72. <el-input v-model="screenForm.goodsName" placeholder="请输入产品名称"></el-input>
  73. </el-form-item>
  74. </el-col>
  75. <el-col :xs="24" :sm="12" :lg="6">
  76. <el-form-item label="规格型号" prop="model">
  77. <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
  78. </el-form-item>
  79. </el-col>
  80. </el-row>
  81. </el-form>
  82. </template>
  83. </Collapse>
  84. </div>
  85. <div class="mymain-container">
  86. <div class="btn-group clearfix">
  87. <div class="fr">
  88. <ExportButton :exUrl="'stock/manager/export'" :exParams="exParams" />
  89. </div>
  90. </div>
  91. <div class="table">
  92. <el-table
  93. v-loading="listLoading"
  94. :data="dataList"
  95. element-loading-text="Loading"
  96. border
  97. fit
  98. highlight-current-row
  99. stripe
  100. >
  101. <!-- <el-table-column align="left" label="产品大类" prop="mainName" min-width="100" show-overflow-tooltip></el-table-column> -->
  102. <el-table-column
  103. align="left"
  104. label="产品类别"
  105. prop="categoryName"
  106. min-width="100"
  107. show-overflow-tooltip
  108. ></el-table-column>
  109. <el-table-column align="left" label="物料编码" prop="materialNumber" min-width="120" show-overflow-tooltip>
  110. <template slot-scope="scope">
  111. <CopyButton :copyText="scope.row.materialNumber" />
  112. <span>{{ scope.row.materialNumber }}</span>
  113. </template>
  114. </el-table-column>
  115. <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="140" show-overflow-tooltip>
  116. <template slot-scope="scope">
  117. <CopyButton :copyText="scope.row.materialOldNumber" />
  118. <span>{{ scope.row.materialOldNumber }}</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip>
  122. <template slot-scope="scope">
  123. <CopyButton :copyText="scope.row.materialName" />
  124. <span>{{ scope.row.materialName }}</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip>
  128. <template slot-scope="scope">
  129. <CopyButton :copyText="scope.row.specification" />
  130. <span>{{ scope.row.specification }}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column
  134. align="left"
  135. label="单位"
  136. prop="baseUnitId"
  137. min-width="100"
  138. show-overflow-tooltip
  139. ></el-table-column>
  140. <el-table-column
  141. align="left"
  142. label="总库存数量"
  143. prop="stockQty"
  144. min-width="100"
  145. show-overflow-tooltip
  146. ></el-table-column>
  147. <el-table-column
  148. align="left"
  149. label="可用库数"
  150. prop="stockAdequate"
  151. min-width="100"
  152. show-overflow-tooltip
  153. ></el-table-column>
  154. <el-table-column
  155. align="left"
  156. label="可开单数"
  157. prop="openNumber"
  158. min-width="100"
  159. show-overflow-tooltip
  160. ></el-table-column>
  161. <el-table-column
  162. align="left"
  163. label="经销商预留库存"
  164. prop="reservedNum"
  165. min-width="120"
  166. show-overflow-tooltip
  167. ></el-table-column>
  168. <el-table-column
  169. align="left"
  170. label="经销商暂扣库存"
  171. prop="temporaryNum"
  172. min-width="120"
  173. show-overflow-tooltip
  174. ></el-table-column>
  175. <el-table-column
  176. align="left"
  177. label="开单未提数量"
  178. prop="num"
  179. min-width="120"
  180. show-overflow-tooltip
  181. ></el-table-column>
  182. </el-table>
  183. </div>
  184. </div>
  185. <div class="pagination clearfix">
  186. <div class="fr">
  187. <el-pagination
  188. @size-change="handleSizeChange"
  189. @current-change="handleCurrentChange"
  190. :current-page="currentPage"
  191. :page-sizes="[10, 20, 30, 50]"
  192. :page-size="10"
  193. layout="total, sizes, prev, pager, next, jumper"
  194. :total="listTotal"
  195. >
  196. </el-pagination>
  197. </div>
  198. </div>
  199. </div>
  200. </template>
  201. <script>
  202. import { getStockList, getWarehouseList } from '@/api/stock'
  203. import { getCategoryList, getSmallList } from '@/api/common'
  204. export default {
  205. data() {
  206. return {
  207. currentPage: 1, // 当前页码
  208. pageSize: 10, // 每页数量
  209. listTotal: 0, // 列表总数
  210. dataList: null, // 列表数据
  211. listLoading: false, // 列表加载loading
  212. screenForm: {
  213. // 筛选表单数据
  214. warehouse: [],
  215. position: '',
  216. goodsName: '',
  217. goodsNum: '',
  218. goodsCode: '',
  219. model: '',
  220. type: '',
  221. categoryId: []
  222. },
  223. warehouseList: [],
  224. positionList: [],
  225. typeList: [],
  226. smallList: [],
  227. isCollapse: true
  228. }
  229. },
  230. computed: {
  231. exParams() {
  232. const correspondNameS = this.fliterData()
  233. return {
  234. correspondId: this.screenForm.warehouse.join(),
  235. correspondNameS: correspondNameS.join('/'),
  236. stockId: this.screenForm.position,
  237. materialName: this.screenForm.goodsName,
  238. materialNumber: this.screenForm.goodsCode,
  239. materialOldNumber: this.screenForm.goodsNum,
  240. specification: this.screenForm.model,
  241. mainNumber: this.screenForm.type,
  242. categoryId: this.screenForm.categoryId.join(',')
  243. }
  244. }
  245. },
  246. created() {
  247. this.getWarehouseList()
  248. this.getCategoryList()
  249. this.getList()
  250. },
  251. methods: {
  252. // 获取仓库列表
  253. getWarehouseList() {
  254. getWarehouseList({
  255. pageNum: 1,
  256. pageSize: -1
  257. }).then(res => {
  258. this.warehouseList = res.data.records
  259. })
  260. },
  261. // 获取产品大类列表
  262. getCategoryList() {
  263. getCategoryList({
  264. pageNum: 1,
  265. pageSize: -1
  266. }).then(res => {
  267. this.typeList = res.data.records
  268. })
  269. },
  270. // 获取产品小类列表
  271. getSmallList() {
  272. getSmallList({ id: this.screenForm.type }).then(res => {
  273. this.smallList = res.data
  274. })
  275. },
  276. // 更改大类
  277. changeType() {
  278. this.screenForm.categoryId = ''
  279. if (this.screenForm.type) {
  280. this.getSmallList()
  281. } else {
  282. this.smallList = []
  283. }
  284. },
  285. // 更改仓库
  286. changeWarehouse() {
  287. // this.screenForm.position = '';
  288. // if(this.screenForm.warehouse) {
  289. // let obj = this.warehouseList.find(o => o.id == this.screenForm.warehouse);
  290. // this.positionList = obj.kingDeeStocks;
  291. // }else {
  292. // this.positionList = [];
  293. // }
  294. },
  295. // 查询列表
  296. getList() {
  297. this.listLoading = true
  298. const correspondNameS = this.fliterData()
  299. let params = {
  300. pageNum: this.currentPage,
  301. pageSize: this.pageSize,
  302. correspondId: this.screenForm.warehouse.join(),
  303. correspondNameS: correspondNameS.join('/'),
  304. stockId: this.screenForm.position,
  305. materialName: this.screenForm.goodsName,
  306. materialNumber: this.screenForm.goodsCode,
  307. materialOldNumber: this.screenForm.goodsNum,
  308. specification: this.screenForm.model,
  309. mainNumber: this.screenForm.type,
  310. categoryId: this.screenForm.categoryId.join(',')
  311. }
  312. getStockList(params).then(res => {
  313. this.dataList = res.data.records
  314. this.listTotal = res.data.total
  315. this.listLoading = false
  316. })
  317. },
  318. // 提交筛选表单
  319. submitScreenForm() {
  320. this.currentPage = 1
  321. this.getList()
  322. },
  323. // 重置筛选表单
  324. resetScreenForm() {
  325. this.$refs.screenForm.resetFields()
  326. this.currentPage = 1
  327. this.getList()
  328. },
  329. // 更改每页数量
  330. handleSizeChange(val) {
  331. this.pageSize = val
  332. this.currentPage = 1
  333. this.getList()
  334. },
  335. // 更改当前页
  336. handleCurrentChange(val) {
  337. this.currentPage = val
  338. this.getList()
  339. },
  340. fliterData() {
  341. const correspondNameS = []
  342. if (this.screenForm.warehouse && this.screenForm.warehouse.length)
  343. this.screenForm.warehouse.forEach(e => {
  344. this.warehouseList.filter(k => {
  345. if (e === k.id) {
  346. correspondNameS.push(k.name)
  347. }
  348. })
  349. })
  350. return correspondNameS
  351. }
  352. }
  353. }
  354. </script>
  355. <style lang="scss" scoped></style>