Commit 3e339799 by shj

生成预算提示,总预算与预算分布的差值

parent 42269046
......@@ -19,10 +19,12 @@
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style type="text/css">
body{
body {
padding-top: 70px;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
</head>
<body>
......@@ -63,7 +65,8 @@
others = 0; %>
<iframe hidden id="hidden_frame" name="hidden_frame"></iframe>
<form class="form-horizontal" method="post" action="${pageContext.request.contextPath}/Budget/Generate">
<div id="form">
<form class="form-horizontal" method="post" action="${pageContext.request.contextPath}/Budget/Generate">
<div class="form-group">
<label class="control-label col-sm-4">预算名称</label>
......@@ -75,7 +78,17 @@
<div class="form-group">
<label class="control-label col-sm-4">总预算(万元)</label>
<div class="col-sm-4">
<input name="total" type="number" placeholder="" class="form-control" required value=<%=total%>>
<input name="total" type="number" placeholder="填写大于0的数字" class="form-control" required v-model="total">
</div>
<div class="col-sm-4">
<label>{{sum}}</label>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">项目周期(年)</label>
<div class="col-sm-4">
<input name="years" type="number" placeholder="填写大于0的数字" class="form-control" required>
</div>
</div>
......@@ -89,7 +102,10 @@
设备费
</label>
<div class="col-sm-4">
<input name="equipment-number" class="form-control" type="number" value=<%=equiment%>>
<input name="equipment-number" class="form-control" type="number" v-model="arr[0]">
</div>
<div class="col-sm-2">
<input name="equipment-distribution" class="form-control" type="text" required>
</div>
</div>
......@@ -99,7 +115,7 @@
材料费
</label>
<div class="col-sm-4">
<input name="material-number" class="form-control" type="number" value=<%=material%>>
<input name="material-number" class="form-control" type="number" v-model="arr[1]">
</div>
</div>
......@@ -109,7 +125,7 @@
测试化验加工费
</label>
<div class="col-sm-4">
<input name="test-and-process-number" class="form-control" type="number" value=<%=test%>>
<input name="test-and-process-number" class="form-control" type="number" v-model="arr[2]">
</div>
</div>
......@@ -119,7 +135,7 @@
燃料动力费
</label>
<div class="col-sm-4">
<input name="power-number" class="form-control" type="number" value=<%=power%>>
<input name="power-number" class="form-control" type="number" v-model="arr[3]">
</div>
</div>
......@@ -129,7 +145,7 @@
差旅费
</label>
<div class="col-sm-4">
<input name="travel-number" class="form-control" type="number" value=<%=travel%>>
<input name="travel-number" class="form-control" type="number" v-model="arr[4]">
</div>
</div>
......@@ -139,7 +155,7 @@
会议费
</label>
<div class="col-sm-4" id="tip">
<input name="conference-number" class="form-control" type="number" value=<%=conference%>>
<input name="conference-number" class="form-control" type="number" v-model="arr[5]">
</div>
</div>
......@@ -150,7 +166,7 @@
</label>
<div class="col-sm-4">
<input name="international-communication-number" class="form-control" type="number"
value="<%=international%>"></div>
v-model="arr[6]"></div>
</div>
<div class="form-group">
......@@ -159,7 +175,7 @@
产权费
</label>
<div class="col-sm-4">
<input name="property-number" class="form-control" type="number" value="<%=property%>"></div>
<input name="property-number" class="form-control" type="number" v-model="arr[7]"></div>
</div>
<div class="form-group">
......@@ -168,7 +184,7 @@
劳务费
</label>
<div class="col-sm-4">
<input name="labour-number" class="form-control" type="number" value="<%=labour%>"></div>
<input name="labour-number" class="form-control" type="number" v-model="arr[8]"></div>
</div>
<div class="form-group">
......@@ -177,7 +193,7 @@
咨询费
</label>
<div class="col-sm-4">
<input name="consultation-number" class="form-control" type="number" value="<%=consultation%>"></div>
<input name="consultation-number" class="form-control" type="number" v-model="arr[9]"></div>
</div>
<div class="form-group">
......@@ -186,7 +202,7 @@
其他费用
</label>
<div class="col-sm-4">
<input name="others-number" class="form-control" type="number" value="<%=others%>"></div>
<input name="others-number" class="form-control" type="number" v-model="arr[10]"></div>
</div>
<!-- Button -->
......@@ -194,8 +210,26 @@
<button class="btn btn-default btn-lg center-block" type="submit">生成预算</button>
<p class="help-block" style="color:red">所有复选框必须勾选,如果不需要某类费用,后面的数字填0即可</p>
</div>
</form>
</form>
</div>
<script type="text/javascript">
var formVue = new Vue({
el: "#form",
data:{
arr:[20,12,15,0,12,5, 6,8,66,2,0],
total:150
},
computed:{
sum:function () {
var sum=Number(0);
for(var i =0;i<this.arr.length;i++)
sum+=Number(this.arr[i]);
return sum;
}
}
})
</script>
</body>
</html>
......@@ -121,6 +121,30 @@ ${pageContext.request.contextPath}<br>
});
</script>
<div id="computedTest">
<input type="number" v-model="arr[0]">
<input type="number" v-model="arr[1]">
<p>{{z}}</p>
</div>
<script type="text/javascript">
var computedVue=new Vue({
el:"#computedTest",
data:{
x:0,
y:0,
arr:[]
},
computed:{
z:function () {
var sum=Number(0);
for(var i =0;i<this.arr.length;i++)
sum+=Number(this.arr[i]);
return sum;
}
}
})
</script>
<script type="text/javascript">
function logout() {
if(confirm("确认退出登录?")){
......
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