index.vue 5.8 KB

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