refactor(系统设置): 插件表单支持按条件显示
This commit is contained in:
parent
ccaedcda59
commit
8650f3ea10
|
@ -3,16 +3,20 @@
|
||||||
<el-form-item :label="config.i18n ? $t(config.label) : config.label">
|
<el-form-item :label="config.i18n ? $t(config.label) : config.label">
|
||||||
<ms-instructions-icon size="10" :content="config.i18n ? $t(config.instructionsInfo) : config.instructionsInfo"/>
|
<ms-instructions-icon size="10" :content="config.i18n ? $t(config.instructionsInfo) : config.instructionsInfo"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<span v-for="item in config.formItems"
|
||||||
v-for="item in config.formItems"
|
:key="item.name">
|
||||||
:key="item.name"
|
<el-form-item
|
||||||
:label="item.i18n ? $t(item.label) : item.label"
|
v-if="!item.displayConditions
|
||||||
:prop="item.name">
|
|| accountConfig[item.displayConditions.field] === item.displayConditions.value"
|
||||||
<custom-filed-component :form="accountConfig"
|
:label="item.i18n ? $t(item.label) : item.label"
|
||||||
|
:prop="item.name">
|
||||||
|
<custom-filed-component :form="accountConfig"
|
||||||
:data="item"
|
:data="item"
|
||||||
prop="defaultValue"/>
|
prop="defaultValue"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" style="float: right" @click="handleAuth" size="mini">
|
<el-button type="primary" style="float: right" @click="handleAuth" size="mini">
|
||||||
{{ $t('commons.validate') }}
|
{{ $t('commons.validate') }}
|
||||||
|
@ -54,7 +58,7 @@ export default {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -65,7 +69,9 @@ export default {
|
||||||
}
|
}
|
||||||
// 设置默认值
|
// 设置默认值
|
||||||
if (this.accountConfig[item.name]) {
|
if (this.accountConfig[item.name]) {
|
||||||
this.$set(item, 'defaultValue', this.accountConfig[item.name]);
|
if (this.accountConfig[item.name]) {
|
||||||
|
this.$set(item, 'defaultValue', this.accountConfig[item.name]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.rules = getPlatformFormRules(this.config);
|
this.rules = getPlatformFormRules(this.config);
|
||||||
|
|
|
@ -169,6 +169,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.setFormData();
|
||||||
if (['member', 'multipleMember'].indexOf(this.data.type) < 0) {
|
if (['member', 'multipleMember'].indexOf(this.data.type) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -180,6 +181,11 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
form() {
|
||||||
|
this.setFormData();
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getTranslateOption(item) {
|
getTranslateOption(item) {
|
||||||
return item.system ? this.$t(item.text) : item.text;
|
return item.system ? this.$t(item.text) : item.text;
|
||||||
|
@ -191,6 +197,11 @@ export default {
|
||||||
this.$emit('change', this.data.name);
|
this.$emit('change', this.data.name);
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
},
|
},
|
||||||
|
setFormData() {
|
||||||
|
if (this.form && this.data && this.data[this.prop]) {
|
||||||
|
this.$set(this.form, this.data.name, this.data[this.prop]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -738,11 +738,14 @@ const message = {
|
||||||
app_key: 'APP key',
|
app_key: 'APP key',
|
||||||
account: 'Account',
|
account: 'Account',
|
||||||
password: 'Password',
|
password: 'Password',
|
||||||
|
token_auth: 'Token',
|
||||||
|
password_auth: 'Password',
|
||||||
jira_url: 'JIRA url',
|
jira_url: 'JIRA url',
|
||||||
jira_issuetype: 'JIRA issue type',
|
jira_issuetype: 'JIRA issue type',
|
||||||
jira_storytype: 'JIRA story type',
|
jira_storytype: 'JIRA story type',
|
||||||
input_api_account: 'please enter account',
|
input_api_account: 'please enter account',
|
||||||
input_api_password: 'Please enter password',
|
input_api_password: 'Please enter password',
|
||||||
|
input_token: 'Please enter token',
|
||||||
input_jira_url: 'Please enter Jira address, for example: https://metersphere.atlassian.net/',
|
input_jira_url: 'Please enter Jira address, for example: https://metersphere.atlassian.net/',
|
||||||
input_jira_issuetype: 'Please enter the issue type',
|
input_jira_issuetype: 'Please enter the issue type',
|
||||||
input_jira_storytype: 'Please enter the story type',
|
input_jira_storytype: 'Please enter the story type',
|
||||||
|
|
|
@ -746,11 +746,14 @@ const message = {
|
||||||
app_key: '密钥',
|
app_key: '密钥',
|
||||||
account: '账号',
|
account: '账号',
|
||||||
password: '密码',
|
password: '密码',
|
||||||
|
token_auth: 'Token 认证',
|
||||||
|
password_auth: '账号密码认证',
|
||||||
jira_url: 'JIRA 地址',
|
jira_url: 'JIRA 地址',
|
||||||
jira_issuetype: '问题类型',
|
jira_issuetype: '问题类型',
|
||||||
jira_storytype: '需求类型',
|
jira_storytype: '需求类型',
|
||||||
input_api_account: '请输入账号',
|
input_api_account: '请输入账号',
|
||||||
input_api_password: '请输入密码',
|
input_api_password: '请输入密码',
|
||||||
|
input_token: '请输入Token',
|
||||||
input_jira_url: '请输入Jira地址,例:https://metersphere.atlassian.net/',
|
input_jira_url: '请输入Jira地址,例:https://metersphere.atlassian.net/',
|
||||||
input_jira_issuetype: '请输入问题类型',
|
input_jira_issuetype: '请输入问题类型',
|
||||||
input_jira_storytype: '请输入需求类型',
|
input_jira_storytype: '请输入需求类型',
|
||||||
|
|
|
@ -742,11 +742,14 @@ const message = {
|
||||||
app_key: '密鑰',
|
app_key: '密鑰',
|
||||||
account: '賬號',
|
account: '賬號',
|
||||||
password: '密碼',
|
password: '密碼',
|
||||||
|
token_auth: 'Token 認證',
|
||||||
|
password_auth: '賬號密碼認證',
|
||||||
jira_url: 'JIRA 地址',
|
jira_url: 'JIRA 地址',
|
||||||
jira_issuetype: '問題類型',
|
jira_issuetype: '問題類型',
|
||||||
jira_storytype: '需求類型',
|
jira_storytype: '需求類型',
|
||||||
input_api_account: '請輸入賬號',
|
input_api_account: '請輸入賬號',
|
||||||
input_api_password: '請輸入密碼',
|
input_api_password: '請輸入密碼',
|
||||||
|
input_token: '請輸入Token',
|
||||||
input_jira_url: '請輸入Jira地址,例:https://metersphere.atlassian.net/',
|
input_jira_url: '請輸入Jira地址,例:https://metersphere.atlassian.net/',
|
||||||
input_jira_issuetype: '請輸入問題類型',
|
input_jira_issuetype: '請輸入問題類型',
|
||||||
input_jira_storytype: '請輸入需求類型',
|
input_jira_storytype: '請輸入需求類型',
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -22,7 +22,7 @@
|
||||||
<java.version>11</java.version>
|
<java.version>11</java.version>
|
||||||
<spring-cloud.version>2021.0.5</spring-cloud.version>
|
<spring-cloud.version>2021.0.5</spring-cloud.version>
|
||||||
<dubbo.version>2.7.18</dubbo.version>
|
<dubbo.version>2.7.18</dubbo.version>
|
||||||
<platform-plugin-sdk.version>1.3.0</platform-plugin-sdk.version>
|
<platform-plugin-sdk.version>1.4.0</platform-plugin-sdk.version>
|
||||||
<flyway.version>7.15.0</flyway.version>
|
<flyway.version>7.15.0</flyway.version>
|
||||||
<shiro.version>1.10.1</shiro.version>
|
<shiro.version>1.10.1</shiro.version>
|
||||||
<mssql-jdbc.version>7.4.1.jre8</mssql-jdbc.version>
|
<mssql-jdbc.version>7.4.1.jre8</mssql-jdbc.version>
|
||||||
|
|
|
@ -3,24 +3,27 @@
|
||||||
<div style="width: 500px">
|
<div style="width: 500px">
|
||||||
<div style="margin-top: 20px;margin-bottom: 10px">{{ $t('organization.integration.basic_auth_info') }}</div>
|
<div style="margin-top: 20px;margin-bottom: 10px">{{ $t('organization.integration.basic_auth_info') }}</div>
|
||||||
<el-form :model="form" ref="form" label-width="100px" size="small" :disabled="show" :rules="rules">
|
<el-form :model="form" ref="form" label-width="100px" size="small" :disabled="show" :rules="rules">
|
||||||
<el-form-item
|
<span v-for="item in config.formItems"
|
||||||
v-for="item in config.formItems"
|
:key="item.name">
|
||||||
:key="item.name"
|
<el-form-item
|
||||||
:label="item.i18n ? $t(item.label) : item.label"
|
v-if="!item.displayConditions
|
||||||
:prop="item.name">
|
|| form[item.displayConditions.field] === item.displayConditions.value"
|
||||||
<custom-filed-component :form="form"
|
:label="item.i18n ? $t(item.label) : item.label"
|
||||||
:data="item"
|
:prop="item.name">
|
||||||
prop="defaultValue"/>
|
<custom-filed-component :form="form"
|
||||||
<ms-instructions-icon v-if="item.instructionsIcon || item.instructionsTip" effect="light">
|
:data="item"
|
||||||
<template>
|
prop="defaultValue"/>
|
||||||
<img v-if="item.instructionsIcon"
|
<ms-instructions-icon v-if="item.instructionsIcon || item.instructionsTip" effect="light">
|
||||||
:src="getPlatformImageUrl(config, item)"/>
|
<template>
|
||||||
<span v-if="item.instructionsTip">
|
<img v-if="item.instructionsIcon"
|
||||||
{{ item.instructionsTip }}
|
:src="getPlatformImageUrl(config, item)"/>
|
||||||
</span>
|
<span v-if="item.instructionsTip">
|
||||||
</template>
|
{{ item.instructionsTip }}
|
||||||
</ms-instructions-icon>
|
</span>
|
||||||
</el-form-item>
|
</template>
|
||||||
|
</ms-instructions-icon>
|
||||||
|
</el-form-item>
|
||||||
|
</span>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -34,7 +37,7 @@
|
||||||
:show.sync="show"
|
:show.sync="show"
|
||||||
ref="bugBtn"/>
|
ref="bugBtn"/>
|
||||||
|
|
||||||
<div class="defect-tip" >
|
<div class="defect-tip">
|
||||||
<div>{{ $t('organization.integration.use_tip') }}</div>
|
<div>{{ $t('organization.integration.use_tip') }}</div>
|
||||||
<div v-html="config.tips"></div>
|
<div v-html="config.tips"></div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -113,7 +116,9 @@ export default {
|
||||||
this.form = form;
|
this.form = form;
|
||||||
// 设置默认值
|
// 设置默认值
|
||||||
this.config.formItems.forEach(item => {
|
this.config.formItems.forEach(item => {
|
||||||
this.$set(item, 'defaultValue', this.form[item.name]);
|
if (this.form[item.name]) {
|
||||||
|
this.$set(item, 'defaultValue', this.form[item.name]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
Loading…
Reference in New Issue