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, scheduleOrgCenterListUrl,
scheduleProCenterListUrl, scheduleProCenterListUrl,
scheduleSysCenterListUrl, scheduleSysCenterListUrl,
stopRealOrdApiUrl, stopRealOrgPlanUrl, stopRealOrdApiUrl,
stopRealProjectApiUrl, stopRealProjectPlanUrl, stopRealOrgPlanUrl,
stopRealSysApiUrl, stopRealSysPlanUrl, stopRealProjectApiUrl,
stopRealProjectPlanUrl,
stopRealSysApiUrl,
stopRealSysPlanUrl,
systemRealTotal, systemRealTotal,
systemScheduleTotal, systemScheduleTotal,
taskOrgPlanRealCenterListUrl, taskOrgPlanRealCenterListUrl,

View File

@ -89,7 +89,7 @@
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import useMinderStore from '@/store/modules/components/minder-editor/index'; import useMinderStore from '@/store/modules/components/minder-editor/index';
import { MinderCustomEvent } from '@/store/modules/components/minder-editor/types'; 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 { hasAnyPermission } from '@/utils/permission';
import { import {
@ -762,6 +762,21 @@
deleteResourceList: clearDeleteResource ? [] : tempMinderParams.value.deleteResourceList, // deleteResourceList: clearDeleteResource ? [] : tempMinderParams.value.deleteResourceList, //
additionalNodeList: [], 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 true;
}); });
return tempMinderParams.value; return tempMinderParams.value;
@ -830,7 +835,7 @@
* @param fullJson 脑图导出的完整数据 * @param fullJson 脑图导出的完整数据
* @param callback 保存成功回调 * @param callback 保存成功回调
*/ */
async function handleMinderSave(fullJson: MinderJson, callback: (refersh: boolean) => void) { async function handleMinderSave(fullJson: MinderJson, callback: (refresh: boolean) => void) {
try { try {
loading.value = true; loading.value = true;
await saveCaseMinder(makeMinderParams(fullJson)); await saveCaseMinder(makeMinderParams(fullJson));

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<MsSelect <MsSelect
v-model:model-value="currentValue" v-model:model-value="innerValue"
mode="remote" mode="remote"
:options="[]" :options="[]"
:placeholder="props.placeholder || 'common.pleaseSelectMember'" :placeholder="props.placeholder || 'common.pleaseSelectMember'"
@ -16,7 +16,13 @@
:remote-func="loadList" :remote-func="loadList"
:remote-extra-params="{ ...props.loadOptionParams, type: props.type }" :remote-extra-params="{ ...props.loadOptionParams, type: props.type }"
:option-label-render="optionLabelRender" :option-label-render="optionLabelRender"
:fallback-option="(val) => ({
label: (val as Record<string, any>).name,
value: val,
})"
:object-value="true"
:should-calculate-max-tag="false" :should-calculate-max-tag="false"
@remote-search="handleRemoteSearch"
> >
</MsSelect> </MsSelect>
</template> </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 loading = ref(true);
const loadList = async (params: Record<string, any>) => { const loadList = async (params: Record<string, any>) => {
@ -99,4 +106,28 @@
} }
return `<span class='text-[var(--color-text-1)]'>${option.name}</span>`; 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> </script>

View File

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

View File

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

View File

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

View File

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

View File

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