|
|
@@ -1044,6 +1044,7 @@ public class ExcelTabController extends BladeController {
|
|
|
keyNames.attr("placeholder", textdictInfoVO.getSigRoleName());
|
|
|
}
|
|
|
}
|
|
|
+ setTableTips(wbsTreeContract, table);
|
|
|
fileInputStream.close();
|
|
|
return R.data(table + "");
|
|
|
} catch (Exception e) {
|
|
|
@@ -1051,6 +1052,94 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void setTableTips(WbsTreeContract tableNode, Element tableHtml) {
|
|
|
+ if (tableNode == null || tableHtml == null || tableNode.getDateIsComplete() == null || tableNode.getDateIsComplete() == 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ String tableName = tableNode.getInitTableName();
|
|
|
+ List<Map<String, Object>> valueMapList = jdbcTemplate.queryForList("select * from " + tableName + " where p_key_id = " + tableNode.getPKeyId());
|
|
|
+ if (CollectionUtil.isEmpty(valueMapList) || CollectionUtil.isEmpty(valueMapList.get(0))) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<WbsFormElement> wbsFormElementList = jdbcTemplate.query("select * from m_wbs_form_element where f_id = ( select id from m_table_info where tab_en_name in ( '" + tableName + "' ) and is_deleted = 0) and is_deleted = 0 and (required = 1 or ignore is not null)",
|
|
|
+ new BeanPropertyRowMapper<>(WbsFormElement.class));
|
|
|
+ if (CollectionUtil.isEmpty(wbsFormElementList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<String, WbsFormElement> keyMap = wbsFormElementList.stream().collect(Collectors.toMap(WbsFormElement::getEKey, item -> item, (v1, v2) -> v1));
|
|
|
+ Elements elements = tableHtml.select("el-date-picker");
|
|
|
+ elements.forEach(element -> {
|
|
|
+ String keyname = element.attr("keyname");
|
|
|
+ String key = keyname.split("__")[0];
|
|
|
+ if (!keyMap.containsKey(key)) {
|
|
|
+ WbsFormElement wbsFormElement = keyMap.get(key);
|
|
|
+ if (wbsFormElement != null && wbsFormElement.getNodeIgnore() != null && wbsFormElement.getNodeIgnore().contains(tableNode.getPId() + "")) {
|
|
|
+ Elements parents = element.parents();
|
|
|
+ for (Element parent : parents) {
|
|
|
+ if (parent.hasAttr("@mouseup.left")) {
|
|
|
+ String attr = parent.attr("@mouseup.left");
|
|
|
+ parent.attr("@mouseup.left", attr.substring(0, attr.length() - 1) + ", false)");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Elements parents = element.parents();
|
|
|
+ for (Element parent : parents) {
|
|
|
+ if (parent.hasAttr("@mouseup.left")) {
|
|
|
+ String attr = parent.attr("@mouseup.left");
|
|
|
+ parent.attr("@mouseup.left", attr.substring(0, attr.length() - 1) + ", true)");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ element.wrap("<div display=\"line\"></div>");
|
|
|
+ element.before("<el-tooltip content=\"缺少日期,点击忽略\" placement=\"top\" effect=\"light\">" +
|
|
|
+ "<hc-icon name=\"error-warning\"/ style = \"margin-right: 2px;color:#f56c6c;\">" +
|
|
|
+ "</el-tooltip>");
|
|
|
+ });
|
|
|
+ Map<String, Object> map = valueMapList.get(0);
|
|
|
+ DataStructureFormatUtils.parseDataByKey( map);
|
|
|
+
|
|
|
+ for (WbsFormElement wbsFormElement : wbsFormElementList) {
|
|
|
+ Object obj = map.get(wbsFormElement.getEKey());
|
|
|
+ if (obj != null && obj.toString().contains("_^_")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 查找html中标签属性 keyname中包含 wbsFormElement.getEKey()的标签
|
|
|
+ Elements keyNames = tableHtml.getElementsByAttributeValueContaining("keyname", wbsFormElement.getEKey());
|
|
|
+ if (!keyNames.isEmpty()) {
|
|
|
+ keyNames.forEach(element -> {
|
|
|
+ if (wbsFormElement.getNodeIgnore() != null && wbsFormElement.getNodeIgnore().contains(tableNode.getPId() + "")) {
|
|
|
+ Elements parents = element.parents();
|
|
|
+ for (Element parent : parents) {
|
|
|
+ if (parent.hasAttr("@mouseup.left")) {
|
|
|
+ String attr = parent.attr("@mouseup.left");
|
|
|
+ parent.attr("@mouseup.left", attr.substring(0, attr.length() - 1) + ", false)");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Elements parents = element.parents();
|
|
|
+ for (Element parent : parents) {
|
|
|
+ if (parent.hasAttr("@mouseup.left")) {
|
|
|
+ String attr = parent.attr("@mouseup.left");
|
|
|
+ parent.attr("@mouseup.left", attr.substring(0, attr.length() - 1) + ", true)");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ element.wrap("<div></div>");
|
|
|
+ element.before("<el-tooltip content=\"此项为必填项,点击忽略\" placement=\"top\" effect=\"light\" @click=\"cancelRequiredTips($event, " + wbsFormElement.getEKey() +")\">" +
|
|
|
+ "<hc-icon name=\"error-warning\"/ style = \"margin-right: 2px;color:#f56c6c;\">" +
|
|
|
+ "</el-tooltip>");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 后管清表生成html
|
|
|
*/
|
|
|
@@ -5542,4 +5631,35 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.data(excelTabService.getWbsTreeExcelTab(id,nodeId));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @GetMapping("/ignoreTips")
|
|
|
+ @ApiOperationSupport(order = 30)
|
|
|
+ @ApiOperation(value = "忽略必填提示", notes = "忽略必填提示")
|
|
|
+ public R<Boolean> ignoreTips(@RequestParam Long pkeyId, @RequestParam String key) {
|
|
|
+ if (key == null) {
|
|
|
+ throw new ServiceException("参数错误");
|
|
|
+ }
|
|
|
+ WbsTreeContract table = wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
+ if (table == null) {
|
|
|
+ throw new ServiceException("没有找到表单");
|
|
|
+ }
|
|
|
+ List<org.springblade.manager.entity.TableInfo> tableInfos = tableInfoService.list(Wrappers.<org.springblade.manager.entity.TableInfo>lambdaQuery().eq(org.springblade.manager.entity.TableInfo::getTabEnName, table.getInitTableName()));
|
|
|
+ if (tableInfos == null || tableInfos.isEmpty()) {
|
|
|
+ return R.fail("没有找到关联元素");
|
|
|
+ }
|
|
|
+ org.springblade.manager.entity.TableInfo tableInfo = tableInfos.get(0);
|
|
|
+ if (key.contains("__")) {
|
|
|
+ key = key.split("__")[0];
|
|
|
+ }
|
|
|
+ List<WbsFormElement> list = wbsFormElementService.list(Wrappers.<WbsFormElement>lambdaQuery().eq(WbsFormElement::getFId, tableInfo.getId()).eq(WbsFormElement::getEKey, key));
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
+ return R.fail("没有找到关联元素");
|
|
|
+ }
|
|
|
+ WbsFormElement element = list.get(0);
|
|
|
+ if (element.getNodeIgnore() == null || !element.getNodeIgnore().contains(table.getPId() + "")) {
|
|
|
+ element.setNodeIgnore(element.getNodeIgnore() == null ? "" : element.getNodeIgnore() + "," + table.getPId());
|
|
|
+ wbsFormElementService.update(Wrappers.<WbsFormElement>lambdaUpdate().eq(WbsFormElement::getId, element.getId()).set(WbsFormElement::getNodeIgnore, element.getNodeIgnore()));
|
|
|
+ }
|
|
|
+ return R.data(true);
|
|
|
+ }
|
|
|
}
|