Compare commits

...

3 Commits

  1. 224
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ChineseNumberFilter.java
  2. 297
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TitleFormatterController.java
  3. 297
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TitleFormatterControllerCopy.java
  4. 64
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TitleTemplateController.java
  5. 72
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java
  6. 90
      ruoyi-system/src/main/java/com/ruoyi/system/domain/FileUploadDTO.java
  7. 100
      ruoyi-system/src/main/java/com/ruoyi/system/domain/TitleTemplate.java
  8. 26
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/TitleTemplateMapper.java
  9. 23
      ruoyi-system/src/main/java/com/ruoyi/system/service/ITitleTemplateService.java
  10. 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LuceneUtil.java
  11. 50
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TitleTemplateServiceImpl.java
  12. 952
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WordSplitter.java
  13. 34
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZhyFileManageServiceImpl.java
  14. 93
      ruoyi-system/src/main/resources/mapper/system/TitleTemplateMapper.xml
  15. 50
      ruoyi-ui/src/api/system/titleTemplate.js
  16. 721
      ruoyi-ui/src/views/system/fileManage/index.vue

224
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ChineseNumberFilter.java

@ -0,0 +1,224 @@
package com.ruoyi.web.controller.system;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
public class ChineseNumberFilter {
// 中文数字字符集
private static final String[] CHINESE_DIGITS = {
"零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十",
"百", "千", "万", "亿", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖", "拾"
};
// 阿拉伯数字正则表达式
private static final Pattern ARABIC_DIGITS_PATTERN = Pattern.compile("[0-9]+");
// 中文数字正则表达式
private static final Pattern CHINESE_DIGITS_PATTERN;
static {
// 构建中文数字正则表达式
StringBuilder chinesePatternBuilder = new StringBuilder();
for (String digit : CHINESE_DIGITS) {
chinesePatternBuilder.append(Pattern.quote(digit)).append("|");
}
String chinesePattern = chinesePatternBuilder.substring(0, chinesePatternBuilder.length() - 1);
CHINESE_DIGITS_PATTERN = Pattern.compile("(" + chinesePattern + ")+");
}
/**
* 过滤标题中的中文数字和阿拉伯数字
* @param title 原始标题
* @return 过滤后的标题
*/
public static String filterNumbers(String title) {
if (title == null || title.isEmpty()) {
return title;
}
// 移除阿拉伯数字
String result = removeArabicDigits(title);
// 移除中文数字
result = removeChineseDigits(result);
return result.trim();
}
/**
* 移除阿拉伯数字
*/
private static String removeArabicDigits(String text) {
Matcher matcher = ARABIC_DIGITS_PATTERN.matcher(text);
return matcher.replaceAll("");
}
/**
* 移除中文数字
*/
private static String removeChineseDigits(String text) {
String result = text;
for (String digit : CHINESE_DIGITS) {
result = result.replace(digit, "");
}
return result;
}
/**
* 提取标题中的数字格式保留数字但规范化格式
*/
public static String extractNumberFormat(String title) {
if (title == null || title.isEmpty()) {
return "";
}
// 提取阿拉伯数字
String arabicResult = extractArabicDigits(title);
// 提取中文数字
String chineseResult = extractChineseDigits(title);
return arabicResult + chineseResult;
}
/**
* 提取阿拉伯数字
*/
private static String extractArabicDigits(String text) {
Matcher matcher = ARABIC_DIGITS_PATTERN.matcher(text);
StringBuilder result = new StringBuilder();
while (matcher.find()) {
result.append("[数字]");
}
return result.toString();
}
/**
* 提取中文数字
*/
private static String extractChineseDigits(String text) {
Matcher matcher = CHINESE_DIGITS_PATTERN.matcher(text);
StringBuilder result = new StringBuilder();
while (matcher.find()) {
result.append("[中文数字]");
}
return result.toString();
}
/**
* 比较两个标题的数字格式是否相同
*/
public static boolean compareNumberFormats(String title1, String title2) {
String format1 = extractNumberFormat(title1);
String format2 = extractNumberFormat(title2);
return format1.equals(format2);
}
private static String getFirstNChars(String str, int n) {
if (str == null || n <= 0) {
return "";
}
return str.length() > n ? str.substring(0, n) : str;
}
/**
* 测试方法
*/
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("中文标题数字格式比较工具");
System.out.println("=======================");
String useT = "第1部分 这是一级标题";
String useTFormat = extractNumberFormat(useT);
System.out.println("参考标题: " + useT);
System.out.println("参考标题数字格式: " + useTFormat);
System.out.println("请输入要比较的标题(输入'exit'退出):");
while (true) {
System.out.print("> ");
String input = scanner.nextLine();
if ("exit".equalsIgnoreCase(input)) {
break;
}
String result = filterNumbers(input);
String inputFormat = extractNumberFormat(input);
int aa = input.length();
String useTT = getFirstNChars(useT, aa);
String textResult = filterNumbers(useTT);
// 比较数字格式
boolean formatsMatch = compareNumberFormats(input, useTT);
System.out.println("原始模板标题: " + input);
System.out.println("过滤后模板标题: " + result);
System.out.println("原始标题: " + useTT);
System.out.println("过滤后标题: " + textResult);
System.out.println("检测到的数字格式: " + inputFormat);
System.out.println("与参考格式匹配: " + formatsMatch);
if(result.equals("")){
if (textResult.equals("")){
System.out.println("是一级标题");
}else {
System.out.println("不是");
}
}else {
// 判断是否是一级标题的逻辑
if (result.equals("")) {
if (textResult.equals("")) {
System.out.println("判断: 是一级标题");
} else {
System.out.println("判断: 不是一级标题");
}
} else {
if(textResult.contains(result)){
if (formatsMatch) {
System.out.println("判断: 数字格式匹配,可能是同级标题");
} else {
System.out.println("判断: 数字格式不匹配,不是同级标题");
}
}else {
System.out.println("判断: 不是一级标题");
}
}
}
char lastChar = input.charAt(input.length() - 1);
System.out.println(lastChar);
// 在实际标题中查找这个字符第一次出现的位置
int position = useT.indexOf(lastChar);
if (position == -1) {
// 如果没有找到,返回整个实际标题
System.out.println("没有");
}else {
String content = useT.substring(position + 1).trim();
System.out.println(content);
}
System.out.println();
}
scanner.close();
System.out.println("程序已退出。");
}
}

297
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TitleFormatterController.java

