Commit 318ee87f by shj

代码重构,全面使用ajax进行请求

parent 1394773f
...@@ -133,6 +133,21 @@ ...@@ -133,6 +133,21 @@
<artifactId>jsoup</artifactId> <artifactId>jsoup</artifactId>
<version>1.11.3</version> <version>1.11.3</version>
</dependency> </dependency>
<!-- Json-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.55</version>
</dependency>
<!--Gson-->
<!--<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>-->
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -9,19 +9,19 @@ import java.util.Map; ...@@ -9,19 +9,19 @@ import java.util.Map;
* 经费报表对象,内含各种经费的集合 * 经费报表对象,内含各种经费的集合
*/ */
public class Budget implements Serializable { public class Budget implements Serializable {
private Map<Equipment,Integer> equipments; private Map<Equipment, Integer> equipments;
private Map<Material,Integer> materials; private Map<Material, Integer> materials;
private Map<TestAndProcess,Integer> testAndProcesses; private Map<TestAndProcess, Integer> testAndProcesses;
private Map<Power,Integer> powers; private Map<Power, Integer> powers;
private Map<Travel,Pair> travels; private Map<Travel, Pair> travels;
private Map<Conference,Integer> conferences; private Map<Conference, Pair> conferences;
private Map<InternationalCommunication,Integer> internationalCommunications; private Map<InternationalCommunication, Integer> internationalCommunications;
private Map<Property,Integer> properties; private Map<Property, Integer> properties;
private Map<Labour,Integer> labour; private Map<Labour, Integer> labour;
private Map<Consultation,Integer> consultations; private Map<Consultation, Integer> consultations;
private Map<Others,Integer> others; private Map<Others, Integer> others;
private Map<Indirect,Integer> indirects; private Map<Indirect, Integer> indirects;
private Requirement requirement=new Requirement(); private Requirement requirement = new Requirement();
public Requirement getRequirement() { public Requirement getRequirement() {
return requirement; return requirement;
...@@ -79,11 +79,11 @@ public class Budget implements Serializable { ...@@ -79,11 +79,11 @@ public class Budget implements Serializable {
this.travels = travels; this.travels = travels;
} }
public Map<Conference, Integer> getConferences() { public Map<Conference, Pair> getConferences() {
return conferences; return conferences;
} }
public void setConferences(Map<Conference, Integer> conferences) { public void setConferences(Map<Conference, Pair> conferences) {
this.conferences = conferences; this.conferences = conferences;
} }
...@@ -145,7 +145,7 @@ public class Budget implements Serializable { ...@@ -145,7 +145,7 @@ public class Budget implements Serializable {
* *
* @return * @return
*/ */
public Map<Indirect,Integer> computeIndirect() { public Map<Indirect, Integer> computeIndirect() {
double direct = 0.0; double direct = 0.0;
if (materials != null) if (materials != null)
for (Material material : materials.keySet()) { for (Material material : materials.keySet()) {
...@@ -165,23 +165,28 @@ public class Budget implements Serializable { ...@@ -165,23 +165,28 @@ public class Budget implements Serializable {
} }
if (conferences != null) if (conferences != null)
for (Conference conference : conferences.keySet()) { for (Conference conference : conferences.keySet()) {
direct += conference.computeUnitPrice()*conferences.get(conference); direct += conference.getPrice() * conferences.get(conference).getPeople() * conferences.get(conference).getDays();
} }
if (consultations!=null) {
for (Consultation consultation : consultations.keySet()) {
direct+=consultation.getPrice()*consultations.get(consultation);
}
}
if (internationalCommunications != null) if (internationalCommunications != null)
for (InternationalCommunication internationalCommunication : internationalCommunications.keySet()) { for (InternationalCommunication internationalCommunication : internationalCommunications.keySet()) {
direct += internationalCommunication.computeUnitPrice()*internationalCommunications.get(internationalCommunication); direct += internationalCommunication.computeUnitPrice() * internationalCommunications.get(internationalCommunication);
} }
if (properties != null) if (properties != null)
for (Property property : properties.keySet()) { for (Property property : properties.keySet()) {
direct += property.computeUnitPrice()*properties.get(property); direct += property.computeUnitPrice() * properties.get(property);
} }
if (labour != null) if (labour != null)
for (Labour labour1 : labour.keySet()) { for (Labour labour1 : labour.keySet()) {
direct += labour1.computeUnitPrice()*labour.get(labour1); direct += labour1.computeUnitPrice() * labour.get(labour1);
} }
if (others != null) if (others != null)
for (Others other : others.keySet()) { for (Others other : others.keySet()) {
direct += other.computeUnitPrice()*others.get(other); direct += other.computeUnitPrice() * others.get(other);
} }
double indirect = 0.0; double indirect = 0.0;
...@@ -195,8 +200,8 @@ public class Budget implements Serializable { ...@@ -195,8 +200,8 @@ public class Budget implements Serializable {
Indirect result = new Indirect(); Indirect result = new Indirect();
result.setPrice(indirect); result.setPrice(indirect);
result.setName("间接费用"); result.setName("间接费用");
Map<Indirect,Integer> map=new HashMap<>(); Map<Indirect, Integer> map = new HashMap<>();
map.put(result,1); map.put(result, 1);
return map; return map;
} }
......
...@@ -35,4 +35,11 @@ public class Conference extends Item { ...@@ -35,4 +35,11 @@ public class Conference extends Item {
", people=" + people + ", people=" + people +
"} " + super.toString(); "} " + super.toString();
} }
public double cost(Pair pair,Consultation consultation)
{
if(pair==null || pair.getDays()<=0 || pair.getPeople()<=0 || (consultation==null&&getExperts()!=0))
return 0.0;
double expert=(consultation==null)?0.0:consultation.getPrice();
return pair.getDays()*(getExperts()*expert+getPrice()*pair.getPeople());
}
} }
...@@ -9,10 +9,11 @@ import java.util.Objects; ...@@ -9,10 +9,11 @@ import java.util.Objects;
*/ */
public class Item implements Serializable { public class Item implements Serializable {
private Integer id; private Integer id;
private String name=null; private String name;
private double price; private double price;
private String comment; private String comment;
/** /**
* 此方法返回每一类预算的价格,不等同于getPrice,由子类选择实现,因为存在差旅费等多个价格加算的预算 * 此方法返回每一类预算的价格,不等同于getPrice,由子类选择实现,因为存在差旅费等多个价格加算的预算
* 一般就是getPrice * 一般就是getPrice
......
...@@ -28,4 +28,12 @@ public class Pair implements Serializable { ...@@ -28,4 +28,12 @@ public class Pair implements Serializable {
public void setDays(int days) { public void setDays(int days) {
this.days = days; this.days = days;
} }
@Override
public String toString() {
return "Pair{" +
"people=" + people +
", days=" + days +
'}';
}
} }
...@@ -74,7 +74,8 @@ public class BudgetHandler { ...@@ -74,7 +74,8 @@ public class BudgetHandler {
} else if (item.contains("conference")) { } else if (item.contains("conference")) {
budget.setConferences(budgetService.doConference(number)); budget.setConferences(budgetService.doConference(number));
budget.getRequirement().setConference(number); budget.getRequirement().setConference(number);
budget.setConsultations(budgetService.doConsultation(budget.getConferences())); int experts=expertSum(budget.getConferences());
budget.setConsultations(budgetService.doConsultation(experts));
} else if (item.contains("international")) { } else if (item.contains("international")) {
budget.setInternationalCommunications(budgetService.doInternationalCommunication(number)); budget.setInternationalCommunications(budgetService.doInternationalCommunication(number));
budget.getRequirement().setInternational(number); budget.getRequirement().setInternational(number);
...@@ -117,6 +118,14 @@ public class BudgetHandler { ...@@ -117,6 +118,14 @@ public class BudgetHandler {
} }
} }
private int expertSum(Map<Conference, Pair> conferences) {
int experts=0;
for (Conference conference : conferences.keySet()) {
experts+=conference.getExperts()*conferences.get(conference).getDays();
}
return experts;
}
/** /**
* 下载最新报表 * 下载最新报表
* *
...@@ -489,45 +498,58 @@ public class BudgetHandler { ...@@ -489,45 +498,58 @@ public class BudgetHandler {
@Autowired @Autowired
private IConferenceDao conferenceDao; private IConferenceDao conferenceDao;
/** /**
* 修改预算中的劳务费、规则中的劳务费
* *
* @param mode * @param mode
* @param id * @param conference
* @param name * @param pair
* @param price
* @param nums * @param nums
* @param curd * @param curd
* @param request * @param request
* @param response * @param response
*/ */
@RequestMapping("/Modify/Conference") @RequestMapping("/Modify/Conference")
public void modifyConference(Integer mode, Integer id, String name, Double price,Integer experts,Integer people, Integer nums, Integer curd, HttpServletRequest request, HttpServletResponse response) { public void modifyConference(Integer mode, Conference conference,Pair pair, Integer nums, Integer curd, HttpServletRequest request, HttpServletResponse response) {
System.out.println("/Modify/Conference"); System.out.println("/Modify/Conference");
if (mode.equals(0))//修改预算 if (mode.equals(0))//修改预算
{ {
if (nums < 0) return; if (pair==null || pair.getDays()<0 || pair.getPeople()<0) return;
String sessionID = getSessionID(request.getCookies()); String sessionID = getSessionID(request.getCookies());
Budget budget = retrieveBudget(sessionID); Budget budget = retrieveBudget(sessionID);
assert budget != null; assert budget != null;
Map<Conference, Integer> items = null; Map<Conference, Pair> items = budget.getConferences();
items = budget.getConferences(); Conference mod=conferenceDao.selectById(conference.getId());
Conference mod=conferenceDao.selectById(id);
if(mod!=null) if(mod!=null)
items.put(mod,nums); items.put(mod,pair);
budget.setConsultations(budgetService.doConsultation(budget.getConferences())); int experts=0;
for (Conference item : items.keySet()) {
experts+=item.getExperts()*items.get(item).getDays();
}
budget.setConsultations(budgetService.doConsultation(experts));
try {
double sum=0.0;
Map<Conference, Pair> conferencesMap = budget.getConferences();
Map<Consultation, Integer> consultationsMap = budget.getConsultations();
Consultation consultation=null;
for (Consultation item : consultationsMap.keySet()) {
consultation=item;
}
for (Conference item : conferencesMap.keySet()) {
sum+=(consultation.getPrice()*item.getExperts()
+item.getPrice()*conferencesMap.get(item).getPeople())*conferencesMap.get(item).getDays();
}
response.getWriter().print(sum);
} catch (IOException e) {
e.printStackTrace();
}
serializeBudget(budget, getFilePath(sessionID)); serializeBudget(budget, getFilePath(sessionID));
} else//修改规则 } else//修改规则
{ {
Conference item = new Conference(); Conference item =conference;
item.setId(id);
item.setName(name);
item.setPrice(price);
item.setExperts(experts);
item.setPeople(people);
if (curd.equals(0))//增 if (curd.equals(0))//增
{ {
conferenceDao.insertConference(item); conferenceDao.insertConference(item);
...@@ -668,7 +690,7 @@ public class BudgetHandler { ...@@ -668,7 +690,7 @@ public class BudgetHandler {
* @param cookies * @param cookies
* @return * @return
*/ */
private String getSessionID(Cookie[] cookies) { public static String getSessionID(Cookie[] cookies) {
String sessionID = null; String sessionID = null;
for (Cookie cookie : cookies) { for (Cookie cookie : cookies) {
if (cookie.getName().equals("sessionID")) { if (cookie.getName().equals("sessionID")) {
...@@ -687,7 +709,7 @@ public class BudgetHandler { ...@@ -687,7 +709,7 @@ public class BudgetHandler {
* @param sessionID * @param sessionID
* @return * @return
*/ */
private Budget retrieveBudget(String sessionID) { public static Budget retrieveBudget(String sessionID) {
String filepath = getFilePath(sessionID); String filepath = getFilePath(sessionID);
ObjectInputStream inputStream = null; ObjectInputStream inputStream = null;
try { try {
...@@ -712,7 +734,7 @@ public class BudgetHandler { ...@@ -712,7 +734,7 @@ public class BudgetHandler {
* @param sessionID * @param sessionID
* @return * @return
*/ */
private String getFilePath(String sessionID) { public static String getFilePath(String sessionID) {
String filePath = BudgetHandler.class.getClassLoader().getResource("..").getPath() + String filePath = BudgetHandler.class.getClassLoader().getResource("..").getPath() +
File.separator + "budgets" + File.separator + "budgets" +
File.separator + sessionID; File.separator + sessionID;
...@@ -721,7 +743,7 @@ public class BudgetHandler { ...@@ -721,7 +743,7 @@ public class BudgetHandler {
} }
private void serializeBudget(Budget budget, String filePath) { public static void serializeBudget(Budget budget, String filePath) {
File budgetFile = new File(filePath); File budgetFile = new File(filePath);
ObjectOutputStream outputStream = null; ObjectOutputStream outputStream = null;
try { try {
...@@ -746,7 +768,7 @@ public class BudgetHandler { ...@@ -746,7 +768,7 @@ public class BudgetHandler {
* @param budget * @param budget
* @param printWriter * @param printWriter
*/ */
private void budgetToOutputStream(Budget budget, Writer printWriter) { private static void budgetToOutputStream(Budget budget, Writer printWriter) {
BufferedWriter writer = new BufferedWriter(printWriter); BufferedWriter writer = new BufferedWriter(printWriter);
try { try {
writer.write("设备费,名称,单价,数量,小计"); writer.write("设备费,名称,单价,数量,小计");
...@@ -818,14 +840,14 @@ public class BudgetHandler { ...@@ -818,14 +840,14 @@ public class BudgetHandler {
writer.write("会议费,会议内容,费用标准,参会人数,会议次数,小计"); writer.write("会议费,会议内容,费用标准,参会人数,会议次数,小计");
writer.newLine(); writer.newLine();
items = (Map) budget.getConferences(); Map<Conference, Pair> conferences = budget.getConferences();
for (Item item : items.keySet()) { for (Item item : conferences.keySet()) {
if (item instanceof Conference) { if (item instanceof Conference) {
writer.write(comma + item.getName() writer.write(comma + item.getName()
+ comma + item.getPrice() + comma + item.getPrice()
+comma+((Conference) item).getPeople() +comma+conferences.get(item).getPeople()
+ comma + items.get(item) + comma + conferences.get(item).getDays()
+ comma + item.computeUnitPrice() * items.get(item)); + comma + item.getPrice()*conferences.get(item).getPeople()*conferences.get(item).getDays());
writer.newLine(); writer.newLine();
} }
} }
...@@ -873,7 +895,7 @@ public class BudgetHandler { ...@@ -873,7 +895,7 @@ public class BudgetHandler {
} }
writer.newLine(); writer.newLine();
if (budget.getConferences() != null && budget.getConferences().size() > 0) { if (budget.getConferences() != null && budget.getConferences().size() > 0 && budget.getConsultations()!=null) {
writer.write("咨询费,工作内容,人员类型,费用标准,每次人数,次数,小计"); writer.write("咨询费,工作内容,人员类型,费用标准,每次人数,次数,小计");
writer.newLine(); writer.newLine();
Map<Consultation, Integer> consultations = budget.getConsultations(); Map<Consultation, Integer> consultations = budget.getConsultations();
...@@ -881,15 +903,15 @@ public class BudgetHandler { ...@@ -881,15 +903,15 @@ public class BudgetHandler {
for (Consultation item : consultations.keySet()) { for (Consultation item : consultations.keySet()) {
consultation = item; consultation = item;
} }
items = (Map) budget.getConferences(); conferences= budget.getConferences();
for (Item item : items.keySet()) { for (Item item : conferences.keySet()) {
if (item instanceof Conference) { if (item instanceof Conference) {
writer.write(comma + item.getName() writer.write(comma + item.getName()
+ comma + consultation.getName() + comma + consultation.getName()
+ comma + consultation.getPrice() + comma + consultation.getPrice()
+ comma + ((Conference) item).getExperts() + comma + ((Conference) item).getExperts()
+ comma + items.get(item) + comma + conferences.get(item).getDays()
+ comma + ((Conference) item).getExperts() * consultation.getPrice() * items.get(item)); + comma + ((Conference) item).getExperts() * consultation.getPrice() * conferences.get(item).getDays());
writer.newLine(); writer.newLine();
} }
} }
...@@ -938,7 +960,7 @@ public class BudgetHandler { ...@@ -938,7 +960,7 @@ public class BudgetHandler {
* @param budget * @param budget
* @param outputStream * @param outputStream
*/ */
private void budgetToOutputStream(Budget budget, OutputStream outputStream) { public static void budgetToOutputStream(Budget budget, OutputStream outputStream) {
System.out.println("GBK"); System.out.println("GBK");
try { try {
budgetToOutputStream(budget, new PrintWriter(new OutputStreamWriter(outputStream, "GBK"))); budgetToOutputStream(budget, new PrintWriter(new OutputStreamWriter(outputStream, "GBK")));
......
package handlers;
import beans.Budget;
import beans.Indirect;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import service.IDetailService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/Budget/Detail")
public class DetailHandler {
@RequestMapping("Indirect")
public void showIndirect(HttpServletRequest request, HttpServletResponse response)
{
try {
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter writer = response.getWriter();
JSONObject object=new JSONObject();
String sessionID = BudgetHandler.getSessionID(request.getCookies());
Budget budget = BudgetHandler.retrieveBudget(sessionID);
Map<Indirect, Integer> indirects = budget.getIndirects();
List<JSONObject> list=new LinkedList<>();
for (Indirect indirect : indirects.keySet()) {
JSONObject obj=new JSONObject();
obj.put("id",indirect.getId());
obj.put("name",indirect.getName());
obj.put("price",indirect.getPrice());
obj.put("nums",indirects.get(indirect));
list.add(obj);
}
object.put("indirects",list);
writer.write(object.toJSONString());
} catch (IOException e) {
e.printStackTrace();
}
}
@Autowired
private IDetailService detailService;
@RequestMapping("/Stats")
public void getStats(HttpServletRequest request,HttpServletResponse response)
{
try {
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter writer = response.getWriter();
JSONObject object=new JSONObject();
String sessionID = BudgetHandler.getSessionID(request.getCookies());
Budget budget = BudgetHandler.retrieveBudget(sessionID);
double req_sofar=0.0,sum_sofar=0.0,req,sum;
JSONObject sub=new JSONObject();
req=budget.getRequirement().getEquip();
sum=detailService.sumEquipment(budget.getEquipments());
sub.put("req",req);
sub.put("sum",sum);
sub.put("diff",req-sum);
object.put("equipment",sub);
object.put("req",req_sofar);
object.put("sum",sum_sofar);
object.put("diff",req_sofar-sum_sofar);
writer.write(object.toJSONString());
} catch (IOException e) {
e.printStackTrace();
}
}
}
...@@ -17,7 +17,7 @@ public interface IBudgetService { ...@@ -17,7 +17,7 @@ public interface IBudgetService {
Map<Travel, Pair> doTravel(Double number); Map<Travel, Pair> doTravel(Double number);
Map<Conference,Integer> doConference(Double number); Map<Conference, Pair> doConference(Double number);
Map<InternationalCommunication,Integer> doInternationalCommunication(Double number); Map<InternationalCommunication,Integer> doInternationalCommunication(Double number);
...@@ -30,6 +30,7 @@ public interface IBudgetService { ...@@ -30,6 +30,7 @@ public interface IBudgetService {
Map<Consultation,Integer> doConsultation(Map<Conference,Integer> conferences); Map<Consultation,Integer> doConsultation(Map<Conference,Integer> conferences);
Map<Consultation,Integer> doConsultation(int n);
Map<Others,Integer> doOthers(Double number); Map<Others,Integer> doOthers(Double number);
......
package service;
import beans.Equipment;
import beans.Indirect;
import beans.Material;
import beans.Travel;
public interface ICheckService {
boolean checkEquipment(Equipment equipment);
boolean checkMaterial(Material material);
boolean checkTravel(Travel travel);
boolean checkIndirect(Indirect indirect);
}
package service;
import beans.Equipment;
import java.util.Map;
public interface IDetailService {
double sumEquipment(Map<Equipment, Integer> equipments);
}
...@@ -194,28 +194,36 @@ public class BudgetService implements IBudgetService { ...@@ -194,28 +194,36 @@ public class BudgetService implements IBudgetService {
if(travels!=null && travels.size()!=0) if(travels!=null && travels.size()!=0)
{ {
double sofar=0.0; double sofar=0.0;
Pair pair=new Pair(1,1);
for (Travel travel : travels) { for (Travel travel : travels) {
if(sofar<number) if(sofar<number)
{ {
Pair pair=new Pair(1,1);
result.put(travel,pair); result.put(travel,pair);
sofar+=travel.cost(pair); sofar+=travel.cost(pair);
} }
} }
while (true) while (sofar<number)
{ {
sofar=0.0;
for (Travel travel : result.keySet()) { for (Travel travel : result.keySet()) {
pair=result.get(travel); Pair pair=result.get(travel);
double oldCost=travel.cost(pair);
pair.setDays(pair.getDays()+1); pair.setDays(pair.getDays()+1);
sofar+=(travel.cost(pair)); double newCost=travel.cost(pair);
if(sofar>=number) return result; sofar+=(newCost-oldCost);
System.out.println("oldCost:"+oldCost);
System.out.println("newCost:"+newCost);
System.out.println("sofar:"+sofar);
if(sofar>=number) {
System.out.println(result);
return result;
}
} }
} }
} }
return result; return result;
} }
/////////////////////////////////////////////////////////待解决
/** /**
* 合成会议费 * 合成会议费
* *
...@@ -223,9 +231,39 @@ public class BudgetService implements IBudgetService { ...@@ -223,9 +231,39 @@ public class BudgetService implements IBudgetService {
* @return * @return
*/ */
@Override @Override
public Map<Conference, Integer> doConference(Double number) { public Map<Conference, Pair> doConference(Double number) {
Map<Conference,Pair> map=new HashMap<>();
List<Conference> conferences = conferenceDao.selectAll(); List<Conference> conferences = conferenceDao.selectAll();
return generateMap((List) conferences, number); List<Consultation> consultations = consultationDao.selectAll();
Consultation consultation=null;
if(consultations!=null && consultations.size()>0)
{
for (Consultation item : consultations) {
consultation=item;
break;
}
}
double sum=0.0;
for (Conference conference : conferences) {
if(sum<number)
{
Pair value = new Pair(1, 1);
map.put(conference,value);
sum+=conference.cost(value,consultation);
}
}
while (sum<number)
{
for (Conference conference : map.keySet()) {
Pair pair = map.get(conference);
double oldCost=conference.cost(pair,consultation);
pair.setPeople(pair.getPeople()+1);
double newCost=conference.cost(pair,consultation);
sum+=(newCost-oldCost);
if(sum>=number) return map;
}
}
return map;
} }
/** /**
...@@ -301,6 +339,18 @@ public class BudgetService implements IBudgetService { ...@@ -301,6 +339,18 @@ public class BudgetService implements IBudgetService {
return result; return result;
} }
@Override
public Map<Consultation, Integer> doConsultation(int n) {
List<Consultation> consultations = consultationDao.selectAll();
Map<Consultation,Integer> map=new HashMap<>();
if(consultations!=null && consultations.size()>0)
{
Consultation consultation = consultations.get(0);
map.put(consultation,n);
}
return map;
}
/** /**
* 合成其他费用(补差价) * 合成其他费用(补差价)
* *
......
package service.impl;
import beans.Equipment;
import org.springframework.stereotype.Service;
import service.IDetailService;
import java.util.Map;
@Service
public class DetailService implements IDetailService {
@Override
public double sumEquipment(Map<Equipment, Integer> equipments) {
return 0;
}
}
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
test = 15, test = 15,
power = 0, power = 0,
travel = 12, travel = 12,
conference = 3, conference = 5,
international = 6, international = 6,
property = 8, property = 8,
labour = 66, labour = 66,
......
...@@ -51,7 +51,8 @@ ...@@ -51,7 +51,8 @@
</div> </div>
</nav> </nav>
<button class="btn btn-success" onclick=jsp()>test</button>
<label id="xxx">123445</label>
<a href="Crawler/Workstation">爬取工作站数据</a><br> <a href="Crawler/Workstation">爬取工作站数据</a><br>
<a href="Budget/Download">下载</a><br> <a href="Budget/Download">下载</a><br>
...@@ -61,5 +62,14 @@ ${pageContext.request.contextPath}<br> ...@@ -61,5 +62,14 @@ ${pageContext.request.contextPath}<br>
<font size="<%=i%>"> hhhh</font> <font size="<%=i%>"> hhhh</font>
<% } <% }
%> %>
<script type="text/javascript">
var colors=["red","green","blue","orange"];
var i=0;
function jsp() {
document.getElementById("xxx").style.color=colors[i%colors.length];
i++;
}
</script>
</body> </body>
</html> </html>
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