Browse Source

模板创建

zxm
zhangxiaomeng 7 months ago
parent
commit
f750c5effd
  1. 160
      gyxtp/src/components/PdfViewer.vue
  2. 2
      gyxtp/src/view/articleInfo.vue
  3. 121
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyDocmubanController.java
  4. 135
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java
  5. 5
      ruoyi-api/src/main/java/com/ruoyi/api/controller/uploadApiController.java
  6. 107
      ruoyi-system/src/main/java/com/ruoyi/system/domain/ZhyDocmuban.java
  7. 61
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/ZhyDocmubanMapper.java
  8. 61
      ruoyi-system/src/main/java/com/ruoyi/system/service/IZhyDocmubanService.java
  9. 93
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZhyDocmubanServiceImpl.java
  10. 76
      ruoyi-system/src/main/resources/mapper/system/ZhyDocmubanMapper.xml
  11. 54
      ruoyi-ui/src/api/system/docmuban.js
  12. 552
      ruoyi-ui/src/views/system/docmuban/index.vue

160
gyxtp/src/components/PdfViewer.vue

@ -0,0 +1,160 @@
<template>
<div class="pdf-viewer">
<div class="controls">
<button @click="prevPage" :disabled="currentPage <= 1">上一页</button>
<span> {{ currentPage }} / {{ totalPages }} </span>
<button @click="nextPage" :disabled="currentPage >= totalPages">下一页</button>
<span>缩放: </span>
<button @click="zoomOut">-</button>
<button @click="zoomIn">+</button>
</div>
<div class="canvas-container">
<canvas ref="canvas"></canvas>
</div>
</div>
</template>
<script>
import * as pdfjsLib from 'pdfjs-dist/build/pdf';
import 'pdfjs-dist/build/pdf.worker.entry';
export default {
name: 'PdfViewer',
props: {
pdfPath: {
type: String,
required: true
}
},
data() {
return {
currentPage: 1,
totalPages: 0,
pdfDoc: null,
pageRendering: false,
pageNumPending: null,
scale: 1.5
};
},
mounted() {
this.loadPdf();
},
methods: {
async loadPdf() {
try {
// 使fetch APIBlob
const response = await fetch(this.pdfPath);
const blob = await response.blob();
const arrayBuffer = await blob.arrayBuffer();
// PDF
pdfjsLib.GlobalWorkerOptions.workerSrc = window.pdfjsWorker;
this.pdfDoc = await pdfjsLib.getDocument({ data: arrayBuffer }).promise;
this.totalPages = this.pdfDoc.numPages;
this.renderPage(this.currentPage);
} catch (error) {
console.error('Error loading PDF:', error);
}
},
async renderPage(num) {
this.pageRendering = true;
try {
const page = await this.pdfDoc.getPage(num);
const viewport = page.getViewport({ scale: this.scale });
const canvas = this.$refs.canvas;
const context = canvas.getContext('2d');
canvas.height = viewport.height;
canvas.width = viewport.width;
const renderContext = {
canvasContext: context,
viewport: viewport
};
await page.render(renderContext).promise;
this.pageRendering = false;
if (this.pageNumPending !== null) {
this.renderPage(this.pageNumPending);
this.pageNumPending = null;
}
} catch (error) {
console.error('Error rendering page:', error);
}
},
queueRenderPage(num) {
if (this.pageRendering) {
this.pageNumPending = num;
} else {
this.renderPage(num);
}
},
prevPage() {
if (this.currentPage <= 1) return;
this.currentPage--;
this.queueRenderPage(this.currentPage);
},
nextPage() {
if (this.currentPage >= this.totalPages) return;
this.currentPage++;
this.queueRenderPage(this.currentPage);
},
zoomIn() {
this.scale += 0.25;
this.queueRenderPage(this.currentPage);
},
zoomOut() {
if (this.scale > 0.5) {
this.scale -= 0.25;
this.queueRenderPage(this.currentPage);
}
}
},
watch: {
pdfPath() {
this.loadPdf();
}
}
};
</script>
<style scoped>
.pdf-viewer {
display: flex;
flex-direction: column;
align-items: center;
margin: 20px;
}
.controls {
margin-bottom: 20px;
}
.controls button {
margin: 0 5px;
padding: 5px 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
.controls button:disabled {
background-color: #cccccc;
cursor: not-allowed;
}
.controls span {
margin: 0 10px;
}
.canvas-container {
border: 1px solid #ddd;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-top: 10px;
}
</style>

2
gyxtp/src/view/articleInfo.vue

@ -941,7 +941,7 @@ export default {
this.id = this.$route.query.id;
getArticleInfo(this.id).then(async res => {
this.content = res
if(this.content.uploadUrl==null && this.content.uploadUrl==''){
if(this.content.uploadUrl==null || this.content.uploadUrl==''){
const localFilePath = this.content.localUrl;
try {

121
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyDocmubanController.java

@ -0,0 +1,121 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
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.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.ZhyDocmuban;
import com.ruoyi.system.service.IZhyDocmubanService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 图谱模板Controller
*
* @author ruoyi
* @date 2025-09-09
*/
@RestController
@RequestMapping("/system/docmuban")
public class ZhyDocmubanController extends BaseController
{
@Autowired
private IZhyDocmubanService zhyDocmubanService;
/**
* 查询图谱模板列表
*/
@GetMapping("/list")
public Map<String, List<ZhyDocmuban>> list(ZhyDocmuban zhyDocmuban) {
List<ZhyDocmuban> list = zhyDocmubanService.selectZhyDocmubanList(zhyDocmuban);
// 按 type 分组,返回 Map<type, List<ZhyDocmuban>>
return list.stream()
.collect(Collectors.groupingBy(ZhyDocmuban::getType));
}
/**
* 导出图谱模板列表
*/
@PreAuthorize("@ss.hasPermi('system:docmuban:export')")
@Log(title = "图谱模板", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ZhyDocmuban zhyDocmuban)
{
List<ZhyDocmuban> list = zhyDocmubanService.selectZhyDocmubanList(zhyDocmuban);
ExcelUtil<ZhyDocmuban> util = new ExcelUtil<ZhyDocmuban>(ZhyDocmuban.class);
util.exportExcel(response, list, "图谱模板数据");
}
/**
* 获取图谱模板详细信息
*/
@PreAuthorize("@ss.hasPermi('system:docmuban:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(zhyDocmubanService.selectZhyDocmubanById(id));
}
/**
* 新增图谱模板
*/
@PreAuthorize("@ss.hasPermi('system:docmuban:add')")
@Log(title = "图谱模板", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ZhyDocmuban zhyDocmuban)
{
return toAjax(zhyDocmubanService.insertZhyDocmuban(zhyDocmuban));
}
//新增测试
@PostMapping("/addList")
public AjaxResult addList(@RequestBody String[] list)
{
for(int a=0;a<list.length;a++){
ZhyDocmuban zhyDocmuban = new ZhyDocmuban();
zhyDocmuban.setGroupId(2l);
zhyDocmuban.setText(list[a]);
zhyDocmuban.setType("指标");
zhyDocmubanService.insertZhyDocmuban(zhyDocmuban);
}
return AjaxResult.success();
}
/**
* 修改图谱模板
*/
@PreAuthorize("@ss.hasPermi('system:docmuban:edit')")
@Log(title = "图谱模板", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ZhyDocmuban zhyDocmuban)
{
return toAjax(zhyDocmubanService.updateZhyDocmuban(zhyDocmuban));
}
/**
* 删除图谱模板
*/
@PreAuthorize("@ss.hasPermi('system:docmuban:remove')")
@Log(title = "图谱模板", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(zhyDocmubanService.deleteZhyDocmubanByIds(ids));
}
}

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

@ -298,6 +298,54 @@ public class ZhyFileManageController extends BaseController {
"反恐与极端主义方向(中亚及西部边疆)"
};
String[] strs2 = { "快速机降作战",
"海上机动作战",
"航母战斗群打击拒止",
"水面舰艇护航行动",
"边境防卫作战",
"岛屿进攻作战",
"岛礁防卫作战",
"领海防卫作战",
"强敌拒止作战",
"边境冲突作战",
"要地争夺作战",
"战略钳制作战",
"战役惩诫作战",
"航道与海峡联合封锁作战",
"突发事件应急作战",
"联合渡海登岛作战",
};
String[] strs3 = {
"坦克", "两栖坦克", "步兵战车", "轮式步战车", "履带步战车",
"全地形突击车", "轻型战术车", "重型战车", "自行火炮", "榴弹炮",
"火箭炮", "迫击炮", "机关炮", "火箭发射器", "反装甲弹药",
"导弹", "弹道导弹", "巡航导弹", "高超声速导弹", "反舰导弹",
"近防导弹", "空空导弹", "歼击机", "战斗机", "战斗攻击机",
"轰炸机", "加油机", "运输机", "侦察机", "预警机",
"电子作战机", "电子战机", "反潜机", "海上巡逻机", "无人机",
"直升机", "武装直升机", "运输直升机", "舰载直升机", "旋翼机",
"航空母舰", "战列舰", "巡洋舰", "驱逐舰", "护卫舰",
"潜艇", "两栖攻击舰", "两栖登陆舰", "坦克登陆舰", "船坞登陆舰",
"登陆舰", "气垫船", "补给舰", "综合补给舰", "滚装船",
"测控船", "空间站", "通信卫星", "侦察卫星",
"中继卫星", "火箭", "舰炮", "近程防御武器系统", "鱼雷",
"深水炸弹", "航空炸弹", "多功能干扰火箭", "火控雷达", "伞降",
"舰载声呐", "机载声纳",
};
String[] strs4 = { "温度", "湿度", "气压", "风", "云", "能见度", "降雨", "降雪", "路面结冰", "积雪",
"沙尘暴", "雷暴", "热带气旋", "海浪", "风浪", "涌浪", "拍岸浪", "海流", "海水温度",
"海水盐度", "海水密度", "内波", "中尺度涡", "海洋锋", "潮汐", "水色", "透明度",
"大气波导", "大气折射", "跃层", "寒潮"};
String[] strs11 ={
"气象海洋数据融合系统",
"气象海洋数值预报系统",
@ -312,6 +360,7 @@ public class ZhyFileManageController extends BaseController {
"云边端协同调度系统",
"知识模型管理系统"
};
String[] strs22 = {
"多源数据融合模型库",
"传感器误差校正模型库",
@ -334,40 +383,6 @@ public class ZhyFileManageController extends BaseController {
"模型全生命周期管理库",
"多模态交互渲染模型库"
};
String[] strs2 = { "快速机降作战",
"海上机动作战",
"航母战斗群打击拒止",
"水面舰艇护航行动",
"边境防卫作战",
"岛屿进攻作战",
"岛礁防卫作战",
"领海防卫作战",
"强敌拒止作战",
"边境冲突作战",
"要地争夺作战",
"战略钳制作战",
"战役惩诫作战",
"航道与海峡联合封锁作战",
"突发事件应急作战",
"联合渡海登岛作战",
};
String[] strs3 = {
"坦克", "两栖坦克", "步兵战车", "轮式步战车", "履带步战车",
"全地形突击车", "轻型战术车", "重型战车", "自行火炮", "榴弹炮",
"火箭炮", "迫击炮", "机关炮", "火箭发射器", "反装甲弹药",
"导弹", "弹道导弹", "巡航导弹", "高超声速导弹", "反舰导弹",
"近防导弹", "空空导弹", "歼击机", "战斗机", "战斗攻击机",
"轰炸机", "加油机", "运输机", "侦察机", "预警机",
"电子作战机", "电子战机", "反潜机", "海上巡逻机", "无人机",
"直升机", "武装直升机", "运输直升机", "舰载直升机", "旋翼机",
"航空母舰", "战列舰", "巡洋舰", "驱逐舰", "护卫舰",
"潜艇", "两栖攻击舰", "两栖登陆舰", "坦克登陆舰", "船坞登陆舰",
"登陆舰", "气垫船", "补给舰", "综合补给舰", "滚装船",
"测控船", "空间站", "通信卫星", "侦察卫星",
"中继卫星", "火箭", "舰炮", "近程防御武器系统", "鱼雷",
"深水炸弹", "航空炸弹", "多功能干扰火箭", "火控雷达", "伞降",
"舰载声呐", "机载声纳",
};
String[] strs33 = {
@ -447,6 +462,29 @@ public class ZhyFileManageController extends BaseController {
"实时动态数据",
"社会经济数据"
};
String[] strs55 = {
"地形数据",
"水文数据",
"重要的岛屿港口",
"实时气象数据",
"历史气象数据",
"海洋水文数据",
"海洋气象数据",
"电磁环境数据",
"核生化数据",
"武器系统参数",
"平台机动数据",
"任务规划数据",
"兵力部署数据",
"气象影响案例",
"海洋影响案例",
"军事规则库",
"专家知识库",
"卫星遥感数据",
"无人平台数据",
"民用设施数据",
"人口密度数据"
};
String[] strs111 = {
"演化博弈推演决策模型",
"多属性群决策模型",
@ -471,29 +509,7 @@ public class ZhyFileManageController extends BaseController {
"效用分析决策方法",
"模糊逻辑推理评估方法"
};
String[] strs55 = {
"地形数据",
"水文数据",
"重要的岛屿港口",
"实时气象数据",
"历史气象数据",
"海洋水文数据",
"海洋气象数据",
"电磁环境数据",
"核生化数据",
"武器系统参数",
"平台机动数据",
"任务规划数据",
"兵力部署数据",
"气象影响案例",
"海洋影响案例",
"军事规则库",
"专家知识库",
"卫星遥感数据",
"无人平台数据",
"民用设施数据",
"人口密度数据"
};
String[] strs222 = { "补给舰航行安全风险指数",
"导弹艇航行安全风险指数",
@ -524,10 +540,7 @@ public class ZhyFileManageController extends BaseController {
"岛礁空降作战环境风险指数",
"蛙人特种作战环境风险指数",
"岛礁防卫作战环境风险指数"};
String[] strs4 = { "温度", "湿度", "气压", "风", "云", "能见度", "降雨", "降雪", "路面结冰", "积雪",
"沙尘暴", "雷暴", "热带气旋", "海浪", "风浪", "涌浪", "拍岸浪", "海流", "海水温度",
"海水盐度", "海水密度", "内波", "中尺度涡", "海洋锋", "潮汐", "水色", "透明度",
"大气波导", "大气折射", "跃层", "寒潮"};
ZhyFileManage zhyFileManage = new ZhyFileManage();
zhyFileManage.setCreateTime(new Date());

5
ruoyi-api/src/main/java/com/ruoyi/api/controller/uploadApiController.java

@ -84,7 +84,8 @@ public class uploadApiController {
String serverUrlPrefix = serverConfig.getUrl(); // 例如 http://localhost:8080/profile/upload/
// 定义目标相对路径(可自定义规则)
String relativePath = "/profile/upload/pdf/" + originalFilename;
String relativePath = "/pdf/" + originalFilename;
String relativePath1 = "/profile/upload/pdf/" + originalFilename;
Path targetPath = Paths.get(uploadDir, relativePath);
System.out.println(targetPath);
@ -95,7 +96,7 @@ public class uploadApiController {
Files.copy(path, targetPath, StandardCopyOption.REPLACE_EXISTING);
// 构建可访问的 URL
String accessibleUrl = serverUrlPrefix + relativePath;
String accessibleUrl = serverUrlPrefix + relativePath1;
AjaxResult ajax = AjaxResult.success();
ajax.put("url", accessibleUrl);

107
ruoyi-system/src/main/java/com/ruoyi/system/domain/ZhyDocmuban.java

@ -0,0 +1,107 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 图谱模板对象 zhy_docmuban
*
* @author ruoyi
* @date 2025-09-09
*/
public class ZhyDocmuban extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键Id */
private Long id;
/** 内容 */
@Excel(name = "内容")
private String text;
/** 种类 */
@Excel(name = "种类")
private String type;
/** 组别(0,1,2) */
@Excel(name = "组别", readConverterExp = "0=,1,2")
private Long groupId;
/** 上级Id */
@Excel(name = "上级Id")
private Long parentId;
/** 关系 */
@Excel(name = "关系")
private String relation;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setText(String text)
{
this.text = text;
}
public String getText()
{
return text;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setGroupId(Long groupId)
{
this.groupId = groupId;
}
public Long getGroupId()
{
return groupId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public Long getParentId()
{
return parentId;
}
public void setRelation(String relation)
{
this.relation = relation;
}
public String getRelation()
{
return relation;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("text", getText())
.append("type", getType())
.append("groupId", getGroupId())
.append("parentId", getParentId())
.append("relation", getRelation())
.toString();
}
}

61
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ZhyDocmubanMapper.java

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.ZhyDocmuban;
/**
* 图谱模板Mapper接口
*
* @author ruoyi
* @date 2025-09-09
*/
public interface ZhyDocmubanMapper
{
/**
* 查询图谱模板
*
* @param id 图谱模板主键
* @return 图谱模板
*/
public ZhyDocmuban selectZhyDocmubanById(Long id);
/**
* 查询图谱模板列表
*
* @param zhyDocmuban 图谱模板
* @return 图谱模板集合
*/
public List<ZhyDocmuban> selectZhyDocmubanList(ZhyDocmuban zhyDocmuban);
/**
* 新增图谱模板
*
* @param zhyDocmuban 图谱模板
* @return 结果
*/
public int insertZhyDocmuban(ZhyDocmuban zhyDocmuban);
/**
* 修改图谱模板
*
* @param zhyDocmuban 图谱模板
* @return 结果
*/
public int updateZhyDocmuban(ZhyDocmuban zhyDocmuban);
/**
* 删除图谱模板
*
* @param id 图谱模板主键
* @return 结果
*/
public int deleteZhyDocmubanById(Long id);
/**
* 批量删除图谱模板
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteZhyDocmubanByIds(Long[] ids);
}

61
ruoyi-system/src/main/java/com/ruoyi/system/service/IZhyDocmubanService.java

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.ZhyDocmuban;
/**
* 图谱模板Service接口
*
* @author ruoyi
* @date 2025-09-09
*/
public interface IZhyDocmubanService
{
/**
* 查询图谱模板
*
* @param id 图谱模板主键
* @return 图谱模板
*/
public ZhyDocmuban selectZhyDocmubanById(Long id);
/**
* 查询图谱模板列表
*
* @param zhyDocmuban 图谱模板
* @return 图谱模板集合
*/
public List<ZhyDocmuban> selectZhyDocmubanList(ZhyDocmuban zhyDocmuban);
/**
* 新增图谱模板
*
* @param zhyDocmuban 图谱模板
* @return 结果
*/
public int insertZhyDocmuban(ZhyDocmuban zhyDocmuban);
/**
* 修改图谱模板
*
* @param zhyDocmuban 图谱模板
* @return 结果
*/
public int updateZhyDocmuban(ZhyDocmuban zhyDocmuban);
/**
* 批量删除图谱模板
*
* @param ids 需要删除的图谱模板主键集合
* @return 结果
*/
public int deleteZhyDocmubanByIds(Long[] ids);
/**
* 删除图谱模板信息
*
* @param id 图谱模板主键
* @return 结果
*/
public int deleteZhyDocmubanById(Long id);
}

93
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZhyDocmubanServiceImpl.java

@ -0,0 +1,93 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ZhyDocmubanMapper;
import com.ruoyi.system.domain.ZhyDocmuban;
import com.ruoyi.system.service.IZhyDocmubanService;
/**
* 图谱模板Service业务层处理
*
* @author ruoyi
* @date 2025-09-09
*/
@Service
public class ZhyDocmubanServiceImpl implements IZhyDocmubanService
{
@Autowired
private ZhyDocmubanMapper zhyDocmubanMapper;
/**
* 查询图谱模板
*
* @param id 图谱模板主键
* @return 图谱模板
*/
@Override
public ZhyDocmuban selectZhyDocmubanById(Long id)
{
return zhyDocmubanMapper.selectZhyDocmubanById(id);
}
/**
* 查询图谱模板列表
*
* @param zhyDocmuban 图谱模板
* @return 图谱模板
*/
@Override
public List<ZhyDocmuban> selectZhyDocmubanList(ZhyDocmuban zhyDocmuban)
{
return zhyDocmubanMapper.selectZhyDocmubanList(zhyDocmuban);
}
/**
* 新增图谱模板
*
* @param zhyDocmuban 图谱模板
* @return 结果
*/
@Override
public int insertZhyDocmuban(ZhyDocmuban zhyDocmuban)
{
return zhyDocmubanMapper.insertZhyDocmuban(zhyDocmuban);
}
/**
* 修改图谱模板
*
* @param zhyDocmuban 图谱模板
* @return 结果
*/
@Override
public int updateZhyDocmuban(ZhyDocmuban zhyDocmuban)
{
return zhyDocmubanMapper.updateZhyDocmuban(zhyDocmuban);
}
/**
* 批量删除图谱模板
*
* @param ids 需要删除的图谱模板主键
* @return 结果
*/
@Override
public int deleteZhyDocmubanByIds(Long[] ids)
{
return zhyDocmubanMapper.deleteZhyDocmubanByIds(ids);
}
/**
* 删除图谱模板信息
*
* @param id 图谱模板主键
* @return 结果
*/
@Override
public int deleteZhyDocmubanById(Long id)
{
return zhyDocmubanMapper.deleteZhyDocmubanById(id);
}
}

76
ruoyi-system/src/main/resources/mapper/system/ZhyDocmubanMapper.xml

@ -0,0 +1,76 @@
<?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.ZhyDocmubanMapper">
<resultMap type="ZhyDocmuban" id="ZhyDocmubanResult">
<result property="id" column="id" />
<result property="text" column="text" />
<result property="type" column="type" />
<result property="groupId" column="groupId" />
<result property="parentId" column="parentId" />
<result property="relation" column="relation" />
</resultMap>
<sql id="selectZhyDocmubanVo">
select id, text, type, groupId, parentId, relation from zhy_docmuban
</sql>
<select id="selectZhyDocmubanList" parameterType="ZhyDocmuban" resultMap="ZhyDocmubanResult">
<include refid="selectZhyDocmubanVo"/>
<where>
<if test="text != null and text != ''"> and text like concat('%', #{text}, '%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="groupId != null "> and groupId = #{groupId}</if>
<if test="parentId != null "> and parentId = #{parentId}</if>
<if test="relation != null and relation != ''"> and relation = #{relation}</if>
</where>
</select>
<select id="selectZhyDocmubanById" parameterType="Long" resultMap="ZhyDocmubanResult">
<include refid="selectZhyDocmubanVo"/>
where id = #{id}
</select>
<insert id="insertZhyDocmuban" parameterType="ZhyDocmuban" useGeneratedKeys="true" keyProperty="id">
insert into zhy_docmuban
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="text != null and text != ''">text,</if>
<if test="type != null and type != ''">type,</if>
<if test="groupId != null">groupId,</if>
<if test="parentId != null">parentId,</if>
<if test="relation != null">relation,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="text != null and text != ''">#{text},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="groupId != null">#{groupId},</if>
<if test="parentId != null">#{parentId},</if>
<if test="relation != null">#{relation},</if>
</trim>
</insert>
<update id="updateZhyDocmuban" parameterType="ZhyDocmuban">
update zhy_docmuban
<trim prefix="SET" suffixOverrides=",">
<if test="text != null and text != ''">text = #{text},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="groupId != null">groupId = #{groupId},</if>
<if test="parentId != null">parentId = #{parentId},</if>
<if test="relation != null">relation = #{relation},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZhyDocmubanById" parameterType="Long">
delete from zhy_docmuban where id = #{id}
</delete>
<delete id="deleteZhyDocmubanByIds" parameterType="String">
delete from zhy_docmuban where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

54
ruoyi-ui/src/api/system/docmuban.js

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 查询图谱模板列表
export function listDocmuban(query) {
return request({
url: '/system/docmuban/list',
method: 'get',
params: query
})
}
// 查询图谱模板详细
export function getDocmuban(id) {
return request({
url: '/system/docmuban/' + id,
method: 'get'
})
}
// 新增图谱模板
export function addDocmuban(data) {
return request({
url: '/system/docmuban',
method: 'post',
data: data
})
}
export function addList(data) {
return request({
url: '/system/docmuban/addList',
method: 'post',
data: data
})
}
// 修改图谱模板
export function updateDocmuban(data) {
return request({
url: '/system/docmuban',
method: 'put',
data: data
})
}
// 删除图谱模板
export function delDocmuban(id) {
return request({
url: '/system/docmuban/' + id,
method: 'delete'
})
}

552
ruoyi-ui/src/views/system/docmuban/index.vue

@ -0,0 +1,552 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="组别" prop="groupId">
<el-select v-model="queryParams.groupId" placeholder="请选择组别" @change="handleQuery">
<el-option
v-for="item in options"
:key="item.key"
:label="item.text"
:value="item.key">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<!-- <el-button type="primary" icon="el-icon-search" size="mini" >搜索</el-button>-->
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div style="width: 100%;height: 100%;display: flex;justify-content: space-around" v-if="this.queryParams.groupId==0">
<div style="width: 20%;">
<div style="text-align: center;font-size: 1.2vw;font-weight: bold;margin-bottom: 4%;">方向</div>
<el-table border height="700" v-loading="loading" :data="docmubanList01" >
<el-table-column label="内容" align="center" prop="text" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="width: 20%;margin-left: 5%">
<div style="text-align: center;font-size: 1.2vw;font-weight: bold;margin-bottom: 4%;">作战</div>
<el-table border height="700" v-loading="loading" :data="docmubanList02" >
<el-table-column label="内容" align="center" prop="text" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="width: 20%;margin-left: 5%">
<div style="text-align: center;font-size: 1.2vw;font-weight: bold;margin-bottom: 4%;">装备</div>
<el-table border height="700" v-loading="loading" :data="docmubanList03" >
<el-table-column label="内容" align="center" prop="text" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="width: 20%;margin-left: 5%">
<div style="text-align: center;font-size: 1.2vw;font-weight: bold;margin-bottom: 4%;">环境</div>
<el-table border height="700" v-loading="loading" :data="docmubanList04" >
<el-table-column label="内容" align="center" prop="text" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div style="width: 100%;height: 100%;display: flex;justify-content: space-around" v-if="this.queryParams.groupId==1">
<div style="width: 15%;">
<div style="text-align: center;font-size: 1.2vw;font-weight: bold;margin-bottom: 4%;">业务系统</div>
<el-table border height="700" v-loading="loading" :data="docmubanList11" >
<el-table-column label="内容" align="center" prop="text" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="width: 15%;margin-left: 5%">
<div style="text-align: center;font-size: 1.2vw;font-weight: bold;margin-bottom: 4%;">模型库</div>
<el-table border height="700" v-loading="loading" :data="docmubanList12" >
<el-table-column label="内容" align="center" prop="text" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="width: 15%;margin-left: 5%">
<div style="text-align: center;font-size: 1.2vw;font-weight: bold;margin-bottom: 4%;">规则库</div>
<el-table border height="700" v-loading="loading" :data="docmubanList13" >
<el-table-column label="内容" align="center" prop="text" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="width: 15%;margin-left: 5%">
<div style="text-align: center;font-size: 1.2vw;font-weight: bold;margin-bottom: 4%;">大类</div>
<el-table border height="700" v-loading="loading" :data="docmubanList14" >
<el-table-column label="内容" align="center" prop="text" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="width: 15%;margin-left: 5%">
<div style="text-align: center;font-size: 1.2vw;font-weight: bold;margin-bottom: 4%;">小类</div>
<el-table border height="700" v-loading="loading" :data="docmubanList15" >
<el-table-column label="内容" align="center" prop="text" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div style="width: 100%;height: 100%;display: flex;justify-content: space-around" v-if="this.queryParams.groupId==2">
<div style="width: 30%;">
<div style="text-align: center;font-size: 1.2vw;font-weight: bold;margin-bottom: 4%;">模型</div>
<el-table border height="700" v-loading="loading" :data="docmubanList21" >
<el-table-column label="内容" align="center" prop="text" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="width: 30%;margin-left: 5%">
<div style="text-align: center;font-size: 1.2vw;font-weight: bold;margin-bottom: 4%;">指标</div>
<el-table border height="700" v-loading="loading" :data="docmubanList22" >
<el-table-column label="内容" align="center" prop="text" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 添加或修改图谱模板对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDocmuban, getDocmuban, delDocmuban, addDocmuban, updateDocmuban } from "@/api/system/docmuban";
import {addList} from "../../../api/system/docmuban";
export default {
name: "Docmuban",
data() {
return {
options:[
{
key:0,
text:"方向-作战-装备-环境"
},
{
key:1,
text:"业务系统-模型库-规则库-大类-小类"
},
{
key:2,
text:"模型-指标"
}
],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
docmubanList: [],
docmubanList01: [],
docmubanList02: [],
docmubanList03: [],
docmubanList04: [],
docmubanList11: [],
docmubanList12: [],
docmubanList13: [],
docmubanList14: [],
docmubanList15: [],
docmubanList21: [],
docmubanList22: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
text: null,
type: null,
groupId: 0,
parentId: null,
relation: null
},
//
form: {},
//
rules: {
text: [
{ required: true, message: "内容不能为空", trigger: "blur" }
],
type: [
{ required: true, message: "种类不能为空", trigger: "change" }
],
groupId: [
{ required: true, message: "组别不能为空", trigger: "blur" }
],
},
testInfo:["补给舰航行安全风险指数",
"导弹艇航行安全风险指数",
"驱逐舰航行安全风险指数",
"攻击型潜艇航行安全风险指数",
"护卫舰航行安全风险指数",
"舰炮打击效能影响指数",
"舰射鱼雷打击效能影响指数",
"舰载反舰导弹打击效能影响指数",
"舰载防空导弹打击效能影响指数",
"舰载机飞行安全风险指数",
"舰载雷达探测效能影响指数",
"舰载声纳探测效能影响指数",
"舰载直升机降落安全风险指数",
"舰载直升机起飞安全风险指数",
"湿热指数",
"风寒指数",
"水面舰艇综合效能影响指数",
"舰艇机动效能影响指数",
"舰艇声呐效能影响指数",
"巡航导弹效能影响指数",
"防空导弹效能影响指数",
"水面舰艇航行之环境影响指数",
"飞机起降与飞行安全影响指数",
"空载武器打击精度环境影响指数",
"舰载武器打击精度环境影响指数",
"两栖登陆作战环境风险指数",
"岛礁空降作战环境风险指数",
"蛙人特种作战环境风险指数",
"岛礁防卫作战环境风险指数"],
};
},
created() {
this.getList();
// this.addListInfo()
},
methods: {
addListInfo(){
addList(this.testInfo).then((res)=>{
console.log(res);
})
},
/** 查询图谱模板列表 */
getList() {
this.loading = true;
listDocmuban(this.queryParams).then(response => {
const grouped = response; // { "": [...], "": [...] }
if(this.queryParams.groupId==0){
this.docmubanList01 = grouped["方向"] || [];
this.docmubanList02 = grouped["作战"] || [];
this.docmubanList03 = grouped["装备"] || [];
this.docmubanList04 = grouped["环境"] || [];
}
if(this.queryParams.groupId==1){
this.docmubanList11 = grouped["业务系统"] || [];
this.docmubanList12 = grouped["模型库"] || [];
this.docmubanList13 = grouped["规则库"] || [];
this.docmubanList14 = grouped["大类"] || [];
this.docmubanList15 = grouped["小类"] || [];
}
if(this.queryParams.groupId==2){
this.docmubanList21 = grouped["模型"] || [];
this.docmubanList22 = grouped["指标"] || [];
}
// this.docmubanList = response;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
text: null,
type: null,
groupId: null,
parentId: null,
relation: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加图谱模板";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getDocmuban(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改图谱模板";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDocmuban(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDocmuban(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除图谱模板编号为"' + ids + '"的数据项?').then(function() {
return delDocmuban(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/docmuban/export', {
...this.queryParams
}, `docmuban_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save