flat: 修复bug

This commit is contained in:
史典卓
2025-07-21 14:49:45 +08:00
parent ec2dc5f659
commit ea04387b58
17 changed files with 171 additions and 108 deletions

View File

@@ -58,9 +58,9 @@ const state = reactive({
visible: false,
});
onMounted(() => {
serchforIt();
});
// onMounted(() => {
// serchforIt();
// });
// 统一处理二维数组格式
const processedListData = computed(() => {
@@ -82,11 +82,11 @@ const open = (newConfig = {}) => {
rowLabel: configRowLabel = 'label',
rowKey: configRowKey = 'value',
maskClick: configMaskClick = false,
defaultIndex = [],
defaultId = '',
} = newConfig;
reset();
serchforIt();
serchforIt(defaultId);
if (configTitle) title.value = configTitle;
if (typeof success === 'function') confirmCallback.value = success;
@@ -143,11 +143,13 @@ const handleClick = async (callback) => {
console.error('confirmCallback 执行出错:', error);
}
};
function serchforIt() {
function serchforIt(defaultId) {
if (state.stations.length) {
const ids = userInfo.value.jobTitleId.split(',').map((id) => Number(id));
const ids = defaultId
? defaultId.split(',').map((id) => Number(id))
: userInfo.value.jobTitleId.split(',').map((id) => Number(id));
count.value = ids.length;
state.jobTitleId = userInfo.value.jobTitleId;
state.jobTitleId = defaultId ? defaultId : userInfo.value.jobTitleId;
setCheckedNodes(state.stations, ids);
state.visible = true;
return;
@@ -166,14 +168,14 @@ function serchforIt() {
const reset = () => {
maskClick.value = false;
confirmCallback.value = null;
cancelCallback.value = null;
changeCallback.value = null;
listData.value = [];
selectedIndex.value = [0, 0, 0];
rowLabel.value = 'label';
rowKey.value = 'value';
selectedItems.value = [];
JobsIdsValue.value = '';
JobsLabelValue.value = '';
};
// 暴露方法给父组件