|
@@ -68,6 +68,7 @@ public class LinkdataInfoController extends BladeController {
|
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
|
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
|
+
|
|
|
/**
|
|
|
* 详情
|
|
|
*/
|
|
@@ -169,7 +170,7 @@ public class LinkdataInfoController extends BladeController {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 编辑表单-替换元素||删除文本信息 保存
|
|
|
+ * 编辑表单-替换元素||删除文本信息 单个保存
|
|
|
*/
|
|
|
@PostMapping("/saveTabColInfo")
|
|
|
@ApiOperationSupport(order = 9)
|
|
@@ -247,4 +248,98 @@ public class LinkdataInfoController extends BladeController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑表单-替换元素||删除文本信息 批量编辑保存
|
|
|
+ */
|
|
|
+ @PostMapping("/saveTabColInfo2")
|
|
|
+ @ApiOperationSupport(order = 9)
|
|
|
+ @ApiOperation(value = "编辑表单-替换元素||删除文本信息 保存", notes = "传入linkdataInfo数组")
|
|
|
+ public R saveTabColInfo2(@Valid @RequestBody List<LinkdataInfo> list) throws IOException {
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
+ // 获取 节点信息
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(list.get(0).getTabId());
|
|
|
+ // 获取元素基本信息
|
|
|
+ WbsFormElement wbsFormElement = wbsFormElementService.getById(list.get(0).getHtmlType());
|
|
|
+ // 读取html页面信息
|
|
|
+ File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
+// File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1696003315218776064.html");
|
|
|
+ FileInputStream inputStream = new FileInputStream(file1);
|
|
|
+ String htmlString = IoUtil.readToString(inputStream);
|
|
|
+ // 样式集合
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+ //解析
|
|
|
+ Element table = doc.select("table").first();
|
|
|
+ Elements trs = table.select("tr");
|
|
|
+ for (LinkdataInfo linkdataInfo : list) {
|
|
|
+ Element element = trs.get(linkdataInfo.getTrIndex()).select("td").get(linkdataInfo.getTdIndex());
|
|
|
+ String keyId = "";
|
|
|
+ if (linkdataInfo.getColName().equals("/")) {
|
|
|
+ element.empty();
|
|
|
+ } else {
|
|
|
+ String enName = wbsFormElement.getEName();
|
|
|
+ element.removeAttr("title");
|
|
|
+ element.attr("title", enName);
|
|
|
+ String dataInfo2 = wbsFormElement.getEKey() + "__" + linkdataInfo.getTrIndex() + "_" + linkdataInfo.getTdIndex();
|
|
|
+ Element element1 = element.children().get(0);
|
|
|
+
|
|
|
+ if (element.html().indexOf("el-tooltip") >= 0) {
|
|
|
+ element1.removeAttr("placeholder");
|
|
|
+ element1.removeAttr("keyName");
|
|
|
+ element1.removeAttr("id");
|
|
|
+ element1.removeAttr("weighing");
|
|
|
+ element1.removeAttr("v-model");
|
|
|
+ element1.removeAttr("@focus");
|
|
|
+ keyId = element1.attr("keyName");
|
|
|
+ element1 = element.children().get(0).children().get(0);
|
|
|
+ }
|
|
|
+ //如果是警告,则删除样式
|
|
|
+ String aClass = element1.attr("class");
|
|
|
+ if (StringUtils.isNotBlank(aClass)){
|
|
|
+ if ("warnstyle".equals(aClass)){
|
|
|
+ element1.removeAttr("class");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ element1.removeAttr("placeholder");
|
|
|
+ element1.removeAttr("keyName");
|
|
|
+ element1.removeAttr("id");
|
|
|
+ element1.removeAttr("weighing");
|
|
|
+ element1.removeAttr("v-model");
|
|
|
+ element1.removeAttr("@focus");
|
|
|
+ keyId = element1.attr("keyName");
|
|
|
+ if (element.html().indexOf("hc-form-checkbox-group") >= 0) {
|
|
|
+ element1.removeAttr(":val");
|
|
|
+ element1.attr(":val", "formData." + dataInfo2);
|
|
|
+ }
|
|
|
+
|
|
|
+ element1.attr("placeholder", enName).attr("keyName", dataInfo2).attr("id", dataInfo2);
|
|
|
+ element1.attr("weighing", "100");
|
|
|
+ element1.attr("v-model", "formData." + dataInfo2);
|
|
|
+ element.attr("@click", "getInformation('" + enName + "'," + linkdataInfo.getTrIndex() + "," + linkdataInfo.getTdIndex() + ")");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清空数据
|
|
|
+ if (StringUtils.isNotEmpty(keyId)) {
|
|
|
+ String tabName = wbsTreePrivate.getInitTableName();
|
|
|
+ String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
|
|
|
+ List<Map<String, Object>> tablist = jdbcTemplate.queryForList(isExitSql);
|
|
|
+ if (tablist != null && tablist.size() > 0 && wbsTreePrivate.getType() != 10) {
|
|
|
+ String clarSql = "update " + tabName + " set " + keyId.split("__")[0] + "=null where p_key_id in(SELECT p_key_id FROM m_wbs_tree_contract WHERE id ='" + wbsTreePrivate.getId() + "' and project_id='" + wbsTreePrivate.getProjectId() + "' )";
|
|
|
+ jdbcTemplate.execute(clarSql);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ File writefile = new File(wbsTreePrivate.getHtmlUrl());
|
|
|
+// File writefile = new File("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1696003315218776064.html");
|
|
|
+ FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
+ inputStream.close();
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|