12 changed files with 1363 additions and 64 deletions
@ -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 API并转换为Blob |
|||
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> |
|||
@ -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)); |
|||
} |
|||
} |
|||
@ -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(); |
|||
} |
|||
} |
|||
@ -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); |
|||
} |
|||
@ -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); |
|||
} |
|||
@ -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); |
|||
} |
|||
} |
|||
@ -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> |
|||
@ -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' |
|||
}) |
|||
} |
|||
@ -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…
Reference in new issue