Commit 41fe001c by shj

解决了数据库列表显示的bug:不能删除预算中已有的记录

parent 341ac144
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
<button class="btn btn-success" @click="addToDatabase(sample)">添加到数据库</button> <button class="btn btn-success" @click="addToDatabase(sample)">添加到数据库</button>
</td> </td>
</tr> </tr>
<tr class="info"> <tr class="info" v-if="database.length>0">
<td> <td>
<select v-model="selectedIndex" class="form-control"> <select v-model="selectedIndex" class="form-control">
<option v-for="(record,i) in database" :value="i"> <option v-for="(record,i) in database" :value="i">
...@@ -452,7 +452,7 @@ ...@@ -452,7 +452,7 @@
</td> </td>
</tr> </tr>
<tr class="info"> <tr class="info" v-if="database.length>0">
<td> <td>
<select v-model="selectedIndex" class="form-control"> <select v-model="selectedIndex" class="form-control">
<option v-for="(record,i) in database" :value="i"> <option v-for="(record,i) in database" :value="i">
...@@ -502,7 +502,7 @@ ...@@ -502,7 +502,7 @@
</td> </td>
</tr> </tr>
<tr class="info"> <tr class="info" v-if="database.length>0">
<td> <td>
<select v-model="selectedIndex" class="form-control"> <select v-model="selectedIndex" class="form-control">
<option v-for="(record,i) in database" :value="i"> <option v-for="(record,i) in database" :value="i">
...@@ -589,28 +589,31 @@ ...@@ -589,28 +589,31 @@
this.items = data.body.data; this.items = data.body.data;
console.log("showlist"); console.log("showlist");
updateBudgetPage("equipment"); updateBudgetPage("equipment");
this.showDatabase();
this.$http.get("${pageContext.request.contextPath}/Database/Query/Equipment").then(
function (data) {
var tmp= data.body.data;
for(var i=0;i<tmp.length;i++)
{
if(inItems(tmp[i],this.items)){
tmp.splice(i,1);
}
}
this.database=tmp;
console.log("show database");
}, function (error) {
console.log(error)
}
)
}, function (error) { }, function (error) {
console.log(error) console.log(error)
} }
); );
}, },
showDatabase:function(){
this.$http.get("${pageContext.request.contextPath}/Database/Query/Equipment").then(
function (data) {
var tmp= data.body.data;
for(var i=0;i<tmp.length;i++)
{
if(inItems(tmp[i],this.items)){
console.log("inItems:true, "+tmp[i].name);
tmp.splice(i,1);
i--;
}
}
this.database=tmp;
console.log("show database");
}, function (error) {
console.log(error)
}
)
},
doUpdate: function (item, curd) { doUpdate: function (item, curd) {
this.$http.post("${pageContext.request.contextPath}/Budget/Modify/Equipment", this.$http.post("${pageContext.request.contextPath}/Budget/Modify/Equipment",
{ {
...@@ -982,20 +985,25 @@ ...@@ -982,20 +985,25 @@
function (data) { function (data) {
this.items = data.body.data; this.items = data.body.data;
console.log("showlist"); console.log("showlist");
updateBudgetPage("labour") updateBudgetPage("labour");
this.showDatabase()
}, function (error) { }, function (error) {
console.log(error) console.log(error)
} }
); );
},
showDatabase:function(){
this.$http.get("${pageContext.request.contextPath}/Database/Query/Labour").then( this.$http.get("${pageContext.request.contextPath}/Database/Query/Labour").then(
function (data) { function (data) {
this.database = data.body.data; var list = data.body.data;
for(var i=0;i<this.database.length;i++) for(var i=0;i<list.length;i++)
{ {
if(inItems(this.database[i],this.items)){ if(inItems(list[i],this.items)){
this.database.splice(i,1); list.splice(i,1);
i--;
} }
} }
this.database=list;
console.log("show database"); console.log("show database");
}, function (error) { }, function (error) {
console.log(error) console.log(error)
...@@ -1046,20 +1054,27 @@ ...@@ -1046,20 +1054,27 @@
function (data) { function (data) {
this.items = data.body.data; this.items = data.body.data;
console.log("showlist"); console.log("showlist");
updateBudgetPage("consultation") updateBudgetPage("consultation");
this.showDatabase();
}, function (error) { }, function (error) {
console.log(error) console.log(error)
} }
); );
},
showDatabase:function(){
this.$http.get("${pageContext.request.contextPath}/Database/Query/Consultation").then( this.$http.get("${pageContext.request.contextPath}/Database/Query/Consultation").then(
function (data) { function (data) {
this.database = data.body.data; var list = data.body.data;
for(var i=0;i<this.database.length;i++) console.log(this.items);
for(var i=0;i<list.length;i++)
{ {
if(inItems(this.database[i],this.items)){ if(inItems(list[i],this.items)){
this.database.splice(i,1); console.log("deleted: "+list[i].name);
list.splice(i,1);
i--;
} }
} }
this.database=list;
console.log("show database"); console.log("show database");
}, function (error) { }, function (error) {
console.log(error) console.log(error)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment