refactor(系统设置): 插件表单支持按条件显示
This commit is contained in:
parent
365164eb9b
commit
51e60e70ef
|
@ -3,9 +3,11 @@
|
|||
<el-form-item :label="config.i18n ? $t(config.label) : config.label">
|
||||
<ms-instructions-icon size="10" :content="config.i18n ? $t(config.instructionsInfo) : config.instructionsInfo"/>
|
||||
</el-form-item>
|
||||
<span v-for="item in config.formItems"
|
||||
:key="item.name">
|
||||
<el-form-item
|
||||
v-for="item in config.formItems"
|
||||
:key="item.name"
|
||||
v-if="!item.displayConditions
|
||||
|| accountConfig[item.displayConditions.field] === item.displayConditions.value"
|
||||
:label="item.i18n ? $t(item.label) : item.label"
|
||||
:prop="item.name">
|
||||
<custom-filed-component :form="accountConfig"
|
||||
|
@ -13,6 +15,8 @@
|
|||
prop="defaultValue"/>
|
||||
</el-form-item>
|
||||
|
||||
</span>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" style="float: right" @click="handleAuth" size="mini">
|
||||
{{ $t('commons.validate') }}
|
||||
|
@ -54,7 +58,7 @@ export default {
|
|||
this.init();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
|
@ -64,9 +68,11 @@ export default {
|
|||
item.options = [];
|
||||
}
|
||||
// 设置默认值
|
||||
if (this.accountConfig[item.name]) {
|
||||
if (this.accountConfig[item.name]) {
|
||||
this.$set(item, 'defaultValue', this.accountConfig[item.name]);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.rules = getPlatformFormRules(this.config);
|
||||
},
|
||||
|
|
|
@ -169,6 +169,7 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
this.setFormData();
|
||||
if (['member', 'multipleMember'].indexOf(this.data.type) < 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -180,6 +181,11 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
form() {
|
||||
this.setFormData();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getTranslateOption(item) {
|
||||
return item.system ? this.$t(item.text) : item.text;
|
||||
|
@ -191,6 +197,11 @@ export default {
|
|||
this.$emit('change', this.data.name);
|
||||
this.$forceUpdate();
|
||||
},
|
||||
setFormData() {
|
||||
if (this.form && this.data && this.data[this.prop]) {
|
||||
this.$set(this.form, this.data.name, this.data[this.prop]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -742,11 +742,14 @@ const message = {
|
|||
app_key: 'APP key',
|
||||
account: 'Account',
|
||||
password: 'Password',
|
||||
token_auth: 'Token',
|
||||
password_auth: 'Password',
|
||||
jira_url: 'JIRA url',
|
||||
jira_issuetype: 'JIRA issue type',
|
||||
jira_storytype: 'JIRA story type',
|
||||
input_api_account: 'please enter account',
|
||||
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_issuetype: 'Please enter the issue type',
|
||||
input_jira_storytype: 'Please enter the story type',
|
||||
|
|
|
@ -747,11 +747,14 @@ const message = {
|
|||
app_key: '密钥',
|
||||
account: '账号',
|
||||
password: '密码',
|
||||
token_auth: 'Token 认证',
|
||||
password_auth: '账号密码认证',
|
||||
jira_url: 'JIRA 地址',
|
||||
jira_issuetype: '问题类型',
|
||||
jira_storytype: '需求类型',
|
||||
input_api_account: '请输入账号',
|
||||
input_api_password: '请输入密码',
|
||||
input_token: '请输入Token',
|
||||
input_jira_url: '请输入Jira地址,例:https://metersphere.atlassian.net/',
|
||||
input_jira_issuetype: '请输入问题类型',
|
||||
input_jira_storytype: '请输入需求类型',
|
||||
|
|
|
@ -746,11 +746,14 @@ const message = {
|
|||
app_key: '密鑰',
|
||||
account: '賬號',
|
||||
password: '密碼',
|
||||
token_auth: 'Token 認證',
|
||||
password_auth: '賬號密碼認證',
|
||||
jira_url: 'JIRA 地址',
|
||||
jira_issuetype: '問題類型',
|
||||
jira_storytype: '需求類型',
|
||||
input_api_account: '請輸入賬號',
|
||||
input_api_password: '請輸入密碼',
|
||||
input_token: '請輸入Token',
|
||||
input_jira_url: '請輸入Jira地址,例:https://metersphere.atlassian.net/',
|
||||
input_jira_issuetype: '請輸入問題類型',
|
||||
input_jira_storytype: '請輸入需求類型',
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -22,7 +22,7 @@
|
|||
<java.version>17</java.version>
|
||||
<spring-cloud.version>2022.0.1</spring-cloud.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>
|
||||
<shiro.version>1.11.0</shiro.version>
|
||||
<mssql-jdbc.version>7.4.1.jre8</mssql-jdbc.version>
|
||||
<postgresql.version>42.3.8</postgresql.version>
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
<div style="width: 500px">
|
||||
<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">
|
||||
<span v-for="item in config.formItems"
|
||||
:key="item.name">
|
||||
<el-form-item
|
||||
v-for="item in config.formItems"
|
||||
:key="item.name"
|
||||
v-if="!item.displayConditions
|
||||
|| form[item.displayConditions.field] === item.displayConditions.value"
|
||||
:label="item.i18n ? $t(item.label) : item.label"
|
||||
:prop="item.name">
|
||||
<custom-filed-component :form="form"
|
||||
|
@ -21,6 +23,7 @@
|
|||
</template>
|
||||
</ms-instructions-icon>
|
||||
</el-form-item>
|
||||
</span>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
|
@ -34,7 +37,7 @@
|
|||
:show.sync="show"
|
||||
ref="bugBtn"/>
|
||||
|
||||
<div class="defect-tip" >
|
||||
<div class="defect-tip">
|
||||
<div>{{ $t('organization.integration.use_tip') }}</div>
|
||||
<div v-html="config.tips"></div>
|
||||
<div>
|
||||
|
@ -113,7 +116,9 @@ export default {
|
|||
this.form = form;
|
||||
// 设置默认值
|
||||
this.config.formItems.forEach(item => {
|
||||
if (this.form[item.name]) {
|
||||
this.$set(item, 'defaultValue', this.form[item.name]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.clear();
|
||||
|
|
Loading…
Reference in New Issue