3f73d0f0 by xukangle

fix : 分类分级bug修改

1 parent 7daf9d9d
...@@ -90,6 +90,10 @@ const pageInfo = computed(() => { ...@@ -90,6 +90,10 @@ const pageInfo = computed(() => {
90 return props.tableInfo.page; 90 return props.tableInfo.page;
91 }); 91 });
92 92
93 // const expandRowKeys = computed(() => {
94 // return Array.isArray(props.tableInfo.expandedKey) ? props.tableInfo.expandedKey : [];;
95 // });
96
93 const tableRowClassName = (row, rowIndex) => { 97 const tableRowClassName = (row, rowIndex) => {
94 if (rowIndex === 1) { 98 if (rowIndex === 1) {
95 return "warning-row"; 99 return "warning-row";
...@@ -236,7 +240,7 @@ onMounted(() => { ...@@ -236,7 +240,7 @@ onMounted(() => {
236 :show-header="props.tableInfo.showHeader ?? true" stripe :border="props.tableInfo.border 240 :show-header="props.tableInfo.showHeader ?? true" stripe :border="props.tableInfo.border
237 ?? true" :height="props.tableInfo.height === null ? null : (props.tableInfo.height ?? '100%')" 241 ?? true" :height="props.tableInfo.height === null ? null : (props.tableInfo.height ?? '100%')"
238 :max-height="maxHeight" :row-key="rowKey" :current-row-key="currentRowKey" :row-class-name="rowClassName" 242 :max-height="maxHeight" :row-key="rowKey" :current-row-key="currentRowKey" :row-class-name="rowClassName"
239 :expand-row-keys="props.tableInfo.expandRowKeys" v-loading="tableDataLoading" @row-click="rowClick" 243 :expand-row-keys="props.tableInfo.expandedKey" v-loading="tableDataLoading" @row-click="rowClick"
240 @row-dblclick="rowDblClick" @selection-change="selectionChange" @select="tableCheckboxSelectChange" 244 @row-dblclick="rowDblClick" @selection-change="selectionChange" @select="tableCheckboxSelectChange"
241 @select-all="tableCheckboxAllSelectChange" style="width: 100%; display: inline-block" 245 @select-all="tableCheckboxAllSelectChange" style="width: 100%; display: inline-block"
242 :style="{ 'min-height': props.tableInfo.minHeight ?? '200px' }" tooltip-effect="light" 246 :style="{ 'min-height': props.tableInfo.minHeight ?? '200px' }" tooltip-effect="light"
......
...@@ -5,9 +5,15 @@ import useSettingsStore from '@/store/modules/settings' ...@@ -5,9 +5,15 @@ import useSettingsStore from '@/store/modules/settings'
5 import type { Menu } from '#/global' 5 import type { Menu } from '#/global'
6 import { getDownloadUrl, download } from "@/utils/common"; 6 import { getDownloadUrl, download } from "@/utils/common";
7 import { getImageContent } from "@/api/modules/queryService"; 7 import { getImageContent } from "@/api/modules/queryService";
8 import {createSVG } from "@/utils/common" 8 import { createSVG } from "@/utils/common"
9 import { onBeforeMount } from "vue" 9 import { onBeforeMount } from "vue"
10 import { resolve } from 'path-browserify'; 10 import { resolve } from 'path-browserify';
11 import { ElMessage } from "element-plus";
12 import {
13 parseAndDecodeUrl,
14 getDownFileSignByUrl,
15 obsDownloadRequest
16 } from '@/api/modules/obsService';
11 const props = defineProps({ 17 const props = defineProps({
12 item: { 18 item: {
13 type: Object as () => Menu.recordRaw, 19 type: Object as () => Menu.recordRaw,
...@@ -19,7 +25,7 @@ const props = defineProps({ ...@@ -19,7 +25,7 @@ const props = defineProps({
19 }, 25 },
20 }) 26 })
21 const settingsStore = useSettingsStore() 27 const settingsStore = useSettingsStore()
22 const item1:any = ref() 28 const item1: any = ref()
23 const hasChildren = computed(() => { 29 const hasChildren = computed(() => {
24 let flag = true 30 let flag = true
25 if (props.item.children) { 31 if (props.item.children) {
...@@ -32,70 +38,79 @@ const hasChildren = computed(() => { ...@@ -32,70 +38,79 @@ const hasChildren = computed(() => {
32 } 38 }
33 return flag 39 return flag
34 }) 40 })
35 onBeforeMount( async ()=>{ 41 onBeforeMount(async () => {
36 await getSvgElement(props.item) 42 await getSvgElement(props.item)
37 }) 43 })
38 const getSvgElement = async (item:any)=>{ 44 const getSvgElement = async (item: any) => {
45 console.log(item)
39 item1.value = item 46 item1.value = item
40 //// return new Promise( async (reslove,inject)=>{ 47 //// return new Promise( async (reslove,inject)=>{
41 if(item1.value.meta.icon && item1.value.meta.icon.indexOf("https")>-1) { 48 if (item1.value.meta.icon && item1.value.meta.icon.indexOf("https") > -1) {
42 const res1:any = await getImageContent(item1.value.meta?.icon) 49 const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(item1.value.meta.icon).fileName);
43 let ele:any 50 if (!refSignInfo?.data) {
44 if (res1 && !res1.msg) { 51 refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
45 let name = item1.value.meta?.icon; 52 return;
46 var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : ''; 53 }
47 if (fileSuffix === 'svg') { //浏览器可以支持图片和pdf预览 54 console.log(refSignInfo, '------')
48 let blob= getDownloadUrl(res1, name, fileSuffix,false) as Blob 55 const res1: any = await obsDownloadRequest(refSignInfo?.data)
49 ele = await createSVG(blob) 56 let ele: any
50 item1.value.meta.isEle = false 57 console.log(res1, '*********')
51 item1.value.meta.icon = ele 58 // if (res1 && !res1.msg) {
52 // reslove({}) 59 // ele = await createSVG(res1)
53 } 60 // item1.value.meta.isEle = false
54 } 61 // item1.value.meta.icon = ele
55 } 62 // // reslove({})
56 // reslove(122) 63 // }
64 }
65 }
66
67 // reslove(122)
57 // }) 68 // })
58 69
59 70
60 }
61 </script> 71 </script>
62 72
63 <template> 73 <template>
64 <div class="sidebar-item"> 74 <div class="sidebar-item">
65 <router-link v-if="!hasChildren" v-slot="{ href, navigate, isActive, isExactActive }" custom :to="resolveRoutePath(basePath, item1.path)"> 75 <router-link v-if="!hasChildren" v-slot="{ href, navigate, isActive, isExactActive }" custom
66 <a :href="item1.meta?.link ? item1.meta.link : href" :class="[isActive && 'router-link-active', isExactActive && 'router-link-exact-active']" :target="item.meta?.link ? '_blank' : '_self'" @click="navigate" v-preReClick> 76 :to="resolveRoutePath(basePath, item1.path)">
77 <a :href="item1.meta?.link ? item1.meta.link : href"
78 :class="[isActive && 'router-link-active', isExactActive && 'router-link-exact-active']"
79 :target="item.meta?.link ? '_blank' : '_self'" @click="navigate" v-preReClick>
67 <el-menu-item :title="item1.meta?.title ?? '[ 无标题 ]'" :index="resolveRoutePath(basePath, item1.path || '')"> 80 <el-menu-item :title="item1.meta?.title ?? '[ 无标题 ]'" :index="resolveRoutePath(basePath, item1.path || '')">
68 <el-icon v-if="item1.meta?.icon" class="title-icon" > 81 <el-icon v-if="item1.meta?.icon" class="title-icon">
69 <!-- <img :src="item.meta.icon" v-if="item.meta.icon.indexOf('http')>-1" alt=""> --> 82 <!-- <img :src="item.meta.icon" v-if="item.meta.icon.indexOf('http')>-1" alt=""> -->
70 83
71 <!-- {{ item.meta.icon }} --> 84 <!-- {{ item.meta.icon }} -->
72 <template v-if="item1.meta.icon.indexOf('svg')>-1"> 85 <template v-if="item1.meta.icon.indexOf('svg') > -1">
73 <i v-html="item1.meta.icon" :key="item1.meta.icon" v-if="!item1.meta.isEle"></i> 86 <i v-html="item1.meta.icon" :key="item1.meta.icon" v-if="!item1.meta.isEle"></i>
74 </template> 87 </template>
75 <template v-else> 88 <template v-else>
76 <svg-icon :name="item1.meta.icon"/> 89 <svg-icon :name="item1.meta.icon" />
77 </template> 90 </template>
78 </el-icon> 91 </el-icon>
79 <span class="title">{{ item1.meta?.title ?? '[ 无标题 ]' }}</span> 92 <span class="title">{{ item1.meta?.title ?? '[ 无标题 ]' }}</span>
80 </el-menu-item> 93 </el-menu-item>
81 </a> 94 </a>
82 </router-link> 95 </router-link>
83 <el-sub-menu v-else :title="item1.meta?.title ?? '[ 无标题 ]'" :index="settingsStore.settings.app.routeBaseOn !== 'filesystem' ? resolveRoutePath(basePath, item1.path) : JSON.stringify(item1)"> 96 <el-sub-menu v-else :title="item1.meta?.title ?? '[ 无标题 ]'"
97 :index="settingsStore.settings.app.routeBaseOn !== 'filesystem' ? resolveRoutePath(basePath, item1.path) : JSON.stringify(item1)">
84 <template #title> 98 <template #title>
85 <el-icon v-if="item1.meta?.icon" class="title-icon" > 99 <el-icon v-if="item1.meta?.icon" class="title-icon">
86 <!-- <img :src="item.meta.icon" v-if="item.meta.icon.indexOf('http')>-1" alt=""> 100 <!-- <img :src="item.meta.icon" v-if="item.meta.icon.indexOf('http')>-1" alt="">
87 <svg-icon :name="item.meta.icon" v-else /> --> 101 <svg-icon :name="item.meta.icon" v-else /> -->
88 <template v-if="item1.meta.icon.indexOf('svg')>-1"> 102 <template v-if="item1.meta.icon.indexOf('svg') > -1">
89 <i v-html="item1.meta.icon" :key="item1.meta.icon" v-if="!item1.meta.isEle"></i> 103 <i v-html="item1.meta.icon" :key="item1.meta.icon" v-if="!item1.meta.isEle"></i>
90 </template> 104 </template>
91 <template v-else> 105 <template v-else>
92 <svg-icon :name="item1.meta.icon"/> 106 <svg-icon :name="item1.meta.icon" />
93 </template> 107 </template>
94 </el-icon> 108 </el-icon>
95 <span class="title">{{ item.meta?.title ?? '[ 无标题 ]' }}</span> 109 <span class="title">{{ item.meta?.title ?? '[ 无标题 ]' }}</span>
96 </template> 110 </template>
97 <template v-for="route in (item1.children as Menu.recordRaw[])"> 111 <template v-for="route in (item1.children as Menu.recordRaw[])">
98 <SidebarItem v-if="route.meta?.sidebar !== false" :key="route.path" :item="route" :base-path="resolveRoutePath(basePath, item1.path)" /> 112 <SidebarItem v-if="route.meta?.sidebar !== false" :key="route.path" :item="route"
113 :base-path="resolveRoutePath(basePath, item1.path)" />
99 </template> 114 </template>
100 </el-sub-menu> 115 </el-sub-menu>
101 </div> 116 </div>
...@@ -128,7 +143,7 @@ const getSvgElement = async (item:any)=>{ ...@@ -128,7 +143,7 @@ const getSvgElement = async (item:any)=>{
128 color: #B2B2B2; 143 color: #B2B2B2;
129 } 144 }
130 145
131 .title-icon + .title { 146 .title-icon+.title {
132 margin-left: 10px; 147 margin-left: 10px;
133 } 148 }
134 149
...@@ -154,7 +169,7 @@ a { ...@@ -154,7 +169,7 @@ a {
154 } 169 }
155 170
156 .el-sub-menu__title { 171 .el-sub-menu__title {
157 > .badge { 172 >.badge {
158 &-dot { 173 &-dot {
159 right: 40px; 174 right: 40px;
160 } 175 }
...@@ -171,7 +186,7 @@ a { ...@@ -171,7 +186,7 @@ a {
171 background-color: var(--g-sub-sidebar-menu-bg) !important; 186 background-color: var(--g-sub-sidebar-menu-bg) !important;
172 187
173 .el-menu-item, 188 .el-menu-item,
174 .el-sub-menu > .el-sub-menu__title { 189 .el-sub-menu>.el-sub-menu__title {
175 color: var(--g-sub-sidebar-menu-color); 190 color: var(--g-sub-sidebar-menu-color);
176 background-color: var(--g-sub-sidebar-menu-bg) !important; 191 background-color: var(--g-sub-sidebar-menu-bg) !important;
177 192
...@@ -194,7 +209,7 @@ a { ...@@ -194,7 +209,7 @@ a {
194 } 209 }
195 210
196 .el-menu-item.is-active, 211 .el-menu-item.is-active,
197 .el-menu--collapse .el-sub-menu.is-active > .el-sub-menu__title, 212 .el-menu--collapse .el-sub-menu.is-active>.el-sub-menu__title,
198 .el-sub-menu .el-menu--inline .el-menu-item.is-active { 213 .el-sub-menu .el-menu--inline .el-menu-item.is-active {
199 color: var(--g-sub-sidebar-menu-active-color) !important; 214 color: var(--g-sub-sidebar-menu-active-color) !important;
200 background-color: var(--g-sub-sidebar-menu-active-bg) !important; 215 background-color: var(--g-sub-sidebar-menu-active-bg) !important;
...@@ -203,10 +218,12 @@ a { ...@@ -203,10 +218,12 @@ a {
203 .el-sub-menu__icon-arrow { 218 .el-sub-menu__icon-arrow {
204 color: unset; 219 color: unset;
205 } 220 }
221
206 .title-icon { 222 .title-icon {
207 color: var(--g-sub-sidebar-menu-active-color); 223 color: var(--g-sub-sidebar-menu-active-color);
208 } 224 }
209 } 225 }
226
210 svg { 227 svg {
211 g { 228 g {
212 fill: inherit !important; 229 fill: inherit !important;
......
...@@ -80,7 +80,7 @@ const drawerRef = ref<any>(''); ...@@ -80,7 +80,7 @@ const drawerRef = ref<any>('');
80 const heightlightRow = ref<any>(''); 80 const heightlightRow = ref<any>('');
81 const scopeRow = ref<any>(null); 81 const scopeRow = ref<any>(null);
82 const tableInfo = ref({ 82 const tableInfo = ref({
83 id: "data-class-standard-table", 83 id: "data-class-table",
84 multiple: false, 84 multiple: false,
85 fields: [ 85 fields: [
86 { label: "序号", type: "index", width: 56, align: "center" }, 86 { label: "序号", type: "index", width: 56, align: "center" },
...@@ -110,7 +110,7 @@ const tableInfo = ref({ ...@@ -110,7 +110,7 @@ const tableInfo = ref({
110 data: [], 110 data: [],
111 rowKey: 'guid', 111 rowKey: 'guid',
112 currentRowKey: '', 112 currentRowKey: '',
113 expandedKeys: [] as any, 113 expandedKey: [],
114 showPage: false, 114 showPage: false,
115 actionInfo: { 115 actionInfo: {
116 label: "操作", 116 label: "操作",
...@@ -119,6 +119,7 @@ const tableInfo = ref({ ...@@ -119,6 +119,7 @@ const tableInfo = ref({
119 btns: [ 119 btns: [
120 { 120 {
121 label: "编辑", value: "edit", click: (scope) => { 121 label: "编辑", value: "edit", click: (scope) => {
122 console.log(scope);
122 tableInfo.value.currentRowKey = scope.row.guid; 123 tableInfo.value.currentRowKey = scope.row.guid;
123 heightlightRow.value = scope.row.guid; 124 heightlightRow.value = scope.row.guid;
124 scopeRow.value = scope.row; 125 scopeRow.value = scope.row;
...@@ -823,11 +824,40 @@ const handleTableRowClick = (row, id) => { ...@@ -823,11 +824,40 @@ const handleTableRowClick = (row, id) => {
823 tableInfo.value.currentRowKey = row.guid; 824 tableInfo.value.currentRowKey = row.guid;
824 } 825 }
825 826
827 const findParentsGuids = (treeList, targetGuid) => {
828 let result = null;
829
830 const recursiveSearch = (nodes) => {
831 for (let node of nodes) {
832 if (node.guid === targetGuid) {
833 result = node.parentGuids;
834 return;
835 }
836 if (node.children) {
837 recursiveSearch(node.children);
838 }
839 }
840 };
841
842 recursiveSearch(treeList);
843 return result;
844 };
845
846
826 const drawerSelectChange = (val, row, info) => { 847 const drawerSelectChange = (val, row, info) => {
827 const tree = tableRef.value.tableRef; 848 if (row.field === 'gradeGuid') {
828 console.log(val, row, info, tree); 849 return;
829 tableInfo.value.expandedKeys.push(val); 850 }
830 console.log(tableInfo.value.expandedKeys); 851 tableInfo.value.expandedKey = [];
852 const parentGuids: any = findParentsGuids(treeListData.value, val);
853 if (parentGuids) {
854 tableInfo.value.expandedKey.push(val);
855 parentGuids.forEach((guid) => {
856 tableInfo.value.expandedKey.push(guid);
857 });
858 } else {
859 console.log('No matching item found.');
860 }
831 } 861 }
832 862
833 </script> 863 </script>
......
...@@ -30,8 +30,6 @@ import { ...@@ -30,8 +30,6 @@ import {
30 import { TableColumnWidth } from "@/utils/enum"; 30 import { TableColumnWidth } from "@/utils/enum";
31 import router from "@/router"; 31 import router from "@/router";
32 import { download } from "@/utils/common"; 32 import { download } from "@/utils/common";
33 import { getLabelList } from "@/api/modules/dataLabel";
34 import { de } from "element-plus/es/locale";
35 33
36 const currentPath = ref<string[]>([]); 34 const currentPath = ref<string[]>([]);
37 const currentDatabasePath = ref<string[]>([]); 35 const currentDatabasePath = ref<string[]>([]);
...@@ -485,7 +483,7 @@ const dataBaseTreeInfo = ref<any>({ ...@@ -485,7 +483,7 @@ const dataBaseTreeInfo = ref<any>({
485 value: "guid", 483 value: "guid",
486 }, 484 },
487 nodeKey: 'guid', 485 nodeKey: 'guid',
488 expandedKey: ['0'], 486 expandedKey: [] as any,
489 currentNodeKey: '', 487 currentNodeKey: '',
490 expandOnNodeClick: false, 488 expandOnNodeClick: false,
491 data: [], 489 data: [],
...@@ -565,7 +563,8 @@ const dataBaseTableInfo = ref({ ...@@ -565,7 +563,8 @@ const dataBaseTableInfo = ref({
565 databaseChName: scope.row.databaseChName, 563 databaseChName: scope.row.databaseChName,
566 } 564 }
567 }); 565 });
568 } 566 },
567 disabled: scope.row.state == 0 ? true : false
569 }, 568 },
570 { 569 {
571 label: "编辑表结构", value: "edit", click: (scope) => { 570 label: "编辑表结构", value: "edit", click: (scope) => {
...@@ -870,7 +869,6 @@ const drawerBtnClick = async (btn, info) => { ...@@ -870,7 +869,6 @@ const drawerBtnClick = async (btn, info) => {
870 execGuid: execGuidInfo.value.execGuid, 869 execGuid: execGuidInfo.value.execGuid,
871 classifyDetail: classifyDetailGuidInfo.value, 870 classifyDetail: classifyDetailGuidInfo.value,
872 gradeDetailGuid: levelGuidInfo.value, 871 gradeDetailGuid: levelGuidInfo.value,
873 labelGuid: labelGuidInfo.value,
874 databaseGuid: selectedA.value, 872 databaseGuid: selectedA.value,
875 tableGuid: selectedB.value, 873 tableGuid: selectedB.value,
876 fieldGuid: selectedC.value, 874 fieldGuid: selectedC.value,
...@@ -940,14 +938,31 @@ const getDataBaseTreeData = async () => { ...@@ -940,14 +938,31 @@ const getDataBaseTreeData = async () => {
940 const dataArray = res.data; 938 const dataArray = res.data;
941 // 遍历并添加 GUIDs 939 // 遍历并添加 GUIDs
942 dataArray.forEach(addGuids); 940 dataArray.forEach(addGuids);
941 console.log('dataArray', dataArray, localStorage.getItem("onActiveInfo"));
943 // 更新到绑定的响应式数据 942 // 更新到绑定的响应式数据
944 dataBaseTreeData.value = dataArray; 943 dataBaseTreeData.value = dataArray;
945 dataBaseTreeInfo.value.data = dataArray; 944 dataBaseTreeInfo.value.data = dataArray;
945 if (localStorage.getItem("shouldReloadData")) {
946 console.log('reload');
947 dataBaseTreeInfo.value.expandedKey = [];
948 const info = JSON.parse(localStorage.getItem("onActiveInfo") || '{}');
949 dataBaseTreeInfo.value.expandedKey.push(dataArray[info.dbindex].guid);
950 dataBaseTreeInfo.value.currentNodeKey = dataArray[info.dbindex].guid;
951 dataBaseGuid.value = dataArray[info?.dbindex].databaseGuid;
952 currentDatabasePath.value = info?.path;
953 if (dataArray[info?.dbindex].dicType === 1) {
954 isShowCreateBtn.value = true;
955 }
956 if (dataArray[info?.dbindex].dicType === 2) {
957 isShowCreateBtn.value = false;
958 }
959 dataBaseTreeInfo.value.loading = false;
960 return;
961 }
946 dataBaseTreeInfo.value.expandedKey.push(dataArray[0].guid); 962 dataBaseTreeInfo.value.expandedKey.push(dataArray[0].guid);
947 dataBaseTreeInfo.value.currentNodeKey = dataArray[0].guid; 963 dataBaseTreeInfo.value.currentNodeKey = dataArray[0].guid;
948 dataBaseGuid.value = dataArray[0].databaseGuid; 964 dataBaseGuid.value = dataArray[0].databaseGuid;
949 currentDatabasePath.value = [dataArray[0].name]; 965 currentDatabasePath.value = [dataArray[0].name];
950 console.log('dataArray', dataArray);
951 if (dataArray[0].dicType === 1) { 966 if (dataArray[0].dicType === 1) {
952 isShowCreateBtn.value = true; 967 isShowCreateBtn.value = true;
953 } 968 }
...@@ -1110,11 +1125,23 @@ const tableGuid = ref(''); ...@@ -1110,11 +1125,23 @@ const tableGuid = ref('');
1110 const dataBaseGuid = ref(''); 1125 const dataBaseGuid = ref('');
1111 const dataBaseInfo = ref<any>({}); 1126 const dataBaseInfo = ref<any>({});
1112 1127
1128 // 记录onActive的信息
1129 const onActiveInfo = ref<any>({});
1130
1113 const dataBasenodeClick = (data: any) => { 1131 const dataBasenodeClick = (data: any) => {
1114 isShowCreateBtn.value = false; 1132 isShowCreateBtn.value = false;
1115 console.log('dataBasenodeClick', data, dataBaseTreeData.value); 1133 console.log('dataBasenodeClick', data.databaseGuid, dataBaseTreeData.value);
1134 // 找到data.databaseGuid 在dataBaseTreeData.value 中的下标索引,普通数组遍历就行
1135 const dbindex = dataBaseTreeData.value.findIndex((item) => {
1136 return item.guid === data.databaseGuid;
1137 });
1116 const path = findDDatabasePath(dataBaseTreeData.value, data.guid); 1138 const path = findDDatabasePath(dataBaseTreeData.value, data.guid);
1117 console.log('path', path); 1139 onActiveInfo.value = {
1140 dbindex,
1141 path
1142 }
1143 localStorage.setItem('onActiveInfo', JSON.stringify(onActiveInfo.value));
1144
1118 if (path) { 1145 if (path) {
1119 currentDatabasePath.value = path; 1146 currentDatabasePath.value = path;
1120 } else { 1147 } else {
...@@ -1230,7 +1257,6 @@ const addIsShowDatabaseTip = () => { ...@@ -1230,7 +1257,6 @@ const addIsShowDatabaseTip = () => {
1230 const activeTab = ref('table'); 1257 const activeTab = ref('table');
1231 const isShowWordSearch = ref(true); 1258 const isShowWordSearch = ref(true);
1232 const setActiveTab = (tab) => { 1259 const setActiveTab = (tab) => {
1233 console.log('setActiveTab', tab);
1234 activeTab.value = tab; 1260 activeTab.value = tab;
1235 if (tab === 'word' && activeName.value === 'second') { 1261 if (tab === 'word' && activeName.value === 'second') {
1236 searchItemList.value[0].visible = true; 1262 searchItemList.value[0].visible = true;
...@@ -1422,8 +1448,7 @@ const exportDB = async () => { ...@@ -1422,8 +1448,7 @@ const exportDB = async () => {
1422 } 1448 }
1423 1449
1424 1450
1425 // 标签guid 1451
1426 const labelGuidInfo = ref('');
1427 // 分级guid信息 1452 // 分级guid信息
1428 const levelGuidInfo = ref(''); 1453 const levelGuidInfo = ref('');
1429 // 标签选择 1454 // 标签选择
...@@ -1436,11 +1461,11 @@ const selectChange = (val, row, info) => { ...@@ -1436,11 +1461,11 @@ const selectChange = (val, row, info) => {
1436 1461
1437 // 这里应该是onActivated 钩子,路由从configure-路由从configure-rules跳转过来要重新请求数据、 1462 // 这里应该是onActivated 钩子,路由从configure-路由从configure-rules跳转过来要重新请求数据、
1438 onActivated(async () => { 1463 onActivated(async () => {
1439 if (route.query.reload === 'true') { 1464 if (localStorage.getItem('shouldReloadData') === 'true') {
1440 await getExecGuid(); 1465 await getExecGuid();
1441 activeName.value = 'second'; 1466 activeName.value = 'second';
1442 getDataBaseTreeData(); 1467 await getDataBaseTreeData();
1443 getDataBaseTableData({ 1468 await getDataBaseTableData({
1444 exexGuid: execGuidInfo.value.execGuid 1469 exexGuid: execGuidInfo.value.execGuid
1445 }); 1470 });
1446 getDataBaseFieldData( 1471 getDataBaseFieldData(
...@@ -1449,14 +1474,25 @@ onActivated(async () => { ...@@ -1449,14 +1474,25 @@ onActivated(async () => {
1449 } 1474 }
1450 ); 1475 );
1451 getDbDirTableSelectData(1, {}); 1476 getDbDirTableSelectData(1, {});
1477 localStorage.removeItem('shouldReloadData');
1452 } 1478 }
1453 }); 1479 });
1454 1480
1481 const gradeTreeRef = ref<any>();
1455 const treeSelectNodeClick = (node, item) => { 1482 const treeSelectNodeClick = (node, item) => {
1483 console.log('treeSelectNodeClick', node, item);
1456 classifyDetailGuidInfo.value = node.classifyDetailGuid; 1484 classifyDetailGuidInfo.value = node.classifyDetailGuid;
1457 treeInfo.value.expandedKey = []; 1485 treeInfo.value.expandedKey = [];
1458 treeInfo.value.expandedKey.push(node.classifyDetailGuid); 1486 treeInfo.value.expandedKey.push(node.classifyDetailGuid);
1459 treeInfo.value.currentNodeKey = node.classifyDetailGuid; 1487 treeInfo.value.currentNodeKey = node.classifyDetailGuid;
1488 const path = findPath(CgDirTreeList.value, node.guid);
1489 if (path) {
1490 currentPath.value = path;
1491 console.log('找到路径:', path);
1492 } else {
1493 console.error('未找到路径');
1494 }
1495 console.log('treeSelectNodeClick', treeInfo.value.expandedKey);
1460 } 1496 }
1461 1497
1462 </script> 1498 </script>
...@@ -1483,7 +1519,7 @@ const treeSelectNodeClick = (node, item) => { ...@@ -1483,7 +1519,7 @@ const treeSelectNodeClick = (node, item) => {
1483 <div class="aside_wrap"> 1519 <div class="aside_wrap">
1484 <el-tabs v-model="activeName" class="v-tabs" @tab-click="handleClick"> 1520 <el-tabs v-model="activeName" class="v-tabs" @tab-click="handleClick">
1485 <el-tab-pane label="分类分级目录" name="first"> 1521 <el-tab-pane label="分类分级目录" name="first">
1486 <Tree :treeInfo="treeInfo" @nodeClick="nodeClick" /> 1522 <Tree :treeInfo="treeInfo" @nodeClick="nodeClick" ref="gradeTreeRef" />
1487 <!-- <Tree ref="treeInfoRef" :treeInfo="treeInfo" @nodeClick="nodeClick" /> --> 1523 <!-- <Tree ref="treeInfoRef" :treeInfo="treeInfo" @nodeClick="nodeClick" /> -->
1488 </el-tab-pane> 1524 </el-tab-pane>
1489 <el-tab-pane label="数据库目录" name="second"> 1525 <el-tab-pane label="数据库目录" name="second">
......
...@@ -138,8 +138,10 @@ const findRefGradeGuid = (data, targetClassifyDetailGuid) => { ...@@ -138,8 +138,10 @@ const findRefGradeGuid = (data, targetClassifyDetailGuid) => {
138 }; 138 };
139 const refGradeGuid = ref<any>(''); 139 const refGradeGuid = ref<any>('');
140 const editRow = (row) => { 140 const editRow = (row) => {
141 console.log('row', row)
141 // 进入编辑模式时,查找classifyDetailGuid所在的refGradeGuid 142 // 进入编辑模式时,查找classifyDetailGuid所在的refGradeGuid
142 refGradeGuid.value = findRefGradeGuid(treeSelectOptions.value, row.classifyDetailGuid); 143 refGradeGuid.value = findRefGradeGuid(treeSelectOptions.value, row.classifyDetailGuid);
144 console.log('refGradeGuid', refGradeGuid.value)
143 if (refGradeGuid.value) { 145 if (refGradeGuid.value) {
144 getGradeList({ classifyGradeGuid: refGradeGuid.value.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => { 146 getGradeList({ classifyGradeGuid: refGradeGuid.value.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => {
145 if (res.code === proxy.$passCode) { 147 if (res.code === proxy.$passCode) {
...@@ -294,6 +296,7 @@ const findDDatabasePath = (data: any[], targetGuid: string, path: string[] = [], ...@@ -294,6 +296,7 @@ const findDDatabasePath = (data: any[], targetGuid: string, path: string[] = [],
294 // 存储分级数据 296 // 存储分级数据
295 const gradeInfo = ref<any>(); 297 const gradeInfo = ref<any>();
296 const handleClassifyChange = (row, value) => { 298 const handleClassifyChange = (row, value) => {
299 console.log('row2', row, value)
297 const pathInfo = findDDatabasePath(treeSelectOptions.value, value) 300 const pathInfo = findDDatabasePath(treeSelectOptions.value, value)
298 row.classifyDetailNameRoutes = pathInfo.path; 301 row.classifyDetailNameRoutes = pathInfo.path;
299 row.classifyDetailGuidRoutes = pathInfo.route; 302 row.classifyDetailGuidRoutes = pathInfo.route;
...@@ -302,7 +305,7 @@ const handleClassifyChange = (row, value) => { ...@@ -302,7 +305,7 @@ const handleClassifyChange = (row, value) => {
302 // row.gradeOptions = []; 305 // row.gradeOptions = [];
303 // return; 306 // return;
304 // } 307 // }
305 308 // if (gradeInfo.value) {
306 // refGradeGuid.value = findRefGradeGuid(treeSelectOptions.value, row.classifyDetailGuid); 309 // refGradeGuid.value = findRefGradeGuid(treeSelectOptions.value, row.classifyDetailGuid);
307 // row.classifyDetailName = refGradeGuid.value.classifyName; 310 // row.classifyDetailName = refGradeGuid.value.classifyName;
308 // getGradeList({ classifyGradeGuid: refGradeGuid.value.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => { 311 // getGradeList({ classifyGradeGuid: refGradeGuid.value.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => {
...@@ -312,15 +315,32 @@ const handleClassifyChange = (row, value) => { ...@@ -312,15 +315,32 @@ const handleClassifyChange = (row, value) => {
312 // ElMessage.error(res.msg); 315 // ElMessage.error(res.msg);
313 // } 316 // }
314 // }); 317 // });
318 // }
315 }; 319 };
316 320
317 const handleNodeClick = (row, node, data) => { 321 const handleNodeClick = (row, node, data) => {
322 console.log('row1', row, node, data)
318 // 在gradeInfo找到item.guid === row.gradeGuid 323 // 在gradeInfo找到item.guid === row.gradeGuid
324 if (gradeInfo.value) {
319 const matchedItem = gradeInfo.value.find((item) => item.guid === node.gradeGuid); 325 const matchedItem = gradeInfo.value.find((item) => item.guid === node.gradeGuid);
320 if (matchedItem) { 326 if (matchedItem) {
321 row.gradeDetailGuid = matchedItem.guid; 327 row.gradeDetailGuid = matchedItem.guid;
322 row.gradeDetailName = matchedItem.name; 328 row.gradeDetailName = matchedItem.name;
323 } 329 }
330 } else {
331 getGradeList({ classifyGradeGuid: node.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => {
332 if (res.code === proxy.$passCode) {
333 gradeInfo.value = res.data.records || [];
334 row.gradeOptions = res.data.records || [];
335 const matchedItem = gradeInfo.value.find((item) => item.guid === node.gradeGuid);
336 row.gradeDetailGuid = matchedItem.guid;
337 row.gradeDetailName = matchedItem.name;
338 } else {
339 ElMessage.error(res.msg);
340 }
341 });
342 }
343
324 } 344 }
325 345
326 const isPrevious = ref(false); 346 const isPrevious = ref(false);
...@@ -763,12 +783,14 @@ const saveOrUpdate = async (params: any = {}, type) => { ...@@ -763,12 +783,14 @@ const saveOrUpdate = async (params: any = {}, type) => {
763 if (params.isDraft === 'Y') { 783 if (params.isDraft === 'Y') {
764 proxy.$ElMessage.success('保存为草稿成功!'); 784 proxy.$ElMessage.success('保存为草稿成功!');
765 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); 785 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
766 router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } }); 786 localStorage.setItem('shouldReloadData', 'true');
787 router.push({ name: 'classifyGradeCatalogue' });
767 return 788 return
768 } 789 }
769 proxy.$ElMessage.success('保存成功!'); 790 proxy.$ElMessage.success('保存成功!');
770 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); 791 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
771 router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } }); 792 localStorage.setItem('shouldReloadData', 'true');
793 router.push({ name: 'classifyGradeCatalogue' });
772 } else { 794 } else {
773 saveBtn.value = false 795 saveBtn.value = false
774 proxy.$ElMessage.error(res.msg); 796 proxy.$ElMessage.error(res.msg);
...@@ -780,7 +802,7 @@ const saveOrUpdate = async (params: any = {}, type) => { ...@@ -780,7 +802,7 @@ const saveOrUpdate = async (params: any = {}, type) => {
780 if (res1.code === proxy.$passCode) { 802 if (res1.code === proxy.$passCode) {
781 proxy.$ElMessage.success('编辑成功!'); 803 proxy.$ElMessage.success('编辑成功!');
782 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); 804 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
783 router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } }); 805 router.push({ name: 'classifyGradeCatalogue' });
784 } else { 806 } else {
785 saveBtn.value = false 807 saveBtn.value = false
786 proxy.$ElMessage.error(res1.msg); 808 proxy.$ElMessage.error(res1.msg);
......
...@@ -1487,7 +1487,8 @@ const saveTable = async () => { ...@@ -1487,7 +1487,8 @@ const saveTable = async () => {
1487 if (res.code === proxy.$passCode) { 1487 if (res.code === proxy.$passCode) {
1488 proxy.$ElMessage.success('保存成功!'); 1488 proxy.$ElMessage.success('保存成功!');
1489 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); 1489 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
1490 router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } }); 1490 localStorage.setItem('shouldReloadData', 'true');
1491 router.push({ name: 'classifyGradeCatalogue' });
1491 } else { 1492 } else {
1492 proxy.$ElMessage.error(res.msg); 1493 proxy.$ElMessage.error(res.msg);
1493 } 1494 }
...@@ -1610,7 +1611,8 @@ const saveDraftTable = async () => { ...@@ -1610,7 +1611,8 @@ const saveDraftTable = async () => {
1610 if (res.code === proxy.$passCode) { 1611 if (res.code === proxy.$passCode) {
1611 proxy.$ElMessage.success('保存草稿成功!'); 1612 proxy.$ElMessage.success('保存草稿成功!');
1612 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); 1613 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
1613 router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } }); 1614 localStorage.setItem('shouldReloadData', 'true');
1615 router.push({ name: 'classifyGradeCatalogue' });
1614 } else { 1616 } else {
1615 proxy.$ElMessage.error(res.msg); 1617 proxy.$ElMessage.error(res.msg);
1616 } 1618 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!