Commit 06580758 by liyaoting

V1.03

1 parent c47c9093
Showing 1 changed file with 37 additions and 12 deletions
...@@ -36,11 +36,22 @@ ...@@ -36,11 +36,22 @@
<div> <div>
<div class="input-group"> <div class="input-group">
<span class="input-group-addon" id="basic-addon1">把配置贴到这</span> <span class="input-group-addon" id="basic-addon1">把配置贴到这</span>
<textarea v-model="source" class="form-control" rows="2"></textarea> <textarea v-model="source" class="form-control" placeholder="请手动输入..." rows="2"></textarea>
</div>
</div>
<!--搜索-->
<div class="row navbar-btn" v-if="allServiceList.length">
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" v-model="searchText" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-danger" type="button" @click="cleanSearchText">clean</button>
</span>
</div>
</div> </div>
</div> </div>
<!--表格--> <!--表格-->
<table class="table table-striped" v-if="serviceList.length"> <table class="table table-striped" v-if="allServiceList.length">
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <tr>
<th>No.</th> <th>No.</th>
...@@ -71,12 +82,25 @@ ...@@ -71,12 +82,25 @@
this.source = val; this.source = val;
this.analyseSource(); this.analyseSource();
}, },
searchText: function (val) {
//在allServiceList中找到包含val的
let serviceList = [];
this.allServiceList.forEach((item) => {
console.log(item)
if (item.serviceName.indexOf(val) != -1) {
serviceList.push(item);
}
});
this.serviceList = serviceList;
}
}, },
data: { data: {
source: '', //复制过来的 source: '', //复制过来的
sourceArr: [], //按行分割的 sourceArr: [], //按行分割的
serviceList: [], //服务列表 serviceList: [], //服务列表
allServiceList: [], //服务列表
sleepList: [], //sleep列表 sleepList: [], //sleep列表
searchText: "", //搜索框的值
}, },
created: function () { created: function () {
...@@ -87,23 +111,23 @@ ...@@ -87,23 +111,23 @@
let sysPayload = window.sysPayload; let sysPayload = window.sysPayload;
if (sysPayload) { if (sysPayload) {
let source = "" let source = ""
if (sysPayload.indexOf("node") == -1) { if (!sysPayload.indexOf("node") === -1) {
source = "请手动粘贴吧"
} else {
source = sysPayload; source = sysPayload;
} }
this.source = source; this.source = source;
this.analyseSource(); this.analyseSource();
} else {
this.source = "请手动粘贴吧";
} }
}, 500); }, 500);
}, },
methods: { methods: {
//清除搜索框
cleanSearchText: function () {
this.searchText = "";
},
//清除输入 //清除输入
cleanInput: function () { cleanInput: function () {
this.source = ""; this.source = "";
}, },
//选择服务 //选择服务
selectService: function (index) { selectService: function (index) {
this.serviceList[index].isOpen = !this.serviceList[index].isOpen; this.serviceList[index].isOpen = !this.serviceList[index].isOpen;
...@@ -223,17 +247,18 @@ ...@@ -223,17 +247,18 @@
serviceList.push(serviceMap[key]); serviceList.push(serviceMap[key]);
} }
this.sourceArr = sourceArr; this.sourceArr = sourceArr;
this.allServiceList = serviceList;
this.serviceList = serviceList; this.serviceList = serviceList;
this.sleepList = sleepList; this.sleepList = sleepList;
}, },
//复制出来 //复制出来
copyNew: function () { copyNew: function () {
let {serviceList, sourceArr, sleepList} = this; let {serviceList, allServiceList, sourceArr, sleepList} = this;
if (!serviceList.length) { if (!allServiceList.length) {
alert("你输入的内容不对"); alert("你输入的内容不对");
} else { } else {
serviceList.forEach((item) => { allServiceList.forEach((item) => {
let uploadRow = item.uploadRow; let uploadRow = item.uploadRow;
let buildRow = item.buildRow; let buildRow = item.buildRow;
sourceArr[item.uploadRowNo] = uploadRow; sourceArr[item.uploadRowNo] = uploadRow;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!