|
@@ -27,6 +27,7 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import {getConfigByKey, updateConfigByKey} from '@/api/system/config';
|
|
import {getConfigByKey, updateConfigByKey} from '@/api/system/config';
|
|
|
|
|
+import {editTenantConfig, getTenantConfigByKey} from '@/api/tenant/tenant';
|
|
|
import yaml from "js-yaml";
|
|
import yaml from "js-yaml";
|
|
|
import MonacoEditor from "vue-monaco";
|
|
import MonacoEditor from "vue-monaco";
|
|
|
|
|
|
|
@@ -37,11 +38,17 @@ export default {
|
|
|
MonacoEditor
|
|
MonacoEditor
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ props: {
|
|
|
|
|
+ tenantId: {
|
|
|
|
|
+ type: [String, Number],
|
|
|
|
|
+ default: null
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
activeName: "projectConfig",
|
|
activeName: "projectConfig",
|
|
|
projectYaml: "",
|
|
projectYaml: "",
|
|
|
- tenantId: null,
|
|
|
|
|
monacoOptions: {
|
|
monacoOptions: {
|
|
|
automaticLayout: true,
|
|
automaticLayout: true,
|
|
|
minimap: { enabled: false },
|
|
minimap: { enabled: false },
|
|
@@ -65,7 +72,11 @@ export default {
|
|
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
loadConfig(key) {
|
|
loadConfig(key) {
|
|
|
- getConfigByKey(key).then(response => {
|
|
|
|
|
|
|
+ const requestFn = this.tenantId
|
|
|
|
|
+ ? getTenantConfigByKey(key, this.tenantId)
|
|
|
|
|
+ : getConfigByKey(key);
|
|
|
|
|
+
|
|
|
|
|
+ requestFn.then(response => {
|
|
|
if (!response.data) {
|
|
if (!response.data) {
|
|
|
this.configId = null;
|
|
this.configId = null;
|
|
|
this.projectYaml = '';
|
|
this.projectYaml = '';
|
|
@@ -99,11 +110,23 @@ export default {
|
|
|
}
|
|
}
|
|
|
const param = { configId: this.configId, configKey: this.activeName, configValue: JSON.stringify(json) }
|
|
const param = { configId: this.configId, configKey: this.activeName, configValue: JSON.stringify(json) }
|
|
|
|
|
|
|
|
- updateConfigByKey(param).then(response => {
|
|
|
|
|
- if (response.code === 200) {
|
|
|
|
|
- this.msgSuccess('修改成功')
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ if (this.tenantId) {
|
|
|
|
|
+ // 从租户管理页面进入,使用租户配置编辑接口
|
|
|
|
|
+ param.id = this.tenantId;
|
|
|
|
|
+ editTenantConfig(param).then(response => {
|
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
|
+ this.msgSuccess('修改成功');
|
|
|
|
|
+ this.$emit('success');
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 默认使用系统配置接口
|
|
|
|
|
+ updateConfigByKey(param).then(response => {
|
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
|
+ this.msgSuccess('修改成功')
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
this.$message.error("YAML 格式错误:" + e.message);
|
|
this.$message.error("YAML 格式错误:" + e.message);
|
|
|
}
|
|
}
|