|
@@ -285,9 +285,9 @@ public class ExcelTabController extends BladeController {
|
|
|
@GetMapping("/getWbsTypeList")
|
|
|
@ApiOperationSupport(order = 10)
|
|
|
@ApiOperation(value = "清表编辑 wbs 下拉框选择", notes = "传入excelTab")
|
|
|
- @ApiImplicitParams(value = {@ApiImplicitParam(name = "wbsType", value = "wbsType", required = true)})
|
|
|
- public R getWbsTypeList(Integer wbsType) {
|
|
|
- List<ExcelTabWbsTypeVO> wbsTypeList= excelTabService.getWbsTypeList(wbsType);
|
|
|
+ @ApiImplicitParams(value = {@ApiImplicitParam(name = "wbstype", value = "wbstype", required = true)})
|
|
|
+ public R getWbsTypeList(Integer wbstype) {
|
|
|
+ List<ExcelTabWbsTypeVO> wbsTypeList= excelTabService.getWbsTypeList(wbstype);
|
|
|
return R.data(wbsTypeList);
|
|
|
}
|
|
|
|
|
@@ -738,11 +738,17 @@ public class ExcelTabController extends BladeController {
|
|
|
for(int i = 0 ;i <=trs.size()-1 ;i++) {
|
|
|
Element tr = trs.get(i);
|
|
|
Elements tds = tr.select("td");
|
|
|
+
|
|
|
String xyInof = getTrInfo(tds,styleMap,index_state,xy_type,maxCol);
|
|
|
+
|
|
|
xy_type = Integer.parseInt(xyInof.split(",")[0]);
|
|
|
tr.attr("xy_type",xyInof);
|
|
|
index_state = Boolean.parseBoolean(xyInof.split(",")[1]);
|
|
|
boolean isMaxCol = Integer.parseInt(xyInof.split(",")[2])==maxCol;
|
|
|
+
|
|
|
+ boolean istrue = Boolean.parseBoolean(xyInof.split(",")[3]);
|
|
|
+
|
|
|
+
|
|
|
// 计算单元格坐标
|
|
|
int x= 0;
|
|
|
for (int j = 0; j < tds.size(); j++) {
|
|
@@ -820,8 +826,6 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- // System.out.println(x1+"_"+x2+"_"+y1+"_"+y2+"_"+textInfo);
|
|
|
data.text(textInfo.replaceAll(" ",""));
|
|
|
if(!textInfo.isEmpty() && !textInfo.equals("/") && !(textInfo.indexOf("年")>=0 && textInfo.indexOf("月")>=0&& textInfo.indexOf("日")>=0)&& !textInfo.equals("—") && !textInfo.equals("-") ){ // 标题区域
|
|
|
Map<String,String> dataInfo =new HashMap<String,String>();
|
|
@@ -842,10 +846,12 @@ public class ExcelTabController extends BladeController {
|
|
|
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 && xytype2==xy_type){
|
|
|
left.add(zikey.get(k));
|
|
|
}
|
|
|
+
|
|
|
//向 上 匹配
|
|
|
if(index_state){
|
|
|
if( xx1<=x1 && xx2 >=x2 && yy2<y1 && xytype2==xy_type){
|
|
@@ -861,8 +867,17 @@ public class ExcelTabController extends BladeController {
|
|
|
int xx2 = Integer.parseInt( left.get(k).get("x2"));
|
|
|
int yy1 = Integer.parseInt( left.get(k).get("y1"));
|
|
|
int yy2 = Integer.parseInt( left.get(k).get("y2"));
|
|
|
+
|
|
|
if(index_state){ // 正向规则匹配
|
|
|
- inputText+=name+"_";
|
|
|
+ if(istrue){
|
|
|
+ if(x1-xx2<=1 && y1==yy2){
|
|
|
+ inputText = name;
|
|
|
+ }else{
|
|
|
+ inputText+=name+"_";
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ inputText+=name+"_";
|
|
|
+ }
|
|
|
}else{
|
|
|
if(x1-xx2<=1 && y1==yy2){
|
|
|
inputText = name;
|
|
@@ -886,21 +901,20 @@ public class ExcelTabController extends BladeController {
|
|
|
inputText = inputText.substring(0,inputText.lastIndexOf("_"));
|
|
|
}
|
|
|
|
|
|
- // 计算当前 输入框 标题匹配原则(左 - 上- 下)
|
|
|
- // System.out.println(x1+"_"+x2+","+y1+"_"+y2+"=="+textInfo+"=left"+left.toString() +"===top"+top.toString()+"__index_state="+index_state+"inputtext="+inputText);
|
|
|
-
|
|
|
+ String parm = i+","+j+","+x1+","+x2+","+y1+","+y2+",$event";
|
|
|
// 设置文本信息
|
|
|
ExctabCell exctabCell = new ExctabCell();
|
|
|
if(textInfo.indexOf("年")>=0 && textInfo.indexOf("月")>=0&& textInfo.indexOf("日")>=0){
|
|
|
- //data.empty().append("<input type='time' style='width:100%;height:100%' placeholder=''> </input>");
|
|
|
- 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>");
|
|
|
+ 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>");
|
|
|
exctabCell.setExctabId(excelId);
|
|
|
exctabCell.setTextInfo("签字时间");
|
|
|
exctabCell.setIsDeleted(0);
|
|
|
exctabCell.setXys(i+"_"+j);
|
|
|
colTitle.add(exctabCell);
|
|
|
+ data.attr("title","签字时间");
|
|
|
}else {
|
|
|
- String parm = i+","+j+","+x1+","+x2+","+y1+","+y2+",$event";
|
|
|
+
|
|
|
if(index_state){
|
|
|
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>");
|
|
@@ -935,9 +949,8 @@ public class ExcelTabController extends BladeController {
|
|
|
exctabCell.setXys(i+"_"+j);
|
|
|
colTitle.add(exctabCell);
|
|
|
}
|
|
|
+ data.attr("title",inputText.replaceAll("[^(\u4E00-\u9FA5_)]", ""));
|
|
|
}
|
|
|
- data.attr("title",inputText.replaceAll("[^(\u4E00-\u9FA5_)]", ""));
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -974,13 +987,20 @@ public class ExcelTabController extends BladeController {
|
|
|
int text_width = 0;
|
|
|
int width = 0;
|
|
|
|
|
|
+
|
|
|
+ int null_count = 0;
|
|
|
+ int val_count = 0;
|
|
|
+
|
|
|
+ boolean istrue = true;
|
|
|
+
|
|
|
//区域计算
|
|
|
for (int j = 0; j < tds.size(); j++) {
|
|
|
Element data = tds.get(j);
|
|
|
String keyId = data.attr("class");
|
|
|
-
|
|
|
int colspan = data.attr("COLSPAN").equals("") ? 1 : Integer.parseInt(data.attr("COLSPAN"));
|
|
|
String classInfo = styleMap.get(keyId);
|
|
|
+ String textInfo = data.text().trim().replaceAll(" ","");
|
|
|
+
|
|
|
if(classInfo ==null){
|
|
|
classInfo = data.attr("style");
|
|
|
}else{
|
|
@@ -1003,6 +1023,12 @@ public class ExcelTabController extends BladeController {
|
|
|
text_width += colspan;
|
|
|
}
|
|
|
width +=colspan;
|
|
|
+
|
|
|
+ if(!textInfo.isEmpty() && !textInfo.equals("/") && !(textInfo.indexOf("年")>=0 && textInfo.indexOf("月")>=0&& textInfo.indexOf("日")>=0)&& !textInfo.equals("—") && !textInfo.equals("-") ){ // 标题区域
|
|
|
+ val_count++;
|
|
|
+ }else{
|
|
|
+ null_count++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 在区域内
|
|
@@ -1021,7 +1047,13 @@ public class ExcelTabController extends BladeController {
|
|
|
xy_type+=1;
|
|
|
}
|
|
|
}
|
|
|
- return xy_type+","+index_state+","+width;
|
|
|
+
|
|
|
+ if(null_count==val_count){
|
|
|
+ istrue = true;
|
|
|
+ }else{
|
|
|
+ istrue = false ;
|
|
|
+ }
|
|
|
+ return xy_type+","+index_state+","+width+","+istrue;
|
|
|
}
|
|
|
|
|
|
// 获取解析样式
|
|
@@ -1126,7 +1158,6 @@ public class ExcelTabController extends BladeController {
|
|
|
}else{
|
|
|
reData.put(keyData,myData);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1194,7 +1225,7 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
|
|
|
String pdfPath="/Users/hongchuangyanfa/Desktop/pdf//"+pkeyId+".pdf";
|
|
|
- String pdfHtmlPath="/Users/hongchuangyanfa/Desktop/pdfHtml//"+pkeyId+".pdf";
|
|
|
+ String pdfHtmlPath="/Users/hongchuangyanfa/Desktop/pdfHtml//"+pkeyId+".html";
|
|
|
|
|
|
File writefile = new File(pdfHtmlPath);
|
|
|
FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|