littlegreen 2 жил өмнө
parent
commit
90c29d226b

+ 104 - 0
ruoyi-system/src/main/java/com/ruoyi/system/controller/TemplateTableController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.system.controller;
+
+import java.util.List;
+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.TemplateTable;
+import com.ruoyi.system.service.ITemplateTableService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 证书模板Controller
+ * 
+ * @author ruoyi
+ * @date 2022-12-07
+ */
+@RestController
+@RequestMapping("/system/temp")
+public class TemplateTableController extends BaseController
+{
+    @Autowired
+    private ITemplateTableService templateTableService;
+
+    /**
+     * 查询证书模板列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:temp:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TemplateTable templateTable)
+    {
+        startPage();
+        List<TemplateTable> list = templateTableService.selectTemplateTableList(templateTable);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出证书模板列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:temp:export')")
+    @Log(title = "证书模板", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, TemplateTable templateTable)
+    {
+        List<TemplateTable> list = templateTableService.selectTemplateTableList(templateTable);
+        ExcelUtil<TemplateTable> util = new ExcelUtil<TemplateTable>(TemplateTable.class);
+        util.exportExcel(response, list, "证书模板数据");
+    }
+
+    /**
+     * 获取证书模板详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:temp:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(templateTableService.selectTemplateTableById(id));
+    }
+
+    /**
+     * 新增证书模板
+     */
+    @PreAuthorize("@ss.hasPermi('system:temp:add')")
+    @Log(title = "证书模板", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TemplateTable templateTable)
+    {
+        return toAjax(templateTableService.insertTemplateTable(templateTable));
+    }
+
+    /**
+     * 修改证书模板
+     */
+    @PreAuthorize("@ss.hasPermi('system:temp:edit')")
+    @Log(title = "证书模板", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TemplateTable templateTable)
+    {
+        return toAjax(templateTableService.updateTemplateTable(templateTable));
+    }
+
+    /**
+     * 删除证书模板
+     */
+    @PreAuthorize("@ss.hasPermi('system:temp:remove')")
+    @Log(title = "证书模板", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(templateTableService.deleteTemplateTableByIds(ids));
+    }
+}

+ 65 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/TemplateTable.java