@ -0,0 +1,297 @@
package com.ruoyi.web.controller.system;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.system.domain.TitleTemplate;
import com.ruoyi.system.service.impl.TitleTemplateServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.util.*;
@RestController
@RequestMapping("/system/formatter")
public class TitleFormatterController {
@Autowired
private TitleTemplateServiceImpl titleTemplateService;
@PostMapping
public AjaxResult formatDocument(@RequestParam("file") MultipartFile file,
@RequestParam("template") String templateJson) {
try {
// 解析模板参数
JSONObject templateObj = JSON.parseObject(templateJson);
Long templateType = Long.parseLong(templateObj.getString("id"));
TitleTemplate titleTemplate = titleTemplateService.selectTitleTemplateById(templateType);
if (titleTemplate == null) {
return AjaxResult.error("未找到对应的标题模板");
}
// 检查文件类型
if (!file.getOriginalFilename().endsWith(".docx")) {
return AjaxResult.error("仅支持.docx格式的文档");
}
// 处理文档
Map<String, Object> result = processDocumentWithNumbering(file, titleTemplate);
return AjaxResult.success("文档处理成功", result);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("文档处理失败: " + e.getMessage());
}
}
/**
* 处理文档并添加多级标题编号
*/
private Map<String, Object> processDocumentWithNumbering(MultipartFile file, TitleTemplate titleTemplate)
throws IOException {
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> paragraphsInfo = new ArrayList<>();
// 初始化各级标题计数器
int[] levelCounters = new int[5]; // 0不使用,1-4对应各级标题
Arrays.fill(levelCounters, 0);
try (InputStream inputStream = file.getInputStream();
XWPFDocument document = new XWPFDocument(inputStream)) {
// 获取模板中的标题配置
String firstTitle = titleTemplate.getFirstTitle();
String secondTitle = titleTemplate.getSecondTitle();
String thirdTitle = titleTemplate.getThirdTitle();
String fourthTitle = titleTemplate.getFourthTitle();
System.out.println("=== 开始处理文档 ===");
System.out.println("模板配置: 一级标题='" + firstTitle + "', 二级标题='" + secondTitle +
"', 三级标题='" + thirdTitle + "', 四级标题='" + fourthTitle + "'");
// 遍历文档中的所有段落
List<XWPFParagraph> paragraphs = document.getParagraphs();
for (int i = 0; i < paragraphs.size(); i++) {
XWPFParagraph paragraph = paragraphs.get(i);
// 获取段落文本
String fullText = getParagraphText(paragraph);
if (fullText.isEmpty()) {
continue;
}
System.out.println("\n--- 处理段落 " + (i + 1) + " ---");
System.out.println("完整文本: '" + fullText + "'");
Map<String, Object> paraInfo = new HashMap<>();
paraInfo.put("originalText", fullText);
String numberedText = fullText;
int levelNumber = 0;
String levelName = "正文";
// 检查段落是否包含模板字符串并确定标题级别(精确匹配)
if (isExactTemplateMatch(fullText, firstTitle)) {
levelCounters[1]++;
resetLowerLevels(levelCounters, 1);
numberedText = generateLevelNumber(levelCounters, 1) + " " + extractPureContent(fullText, firstTitle);
levelNumber = 1;
levelName = "一级标题";
setParagraphStyle(paragraph, "Heading1");
System.out.println("识别为一级标题,新编号: " + numberedText);
} else if (isExactTemplateMatch(fullText, secondTitle)) {
levelCounters[2]++;
resetLowerLevels(levelCounters, 2);
numberedText = generateLevelNumber(levelCounters, 2) + " " + extractPureContent(fullText, secondTitle);
levelNumber = 2;
levelName = "二级标题";
setParagraphStyle(paragraph, "Heading2");
System.out.println("识别为二级标题,新编号: " + numberedText);
} else if (isExactTemplateMatch(fullText, thirdTitle)) {
levelCounters[3]++;
resetLowerLevels(levelCounters, 3);
numberedText = generateLevelNumber(levelCounters, 3) + " " + extractPureContent(fullText, thirdTitle);
levelNumber = 3;
levelName = "三级标题";
setParagraphStyle(paragraph, "Heading3");
System.out.println("识别为三级标题,新编号: " + numberedText);
} else if (isExactTemplateMatch(fullText, fourthTitle)) {
levelCounters[4]++;
resetLowerLevels(levelCounters, 4);
numberedText = generateLevelNumber(levelCounters, 4) + " " + extractPureContent(fullText, fourthTitle);
levelNumber = 4;
levelName = "四级标题";
setParagraphStyle(paragraph, "Heading4");
System.out.println("识别为四级标题,新编号: " + numberedText);
} else {
System.out.println("识别为正文");
}
// 设置段落信息
paraInfo.put("level", levelName);
paraInfo.put("levelNumber", levelNumber);
paraInfo.put("numberedText", numberedText);
paragraphsInfo.add(paraInfo);
// 更新段落文本
updateParagraphText(paragraph, numberedText);
}
}
result.put("paragraphs", paragraphsInfo);
result.put("summary", String.format(
"文档处理完成:一级标题%d个,二级标题%d个,三级标题%d个,四级标题%d个",
levelCounters[1], levelCounters[2], levelCounters[3], levelCounters[4]
));
return result;
}
/**
* 精确模板匹配
*/
private boolean isExactTemplateMatch(String text, String template) {
if (text == null || template == null || template.isEmpty()) {
return false;
}
return text.trim().startsWith(template.trim());
}
/**
* 提取纯文本内容
*/
private String extractPureContent(String fullText, String template) {
if (fullText.startsWith(template)) {
return fullText.substring(template.length()).trim();
}
return fullText;
}
/**
* 获取段落文本
*/
private String getParagraphText(XWPFParagraph paragraph) {
StringBuilder textBuilder = new StringBuilder();
for (XWPFRun run : paragraph.getRuns()) {
if (run.getText(0) != null) {
textBuilder.append(run.getText(0));
}
}
return textBuilder.toString().trim();
}
/**
* 生成级别编号
*/
private String generateLevelNumber(int[] levelCounters, int level) {
for (int i = 1; i < levelCounters.length; i++) {
if (levelCounters[i] == 0) {
levelCounters[i] = 1;
}
}
switch (level) {
case 1:
return generateChineseNumber(levelCounters[1]) + "、";
case 2:
return "(" + generateChineseNumber(levelCounters[2]) + ")";
case 3:
return levelCounters[3] + ".";
case 4:
return "(" + levelCounters[4] + ")";
default:
return "";
}
}
/**
* 生成中文数字
*/
private String generateChineseNumber(int number) {
String[] chineseNumbers = {"", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"};
if (number <= 10) {
return chineseNumbers[number];
} else if (number < 20) {
return "十" + (number > 10 ? chineseNumbers[number - 10] : "");
} else if (number < 100) {
int tens = number / 10;
int units = number % 10;
return chineseNumbers[tens] + "十" + (units > 0 ? chineseNumbers[units] : "");
} else {
return String.valueOf(number);
}
}
/**
* 重置下级标题计数器
*/
private void resetLowerLevels(int[] levelCounters, int currentLevel) {
for (int i = currentLevel + 1; i < levelCounters.length; i++) {
levelCounters[i] = 0;
}
}
/**
* 更新段落文本
*/
private void updateParagraphText(XWPFParagraph paragraph, String newText) {
// 清除原有的runs
for (int i = paragraph.getRuns().size() - 1; i >= 0; i--) {
paragraph.removeRun(i);
}
// 创建新的run并设置文本
XWPFRun run = paragraph.createRun();
run.setText(newText);
// 设置字体样式
run.setFontSize(12);
if (paragraph.getStyle() != null && paragraph.getStyle().startsWith("Heading")) {
run.setBold(true);
// 根据标题级别设置不同的字体大小
switch (paragraph.getStyle()) {
case "Heading1":
run.setFontSize(16);
break;
case "Heading2":
run.setFontSize(14);
break;
case "Heading3":
run.setFontSize(13);
break;
case "Heading4":
run.setFontSize(12);
break;
}
}
}
/**
* 设置段落样式
*/
private void setParagraphStyle(XWPFParagraph paragraph, String style) {
paragraph.setStyle(style);
if (style.startsWith("Heading")) {
// 设置不同的缩进
switch (style) {
case "Heading1":
paragraph.setIndentationLeft(0);
break;
case "Heading2":
paragraph.setIndentationLeft(200);
break;
case "Heading3":
paragraph.setIndentationLeft(400);
break;
case "Heading4":
paragraph.setIndentationLeft(600);
break;
}
}
}
}

297
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TitleFormatterControllerCopy.java

@ -0,0 +1,297 @@
package com.ruoyi.web.controller.system;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.system.domain.TitleTemplate;
import com.ruoyi.system.service.impl.TitleTemplateServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.util.*;
@RestController
@RequestMapping("/system/formatterCopy")
public class TitleFormatterControllerCopy {
@Autowired
private TitleTemplateServiceImpl titleTemplateService;
@PostMapping
public AjaxResult formatDocument(@RequestParam("file") MultipartFile file,
@RequestParam("template") String templateJson) {
try {
// 解析模板参数
JSONObject templateObj = JSON.parseObject(templateJson);
Long templateType = Long.parseLong(templateObj.getString("id"));
TitleTemplate titleTemplate = titleTemplateService.selectTitleTemplateById(templateType);
if (titleTemplate == null) {
return AjaxResult.error("未找到对应的标题模板");
}
// 检查文件类型
if (!file.getOriginalFilename().endsWith(".docx")) {
return AjaxResult.error("仅支持.docx格式的文档");
}
// 处理文档
Map<String, Object> result = processDocumentWithNumbering(file, titleTemplate);
return AjaxResult.success("文档处理成功", result);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("文档处理失败: " + e.getMessage());
}
}
/**
* 处理文档并添加多级标题编号
*/
private Map<String, Object> processDocumentWithNumbering(MultipartFile file, TitleTemplate titleTemplate)
throws IOException {
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> paragraphsInfo = new ArrayList<>();
// 初始化各级标题计数器
int[] levelCounters = new int[5]; // 0不使用,1-4对应各级标题
Arrays.fill(levelCounters, 0);
try (InputStream inputStream = file.getInputStream();
XWPFDocument document = new XWPFDocument(inputStream)) {
// 获取模板中的标题配置
String firstTitle = titleTemplate.getFirstTitle();
String secondTitle = titleTemplate.getSecondTitle();
String thirdTitle = titleTemplate.getThirdTitle();
String fourthTitle = titleTemplate.getFourthTitle();
System.out.println("=== 开始处理文档 ===");
System.out.println("模板配置: 一级标题='" + firstTitle + "', 二级标题='" + secondTitle +
"', 三级标题='" + thirdTitle + "', 四级标题='" + fourthTitle + "'");
// 遍历文档中的所有段落
List<XWPFParagraph> paragraphs = document.getParagraphs();
for (int i = 0; i < paragraphs.size(); i++) {
XWPFParagraph paragraph = paragraphs.get(i);
// 获取段落文本
String fullText = getParagraphText(paragraph);
if (fullText.isEmpty()) {
continue;
}
System.out.println("\n--- 处理段落 " + (i + 1) + " ---");
System.out.println("完整文本: '" + fullText + "'");
Map<String, Object> paraInfo = new HashMap<>();
paraInfo.put("originalText", fullText);
String numberedText = fullText;
int levelNumber = 0;
String levelName = "正文";
// 检查段落是否包含模板字符串并确定标题级别(精确匹配)
if (isExactTemplateMatch(fullText, firstTitle)) {
levelCounters[1]++;
resetLowerLevels(levelCounters, 1);
numberedText = generateLevelNumber(levelCounters, 1) + " " + extractPureContent(fullText, firstTitle);
levelNumber = 1;
levelName = "一级标题";
setParagraphStyle(paragraph, "Heading1");
System.out.println("识别为一级标题,新编号: " + numberedText);
} else if (isExactTemplateMatch(fullText, secondTitle)) {
levelCounters[2]++;
resetLowerLevels(levelCounters, 2);
numberedText = generateLevelNumber(levelCounters, 2) + " " + extractPureContent(fullText, secondTitle);
levelNumber = 2;
levelName = "二级标题";
setParagraphStyle(paragraph, "Heading2");
System.out.println("识别为二级标题,新编号: " + numberedText);
} else if (isExactTemplateMatch(fullText, thirdTitle)) {
levelCounters[3]++;
resetLowerLevels(levelCounters, 3);
numberedText = generateLevelNumber(levelCounters, 3) + " " + extractPureContent(fullText, thirdTitle);
levelNumber = 3;
levelName = "三级标题";
setParagraphStyle(paragraph, "Heading3");
System.out.println("识别为三级标题,新编号: " + numberedText);
} else if (isExactTemplateMatch(fullText, fourthTitle)) {
levelCounters[4]++;
resetLowerLevels(levelCounters, 4);
numberedText = generateLevelNumber(levelCounters, 4) + " " + extractPureContent(fullText, fourthTitle);
levelNumber = 4;
levelName = "四级标题";
setParagraphStyle(paragraph, "Heading4");
System.out.println("识别为四级标题,新编号: " + numberedText);
} else {
System.out.println("识别为正文");
}
// 设置段落信息
paraInfo.put("level", levelName);
paraInfo.put("levelNumber", levelNumber);
paraInfo.put("numberedText", numberedText);
paragraphsInfo.add(paraInfo);
// 更新段落文本
updateParagraphText(paragraph, numberedText);
}
}
result.put("paragraphs", paragraphsInfo);
result.put("summary", String.format(
"文档处理完成:一级标题%d个,二级标题%d个,三级标题%d个,四级标题%d个",
levelCounters[1], levelCounters[2], levelCounters[3], levelCounters[4]
));
return result;
}
/**
* 精确模板匹配
*/
private boolean isExactTemplateMatch(String text, String template) {
if (text == null || template == null || template.isEmpty()) {
return false;
}
return text.trim().startsWith(template.trim());
}
/**
* 提取纯文本内容
*/
private String extractPureContent(String fullText, String template) {
if (fullText.startsWith(template)) {
return fullText.substring(template.length()).trim();
}
return fullText;
}
/**
* 获取段落文本
*/
private String getParagraphText(XWPFParagraph paragraph) {
StringBuilder textBuilder = new StringBuilder();
for (XWPFRun run : paragraph.getRuns()) {
if (run.getText(0) != null) {
textBuilder.append(run.getText(0));
}
}
return textBuilder.toString().trim();
}
/**
* 生成级别编号
*/
private String generateLevelNumber(int[] levelCounters, int level) {
for (int i = 1; i < levelCounters.length; i++) {
if (levelCounters[i] == 0) {
levelCounters[i] = 1;
}
}
switch (level) {
case 1:
return generateChineseNumber(levelCounters[1]) + "、";
case 2:
return "(" + generateChineseNumber(levelCounters[2]) + ")";
case 3:
return levelCounters[3] + ".";
case 4:
return "(" + levelCounters[4] + ")";
default:
return "";
}
}
/**
* 生成中文数字
*/
private String generateChineseNumber(int number) {
String[] chineseNumbers = {"", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"};
if (number <= 10) {
return chineseNumbers[number];
} else if (number < 20) {
return "十" + (number > 10 ? chineseNumbers[number - 10] : "");
} else if (number < 100) {
int tens = number / 10;
int units = number % 10;
return chineseNumbers[tens] + "十" + (units > 0 ? chineseNumbers[units] : "");
} else {
return String.valueOf(number);
}
}
/**
* 重置下级标题计数器
*/
private void resetLowerLevels(int[] levelCounters, int currentLevel) {
for (int i = currentLevel + 1; i < levelCounters.length; i++) {
levelCounters[i] = 0;
}
}
/**
* 更新段落文本
*/
private void updateParagraphText(XWPFParagraph paragraph, String newText) {
// 清除原有的runs
for (int i = paragraph.getRuns().size() - 1; i >= 0; i--) {
paragraph.removeRun(i);
}
// 创建新的run并设置文本
XWPFRun run = paragraph.createRun();
run.setText(newText);
// 设置字体样式
run.setFontSize(12);
if (paragraph.getStyle() != null && paragraph.getStyle().startsWith("Heading")) {
run.setBold(true);
// 根据标题级别设置不同的字体大小
switch (paragraph.getStyle()) {
case "Heading1":
run.setFontSize(16);
break;
case "Heading2":
run.setFontSize(14);
break;
case "Heading3":
run.setFontSize(13);
break;
case "Heading4":
run.setFontSize(12);
break;
}
}
}
/**
* 设置段落样式
*/
private void setParagraphStyle(XWPFParagraph paragraph, String style) {
paragraph.setStyle(style);
if (style.startsWith("Heading")) {
// 设置不同的缩进
switch (style) {
case "Heading1":
paragraph.setIndentationLeft(0);
break;
case "Heading2":
paragraph.setIndentationLeft(200);
break;
case "Heading3":
paragraph.setIndentationLeft(400);
break;
case "Heading4":
paragraph.setIndentationLeft(600);
break;
}
}
}
}

64
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TitleTemplateController.java

@ -0,0 +1,64 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.domain.TitleTemplate;
import com.ruoyi.system.service.ITitleTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
@RestController
@RequestMapping("/system/template")
public class TitleTemplateController extends BaseController
{
@Autowired
private ITitleTemplateService titleTemplateService;
@GetMapping("/list")
public List<TitleTemplate> list(TitleTemplate titleTemplate)
{
List<TitleTemplate> list = titleTemplateService.selectTitleTemplateList(titleTemplate);
return list;
}
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(titleTemplateService.selectTitleTemplateById(id));
}
@PostMapping
public AjaxResult add(@RequestBody TitleTemplate titleTemplate)
{
return toAjax(titleTemplateService.insertTitleTemplate(titleTemplate));
}
@PutMapping
public AjaxResult edit(@RequestBody TitleTemplate titleTemplate)
{
return toAjax(titleTemplateService.updateTitleTemplate(titleTemplate));
}
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id)
{
return toAjax(titleTemplateService.deleteTitleTemplateById(id));
}
}

