index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <el-tabs v-model="activeName" type="card" @tab-change="changeActiveName">
  5. <el-tab-pane label="成品库" name="first">
  6. <byTable
  7. :source="sourceList.data"
  8. :pagination="sourceList.pagination"
  9. :config="config"
  10. :loading="loading"
  11. :searchConfig="searchConfig"
  12. highlight-current-row
  13. :action-list="[
  14. {
  15. text: '导出Excel',
  16. action: () => deriveExcel(),
  17. },
  18. ]"
  19. @get-list="getList"
  20. @clickReset="clickReset">
  21. </byTable>
  22. </el-tab-pane>
  23. <el-tab-pane label="成品库明细" name="second">
  24. <byTable
  25. :source="sourceListTwo.data"
  26. :pagination="sourceListTwo.pagination"
  27. :config="configTwo"
  28. :loading="loading"
  29. :searchConfig="searchConfigTwo"
  30. highlight-current-row
  31. :action-list="[
  32. {
  33. text: '导出Excel',
  34. action: () => deriveExcelTwo(),
  35. },
  36. ]"
  37. @get-list="getListTwo"
  38. @clickReset="clickResetTwo">
  39. </byTable>
  40. </el-tab-pane>
  41. </el-tabs>
  42. </el-card>
  43. </div>
  44. </template>
  45. <script setup>
  46. import byTable from "/src/components/byTable/index";
  47. import { ElMessageBox } from "element-plus";
  48. const { proxy } = getCurrentInstance();
  49. const activeName = ref("first");
  50. const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
  51. const sourceList = ref({
  52. data: [],
  53. pagination: {
  54. total: 0,
  55. pageNum: 1,
  56. pageSize: 10,
  57. skuSpecCode: "",
  58. skuSpecName: "",
  59. },
  60. });
  61. const sourceListTwo = ref({
  62. data: [],
  63. pagination: {
  64. total: 0,
  65. pageNum: 1,
  66. pageSize: 10,
  67. skuSpecCode: "",
  68. skuSpecName: "",
  69. orderCode: "",
  70. orderWlnCode: "",
  71. departmentId: "",
  72. },
  73. });
  74. const loading = ref(false);
  75. const searchConfig = computed(() => {
  76. return [
  77. {
  78. type: "input",
  79. prop: "skuSpecCode",
  80. label: "SKU品号",
  81. },
  82. {
  83. type: "input",
  84. prop: "skuSpecName",
  85. label: "SKU品名",
  86. },
  87. ];
  88. });
  89. const searchConfigTwo = computed(() => {
  90. return [
  91. {
  92. type: "input",
  93. prop: "orderCode",
  94. label: "订单号",
  95. },
  96. {
  97. type: "input",
  98. prop: "orderWlnCode",
  99. label: "万里牛单号",
  100. },
  101. {
  102. type: "input",
  103. prop: "skuSpecCode",
  104. label: "SKU品号",
  105. },
  106. {
  107. type: "input",
  108. prop: "skuSpecName",
  109. label: "SKU品名",
  110. },
  111. {
  112. type: "select",
  113. prop: "departmentId",
  114. data: departmentList.value,
  115. label: "事业部",
  116. },
  117. ];
  118. });
  119. const config = computed(() => {
  120. return [
  121. {
  122. attrs: {
  123. label: "SKU品号",
  124. prop: "skuSpecCode",
  125. "min-width": 140,
  126. },
  127. },
  128. {
  129. attrs: {
  130. label: "SKU品名",
  131. prop: "skuSpecName",
  132. "min-width": 340,
  133. },
  134. },
  135. {
  136. attrs: {
  137. label: "数量",
  138. prop: "quantity",
  139. "min-width": 120,
  140. },
  141. },
  142. ];
  143. });
  144. const configTwo = computed(() => {
  145. return [
  146. {
  147. attrs: {
  148. label: "订单号",
  149. prop: "orderCode",
  150. width: 160,
  151. },
  152. },
  153. {
  154. attrs: {
  155. label: "万里牛单号",
  156. prop: "orderWlnCode",
  157. width: 140,
  158. },
  159. },
  160. {
  161. attrs: {
  162. label: "事业部",
  163. prop: "departmentName",
  164. width: 140,
  165. },
  166. },
  167. {
  168. attrs: {
  169. label: "SKU品号",
  170. prop: "skuSpecCode",
  171. width: 140,
  172. },
  173. },
  174. {
  175. attrs: {
  176. label: "SKU品名",
  177. prop: "skuSpecName",
  178. },
  179. },
  180. {
  181. attrs: {
  182. label: "数量",
  183. prop: "quantity",
  184. width: 120,
  185. },
  186. },
  187. {
  188. attrs: {
  189. label: "操作类型",
  190. prop: "operationType",
  191. width: 120,
  192. },
  193. render(val) {
  194. if (val == "1") {
  195. return "入库";
  196. } else if (val == "2") {
  197. return "出库";
  198. }
  199. },
  200. },
  201. {
  202. attrs: {
  203. label: "操作时间",
  204. prop: "createTime",
  205. width: 160,
  206. align: "center",
  207. },
  208. },
  209. ];
  210. });
  211. const getDemandData = () => {
  212. proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  213. if (res.rows && res.rows.length > 0) {
  214. departmentList.value = departmentList.value.concat(
  215. res.rows.map((item) => {
  216. return {
  217. dictKey: item.id,
  218. dictValue: item.name,
  219. };
  220. })
  221. );
  222. }
  223. });
  224. };
  225. getDemandData();
  226. const getList = async (req, status) => {
  227. if (status) {
  228. sourceList.value.pagination = {
  229. pageNum: sourceList.value.pagination.pageNum,
  230. pageSize: sourceList.value.pagination.pageSize,
  231. };
  232. } else {
  233. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  234. }
  235. loading.value = true;
  236. proxy.post("/inventoryFinished/page", sourceList.value.pagination).then((res) => {
  237. sourceList.value.data = res.rows;
  238. sourceList.value.pagination.total = res.total;
  239. setTimeout(() => {
  240. loading.value = false;
  241. }, 200);
  242. });
  243. };
  244. getList();
  245. const clickReset = () => {
  246. getList("", true);
  247. };
  248. const getListTwo = async (req, status) => {
  249. if (status) {
  250. sourceListTwo.value.pagination = {
  251. pageNum: sourceListTwo.value.pagination.pageNum,
  252. pageSize: sourceListTwo.value.pagination.pageSize,
  253. };
  254. } else {
  255. sourceListTwo.value.pagination = { ...sourceListTwo.value.pagination, ...req };
  256. }
  257. loading.value = true;
  258. proxy.post("/inventoryFinishedOrder/page", sourceListTwo.value.pagination).then((res) => {
  259. sourceListTwo.value.data = res.rows;
  260. sourceListTwo.value.pagination.total = res.total;
  261. setTimeout(() => {
  262. loading.value = false;
  263. }, 200);
  264. });
  265. };
  266. const clickResetTwo = () => {
  267. getListTwo("", true);
  268. };
  269. const changeActiveName = (val) => {
  270. if (val === "first") {
  271. getList();
  272. } else {
  273. getListTwo();
  274. }
  275. };
  276. const deriveExcel = () => {
  277. ElMessageBox.confirm("你是否确认此操作", "提示", {
  278. confirmButtonText: "确定",
  279. cancelButtonText: "取消",
  280. type: "warning",
  281. })
  282. .then(() => {
  283. proxy.getFile("/inventoryFinished/excelExport", sourceList.value.pagination).then((res) => {
  284. proxy.downloadFile(res, "成品库.xlsx");
  285. });
  286. })
  287. .catch(() => {});
  288. };
  289. const deriveExcelTwo = () => {
  290. ElMessageBox.confirm("你是否确认此操作", "提示", {
  291. confirmButtonText: "确定",
  292. cancelButtonText: "取消",
  293. type: "warning",
  294. })
  295. .then(() => {
  296. proxy.getFile("/inventoryFinishedOrder/excelExport", sourceListTwo.value.pagination).then((res) => {
  297. proxy.downloadFile(res, "成品库明细.xlsx");
  298. });
  299. })
  300. .catch(() => {});
  301. };
  302. </script>
  303. <style lang="scss" scoped>
  304. ::v-deep(.el-input-number .el-input__inner) {
  305. text-align: left;
  306. }
  307. </style>