模板管理
This commit is contained in:
@ -43,12 +43,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, getCurrentInstance, computed } from 'vue';
|
||||
import { ElMessageBox, ElMessage, ElLoading } from 'element-plus';
|
||||
import { documentDataAllList, templateRecycleBin, dataRecyclingStation } from '@/api/safety/knowledgeDocument';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const proxy = getCurrentInstance()?.proxy as any;
|
||||
const userStore = useUserStoreHook();
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
|
||||
@ -71,6 +67,7 @@ const getDocumentDataList = () => {
|
||||
loading.value = true;
|
||||
tableData.value = [];
|
||||
value.value = '2';
|
||||
param.projectId = currentProject.value.id;
|
||||
documentDataAllList(param).then((res: any) => {
|
||||
tableData.value = res.rows ?? [];
|
||||
total.value = res.total;
|
||||
|
@ -262,7 +262,6 @@ const resetQuery = () => {
|
||||
// 获取树形结构文件夹目录
|
||||
const gettreeStructureData = () => {
|
||||
state.parentPid = null;
|
||||
activeName.value = 'second';
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '正在加载中……',
|
||||
@ -271,10 +270,10 @@ const gettreeStructureData = () => {
|
||||
});
|
||||
treeStructureData(state.projectId).then((res: any) => {
|
||||
loading.close();
|
||||
if (res.code == 200 && res.data && res.data.length) {
|
||||
state.selectedNodeId = '';
|
||||
if (res.code == 200) {
|
||||
state.selectedNodeId = res.data[0] ? res.data[0].children[0].id : '';
|
||||
state.treeList = res.data;
|
||||
state.paramsQuery.folderId = res.data[0].id;
|
||||
state.paramsQuery.folderId = res.data[0] ? res.data[0].children[0].id : '';
|
||||
getdocumentDataList();
|
||||
// setInfo(res.data);
|
||||
}
|
||||
@ -313,6 +312,8 @@ const handleNodeClick = (row) => {
|
||||
// 获取文档列表数据
|
||||
const getdocumentDataList = () => {
|
||||
if (!state.paramsQuery.folderId) {
|
||||
state.infoList = [];
|
||||
state.total = 0;
|
||||
return;
|
||||
}
|
||||
state.loading = true;
|
||||
@ -339,7 +340,8 @@ const handleDelete = (row) => {
|
||||
|
||||
//切换tab
|
||||
const handleCheckMian = (tab, event) => {
|
||||
activeName.value = tab.name;
|
||||
activeName.value = tab.paneName;
|
||||
|
||||
if (activeName.value === 'first') {
|
||||
gettreeStructureData();
|
||||
} else {
|
||||
@ -448,6 +450,25 @@ const onBook = () => {
|
||||
onMounted(() => {
|
||||
gettreeStructureData();
|
||||
});
|
||||
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value.id,
|
||||
(nid, oid) => {
|
||||
state.projectId = nid;
|
||||
state.paramsQuery.projectId = nid;
|
||||
if (activeName.value === 'first') {
|
||||
gettreeStructureData();
|
||||
} else {
|
||||
// 回收站
|
||||
recylingRef.value.getDocumentDataList();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
Reference in New Issue
Block a user