72
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java

@ -10,15 +10,13 @@ import com.ruoyi.common.utils.Neo4jUtil;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.system.domain.ZhyArticle;
import com.ruoyi.system.domain.ZhyDoc;
import com.ruoyi.system.domain.ZhyDocRelation;
import com.ruoyi.system.domain.ZhyFileManage;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.mapper.Test1Mapper;
import com.ruoyi.system.mapper.ZhyArticleMapper;
import com.ruoyi.system.mapper.ZhyDocRelationMapper;
import com.ruoyi.system.service.impl.LuceneUtil;
import com.ruoyi.system.service.impl.ZhyFileManageServiceImpl;
import lombok.Data;
import org.apache.poi.util.Units;
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
@ -97,45 +95,25 @@ public class ZhyFileManageController extends BaseController {
util.exportExcel(response, list, "用户数据");
}
@PostMapping("/addFile")
public AjaxResult addFile(MultipartFile file) throws IOException {
String url = saveFileWithStructure(file);
FileInputStream fileInputStream = new FileInputStream(url + "\\" + file.getOriginalFilename());
ZhyFileManage zhyFileManage = new ZhyFileManage();
zhyFileManage.setCreateTime(new Date());
zhyFileManage.setFileName(file.getOriginalFilename());
zhyFileManage.setFileUrl(url + "\\" + file.getOriginalFilename());
zhyFileManage.setIsShow("0");
zhyFileManage.setIsDelete("0");
zhyFileManage.setCreateBy(getUserId());
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在保存原文件");
zhyFileManageService.insertFile(zhyFileManage);
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在解析分词");
zhyFileManageService.wordSplitter(fileInputStream, url + "\\wordSplitter", zhyFileManage.getId(),null);
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在创建索引");
zhyFileManageService.createIndex(url + "\\wordSplitter", "D:\\project\\gyx\\tupudata\\fileManager\\index");
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在建立关系");
zhyFileManageService.getRelationShip(zhyFileManage.getId());
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在创建图谱");
zhyFileManageService.createGraph();
return AjaxResult.success().put("msg", "成功");
}
@PostMapping("/addFile1")
public AjaxResult addFile1(MultipartFile file) throws IOException {
String url = saveFileWithStructure(file);
FileInputStream fileInputStream = new FileInputStream(url + "\\" + file.getOriginalFilename());
@PostMapping("/addFile")
public AjaxResult addFile(FileUploadDTO fileInfo) throws IOException {
System.out.println(fileInfo.getTitleInfo());
System.out.println(fileInfo.getFirstTitle());
String url = saveFileWithStructure(fileInfo.getFile());
FileInputStream fileInputStream = new FileInputStream(url + "\\" + fileInfo.getFile().getOriginalFilename());
ZhyFileManage zhyFileManage = new ZhyFileManage();
zhyFileManage.setCreateTime(new Date());
zhyFileManage.setFileName(file.getOriginalFilename());
zhyFileManage.setFileUrl(url + "\\" + file.getOriginalFilename());
zhyFileManage.setFileName(fileInfo.getFile().getOriginalFilename());
zhyFileManage.setFileUrl(url + "\\" + fileInfo.getFile().getOriginalFilename());
zhyFileManage.setIsShow("0");
zhyFileManage.setIsDelete("0");
zhyFileManage.setCreateBy(getUserId());
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在保存原文件");
zhyFileManageService.insertFile(zhyFileManage);
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在解析分词");
zhyFileManageService.wordSplitter(fileInputStream, url + "\\wordSplitter", zhyFileManage.getId(),null);
zhyFileManageService.wordSplitter(fileInputStream, url + "\\wordSplitter", zhyFileManage.getId(),null,fileInfo);
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在创建索引");
zhyFileManageService.createIndex(url + "\\wordSplitter", "D:\\project\\gyx\\tupudata\\fileManager\\index");
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在建立关系");
@ -145,6 +123,30 @@ public class ZhyFileManageController extends BaseController {
return AjaxResult.success().put("msg", "成功");
}
// @PostMapping("/addFile1")
// public AjaxResult addFile1(MultipartFile file) throws IOException {
// String url = saveFileWithStructure(file);
// FileInputStream fileInputStream = new FileInputStream(url + "\\" + file.getOriginalFilename());
// ZhyFileManage zhyFileManage = new ZhyFileManage();
// zhyFileManage.setCreateTime(new Date());
// zhyFileManage.setFileName(file.getOriginalFilename());
// zhyFileManage.setFileUrl(url + "\\" + file.getOriginalFilename());
// zhyFileManage.setIsShow("0");
// zhyFileManage.setIsDelete("0");
// zhyFileManage.setCreateBy(getUserId());
// webSocket.sendOneMessage(String.valueOf(getUserId()), "正在保存原文件");
// zhyFileManageService.insertFile(zhyFileManage);
// webSocket.sendOneMessage(String.valueOf(getUserId()), "正在解析分词");
// zhyFileManageService.wordSplitter(fileInputStream, url + "\\wordSplitter", zhyFileManage.getId(),null);
// webSocket.sendOneMessage(String.valueOf(getUserId()), "正在创建索引");
// zhyFileManageService.createIndex(url + "\\wordSplitter", "D:\\project\\gyx\\tupudata\\fileManager\\index");
// webSocket.sendOneMessage(String.valueOf(getUserId()), "正在建立关系");
// zhyFileManageService.getRelationShip(zhyFileManage.getId());
// webSocket.sendOneMessage(String.valueOf(getUserId()), "正在创建图谱");
// zhyFileManageService.createGraph();
//
// return AjaxResult.success().put("msg", "成功");
// }
@PostMapping("/insertRelationByFile")
public AjaxResult insertRelationByFile(MultipartFile file) throws IOException {
@ -675,7 +677,7 @@ public class ZhyFileManageController extends BaseController {
}
}
zhyFileManageService.wordSplitter(null , url +"\\wordSplitter", 0,list);
zhyFileManageService.wordSplitterOld(null , url +"\\wordSplitter", 0,list);
zhyFileManageService.createIndex(url + "\\wordSplitter", "D:\\project\\gyx\\tupudata\\fileManager\\index");
test1Mapper.updateParentId(list);

90
ruoyi-system/src/main/java/com/ruoyi/system/domain/FileUploadDTO.java

@ -0,0 +1,90 @@
package com.ruoyi.system.domain;
import org.springframework.web.multipart.MultipartFile;
public class FileUploadDTO {
private MultipartFile file;
private TitleTemplate titleInfo;
private String firstTitle;
private String secondTitle;
private String thirdTitle;
private String fourthTitle;
private String fiveTitle;
private String sixTitle;
private String sevenTitle;
public MultipartFile getFile() {
return file;
}
public void setFile(MultipartFile file) {
this.file = file;
}
public TitleTemplate getTitleInfo() {
return titleInfo;
}
public void setTitleInfo(TitleTemplate titleInfo) {
this.titleInfo = titleInfo;
}
public String getFirstTitle() {
return firstTitle;
}
public void setFirstTitle(String firstTitle) {
this.firstTitle = firstTitle;
}
public String getSecondTitle() {
return secondTitle;
}
public void setSecondTitle(String secondTitle) {
this.secondTitle = secondTitle;
}
public String getThirdTitle() {
return thirdTitle;
}
public void setThirdTitle(String thirdTitle) {
this.thirdTitle = thirdTitle;
}
public String getFourthTitle() {
return fourthTitle;
}
public void setFourthTitle(String fourthTitle) {
this.fourthTitle = fourthTitle;
}
public String getFiveTitle() {
return fiveTitle;
}
public void setFiveTitle(String fiveTitle) {
this.fiveTitle = fiveTitle;
}
public String getSixTitle() {
return sixTitle;
}
public void setSixTitle(String sixTitle) {
this.sixTitle = sixTitle;
}
public String getSevenTitle() {
return sevenTitle;
}
public void setSevenTitle(String sevenTitle) {
this.sevenTitle = sevenTitle;
}
}

100
ruoyi-system/src/main/java/com/ruoyi/system/domain/TitleTemplate.java

@ -0,0 +1,100 @@
package com.ruoyi.system.domain;
public class TitleTemplate {
private String name;
private Long id;
private String firstTitle;
private String secondTitle;
private String thirdTitle;
private String fourthTitle;
private String fiveTitle;
private String sixTitle;
private String sevenTitle;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFirstTitle() {
return firstTitle;
}
public void setFirstTitle(String firstTitle) {
this.firstTitle = firstTitle;
}
public String getSecondTitle() {
return secondTitle;
}
public void setSecondTitle(String secondTitle) {
this.secondTitle = secondTitle;
}
public String getThirdTitle() {
return thirdTitle;
}
public void setThirdTitle(String thirdTitle) {
this.thirdTitle = thirdTitle;
}
public String getFourthTitle() {
return fourthTitle;
}
public void setFourthTitle(String fourthTitle) {
this.fourthTitle = fourthTitle;
}
public String getFiveTitle() {
return fiveTitle;
}
public void setFiveTitle(String fiveTitle) {
this.fiveTitle = fiveTitle;
}
public String getSixTitle() {
return sixTitle;
}
public void setSixTitle(String sixTitle) {
this.sixTitle = sixTitle;
}
public String getSevenTitle() {
return sevenTitle;
}
public void setSevenTitle(String sevenTitle) {
this.sevenTitle = sevenTitle;
}
@Override
public String toString() {
return "TitleTemplate{" +
"name='" + name + '\'' +
", id=" + id +
", firstTitle='" + firstTitle + '\'' +
", secondTitle='" + secondTitle + '\'' +
", thirdTitle='" + thirdTitle + '\'' +
", fourthTitle='" + fourthTitle + '\'' +
", fiveTitle='" + fiveTitle + '\'' +
", sixTitle='" + sixTitle + '\'' +
", sevenTitle='" + sevenTitle + '\'' +
'}';
}
}

26
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TitleTemplateMapper.java

@ -0,0 +1,26 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.TitleTemplate;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TitleTemplateMapper
{
public TitleTemplate selectTitleTemplateById(Long id);
public List<TitleTemplate> selectTitleTemplateList(TitleTemplate titleTemplate);
public int insertTitleTemplate(TitleTemplate titleTemplate);
public int updateTitleTemplate(TitleTemplate titleTemplate);
public int deleteTitleTemplateById(Long id);
}

23
ruoyi-system/src/main/java/com/ruoyi/system/service/ITitleTemplateService.java

@ -0,0 +1,23 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.TitleTemplate;
import java.util.List;
public interface ITitleTemplateService
{
public TitleTemplate selectTitleTemplateById(Long id);
public List<TitleTemplate> selectTitleTemplateList(TitleTemplate titleTemplate);
public int insertTitleTemplate(TitleTemplate titleTemplate);
public int updateTitleTemplate(TitleTemplate titleTemplate);
public int deleteTitleTemplateById(Long id);
}

2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LuceneUtil.java

@ -547,7 +547,7 @@ public class LuceneUtil {
String url = doc.get("url");
String snippet = null;
String snippet1 = null;
Map ttt = wordSplitter.startsWithHeading1(id);
Map ttt = wordSplitter.startsWithHeadingOld(id);
try {
snippet = highlighter.getBestFragment(new IKAnalyzer(true), "content", text);
snippet1 = highlighter.getBestFragment(new IKAnalyzer(true), "id", String.valueOf(ttt.get("title")));

50
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TitleTemplateServiceImpl.java

@ -0,0 +1,50 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.TitleTemplate;
import com.ruoyi.system.mapper.TitleTemplateMapper;
import com.ruoyi.system.service.ITitleTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TitleTemplateServiceImpl implements ITitleTemplateService
{
@Autowired
private TitleTemplateMapper titleTemplateMapper;
@Override
public TitleTemplate selectTitleTemplateById(Long id)
{
return titleTemplateMapper.selectTitleTemplateById(id);
}
@Override
public List<TitleTemplate> selectTitleTemplateList(TitleTemplate titleTemplate)
{
return titleTemplateMapper.selectTitleTemplateList(titleTemplate);
}
@Override
public int insertTitleTemplate(TitleTemplate titleTemplate)
{
return titleTemplateMapper.insertTitleTemplate(titleTemplate);
}
@Override
public int updateTitleTemplate(TitleTemplate titleTemplate)
{
return titleTemplateMapper.updateTitleTemplate(titleTemplate);
}
@Override
public int deleteTitleTemplateById(Long id)
{
return titleTemplateMapper.deleteTitleTemplateById(id);
}
}

952
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WordSplitter.java

File diff suppressed because it is too large

34
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZhyFileManageServiceImpl.java

@ -43,10 +43,10 @@ public class ZhyFileManageServiceImpl {
@Autowired
Test1Mapper test1Mapper;
public String wordSplitter(FileInputStream file,String url,Integer fileId,List<ZhyDoc> list){
public String wordSplitter(FileInputStream file,String url,Integer fileId,List<ZhyDoc> list,FileUploadDTO fileUploadDTO){
try {
if(file!=null){
wordSplitter.testWordOne(file,url,fileId);
wordSplitter.testWordOne(file,url,fileId,fileUploadDTO);
}else{
wordSplitter.handWord(url,list);
}
@ -57,9 +57,13 @@ public class ZhyFileManageServiceImpl {
return "b";
}
public String wordSplitterBattle(FileInputStream file,String url,Integer fileId){
public String wordSplitterOld(FileInputStream file,String url,Integer fileId,List<ZhyDoc> list){
try {
wordSplitter.testWordBattle(file,url,fileId);
if(file!=null){
wordSplitter.testWordOneOld(file,url,fileId);
}else{
wordSplitter.handWord(url,list);
}
return "a";
} catch (Exception e) {
e.printStackTrace();
@ -67,26 +71,12 @@ public class ZhyFileManageServiceImpl {
return "b";
}
// public String wordSplitterAdd(FileInputStream file,String url,Integer fileId,List<Map> list){
// try {
// wordSplitter.testWordOneAdd(file,url,fileId,list);
// return "a";
// } catch (Exception e) {
// e.printStackTrace();
// }
// return "b";
// }
public String wordSplitterBattleAdd(FileInputStream file,String url,Integer fileId,List<Map> list){
try {
wordSplitter.testWordBattleAdd(file,url,fileId,list);
return "a";
} catch (Exception e) {
e.printStackTrace();
}
return "b";
}

93
ruoyi-system/src/main/resources/mapper/system/TitleTemplateMapper.xml

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.TitleTemplateMapper">
<resultMap type="TitleTemplate" id="TitleTemplateResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="firstTitle" column="first_title" />
<result property="secondTitle" column="second_title" />
<result property="thirdTitle" column="third_title" />
<result property="fourthTitle" column="fourth_title" />
<result property="fiveTitle" column="five_title" />
<result property="sixTitle" column="six_title" />
<result property="sevenTitle" column="seven_title" />
</resultMap>
<sql id="selectTitleTemplateVo">
select id, name, first_title, second_title, third_title, fourth_title,five_title,six_title,seven_title from title_template
</sql>
<select id="selectTitleTemplateList" parameterType="TitleTemplate" resultMap="TitleTemplateResult">
<include refid="selectTitleTemplateVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="firstTitle != null and firstTitle != ''"> and first_title = #{firstTitle}</if>
<if test="secondTitle != null and secondTitle != ''"> and second_title = #{secondTitle}</if>
<if test="thirdTitle != null and thirdTitle != ''"> and third_title = #{thirdTitle}</if>
<if test="fourthTitle != null and fourthTitle != ''"> and fourth_title = #{fourthTitle}</if>
<if test="fiveTitle != null and fiveTitle != ''"> and five_title = #{fiveTitle}</if>
<if test="sixTitle != null and sixTitle != ''"> and six_title = #{sixTitle}</if>
<if test="sevenTitle != null and sevenTitle != ''"> and seven_title = #{sevenTitle}</if>
</where>
</select>
<select id="selectTitleTemplateById" parameterType="Long" resultMap="TitleTemplateResult">
<include refid="selectTitleTemplateVo"/>
where id = #{id}
</select>
<insert id="insertTitleTemplate" parameterType="TitleTemplate">
insert into title_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="firstTitle != null">first_title,</if>
<if test="secondTitle != null">second_title,</if>
<if test="thirdTitle != null">third_title,</if>
<if test="fourthTitle != null">fourth_title,</if>
<if test="fiveTitle != null">five_title,</if>
<if test="sixTitle != null">six_title,</if>
<if test="sevenTitle != null">seven_title,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="firstTitle != null">#{firstTitle},</if>
<if test="secondTitle != null">#{secondTitle},</if>
<if test="thirdTitle != null">#{thirdTitle},</if>
<if test="fourthTitle != null">#{fourthTitle},</if>
<if test="fiveTitle != null">#{fiveTitle},</if>
<if test="sixTitle != null">#{sixTitle},</if>
<if test="sevenTitle != null">#{sevenTitle},</if>
</trim>
</insert>
<update id="updateTitleTemplate" parameterType="TitleTemplate">
update title_template
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="firstTitle != null">first_title = #{firstTitle},</if>
<if test="secondTitle != null">second_title = #{secondTitle},</if>
<if test="thirdTitle != null">third_title = #{thirdTitle},</if>
<if test="fourthTitle != null">fourth_title = #{fourthTitle},</if>
<if test="fiveTitle != null">five_title = #{fiveTitle},</if>
<if test="sixTitle != null">six_title = #{sixTitle},</if>
<if test="sevenTitle != null">seven_title = #{sevenTitle},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTitleTemplateById" parameterType="Long">
delete from title_template where id = #{id}
</delete>
<delete id="deleteTitleTemplateByIds" parameterType="String">
delete from title_template where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

50
ruoyi-ui/src/api/system/titleTemplate.js

@ -0,0 +1,50 @@
import request from '@/utils/request'
export function listTemplate(query) {
return request({
url: '/system/template/list',
method: 'get',
params: query
})
}
export function getTemplate(id) {
return request({
url: '/system/template/' + id,
method: 'get'
})
}
export function addTemplate(data) {
return request({
url: '/system/template',
method: 'post',
data: data
})
}
export function updateTemplate(data) {
return request({
url: '/system/template',
method: 'put',
data: data
})
}
export function delTemplate(id) {
return request({
url: '/system/template/' + id,
method: 'delete'
})
}
export function titleFormatter(formData) {
return request({
url: '/system/formatter',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data' // 必须设置这个
},
data: formData // 必须是 FormData 对象
})
}

721
ruoyi-ui/src/views/system/fileManage/index.vue

@ -1,13 +1,10 @@
<template>
<div>
<div class="loading-container"></div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px" style="margin-top: 20px;">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px"
style="margin-top: 20px;">
<el-form-item label="知识点名称" prop="relationship">
<el-input
v-model="queryParams.docTitle"
placeholder="请输入知识点名称"
clearable
/>
<el-input v-model="queryParams.docTitle" placeholder="请输入知识点名称" clearable/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@ -15,74 +12,22 @@
</el-form>
<div style="display: flex;">
<el-button
type="primary"
plain
style="float: left;margin-left: 2vw"
icon="el-icon-plus"
size="mini"
@click="openAddTxt(0)"
>新增
<el-button type="primary" plain style="float: left;margin-left: 2vw" icon="el-icon-plus" size="mini"
@click="openAddTxt(0)">新增
</el-button>
<el-button
type="success"
plain
style="float: left"
icon="el-icon-refresh"
size="mini"
@click="reset"
>重置
<el-button type="success" plain style="float: left" icon="el-icon-refresh" size="mini" @click="reset">重置
</el-button>
<el-button
type="info"
plain
style="float: left"
icon="el-icon-upload2"
size="mini"
@click="handleImport"
>导入
<el-button type="info" plain style="float: left" icon="el-icon-upload2" size="mini" @click="handleImport">导入
</el-button>
<el-button
type="info"
plain
style="float: left"
icon="el-icon-upload2"
size="mini"
@click="handleImportRelation"
>导入文献
<el-button type="info" plain style="float: left" icon="el-icon-upload2" size="mini"
@click="handleImportRelation">导入文献
</el-button>
<!-- <el-button-->
<!-- type="info"-->
<!-- style="float: left"-->
<!-- plain-->
<!-- icon="el-icon-upload2"-->
<!-- size="mini"-->
<!-- @click="handleImport1"-->
<!-- >导入补充-->
<!-- </el-button>-->
<el-button
type="primary"
style="float: left"
plain
icon="el-icon-download"
size="mini"
@click="exportAllContent">
<el-button type="primary" style="float: left" plain icon="el-icon-download" size="mini" @click="exportAllContent">
导出
</el-button>
<!-- <el-button-->
<!-- type="warning"-->
<!-- style="float: left"-->
<!-- plain-->
<!-- size="mini"-->
<!-- @click="openAllList"-->
<!-- >历史文件下载-->
<!-- </el-button>-->
<!-- <el-button type="primary" plain style="float: left" size="mini" >-->
<!-- <div>-->
<!-- <a href="/file/gyxtq.docx" download="高影响天气知识模板">模板下载</a>-->
<!-- </div>-->
<!-- </el-button>-->
<el-button type="warning" plain style="float: left" size="mini" @click="exportList">
导出表格
</el-button>
@ -94,22 +39,15 @@
<!-- 删除指定实体-->
<!-- </el-button>-->
<div style="color: red; float: left;margin-left: 5vw;font-size: 12px;display: flex;align-items: center;">是否可以下载
<el-switch
v-model="value"
style="margin-left: 1vw;"
active-color="#13ce66"
inactive-color="#ff4949"
@change="updateInfo"
>
</el-switch></div>
<el-switch v-model="value" style="margin-left: 1vw;" active-color="#13ce66" inactive-color="#ff4949"
@change="updateInfo">
</el-switch>
</div>
</div>
<el-dialog title="删除指定实体" :visible.sync="opendeletOly" width="800px" append-to-body>
<el-input
placeholder="请输入内容"
v-model="deleteWord"
clearable>
<el-input placeholder="请输入内容" v-model="deleteWord" clearable>
</el-input>
<el-button type="danger" plain style="float: left" size="mini" @click="deleteOnly">删除</el-button>
@ -117,17 +55,15 @@
<el-dialog title="历史文件" :visible.sync="openList" width="800px" append-to-body>
<el-table
:data="fileAllList"
style="width: 100%;margin-top: 2vw;"
:header-cell-style="{'text-align':'center'}"
:cell-style="{'text-align':'center'}"
>
<el-table :data="fileAllList" style="width: 100%;margin-top: 2vw;" :header-cell-style="{ 'text-align': 'center' }"
:cell-style="{ 'text-align': 'center' }">
<el-table-column prop="id" label="序号"></el-table-column>
<el-table-column prop="fileName" label="文件名称"></el-table-column>
<el-table-column prop="docLevel" label="操作">
<template slot-scope="scope">
<el-button style="font-size: 0.8vw;" type="text" @click="downLoadFile(scope.row.fileUrl,scope.row.fileName)">下载</el-button>
<el-button style="font-size: 0.8vw;" type="text"
@click="downLoadFile(scope.row.fileUrl, scope.row.fileName)">下载
</el-button>
</template>
</el-table-column>
@ -135,18 +71,11 @@
</el-dialog>
<el-table
:data="fileList"
row-key="id"
:expand-on-click-node="false"
:tree-props="{children: 'level2', hasChildren: true}"
style="width: 100%;margin-top: 2vw;"
:header-cell-style="{'text-align':'center'}"
:cell-style="{'text-align':'center'}"
<el-table :data="fileList" row-key="id" :expand-on-click-node="false"
:tree-props="{ children: 'level2', hasChildren: true }" style="width: 100%;margin-top: 2vw;"
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
v-loading="loading"
element-loading-text="重置数据中"
>
element-loading-text="重置数据中">
<el-table-column prop="id" label="序号"></el-table-column>
<el-table-column prop="docTitle" label="标题"></el-table-column>
<el-table-column prop="docLevel" label="关系层级"></el-table-column>
@ -174,20 +103,123 @@
</el-table-column>
</el-table>
<!-- 模板选择对话框 -->
<el-dialog :title="templateDialog.title" :visible.sync="templateDialog.visible" width="900px" append-to-body>
<div class="template-selection">
<el-button type="primary" size="small" @click="createNewTemplate" style="font-size: 0.8vw;">
新增模板
</el-button>
<div class="section-title" style="font-size: 1vw;margin-top: 0.5vw;">可用模板</div>
<div class="section">
<div class="template-list" style="margin-top: 0.7vw;">
<el-table
:data="templates"
style="width: 100%">
<el-table-column
prop="name"
label="名称"
width="180">
</el-table-column>
<el-table-column
prop="options"
label="操作">
<template slot-scope="scope">
<el-button size="mini" @click.stop="selectTemplate(scope.row)">选择</el-button>
<el-button size="mini" @click.stop="handleDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div class="preview-panel" v-if="selectedTemplate">
<div class="preview-title" style="font-size: 1vw;margin-top: 0.8vw;">当前选中模板预览:
{{ selectedTemplate.name }}
</div>
<div class="preview-content" style="margin-top: 0.8vw;">
<el-form :inline="true" label-position="right" label-width="80px" :model="selectedTemplate">
<el-form-item label="一级标题">
<el-input v-model="selectedTemplate.firstTitle"></el-input>
</el-form-item>
<el-form-item label="五级标题">
<el-input v-model="selectedTemplate.fiveTitle"></el-input>
</el-form-item>
<el-form-item label="二级标题">
<el-input v-model="selectedTemplate.secondTitle"></el-input>
</el-form-item>
<el-form-item label="六级标题">
<el-input v-model="selectedTemplate.sixTitle"></el-input>
</el-form-item>
<el-form-item label="三级标题">
<el-input v-model="selectedTemplate.thirdTitle"></el-input>
</el-form-item>
<el-form-item label="七级标题">
<el-input v-model="selectedTemplate.sevenTitle"></el-input>
</el-form-item>
<el-form-item label="四级标题">
<el-input v-model="selectedTemplate.fourthTitle"></el-input>
</el-form-item>
</el-form>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="templateDialog.visible = false">取消</el-button>
<el-button type="primary" :disabled="!selectedTemplate" @click="confirmTemplate">
确认
</el-button>
</div>
</el-dialog>
<!-- 模板编辑器对话框 -->
<el-dialog title='创建新模板' :visible.sync="templateEditor.visible" width="700px" append-to-body>
<el-form :model="templateEditor.form" label-width="100px" :rules="templateRules" ref="templateForm">
<el-form-item label="模板名称" prop="name">
<el-input v-model="templateEditor.form.name" placeholder="请输入模板名称" maxlength="20"
show-word-limit></el-input>
</el-form-item>
<el-divider>标题样式设置</el-divider>
<el-form-item v-for="level in levels" :key="level.key" :label="level.label">
<el-input v-model="templateEditor.form[level.key]" @change="handleSelected()"/>
<!-- <el-select v-model="templateEditor.form[level.key]" style="width: 100%"-->
<!-- :placeholder="`请选择${level.label}样式`"-->
<!-- @change="handleSelected()">-->
<!-- <el-option v-for="option in titleOptions" :key="option.value" :label="option.label" :value="option.value">-->
<!-- <span style="float: left">{{ option.label }}</span>-->
<!-- &lt;!&ndash; <span style="float: right; color: #8492a6; font-size: 13px">-->
<!-- <i :class="option.icon" style="margin-right: 5px;"></i>-->
<!-- {{ option.desc }}-->
<!-- </span> &ndash;&gt;-->
<!-- </el-option>-->
<!-- </el-select>-->
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCancle">取消</el-button>
<el-button type="primary" @click="saveTemplate">保存</el-button>
</div>
</el-dialog>
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".doc, .docx,.csv"
<el-upload ref="upload" :limit="1" accept=".doc, .docx,.csv"
:headers="upload.headers"
:action="upload.url"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
:data="selectedTemplate"
drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
@ -200,24 +232,12 @@
<el-button :disabled="oprnIno" @click="upload.open = false"> </el-button>
</div>
</el-dialog>
<el-dialog
:title="upload1.title"
:visible.sync="upload1.open"
width="400px"
append-to-body
>
<el-upload
ref="uploadR"
:limit="1"
accept=".csv"
:headers="upload1.headers"
:action="upload1.url"
:disabled="upload1.isUploading"
:on-progress="handleFileUploadProgressRelation"
:on-success="handleFileSuccessRelation"
:auto-upload="false"
drag
>
<el-dialog :title="upload1.title" :visible.sync="upload1.open" width="400px" append-to-body>
<el-upload ref="uploadR" :limit="1" accept=".csv" :headers="upload1.headers" :action="upload1.url"
:disabled="upload1.isUploading" :on-progress="handleFileUploadProgressRelation"
:on-success="handleFileSuccessRelation" :auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text"> CSV 文件拖到此处 <em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
@ -235,19 +255,10 @@
<!-- 用户导入补充数据对话框 -->
<el-dialog title="补充数据导入" :visible.sync="uploadAdd.open" width="400px" append-to-body>
<el-upload
ref="upload1"
:limit="1"
accept=".doc, .docx"
:headers="uploadAdd.headers"
:action="uploadAdd.url"
:disabled="uploadAdd.isUploading"
:on-progress="handleFileUploadProgress1"
<el-upload ref="upload1" :limit="1" accept=".doc, .docx" :headers="uploadAdd.headers" :action="uploadAdd.url"
:disabled="uploadAdd.isUploading" :on-progress="handleFileUploadProgress1"
:on-success="handleFileSuccess1"
:auto-upload="false"
:data="{parentId:parentId,relation:relaTion}"
drag
>
:auto-upload="false" :data="{ parentId: parentId, relation: relaTion }" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
@ -271,7 +282,6 @@
<el-button :disabled="oprnIno1" @click="uploadAdd.open = false"> </el-button>
</div>
</el-dialog>
<el-dialog title="修改知识点" :visible.sync="editTxt" width="800px" append-to-body>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item style="position: relative ;" label="知识标题">
@ -294,11 +304,7 @@
<el-form-item style="position: relative ;" label="上级知识">
<el-select filterable v-model="parentId1" label="选择上级文章" @change="selectChanged">
<el-option
v-for="item in parentDocList"
:key="item.id"
:label="item.docTitle"
:value="item.id">
<el-option v-for="item in parentDocList" :key="item.id" :label="item.docTitle" :value="item.id">
</el-option>
</el-select>
@ -311,67 +317,43 @@
<el-form-item label="上传视频" prop="courseUrl">
<el-upload
class="avatar-uploader el-upload--text"
multiple
:headers="videoUpload.headers"
:action="videoUpload.url"
:file-list="videoFileList"
:show-file-list="false"
accept=".mp4"
:on-success="handleVideoSuccess"
:before-upload="beforeUploadVideo"
<el-upload class="avatar-uploader el-upload--text" multiple :headers="videoUpload.headers"
:action="videoUpload.url" :file-list="videoFileList" :show-file-list="false" accept=".mp4"
:on-success="handleVideoSuccess" :before-upload="beforeUploadVideo"
:on-progress="uploadVideoProcess"
:on-remove="handleVideoRemove"
>
:on-remove="handleVideoRemove">
<div v-if="!videoFlag && showVideoPath" style="display: flex; flex-wrap: wrap; gap: 10px;">
<div v-for="(url, index) in showVideoPath.split(',')" :key="url"
style="position: relative; flex: 1 1 calc(33.333% - 20px); min-width: 200px; margin-bottom: 10px;">
<video :src="`${videoUpload.url2}${url}`" style="width:90%; height: auto;border-radius: 0.5vw;" class="avatar video-avatar" controls>
<video :src="`${videoUpload.url2}${url}`" style="width:90%; height: auto;border-radius: 0.5vw;"
class="avatar video-avatar" controls>
您的浏览器不支持视频播放
</video>
<img
src="../../../assets/images/delete.png"
@click.stop="handleVideoRemove(videoFileList[index])"
<img src="../../../assets/images/delete.png" @click.stop="handleVideoRemove(videoFileList[index])"
style="width: 35px; height: 35px;position: absolute; top: 5px; left: 5px; cursor: pointer; z-index: 999;"
alt="删除"
/>
alt="删除"/>
</div>
</div>
<el-progress :stroke-width="10" class="progressType" v-if="videoFlag"
type="circle" :percentage="videoUploadPercent" style="margin-top:30px;"></el-progress>
<el-button style="z-index: 999;" class="video-btn" slot="trigger" size="small" type="primary">点击上传视频</el-button>
<el-progress :stroke-width="10" class="progressType" v-if="videoFlag" type="circle"
:percentage="videoUploadPercent" style="margin-top:30px;"></el-progress>
<el-button style="z-index: 999;" class="video-btn" slot="trigger" size="small"
type="primary">点击上传视频
</el-button>
</el-upload>
</el-form-item>
<el-form-item label="上传图片" prop="courseUrl">
<el-upload
:action="uploadImgUrl"
list-type="picture-card"
multiple
:on-success="handleSuccess"
:on-remove="handleRemove"
:file-list="fileListImgs"
>
<el-upload :action="uploadImgUrl" list-type="picture-card" multiple :on-success="handleSuccess"
:on-remove="handleRemove" :file-list="fileListImgs">
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="上传文件" prop="courseUrl">
<el-upload
v-model="diaForm.list"
:limit="5"
:on-exceed="handleExceed"
:on-preview="handlePreview"
:before-upload="beforeAvatarUpload"
:on-remove="handleRemoveFile"
:headers="reqHeaders"
:on-success="onUploadSuccess"
action="http://localhost:10031/common/upload"
<el-upload v-model="diaForm.list" :limit="5" :on-exceed="handleExceed" :on-preview="handlePreview"
:before-upload="beforeAvatarUpload" :on-remove="handleRemoveFile" :headers="reqHeaders"
:on-success="onUploadSuccess" action="http://localhost:10031/common/upload"
:file-list="resultFileList"
list-type="picture"
class="upload-files"
accept=".png,.jpeg,.gif,.pdf,.jpg,.JPG">
list-type="picture" class="upload-files" accept=".png,.jpeg,.gif,.pdf,.jpg,.JPG">
<div class="upfile-btn">
<d2-icon name="document-upload" class="document-upload"/>
<div>点击上传+拖拽上传</div>
@ -380,8 +362,6 @@
</el-form-item>
<el-form-item style="position: relative ;">
<el-input type="hidden" v-model="form.courseUrl" readonly class="noAlert" placeholder=""/>
</el-form-item>
@ -423,9 +403,6 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="addTxtf"> </el-button>
<el-button @click="addTxt = false"> </el-button>
@ -435,6 +412,7 @@
</template>
<script>
import {getToken} from "@/utils/auth";
import {addTemplate, listTemplate, delTemplate} from "@/api/system/titleTemplate"
import {
addTxtC,
deleteTxt,
@ -447,7 +425,6 @@ import {
getFileListNew, updateOpenDown, getAllFieldList, downInfoFile, getAllTxtListP, insertNode, reset
} from "@/api/system/file";
import Editor from '@/components/Editor/index.vue'
import {deleteBattleTxt} from "../../../api/system/battle";
import {deletAllInfoNew, deleteDocTitleOnly} from "../../../api/system/file";
export default {
@ -456,6 +433,162 @@ export default {
},
data() {
return {
//
templateDialog: {
visible: false,
title: "选择导入模板"
},
showPreview: false,
levels: [{
key: 'level1',
label: '一级标题',
},
{
key: 'level2',
label: '二级标题',
},
{
key: 'level3',
label: '三级标题',
},
{
key: 'level4',
label: '四级标题',
},
{
key: 'level5',
label: '五级标题',
},
{
key: 'level6',
label: '六级标题',
},
{
key: 'level7',
label: '七级标题',
},],
titleOptions: [{
id: '1',
label: '一、',
value: '一、',
},
{
id: '2',
label: '(一)',
value: '(一)',
},
{
id: '3',
label: '(1)',
value: '(1)',
},
{
id: '4',
label: '1.',
value: '1.',
},
{
id: '5',
label: '1.1',
value: '1.1',
},
{
id: '6',
label: '1.1.1',
value: '1.1.1',
},
{
id: '7',
label: '1.1.1.1',
value: '1.1.1.1',
},
{
id: '8',
label: '①',
value: '①',
}],
titleOptions1: [{
id: '1',
label: '一、',
value: '一、',
},
{
id: '2',
label: '(一)',
value: '(一)',
},
{
id: '3',
label: '(1)',
value: '(1)',
},
{
id: '4',
label: '1.',
value: '1.',
},
{
id: '5',
label: '1.1',
value: '1.1',
},
{
id: '6',
label: '1.1.1',
value: '1.1.1',
},
{
id: '7',
label: '1.1.1.1',
value: '1.1.1.1',
},
{
id: '8',
label: '①',
value: '①',
}],
templateEditor: {
visible: false,
form: {
id: null,
name: '',
styles: {
1: {fontSize: 24, fontWeight: 'bold', color: '#000000'},
2: {fontSize: 20, fontWeight: 'bold', color: '#000000'},
3: {fontSize: 18, fontWeight: 'bold', color: '#000000'},
4: {fontSize: 16, fontWeight: 'bold', color: '#000000'},
5: {fontSize: 14, fontWeight: 'normal', color: '#000000'},
6: {fontSize: 12, fontWeight: 'normal', color: '#000000'}
},
level1: '',
level2: '',
level3: '',
level4: '',
level5: '',
level6: '',
level7: '',
}
},
templateRules: {
name: [
{required: true, message: '请输入模板名称', trigger: 'blur'},
{min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur'}
]
},
selectedTemplate: {
firstTitle: "",
secondTitle: "",
thirdTitle: "",
fourthTitle: "",
fiveTitle:"",
sixTitle:"",
sevenTitle:""
},
customTemplates: [],
currentTemplate: null,
//
opendeletOly: false,
deleteWord: "",
parentId1: undefined,
@ -471,6 +604,7 @@ export default {
isInputInvalid1: false,
inputErrorMessage: '',
isInputInvalid: false,
inputErrorMessage1: '',
oprnIno: false,
oprnIno1: false,
resultFileList: [],
@ -514,6 +648,12 @@ export default {
TxtValue: "",
fileId: undefined,
fileList: [],
//
muban: {
open: false,
title: "模板选择",
},
templates: [],
//
upload: {
tip: "准备上传文件",
@ -559,6 +699,130 @@ export default {
}
},
methods: {
handleCancle() {
this.templateEditor.visible = false;
this.templateEditor.form.level1 = ""
this.templateEditor.form.level2 = ""
this.templateEditor.form.level3 = ""
this.templateEditor.form.level4 = ""
this.templateEditor.form.name = ""
this.titleOptions = this.titleOptions1
},
handleSelected() {
const option1 = this.templateEditor.form.level1;
const option2 = this.templateEditor.form.level2;
const option3 = this.templateEditor.form.level3;
const option4 = this.templateEditor.form.level4;
this.titleOptions = this.titleOptions.filter(option =>
option.value !== option1 &&
option.value !== option2 &&
option.value !== option3 &&
option.value !== option4
);
console.log(this.titleOptions)
},
//
handleImport() {
this.templateDialog.visible = true;
this.selectedTemplate = null;
var data = {};
listTemplate(data).then((res) => {
console.log(res)
this.templates = res;
})
},
createNewTemplate() {
// this.templateEditor.form = {
// id: Date.now(),
// name: '',
// styles: {
// 1: { fontSize: 24, fontWeight: 'bold', color: '#000000' },
// 2: { fontSize: 20, fontWeight: 'bold', color: '#000000' },
// 3: { fontSize: 18, fontWeight: 'bold', color: '#000000' },
// 4: { fontSize: 16, fontWeight: 'bold', color: '#000000' },
// 5: { fontSize: 14, fontWeight: 'normal', color: '#000000' },
// 6: { fontSize: 12, fontWeight: 'normal', color: '#000000' }
// }
// };
this.templateEditor.visible = true;
this.$nextTick(() => {
if (this.$refs.templateForm) {
this.$refs.templateForm.clearValidate();
}
});
},
selectTemplate(template) {
this.selectedTemplate = template;
},
saveTemplate() {
var template = {
"name": this.templateEditor.form.name,
"firstTitle": this.templateEditor.form.level1,
"secondTitle": this.templateEditor.form.level2,
"thirdTitle": this.templateEditor.form.level3,
"fourthTitle": this.templateEditor.form.level4,
"fiveTitle": this.templateEditor.form.level5,
"sixTitle": this.templateEditor.form.level6,
"sevenTitle": this.templateEditor.form.level7,
}
addTemplate(template).then((res) => {
this.handleImport();
})
this.templateEditor.visible = false;
this.templateEditor.form.level1 = ""
this.templateEditor.form.level2 = ""
this.templateEditor.form.level3 = ""
this.templateEditor.form.level4 = ""
this.templateEditor.form.name = ""
this.titleOptions = this.titleOptions1
},
confirmTemplate() {
if (!this.selectedTemplate) {
this.$message.warning('请先选择一个模板');
return;
}
this.templateDialog.visible = false;
this.currentTemplate = this.selectedTemplate;
console.log(this.currentTemplate);
this.$nextTick(() => {
this.upload.title = "导入文档";
this.upload.open = true;
});
},
loadTemplatesFromStorage() {
const savedTemplates = localStorage.getItem('documentTemplates');
if (savedTemplates) {
this.customTemplates = JSON.parse(savedTemplates);
}
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.oprnIno = false;
console.log(file)
this.$message.success('文档导入成功');
this.getFileListInfo();
},
//
exportList() {
this.download('system/fileManage/exportList', {
...this.queryParams
@ -780,7 +1044,9 @@ export default {
this.dealPDF();
}, 1);
}
} else if (response && response.msg) { console.log('upload failed', response.msg); }
} else if (response && response.msg) {
console.log('upload failed', response.msg);
}
},
//
dealPDF() {
@ -797,13 +1063,9 @@ export default {
},
handleQuery() {
if (this.queryParams.docTitle == "") {
var data = {
}
var data = {}
getFileList(data).then((res) => {
this.fileList = res.data
})
@ -967,6 +1229,11 @@ export default {
}
},
handleDelete(id) {
delTemplate(id).then((res) => {
this.handleImport();
})
},
selectChanged(value) {
console.log(value);
this.parentId1 = value;
@ -1087,9 +1354,7 @@ export default {
});
if (this.queryParams.docTitle == "") {
var data = {
}
var data = {}
getFileListNew(data).then((res) => {
console.log(res);
this.fileList = res.data;
@ -1111,17 +1376,9 @@ export default {
loading.close();
}).catch(() => loading.close());
}
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = "新增文件";
this.upload.open = true;
},
handleImportRelation() {
this.upload1.title = "导入文献";
this.upload1.open = true;
@ -1142,31 +1399,12 @@ export default {
this.upload1.oprnIno = true;
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.oprnIno = false;
// this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "", {dangerouslyUseHTMLString: true});
this.$message({
message: '导入文件成功',
type: 'success',
customClass: 'success-message'
});
this.getFileListInfo()
},
//
handleFileSuccessRelation(response, file, fileList) {
this.upload1.open = false;
this.upload1.isUploading = false;
this.$refs.uploadR.clearFiles();
// this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "", {dangerouslyUseHTMLString: true});
this.$message({
message: '导入补充文件成功',
type: 'success',
customClass: 'success-message'
});
this.$message.success('导入补充文件成功');
this.getFileListInfo()
this.upload1.oprnIno1 = false;
},
@ -1205,12 +1443,7 @@ export default {
this.uploadAdd.open = false;
this.uploadAdd.isUploading = false;
this.$refs.upload1.clearFiles();
// this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "", {dangerouslyUseHTMLString: true});
this.$message({
message: '导入补充文件成功',
type: 'success',
customClass: 'success-message'
});
this.$message.success('导入补充文件成功');
this.getFileListInfo()
this.oprnIno1 = false;
},
@ -1229,6 +1462,7 @@ export default {
},
mounted() {
this.getFileListInfo()
this.loadTemplatesFromStorage();
var socket = new WebSocket('ws://localhost:10031/system/websocket/1');
let that = this
@ -1245,25 +1479,32 @@ export default {
top: 55%;
left: 50%;
}
.centered-loading .el-loading-spinner .el-loading-text {
font-size: 18px;
margin-top: 10px;
}
.centered-loading .el-loading-spinner .el-icon-loading {
font-size: 35px;
-webkit-animation: loading-rotate 3s linear infinite;
animation: loading-rotate 3s linear infinite;
}
.success-message {
z-index: 3000 !important; /* 根据实际情况调整 */
z-index: 3000 !important;
/* 根据实际情况调整 */
}
.error-message {
color: red;
}
.el-tree-node__content {
height: 2vw;
}
.tree-head {
background-color: #f8f8f8;
line-height: 2vw;
@ -1276,6 +1517,7 @@ export default {
padding-right: 8px;
margin-top: 1%;
}
.tree-head-check {
width: 38px;
text-align: right;
@ -1290,12 +1532,15 @@ export default {
.tree-head-seven {
flex: 1;
}
.tree-head-one {
flex: 0.3;
}
.tree-head-one {
padding-left: 1.1vw;
}
.tree-custom-node {
flex: 1;
display: flex;
@ -1304,8 +1549,16 @@ export default {
font-size: 1vw;
padding-right: 1vw;
}
.el-tree-node__expand-icon {
font-size: 1vw;
color: #000000;
}
.template-list::v-deep .el-table td,
.template-list::v-deep .el-table th {
font-size: 1vw !important;
color: #67C23A;
}
</style>

Loading…
Cancel
Save