433bc83b by xukangle

fix : 修改loading效果

1 parent d317a29e
......@@ -172,6 +172,14 @@ export const getLargeCategoryList = (params) => request({
method: 'get',
})
/**
* 获取字段类型
*/
export const getFieldTypeList = (params) => request({
url: `${import.meta.env.VITE_APP_CONFIG_URL}/dict/data/get-by-dictType?dictType=${params.dictType}`,
method: 'get',
})
/** 分类分级模板数据 */
export const getTempleteClassifyData = (data) => request({
......
......@@ -16,7 +16,8 @@ import {
getDbDirFieldClassifyAndGrade,
getDbDirTableSelectList,
getTaskExeTreeList,
getGradeList
getGradeList,
getFieldTypeList,
} from "@/api/modules/dataInventory";
import existingTableSelect from "./existingTableSelect.vue";
......@@ -49,26 +50,7 @@ const processData = (data) => {
databaseGuid: undefined, // 删除旧键 "databaseGuid"
})).map(({ databaseGuid, ...rest }) => rest); // 过滤掉 undefined 键
};
// 获取分类分级的数据 getDbDirFieldClassifyAndGrade
const gradeList: any = ref([]);
const classifyList: any = ref([]);
// const getDbDirFieldClassifyAndGradeList = async () => {
// const params = {
// execGuid: execGuid.value,
// type: 'C',
// fieldName: 'classifyName',
// }
// const res: any = await getDbDirFieldClassifyAndGrade(params);
// if (res.code === proxy.$passCode) {
// console.log('分类分级数据', res.data)
// } else {
// proxy.$ElMessage.error(res.msg);
// }
// };
// 获取分类树形数据
// 定义树形选择器的属性
const treeSelectProps = {
......@@ -94,40 +76,77 @@ const getFieldTree = () => {
ElMessage.error('获取分类树形数据失败');
})
}
// 获取分类名称的方法
const matchedItem = ref<any>();
// 获取分级的数据
// 分级的数据props
const gradeSelectProps = {
value: 'guid',
label: 'name',
}
// 字段类型props
const fieldTypeProps = {
value: 'value',
label: 'label',
}
// 获取字段类型
const fieldData = ref<any>();
const getFieldTypeData = async () => {
const params = {
dictType: "字段类型"
}
const res: any = await getFieldTypeList(params);
if (res.code == proxy.$passCode) {
fieldData.value = options;
} else {
proxy.$ElMessage.error(res.msg);
}
}
// 进入编辑模式
const findRefGradeGuid = (data, targetClassifyDetailGuid) => {
// 遍历当前数据
for (const item of data) {
// 判断当前节点是否匹配
if (item.classifyDetailGuid === targetClassifyDetailGuid) {
return item.refGradeGuid; // 找到匹配的,返回 refGradeGuid
}
// 如果当前节点有 children,则递归查找子节点
if (Array.isArray(item.children) && item.children.length > 0) {
const result = findRefGradeGuid(item.children, targetClassifyDetailGuid);
if (result) {
return result; // 如果子节点中找到匹配,返回结果
}
}
}
return null; // 没有找到匹配项时返回 null
};
const editRow = (row) => {
console.log('进入编辑模式', row.classifyDetailGuid)
// 进入编辑模式时,查找classifyDetailGuid所在的refGradeGuid
treeSelectOptions.value.forEach(item => {
if (item.classifyDetailGuid === row.classifyDetailGuid) {
refGradeGuid.value = item.refGradeGuid;
}
});
getGradeList({ classifyGradeGuid: row.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => {
console.log('row进来了吗')
let refGradeGuid = findRefGradeGuid(treeSelectOptions.value, row.classifyDetailGuid);
getGradeList({ classifyGradeGuid: refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => {
if (res.code === proxy.$passCode) {
row.gradeOptions = res.data.records || [];
} else {
ElMessage.error(res.msg);
}
});
// 这个是指定是否能编辑的字段
editableFields.sourceFieldName = false;
row.isEdit = true
}
const handleGradeChange = (row) => {
console.log('分级改变', row)
const gradeOptions = row.gradeOptions || [];
const matchedItem = gradeOptions.find((item) => item.guid === row.gradeDetailGuid);
if (matchedItem) {
row.gradeDetailName = matchedItem.name;
}
};
// 保存数据
const saveRow = (row) => {
console.log('保存数据', row)
editableFields.sourceFieldName = true;
row.isEdit = false
}
......@@ -135,6 +154,7 @@ const saveRow = (row) => {
onMounted(async () => {
await getDbDirDataSourceListData();
await getFieldTypeData();
});
const stepsInfo = ref({
......@@ -811,11 +831,11 @@ const createNewSql = () => {
</template>
</el-table-column>
<!-- 分级(不可编辑) -->
<el-table-column prop="gradeDetailName" label="分级" width="120" align="center">
<el-table-column prop="gradeDetailGuid" label="分级" width="120" align="center">
<template #default="scope">
<div v-if="scope.row.isEdit">
<el-select v-model="scope.row.gradeGuid" placeholder="请选择分级" clearable filterable
:props="gradeSelectProps">
<el-select v-model="scope.row.gradeDetailGuid" placeholder="请选择分级" clearable filterable
:props="gradeSelectProps" @change="handleGradeChange(scope.row)">
<el-option v-for="(item, index) in scope.row.gradeOptions || []" :key="index" :label="item.name"
:value="item.guid"></el-option>
</el-select>
......
......@@ -281,10 +281,10 @@ const newCreateClassStandardDialogInfo = ref({
handleClassDataClick(params, '');
}
})
newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
newCreateClassStandardDialogInfo.value.visible = false;
} else {
newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
proxy.$ElMessage.error(res.msg);
}
} else {
......@@ -364,10 +364,8 @@ const newCreateGradeStandardDialogInfo = ref({
type: 'success',
message: '新增分级成功'
})
// 拿到新增的分级数据,跳转到配置页面
const item = classifyGradListData.value.find(item => item.name === info.name);
if (item) {
const params = {
name: item.name,
......@@ -378,6 +376,7 @@ const newCreateGradeStandardDialogInfo = ref({
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
newCreateGradeStandardDialogInfo.value.visible = false;
} else {
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
proxy.$ElMessage.error(res.msg);
}
} else {
......@@ -558,7 +557,7 @@ const newCreateGrade = () => {
</el-icon>
</template>
<div class="levitation-ul">
<span class="levitation-li" @click="handleClassDataClick(item)">配置</span>
<span class="levitation-li" @click="handleClassDataClick(item)">编辑</span>
<!-- <span class="levitation-li" @click="handleClassDataEdit(item)">编辑</span> -->
<span class="levitation-li" @click="handleClassDataDel(item)">删除</span>
</div>
......@@ -591,7 +590,7 @@ const newCreateGrade = () => {
</el-icon>
</template>
<div class="levitation-ul">
<span class="levitation-li" @click="handleClassifyGradDataClick(item)">配置</span>
<span class="levitation-li" @click="handleClassifyGradDataClick(item)">编辑</span>
<!-- <span class="levitation-li" @click="handleClassifyGradDataEdit(item)">编辑</span> -->
<span class="levitation-li" @click="handleClassifyGradDataDel(item)">删除</span>
</div>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!