[issue/4550]分类字典数据量过多会造成数据查询时间过长
This commit is contained in:
parent
f48e1125d0
commit
6d768d8320
|
@ -14,6 +14,7 @@
|
||||||
const isUpdate = ref(true);
|
const isUpdate = ref(true);
|
||||||
const expandedRowKeys = ref([]);
|
const expandedRowKeys = ref([]);
|
||||||
const treeData = ref([]);
|
const treeData = ref([]);
|
||||||
|
const isSubAdd = ref(false);
|
||||||
//表单配置
|
//表单配置
|
||||||
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
||||||
schemas: formSchema,
|
schemas: formSchema,
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
expandedRowKeys.value = [];
|
expandedRowKeys.value = [];
|
||||||
setModalProps({ confirmLoading: false, minHeight: 80 });
|
setModalProps({ confirmLoading: false, minHeight: 80 });
|
||||||
isUpdate.value = !!data?.isUpdate;
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
isSubAdd.value = !!!data?.isUpdate && data.record.id;
|
||||||
if (data?.record) {
|
if (data?.record) {
|
||||||
//表单赋值
|
//表单赋值
|
||||||
await setFieldsValue({
|
await setFieldsValue({
|
||||||
|
@ -79,7 +81,7 @@
|
||||||
//展开的节点信息
|
//展开的节点信息
|
||||||
await getExpandKeysByPid(values['pid'], unref(treeData));
|
await getExpandKeysByPid(values['pid'], unref(treeData));
|
||||||
//刷新列表(isUpdate:是否编辑;values:表单信息;expandedArr:展开的节点信息)
|
//刷新列表(isUpdate:是否编辑;values:表单信息;expandedArr:展开的节点信息)
|
||||||
emit('success', { isUpdate: unref(isUpdate), values: { ...values }, expandedArr: unref(expandedRowKeys).reverse() });
|
emit('success', { isUpdate: unref(isUpdate), isSubAdd:unref(isSubAdd), values: { ...values }, expandedArr: unref(expandedRowKeys).reverse() });
|
||||||
} finally {
|
} finally {
|
||||||
setModalProps({ confirmLoading: false });
|
setModalProps({ confirmLoading: false });
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@
|
||||||
/**
|
/**
|
||||||
* 成功回调
|
* 成功回调
|
||||||
*/
|
*/
|
||||||
async function handleSuccess({ isUpdate, values, expandedArr }) {
|
async function handleSuccess({ isUpdate,isSubAdd, values, expandedArr }) {
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
//编辑回调
|
//编辑回调
|
||||||
updateTableDataRecord(values.id, values);
|
updateTableDataRecord(values.id, values);
|
||||||
|
@ -155,6 +155,11 @@
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
//新增子集
|
//新增子集
|
||||||
|
//update-begin-author:liusq---date:20230411--for: [issue/4550]分类字典数据量过多会造成数据查询时间过长---
|
||||||
|
if(isSubAdd){
|
||||||
|
await expandTreeNode(values.pid);
|
||||||
|
//update-end-author:liusq---date:20230411--for: [issue/4550]分类字典数据量过多会造成数据查询时间过长---
|
||||||
|
}else{
|
||||||
expandedRowKeys.value = [];
|
expandedRowKeys.value = [];
|
||||||
for (let key of unref(expandedArr)) {
|
for (let key of unref(expandedArr)) {
|
||||||
await expandTreeNode(key);
|
await expandTreeNode(key);
|
||||||
|
@ -162,6 +167,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口请求成功后回调
|
* 接口请求成功后回调
|
||||||
|
@ -247,8 +253,12 @@
|
||||||
*操作表格后处理树节点展开合并
|
*操作表格后处理树节点展开合并
|
||||||
* */
|
* */
|
||||||
async function expandTreeNode(key) {
|
async function expandTreeNode(key) {
|
||||||
let record = findTableDataRecord(key);
|
let record:any = findTableDataRecord(key);
|
||||||
|
//update-begin-author:liusq---date:20230411--for: [issue/4550]分类字典数据量过多会造成数据查询时间过长,显示“接口请求超时,请刷新页面重试!”---
|
||||||
|
if(!expandedRowKeys.value.includes(key)){
|
||||||
expandedRowKeys.value.push(key);
|
expandedRowKeys.value.push(key);
|
||||||
|
}
|
||||||
|
//update-end-author:liusq---date:20230411--for: [issue/4550]分类字典数据量过多会造成数据查询时间过长,显示“接口请求超时,请刷新页面重试!”---
|
||||||
let result = await getChildList({ pid: key });
|
let result = await getChildList({ pid: key });
|
||||||
if (result && result.length > 0) {
|
if (result && result.length > 0) {
|
||||||
record.children = getDataByResult(result);
|
record.children = getDataByResult(result);
|
||||||
|
|
Loading…
Reference in New Issue