index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <script>
  2. import test from "@/components/form-test/index.vue";
  3. import query from "@/components/query/index.vue";
  4. import addManualInbound from "./addManualInbound.vue";
  5. import * as API from "@/api/inbound-outbound/inbound/manualInbound.js";
  6. import { warehouseSelectList } from "@/api/product-material/warehouse/index.js";
  7. export default {
  8. components: {
  9. test,
  10. query,
  11. addManualInbound,
  12. },
  13. data() {
  14. return {
  15. warehouseTypeList: [],
  16. warehouseSelectList: [],
  17. btnForm: {
  18. otherButton: {
  19. list: [
  20. {
  21. name: "手动入库",
  22. methodsText: "add",
  23. type: "primary",
  24. add: () => {
  25. this.handleInbound();
  26. },
  27. },
  28. ],
  29. },
  30. },
  31. queryParams: {
  32. pageNum: 1,
  33. pageSize: 10,
  34. keyword: "",
  35. warehouseId: "",
  36. },
  37. selectConfig: [
  38. {
  39. label: "仓库名称",
  40. prop: "warehouseId",
  41. data: [],
  42. },
  43. ],
  44. tableList: [],
  45. total: 0,
  46. loading: false,
  47. inboundType: 10, // 入库类型 10 采购入库 20 手动入库
  48. titleText: "",
  49. open: false,
  50. form: {
  51. warehouseId: "",
  52. remarks: "",
  53. changeProductList: [],
  54. },
  55. };
  56. },
  57. created() {
  58. const businessDictData = JSON.parse(
  59. window.localStorage.getItem("businessDict")
  60. );
  61. this.warehouseTypeList = businessDictData.find(
  62. (item) => item.code === "warehouseType"
  63. ).children;
  64. // this.selectConfig[0].data = this.warehouseTypeList.map((item) => ({
  65. // label: item.dictValue,
  66. // value: item.dictKey,
  67. // }));
  68. warehouseSelectList().then((res) => {
  69. this.warehouseSelectList = res.data.data;
  70. this.selectConfig[0].data = this.warehouseSelectList.map((x) => ({
  71. label: x.name,
  72. value: x.id,
  73. }));
  74. });
  75. this.getList();
  76. },
  77. methods: {
  78. getList() {
  79. this.loading = true;
  80. API.manualInboundList(this.queryParams).then(
  81. (res) => {
  82. console.log(res, "qq");
  83. this.tableList = res.data.data.records;
  84. this.total = res.data.data.total;
  85. this.loading = false;
  86. },
  87. (err) => {
  88. console.log("manualInboundList: " + err);
  89. this.loading = false;
  90. }
  91. );
  92. },
  93. handleQuery() {
  94. this.getList();
  95. },
  96. handleInbound() {
  97. this.form = {
  98. warehouseId: "",
  99. remarks: "",
  100. changeProductList: [],
  101. };
  102. this.open = true;
  103. },
  104. handleCancel() {
  105. this.open = false;
  106. },
  107. handleSubmit() {
  108. API.manualAdd(this.form).then(
  109. () => {
  110. this.msgSuccess("入库成功");
  111. this.$refs.addManualInbound.loading = false;
  112. this.open = false;
  113. this.getList();
  114. },
  115. (err) => {
  116. console.log("manualAdd: " + err);
  117. this.$refs.addManualInbound.loading = false;
  118. }
  119. );
  120. },
  121. },
  122. };
  123. </script>
  124. <template>
  125. <div class="box-card">
  126. <el-card class="header">
  127. <test :form-config="btnForm"></test>
  128. </el-card>
  129. <el-card class="body-main">
  130. <query
  131. :selectConfig="selectConfig"
  132. :req="queryParams"
  133. :isShowMore="true"
  134. @handleQuery="handleQuery"
  135. @handleMore="
  136. () => {
  137. queryDialog = true;
  138. }
  139. "
  140. ></query>
  141. <el-table :data="tableList" v-loading="loading">
  142. <el-table-column label="仓库名称" align="left" prop="warehouseName" />
  143. <el-table-column
  144. label="物品编码"
  145. align="left"
  146. prop="goodsCode"
  147. width="150"
  148. />
  149. <el-table-column label="物品名称" align="left" prop="goodsName" />
  150. <el-table-column
  151. label="规格"
  152. align="left"
  153. prop="goodsSpecs"
  154. width="100"
  155. />
  156. <el-table-column
  157. label="单位"
  158. align="left"
  159. prop="goodsUnit"
  160. width="100"
  161. />
  162. <el-table-column
  163. label="入库数量"
  164. align="right"
  165. prop="changeQuantity"
  166. width="120"
  167. />
  168. <el-table-column
  169. label="操作人"
  170. align="left"
  171. prop="createUser"
  172. width="130"
  173. />
  174. <el-table-column
  175. label="操作时间"
  176. align="left"
  177. prop="createTime"
  178. width="180"
  179. />
  180. </el-table>
  181. <pagination
  182. v-show="total > 0"
  183. :total="total"
  184. :page.sync="queryParams.pageNum"
  185. :limit.sync="queryParams.pageSize"
  186. @pagination="getList"
  187. />
  188. </el-card>
  189. <el-dialog
  190. title="手动入库"
  191. :visible.sync="open"
  192. v-if="open"
  193. width="80%"
  194. top="60px"
  195. >
  196. <add-manual-inbound
  197. :form="form"
  198. :warehouseSelectList="warehouseSelectList"
  199. :warehouseTypeList="warehouseTypeList"
  200. @submit="handleSubmit"
  201. @cancel="handleCancel"
  202. ref="addManualInbound"
  203. ></add-manual-inbound>
  204. </el-dialog>
  205. </div>
  206. </template>
  207. <style lang="scss" scoped>
  208. .box-card {
  209. height: calc(100vh - 110px);
  210. overflow-y: auto;
  211. display: flex;
  212. flex-direction: column;
  213. .header {
  214. // height: 100px;
  215. margin-bottom: 10px;
  216. box-sizing: border-box;
  217. }
  218. .body-main {
  219. flex: 1;
  220. }
  221. }
  222. </style>