|
@@ -294,9 +294,10 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiOperationSupport(order = 12)
|
|
|
@ApiOperation(value = "查询当前节点下所有表单", notes = "传入父节点id")
|
|
|
public R<List<WbsNodeTableVO>> selectByNodeTable(@ApiParam(value = "树节点Id", required = true) @RequestParam String id,
|
|
|
- @ApiParam(value = "wbsType", required = true) @RequestParam Integer wbsType) {
|
|
|
+ @ApiParam(value = "wbsType", required = true) @RequestParam Integer wbsType,
|
|
|
+ @ApiParam(value = "wbsType", required = true) @RequestParam String projectid) {
|
|
|
if(wbsType==1){
|
|
|
- List<WbsNodeTableVO> rs = wbsTreeService.selectByNodeTable(id);
|
|
|
+ List<WbsNodeTableVO> rs = wbsTreeService.selectByNodeTableByExcel(id,projectid);
|
|
|
if (!("").equals(rs) && rs.size() > 0) {
|
|
|
return R.data(rs);
|
|
|
}
|
|
@@ -329,6 +330,31 @@ public class ExcelTabController extends BladeController {
|
|
|
excelTab.setAlias(ancestors);
|
|
|
}
|
|
|
excelTabService.saveOrUpdate(excelTab);
|
|
|
+ // 关联清表信息计算
|
|
|
+
|
|
|
+ List<ExcelTabWbsTypeVO> linkDataInfo = wbsExclTabParmVO.getLinkDataInfo();
|
|
|
+
|
|
|
+ if(linkDataInfo!=null && linkDataInfo.size()>=1){
|
|
|
+ for (ExcelTabWbsTypeVO info : linkDataInfo){
|
|
|
+ String[] pk_id = info.getLinkIds().split(",");
|
|
|
+ for(String pkInfo : pk_id){
|
|
|
+
|
|
|
+ /*wbsTree.setPKeyId(Long.parseLong(pkInfo));
|
|
|
+ WbsTreePrivate aPrivate = wbsTreePrivateService.getOne(Condition.getQueryWrapper(wbsTree));
|
|
|
+ aPrivate.setExcelId(excelTab.getId());
|
|
|
+ aPrivate.setIsLinkTable(2);*/
|
|
|
+
|
|
|
+ UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.in("p_key_id",Long.parseLong(pkInfo));
|
|
|
+ updateWrapper.set("is_link_table",2);
|
|
|
+ updateWrapper.set("excel_id",excelTab.getId());
|
|
|
+
|
|
|
+ wbsTreePrivateService.update(updateWrapper);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
return R.success("添加成功!");
|
|
|
}
|
|
|
|
|
@@ -362,7 +388,7 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
|
updateWrapper.in("p_key_id",tabId);
|
|
|
- updateWrapper.set("is_link_table",1);
|
|
|
+ updateWrapper.set("is_link_table",2);
|
|
|
updateWrapper.set("excel_id",exceTabId);
|
|
|
|
|
|
wbsTreePrivateService.update(updateWrapper);
|
|
@@ -395,21 +421,11 @@ public class ExcelTabController extends BladeController {
|
|
|
// 标题坐标
|
|
|
List<Map<String,String>> zikey = new ArrayList<>();
|
|
|
|
|
|
- int index_id = 0;
|
|
|
+
|
|
|
// 循环解析
|
|
|
for(int i = 0 ;i < trs.size() ;i++) {
|
|
|
Element tr = trs.get(i);
|
|
|
- boolean index_stat = Boolean.parseBoolean(tr.attr("index_stat"));
|
|
|
-
|
|
|
- if(index_stat && index_id==0){
|
|
|
- index_id = 1;
|
|
|
- zikey = new ArrayList<>();
|
|
|
- }
|
|
|
-
|
|
|
- if(!index_stat && index_id==1 && zikey.size()>=1){
|
|
|
- index_id = 2;
|
|
|
- zikey = new ArrayList<>();
|
|
|
- }
|
|
|
+ boolean index_stat = Boolean.parseBoolean(tr.attr("indexstat"));
|
|
|
|
|
|
Elements tds = tr.select("td");
|
|
|
for (int j = 0; j < tds.size(); j++) {
|
|
@@ -419,7 +435,8 @@ public class ExcelTabController extends BladeController {
|
|
|
int x2 = Integer.parseInt( data.attr("x2"));
|
|
|
int y1 = Integer.parseInt( data.attr("y1"));
|
|
|
int y2 = Integer.parseInt( data.attr("y2"));
|
|
|
-
|
|
|
+ int xytype = Integer.parseInt( data.attr("xytype"));
|
|
|
+ System.out.println(data.html());
|
|
|
|
|
|
if(!textInfo.isEmpty() && !textInfo.equals("/")){
|
|
|
Map<String,String> dataInfo =new HashMap<String,String>();
|
|
@@ -428,22 +445,22 @@ public class ExcelTabController extends BladeController {
|
|
|
dataInfo.put("x2",data.attr("x2"));
|
|
|
dataInfo.put("y1",data.attr("y1"));
|
|
|
dataInfo.put("y2",data.attr("y2"));
|
|
|
+ dataInfo.put("xytype",data.attr("xytype"));
|
|
|
zikey.add(dataInfo);
|
|
|
- }else if(data.html().indexOf("input")>=0){
|
|
|
-
|
|
|
+ }else if(data.html().indexOf("el-input")>=0){
|
|
|
List arrayList = new ArrayList<>();
|
|
|
-
|
|
|
-
|
|
|
- for(int k=zikey.size()-1;k>=0 ;k--){
|
|
|
+ List left = new ArrayList<>();
|
|
|
+ List top = new ArrayList<>();
|
|
|
+ for(int k=zikey.size()-1 ; k>=0 ;k--){
|
|
|
String name = zikey.get(k).get("name").replaceAll("[^\u4E00-\u9FA5]", "");
|
|
|
int xx1 = Integer.parseInt( zikey.get(k).get("x1"));
|
|
|
int xx2 = Integer.parseInt( zikey.get(k).get("x2"));
|
|
|
int yy1 = Integer.parseInt( zikey.get(k).get("y1"));
|
|
|
int yy2 = Integer.parseInt( zikey.get(k).get("y2"));
|
|
|
-
|
|
|
+ int xytype2 = Integer.parseInt( zikey.get(k).get("xytype"));
|
|
|
// 左匹配
|
|
|
- if( yy1<=y1 && yy2>=y2 && xx2<x1 && StringUtils.isNotEmpty(name)){
|
|
|
- arrayList.add(name);
|
|
|
+ if( yy1<=y1 && yy2>=y2 && xx2<x1 && StringUtils.isNotEmpty(name) && xytype2==xytype){
|
|
|
+ left.add(name);
|
|
|
if(!index_stat){
|
|
|
break;
|
|
|
}
|
|
@@ -451,41 +468,43 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
//向 上 匹配
|
|
|
if(index_stat){
|
|
|
- if( xx1<=x1 && xx2 >=x2 && yy2<y1 ){
|
|
|
- arrayList.add(name);
|
|
|
+ if( xx1<=x1 && xx2 >=x2 && yy2<y1 && xytype2==xytype){
|
|
|
+ top.add(name);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ arrayList.addAll(left);
|
|
|
+ arrayList.addAll(top);
|
|
|
+
|
|
|
Set<String> resultSet = new HashSet<>();
|
|
|
MathUtil.getCombination(arrayList, resultSet);
|
|
|
double maxInfo = 0;
|
|
|
- if(!resultSet.isEmpty()){
|
|
|
-
|
|
|
- for(WbsFormElement wbsFormElement : dataList){
|
|
|
- for(String bx : resultSet){
|
|
|
- double dataxx = MathUtil.sim(bx,wbsFormElement.getEName().replaceAll("[^\u4E00-\u9FA5]", ""));
|
|
|
- if(maxInfo < dataxx){
|
|
|
- System.out.println("x1-x2="+x1+","+x2+"y1-y2="+y1+","+y2+bx+"="+dataxx+"_jieh="+resultSet);
|
|
|
- data.empty().text(bx);
|
|
|
- maxInfo = dataxx;
|
|
|
+ String textDataInfo = "";
|
|
|
+ String textDataType = "";
|
|
|
+ if (!resultSet.isEmpty()) {
|
|
|
+ for (String bx : resultSet) {
|
|
|
+ for (WbsFormElement wbsFormElement : dataList) {
|
|
|
+ if(bx.equals(wbsFormElement.getEName())){
|
|
|
+ textDataInfo= wbsFormElement.getEName();
|
|
|
+ textDataType = wbsFormElement.getEKey();
|
|
|
+ break;
|
|
|
+ }else {
|
|
|
+ double dataxx = MathUtil.sim(bx, wbsFormElement.getEName());
|
|
|
+ if (maxInfo < dataxx) {
|
|
|
+ textDataInfo = wbsFormElement.getEName();
|
|
|
+ textDataType = wbsFormElement.getEKey();
|
|
|
+ maxInfo = dataxx;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- System.out.println(maxInfo);
|
|
|
+ data.children().get(0).attr("placeholder",textDataInfo).attr("v-model","formData."+textDataType+"_"+i+j);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- //
|
|
|
- // for (Map<String,String> d:zikey){
|
|
|
- // System.out.println(d.get("name")+"x1"+d.get("x1"));
|
|
|
- // }
|
|
|
-
|
|
|
fileInputStream.close();
|
|
|
-
|
|
|
File writefile = new File(thmlUrl);
|
|
|
FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
System.out.println("完成");
|
|
@@ -493,6 +512,34 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 清表生成html
|
|
|
+ */
|
|
|
+ @GetMapping("/get-excel-html_buss")
|
|
|
+ @ApiOperationSupport(order = 16)
|
|
|
+ @ApiOperation(value = "清表生成html", notes = "清表生成html")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(name = "excelId", value = "excelId", required = true)
|
|
|
+ })
|
|
|
+ public R getExcelHtmlByBuss(Long excelId) throws IOException {
|
|
|
+ ExcelTab excelTab = excelTabService.getById(excelId);
|
|
|
+ if(excelTab ==null ){
|
|
|
+ return R.fail("该数据下无此节点!");
|
|
|
+ }
|
|
|
+ if(excelTab.getHtmlUrl()==null){
|
|
|
+ return R.fail("请上传清表!");
|
|
|
+ }
|
|
|
+
|
|
|
+ File file1 = ResourceUtil.getFile(excelTab.getHtmlUrl());
|
|
|
+ FileInputStream fileInputStream = new FileInputStream(file1);
|
|
|
+ String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
+ // 解析 style
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+ Element table = doc.select("table").first();
|
|
|
+ doc.select("Col").remove();
|
|
|
+ fileInputStream.close();
|
|
|
+ return R.data(table+"");
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 清表生成html
|
|
@@ -553,6 +600,7 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
int s_index = 0;
|
|
|
boolean index_stat = false;
|
|
|
+ int xy_type = 1 ;
|
|
|
// 横向计算
|
|
|
for(int i = 0 ;i < trs.size() ;i++) {
|
|
|
Element tr = trs.get(i);
|
|
@@ -560,6 +608,7 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
int x_width = 0 ;
|
|
|
int y_width = 0 ;
|
|
|
+ int text_width = 0;
|
|
|
//区域计算
|
|
|
for (int j = 0; j < tds.size(); j++) {
|
|
|
Element data = tds.get(j);
|
|
@@ -570,35 +619,39 @@ public class ExcelTabController extends BladeController {
|
|
|
data.removeAttr("class");
|
|
|
data.attr("style",styleMap.get(keyId).replaceAll("break-word","inherit"));
|
|
|
// 第一列
|
|
|
- if(j==0 && classInfo.indexOf("border-left-style")>=0 && classInfo.indexOf("border-top-style")>=0 && classInfo.indexOf("border-bottom-style")>=0 && !index_stat){
|
|
|
- x_width +=colspan;
|
|
|
- }else if(j == tds.size()-1 && classInfo.indexOf("border-right-style")>=0 && classInfo.indexOf("border-top-style")>=0 && classInfo.indexOf("border-bottom-style")>=0 && !index_stat && j>=1){
|
|
|
- x_width +=colspan;
|
|
|
- }else if(classInfo.indexOf("border-top-style")>=0 && classInfo.indexOf("border-bottom-style")>=0 && !index_stat && j>=1){
|
|
|
- x_width +=colspan;
|
|
|
+
|
|
|
+ // 计算线开始
|
|
|
+ if(classInfo.indexOf("border-left-style")>=0 && classInfo.indexOf("border-top-style")>=0 && classInfo.indexOf("border-bottom-style")>=0 && classInfo.indexOf("border-right-style")>=0){
|
|
|
+ x_width += colspan;
|
|
|
}
|
|
|
|
|
|
- // 计算退出
|
|
|
- if(j==0 && classInfo.indexOf("border-left-style")<0 && classInfo.indexOf("border-top-style")>=0 && classInfo.indexOf("border-bottom-style")<0 && index_stat && classInfo.indexOf("border-right-style")<0){
|
|
|
- y_width +=colspan;
|
|
|
- }else if(j == tds.size()-1 && classInfo.indexOf("border-right-style")<0 && classInfo.indexOf("border-top-style")>=0 && classInfo.indexOf("border-bottom-style")<0 && index_stat && j>=1){
|
|
|
- y_width +=colspan;
|
|
|
- }else if(classInfo.indexOf("border-top-style")>=0 && classInfo.indexOf("border-bottom-style")<0 &&index_stat && j>=1){
|
|
|
- y_width +=colspan;
|
|
|
+ // 计算结束
|
|
|
+ if(classInfo.indexOf("border-left-style")< 0 && classInfo.indexOf("border-bottom-style")<0 && classInfo.indexOf("border-right-style")<0){
|
|
|
+ y_width += colspan;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if(x_width == maxCol && !index_stat && s_index==0){
|
|
|
- s_index = i + 1;
|
|
|
- index_stat = true ;
|
|
|
+ String name = data.text().replaceAll("[^\u4E00-\u9FA5]", "");
|
|
|
+ if(!name.isEmpty()){
|
|
|
+ text_width += colspan;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if(y_width == maxCol && index_stat && s_index>0){
|
|
|
- s_index = i + 1;
|
|
|
- index_stat = false ;
|
|
|
+ if(index_stat){
|
|
|
+ //是否需要改变
|
|
|
+ if(maxCol == y_width ){
|
|
|
+ index_stat = false ;
|
|
|
+ xy_type+=1;
|
|
|
+ }
|
|
|
+ if(maxCol == text_width){
|
|
|
+ xy_type+=1;
|
|
|
+ }
|
|
|
+ }else{ // 区域外
|
|
|
+ if(maxCol == x_width ){
|
|
|
+ index_stat = true ;
|
|
|
+ xy_type+=1;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- tr.attr("index_stat",index_stat+"");
|
|
|
+ tr.attr("indexStat",index_stat+"");
|
|
|
|
|
|
int x= 0;
|
|
|
for (int j = 0; j < tds.size(); j++) {
|
|
@@ -674,12 +727,9 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- // System.out.println(StringUtil.trimAllWhitespace(textInfo)+""+StringUtil.trimAllWhitespace(textInfo).length());
|
|
|
+ System.out.println(StringUtil.trimAllWhitespace(textInfo)+""+StringUtil.trimAllWhitespace(textInfo).length());
|
|
|
data.text(textInfo.replaceAll(" ",""));
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// 设置td 属性
|
|
|
data.attr("trIndex",i+"");
|
|
|
data.attr("tdIndex",j+"");
|
|
@@ -687,24 +737,25 @@ public class ExcelTabController extends BladeController {
|
|
|
data.attr("x2",x2+"");
|
|
|
data.attr("y1",y1+"");
|
|
|
data.attr("y2",y2+"");
|
|
|
+ data.attr("xytype",xy_type+"");
|
|
|
String parm = i+","+j+","+x1+","+x2+","+y1+","+y2;
|
|
|
// 设置文本信息
|
|
|
if(textInfo.indexOf("年")>=0 && textInfo.indexOf("月")>=0&& textInfo.indexOf("日")>=0){
|
|
|
- data.empty().append("<el-date-picker style='width:100%;height:100%' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" type='date' format='yyyy 年 MM 月 dd 日' placeholder='请选择时间'> </el-date-picker>");
|
|
|
+ data.empty().append("<el-date-picker style='width:100%;height:100%' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" type='date' format='yyyy 年 MM 月 dd 日' placeholder='请选择时间'> </el-date-picker>");
|
|
|
}
|
|
|
|
|
|
if(textInfo.isEmpty() || textInfo.equals("/") || textInfo.equals("-")){
|
|
|
if(index_stat){
|
|
|
if(rowspan>=1){
|
|
|
- data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
}else{
|
|
|
- data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' placeholder=''> </el-input>");
|
|
|
}
|
|
|
}else{
|
|
|
if(j==0 ){
|
|
|
if(colspan ==maxCol && i>=1 && i<=2){
|
|
|
if(rowspan>=1){
|
|
|
- data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
}else{
|
|
|
data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' placeholder=''> </el-input>");
|
|
|
}
|
|
@@ -715,7 +766,7 @@ public class ExcelTabController extends BladeController {
|
|
|
if(rowspan>=1){
|
|
|
data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
}else{
|
|
|
- data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' placeholder=''> </el-input>");
|
|
|
}
|
|
|
}
|
|
|
}
|