refactor: jar包管理优化

This commit is contained in:
chenjianxing 2021-02-03 17:21:20 +08:00
parent 117571cd94
commit 937ce3f3c6
2 changed files with 33 additions and 34 deletions

View File

@ -2,28 +2,32 @@
<el-dialog width="50%" :close-on-click-modal="false" :title="$t('api_test.jar_config.title')" :visible.sync="visible" class="jar-import" @close="close">
<div v-loading="result.loading">
<ms-jar-config-from :config="currentConfig" :callback="saveConfig" ref="jarConfigFrom" :read-only="isReadOnly"/>
<ms-jar-search-bar @refresh="getJarConfigs" :table-data="configs" ref="jarSearchBar"/>
<ms-jar-search-bar v-if="(!isSearchBarQuery && configs.length > 0) || isSearchBarQuery" :condition="condition"
@search="getJarConfigs" :table-data="configs" ref="jarSearchBar"/>
<ms-jar-config-list @refresh="getJarConfigs" v-if="configs.length > 0" @rowSelect="rowSelect" :table-data="configs" ref="jarConfigList"/>
</div>
</el-dialog>
</template>
<script>
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
import {listenGoBack, removeGoBackListener} from "../../../../../../common/js/utils";
import MsJarConfigList from "./JarConfigList";
import MsJarConfigFrom from "./JarConfigFrom";
import MsJarSearchBar from "./JarSearchBar";
export default {
name: "MsJarConfig",
components: {MsJarConfigFrom, MsJarSearchBar, MsJarConfigList, MsDialogFooter},
data() {
return {
visible: false,
result: {},
currentConfig: {},
configs: []
}
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
import {listenGoBack, removeGoBackListener} from "../../../../../../common/js/utils";
import MsJarConfigList from "./JarConfigList";
import MsJarConfigFrom from "./JarConfigFrom";
import MsJarSearchBar from "./JarSearchBar";
export default {
name: "MsJarConfig",
components: {MsJarConfigFrom, MsJarSearchBar, MsJarConfigList, MsDialogFooter},
data() {
return {
visible: false,
result: {},
currentConfig: {},
configs: [],
condition: {},
isSearchBarQuery: false
}
},
props: {
isReadOnly: {
@ -34,6 +38,8 @@
methods: {
open() {
this.visible = true;
this.condition = {};
this.getJarConfigs();
listenGoBack(this.close);
},
@ -54,11 +60,14 @@
this.getJarConfigs();
});
},
getJarConfigs(condition) {
this.result = this.$post("/jar/list", {name: condition}, response => {
this.configs = response.data;
this.currentConfig = {};
});
getJarConfigs(isSearchBarQuery) {
if (isSearchBarQuery) {
this.isSearchBarQuery = isSearchBarQuery;
}
this.result = this.$post("/jar/list", this.condition, response => {
this.configs = response.data;
this.currentConfig = {};
});
},
rowSelect(config) {
this.currentConfig = config;

View File

@ -1,10 +1,10 @@
<template>
<el-input class="jar-header-search"
v-model="searchCondition"
v-model="condition.name"
type="text"
size="small"
prefix-icon="el-icon-search"
@keyup.enter.native="search"
@blur="search"
:placeholder="$t('project.search_by_name_jar')" clearable/>
</template>
@ -19,19 +19,9 @@
},
},
},
data() {
return {
searchCondition: this.condition
};
},
watch: {
inputCondition(value) {
this.searchCondition = value;
}
},
methods: {
search() {
this.$emit('refresh', this.searchCondition);
this.$emit('search', true);
}
},
}