qianxb преди 2 години
родител
ревизия
917735428f
променени са 1 файла, в които са добавени 77 реда и са изтрити 77 реда
  1. 77 77
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/LinkdataInfoController.java

+ 77 - 77
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/LinkdataInfoController.java

@@ -171,83 +171,83 @@ public class LinkdataInfoController extends BladeController {
     }
 
 
-//    /**
-//     * 编辑表单-替换元素||删除文本信息 单个保存
-//     */
-//    @PostMapping("/saveTabColInfo")
-//    @ApiOperationSupport(order = 9)
-//    @ApiOperation(value = "编辑表单-替换元素||删除文本信息 保存", notes = "传入linkdataInfo")
-//    public R saveTabColInfo(@Valid @RequestBody LinkdataInfo linkdataInfo) throws IOException {
-//
-//        // 获取 节点信息
-//        WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(linkdataInfo.getTabId());
-//        // 读取html页面信息
-//        File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
-//        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");
-//        Element element = trs.get(linkdataInfo.getTrIndex()).select("td").get(linkdataInfo.getTdIndex());
-//        String keyId = "";
-//        if (linkdataInfo.getColName().equals("/")) {
-//            element.empty();
-//        } else {
-//            // 获取元素基本信息
-//            WbsFormElement wbsFormElement = wbsFormElementService.getById(linkdataInfo.getHtmlType());
-//            String enName = wbsFormElement.getEName();
-//            element.removeAttr("title");
-//            element.attr("title", enName);
-//            String dataInfo2 = wbsFormElement.getEKey() + "__" + linkdataInfo.getTrIndex() + "_" + linkdataInfo.getTdIndex();
-//            Element element1 = 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);
-//            }
-//
-//            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() + ")");
-//        }
-//
-//        File writefile = new File(wbsTreePrivate.getHtmlUrl());
-//        FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
-//        inputStream.close();
-//
-//        // 清空数据
-//        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);
-//            }
-//        }
-//        return R.success("操作成功");
-//    }
+    /**
+     * 编辑表单-替换元素||删除文本信息 单个保存
+     */
+    @PostMapping("/saveTabColInfo")
+    @ApiOperationSupport(order = 9)
+    @ApiOperation(value = "编辑表单-替换元素||删除文本信息 保存", notes = "传入linkdataInfo")
+    public R saveTabColInfo(@Valid @RequestBody LinkdataInfo linkdataInfo) throws IOException {
+
+        // 获取 节点信息
+        WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(linkdataInfo.getTabId());
+        // 读取html页面信息
+        File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
+        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");
+        Element element = trs.get(linkdataInfo.getTrIndex()).select("td").get(linkdataInfo.getTdIndex());
+        String keyId = "";
+        if (linkdataInfo.getColName().equals("/")) {
+            element.empty();
+        } else {
+            // 获取元素基本信息
+            WbsFormElement wbsFormElement = wbsFormElementService.getById(linkdataInfo.getHtmlType());
+            String enName = wbsFormElement.getEName();
+            element.removeAttr("title");
+            element.attr("title", enName);
+            String dataInfo2 = wbsFormElement.getEKey() + "__" + linkdataInfo.getTrIndex() + "_" + linkdataInfo.getTdIndex();
+            Element element1 = 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);
+            }
+
+            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() + ")");
+        }
+
+        File writefile = new File(wbsTreePrivate.getHtmlUrl());
+        FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
+        inputStream.close();
+
+        // 清空数据
+        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);
+            }
+        }
+        return R.success("操作成功");
+    }