fix(组件): 脑图&formTable 组件问题修复&lint

This commit is contained in:
baiqi 2024-07-22 11:52:11 +08:00 committed by 刘瑞斌
parent b7760714a0
commit a78d3364c0
9 changed files with 67 additions and 25 deletions

View File

@ -23,9 +23,12 @@ import {
scheduleOrgCenterListUrl,
scheduleProCenterListUrl,
scheduleSysCenterListUrl,
stopRealOrdApiUrl, stopRealOrgPlanUrl,
stopRealProjectApiUrl, stopRealProjectPlanUrl,
stopRealSysApiUrl, stopRealSysPlanUrl,
stopRealOrdApiUrl,
stopRealOrgPlanUrl,
stopRealProjectApiUrl,
stopRealProjectPlanUrl,
stopRealSysApiUrl,
stopRealSysPlanUrl,
systemRealTotal,
systemScheduleTotal,
taskOrgPlanRealCenterListUrl,

View File

@ -89,7 +89,7 @@
import useAppStore from '@/store/modules/app';
import useMinderStore from '@/store/modules/components/minder-editor/index';
import { MinderCustomEvent } from '@/store/modules/components/minder-editor/types';
import { filterTree, findNodeByKey, getGenerateId, mapTree, replaceNodeInTree } from '@/utils';
import { filterTree, findNodeByKey, getGenerateId, mapTree, replaceNodeInTree, traverseTree } from '@/utils';
import { hasAnyPermission } from '@/utils/permission';
import {
@ -762,6 +762,21 @@
deleteResourceList: clearDeleteResource ? [] : tempMinderParams.value.deleteResourceList, //
additionalNodeList: [],
};
if (clearDeleteResource) {
traverseTree(importJson.value.root.children, (node) => {
const minderNode: MinderJsonNode = window.minder.getNodeById(node.data.id);
if (minderNode?.data) {
// isNew changed
minderNode.data.isNew = false;
minderNode.data.changed = false;
} else {
// isNew changed
node.data.isNew = false;
node.data.changed = false;
}
return true;
});
}
}
/**
@ -810,16 +825,6 @@
});
}
}
const minderNode: MinderJsonNode = window.minder.getNodeById(node.data.id);
if (minderNode?.data) {
// isNew changed
minderNode.data.isNew = false;
minderNode.data.changed = false;
} else {
// isNew changed
node.data.isNew = false;
node.data.changed = false;
}
return true;
});
return tempMinderParams.value;
@ -830,7 +835,7 @@
* @param fullJson 脑图导出的完整数据
* @param callback 保存成功回调
*/
async function handleMinderSave(fullJson: MinderJson, callback: (refersh: boolean) => void) {
async function handleMinderSave(fullJson: MinderJson, callback: (refresh: boolean) => void) {
try {
loading.value = true;
await saveCaseMinder(makeMinderParams(fullJson));

View File

@ -82,6 +82,7 @@
title: '',
disabled: false,
size: 'medium',
maxLength: 1000,
}
);
const emit = defineEmits<{

View File

@ -1,6 +1,6 @@
<template>
<MsSelect
v-model:model-value="currentValue"
v-model:model-value="innerValue"
mode="remote"
:options="[]"
:placeholder="props.placeholder || 'common.pleaseSelectMember'"
@ -16,7 +16,13 @@
:remote-func="loadList"
:remote-extra-params="{ ...props.loadOptionParams, type: props.type }"
:option-label-render="optionLabelRender"
:fallback-option="(val) => ({
label: (val as Record<string, any>).name,
value: val,
})"
:object-value="true"
:should-calculate-max-tag="false"
@remote-search="handleRemoteSearch"
>
</MsSelect>
</template>
@ -61,7 +67,8 @@
}
);
const currentValue = defineModel<(string | number)[] | string>({ default: [] });
const currentValue = defineModel<(string | number)[]>('modelValue', { default: [] });
const innerValue = ref<MsUserSelectorOption[]>([]);
const loading = ref(true);
const loadList = async (params: Record<string, any>) => {
@ -99,4 +106,28 @@
}
return `<span class='text-[var(--color-text-1)]'>${option.name}</span>`;
};
watch(
() => innerValue.value,
(value) => {
const values: (string | number)[] = [];
value.forEach((item) => {
values.push(item.id);
});
currentValue.value = values;
}
);
function handleRemoteSearch(options: MsUserSelectorOption[]) {
if (currentValue.value.length > 0 && innerValue.value.length === 0) {
const values: MsUserSelectorOption[] = [];
currentValue.value.forEach((item) => {
const option = options.find((o) => o.id === item);
if (option) {
values.push(option);
}
});
innerValue.value = values;
}
}
</script>

View File

@ -158,6 +158,7 @@
class="ms-form-table-input"
:auto-size="{ minRows: 1, maxRows: 1 }"
:size="item.size || 'medium'"
:max-length="item.maxLength"
@input="() => handleFormChange(record, rowIndex, item)"
></a-textarea>
<MsQuickInput
@ -165,6 +166,7 @@
v-model:model-value="record[item.dataIndex as string]"
:title="item.title as string || ''"
:disabled="props.disabled || item.disabled || record.disabled"
:max-length="item.maxLength"
class="ms-form-table-input"
type="textarea"
@input="() => handleFormChange(record, rowIndex, item)"

View File

@ -58,7 +58,7 @@ export interface SearchParams {
export interface AddProjectMember {
projectId?: string;
userIds: string[] | string;
userIds: string[];
roleIds: string[] | string;
}

View File

@ -57,6 +57,6 @@ export default {
'project.taskCenter.filterProPlaceholderText': '请选择所属项目',
'project.taskCenter.filterOrgPlaceholderText': '请选择所属组织',
'project.executionHistory.cleared': '执行结果被清理',
'project.taskCenter.plan': '计划',
'project.taskCenter.planGroup': '计划组',
'project.taskCenter.plan': '计划',
'project.taskCenter.planGroup': '计划组',
};

View File

@ -20,7 +20,7 @@
<!-- 编辑项目 -->
<a-form-item v-if="type === 'edit'" :label="t('organization.member.project')" asterisk-position="end">
<MsUserSelector
v-model="form.projectIds"
v-model:modelValue="form.projectIds"
:load-option-params="{ organizationId: lastOrganizationId }"
:type="UserRequestTypeEnum.SYSTEM_ORGANIZATION_PROJECT"
placeholder="organization.member.selectProjectScope"
@ -35,7 +35,7 @@
:rules="[{ required: true, message: t('organization.member.selectMemberEmptyTip') }]"
>
<MsUserSelector
v-model="form.memberIds"
v-model:modelValue="form.memberIds"
:load-option-params="{ organizationId: lastOrganizationId }"
:type="UserRequestTypeEnum.SYSTEM_ORGANIZATION_MEMBER"
placeholder="organization.member.selectMemberScope"
@ -100,8 +100,8 @@
export interface InitFromType {
organizationId?: string;
userRoleIds: string[];
memberIds: string[];
projectIds: string[];
memberIds: (string | number)[];
projectIds: (string | number)[];
}
const initFormValue: InitFromType = {

View File

@ -35,5 +35,5 @@ export default {
'system.log.log': 'Operation log',
'system.log.time': 'Operation time',
'system.log.content': 'in {module} under {range}',
'system.log.operateType.stop': 'Stop',
'system.log.operateType.stop': 'Stop',
};