index.vue 5.4 KB

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