index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <script>
  2. import query from "@/components/query/index.vue";
  3. import * as API from "@/api/inventory-management/query.js";
  4. export default {
  5. components: {
  6. query,
  7. },
  8. data() {
  9. return {
  10. activeName: "first",
  11. warehouseTypeList: [],
  12. productTypeList: [],
  13. queryParams: {
  14. pageNum: 1,
  15. pageSize: 10,
  16. keyword: "",
  17. },
  18. selectConfigOne: [
  19. {
  20. label: "产品类型",
  21. prop: "type",
  22. data: [],
  23. },
  24. ],
  25. selectConfigTwo: [
  26. {
  27. label: "仓库类型",
  28. prop: "type",
  29. data: [],
  30. },
  31. ],
  32. tableList: [],
  33. total: 0,
  34. loading: false,
  35. };
  36. },
  37. created() {
  38. const businessDictData = JSON.parse(
  39. window.localStorage.getItem("businessDict")
  40. );
  41. this.productTypeList = businessDictData.find(
  42. (item) => item.code === "productType"
  43. ).children;
  44. this.selectConfigOne[0].data = this.productTypeList.map((item) => ({
  45. label: item.dictValue,
  46. value: item.dictKey,
  47. }));
  48. this.warehouseTypeList = businessDictData.find(
  49. (item) => item.code === "warehouseType"
  50. ).children;
  51. this.selectConfigTwo[0].data = this.warehouseTypeList.map((item) => ({
  52. label: item.dictValue,
  53. value: item.dictKey,
  54. }));
  55. this.getList();
  56. },
  57. methods: {
  58. getList() {
  59. this.loading = true;
  60. switch (this.activeName) {
  61. case "first":
  62. API.byWarehouseList(this.queryParams).then(
  63. (res) => {
  64. this.tableList = res.data.data.records;
  65. this.total = res.data.data.total;
  66. this.loading = false;
  67. },
  68. (err) => {
  69. console.log("byWarehouseList: " + err);
  70. this.loading = false;
  71. }
  72. );
  73. break;
  74. case "second":
  75. API.byProductList(this.queryParams).then(
  76. (res) => {
  77. this.tableList = res.data.data.records;
  78. this.total = res.data.data.total;
  79. this.loading = false;
  80. },
  81. (err) => {
  82. console.log("byProductList: " + err);
  83. this.loading = false;
  84. }
  85. );
  86. break;
  87. default:
  88. break;
  89. }
  90. },
  91. handleQuery() {
  92. this.getList();
  93. },
  94. handleClick() {
  95. this.queryParams = {
  96. pageNum: 1,
  97. pageSize: 10,
  98. keyword: "",
  99. };
  100. this.handleQuery();
  101. },
  102. },
  103. };
  104. </script>
  105. <template>
  106. <div>
  107. <el-card class="box-card">
  108. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  109. <el-tab-pane label="按仓库" name="first"> </el-tab-pane>
  110. <el-tab-pane label="按产品" name="second"> </el-tab-pane>
  111. <!-- <el-tab-pane label="按组合" name="third"> </el-tab-pane> -->
  112. </el-tabs>
  113. <div v-show="activeName === 'first'">
  114. <query
  115. :selectConfig="[]"
  116. :req="queryParams"
  117. :isShowMore="false"
  118. @handleQuery="handleQuery"
  119. @handleMore="
  120. () => {
  121. queryDialog = true;
  122. }
  123. "
  124. ></query>
  125. <el-table :data="tableList" v-loading="loading">
  126. <!-- <el-table-column
  127. label="产品类型"
  128. align="left"
  129. :formatter="(row) => dictDataEcho(row.type, productTypeList)"
  130. /> -->
  131. <el-table-column label="仓库名称" align="left" prop="warehouseName" />
  132. <el-table-column label="产品编码" align="left" prop="productCode" />
  133. <el-table-column label="产品名称" align="left" prop="productName" />
  134. <el-table-column label="规格" align="left" prop="productSpecs" />
  135. <el-table-column label="单位" align="left" prop="productUnit" />
  136. <el-table-column label="可用库存" align="left" prop="quantity" />
  137. <el-table-column
  138. label="冻结库存"
  139. align="left"
  140. prop="frozenQuantity"
  141. />
  142. <el-table-column
  143. label="次品库存"
  144. align="left"
  145. prop="defectiveQuantity"
  146. />
  147. <!-- <el-table-column label="查看" align="left">
  148. <template>
  149. <el-button type="text" @click="deleteRow(scope.$index)"
  150. >出库记录</el-button
  151. >
  152. <el-button type="text" @click="deleteRow(scope.$index)"
  153. >入库记录</el-button
  154. >
  155. <el-button type="text" @click="deleteRow(scope.$index)"
  156. >调仓记录</el-button
  157. >
  158. </template>
  159. </el-table-column> -->
  160. </el-table>
  161. </div>
  162. <div v-show="activeName === 'second'">
  163. <query
  164. :selectConfig="[]"
  165. :req="queryParams"
  166. :isShowMore="false"
  167. @handleQuery="handleQuery"
  168. @handleMore="
  169. () => {
  170. queryDialog = true;
  171. }
  172. "
  173. ></query>
  174. <el-table :data="tableList" v-loading="loading">
  175. <el-table-column label="产品编码" align="left" prop="productCode" />
  176. <el-table-column label="产品名称" align="left" prop="productName" />
  177. <el-table-column label="规格" align="left" prop="productSpecs" />
  178. <el-table-column label="单位" align="left" prop="productUnit" />
  179. <el-table-column label="可用库存" align="left" prop="quantity" />
  180. <el-table-column
  181. label="冻结库存"
  182. align="left"
  183. prop="frozenQuantity"
  184. />
  185. <el-table-column
  186. label="次品库存"
  187. align="left"
  188. prop="defectiveQuantity"
  189. />
  190. <!-- <el-table-column label="查看" align="left">
  191. <template>
  192. <el-button type="text" @click="deleteRow(scope.$index)"
  193. >出库记录</el-button
  194. >
  195. <el-button type="text" @click="deleteRow(scope.$index)"
  196. >入库记录</el-button
  197. >
  198. <el-button type="text" @click="deleteRow(scope.$index)"
  199. >调仓记录</el-button
  200. >
  201. </template>
  202. </el-table-column> -->
  203. </el-table>
  204. </div>
  205. <div v-show="activeName === 'third'">
  206. <query
  207. :selectConfig="selectConfigOne"
  208. :req="queryParams"
  209. :isShowMore="false"
  210. @handleQuery="handleQuery"
  211. @handleMore="
  212. () => {
  213. queryDialog = true;
  214. }
  215. "
  216. ></query>
  217. <el-table :data="tableList" v-loading="loading">
  218. <el-table-column label="组合编码" align="left" prop="customerName" />
  219. <el-table-column label="组合名称" align="left" />
  220. <el-table-column label="规格" align="left" />
  221. <el-table-column label="单位" align="left" />
  222. <el-table-column label="库存数量" align="left" />
  223. <el-table-column label="可组合数量" align="left" />
  224. <el-table-column label="查看" align="left">
  225. <template>
  226. <el-button type="text" @click="deleteRow(scope.$index)"
  227. >出库记录</el-button
  228. >
  229. <el-button type="text" @click="deleteRow(scope.$index)"
  230. >入库记录</el-button
  231. >
  232. <el-button type="text" @click="deleteRow(scope.$index)"
  233. >调仓记录</el-button
  234. >
  235. </template>
  236. </el-table-column>
  237. </el-table>
  238. </div>
  239. <pagination
  240. v-show="total > 0"
  241. :total="total"
  242. :page.sync="queryParams.pageNum"
  243. :limit.sync="queryParams.pageSize"
  244. @pagination="getList"
  245. />
  246. </el-card>
  247. </div>
  248. </template>
  249. <style lang="scss" scoped>
  250. .box-card {
  251. height: calc(100vh - 110px);
  252. overflow-y: auto;
  253. }
  254. </style>