433bc83b by xukangle

fix : 修改loading效果

1 parent d317a29e
...@@ -172,6 +172,14 @@ export const getLargeCategoryList = (params) => request({ ...@@ -172,6 +172,14 @@ export const getLargeCategoryList = (params) => request({
172 method: 'get', 172 method: 'get',
173 }) 173 })
174 174
175 /**
176 * 获取字段类型
177 */
178 export const getFieldTypeList = (params) => request({
179 url: `${import.meta.env.VITE_APP_CONFIG_URL}/dict/data/get-by-dictType?dictType=${params.dictType}`,
180 method: 'get',
181 })
182
175 183
176 /** 分类分级模板数据 */ 184 /** 分类分级模板数据 */
177 export const getTempleteClassifyData = (data) => request({ 185 export const getTempleteClassifyData = (data) => request({
......
...@@ -16,7 +16,8 @@ import { ...@@ -16,7 +16,8 @@ import {
16 getDbDirFieldClassifyAndGrade, 16 getDbDirFieldClassifyAndGrade,
17 getDbDirTableSelectList, 17 getDbDirTableSelectList,
18 getTaskExeTreeList, 18 getTaskExeTreeList,
19 getGradeList 19 getGradeList,
20 getFieldTypeList,
20 } from "@/api/modules/dataInventory"; 21 } from "@/api/modules/dataInventory";
21 import existingTableSelect from "./existingTableSelect.vue"; 22 import existingTableSelect from "./existingTableSelect.vue";
22 23
...@@ -49,26 +50,7 @@ const processData = (data) => { ...@@ -49,26 +50,7 @@ const processData = (data) => {
49 databaseGuid: undefined, // 删除旧键 "databaseGuid" 50 databaseGuid: undefined, // 删除旧键 "databaseGuid"
50 })).map(({ databaseGuid, ...rest }) => rest); // 过滤掉 undefined 键 51 })).map(({ databaseGuid, ...rest }) => rest); // 过滤掉 undefined 键
51 }; 52 };
52
53 // 获取分类分级的数据 getDbDirFieldClassifyAndGrade
54 const gradeList: any = ref([]);
55 const classifyList: any = ref([]); 53 const classifyList: any = ref([]);
56
57 // const getDbDirFieldClassifyAndGradeList = async () => {
58 // const params = {
59 // execGuid: execGuid.value,
60 // type: 'C',
61 // fieldName: 'classifyName',
62 // }
63
64 // const res: any = await getDbDirFieldClassifyAndGrade(params);
65 // if (res.code === proxy.$passCode) {
66 // console.log('分类分级数据', res.data)
67 // } else {
68 // proxy.$ElMessage.error(res.msg);
69 // }
70 // };
71
72 // 获取分类树形数据 54 // 获取分类树形数据
73 // 定义树形选择器的属性 55 // 定义树形选择器的属性
74 const treeSelectProps = { 56 const treeSelectProps = {
...@@ -94,40 +76,77 @@ const getFieldTree = () => { ...@@ -94,40 +76,77 @@ const getFieldTree = () => {
94 ElMessage.error('获取分类树形数据失败'); 76 ElMessage.error('获取分类树形数据失败');
95 }) 77 })
96 } 78 }
97 79 // 分级的数据props
98 // 获取分类名称的方法
99 const matchedItem = ref<any>();
100 // 获取分级的数据
101 const gradeSelectProps = { 80 const gradeSelectProps = {
102 value: 'guid', 81 value: 'guid',
103 label: 'name', 82 label: 'name',
104 } 83 }
105 84
85 // 字段类型props
86 const fieldTypeProps = {
87 value: 'value',
88 label: 'label',
89 }
90
91 // 获取字段类型
92 const fieldData = ref<any>();
93 const getFieldTypeData = async () => {
94 const params = {
95 dictType: "字段类型"
96 }
97 const res: any = await getFieldTypeList(params);
98 if (res.code == proxy.$passCode) {
99 fieldData.value = options;
100 } else {
101 proxy.$ElMessage.error(res.msg);
102 }
103 }
104
106 // 进入编辑模式 105 // 进入编辑模式
106 const findRefGradeGuid = (data, targetClassifyDetailGuid) => {
107 // 遍历当前数据
108 for (const item of data) {
109 // 判断当前节点是否匹配
110 if (item.classifyDetailGuid === targetClassifyDetailGuid) {
111 return item.refGradeGuid; // 找到匹配的,返回 refGradeGuid
112 }
113
114 // 如果当前节点有 children,则递归查找子节点
115 if (Array.isArray(item.children) && item.children.length > 0) {
116 const result = findRefGradeGuid(item.children, targetClassifyDetailGuid);
117 if (result) {
118 return result; // 如果子节点中找到匹配,返回结果
119 }
120 }
121 }
122 return null; // 没有找到匹配项时返回 null
123 };
107 const editRow = (row) => { 124 const editRow = (row) => {
108 console.log('进入编辑模式', row.classifyDetailGuid)
109 // 进入编辑模式时,查找classifyDetailGuid所在的refGradeGuid 125 // 进入编辑模式时,查找classifyDetailGuid所在的refGradeGuid
110 treeSelectOptions.value.forEach(item => { 126 let refGradeGuid = findRefGradeGuid(treeSelectOptions.value, row.classifyDetailGuid);
111 if (item.classifyDetailGuid === row.classifyDetailGuid) { 127 getGradeList({ classifyGradeGuid: refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => {
112 refGradeGuid.value = item.refGradeGuid;
113 }
114 });
115 getGradeList({ classifyGradeGuid: row.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => {
116 console.log('row进来了吗')
117 if (res.code === proxy.$passCode) { 128 if (res.code === proxy.$passCode) {
118 row.gradeOptions = res.data.records || []; 129 row.gradeOptions = res.data.records || [];
119 } else { 130 } else {
120 ElMessage.error(res.msg); 131 ElMessage.error(res.msg);
121 } 132 }
122 }); 133 });
123
124
125 // 这个是指定是否能编辑的字段 134 // 这个是指定是否能编辑的字段
126 editableFields.sourceFieldName = false; 135 editableFields.sourceFieldName = false;
127 row.isEdit = true 136 row.isEdit = true
128 } 137 }
138
139 const handleGradeChange = (row) => {
140 console.log('分级改变', row)
141 const gradeOptions = row.gradeOptions || [];
142 const matchedItem = gradeOptions.find((item) => item.guid === row.gradeDetailGuid);
143 if (matchedItem) {
144 row.gradeDetailName = matchedItem.name;
145 }
146 };
129 // 保存数据 147 // 保存数据
130 const saveRow = (row) => { 148 const saveRow = (row) => {
149 console.log('保存数据', row)
131 editableFields.sourceFieldName = true; 150 editableFields.sourceFieldName = true;
132 row.isEdit = false 151 row.isEdit = false
133 } 152 }
...@@ -135,6 +154,7 @@ const saveRow = (row) => { ...@@ -135,6 +154,7 @@ const saveRow = (row) => {
135 154
136 onMounted(async () => { 155 onMounted(async () => {
137 await getDbDirDataSourceListData(); 156 await getDbDirDataSourceListData();
157 await getFieldTypeData();
138 }); 158 });
139 159
140 const stepsInfo = ref({ 160 const stepsInfo = ref({
...@@ -811,11 +831,11 @@ const createNewSql = () => { ...@@ -811,11 +831,11 @@ const createNewSql = () => {
811 </template> 831 </template>
812 </el-table-column> 832 </el-table-column>
813 <!-- 分级(不可编辑) --> 833 <!-- 分级(不可编辑) -->
814 <el-table-column prop="gradeDetailName" label="分级" width="120" align="center"> 834 <el-table-column prop="gradeDetailGuid" label="分级" width="120" align="center">
815 <template #default="scope"> 835 <template #default="scope">
816 <div v-if="scope.row.isEdit"> 836 <div v-if="scope.row.isEdit">
817 <el-select v-model="scope.row.gradeGuid" placeholder="请选择分级" clearable filterable 837 <el-select v-model="scope.row.gradeDetailGuid" placeholder="请选择分级" clearable filterable
818 :props="gradeSelectProps"> 838 :props="gradeSelectProps" @change="handleGradeChange(scope.row)">
819 <el-option v-for="(item, index) in scope.row.gradeOptions || []" :key="index" :label="item.name" 839 <el-option v-for="(item, index) in scope.row.gradeOptions || []" :key="index" :label="item.name"
820 :value="item.guid"></el-option> 840 :value="item.guid"></el-option>
821 </el-select> 841 </el-select>
......
...@@ -281,10 +281,10 @@ const newCreateClassStandardDialogInfo = ref({ ...@@ -281,10 +281,10 @@ const newCreateClassStandardDialogInfo = ref({
281 handleClassDataClick(params, ''); 281 handleClassDataClick(params, '');
282 } 282 }
283 }) 283 })
284
285 newCreateClassStandardDialogInfo.value.submitBtnLoading = false; 284 newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
286 newCreateClassStandardDialogInfo.value.visible = false; 285 newCreateClassStandardDialogInfo.value.visible = false;
287 } else { 286 } else {
287 newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
288 proxy.$ElMessage.error(res.msg); 288 proxy.$ElMessage.error(res.msg);
289 } 289 }
290 } else { 290 } else {
...@@ -364,10 +364,8 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -364,10 +364,8 @@ const newCreateGradeStandardDialogInfo = ref({
364 type: 'success', 364 type: 'success',
365 message: '新增分级成功' 365 message: '新增分级成功'
366 }) 366 })
367
368 // 拿到新增的分级数据,跳转到配置页面 367 // 拿到新增的分级数据,跳转到配置页面
369 const item = classifyGradListData.value.find(item => item.name === info.name); 368 const item = classifyGradListData.value.find(item => item.name === info.name);
370
371 if (item) { 369 if (item) {
372 const params = { 370 const params = {
373 name: item.name, 371 name: item.name,
...@@ -378,6 +376,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -378,6 +376,7 @@ const newCreateGradeStandardDialogInfo = ref({
378 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false; 376 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
379 newCreateGradeStandardDialogInfo.value.visible = false; 377 newCreateGradeStandardDialogInfo.value.visible = false;
380 } else { 378 } else {
379 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
381 proxy.$ElMessage.error(res.msg); 380 proxy.$ElMessage.error(res.msg);
382 } 381 }
383 } else { 382 } else {
...@@ -558,7 +557,7 @@ const newCreateGrade = () => { ...@@ -558,7 +557,7 @@ const newCreateGrade = () => {
558 </el-icon> 557 </el-icon>
559 </template> 558 </template>
560 <div class="levitation-ul"> 559 <div class="levitation-ul">
561 <span class="levitation-li" @click="handleClassDataClick(item)">配置</span> 560 <span class="levitation-li" @click="handleClassDataClick(item)">编辑</span>
562 <!-- <span class="levitation-li" @click="handleClassDataEdit(item)">编辑</span> --> 561 <!-- <span class="levitation-li" @click="handleClassDataEdit(item)">编辑</span> -->
563 <span class="levitation-li" @click="handleClassDataDel(item)">删除</span> 562 <span class="levitation-li" @click="handleClassDataDel(item)">删除</span>
564 </div> 563 </div>
...@@ -591,7 +590,7 @@ const newCreateGrade = () => { ...@@ -591,7 +590,7 @@ const newCreateGrade = () => {
591 </el-icon> 590 </el-icon>
592 </template> 591 </template>
593 <div class="levitation-ul"> 592 <div class="levitation-ul">
594 <span class="levitation-li" @click="handleClassifyGradDataClick(item)">配置</span> 593 <span class="levitation-li" @click="handleClassifyGradDataClick(item)">编辑</span>
595 <!-- <span class="levitation-li" @click="handleClassifyGradDataEdit(item)">编辑</span> --> 594 <!-- <span class="levitation-li" @click="handleClassifyGradDataEdit(item)">编辑</span> -->
596 <span class="levitation-li" @click="handleClassifyGradDataDel(item)">删除</span> 595 <span class="levitation-li" @click="handleClassifyGradDataDel(item)">删除</span>
597 </div> 596 </div>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!