工程量清单切换项目bug

This commit is contained in:
Teo
2025-09-14 11:45:04 +08:00
parent 9e8202b274
commit d4c0d61492
2 changed files with 15 additions and 2 deletions

View File

@ -170,6 +170,7 @@ async function getVersionNums(isSheet = true) {
state.loading.versions = true;
state.error = null;
console.log('🚀 ~ handleSheetName ~ currentProject.value?.id:', currentProject.value?.id);
const res = await obtainAllVersionNumbers({
projectId: currentProject.value?.id,
workOrderType: state.work_order_type,
@ -375,6 +376,16 @@ const downloadTemplate = (type) => {
alert('下载失败,请重试');
}
};
const resetState = () => {
state.tableData = [];
state.options = [];
state.sheets = [];
state.queryForm.versions = '';
state.queryForm.sheet = '';
state.versionsData = {};
state.error = null;
isExpandAll.value = true;
};
onMounted(async () => {
await getVersionNums();
});
@ -382,6 +393,8 @@ onMounted(async () => {
const listeningProject = watch(
() => currentProject.value?.id,
(nid, oid) => {
resetState();
state.queryForm.projectId = nid;
getVersionNums();
}
);