bf7dfb69 by xukangle

fix : 分类分级加上数据字典

1 parent 91fef325
...@@ -31,7 +31,6 @@ import { TableColumnWidth } from "@/utils/enum"; ...@@ -31,7 +31,6 @@ 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"; 33 import { getLabelList } from "@/api/modules/dataLabel";
34 import { da } from "element-plus/es/locale";
35 34
36 const currentPath = ref<string[]>([]); 35 const currentPath = ref<string[]>([]);
37 const { proxy } = getCurrentInstance() as any; 36 const { proxy } = getCurrentInstance() as any;
...@@ -188,7 +187,7 @@ const searchItemList = ref([ ...@@ -188,7 +187,7 @@ const searchItemList = ref([
188 lazy: false, 187 lazy: false,
189 props: { 188 props: {
190 label: "classifyName", 189 label: "classifyName",
191 value: "guid", 190 value: "classifyDetailGuid",
192 }, 191 },
193 block: false, 192 block: false,
194 filterable: false, 193 filterable: false,
...@@ -219,8 +218,7 @@ const toSearch = (val: any, clear: boolean = false) => { ...@@ -219,8 +218,7 @@ const toSearch = (val: any, clear: boolean = false) => {
219 selectedC.value = null; 218 selectedC.value = null;
220 searchItemList.value.map(item => item.default = '') 219 searchItemList.value.map(item => item.default = '')
221 } 220 }
222 console.log('toSearch', val); 221 console.log('toSearch', val, classifyDetailGuidInfo.value);
223 // 差一个label标签 -- 未完成
224 if (activeName.value === 'first') { 222 if (activeName.value === 'first') {
225 getCgDirFieldPage({ 223 getCgDirFieldPage({
226 pageIndex: 1, 224 pageIndex: 1,
...@@ -239,8 +237,8 @@ const toSearch = (val: any, clear: boolean = false) => { ...@@ -239,8 +237,8 @@ const toSearch = (val: any, clear: boolean = false) => {
239 pageIndex: 1, 237 pageIndex: 1,
240 pageSize: 50, 238 pageSize: 50,
241 execGuid: execGuidInfo.value.execGuid, 239 execGuid: execGuidInfo.value.execGuid,
242 tableGuid: selectedB.value || '', 240 tableGuid: selectedB.value || tableGuid.value || '',
243 databaseGuid: selectedA.value || '', 241 databaseGuid: selectedA.value || dataBaseGuid.value || '',
244 classifyDetailGuid: val.classifyName, 242 classifyDetailGuid: val.classifyName,
245 gradeDetailGuid: val.levelName, 243 gradeDetailGuid: val.levelName,
246 labelGuid: val.labelName, 244 labelGuid: val.labelName,
...@@ -251,8 +249,8 @@ const toSearch = (val: any, clear: boolean = false) => { ...@@ -251,8 +249,8 @@ const toSearch = (val: any, clear: boolean = false) => {
251 pageIndex: 1, 249 pageIndex: 1,
252 pageSize: 50, 250 pageSize: 50,
253 execGuid: execGuidInfo.value.execGuid, 251 execGuid: execGuidInfo.value.execGuid,
254 tableGuid: selectedB.value || '', 252 tableGuid: selectedB.value || tableGuid.value || '',
255 databaseGuid: selectedA.value || '', 253 databaseGuid: selectedA.value || dataBaseGuid.value || '',
256 fieldGuid: selectedC.value || '', 254 fieldGuid: selectedC.value || '',
257 classifyDetailGuid: val.classifyName, 255 classifyDetailGuid: val.classifyName,
258 gradeDetailGuid: val.levelName, 256 gradeDetailGuid: val.levelName,
...@@ -382,7 +380,8 @@ const tablePageChange = (info) => { ...@@ -382,7 +380,8 @@ const tablePageChange = (info) => {
382 getCgDirFieldPage({ 380 getCgDirFieldPage({
383 pageIndex: info.curr, 381 pageIndex: info.curr,
384 pageSize: info.limit, 382 pageSize: info.limit,
385 execGuid: execGuidInfo.value.execGuid 383 execGuid: execGuidInfo.value.execGuid,
384 classifyDetail: classifyDetailGuidInfo.value
386 }); 385 });
387 } 386 }
388 387
...@@ -1318,6 +1317,12 @@ onActivated(async () => { ...@@ -1318,6 +1317,12 @@ onActivated(async () => {
1318 } 1317 }
1319 }); 1318 });
1320 1319
1320 const treeSelectNodeClick = (node, item) => {
1321 treeInfo.value.expandedKey = [];
1322 treeInfo.value.expandedKey.push(node.classifyDetailGuid);
1323 treeInfo.value.currentNodeKey = node.classifyDetailGuid;
1324 }
1325
1321 </script> 1326 </script>
1322 1327
1323 <template> 1328 <template>
...@@ -1332,11 +1337,11 @@ onActivated(async () => { ...@@ -1332,11 +1337,11 @@ onActivated(async () => {
1332 <el-option v-for="item in optionsB" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" /> 1337 <el-option v-for="item in optionsB" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
1333 </el-select> 1338 </el-select>
1334 <el-select v-model="selectedC" placeholder="选择字段名" :disabled="!selectedB" style="width: 140px;margin-right: 8px" 1339 <el-select v-model="selectedC" placeholder="选择字段名" :disabled="!selectedB" style="width: 140px;margin-right: 8px"
1335 :clearable="true" v-if="!isShowWordSearch"> 1340 :clearable="true" v-if="!(activeTab === 'table' && activeName === 'second')">
1336 <el-option v-for="item in optionsC" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" /> 1341 <el-option v-for="item in optionsC" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
1337 </el-select> 1342 </el-select>
1338 <TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch" 1343 <TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch"
1339 @selectChange="selectChange" /> 1344 @selectChange="selectChange" @treeSelectNodeClick="treeSelectNodeClick" />
1340 </div> 1345 </div>
1341 <div class="container_wrap full flex"> 1346 <div class="container_wrap full flex">
1342 <div class="aside_wrap"> 1347 <div class="aside_wrap">
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
5 <script lang="ts" setup name="configureRules"> 5 <script lang="ts" setup name="configureRules">
6 import { ref } from "vue"; 6 import { ref } from "vue";
7 import useUserStore from "@/store/modules/user"; 7 import useUserStore from "@/store/modules/user";
8 import { getBizRuleConfigDetail, getNewDataTypeList, saveBizRuleConfig, } from '@/api/modules/dataInventory' 8 import { getBizRuleConfigDetail, getDictionaryAll, getNewDataTypeList, saveBizRuleConfig, } from '@/api/modules/dataInventory'
9 const { proxy } = getCurrentInstance() as any; 9 const { proxy } = getCurrentInstance() as any;
10 const router = useRouter(); 10 const router = useRouter();
11 const route = useRoute(); 11 const route = useRoute();
...@@ -45,9 +45,24 @@ const getFieldTypeData = async () => { ...@@ -45,9 +45,24 @@ const getFieldTypeData = async () => {
45 } 45 }
46 } 46 }
47 47
48 // 获取字典
49 const dictionaryList = ref([]);
50
51 const getDictionaryList = () => {
52 getDictionaryAll({ state: 1 }).then((res: any) => {
53 dictionaryList.value = [];
54 if (res.code == proxy.$passCode) {
55 dictionaryList.value = res.data || [];
56 } else {
57 proxy.$ElMessage.error(res.msg);
58 }
59 })
60 };
61
48 onMounted(async () => { 62 onMounted(async () => {
49 await getFieldTypeData() 63 await getFieldTypeData()
50 await getBizRuleConfigDetailData() 64 await getBizRuleConfigDetailData()
65 getDictionaryList()
51 }) 66 })
52 67
53 68
...@@ -78,6 +93,7 @@ const selectedRows = ref([]); ...@@ -78,6 +93,7 @@ const selectedRows = ref([]);
78 // 监听选中行变化 93 // 监听选中行变化
79 const selectionFieldsChange = (selection) => { 94 const selectionFieldsChange = (selection) => {
80 selectedRows.value = selection; 95 selectedRows.value = selection;
96 console.log('selectedRows', selectedRows.value)
81 }; 97 };
82 98
83 // 上移操作 99 // 上移操作
...@@ -87,7 +103,7 @@ const moveUp = () => { ...@@ -87,7 +103,7 @@ const moveUp = () => {
87 return; 103 return;
88 } 104 }
89 selectedRows.value.forEach((row: any) => { 105 selectedRows.value.forEach((row: any) => {
90 const index = tableData.value.findIndex((item) => item.tableData === row.tableData); 106 const index = tableData.value.findIndex((item) => item.fieldGuid === row.fieldGuid);
91 if (index > 0) { 107 if (index > 0) {
92 [tableData.value[index - 1], tableData.value[index]] = [ 108 [tableData.value[index - 1], tableData.value[index]] = [
93 tableData.value[index], 109 tableData.value[index],
...@@ -105,7 +121,7 @@ const moveDown = () => { ...@@ -105,7 +121,7 @@ const moveDown = () => {
105 } 121 }
106 // 倒序遍历选中行 122 // 倒序遍历选中行
107 [...selectedRows.value].reverse().forEach((row: any) => { 123 [...selectedRows.value].reverse().forEach((row: any) => {
108 const index = tableData.value.findIndex((item) => item.tableData === row.tableData); 124 const index = tableData.value.findIndex((item) => item.fieldGuid === row.fieldGuid);
109 if (index < tableData.value.length - 1) { 125 if (index < tableData.value.length - 1) {
110 [tableData.value[index], tableData.value[index + 1]] = [ 126 [tableData.value[index], tableData.value[index + 1]] = [
111 tableData.value[index + 1], 127 tableData.value[index + 1],
...@@ -383,10 +399,13 @@ const cancel = () => { ...@@ -383,10 +399,13 @@ const cancel = () => {
383 <!-- 关联字典(可编辑)el-tree-select 形式下拉形式 --> 399 <!-- 关联字典(可编辑)el-tree-select 形式下拉形式 -->
384 <el-table-column prop="dictionaryGuid" label="关联字典" width="150" align="center"> 400 <el-table-column prop="dictionaryGuid" label="关联字典" width="150" align="center">
385 <template #default="scope"> 401 <template #default="scope">
386 <span v-if="!scope.row.isEdit || !editableFields.dictionaryGuid">{{ scope.row.isDict ? scope.row.isDict : 402 <span v-if="!scope.row.isEdit">{{ scope.row.dictionaryGuid
387 '--' }}</span> 403 ? dictionaryList.find((item: any) => item.guid === scope.row.dictionaryGuid)?.chName : '--' }}</span>
388 <el-tree-select v-else v-model="scope.row.isDict" :data="data" placeholder="请选择" /> 404 <el-select v-else v-model="scope.row.dictionaryGuid" placeholder="请选择">
405 <el-option v-for="item in dictionaryList" :key="item?.guid" :label="item.chName" :value="item.guid" />
406 </el-select>
389 </template> 407 </template>
408
390 </el-table-column> 409 </el-table-column>
391 410
392 <!-- 数据是否唯一(可编辑) --> 411 <!-- 数据是否唯一(可编辑) -->
......
...@@ -17,6 +17,7 @@ import { ...@@ -17,6 +17,7 @@ import {
17 getGradeList, 17 getGradeList,
18 getNewDataTypeList, 18 getNewDataTypeList,
19 getDbDirDetail, 19 getDbDirDetail,
20 getDictionaryAll,
20 } from "@/api/modules/dataInventory"; 21 } from "@/api/modules/dataInventory";
21 import existingTableSelect from "./existingTableSelect.vue"; 22 import existingTableSelect from "./existingTableSelect.vue";
22 import useUserStore from "@/store/modules/user"; 23 import useUserStore from "@/store/modules/user";
...@@ -30,6 +31,21 @@ const fullPath = route.fullPath; ...@@ -30,6 +31,21 @@ const fullPath = route.fullPath;
30 const userStore = useUserStore(); 31 const userStore = useUserStore();
31 const execGuid: any = ref(route.query.execGuid); 32 const execGuid: any = ref(route.query.execGuid);
32 33
34
35 // 获取字典
36 const dictionaryList = ref([]);
37
38 const getDictionaryList = () => {
39 getDictionaryAll({ state: 1 }).then((res: any) => {
40 dictionaryList.value = [];
41 if (res.code == proxy.$passCode) {
42 dictionaryList.value = res.data || [];
43 } else {
44 proxy.$ElMessage.error(res.msg);
45 }
46 })
47 };
48
33 // 获取数据库列表 49 // 获取数据库列表
34 const databaseList: any = ref([]); 50 const databaseList: any = ref([]);
35 const getDbDirDataSourceListData = async () => { 51 const getDbDirDataSourceListData = async () => {
...@@ -189,6 +205,7 @@ onMounted(async () => { ...@@ -189,6 +205,7 @@ onMounted(async () => {
189 await getDbDirDataSourceListData(); 205 await getDbDirDataSourceListData();
190 } 206 }
191 await getFieldTypeData(); 207 await getFieldTypeData();
208 getDictionaryList();
192 }); 209 });
193 210
194 const stepsInfo = ref({ 211 const stepsInfo = ref({
...@@ -1034,10 +1051,13 @@ onActivated(() => { ...@@ -1034,10 +1051,13 @@ onActivated(() => {
1034 <!-- 关联字典(可编辑)el-tree-select 形式下拉形式 --> 1051 <!-- 关联字典(可编辑)el-tree-select 形式下拉形式 -->
1035 <el-table-column prop="dictionaryGuid" label="关联字典" width="150" align="center"> 1052 <el-table-column prop="dictionaryGuid" label="关联字典" width="150" align="center">
1036 <template #default="scope"> 1053 <template #default="scope">
1037 <span v-if="!scope.row.isEdit || !editableFields.dictionaryGuid">{{ scope.row.isDict ? scope.row.isDict 1054 <span v-if="!scope.row.isEdit">{{ scope.row.dictionaryGuid
1038 : '--' }}</span> 1055 ? dictionaryList.find((item: any) => item.guid === scope.row.dictionaryGuid)?.chName : '--' }}</span>
1039 <el-tree-select v-else v-model="scope.row.isDict" :data="data" placeholder="请选择" /> 1056 <el-select v-else v-model="scope.row.dictionaryGuid" placeholder="请选择">
1057 <el-option v-for="item in dictionaryList" :key="item?.guid" :label="item.chName" :value="item.guid" />
1058 </el-select>
1040 </template> 1059 </template>
1060
1041 </el-table-column> 1061 </el-table-column>
1042 1062
1043 <!-- 数据是否唯一(可编辑) --> 1063 <!-- 数据是否唯一(可编辑) -->
......
...@@ -33,7 +33,7 @@ import { ...@@ -33,7 +33,7 @@ import {
33 getSubjectTableDetail, 33 getSubjectTableDetail,
34 checkSubjectTableData 34 checkSubjectTableData
35 } from "@/api/modules/dataCatalogService"; 35 } from "@/api/modules/dataCatalogService";
36 import { getFidldEnName, getGradeList, getNewDataTypeList, getTaskExeTreeList, saveDbDirTable } from "@/api/modules/dataInventory"; 36 import { getDictionaryAll, getFidldEnName, getGradeList, getNewDataTypeList, getTaskExeTreeList, saveDbDirTable } from "@/api/modules/dataInventory";
37 import { useDefault } from "@/hooks/useDefault"; 37 import { useDefault } from "@/hooks/useDefault";
38 import uploadExcelFile from "./components/uploadExcelFile.vue"; 38 import uploadExcelFile from "./components/uploadExcelFile.vue";
39 import { add } from "lodash-es"; 39 import { add } from "lodash-es";
...@@ -131,6 +131,20 @@ const getSubjectField = () => { ...@@ -131,6 +131,20 @@ const getSubjectField = () => {
131 }); 131 });
132 } 132 }
133 133
134 // 获取字典
135 const dictionaryList1 = ref([]);
136
137 const getDictionaryList1 = () => {
138 getDictionaryAll({ state: 1 }).then((res: any) => {
139 dictionaryList.value = [];
140 if (res.code == proxy.$passCode) {
141 dictionaryList1.value = res.data || [];
142 } else {
143 proxy.$ElMessage.error(res.msg);
144 }
145 })
146 };
147
134 // 定义分类选择器的属性 148 // 定义分类选择器的属性
135 const treeSelectProps = { 149 const treeSelectProps = {
136 label: "classifyName", 150 label: "classifyName",
...@@ -213,6 +227,7 @@ const nextStep = () => { ...@@ -213,6 +227,7 @@ const nextStep = () => {
213 tableCreateInfo.value.isSync = 'Y'; 227 tableCreateInfo.value.isSync = 'Y';
214 } 228 }
215 stepsInfo.value.step = 1; 229 stepsInfo.value.step = 1;
230 getDictionaryList1()
216 // getDictionaryList(); 231 // getDictionaryList();
217 // getDimListData(); 232 // getDimListData();
218 if (!fieldTypes.value.length) { 233 if (!fieldTypes.value.length) {
...@@ -1861,7 +1876,7 @@ const tableSelectFields = computed(() => { ...@@ -1861,7 +1876,7 @@ const tableSelectFields = computed(() => {
1861 <span v-else>{{ scope.row["fieldPrecision"] == null ? '--' : scope.row["fieldPrecision"] }}</span> 1876 <span v-else>{{ scope.row["fieldPrecision"] == null ? '--' : scope.row["fieldPrecision"] }}</span>
1862 </template> 1877 </template>
1863 </el-table-column> 1878 </el-table-column>
1864 <el-table-column prop="dimOrdictionaryGuid" v-if="!isDimTable" label="关联维度/字典" width="130px" align="left" 1879 <!-- <el-table-column prop="dimOrdictionaryGuid" v-if="!isDimTable" label="关联维度/字典" width="130px" align="left"
1865 show-overflow-tooltip> 1880 show-overflow-tooltip>
1866 <template #default="scope"> 1881 <template #default="scope">
1867 <el-tree-select ref="dimOrDictSelectRef" v-if="scope.row['isEdit']" filterable clearable 1882 <el-tree-select ref="dimOrDictSelectRef" v-if="scope.row['isEdit']" filterable clearable
...@@ -1883,7 +1898,35 @@ const tableSelectFields = computed(() => { ...@@ -1883,7 +1898,35 @@ const tableSelectFields = computed(() => {
1883 <span v-else>{{ (scope.row['dictionaryGuid'] ? scope.row["dictionaryChName"] : (scope.row['dimGuid'] ? 1898 <span v-else>{{ (scope.row['dictionaryGuid'] ? scope.row["dictionaryChName"] : (scope.row['dimGuid'] ?
1884 scope.row['dimChName'] : '--')) || '--' }}</span> 1899 scope.row['dimChName'] : '--')) || '--' }}</span>
1885 </template> 1900 </template>
1901 </el-table-column> -->
1902 <!-- <el-table-column prop="dimOrdictionaryGuid" v-if="!isDimTable" label="关联字典" width="120px" align="left"
1903 show-overflow-tooltip>
1904 <template #default="scope">
1905 <el-select v-if="scope.row['dimOrdictionaryGuid']" v-model="scope.row['dimOrdictionaryGuid']"
1906 placeholder="请选择">
1907 <el-option v-for="opt in dictionaryList" :key="opt['guid']" :label="opt['chName']"
1908 :value="opt['guid']" />
1909 </el-select>
1910 <span v-else>{{ dictionaryList.find(d => d.guid === scope.row['dimOrdictionaryGuid'])?.chName || '--'
1911 }}</span>
1912 </template>
1913 </el-table-column> -->
1914
1915 <el-table-column prop="dictionaryGuid" label="关联字典" width="120" align="center" show-overflow-tooltip>
1916 <template #default="scope">
1917 <div v-if="scope.row.isEdit">
1918 <el-select v-if="scope.row['isEdit']" v-model="scope.row['dictionaryGuid']" placeholder="请选择分级"
1919 clearable filterable>
1920 <el-option v-for="opt in dictionaryList1" :key="opt['guid']" :label="opt['chName']"
1921 :value="opt['guid']" />
1922 </el-select>
1923 </div>
1924 <div v-else>
1925 {{ dictionaryList1.find(d => d.guid === scope.row['dictionaryGuid'])?.chName || '--' }}
1926 </div>
1927 </template>
1886 </el-table-column> 1928 </el-table-column>
1929
1887 <el-table-column prop="isPrimary" label="是否主键" width="90px" align="left" show-overflow-tooltip> 1930 <el-table-column prop="isPrimary" label="是否主键" width="90px" align="left" show-overflow-tooltip>
1888 <template #default="scope"> 1931 <template #default="scope">
1889 <el-select v-if="scope.row['isEdit']" v-model="scope.row['isPrimary']" placeholder="请选择"> 1932 <el-select v-if="scope.row['isEdit']" v-model="scope.row['isPrimary']" placeholder="请选择">
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!