|
|
@@ -72,24 +72,39 @@ export default {
|
|
|
|
|
|
methods: {
|
|
|
loadConfig(key) {
|
|
|
- const requestFn = this.tenantId
|
|
|
- ? getTenantConfigByKey(key, this.tenantId)
|
|
|
- : getConfigByKey(key);
|
|
|
-
|
|
|
- requestFn.then(response => {
|
|
|
- if (!response.data) {
|
|
|
- this.configId = null;
|
|
|
- this.projectYaml = '';
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- const data = response.data;
|
|
|
- this.configId = data.configId;
|
|
|
-
|
|
|
- // JSON.parse 将 JSON 字符串变对象,再用 yaml.dump 转 YAML 字符串
|
|
|
- const obj = JSON.parse(data.configValue);
|
|
|
- this.projectYaml = yaml.dump(obj);
|
|
|
- });
|
|
|
+ if (this.tenantId) {
|
|
|
+ getTenantConfigByKey(key, this.tenantId).then(response => {
|
|
|
+ if (response.data) {
|
|
|
+ const data = response.data;
|
|
|
+ this.configId = data.configId;
|
|
|
+ const obj = JSON.parse(data.configValue);
|
|
|
+ this.projectYaml = yaml.dump(obj);
|
|
|
+ } else {
|
|
|
+ // 租户配置为空,回退到系统配置接口
|
|
|
+ this.configId = null;
|
|
|
+ this.projectYaml = '';
|
|
|
+ getConfigByKey(key).then(res => {
|
|
|
+ if (res.data) {
|
|
|
+ this.configId = res.data.configId;
|
|
|
+ const obj = JSON.parse(res.data.configValue);
|
|
|
+ this.projectYaml = yaml.dump(obj);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ getConfigByKey(key).then(response => {
|
|
|
+ if (!response.data) {
|
|
|
+ this.configId = null;
|
|
|
+ this.projectYaml = '';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const data = response.data;
|
|
|
+ this.configId = data.configId;
|
|
|
+ const obj = JSON.parse(data.configValue);
|
|
|
+ this.projectYaml = yaml.dump(obj);
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/** Tab 切换时强制 layout */
|