添加下拉框值后自动选中,项目文件控制台按钮是否显示

This commit is contained in:
bwcx_jzy 2021-09-16 10:06:23 +08:00
parent 1343645c22
commit ef0a928e87
4 changed files with 112 additions and 141 deletions

View File

@ -4,7 +4,7 @@
<a-icon slot="suffixIcon" type="reload" @click="refreshSelect" />
<div slot="dropdownRender" slot-scope="menu">
<div style="padding: 8px 8px; cursor: pointer; display: flex" @mousedown="(e) => e.preventDefault()">
<a-input-search
<a-input-search
enter-button="添加"
v-model="selectInput"
@search="onSearch"
@ -13,14 +13,14 @@
@click="(e) => e.target.focus()"
:placeholder="inputPlaceholder"
size="small"
>
<a-tooltip slot="suffix">
<template slot="title">
<slot name="inputTips"></slot>
</template>
<a-icon type="question-circle" theme="filled" />
</a-tooltip>
</a-input-search>
>
<a-tooltip slot="suffix">
<template slot="title">
<slot name="inputTips"></slot>
</template>
<a-icon type="question-circle" theme="filled" />
</a-tooltip>
</a-input-search>
</div>
<a-divider style="margin: 4px 0" />
<v-nodes :vnodes="menu" />
@ -30,92 +30,95 @@
</div>
</template>
<script>
import { Select } from 'ant-design-vue'
import { Select } from "ant-design-vue";
export default {
components: {
Select,
VNodes: {
functional: true,
render: (h, ctx) => ctx.props.vnodes,
},
},
data() {
return {
selectInput: "",
selectOpen: false,
selectFocus: false,
inputFocus: false,
optionList: [],
selected: ''
}
},
props: {
// props
...Select.props,
data: {
type: Array,
default: () => []
},
inputPlaceholder: {
type: String,
default: '请输入...'
},
selectPlaceholder: {
type: String,
default: '请选择'
}
},
watch: {
value: {
handler(v) {
this.selected = v
},
immediate: true,
},
data: {
handler(v) {
this.optionList = v;
},
deep: true,
immediate: true,
},
export default {
components: {
Select,
VNodes: {
functional: true,
render: (h, ctx) => ctx.props.vnodes,
},
},
methods: {
refreshSelect() {
this.$emit("onRefreshSelect");
data() {
return {
selectInput: "",
selectOpen: false,
selectFocus: false,
inputFocus: false,
optionList: [],
selected: "",
};
},
props: {
// props
...Select.props,
data: {
type: Array,
default: () => [],
},
inputPlaceholder: {
type: String,
default: "请输入...",
},
selectPlaceholder: {
type: String,
default: "请选择",
},
},
watch: {
value: {
handler(v) {
this.selected = v;
},
selectChange(v) {
this.$emit("input", v);
this.selectOpen = false;
immediate: true,
},
data: {
handler(v) {
this.optionList = v;
},
onSearch(v) {
if (!v) {
return;
}
deep: true,
immediate: true,
},
},
methods: {
refreshSelect() {
this.$emit("onRefreshSelect");
},
selectChange(v) {
this.$emit("input", v);
this.selectOpen = false;
},
onSearch(v) {
if (!v) {
return;
}
let index = this.optionList.indexOf(v);
if (index === -1) {
this.optionList = [...this.optionList, v];
this.selectInput = "";
},
setSelectOpen(v) {
this.selectFocus = v;
if (this.inputFocus || this.selectFocus) {
this.selectOpen = true;
return;
}
this.selectOpen = false;
},
visibleInput(v) {
this.inputFocus = v;
if (this.inputFocus || this.selectFocus) {
this.selectOpen = true;
return;
}
this.selectOpen = false;
},
}
}
</script>
}
this.selectInput = "";
this.selected = v;
},
setSelectOpen(v) {
this.selectFocus = v;
if (this.inputFocus || this.selectFocus) {
this.selectOpen = true;
return;
}
this.selectOpen = false;
},
visibleInput(v) {
this.inputFocus = v;
if (this.inputFocus || this.selectFocus) {
this.selectOpen = true;
return;
}
this.selectOpen = false;
},
},
};
</script>

View File

@ -75,32 +75,17 @@
<a-modal v-model="editBuildVisible" title="编辑构建" @ok="handleEditBuildOk" width="50%" :maskClosable="false">
<a-form-model ref="editBuildForm" :rules="rules" :model="temp" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
<a-form-model-item label="名称" prop="name">
<a-input v-model="temp.name" placeholder="名称" />
</a-form-model-item>
<a-form-model-item label="分组名称" prop="group">
<a-row>
<a-col :span="18">
<a-select v-model="temp.group" placeholder="可手动输入">
<a-select-option v-for="group in groupList" :key="group">{{ group }}</a-select-option>
</a-select>
<a-col :span="10">
<a-input v-model="temp.name" placeholder="名称" />
</a-col>
<a-col :span="6">
<a-popover v-model="addGroupvisible" title="添加分组" trigger="click">
<template slot="content">
<a-row>
<a-col :span="18">
<a-input v-model="temp.tempGroup" placeholder="分组名称" />
</a-col>
<a-col :span="6">
<a-button type="primary" @click="handleAddGroup">确认</a-button>
</a-col>
</a-row>
</template>
<a-button type="primary" class="btn-add">添加分组</a-button>
</a-popover>
<a-col :span="4" style="text-align: right">分组名称</a-col>
<a-col :span="10">
<custom-select v-model="temp.group" :data="groupList" inputPlaceholder="添加分组" selectPlaceholder="分组名称,可以不选择"> </custom-select>
</a-col>
</a-row>
</a-form-model-item>
<a-form-model-item label="仓库地址" prop="repositoryId">
<a-select v-model="temp.repositoryId" @select="changeRepositpry" @change="changeRepositpry" placeholder="请选择仓库">
<a-select-option v-for="item in repositoryList" :key="item.id" :value="item.id">{{ item.name }}[{{ item.gitUrl }}]</a-select-option>
@ -121,7 +106,7 @@
</div>
</custom-select>
</a-col>
<a-col :span="4" style="text-align: right"> 标签(TAG):</a-col>
<a-col :span="4" style="text-align: right"> 标签(TAG)</a-col>
<a-col :span="10">
<custom-select
v-model="temp.branchTagName"
@ -273,7 +258,6 @@ export default {
temp: {},
//
editBuildVisible: false,
addGroupvisible: false,
triggerVisible: false,
buildLogVisible: false,
afterOptList: [
@ -540,26 +524,6 @@ export default {
this.loadSshList();
this.editBuildVisible = true;
},
//
handleAddGroup() {
if (!this.temp.tempGroup || this.temp.tempGroup.length === 0) {
this.$notification.warning({
message: "分组名称不能为空",
duration: 2,
});
return false;
}
//
if (this.groupList.indexOf(this.temp.tempGroup) === -1) {
this.groupList.push(this.temp.tempGroup);
}
this.temp.tempGroup = "";
this.$notification.success({
message: "添加成功",
duration: 2,
});
this.addGroupvisible = false;
},
//
loadBranchList() {
if (this.tempRepository.repoType !== 0) {

View File

@ -5,7 +5,7 @@
<a-layout-sider theme="light" class="sider" width="25%">
<div class="dir-container">
<a-button type="primary" @click="loadData">刷新目录</a-button>
<a-button type="primary" @click="goConsole" v-show="runMode !== 'File'">控制台</a-button>
<a-button type="primary" v-if="showConsole" @click="goConsole" v-show="runMode !== 'File'">控制台</a-button>
</div>
<a-empty v-if="treeList.length === 0" />
<el-tree
@ -123,6 +123,10 @@ export default {
absPath: {
type: String,
},
showConsole: {
type: Boolean,
default: true,
},
},
data() {
return {
@ -139,7 +143,7 @@ export default {
uploadRemoteFileVisible: false,
editFileVisible: false,
successSize: 0,
fileContent: '',
fileContent: "",
cmOptions: {
mode: "application/json",
@ -204,7 +208,7 @@ export default {
//
handleCloseModal() {
this.fileContent = ''
this.fileContent = "";
},
//
@ -272,9 +276,9 @@ export default {
readFile(params).then((res) => {
if (res.code === 200) {
setTimeout(()=> {
setTimeout(() => {
this.fileContent = res.data;
}, 300)
}, 300);
}
});
},

View File

@ -82,8 +82,8 @@ export default {
disableStdin: false,
rendererType: "canvas",
theme: {
foreground: "#7e9192", //
background: "#002833", //
// foreground: "#7e9192", //
// background: "#002833", //
cursor: "help", //
lineHeight: 16,
},