|
@@ -50,8 +50,11 @@
|
|
|
|
|
|
<script setup>
|
|
|
import byTable from "@/components/byTable/index";
|
|
|
+import { useRoute } from "vue-router";
|
|
|
+import useTagsViewStore from "@/store/modules/tagsView";
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
+const route = useRoute();
|
|
|
const departmentList = ref([]);
|
|
|
const warehouseList = ref([
|
|
|
{
|
|
@@ -196,27 +199,31 @@ const getDemandData = () => {
|
|
|
{ id: "0", name: "胜德体育" },
|
|
|
];
|
|
|
departmentList.value = list.concat(res.rows);
|
|
|
- proxy.post("/inventory/getQuantityByDepartment", {}).then((res) => {
|
|
|
- for (let i = 0; i < departmentList.value.length; i++) {
|
|
|
- let list = res.filter((item) => item.departmentId === departmentList.value[i].id);
|
|
|
- if (list && list.length > 0) {
|
|
|
- departmentList.value[i].quantity = list[0].inventoryQuantity;
|
|
|
+ if (!(route.query && route.query.backupDateStr)) {
|
|
|
+ proxy.post("/inventory/getQuantityByDepartment", {}).then((res) => {
|
|
|
+ for (let i = 0; i < departmentList.value.length; i++) {
|
|
|
+ let list = res.filter((item) => item.departmentId === departmentList.value[i].id);
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ departmentList.value[i].quantity = list[0].inventoryQuantity;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
|
warehouseList.value[0].children = res.rows;
|
|
|
- proxy.post("/inventory/getQuantityByWarehouse", { departmentId: sourceList.value.pagination.departmentId }).then((res) => {
|
|
|
- if (warehouseList.value[0].children && warehouseList.value[0].children.length > 0) {
|
|
|
- for (let i = 0; i < warehouseList.value[0].children.length; i++) {
|
|
|
- let list = res.filter((item) => item.warehouseId === warehouseList.value[0].children[i].id);
|
|
|
- if (list && list.length > 0) {
|
|
|
- warehouseList.value[0].children[i].quantity = list[0].inventoryQuantity;
|
|
|
+ if (!(route.query && route.query.backupDateStr)) {
|
|
|
+ proxy.post("/inventory/getQuantityByWarehouse", { departmentId: sourceList.value.pagination.departmentId }).then((res) => {
|
|
|
+ if (warehouseList.value[0].children && warehouseList.value[0].children.length > 0) {
|
|
|
+ for (let i = 0; i < warehouseList.value[0].children.length; i++) {
|
|
|
+ let list = res.filter((item) => item.warehouseId === warehouseList.value[0].children[i].id);
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ warehouseList.value[0].children[i].quantity = list[0].inventoryQuantity;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
};
|
|
|
getDemandData();
|
|
@@ -229,8 +236,12 @@ const getList = async (req, status) => {
|
|
|
} else {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
}
|
|
|
+ let path = "/inventory/page";
|
|
|
+ if (route.query && route.query.backupDateStr) {
|
|
|
+ path = "/inventoryBackup/detailPage";
|
|
|
+ }
|
|
|
loading.value = true;
|
|
|
- proxy.post("/inventory/page", sourceList.value.pagination).then((res) => {
|
|
|
+ proxy.post(path, sourceList.value.pagination).then((res) => {
|
|
|
sourceList.value.data = res.rows;
|
|
|
sourceList.value.pagination.total = res.total;
|
|
|
setTimeout(() => {
|
|
@@ -238,7 +249,6 @@ const getList = async (req, status) => {
|
|
|
}, 200);
|
|
|
});
|
|
|
};
|
|
|
-getList();
|
|
|
const clickReset = () => {
|
|
|
proxy.$refs.treeCategory.setCurrentKey(null);
|
|
|
getList("", true);
|
|
@@ -253,20 +263,22 @@ const getTotal = (item) => {
|
|
|
}
|
|
|
return proxy.moneyFormat(total, 2);
|
|
|
};
|
|
|
-const changeDepartment = (val) => {
|
|
|
+const changeDepartment = () => {
|
|
|
proxy.$refs.treeCategory.setCurrentKey(null);
|
|
|
- proxy.post("/inventory/getQuantityByWarehouse", { departmentId: sourceList.value.pagination.departmentId }).then((res) => {
|
|
|
- if (warehouseList.value[0].children && warehouseList.value[0].children.length > 0) {
|
|
|
- for (let i = 0; i < warehouseList.value[0].children.length; i++) {
|
|
|
- let list = res.filter((item) => item.warehouseId === warehouseList.value[0].children[i].id);
|
|
|
- if (list && list.length > 0) {
|
|
|
- warehouseList.value[0].children[i].quantity = list[0].inventoryQuantity;
|
|
|
- } else {
|
|
|
- warehouseList.value[0].children[i].quantity = null;
|
|
|
+ if (!(route.query && route.query.backupDateStr)) {
|
|
|
+ proxy.post("/inventory/getQuantityByWarehouse", { departmentId: sourceList.value.pagination.departmentId }).then((res) => {
|
|
|
+ if (warehouseList.value[0].children && warehouseList.value[0].children.length > 0) {
|
|
|
+ for (let i = 0; i < warehouseList.value[0].children.length; i++) {
|
|
|
+ let list = res.filter((item) => item.warehouseId === warehouseList.value[0].children[i].id);
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ warehouseList.value[0].children[i].quantity = list[0].inventoryQuantity;
|
|
|
+ } else {
|
|
|
+ warehouseList.value[0].children[i].quantity = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
getList({ departmentId: sourceList.value.pagination.departmentId });
|
|
|
};
|
|
|
const showName = (item) => {
|
|
@@ -283,6 +295,26 @@ const renderContent = (h, data) => {
|
|
|
return h("span", h("span", null, data.node.label));
|
|
|
}
|
|
|
};
|
|
|
+onMounted(() => {
|
|
|
+ if (route.query && route.query.backupDateStr) {
|
|
|
+ useTagsViewStore().visitedViews = useTagsViewStore().visitedViews.map((item) => {
|
|
|
+ if (item.query && item.query.backupDateStr === route.query.backupDateStr) {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ name: "库存快照: " + route.query.backupDateStr,
|
|
|
+ title: "库存快照: " + route.query.backupDateStr,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ });
|
|
|
+ getList({ backupDate: route.query.backupDateStr });
|
|
|
+ } else {
|
|
|
+ getList();
|
|
|
+ }
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|