|
@@ -146,6 +146,13 @@
|
|
@click="toEdit(item)"
|
|
@click="toEdit(item)"
|
|
>编辑</el-button
|
|
>编辑</el-button
|
|
>
|
|
>
|
|
|
|
+ <el-button
|
|
|
|
+ v-if="!item.isFromBaseline && group.name !== 'custom'"
|
|
|
|
+ class="btn-danger cont-edit"
|
|
|
|
+ type="text"
|
|
|
|
+ @click="toDelete(item)"
|
|
|
|
+ >删除</el-button
|
|
|
|
+ >
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -173,7 +180,7 @@
|
|
ref="ModifyAppConfigItem"
|
|
ref="ModifyAppConfigItem"
|
|
:instance="curConfigItem"
|
|
:instance="curConfigItem"
|
|
:group="curGroupForAdd"
|
|
:group="curGroupForAdd"
|
|
- @modified="search"
|
|
|
|
|
|
+ @modified="resetSearch"
|
|
></modify-app-config-item>
|
|
></modify-app-config-item>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -184,7 +191,8 @@ import {
|
|
appConfigModes,
|
|
appConfigModes,
|
|
appConfigGroups,
|
|
appConfigGroups,
|
|
appEnvList,
|
|
appEnvList,
|
|
- appConfigList
|
|
|
|
|
|
+ appConfigList,
|
|
|
|
+ appConfigItemDelete
|
|
} from "../api";
|
|
} from "../api";
|
|
import UpdateAppBaseline from "../components/UpdateAppBaseline.vue";
|
|
import UpdateAppBaseline from "../components/UpdateAppBaseline.vue";
|
|
import ModifyAppBaselineItem from "../components/ModifyAppBaselineItem.vue";
|
|
import ModifyAppBaselineItem from "../components/ModifyAppBaselineItem.vue";
|
|
@@ -369,14 +377,17 @@ export default {
|
|
|
|
|
|
this.searchFilter = { ...this.filter };
|
|
this.searchFilter = { ...this.filter };
|
|
|
|
|
|
- if (this.filter.envId) {
|
|
|
|
|
|
+ await this.resetSearch();
|
|
|
|
+ this.$refs.ConfigTableBody.scrollTop = 0;
|
|
|
|
+ },
|
|
|
|
+ async resetSearch() {
|
|
|
|
+ if (this.searchFilter.envId) {
|
|
await this.getConfigList();
|
|
await this.getConfigList();
|
|
this.buildGroupConfigList(this.configList);
|
|
this.buildGroupConfigList(this.configList);
|
|
} else {
|
|
} else {
|
|
await this.getBaselineList();
|
|
await this.getBaselineList();
|
|
this.buildGroupConfigList(this.baselineList);
|
|
this.buildGroupConfigList(this.baselineList);
|
|
}
|
|
}
|
|
- this.$refs.ConfigTableBody.scrollTop = 0;
|
|
|
|
},
|
|
},
|
|
getCacheBaselineList() {
|
|
getCacheBaselineList() {
|
|
const k = [
|
|
const k = [
|
|
@@ -410,17 +421,18 @@ export default {
|
|
const data = await appConfigList(this.searchFilter);
|
|
const data = await appConfigList(this.searchFilter);
|
|
|
|
|
|
let configList = this.baselineList.map(item => {
|
|
let configList = this.baselineList.map(item => {
|
|
- let nitem = { ...item };
|
|
|
|
|
|
+ let nitem = { ...item, isFromBaseline: true };
|
|
if (item.mode === "OVERRIDE") nitem.value = null;
|
|
if (item.mode === "OVERRIDE") nitem.value = null;
|
|
nitem.refVal = item.value;
|
|
nitem.refVal = item.value;
|
|
return nitem;
|
|
return nitem;
|
|
});
|
|
});
|
|
|
|
+ // 只有配置项位于group分组内,不是应用自定义,且基线不包含此配置项时才能删除
|
|
data.forEach(item => {
|
|
data.forEach(item => {
|
|
let bIndex = configList.findIndex(citem => citem.key === item.key);
|
|
let bIndex = configList.findIndex(citem => citem.key === item.key);
|
|
if (bIndex !== -1) {
|
|
if (bIndex !== -1) {
|
|
configList[bIndex].value = item.value;
|
|
configList[bIndex].value = item.value;
|
|
} else {
|
|
} else {
|
|
- configList.push({ ...item });
|
|
|
|
|
|
+ configList.push({ ...item, isFromBaseline: false });
|
|
}
|
|
}
|
|
});
|
|
});
|
|
this.configList = configList;
|
|
this.configList = configList;
|
|
@@ -547,11 +559,28 @@ export default {
|
|
},
|
|
},
|
|
baselineItemModified() {
|
|
baselineItemModified() {
|
|
this.setCacheBaselineList([]);
|
|
this.setCacheBaselineList([]);
|
|
- this.search();
|
|
|
|
|
|
+ this.resetSearch();
|
|
},
|
|
},
|
|
baselineModified(data) {
|
|
baselineModified(data) {
|
|
this.setCacheBaselineList(data);
|
|
this.setCacheBaselineList(data);
|
|
- this.search();
|
|
|
|
|
|
+ this.resetSearch();
|
|
|
|
+ },
|
|
|
|
+ async toDelete(item) {
|
|
|
|
+ const confirm = await this.$confirm(
|
|
|
|
+ `确定要删除配置项【${item.key}】吗?`,
|
|
|
|
+ "提示",
|
|
|
|
+ {
|
|
|
|
+ type: "warning"
|
|
|
|
+ }
|
|
|
|
+ ).catch(() => {});
|
|
|
|
+ if (confirm !== "confirm") return;
|
|
|
|
+ const res = await appConfigItemDelete({
|
|
|
|
+ ...this.filter,
|
|
|
|
+ key: item.key
|
|
|
|
+ }).catch(() => {});
|
|
|
|
+ if (!res) return;
|
|
|
|
+ this.$message.success("删除成功!");
|
|
|
|
+ this.resetSearch();
|
|
},
|
|
},
|
|
scrollTo(group) {
|
|
scrollTo(group) {
|
|
this.$refs.ConfigTableBody.scrollTop =
|
|
this.$refs.ConfigTableBody.scrollTop =
|