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

View File

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