@@ -0,0 +1,65 @@
+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;
+
+/**
+ * 证书模板对象 template_table
+ * 
+ * @author ruoyi
+ * @date 2022-12-07
+ */
+public class TemplateTable extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 模板名称 */
+    @Excel(name = "模板名称")
+    private String name;
+
+    /** 模板地址 */
+    @Excel(name = "模板地址")
+    private String url;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setName(String name) 
+    {
+        this.name = name;
+    }
+
+    public String getName() 
+    {
+        return name;
+    }
+    public void setUrl(String url) 
+    {
+        this.url = url;
+    }
+
+    public String getUrl() 
+    {
+        return url;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("name", getName())
+            .append("url", getUrl())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TemplateTableMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.TemplateTable;
+
+/**
+ * 证书模板Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2022-12-07
+ */
+public interface TemplateTableMapper 
+{
+    /**
+     * 查询证书模板
+     * 
+     * @param id 证书模板主键
+     * @return 证书模板
+     */
+    public TemplateTable selectTemplateTableById(Long id);
+
+    /**
+     * 查询证书模板列表
+     * 
+     * @param templateTable 证书模板
+     * @return 证书模板集合
+     */
+    public List<TemplateTable> selectTemplateTableList(TemplateTable templateTable);
+
+    /**
+     * 新增证书模板
+     * 
+     * @param templateTable 证书模板
+     * @return 结果
+     */
+    public int insertTemplateTable(TemplateTable templateTable);
+
+    /**
+     * 修改证书模板
+     * 
+     * @param templateTable 证书模板
+     * @return 结果
+     */
+    public int updateTemplateTable(TemplateTable templateTable);
+
+    /**
+     * 删除证书模板
+     * 
+     * @param id 证书模板主键
+     * @return 结果
+     */
+    public int deleteTemplateTableById(Long id);
+
+    /**
+     * 批量删除证书模板
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTemplateTableByIds(Long[] ids);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ITemplateTableService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.TemplateTable;
+
+/**
+ * 证书模板Service接口
+ * 
+ * @author ruoyi
+ * @date 2022-12-07
+ */
+public interface ITemplateTableService 
+{
+    /**
+     * 查询证书模板
+     * 
+     * @param id 证书模板主键
+     * @return 证书模板
+     */
+    public TemplateTable selectTemplateTableById(Long id);
+
+    /**
+     * 查询证书模板列表
+     * 
+     * @param templateTable 证书模板
+     * @return 证书模板集合
+     */
+    public List<TemplateTable> selectTemplateTableList(TemplateTable templateTable);
+
+    /**
+     * 新增证书模板
+     * 
+     * @param templateTable 证书模板
+     * @return 结果
+     */
+    public int insertTemplateTable(TemplateTable templateTable);
+
+    /**
+     * 修改证书模板
+     * 
+     * @param templateTable 证书模板
+     * @return 结果
+     */
+    public int updateTemplateTable(TemplateTable templateTable);
+
+    /**
+     * 批量删除证书模板
+     * 
+     * @param ids 需要删除的证书模板主键集合
+     * @return 结果
+     */
+    public int deleteTemplateTableByIds(Long[] ids);
+
+    /**
+     * 删除证书模板信息
+     * 
+     * @param id 证书模板主键
+     * @return 结果
+     */
+    public int deleteTemplateTableById(Long id);
+}

+ 93 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TemplateTableServiceImpl.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.TemplateTableMapper;
+import com.ruoyi.system.domain.TemplateTable;
+import com.ruoyi.system.service.ITemplateTableService;
+
+/**
+ * 证书模板Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2022-12-07
+ */
+@Service
+public class TemplateTableServiceImpl implements ITemplateTableService 
+{
+    @Autowired
+    private TemplateTableMapper templateTableMapper;
+
+    /**
+     * 查询证书模板
+     * 
+     * @param id 证书模板主键
+     * @return 证书模板
+     */
+    @Override
+    public TemplateTable selectTemplateTableById(Long id)
+    {
+        return templateTableMapper.selectTemplateTableById(id);
+    }
+
+    /**
+     * 查询证书模板列表
+     * 
+     * @param templateTable 证书模板
+     * @return 证书模板
+     */
+    @Override
+    public List<TemplateTable> selectTemplateTableList(TemplateTable templateTable)
+    {
+        return templateTableMapper.selectTemplateTableList(templateTable);
+    }
+
+    /**
+     * 新增证书模板
+     * 
+     * @param templateTable 证书模板
+     * @return 结果
+     */
+    @Override
+    public int insertTemplateTable(TemplateTable templateTable)
+    {
+        return templateTableMapper.insertTemplateTable(templateTable);
+    }
+
+    /**
+     * 修改证书模板
+     * 
+     * @param templateTable 证书模板
+     * @return 结果
+     */
+    @Override
+    public int updateTemplateTable(TemplateTable templateTable)
+    {
+        return templateTableMapper.updateTemplateTable(templateTable);
+    }
+
+    /**
+     * 批量删除证书模板
+     * 
+     * @param ids 需要删除的证书模板主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTemplateTableByIds(Long[] ids)
+    {
+        return templateTableMapper.deleteTemplateTableByIds(ids);
+    }
+
+    /**
+     * 删除证书模板信息
+     * 
+     * @param id 证书模板主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTemplateTableById(Long id)
+    {
+        return templateTableMapper.deleteTemplateTableById(id);
+    }
+}

+ 62 - 0
ruoyi-system/src/main/resources/mapper/system/TemplateTableMapper.xml

@@ -0,0 +1,62 @@
+<?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.TemplateTableMapper">
+    
+    <resultMap type="TemplateTable" id="TemplateTableResult">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="url"    column="url"    />
+    </resultMap>
+
+    <sql id="selectTemplateTableVo">
+        select id, name, url from template_table
+    </sql>
+
+    <select id="selectTemplateTableList" parameterType="TemplateTable" resultMap="TemplateTableResult">
+        <include refid="selectTemplateTableVo"/>
+        <where>  
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+        </where>
+    </select>
+    
+    <select id="selectTemplateTableById" parameterType="Long" resultMap="TemplateTableResult">
+        <include refid="selectTemplateTableVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertTemplateTable" parameterType="TemplateTable">
+        insert into template_table
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="name != null">name,</if>
+            <if test="url != null">url,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="name != null">#{name},</if>
+            <if test="url != null">#{url},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTemplateTable" parameterType="TemplateTable">
+        update template_table
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="name != null">name = #{name},</if>
+            <if test="url != null">url = #{url},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteTemplateTableById" parameterType="Long">
+        delete from template_table where id = #{id}
+    </delete>
+
+    <delete id="deleteTemplateTableByIds" parameterType="String">
+        delete from template_table where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 2 - 0
ruoyi-ui/package.json

@@ -45,9 +45,11 @@
     "file-saver": "2.0.5",
     "fuse.js": "6.4.3",
     "highlight.js": "9.18.5",
+    "html2canvas": "^1.4.1",
     "js-beautify": "1.13.0",
     "js-cookie": "3.0.1",
     "jsencrypt": "3.0.0-rc.1",
+    "jspdf": "^2.5.1",
     "nprogress": "0.2.0",
     "quill": "1.3.7",
     "screenfull": "5.0.2",

+ 44 - 0
ruoyi-ui/src/api/system/temp.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询证书模板列表
+export function listTemp(query) {
+  return request({
+    url: '/system/temp/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询证书模板详细
+export function getTemp(id) {
+  return request({
+    url: '/system/temp/' + id,
+    method: 'get'
+  })
+}
+
+// 新增证书模板
+export function addTemp(data) {
+  return request({
+    url: '/system/temp',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改证书模板
+export function updateTemp(data) {
+  return request({
+    url: '/system/temp',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除证书模板
+export function delTemp(id) {
+  return request({
+    url: '/system/temp/' + id,
+    method: 'delete'
+  })
+}

BIN
ruoyi-ui/src/assets/certback/appiontment_page-0001.jpg


BIN
ruoyi-ui/src/assets/certback/preson_page-0001.jpg


BIN
ruoyi-ui/src/assets/certback/team_page-0001.jpg


+ 3 - 0
ruoyi-ui/src/main.js

@@ -71,6 +71,9 @@ DictData.install()
  * Currently MockJs will be used in the production environment,
  * please remove it before going online! ! !
  */
+import htmlToPdf from '@/utils/htmlToPdf'
+// 使用Vue.use()方法就会调用工具方法中的install方法
+Vue.use(htmlToPdf)
 
 Vue.use(Element, {
   size: Cookies.get('size') || 'medium' // set element-ui default size

+ 254 - 0
ruoyi-ui/src/views/cert/temp/index.vue

@@ -0,0 +1,254 @@
+<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="name">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入模板名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['system:temp:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['system:temp:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['system:temp:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['system:temp:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="tempList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="${comment}" align="center" prop="id" />
+      <el-table-column label="模板名称" align="center" prop="name" />
+      <el-table-column label="模板地址" align="center" prop="url" width="100">
+        <template slot-scope="scope">
+          <image-preview :src="scope.row.url" :width="50" :height="50"/>
+        </template>
+      </el-table-column>
+      <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)"
+            v-hasPermi="['system:temp:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['system:temp:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改证书模板对话框 -->
+    <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-item label="模板名称" prop="name">
+          <el-input v-model="form.name" placeholder="请输入模板名称" />
+        </el-form-item>
+        <el-form-item label="模板地址">
+          <image-upload v-model="form.url"/>
+        </el-form-item>
+      </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 { listTemp, getTemp, delTemp, addTemp, updateTemp } from "@/api/system/temp";
+
+export default {
+  name: "Temp",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 证书模板表格数据
+      tempList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询证书模板列表 */
+    getList() {
+      this.loading = true;
+      listTemp(this.queryParams).then(response => {
+        this.tempList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        name: null,
+        url: 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
+      getTemp(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) {
+            updateTemp(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addTemp(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 delTemp(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('system/temp/export', {
+        ...this.queryParams
+      }, `temp_${new Date().getTime()}.xlsx`)
+    }
+  }
+};
+</script>