fix(个人中心): Tapd个人配置及校验问题

--bug=1047467 --user=宋昌昌 [个人中心]三方平台账号的TAPD账号和v2一致,是tapd昵称 https://www.tapd.cn/55049933/s/1597196
This commit is contained in:
song-cc-rock 2024-10-24 13:47:39 +08:00 committed by Craftsman
parent 1d9c4b2af7
commit c23ffa42f9
6 changed files with 45 additions and 16 deletions

View File

@ -4,6 +4,7 @@ import io.metersphere.plugin.platform.dto.request.PlatformRequest;
import io.metersphere.plugin.platform.spi.Platform;
import io.metersphere.sdk.constants.PluginScenarioType;
import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.domain.Plugin;
import io.metersphere.system.domain.ServiceIntegration;
import io.metersphere.system.domain.ServiceIntegrationExample;
@ -45,7 +46,7 @@ public class PlatformPluginService {
public Platform getPlatform(String pluginId, String orgId) {
ServiceIntegration serviceIntegration = getServiceIntegrationByPluginId(pluginId, orgId);
if (serviceIntegration == null) {
throw new MSException("service_integration.configuration.not_blank");
throw new MSException(Translator.get("service_integration.configuration.not_blank"));
}
return getPlatform(pluginId, orgId, new String(serviceIntegration.getConfiguration()));
}

View File

@ -38,7 +38,15 @@
:option="options"
>
</MsFormCreate>
<a-button type="outline" :loading="config.validateLoading" @click="validate(config)">
<a-button
v-if="config.pluginName === 'TAPD'"
type="outline"
:loading="config.validateLoading"
@click="saveNoValidate(config)"
>
{{ t('ms.personal.save') }}
</a-button>
<a-button v-else type="outline" :loading="config.validateLoading" @click="validate(config)">
{{ t('ms.personal.valid') }}
</a-button>
</div>
@ -217,6 +225,22 @@
});
}
async function saveNoValidate(config: any) {
config.validateLoading = true;
const configForms: Record<string, any> = {};
Object.keys(dynamicForm.value).forEach((key) => {
configForms[key] = {
...dynamicForm.value[key].formModel.form,
};
});
await savePlatform({
[currentOrg.value]: configForms,
});
Message.success(t('ms.personal.validPass'));
config.validateLoading = false;
config.status = 1;
}
async function handleOrgChange() {
await initPlatformAccountInfo();
initPlatformInfo();

View File

@ -73,6 +73,7 @@ export default {
'ms.personal.validFail': 'Verification failed',
'ms.personal.unValid': 'Not verified',
'ms.personal.valid': 'Verify and save',
'ms.personal.save': 'Save',
'ms.personal.authType': 'Authentication',
'ms.personal.platformAccount': 'Account',
'ms.personal.platformAccountPlaceholder': 'Please enter {type} account',

View File

@ -67,6 +67,7 @@ export default {
'ms.personal.validFail': '校验失败',
'ms.personal.unValid': '未校验',
'ms.personal.valid': '校验并保存',
'ms.personal.save': '保存',
'ms.personal.authType': '认证方式',
'ms.personal.platformAccount': '平台账号',
'ms.personal.platformAccountPlaceholder': '请输入 {type} 账号',

View File

@ -413,6 +413,7 @@
//
const getFormRules = (arr: BugEditCustomField[]) => {
formRules.value = [];
console.log(arr);
if (Array.isArray(arr) && arr.length) {
formRules.value = arr.map((item: any) => {
const initOptions = item.options || JSON.parse(item.platformOptionJson || '[]');

View File

@ -98,22 +98,23 @@ export function makeCustomFieldsParams(formItem: FormRuleItem[]) {
// 设置成员默认值
export function getDefaultMemberValue(item: DetailCustomField, initOptions: FieldOptions[]) {
// 系统模板创建人
if ((item.defaultValue as string | string[]).includes('CREATE_USER')) {
const optionsIds = initOptions.map((e: any) => e.value);
const userId = userStore.id as string;
if (optionsIds.includes(userId)) {
item.defaultValue = item.type === 'MEMBER' ? userId : [userId];
if (item.defaultValue) {
// 系统模板创建人
if ((item.defaultValue as string | string[]).includes('CREATE_USER')) {
const optionsIds = initOptions.map((e: any) => e.value);
const userId = userStore.id as string;
if (optionsIds.includes(userId)) {
item.defaultValue = item.type === 'MEMBER' ? userId : [userId];
} else {
item.defaultValue = item.type === 'MEMBER' ? '' : [];
}
// 三方默认创建人
} else {
item.defaultValue = item.type === 'MEMBER' ? '' : [];
item.defaultValue =
item.type === 'MULTIPLE_MEMBER' && item.defaultValue && typeof item.defaultValue === 'string'
? JSON.parse(item.defaultValue)
: item.defaultValue;
}
// 三方默认创建人
} else {
const value =
item.type === 'MULTIPLE_MEMBER' && item.defaultValue && typeof item.defaultValue === 'string'
? JSON.parse(item.defaultValue)
: item.defaultValue;
item.defaultValue = value;
}
return item.defaultValue;
}