| @ -0,0 +1,171 @@ | |||
| package org.jeecg.modules.educationArticle.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.educationArticle.entity.EducationArticle; | |||
| import org.jeecg.modules.educationArticle.service.IEducationArticleService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 案例文章表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="案例文章表") | |||
| @RestController | |||
| @RequestMapping("/educationArticle/educationArticle") | |||
| @Slf4j | |||
| public class EducationArticleController extends JeecgController<EducationArticle, IEducationArticleService> { | |||
| @Autowired | |||
| private IEducationArticleService educationArticleService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param educationArticle | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "案例文章表-分页列表查询") | |||
| @ApiOperation(value="案例文章表-分页列表查询", notes="案例文章表-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<EducationArticle>> queryPageList(EducationArticle educationArticle, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<EducationArticle> queryWrapper = QueryGenerator.initQueryWrapper(educationArticle, req.getParameterMap()); | |||
| Page<EducationArticle> page = new Page<EducationArticle>(pageNo, pageSize); | |||
| IPage<EducationArticle> pageList = educationArticleService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param educationArticle | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "案例文章表-添加") | |||
| @ApiOperation(value="案例文章表-添加", notes="案例文章表-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody EducationArticle educationArticle) { | |||
| educationArticleService.save(educationArticle); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param educationArticle | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "案例文章表-编辑") | |||
| @ApiOperation(value="案例文章表-编辑", notes="案例文章表-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody EducationArticle educationArticle) { | |||
| educationArticleService.updateById(educationArticle); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "案例文章表-通过id删除") | |||
| @ApiOperation(value="案例文章表-通过id删除", notes="案例文章表-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| educationArticleService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "案例文章表-批量删除") | |||
| @ApiOperation(value="案例文章表-批量删除", notes="案例文章表-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.educationArticleService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "案例文章表-通过id查询") | |||
| @ApiOperation(value="案例文章表-通过id查询", notes="案例文章表-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<EducationArticle> queryById(@RequestParam(name="id",required=true) String id) { | |||
| EducationArticle educationArticle = educationArticleService.getById(id); | |||
| if(educationArticle==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(educationArticle); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param educationArticle | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, EducationArticle educationArticle) { | |||
| return super.exportXls(request, educationArticle, EducationArticle.class, "案例文章表"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, EducationArticle.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,93 @@ | |||
| package org.jeecg.modules.educationArticle.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 案例文章表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("education_article") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @ApiModel(value="education_article对象", description="案例文章表") | |||
| public class EducationArticle implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**标题*/ | |||
| @Excel(name = "标题", width = 15) | |||
| @ApiModelProperty(value = "标题") | |||
| private java.lang.String title; | |||
| /**封面*/ | |||
| @Excel(name = "封面", width = 15) | |||
| @ApiModelProperty(value = "封面") | |||
| private java.lang.String image; | |||
| /**学生情况*/ | |||
| @Excel(name = "学生情况", width = 15) | |||
| @ApiModelProperty(value = "学生情况") | |||
| private java.lang.String studentCondition; | |||
| /**服务项目*/ | |||
| @Excel(name = "服务项目", width = 15) | |||
| @ApiModelProperty(value = "服务项目") | |||
| private java.lang.String serviceItem; | |||
| /**服务过程*/ | |||
| @Excel(name = "服务过程", width = 15) | |||
| @ApiModelProperty(value = "服务过程") | |||
| private java.lang.String serviceProcess; | |||
| /**服务结果*/ | |||
| @Excel(name = "服务结果", width = 15) | |||
| @ApiModelProperty(value = "服务结果") | |||
| private java.lang.String serviceResult; | |||
| /**服务感受*/ | |||
| @Excel(name = "服务感受", width = 15) | |||
| @ApiModelProperty(value = "服务感受") | |||
| private java.lang.String serviceFeeling; | |||
| /**服务分类*/ | |||
| @Excel(name = "服务分类", width = 15, dictTable = "education_category_service", dicText = "title", dicCode = "id") | |||
| @Dict(dictTable = "education_category_service", dicText = "title", dicCode = "id") | |||
| @ApiModelProperty(value = "服务分类") | |||
| private java.lang.String categoryServiceId; | |||
| /**专业分类*/ | |||
| @Excel(name = "专业分类", width = 15, dictTable = "education_category_major", dicText = "title", dicCode = "id") | |||
| @Dict(dictTable = "education_category_major", dicText = "title", dicCode = "id") | |||
| @ApiModelProperty(value = "专业分类") | |||
| private java.lang.String categoryMajorId; | |||
| /**阶段分类*/ | |||
| @Excel(name = "阶段分类", width = 15, dictTable = "education_category_period", dicText = "title", dicCode = "id") | |||
| @Dict(dictTable = "education_category_period", dicText = "title", dicCode = "id") | |||
| @ApiModelProperty(value = "阶段分类") | |||
| private java.lang.String categoryPeriodId; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.educationArticle.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.educationArticle.entity.EducationArticle; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 案例文章表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface EducationArticleMapper extends BaseMapper<EducationArticle> { | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| <?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="org.jeecg.modules.educationArticle.mapper.EducationArticleMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.educationArticle.service; | |||
| import org.jeecg.modules.educationArticle.entity.EducationArticle; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 案例文章表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IEducationArticleService extends IService<EducationArticle> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.educationArticle.service.impl; | |||
| import org.jeecg.modules.educationArticle.entity.EducationArticle; | |||
| import org.jeecg.modules.educationArticle.mapper.EducationArticleMapper; | |||
| import org.jeecg.modules.educationArticle.service.IEducationArticleService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 案例文章表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class EducationArticleServiceImpl extends ServiceImpl<EducationArticleMapper, EducationArticle> implements IEducationArticleService { | |||
| } | |||
| @ -0,0 +1,232 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('案例文章表')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| :scroll="{x:true}" | |||
| bordered | |||
| rowKey="id" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
| class="j-table-force-nowrap" | |||
| @change="handleTableChange"> | |||
| <template slot="htmlSlot" slot-scope="text"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleDetail(record)">详情</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <education-article-modal ref="modalForm" @ok="modalFormOk"></education-article-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import '@/assets/less/TableExpand.less' | |||
| import { mixinDevice } from '@/utils/mixin' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import EducationArticleModal from './modules/EducationArticleModal' | |||
| import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |||
| export default { | |||
| name: 'EducationArticleList', | |||
| mixins:[JeecgListMixin, mixinDevice], | |||
| components: { | |||
| EducationArticleModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '案例文章表管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title: '#', | |||
| dataIndex: '', | |||
| key:'rowIndex', | |||
| width:60, | |||
| align:"center", | |||
| customRender:function (t,r,index) { | |||
| return parseInt(index)+1; | |||
| } | |||
| }, | |||
| { | |||
| title:'标题', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title:'封面', | |||
| align:"center", | |||
| dataIndex: 'image', | |||
| scopedSlots: {customRender: 'imgSlot'} | |||
| }, | |||
| { | |||
| title:'学生情况', | |||
| align:"center", | |||
| dataIndex: 'studentCondition', | |||
| scopedSlots: {customRender: 'htmlSlot'} | |||
| }, | |||
| { | |||
| title:'服务项目', | |||
| align:"center", | |||
| dataIndex: 'serviceItem', | |||
| scopedSlots: {customRender: 'htmlSlot'} | |||
| }, | |||
| { | |||
| title:'服务过程', | |||
| align:"center", | |||
| dataIndex: 'serviceProcess', | |||
| scopedSlots: {customRender: 'htmlSlot'} | |||
| }, | |||
| { | |||
| title:'服务结果', | |||
| align:"center", | |||
| dataIndex: 'serviceResult', | |||
| scopedSlots: {customRender: 'htmlSlot'} | |||
| }, | |||
| { | |||
| title:'服务感受', | |||
| align:"center", | |||
| dataIndex: 'serviceFeeling', | |||
| scopedSlots: {customRender: 'htmlSlot'} | |||
| }, | |||
| { | |||
| title:'服务分类', | |||
| align:"center", | |||
| dataIndex: 'categoryServiceId_dictText' | |||
| }, | |||
| { | |||
| title:'专业分类', | |||
| align:"center", | |||
| dataIndex: 'categoryMajorId_dictText' | |||
| }, | |||
| { | |||
| title:'阶段分类', | |||
| align:"center", | |||
| dataIndex: 'categoryPeriodId_dictText' | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' } | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/educationArticle/educationArticle/list", | |||
| delete: "/educationArticle/educationArticle/delete", | |||
| deleteBatch: "/educationArticle/educationArticle/deleteBatch", | |||
| exportXlsUrl: "/educationArticle/educationArticle/exportXls", | |||
| importExcelUrl: "educationArticle/educationArticle/importExcel", | |||
| }, | |||
| dictOptions:{}, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl: function(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| }, | |||
| methods: { | |||
| initDictConfig(){ | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'string',value:'title',text:'标题',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'image',text:'封面',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'studentCondition',text:'学生情况',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'serviceItem',text:'服务项目',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'serviceProcess',text:'服务过程',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'serviceResult',text:'服务结果',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'serviceFeeling',text:'服务感受',dictCode:''}) | |||
| fieldList.push({type:'string',value:'categoryServiceId',text:'服务分类',dictCode:"education_category_service,title,id"}) | |||
| fieldList.push({type:'string',value:'categoryMajorId',text:'专业分类',dictCode:"education_category_major,title,id"}) | |||
| fieldList.push({type:'string',value:'categoryPeriodId',text:'阶段分类',dictCode:"education_category_period,title,id"}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,149 @@ | |||
| <template> | |||
| <a-spin :spinning="confirmLoading"> | |||
| <j-form-container :disabled="formDisabled"> | |||
| <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
| <a-row> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="title"> | |||
| <a-input v-model="model.title" placeholder="请输入标题" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="封面" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="image"> | |||
| <j-image-upload isMultiple v-model="model.image" ></j-image-upload> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="学生情况" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="studentCondition"> | |||
| <j-editor v-model="model.studentCondition" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="服务项目" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="serviceItem"> | |||
| <j-editor v-model="model.serviceItem" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="服务过程" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="serviceProcess"> | |||
| <j-editor v-model="model.serviceProcess" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="服务结果" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="serviceResult"> | |||
| <j-editor v-model="model.serviceResult" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="服务感受" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="serviceFeeling"> | |||
| <j-editor v-model="model.serviceFeeling" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="服务分类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="categoryServiceId"> | |||
| <j-dict-select-tag type="list" v-model="model.categoryServiceId" dictCode="education_category_service,title,id" placeholder="请选择服务分类" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="专业分类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="categoryMajorId"> | |||
| <j-dict-select-tag type="list" v-model="model.categoryMajorId" dictCode="education_category_major,title,id" placeholder="请选择专业分类" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="阶段分类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="categoryPeriodId"> | |||
| <j-dict-select-tag type="list" v-model="model.categoryPeriodId" dictCode="education_category_period,title,id" placeholder="请选择阶段分类" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| </a-row> | |||
| </a-form-model> | |||
| </j-form-container> | |||
| </a-spin> | |||
| </template> | |||
| <script> | |||
| import { httpAction, getAction } from '@/api/manage' | |||
| import { validateDuplicateValue } from '@/utils/util' | |||
| export default { | |||
| name: 'EducationArticleForm', | |||
| components: { | |||
| }, | |||
| props: { | |||
| //表单禁用 | |||
| disabled: { | |||
| type: Boolean, | |||
| default: false, | |||
| required: false | |||
| } | |||
| }, | |||
| data () { | |||
| return { | |||
| model:{ | |||
| }, | |||
| labelCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 5 }, | |||
| }, | |||
| wrapperCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 16 }, | |||
| }, | |||
| confirmLoading: false, | |||
| validatorRules: { | |||
| }, | |||
| url: { | |||
| add: "/educationArticle/educationArticle/add", | |||
| edit: "/educationArticle/educationArticle/edit", | |||
| queryById: "/educationArticle/educationArticle/queryById" | |||
| } | |||
| } | |||
| }, | |||
| computed: { | |||
| formDisabled(){ | |||
| return this.disabled | |||
| }, | |||
| }, | |||
| created () { | |||
| //备份model原始值 | |||
| this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.edit(this.modelDefault); | |||
| }, | |||
| edit (record) { | |||
| this.model = Object.assign({}, record); | |||
| this.visible = true; | |||
| }, | |||
| submitForm () { | |||
| const that = this; | |||
| // 触发表单验证 | |||
| this.$refs.form.validate(valid => { | |||
| if (valid) { | |||
| that.confirmLoading = true; | |||
| let httpurl = ''; | |||
| let method = ''; | |||
| if(!this.model.id){ | |||
| httpurl+=this.url.add; | |||
| method = 'post'; | |||
| }else{ | |||
| httpurl+=this.url.edit; | |||
| method = 'put'; | |||
| } | |||
| httpAction(httpurl,this.model,method).then((res)=>{ | |||
| if(res.success){ | |||
| that.$message.success(res.message); | |||
| that.$emit('ok'); | |||
| }else{ | |||
| that.$message.warning(res.message); | |||
| } | |||
| }).finally(() => { | |||
| that.confirmLoading = false; | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,84 @@ | |||
| <template> | |||
| <a-drawer | |||
| :title="title" | |||
| :width="width" | |||
| placement="right" | |||
| :closable="false" | |||
| @close="close" | |||
| destroyOnClose | |||
| :visible="visible"> | |||
| <education-article-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></education-article-form> | |||
| <div class="drawer-footer"> | |||
| <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
| <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
| </div> | |||
| </a-drawer> | |||
| </template> | |||
| <script> | |||
| import EducationArticleForm from './EducationArticleForm' | |||
| export default { | |||
| name: 'EducationArticleModal', | |||
| components: { | |||
| EducationArticleForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:"操作", | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }); | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** Button按钮间距 */ | |||
| .ant-btn { | |||
| margin-left: 30px; | |||
| margin-bottom: 30px; | |||
| float: right; | |||
| } | |||
| .drawer-footer{ | |||
| position: absolute; | |||
| bottom: -8px; | |||
| width: 100%; | |||
| border-top: 1px solid #e8e8e8; | |||
| padding: 10px 16px; | |||
| text-align: right; | |||
| left: 0; | |||
| background: #fff; | |||
| border-radius: 0 0 2px 2px; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,60 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <education-article-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></education-article-form> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import EducationArticleForm from './EducationArticleForm' | |||
| export default { | |||
| name: 'EducationArticleModal', | |||
| components: { | |||
| EducationArticleForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:'', | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }) | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,61 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import {Modal} from 'ant-design-vue'; | |||
| enum Api { | |||
| list = '/educationArticle/educationArticle/list', | |||
| save='/educationArticle/educationArticle/add', | |||
| edit='/educationArticle/educationArticle/edit', | |||
| deleteOne = '/educationArticle/educationArticle/delete', | |||
| deleteBatch = '/educationArticle/educationArticle/deleteBatch', | |||
| importExcel = '/educationArticle/educationArticle/importExcel', | |||
| exportXls = '/educationArticle/educationArticle/exportXls', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 列表接口 | |||
| * @param params | |||
| */ | |||
| export const list = (params) => | |||
| defHttp.get({url: Api.list, params}); | |||
| /** | |||
| * 删除单个 | |||
| */ | |||
| export const deleteOne = (params,handleSuccess) => { | |||
| return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * @param params | |||
| */ | |||
| export const batchDelete = (params, handleSuccess) => { | |||
| Modal.confirm({ | |||
| title: '确认删除', | |||
| content: '是否删除选中数据', | |||
| okText: '确认', | |||
| cancelText: '取消', | |||
| onOk: () => { | |||
| return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 保存或者更新 | |||
| * @param params | |||
| */ | |||
| export const saveOrUpdate = (params, isUpdate) => { | |||
| let url = isUpdate ? Api.edit : Api.save; | |||
| return defHttp.post({url: url, params}); | |||
| } | |||
| @ -0,0 +1,130 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '标题', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '封面', | |||
| align:"center", | |||
| dataIndex: 'image', | |||
| customRender:render.renderAvatar, | |||
| }, | |||
| { | |||
| title: '学生情况', | |||
| align:"center", | |||
| dataIndex: 'studentCondition', | |||
| slots: { customRender: 'htmlSlot' }, | |||
| }, | |||
| { | |||
| title: '服务项目', | |||
| align:"center", | |||
| dataIndex: 'serviceItem', | |||
| slots: { customRender: 'htmlSlot' }, | |||
| }, | |||
| { | |||
| title: '服务过程', | |||
| align:"center", | |||
| dataIndex: 'serviceProcess', | |||
| slots: { customRender: 'htmlSlot' }, | |||
| }, | |||
| { | |||
| title: '服务结果', | |||
| align:"center", | |||
| dataIndex: 'serviceResult', | |||
| slots: { customRender: 'htmlSlot' }, | |||
| }, | |||
| { | |||
| title: '服务感受', | |||
| align:"center", | |||
| dataIndex: 'serviceFeeling', | |||
| slots: { customRender: 'htmlSlot' }, | |||
| }, | |||
| { | |||
| title: '服务分类', | |||
| align:"center", | |||
| dataIndex: 'categoryServiceId_dictText' | |||
| }, | |||
| { | |||
| title: '专业分类', | |||
| align:"center", | |||
| dataIndex: 'categoryMajorId_dictText' | |||
| }, | |||
| { | |||
| title: '阶段分类', | |||
| align:"center", | |||
| dataIndex: 'categoryPeriodId_dictText' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '标题', | |||
| field: 'title', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '封面', | |||
| field: 'image', | |||
| component: 'JImageUpload', | |||
| componentProps:{ | |||
| }, | |||
| }, | |||
| { | |||
| label: '学生情况', | |||
| field: 'studentCondition', | |||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||
| }, | |||
| { | |||
| label: '服务项目', | |||
| field: 'serviceItem', | |||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||
| }, | |||
| { | |||
| label: '服务过程', | |||
| field: 'serviceProcess', | |||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||
| }, | |||
| { | |||
| label: '服务结果', | |||
| field: 'serviceResult', | |||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||
| }, | |||
| { | |||
| label: '服务感受', | |||
| field: 'serviceFeeling', | |||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||
| }, | |||
| { | |||
| label: '服务分类', | |||
| field: 'categoryServiceId', | |||
| component: 'JDictSelectTag', | |||
| componentProps:{ | |||
| dictCode:"education_category_service,title,id" | |||
| }, | |||
| }, | |||
| { | |||
| label: '专业分类', | |||
| field: 'categoryMajorId', | |||
| component: 'JDictSelectTag', | |||
| componentProps:{ | |||
| dictCode:"education_category_major,title,id" | |||
| }, | |||
| }, | |||
| { | |||
| label: '阶段分类', | |||
| field: 'categoryPeriodId', | |||
| component: 'JDictSelectTag', | |||
| componentProps:{ | |||
| dictCode:"education_category_period,title,id" | |||
| }, | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,162 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
| <a-dropdown v-if="checkedKeys.length > 0"> | |||
| <template #overlay> | |||
| <a-menu> | |||
| <a-menu-item key="1" @click="batchHandleDelete"> | |||
| <Icon icon="ant-design:delete-outlined"></Icon> | |||
| 删除 | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </template> | |||
| <a-button>批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template #htmlSlot="{text}"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template #fileSlot="{text}"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <EducationArticleModal @register="registerModal" @success="handleSuccess"></EducationArticleModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="educationArticle-educationArticle" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import EducationArticleModal from './components/EducationArticleModal.vue' | |||
| import {columns, searchFormSchema} from './educationArticle.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './educationArticle.api'; | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '案例文章表', | |||
| api: list, | |||
| columns, | |||
| canResize:false, | |||
| formConfig: { | |||
| labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"案例文章表", | |||
| url: getExportUrl, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| function handleAdd() { | |||
| openModal(true, { | |||
| isUpdate: false, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 编辑事件 | |||
| */ | |||
| function handleEdit(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 详情 | |||
| */ | |||
| function handleDetail(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 删除事件 | |||
| */ | |||
| async function handleDelete(record) { | |||
| await deleteOne({id: record.id}, reload); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: checkedKeys.value}, reload); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| } | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| </style> | |||
| @ -0,0 +1,58 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm"/> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../educationArticle.data'; | |||
| import {saveOrUpdate} from '../educationArticle.api'; | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| </style> | |||
| @ -0,0 +1,171 @@ | |||
| package org.jeecg.modules.educationBanner.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.educationBanner.entity.EducationBanner; | |||
| import org.jeecg.modules.educationBanner.service.IEducationBannerService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 轮播图表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="轮播图表") | |||
| @RestController | |||
| @RequestMapping("/educationBanner/educationBanner") | |||
| @Slf4j | |||
| public class EducationBannerController extends JeecgController<EducationBanner, IEducationBannerService> { | |||
| @Autowired | |||
| private IEducationBannerService educationBannerService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param educationBanner | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "轮播图表-分页列表查询") | |||
| @ApiOperation(value="轮播图表-分页列表查询", notes="轮播图表-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<EducationBanner>> queryPageList(EducationBanner educationBanner, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<EducationBanner> queryWrapper = QueryGenerator.initQueryWrapper(educationBanner, req.getParameterMap()); | |||
| Page<EducationBanner> page = new Page<EducationBanner>(pageNo, pageSize); | |||
| IPage<EducationBanner> pageList = educationBannerService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param educationBanner | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "轮播图表-添加") | |||
| @ApiOperation(value="轮播图表-添加", notes="轮播图表-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody EducationBanner educationBanner) { | |||
| educationBannerService.save(educationBanner); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param educationBanner | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "轮播图表-编辑") | |||
| @ApiOperation(value="轮播图表-编辑", notes="轮播图表-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody EducationBanner educationBanner) { | |||
| educationBannerService.updateById(educationBanner); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "轮播图表-通过id删除") | |||
| @ApiOperation(value="轮播图表-通过id删除", notes="轮播图表-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| educationBannerService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "轮播图表-批量删除") | |||
| @ApiOperation(value="轮播图表-批量删除", notes="轮播图表-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.educationBannerService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "轮播图表-通过id查询") | |||
| @ApiOperation(value="轮播图表-通过id查询", notes="轮播图表-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<EducationBanner> queryById(@RequestParam(name="id",required=true) String id) { | |||
| EducationBanner educationBanner = educationBannerService.getById(id); | |||
| if(educationBanner==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(educationBanner); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param educationBanner | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, EducationBanner educationBanner) { | |||
| return super.exportXls(request, educationBanner, EducationBanner.class, "轮播图表"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, EducationBanner.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,67 @@ | |||
| package org.jeecg.modules.educationBanner.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 轮播图表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("education_banner") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @ApiModel(value="education_banner对象", description="轮播图表") | |||
| public class EducationBanner implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**标题*/ | |||
| @Excel(name = "标题", width = 15) | |||
| @ApiModelProperty(value = "标题") | |||
| private java.lang.String title; | |||
| /**图片*/ | |||
| @Excel(name = "图片", width = 15) | |||
| @ApiModelProperty(value = "图片") | |||
| private java.lang.String image; | |||
| /**分类*/ | |||
| @Excel(name = "分类", width = 15, dicCode = "education_type_banner") | |||
| @Dict(dicCode = "education_type_banner") | |||
| @ApiModelProperty(value = "分类") | |||
| private java.lang.String type; | |||
| /**排序编号*/ | |||
| @Excel(name = "排序编号", width = 15) | |||
| @ApiModelProperty(value = "排序编号") | |||
| private java.lang.Integer orderNo; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.educationBanner.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.educationBanner.entity.EducationBanner; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 轮播图表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface EducationBannerMapper extends BaseMapper<EducationBanner> { | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| <?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="org.jeecg.modules.educationBanner.mapper.EducationBannerMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.educationBanner.service; | |||
| import org.jeecg.modules.educationBanner.entity.EducationBanner; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 轮播图表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IEducationBannerService extends IService<EducationBanner> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.educationBanner.service.impl; | |||
| import org.jeecg.modules.educationBanner.entity.EducationBanner; | |||
| import org.jeecg.modules.educationBanner.mapper.EducationBannerMapper; | |||
| import org.jeecg.modules.educationBanner.service.IEducationBannerService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 轮播图表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class EducationBannerServiceImpl extends ServiceImpl<EducationBannerMapper, EducationBanner> implements IEducationBannerService { | |||
| } | |||
| @ -0,0 +1,191 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('轮播图表')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| :scroll="{x:true}" | |||
| bordered | |||
| rowKey="id" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
| class="j-table-force-nowrap" | |||
| @change="handleTableChange"> | |||
| <template slot="htmlSlot" slot-scope="text"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleDetail(record)">详情</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <education-banner-modal ref="modalForm" @ok="modalFormOk"></education-banner-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import '@/assets/less/TableExpand.less' | |||
| import { mixinDevice } from '@/utils/mixin' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import EducationBannerModal from './modules/EducationBannerModal' | |||
| import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |||
| export default { | |||
| name: 'EducationBannerList', | |||
| mixins:[JeecgListMixin, mixinDevice], | |||
| components: { | |||
| EducationBannerModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '轮播图表管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title: '#', | |||
| dataIndex: '', | |||
| key:'rowIndex', | |||
| width:60, | |||
| align:"center", | |||
| customRender:function (t,r,index) { | |||
| return parseInt(index)+1; | |||
| } | |||
| }, | |||
| { | |||
| title:'标题', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title:'图片', | |||
| align:"center", | |||
| dataIndex: 'image', | |||
| scopedSlots: {customRender: 'imgSlot'} | |||
| }, | |||
| { | |||
| title:'分类', | |||
| align:"center", | |||
| dataIndex: 'type_dictText' | |||
| }, | |||
| { | |||
| title:'排序编号', | |||
| align:"center", | |||
| dataIndex: 'orderNo' | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' } | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/educationBanner/educationBanner/list", | |||
| delete: "/educationBanner/educationBanner/delete", | |||
| deleteBatch: "/educationBanner/educationBanner/deleteBatch", | |||
| exportXlsUrl: "/educationBanner/educationBanner/exportXls", | |||
| importExcelUrl: "educationBanner/educationBanner/importExcel", | |||
| }, | |||
| dictOptions:{}, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl: function(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| }, | |||
| methods: { | |||
| initDictConfig(){ | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'string',value:'title',text:'标题',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'image',text:'图片',dictCode:''}) | |||
| fieldList.push({type:'string',value:'type',text:'分类',dictCode:'education_type_banner'}) | |||
| fieldList.push({type:'int',value:'orderNo',text:'排序编号',dictCode:''}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,119 @@ | |||
| <template> | |||
| <a-spin :spinning="confirmLoading"> | |||
| <j-form-container :disabled="formDisabled"> | |||
| <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
| <a-row> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="title"> | |||
| <a-input v-model="model.title" placeholder="请输入标题" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="image"> | |||
| <j-image-upload isMultiple v-model="model.image" ></j-image-upload> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="分类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> | |||
| <j-dict-select-tag type="list" v-model="model.type" dictCode="education_type_banner" placeholder="请选择分类" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="排序编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderNo"> | |||
| <a-input-number v-model="model.orderNo" placeholder="请输入排序编号" style="width: 100%" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| </a-row> | |||
| </a-form-model> | |||
| </j-form-container> | |||
| </a-spin> | |||
| </template> | |||
| <script> | |||
| import { httpAction, getAction } from '@/api/manage' | |||
| import { validateDuplicateValue } from '@/utils/util' | |||
| export default { | |||
| name: 'EducationBannerForm', | |||
| components: { | |||
| }, | |||
| props: { | |||
| //表单禁用 | |||
| disabled: { | |||
| type: Boolean, | |||
| default: false, | |||
| required: false | |||
| } | |||
| }, | |||
| data () { | |||
| return { | |||
| model:{ | |||
| }, | |||
| labelCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 5 }, | |||
| }, | |||
| wrapperCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 16 }, | |||
| }, | |||
| confirmLoading: false, | |||
| validatorRules: { | |||
| }, | |||
| url: { | |||
| add: "/educationBanner/educationBanner/add", | |||
| edit: "/educationBanner/educationBanner/edit", | |||
| queryById: "/educationBanner/educationBanner/queryById" | |||
| } | |||
| } | |||
| }, | |||
| computed: { | |||
| formDisabled(){ | |||
| return this.disabled | |||
| }, | |||
| }, | |||
| created () { | |||
| //备份model原始值 | |||
| this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.edit(this.modelDefault); | |||
| }, | |||
| edit (record) { | |||
| this.model = Object.assign({}, record); | |||
| this.visible = true; | |||
| }, | |||
| submitForm () { | |||
| const that = this; | |||
| // 触发表单验证 | |||
| this.$refs.form.validate(valid => { | |||
| if (valid) { | |||
| that.confirmLoading = true; | |||
| let httpurl = ''; | |||
| let method = ''; | |||
| if(!this.model.id){ | |||
| httpurl+=this.url.add; | |||
| method = 'post'; | |||
| }else{ | |||
| httpurl+=this.url.edit; | |||
| method = 'put'; | |||
| } | |||
| httpAction(httpurl,this.model,method).then((res)=>{ | |||
| if(res.success){ | |||
| that.$message.success(res.message); | |||
| that.$emit('ok'); | |||
| }else{ | |||
| that.$message.warning(res.message); | |||
| } | |||
| }).finally(() => { | |||
| that.confirmLoading = false; | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,84 @@ | |||
| <template> | |||
| <a-drawer | |||
| :title="title" | |||
| :width="width" | |||
| placement="right" | |||
| :closable="false" | |||
| @close="close" | |||
| destroyOnClose | |||
| :visible="visible"> | |||
| <education-banner-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></education-banner-form> | |||
| <div class="drawer-footer"> | |||
| <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
| <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
| </div> | |||
| </a-drawer> | |||
| </template> | |||
| <script> | |||
| import EducationBannerForm from './EducationBannerForm' | |||
| export default { | |||
| name: 'EducationBannerModal', | |||
| components: { | |||
| EducationBannerForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:"操作", | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }); | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** Button按钮间距 */ | |||
| .ant-btn { | |||
| margin-left: 30px; | |||
| margin-bottom: 30px; | |||
| float: right; | |||
| } | |||
| .drawer-footer{ | |||
| position: absolute; | |||
| bottom: -8px; | |||
| width: 100%; | |||
| border-top: 1px solid #e8e8e8; | |||
| padding: 10px 16px; | |||
| text-align: right; | |||
| left: 0; | |||
| background: #fff; | |||
| border-radius: 0 0 2px 2px; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,60 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <education-banner-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></education-banner-form> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import EducationBannerForm from './EducationBannerForm' | |||
| export default { | |||
| name: 'EducationBannerModal', | |||
| components: { | |||
| EducationBannerForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:'', | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }) | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,61 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import {Modal} from 'ant-design-vue'; | |||
| enum Api { | |||
| list = '/educationBanner/educationBanner/list', | |||
| save='/educationBanner/educationBanner/add', | |||
| edit='/educationBanner/educationBanner/edit', | |||
| deleteOne = '/educationBanner/educationBanner/delete', | |||
| deleteBatch = '/educationBanner/educationBanner/deleteBatch', | |||
| importExcel = '/educationBanner/educationBanner/importExcel', | |||
| exportXls = '/educationBanner/educationBanner/exportXls', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 列表接口 | |||
| * @param params | |||
| */ | |||
| export const list = (params) => | |||
| defHttp.get({url: Api.list, params}); | |||
| /** | |||
| * 删除单个 | |||
| */ | |||
| export const deleteOne = (params,handleSuccess) => { | |||
| return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * @param params | |||
| */ | |||
| export const batchDelete = (params, handleSuccess) => { | |||
| Modal.confirm({ | |||
| title: '确认删除', | |||
| content: '是否删除选中数据', | |||
| okText: '确认', | |||
| cancelText: '取消', | |||
| onOk: () => { | |||
| return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 保存或者更新 | |||
| * @param params | |||
| */ | |||
| export const saveOrUpdate = (params, isUpdate) => { | |||
| let url = isUpdate ? Api.edit : Api.save; | |||
| return defHttp.post({url: url, params}); | |||
| } | |||
| @ -0,0 +1,59 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '标题', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '图片', | |||
| align:"center", | |||
| dataIndex: 'image', | |||
| customRender:render.renderAvatar, | |||
| }, | |||
| { | |||
| title: '分类', | |||
| align:"center", | |||
| dataIndex: 'type_dictText' | |||
| }, | |||
| { | |||
| title: '排序编号', | |||
| align:"center", | |||
| dataIndex: 'orderNo' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '标题', | |||
| field: 'title', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '图片', | |||
| field: 'image', | |||
| component: 'JImageUpload', | |||
| componentProps:{ | |||
| }, | |||
| }, | |||
| { | |||
| label: '分类', | |||
| field: 'type', | |||
| component: 'JDictSelectTag', | |||
| componentProps:{ | |||
| dictCode:"education_type_banner" | |||
| }, | |||
| }, | |||
| { | |||
| label: '排序编号', | |||
| field: 'orderNo', | |||
| component: 'InputNumber', | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,162 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
| <a-dropdown v-if="checkedKeys.length > 0"> | |||
| <template #overlay> | |||
| <a-menu> | |||
| <a-menu-item key="1" @click="batchHandleDelete"> | |||
| <Icon icon="ant-design:delete-outlined"></Icon> | |||
| 删除 | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </template> | |||
| <a-button>批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template #htmlSlot="{text}"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template #fileSlot="{text}"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <EducationBannerModal @register="registerModal" @success="handleSuccess"></EducationBannerModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="educationBanner-educationBanner" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import EducationBannerModal from './components/EducationBannerModal.vue' | |||
| import {columns, searchFormSchema} from './educationBanner.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './educationBanner.api'; | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '轮播图表', | |||
| api: list, | |||
| columns, | |||
| canResize:false, | |||
| formConfig: { | |||
| labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"轮播图表", | |||
| url: getExportUrl, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| function handleAdd() { | |||
| openModal(true, { | |||
| isUpdate: false, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 编辑事件 | |||
| */ | |||
| function handleEdit(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 详情 | |||
| */ | |||
| function handleDetail(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 删除事件 | |||
| */ | |||
| async function handleDelete(record) { | |||
| await deleteOne({id: record.id}, reload); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: checkedKeys.value}, reload); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| } | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| </style> | |||
| @ -0,0 +1,58 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm"/> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../educationBanner.data'; | |||
| import {saveOrUpdate} from '../educationBanner.api'; | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| </style> | |||
| @ -0,0 +1,171 @@ | |||
| package org.jeecg.modules.educationCategoryMajor.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.educationCategoryMajor.entity.EducationCategoryMajor; | |||
| import org.jeecg.modules.educationCategoryMajor.service.IEducationCategoryMajorService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 专业分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="专业分类表") | |||
| @RestController | |||
| @RequestMapping("/educationCategoryMajor/educationCategoryMajor") | |||
| @Slf4j | |||
| public class EducationCategoryMajorController extends JeecgController<EducationCategoryMajor, IEducationCategoryMajorService> { | |||
| @Autowired | |||
| private IEducationCategoryMajorService educationCategoryMajorService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param educationCategoryMajor | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "专业分类表-分页列表查询") | |||
| @ApiOperation(value="专业分类表-分页列表查询", notes="专业分类表-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<EducationCategoryMajor>> queryPageList(EducationCategoryMajor educationCategoryMajor, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<EducationCategoryMajor> queryWrapper = QueryGenerator.initQueryWrapper(educationCategoryMajor, req.getParameterMap()); | |||
| Page<EducationCategoryMajor> page = new Page<EducationCategoryMajor>(pageNo, pageSize); | |||
| IPage<EducationCategoryMajor> pageList = educationCategoryMajorService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param educationCategoryMajor | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "专业分类表-添加") | |||
| @ApiOperation(value="专业分类表-添加", notes="专业分类表-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody EducationCategoryMajor educationCategoryMajor) { | |||
| educationCategoryMajorService.save(educationCategoryMajor); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param educationCategoryMajor | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "专业分类表-编辑") | |||
| @ApiOperation(value="专业分类表-编辑", notes="专业分类表-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody EducationCategoryMajor educationCategoryMajor) { | |||
| educationCategoryMajorService.updateById(educationCategoryMajor); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "专业分类表-通过id删除") | |||
| @ApiOperation(value="专业分类表-通过id删除", notes="专业分类表-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| educationCategoryMajorService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "专业分类表-批量删除") | |||
| @ApiOperation(value="专业分类表-批量删除", notes="专业分类表-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.educationCategoryMajorService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "专业分类表-通过id查询") | |||
| @ApiOperation(value="专业分类表-通过id查询", notes="专业分类表-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<EducationCategoryMajor> queryById(@RequestParam(name="id",required=true) String id) { | |||
| EducationCategoryMajor educationCategoryMajor = educationCategoryMajorService.getById(id); | |||
| if(educationCategoryMajor==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(educationCategoryMajor); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param educationCategoryMajor | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, EducationCategoryMajor educationCategoryMajor) { | |||
| return super.exportXls(request, educationCategoryMajor, EducationCategoryMajor.class, "专业分类表"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, EducationCategoryMajor.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,54 @@ | |||
| package org.jeecg.modules.educationCategoryMajor.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 专业分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("education_category_major") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @ApiModel(value="education_category_major对象", description="专业分类表") | |||
| public class EducationCategoryMajor implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**分类名称*/ | |||
| @Excel(name = "分类名称", width = 15) | |||
| @ApiModelProperty(value = "分类名称") | |||
| private java.lang.String title; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.educationCategoryMajor.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.educationCategoryMajor.entity.EducationCategoryMajor; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 专业分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface EducationCategoryMajorMapper extends BaseMapper<EducationCategoryMajor> { | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| <?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="org.jeecg.modules.educationCategoryMajor.mapper.EducationCategoryMajorMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.educationCategoryMajor.service; | |||
| import org.jeecg.modules.educationCategoryMajor.entity.EducationCategoryMajor; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 专业分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IEducationCategoryMajorService extends IService<EducationCategoryMajor> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.educationCategoryMajor.service.impl; | |||
| import org.jeecg.modules.educationCategoryMajor.entity.EducationCategoryMajor; | |||
| import org.jeecg.modules.educationCategoryMajor.mapper.EducationCategoryMajorMapper; | |||
| import org.jeecg.modules.educationCategoryMajor.service.IEducationCategoryMajorService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 专业分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class EducationCategoryMajorServiceImpl extends ServiceImpl<EducationCategoryMajorMapper, EducationCategoryMajor> implements IEducationCategoryMajorService { | |||
| } | |||
| @ -0,0 +1,171 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('专业分类表')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| :scroll="{x:true}" | |||
| bordered | |||
| rowKey="id" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
| class="j-table-force-nowrap" | |||
| @change="handleTableChange"> | |||
| <template slot="htmlSlot" slot-scope="text"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleDetail(record)">详情</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <education-category-major-modal ref="modalForm" @ok="modalFormOk"></education-category-major-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import '@/assets/less/TableExpand.less' | |||
| import { mixinDevice } from '@/utils/mixin' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import EducationCategoryMajorModal from './modules/EducationCategoryMajorModal' | |||
| export default { | |||
| name: 'EducationCategoryMajorList', | |||
| mixins:[JeecgListMixin, mixinDevice], | |||
| components: { | |||
| EducationCategoryMajorModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '专业分类表管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title: '#', | |||
| dataIndex: '', | |||
| key:'rowIndex', | |||
| width:60, | |||
| align:"center", | |||
| customRender:function (t,r,index) { | |||
| return parseInt(index)+1; | |||
| } | |||
| }, | |||
| { | |||
| title:'分类名称', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' } | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/educationCategoryMajor/educationCategoryMajor/list", | |||
| delete: "/educationCategoryMajor/educationCategoryMajor/delete", | |||
| deleteBatch: "/educationCategoryMajor/educationCategoryMajor/deleteBatch", | |||
| exportXlsUrl: "/educationCategoryMajor/educationCategoryMajor/exportXls", | |||
| importExcelUrl: "educationCategoryMajor/educationCategoryMajor/importExcel", | |||
| }, | |||
| dictOptions:{}, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl: function(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| }, | |||
| methods: { | |||
| initDictConfig(){ | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'string',value:'title',text:'分类名称',dictCode:''}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,60 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <education-category-major-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></education-category-major-form> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import EducationCategoryMajorForm from './EducationCategoryMajorForm' | |||
| export default { | |||
| name: 'EducationCategoryMajorModal', | |||
| components: { | |||
| EducationCategoryMajorForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:'', | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }) | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,61 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import {Modal} from 'ant-design-vue'; | |||
| enum Api { | |||
| list = '/educationCategoryMajor/educationCategoryMajor/list', | |||
| save='/educationCategoryMajor/educationCategoryMajor/add', | |||
| edit='/educationCategoryMajor/educationCategoryMajor/edit', | |||
| deleteOne = '/educationCategoryMajor/educationCategoryMajor/delete', | |||
| deleteBatch = '/educationCategoryMajor/educationCategoryMajor/deleteBatch', | |||
| importExcel = '/educationCategoryMajor/educationCategoryMajor/importExcel', | |||
| exportXls = '/educationCategoryMajor/educationCategoryMajor/exportXls', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 列表接口 | |||
| * @param params | |||
| */ | |||
| export const list = (params) => | |||
| defHttp.get({url: Api.list, params}); | |||
| /** | |||
| * 删除单个 | |||
| */ | |||
| export const deleteOne = (params,handleSuccess) => { | |||
| return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * @param params | |||
| */ | |||
| export const batchDelete = (params, handleSuccess) => { | |||
| Modal.confirm({ | |||
| title: '确认删除', | |||
| content: '是否删除选中数据', | |||
| okText: '确认', | |||
| cancelText: '取消', | |||
| onOk: () => { | |||
| return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 保存或者更新 | |||
| * @param params | |||
| */ | |||
| export const saveOrUpdate = (params, isUpdate) => { | |||
| let url = isUpdate ? Api.edit : Api.save; | |||
| return defHttp.post({url: url, params}); | |||
| } | |||
| @ -0,0 +1,23 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '分类名称', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '分类名称', | |||
| field: 'title', | |||
| component: 'Input', | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,162 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
| <a-dropdown v-if="checkedKeys.length > 0"> | |||
| <template #overlay> | |||
| <a-menu> | |||
| <a-menu-item key="1" @click="batchHandleDelete"> | |||
| <Icon icon="ant-design:delete-outlined"></Icon> | |||
| 删除 | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </template> | |||
| <a-button>批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template #htmlSlot="{text}"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template #fileSlot="{text}"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <EducationCategoryMajorModal @register="registerModal" @success="handleSuccess"></EducationCategoryMajorModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="educationCategoryMajor-educationCategoryMajor" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import EducationCategoryMajorModal from './components/EducationCategoryMajorModal.vue' | |||
| import {columns, searchFormSchema} from './educationCategoryMajor.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './educationCategoryMajor.api'; | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '专业分类表', | |||
| api: list, | |||
| columns, | |||
| canResize:false, | |||
| formConfig: { | |||
| labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"专业分类表", | |||
| url: getExportUrl, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| function handleAdd() { | |||
| openModal(true, { | |||
| isUpdate: false, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 编辑事件 | |||
| */ | |||
| function handleEdit(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 详情 | |||
| */ | |||
| function handleDetail(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 删除事件 | |||
| */ | |||
| async function handleDelete(record) { | |||
| await deleteOne({id: record.id}, reload); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: checkedKeys.value}, reload); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| } | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| </style> | |||
| @ -0,0 +1,58 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm"/> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../educationCategoryMajor.data'; | |||
| import {saveOrUpdate} from '../educationCategoryMajor.api'; | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| </style> | |||
| @ -0,0 +1,171 @@ | |||
| package org.jeecg.modules.educationCategoryPeriod.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.educationCategoryPeriod.entity.EducationCategoryPeriod; | |||
| import org.jeecg.modules.educationCategoryPeriod.service.IEducationCategoryPeriodService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 阶段分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="阶段分类表") | |||
| @RestController | |||
| @RequestMapping("/educationCategoryPeriod/educationCategoryPeriod") | |||
| @Slf4j | |||
| public class EducationCategoryPeriodController extends JeecgController<EducationCategoryPeriod, IEducationCategoryPeriodService> { | |||
| @Autowired | |||
| private IEducationCategoryPeriodService educationCategoryPeriodService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param educationCategoryPeriod | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "阶段分类表-分页列表查询") | |||
| @ApiOperation(value="阶段分类表-分页列表查询", notes="阶段分类表-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<EducationCategoryPeriod>> queryPageList(EducationCategoryPeriod educationCategoryPeriod, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<EducationCategoryPeriod> queryWrapper = QueryGenerator.initQueryWrapper(educationCategoryPeriod, req.getParameterMap()); | |||
| Page<EducationCategoryPeriod> page = new Page<EducationCategoryPeriod>(pageNo, pageSize); | |||
| IPage<EducationCategoryPeriod> pageList = educationCategoryPeriodService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param educationCategoryPeriod | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "阶段分类表-添加") | |||
| @ApiOperation(value="阶段分类表-添加", notes="阶段分类表-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody EducationCategoryPeriod educationCategoryPeriod) { | |||
| educationCategoryPeriodService.save(educationCategoryPeriod); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param educationCategoryPeriod | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "阶段分类表-编辑") | |||
| @ApiOperation(value="阶段分类表-编辑", notes="阶段分类表-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody EducationCategoryPeriod educationCategoryPeriod) { | |||
| educationCategoryPeriodService.updateById(educationCategoryPeriod); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "阶段分类表-通过id删除") | |||
| @ApiOperation(value="阶段分类表-通过id删除", notes="阶段分类表-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| educationCategoryPeriodService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "阶段分类表-批量删除") | |||
| @ApiOperation(value="阶段分类表-批量删除", notes="阶段分类表-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.educationCategoryPeriodService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "阶段分类表-通过id查询") | |||
| @ApiOperation(value="阶段分类表-通过id查询", notes="阶段分类表-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<EducationCategoryPeriod> queryById(@RequestParam(name="id",required=true) String id) { | |||
| EducationCategoryPeriod educationCategoryPeriod = educationCategoryPeriodService.getById(id); | |||
| if(educationCategoryPeriod==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(educationCategoryPeriod); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param educationCategoryPeriod | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, EducationCategoryPeriod educationCategoryPeriod) { | |||
| return super.exportXls(request, educationCategoryPeriod, EducationCategoryPeriod.class, "阶段分类表"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, EducationCategoryPeriod.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,54 @@ | |||
| package org.jeecg.modules.educationCategoryPeriod.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 阶段分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("education_category_period") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @ApiModel(value="education_category_period对象", description="阶段分类表") | |||
| public class EducationCategoryPeriod implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**分类名称*/ | |||
| @Excel(name = "分类名称", width = 15) | |||
| @ApiModelProperty(value = "分类名称") | |||
| private java.lang.String title; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.educationCategoryPeriod.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.educationCategoryPeriod.entity.EducationCategoryPeriod; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 阶段分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface EducationCategoryPeriodMapper extends BaseMapper<EducationCategoryPeriod> { | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| <?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="org.jeecg.modules.educationCategoryPeriod.mapper.EducationCategoryPeriodMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.educationCategoryPeriod.service; | |||
| import org.jeecg.modules.educationCategoryPeriod.entity.EducationCategoryPeriod; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 阶段分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IEducationCategoryPeriodService extends IService<EducationCategoryPeriod> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.educationCategoryPeriod.service.impl; | |||
| import org.jeecg.modules.educationCategoryPeriod.entity.EducationCategoryPeriod; | |||
| import org.jeecg.modules.educationCategoryPeriod.mapper.EducationCategoryPeriodMapper; | |||
| import org.jeecg.modules.educationCategoryPeriod.service.IEducationCategoryPeriodService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 阶段分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class EducationCategoryPeriodServiceImpl extends ServiceImpl<EducationCategoryPeriodMapper, EducationCategoryPeriod> implements IEducationCategoryPeriodService { | |||
| } | |||
| @ -0,0 +1,171 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('阶段分类表')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| :scroll="{x:true}" | |||
| bordered | |||
| rowKey="id" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
| class="j-table-force-nowrap" | |||
| @change="handleTableChange"> | |||
| <template slot="htmlSlot" slot-scope="text"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleDetail(record)">详情</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <education-category-period-modal ref="modalForm" @ok="modalFormOk"></education-category-period-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import '@/assets/less/TableExpand.less' | |||
| import { mixinDevice } from '@/utils/mixin' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import EducationCategoryPeriodModal from './modules/EducationCategoryPeriodModal' | |||
| export default { | |||
| name: 'EducationCategoryPeriodList', | |||
| mixins:[JeecgListMixin, mixinDevice], | |||
| components: { | |||
| EducationCategoryPeriodModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '阶段分类表管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title: '#', | |||
| dataIndex: '', | |||
| key:'rowIndex', | |||
| width:60, | |||
| align:"center", | |||
| customRender:function (t,r,index) { | |||
| return parseInt(index)+1; | |||
| } | |||
| }, | |||
| { | |||
| title:'分类名称', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' } | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/educationCategoryPeriod/educationCategoryPeriod/list", | |||
| delete: "/educationCategoryPeriod/educationCategoryPeriod/delete", | |||
| deleteBatch: "/educationCategoryPeriod/educationCategoryPeriod/deleteBatch", | |||
| exportXlsUrl: "/educationCategoryPeriod/educationCategoryPeriod/exportXls", | |||
| importExcelUrl: "educationCategoryPeriod/educationCategoryPeriod/importExcel", | |||
| }, | |||
| dictOptions:{}, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl: function(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| }, | |||
| methods: { | |||
| initDictConfig(){ | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'string',value:'title',text:'分类名称',dictCode:''}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,60 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <education-category-period-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></education-category-period-form> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import EducationCategoryPeriodForm from './EducationCategoryPeriodForm' | |||
| export default { | |||
| name: 'EducationCategoryPeriodModal', | |||
| components: { | |||
| EducationCategoryPeriodForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:'', | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }) | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,61 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import {Modal} from 'ant-design-vue'; | |||
| enum Api { | |||
| list = '/educationCategoryPeriod/educationCategoryPeriod/list', | |||
| save='/educationCategoryPeriod/educationCategoryPeriod/add', | |||
| edit='/educationCategoryPeriod/educationCategoryPeriod/edit', | |||
| deleteOne = '/educationCategoryPeriod/educationCategoryPeriod/delete', | |||
| deleteBatch = '/educationCategoryPeriod/educationCategoryPeriod/deleteBatch', | |||
| importExcel = '/educationCategoryPeriod/educationCategoryPeriod/importExcel', | |||
| exportXls = '/educationCategoryPeriod/educationCategoryPeriod/exportXls', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 列表接口 | |||
| * @param params | |||
| */ | |||
| export const list = (params) => | |||
| defHttp.get({url: Api.list, params}); | |||
| /** | |||
| * 删除单个 | |||
| */ | |||
| export const deleteOne = (params,handleSuccess) => { | |||
| return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * @param params | |||
| */ | |||
| export const batchDelete = (params, handleSuccess) => { | |||
| Modal.confirm({ | |||
| title: '确认删除', | |||
| content: '是否删除选中数据', | |||
| okText: '确认', | |||
| cancelText: '取消', | |||
| onOk: () => { | |||
| return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 保存或者更新 | |||
| * @param params | |||
| */ | |||
| export const saveOrUpdate = (params, isUpdate) => { | |||
| let url = isUpdate ? Api.edit : Api.save; | |||
| return defHttp.post({url: url, params}); | |||
| } | |||
| @ -0,0 +1,23 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '分类名称', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '分类名称', | |||
| field: 'title', | |||
| component: 'Input', | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,162 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
| <a-dropdown v-if="checkedKeys.length > 0"> | |||
| <template #overlay> | |||
| <a-menu> | |||
| <a-menu-item key="1" @click="batchHandleDelete"> | |||
| <Icon icon="ant-design:delete-outlined"></Icon> | |||
| 删除 | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </template> | |||
| <a-button>批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template #htmlSlot="{text}"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template #fileSlot="{text}"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <EducationCategoryPeriodModal @register="registerModal" @success="handleSuccess"></EducationCategoryPeriodModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="educationCategoryPeriod-educationCategoryPeriod" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import EducationCategoryPeriodModal from './components/EducationCategoryPeriodModal.vue' | |||
| import {columns, searchFormSchema} from './educationCategoryPeriod.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './educationCategoryPeriod.api'; | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '阶段分类表', | |||
| api: list, | |||
| columns, | |||
| canResize:false, | |||
| formConfig: { | |||
| labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"阶段分类表", | |||
| url: getExportUrl, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| function handleAdd() { | |||
| openModal(true, { | |||
| isUpdate: false, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 编辑事件 | |||
| */ | |||
| function handleEdit(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 详情 | |||
| */ | |||
| function handleDetail(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 删除事件 | |||
| */ | |||
| async function handleDelete(record) { | |||
| await deleteOne({id: record.id}, reload); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: checkedKeys.value}, reload); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| } | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| </style> | |||
| @ -0,0 +1,58 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm"/> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../educationCategoryPeriod.data'; | |||
| import {saveOrUpdate} from '../educationCategoryPeriod.api'; | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| </style> | |||
| @ -0,0 +1,171 @@ | |||
| package org.jeecg.modules.educationCategoryService.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.educationCategoryService.entity.EducationCategoryService; | |||
| import org.jeecg.modules.educationCategoryService.service.IEducationCategoryServiceService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 服务分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="服务分类表") | |||
| @RestController | |||
| @RequestMapping("/educationCategoryService/educationCategoryService") | |||
| @Slf4j | |||
| public class EducationCategoryServiceController extends JeecgController<EducationCategoryService, IEducationCategoryServiceService> { | |||
| @Autowired | |||
| private IEducationCategoryServiceService educationCategoryServiceService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param educationCategoryService | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "服务分类表-分页列表查询") | |||
| @ApiOperation(value="服务分类表-分页列表查询", notes="服务分类表-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<EducationCategoryService>> queryPageList(EducationCategoryService educationCategoryService, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<EducationCategoryService> queryWrapper = QueryGenerator.initQueryWrapper(educationCategoryService, req.getParameterMap()); | |||
| Page<EducationCategoryService> page = new Page<EducationCategoryService>(pageNo, pageSize); | |||
| IPage<EducationCategoryService> pageList = educationCategoryServiceService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param educationCategoryService | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "服务分类表-添加") | |||
| @ApiOperation(value="服务分类表-添加", notes="服务分类表-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody EducationCategoryService educationCategoryService) { | |||
| educationCategoryServiceService.save(educationCategoryService); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param educationCategoryService | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "服务分类表-编辑") | |||
| @ApiOperation(value="服务分类表-编辑", notes="服务分类表-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody EducationCategoryService educationCategoryService) { | |||
| educationCategoryServiceService.updateById(educationCategoryService); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "服务分类表-通过id删除") | |||
| @ApiOperation(value="服务分类表-通过id删除", notes="服务分类表-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| educationCategoryServiceService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "服务分类表-批量删除") | |||
| @ApiOperation(value="服务分类表-批量删除", notes="服务分类表-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.educationCategoryServiceService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "服务分类表-通过id查询") | |||
| @ApiOperation(value="服务分类表-通过id查询", notes="服务分类表-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<EducationCategoryService> queryById(@RequestParam(name="id",required=true) String id) { | |||
| EducationCategoryService educationCategoryService = educationCategoryServiceService.getById(id); | |||
| if(educationCategoryService==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(educationCategoryService); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param educationCategoryService | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, EducationCategoryService educationCategoryService) { | |||
| return super.exportXls(request, educationCategoryService, EducationCategoryService.class, "服务分类表"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, EducationCategoryService.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,54 @@ | |||
| package org.jeecg.modules.educationCategoryService.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 服务分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("education_category_service") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @ApiModel(value="education_category_service对象", description="服务分类表") | |||
| public class EducationCategoryService implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**分类名称*/ | |||
| @Excel(name = "分类名称", width = 15) | |||
| @ApiModelProperty(value = "分类名称") | |||
| private java.lang.String title; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.educationCategoryService.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.educationCategoryService.entity.EducationCategoryService; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 服务分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface EducationCategoryServiceMapper extends BaseMapper<EducationCategoryService> { | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| <?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="org.jeecg.modules.educationCategoryService.mapper.EducationCategoryServiceMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.educationCategoryService.service; | |||
| import org.jeecg.modules.educationCategoryService.entity.EducationCategoryService; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 服务分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IEducationCategoryServiceService extends IService<EducationCategoryService> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.educationCategoryService.service.impl; | |||
| import org.jeecg.modules.educationCategoryService.entity.EducationCategoryService; | |||
| import org.jeecg.modules.educationCategoryService.mapper.EducationCategoryServiceMapper; | |||
| import org.jeecg.modules.educationCategoryService.service.IEducationCategoryServiceService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 服务分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class EducationCategoryServiceServiceImpl extends ServiceImpl<EducationCategoryServiceMapper, EducationCategoryService> implements IEducationCategoryServiceService { | |||
| } | |||
| @ -0,0 +1,171 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('服务分类表')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| :scroll="{x:true}" | |||
| bordered | |||
| rowKey="id" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
| class="j-table-force-nowrap" | |||
| @change="handleTableChange"> | |||
| <template slot="htmlSlot" slot-scope="text"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleDetail(record)">详情</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <education-category-service-modal ref="modalForm" @ok="modalFormOk"></education-category-service-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import '@/assets/less/TableExpand.less' | |||
| import { mixinDevice } from '@/utils/mixin' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import EducationCategoryServiceModal from './modules/EducationCategoryServiceModal' | |||
| export default { | |||
| name: 'EducationCategoryServiceList', | |||
| mixins:[JeecgListMixin, mixinDevice], | |||
| components: { | |||
| EducationCategoryServiceModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '服务分类表管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title: '#', | |||
| dataIndex: '', | |||
| key:'rowIndex', | |||
| width:60, | |||
| align:"center", | |||
| customRender:function (t,r,index) { | |||
| return parseInt(index)+1; | |||
| } | |||
| }, | |||
| { | |||
| title:'分类名称', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' } | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/educationCategoryService/educationCategoryService/list", | |||
| delete: "/educationCategoryService/educationCategoryService/delete", | |||
| deleteBatch: "/educationCategoryService/educationCategoryService/deleteBatch", | |||
| exportXlsUrl: "/educationCategoryService/educationCategoryService/exportXls", | |||
| importExcelUrl: "educationCategoryService/educationCategoryService/importExcel", | |||
| }, | |||
| dictOptions:{}, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl: function(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| }, | |||
| methods: { | |||
| initDictConfig(){ | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'string',value:'title',text:'分类名称',dictCode:''}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,60 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <education-category-service-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></education-category-service-form> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import EducationCategoryServiceForm from './EducationCategoryServiceForm' | |||
| export default { | |||
| name: 'EducationCategoryServiceModal', | |||
| components: { | |||
| EducationCategoryServiceForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:'', | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }) | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,61 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import {Modal} from 'ant-design-vue'; | |||
| enum Api { | |||
| list = '/educationCategoryService/educationCategoryService/list', | |||
| save='/educationCategoryService/educationCategoryService/add', | |||
| edit='/educationCategoryService/educationCategoryService/edit', | |||
| deleteOne = '/educationCategoryService/educationCategoryService/delete', | |||
| deleteBatch = '/educationCategoryService/educationCategoryService/deleteBatch', | |||
| importExcel = '/educationCategoryService/educationCategoryService/importExcel', | |||
| exportXls = '/educationCategoryService/educationCategoryService/exportXls', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 列表接口 | |||
| * @param params | |||
| */ | |||
| export const list = (params) => | |||
| defHttp.get({url: Api.list, params}); | |||
| /** | |||
| * 删除单个 | |||
| */ | |||
| export const deleteOne = (params,handleSuccess) => { | |||
| return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * @param params | |||
| */ | |||
| export const batchDelete = (params, handleSuccess) => { | |||
| Modal.confirm({ | |||
| title: '确认删除', | |||
| content: '是否删除选中数据', | |||
| okText: '确认', | |||
| cancelText: '取消', | |||
| onOk: () => { | |||
| return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 保存或者更新 | |||
| * @param params | |||
| */ | |||
| export const saveOrUpdate = (params, isUpdate) => { | |||
| let url = isUpdate ? Api.edit : Api.save; | |||
| return defHttp.post({url: url, params}); | |||
| } | |||
| @ -0,0 +1,23 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '分类名称', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '分类名称', | |||
| field: 'title', | |||
| component: 'Input', | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,162 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
| <a-dropdown v-if="checkedKeys.length > 0"> | |||
| <template #overlay> | |||
| <a-menu> | |||
| <a-menu-item key="1" @click="batchHandleDelete"> | |||
| <Icon icon="ant-design:delete-outlined"></Icon> | |||
| 删除 | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </template> | |||
| <a-button>批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template #htmlSlot="{text}"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template #fileSlot="{text}"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <EducationCategoryServiceModal @register="registerModal" @success="handleSuccess"></EducationCategoryServiceModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="educationCategoryService-educationCategoryService" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import EducationCategoryServiceModal from './components/EducationCategoryServiceModal.vue' | |||
| import {columns, searchFormSchema} from './educationCategoryService.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './educationCategoryService.api'; | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '服务分类表', | |||
| api: list, | |||
| columns, | |||
| canResize:false, | |||
| formConfig: { | |||
| labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"服务分类表", | |||
| url: getExportUrl, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| function handleAdd() { | |||
| openModal(true, { | |||
| isUpdate: false, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 编辑事件 | |||
| */ | |||
| function handleEdit(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 详情 | |||
| */ | |||
| function handleDetail(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 删除事件 | |||
| */ | |||
| async function handleDelete(record) { | |||
| await deleteOne({id: record.id}, reload); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: checkedKeys.value}, reload); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| } | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| </style> | |||
| @ -0,0 +1,58 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm"/> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../educationCategoryService.data'; | |||
| import {saveOrUpdate} from '../educationCategoryService.api'; | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| </style> | |||
| @ -0,0 +1,229 @@ | |||
| package org.jeecg.modules.educationCategoryThesis.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.educationCategoryThesis.entity.EducationCategoryThesis; | |||
| import org.jeecg.modules.educationCategoryThesis.service.IEducationCategoryThesisService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 论文分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="论文分类表") | |||
| @RestController | |||
| @RequestMapping("/educationCategoryThesis/educationCategoryThesis") | |||
| @Slf4j | |||
| public class EducationCategoryThesisController extends JeecgController<EducationCategoryThesis, IEducationCategoryThesisService>{ | |||
| @Autowired | |||
| private IEducationCategoryThesisService educationCategoryThesisService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param educationCategoryThesis | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "论文分类表-分页列表查询") | |||
| @ApiOperation(value="论文分类表-分页列表查询", notes="论文分类表-分页列表查询") | |||
| @GetMapping(value = "/rootList") | |||
| public Result<IPage<EducationCategoryThesis>> queryPageList(EducationCategoryThesis educationCategoryThesis, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| String hasQuery = req.getParameter("hasQuery"); | |||
| if(hasQuery != null && "true".equals(hasQuery)){ | |||
| QueryWrapper<EducationCategoryThesis> queryWrapper = QueryGenerator.initQueryWrapper(educationCategoryThesis, req.getParameterMap()); | |||
| List<EducationCategoryThesis> list = educationCategoryThesisService.queryTreeListNoPage(queryWrapper); | |||
| IPage<EducationCategoryThesis> pageList = new Page<>(1, 10, list.size()); | |||
| pageList.setRecords(list); | |||
| return Result.OK(pageList); | |||
| }else{ | |||
| String parentId = educationCategoryThesis.getPid(); | |||
| if (oConvertUtils.isEmpty(parentId)) { | |||
| parentId = "0"; | |||
| } | |||
| educationCategoryThesis.setPid(null); | |||
| QueryWrapper<EducationCategoryThesis> queryWrapper = QueryGenerator.initQueryWrapper(educationCategoryThesis, req.getParameterMap()); | |||
| // 使用 eq 防止模糊查询 | |||
| queryWrapper.eq("pid", parentId); | |||
| Page<EducationCategoryThesis> page = new Page<EducationCategoryThesis>(pageNo, pageSize); | |||
| IPage<EducationCategoryThesis> pageList = educationCategoryThesisService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| } | |||
| /** | |||
| * 获取子数据 | |||
| * @param educationCategoryThesis | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "论文分类表-获取子数据") | |||
| @ApiOperation(value="论文分类表-获取子数据", notes="论文分类表-获取子数据") | |||
| @GetMapping(value = "/childList") | |||
| public Result<IPage<EducationCategoryThesis>> queryPageList(EducationCategoryThesis educationCategoryThesis,HttpServletRequest req) { | |||
| QueryWrapper<EducationCategoryThesis> queryWrapper = QueryGenerator.initQueryWrapper(educationCategoryThesis, req.getParameterMap()); | |||
| List<EducationCategoryThesis> list = educationCategoryThesisService.list(queryWrapper); | |||
| IPage<EducationCategoryThesis> pageList = new Page<>(1, 10, list.size()); | |||
| pageList.setRecords(list); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 批量查询子节点 | |||
| * @param parentIds 父ID(多个采用半角逗号分割) | |||
| * @return 返回 IPage | |||
| * @param parentIds | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "论文分类表-批量获取子数据") | |||
| @ApiOperation(value="论文分类表-批量获取子数据", notes="论文分类表-批量获取子数据") | |||
| @GetMapping("/getChildListBatch") | |||
| public Result getChildListBatch(@RequestParam("parentIds") String parentIds) { | |||
| try { | |||
| QueryWrapper<EducationCategoryThesis> queryWrapper = new QueryWrapper<>(); | |||
| List<String> parentIdList = Arrays.asList(parentIds.split(",")); | |||
| queryWrapper.in("pid", parentIdList); | |||
| List<EducationCategoryThesis> list = educationCategoryThesisService.list(queryWrapper); | |||
| IPage<EducationCategoryThesis> pageList = new Page<>(1, 10, list.size()); | |||
| pageList.setRecords(list); | |||
| return Result.OK(pageList); | |||
| } catch (Exception e) { | |||
| log.error(e.getMessage(), e); | |||
| return Result.error("批量查询子节点失败:" + e.getMessage()); | |||
| } | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param educationCategoryThesis | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "论文分类表-添加") | |||
| @ApiOperation(value="论文分类表-添加", notes="论文分类表-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody EducationCategoryThesis educationCategoryThesis) { | |||
| educationCategoryThesisService.addEducationCategoryThesis(educationCategoryThesis); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param educationCategoryThesis | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "论文分类表-编辑") | |||
| @ApiOperation(value="论文分类表-编辑", notes="论文分类表-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody EducationCategoryThesis educationCategoryThesis) { | |||
| educationCategoryThesisService.updateEducationCategoryThesis(educationCategoryThesis); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "论文分类表-通过id删除") | |||
| @ApiOperation(value="论文分类表-通过id删除", notes="论文分类表-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| educationCategoryThesisService.deleteEducationCategoryThesis(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "论文分类表-批量删除") | |||
| @ApiOperation(value="论文分类表-批量删除", notes="论文分类表-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.educationCategoryThesisService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "论文分类表-通过id查询") | |||
| @ApiOperation(value="论文分类表-通过id查询", notes="论文分类表-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<EducationCategoryThesis> queryById(@RequestParam(name="id",required=true) String id) { | |||
| EducationCategoryThesis educationCategoryThesis = educationCategoryThesisService.getById(id); | |||
| if(educationCategoryThesis==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(educationCategoryThesis); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param educationCategoryThesis | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, EducationCategoryThesis educationCategoryThesis) { | |||
| return super.exportXls(request, educationCategoryThesis, EducationCategoryThesis.class, "论文分类表"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, EducationCategoryThesis.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,59 @@ | |||
| package org.jeecg.modules.educationCategoryThesis.entity; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import java.io.UnsupportedEncodingException; | |||
| /** | |||
| * @Description: 论文分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("education_category_thesis") | |||
| @ApiModel(value="education_category_thesis对象", description="论文分类表") | |||
| public class EducationCategoryThesis implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**分类名称*/ | |||
| @Excel(name = "分类名称", width = 15) | |||
| @ApiModelProperty(value = "分类名称") | |||
| private java.lang.String title; | |||
| /**父级节点*/ | |||
| @Excel(name = "父级节点", width = 15) | |||
| @ApiModelProperty(value = "父级节点") | |||
| private java.lang.String pid; | |||
| /**是否有子节点*/ | |||
| @Excel(name = "是否有子节点", width = 15, dicCode = "yn") | |||
| @Dict(dicCode = "yn") | |||
| @ApiModelProperty(value = "是否有子节点") | |||
| private java.lang.String hasChild; | |||
| } | |||
| @ -0,0 +1,22 @@ | |||
| package org.jeecg.modules.educationCategoryThesis.mapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.educationCategoryThesis.entity.EducationCategoryThesis; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 论文分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface EducationCategoryThesisMapper extends BaseMapper<EducationCategoryThesis> { | |||
| /** | |||
| * 编辑节点状态 | |||
| * @param id | |||
| * @param status | |||
| */ | |||
| void updateTreeNodeStatus(@Param("id") String id,@Param("status") String status); | |||
| } | |||
| @ -0,0 +1,9 @@ | |||
| <?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="org.jeecg.modules.educationCategoryThesis.mapper.EducationCategoryThesisMapper"> | |||
| <update id="updateTreeNodeStatus" parameterType="java.lang.String"> | |||
| update education_category_thesis set has_child = #{status} where id = #{id} | |||
| </update> | |||
| </mapper> | |||
| @ -0,0 +1,38 @@ | |||
| package org.jeecg.modules.educationCategoryThesis.service; | |||
| import org.jeecg.modules.educationCategoryThesis.entity.EducationCategoryThesis; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| import org.jeecg.common.exception.JeecgBootException; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import java.util.List; | |||
| /** | |||
| * @Description: 论文分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IEducationCategoryThesisService extends IService<EducationCategoryThesis> { | |||
| /**根节点父ID的值*/ | |||
| public static final String ROOT_PID_VALUE = "0"; | |||
| /**树节点有子节点状态值*/ | |||
| public static final String HASCHILD = "1"; | |||
| /**树节点无子节点状态值*/ | |||
| public static final String NOCHILD = "0"; | |||
| /**新增节点*/ | |||
| void addEducationCategoryThesis(EducationCategoryThesis educationCategoryThesis); | |||
| /**修改节点*/ | |||
| void updateEducationCategoryThesis(EducationCategoryThesis educationCategoryThesis) throws JeecgBootException; | |||
| /**删除节点*/ | |||
| void deleteEducationCategoryThesis(String id) throws JeecgBootException; | |||
| /**查询所有数据,无分页*/ | |||
| List<EducationCategoryThesis> queryTreeListNoPage(QueryWrapper<EducationCategoryThesis> queryWrapper); | |||
| } | |||
| @ -0,0 +1,191 @@ | |||
| package org.jeecg.modules.educationCategoryThesis.service.impl; | |||
| import org.jeecg.common.exception.JeecgBootException; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.educationCategoryThesis.entity.EducationCategoryThesis; | |||
| import org.jeecg.modules.educationCategoryThesis.mapper.EducationCategoryThesisMapper; | |||
| import org.jeecg.modules.educationCategoryThesis.service.IEducationCategoryThesisService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.util.ArrayList; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 论文分类表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class EducationCategoryThesisServiceImpl extends ServiceImpl<EducationCategoryThesisMapper, EducationCategoryThesis> implements IEducationCategoryThesisService { | |||
| @Override | |||
| public void addEducationCategoryThesis(EducationCategoryThesis educationCategoryThesis) { | |||
| //新增时设置hasChild为0 | |||
| educationCategoryThesis.setHasChild(IEducationCategoryThesisService.NOCHILD); | |||
| if(oConvertUtils.isEmpty(educationCategoryThesis.getPid())){ | |||
| educationCategoryThesis.setPid(IEducationCategoryThesisService.ROOT_PID_VALUE); | |||
| }else{ | |||
| //如果当前节点父ID不为空 则设置父节点的hasChildren 为1 | |||
| EducationCategoryThesis parent = baseMapper.selectById(educationCategoryThesis.getPid()); | |||
| if(parent!=null && !"1".equals(parent.getHasChild())){ | |||
| parent.setHasChild("1"); | |||
| baseMapper.updateById(parent); | |||
| } | |||
| } | |||
| baseMapper.insert(educationCategoryThesis); | |||
| } | |||
| @Override | |||
| public void updateEducationCategoryThesis(EducationCategoryThesis educationCategoryThesis) { | |||
| EducationCategoryThesis entity = this.getById(educationCategoryThesis.getId()); | |||
| if(entity==null) { | |||
| throw new JeecgBootException("未找到对应实体"); | |||
| } | |||
| String old_pid = entity.getPid(); | |||
| String new_pid = educationCategoryThesis.getPid(); | |||
| if(!old_pid.equals(new_pid)) { | |||
| updateOldParentNode(old_pid); | |||
| if(oConvertUtils.isEmpty(new_pid)){ | |||
| educationCategoryThesis.setPid(IEducationCategoryThesisService.ROOT_PID_VALUE); | |||
| } | |||
| if(!IEducationCategoryThesisService.ROOT_PID_VALUE.equals(educationCategoryThesis.getPid())) { | |||
| baseMapper.updateTreeNodeStatus(educationCategoryThesis.getPid(), IEducationCategoryThesisService.HASCHILD); | |||
| } | |||
| } | |||
| baseMapper.updateById(educationCategoryThesis); | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = Exception.class) | |||
| public void deleteEducationCategoryThesis(String id) throws JeecgBootException { | |||
| //查询选中节点下所有子节点一并删除 | |||
| id = this.queryTreeChildIds(id); | |||
| if(id.indexOf(",")>0) { | |||
| StringBuffer sb = new StringBuffer(); | |||
| String[] idArr = id.split(","); | |||
| for (String idVal : idArr) { | |||
| if(idVal != null){ | |||
| EducationCategoryThesis educationCategoryThesis = this.getById(idVal); | |||
| String pidVal = educationCategoryThesis.getPid(); | |||
| //查询此节点上一级是否还有其他子节点 | |||
| List<EducationCategoryThesis> dataList = baseMapper.selectList(new QueryWrapper<EducationCategoryThesis>().eq("pid", pidVal).notIn("id",Arrays.asList(idArr))); | |||
| if((dataList == null || dataList.size()==0) && !Arrays.asList(idArr).contains(pidVal) | |||
| && !sb.toString().contains(pidVal)){ | |||
| //如果当前节点原本有子节点 现在木有了,更新状态 | |||
| sb.append(pidVal).append(","); | |||
| } | |||
| } | |||
| } | |||
| //批量删除节点 | |||
| baseMapper.deleteBatchIds(Arrays.asList(idArr)); | |||
| //修改已无子节点的标识 | |||
| String[] pidArr = sb.toString().split(","); | |||
| for(String pid : pidArr){ | |||
| this.updateOldParentNode(pid); | |||
| } | |||
| }else{ | |||
| EducationCategoryThesis educationCategoryThesis = this.getById(id); | |||
| if(educationCategoryThesis==null) { | |||
| throw new JeecgBootException("未找到对应实体"); | |||
| } | |||
| updateOldParentNode(educationCategoryThesis.getPid()); | |||
| baseMapper.deleteById(id); | |||
| } | |||
| } | |||
| @Override | |||
| public List<EducationCategoryThesis> queryTreeListNoPage(QueryWrapper<EducationCategoryThesis> queryWrapper) { | |||
| List<EducationCategoryThesis> dataList = baseMapper.selectList(queryWrapper); | |||
| List<EducationCategoryThesis> mapList = new ArrayList<>(); | |||
| for(EducationCategoryThesis data : dataList){ | |||
| String pidVal = data.getPid(); | |||
| //递归查询子节点的根节点 | |||
| if(pidVal != null && !"0".equals(pidVal)){ | |||
| EducationCategoryThesis rootVal = this.getTreeRoot(pidVal); | |||
| if(rootVal != null && !mapList.contains(rootVal)){ | |||
| mapList.add(rootVal); | |||
| } | |||
| }else{ | |||
| if(!mapList.contains(data)){ | |||
| mapList.add(data); | |||
| } | |||
| } | |||
| } | |||
| return mapList; | |||
| } | |||
| /** | |||
| * 根据所传pid查询旧的父级节点的子节点并修改相应状态值 | |||
| * @param pid | |||
| */ | |||
| private void updateOldParentNode(String pid) { | |||
| if(!IEducationCategoryThesisService.ROOT_PID_VALUE.equals(pid)) { | |||
| Integer count = Math.toIntExact(baseMapper.selectCount(new QueryWrapper<EducationCategoryThesis>().eq("pid", pid))); | |||
| if(count==null || count<=1) { | |||
| baseMapper.updateTreeNodeStatus(pid, IEducationCategoryThesisService.NOCHILD); | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * 递归查询节点的根节点 | |||
| * @param pidVal | |||
| * @return | |||
| */ | |||
| private EducationCategoryThesis getTreeRoot(String pidVal){ | |||
| EducationCategoryThesis data = baseMapper.selectById(pidVal); | |||
| if(data != null && !"0".equals(data.getPid())){ | |||
| return this.getTreeRoot(data.getPid()); | |||
| }else{ | |||
| return data; | |||
| } | |||
| } | |||
| /** | |||
| * 根据id查询所有子节点id | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| private String queryTreeChildIds(String ids) { | |||
| //获取id数组 | |||
| String[] idArr = ids.split(","); | |||
| StringBuffer sb = new StringBuffer(); | |||
| for (String pidVal : idArr) { | |||
| if(pidVal != null){ | |||
| if(!sb.toString().contains(pidVal)){ | |||
| if(sb.toString().length() > 0){ | |||
| sb.append(","); | |||
| } | |||
| sb.append(pidVal); | |||
| this.getTreeChildIds(pidVal,sb); | |||
| } | |||
| } | |||
| } | |||
| return sb.toString(); | |||
| } | |||
| /** | |||
| * 递归查询所有子节点 | |||
| * @param pidVal | |||
| * @param sb | |||
| * @return | |||
| */ | |||
| private StringBuffer getTreeChildIds(String pidVal,StringBuffer sb){ | |||
| List<EducationCategoryThesis> dataList = baseMapper.selectList(new QueryWrapper<EducationCategoryThesis>().eq("pid", pidVal)); | |||
| if(dataList != null && dataList.size()>0){ | |||
| for(EducationCategoryThesis tree : dataList) { | |||
| if(!sb.toString().contains(tree.getId())){ | |||
| sb.append(",").append(tree.getId()); | |||
| } | |||
| this.getTreeChildIds(tree.getId(),sb); | |||
| } | |||
| } | |||
| return sb; | |||
| } | |||
| } | |||
| @ -0,0 +1,347 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('论文分类表')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| rowKey="id" | |||
| class="j-table-force-nowrap" | |||
| :scroll="{x:true}" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :expandedRowKeys="expandedRowKeys" | |||
| @change="handleTableChange" | |||
| @expand="handleExpand" | |||
| v-bind="tableProps"> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleAddChild(record)">添加下级</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDeleteNode(record.id)" placement="topLeft"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <educationCategoryThesis-modal ref="modalForm" @ok="modalFormOk"></educationCategoryThesis-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import { getAction, deleteAction } from '@/api/manage' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import EducationCategoryThesisModal from './modules/EducationCategoryThesisModal' | |||
| import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |||
| import { filterObj } from '@/utils/util'; | |||
| export default { | |||
| name: "EducationCategoryThesisList", | |||
| mixins:[JeecgListMixin], | |||
| components: { | |||
| EducationCategoryThesisModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '论文分类表管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title:'分类名称', | |||
| align:"left", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' }, | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/educationCategoryThesis/educationCategoryThesis/rootList", | |||
| childList: "/educationCategoryThesis/educationCategoryThesis/childList", | |||
| getChildListBatch: "/educationCategoryThesis/educationCategoryThesis/getChildListBatch", | |||
| delete: "/educationCategoryThesis/educationCategoryThesis/delete", | |||
| deleteBatch: "/educationCategoryThesis/educationCategoryThesis/deleteBatch", | |||
| exportXlsUrl: "/educationCategoryThesis/educationCategoryThesis/exportXls", | |||
| importExcelUrl: "educationCategoryThesis/educationCategoryThesis/importExcel", | |||
| }, | |||
| expandedRowKeys:[], | |||
| hasChildrenField:"hasChild", | |||
| pidField:"pid", | |||
| dictOptions: {}, | |||
| loadParent: false, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| tableProps() { | |||
| let _this = this | |||
| return { | |||
| // 列表项是否可选择 | |||
| rowSelection: { | |||
| selectedRowKeys: _this.selectedRowKeys, | |||
| onChange: (selectedRowKeys) => _this.selectedRowKeys = selectedRowKeys | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| methods: { | |||
| loadData(arg){ | |||
| if(arg==1){ | |||
| this.ipagination.current=1 | |||
| } | |||
| this.loading = true | |||
| let params = this.getQueryParams() | |||
| params.hasQuery = 'true' | |||
| getAction(this.url.list,params).then(res=>{ | |||
| if(res.success){ | |||
| let result = res.result | |||
| if(Number(result.total)>0){ | |||
| this.ipagination.total = Number(result.total) | |||
| this.dataSource = this.getDataByResult(res.result.records) | |||
| return this.loadDataByExpandedRows(this.dataSource) | |||
| }else{ | |||
| this.ipagination.total=0 | |||
| this.dataSource=[] | |||
| } | |||
| }else{ | |||
| this.$message.warning(res.message) | |||
| } | |||
| }).finally(()=>{ | |||
| this.loading = false | |||
| }) | |||
| }, | |||
| // 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据) | |||
| loadDataByExpandedRows(dataList) { | |||
| if (this.expandedRowKeys.length > 0) { | |||
| return getAction(this.url.getChildListBatch,{ parentIds: this.expandedRowKeys.join(',') }).then(res=>{ | |||
| if (res.success && res.result.records.length>0) { | |||
| //已展开的数据批量子节点 | |||
| let records = res.result.records | |||
| const listMap = new Map(); | |||
| for (let item of records) { | |||
| let pid = item[this.pidField]; | |||
| if (this.expandedRowKeys.join(',').includes(pid)) { | |||
| let mapList = listMap.get(pid); | |||
| if (mapList == null) { | |||
| mapList = []; | |||
| } | |||
| mapList.push(item); | |||
| listMap.set(pid, mapList); | |||
| } | |||
| } | |||
| let childrenMap = listMap; | |||
| let fn = (list) => { | |||
| if(list) { | |||
| list.forEach(data => { | |||
| if (this.expandedRowKeys.includes(data.id)) { | |||
| data.children = this.getDataByResult(childrenMap.get(data.id)) | |||
| fn(data.children) | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| fn(dataList) | |||
| } | |||
| }) | |||
| } else { | |||
| return Promise.resolve() | |||
| } | |||
| }, | |||
| getQueryParams(arg) { | |||
| //获取查询条件 | |||
| let sqp = {} | |||
| let param = {} | |||
| if(this.superQueryParams){ | |||
| sqp['superQueryParams']=encodeURI(this.superQueryParams) | |||
| sqp['superQueryMatchType'] = this.superQueryMatchType | |||
| } | |||
| if(arg){ | |||
| param = Object.assign(sqp, this.isorter ,this.filters); | |||
| }else{ | |||
| param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters); | |||
| } | |||
| if(JSON.stringify(this.queryParam) === "{}" || arg){ | |||
| param.hasQuery = 'false' | |||
| }else{ | |||
| param.hasQuery = 'true' | |||
| } | |||
| param.field = this.getQueryField(); | |||
| param.pageNo = this.ipagination.current; | |||
| param.pageSize = this.ipagination.pageSize; | |||
| return filterObj(param); | |||
| }, | |||
| searchReset() { | |||
| //重置 | |||
| this.expandedRowKeys = [] | |||
| this.queryParam = {} | |||
| this.loadData(1); | |||
| }, | |||
| getDataByResult(result){ | |||
| if(result){ | |||
| return result.map(item=>{ | |||
| //判断是否标记了带有子节点 | |||
| if(item[this.hasChildrenField]=='1'){ | |||
| let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true } | |||
| item.children = [loadChild] | |||
| } | |||
| return item | |||
| }) | |||
| } | |||
| }, | |||
| handleExpand(expanded, record){ | |||
| // 判断是否是展开状态 | |||
| if (expanded) { | |||
| this.expandedRowKeys.push(record.id) | |||
| if (record.children.length>0 && record.children[0].isLoading === true) { | |||
| let params = this.getQueryParams(1);//查询条件 | |||
| params[this.pidField] = record.id | |||
| params.hasQuery = 'false' | |||
| params.superQueryParams="" | |||
| getAction(this.url.childList,params).then((res)=>{ | |||
| if(res.success){ | |||
| if(res.result.records){ | |||
| record.children = this.getDataByResult(res.result.records) | |||
| this.dataSource = [...this.dataSource] | |||
| }else{ | |||
| record.children='' | |||
| record.hasChildrenField='0' | |||
| } | |||
| }else{ | |||
| this.$message.warning(res.message) | |||
| } | |||
| }) | |||
| } | |||
| }else{ | |||
| let keyIndex = this.expandedRowKeys.indexOf(record.id) | |||
| if(keyIndex>=0){ | |||
| this.expandedRowKeys.splice(keyIndex, 1); | |||
| } | |||
| } | |||
| }, | |||
| handleAddChild(record){ | |||
| this.loadParent = true | |||
| let obj = {} | |||
| obj[this.pidField] = record['id'] | |||
| this.$refs.modalForm.add(obj); | |||
| }, | |||
| handleDeleteNode(id) { | |||
| if(!this.url.delete){ | |||
| this.$message.error("请设置url.delete属性!") | |||
| return | |||
| } | |||
| var that = this; | |||
| deleteAction(that.url.delete, {id: id}).then((res) => { | |||
| if (res.success) { | |||
| that.loadData(1) | |||
| } else { | |||
| that.$message.warning(res.message); | |||
| } | |||
| }); | |||
| }, | |||
| batchDel(){ | |||
| if(this.selectedRowKeys.length<=0){ | |||
| this.$message.warning('请选择一条记录!'); | |||
| return false; | |||
| }else{ | |||
| let ids = ""; | |||
| let that = this; | |||
| that.selectedRowKeys.forEach(function(val) { | |||
| ids+=val+","; | |||
| }); | |||
| that.$confirm({ | |||
| title:"确认删除", | |||
| content:"是否删除选中数据?", | |||
| onOk: function(){ | |||
| that.handleDeleteNode(ids) | |||
| that.onClearSelected(); | |||
| } | |||
| }); | |||
| } | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'string',value:'title',text:'分类名称',dictCode:''}) | |||
| fieldList.push({type:'string',value:'pid',text:'父级节点',dictCode:''}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,153 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| :confirmLoading="confirmLoading" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <a-spin :spinning="confirmLoading"> | |||
| <a-form-model ref="form" :model="model" :rules="validatorRules"> | |||
| <a-form-model-item label="分类名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="title"> | |||
| <a-input v-model="model.title" placeholder="请输入分类名称" ></a-input> | |||
| </a-form-model-item> | |||
| <a-form-model-item label="父级节点" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pid"> | |||
| <j-tree-select | |||
| ref="treeSelect" | |||
| placeholder="请选择父级节点" | |||
| v-model="model.pid" | |||
| dict="education_category_thesis,title,id" | |||
| pidField="pid" | |||
| pidValue="0" | |||
| hasChildField="has_child" | |||
| > | |||
| </j-tree-select> | |||
| </a-form-model-item> | |||
| </a-form-model> | |||
| </a-spin> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import { httpAction } from '@/api/manage' | |||
| import { validateDuplicateValue } from '@/utils/util' | |||
| export default { | |||
| name: "EducationCategoryThesisModal", | |||
| components: { | |||
| }, | |||
| data () { | |||
| return { | |||
| title:"操作", | |||
| width:800, | |||
| visible: false, | |||
| model:{ | |||
| }, | |||
| labelCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 5 }, | |||
| }, | |||
| wrapperCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 16 }, | |||
| }, | |||
| confirmLoading: false, | |||
| validatorRules: { | |||
| }, | |||
| url: { | |||
| add: "/educationCategoryThesis/educationCategoryThesis/add", | |||
| edit: "/educationCategoryThesis/educationCategoryThesis/edit", | |||
| }, | |||
| expandedRowKeys:[], | |||
| pidField:"pid" | |||
| } | |||
| }, | |||
| created () { | |||
| //备份model原始值 | |||
| this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
| }, | |||
| methods: { | |||
| add (obj) { | |||
| this.modelDefault.pid='' | |||
| this.edit(Object.assign(this.modelDefault , obj)); | |||
| }, | |||
| edit (record) { | |||
| this.model = Object.assign({}, record); | |||
| this.visible = true; | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| this.$refs.form.clearValidate() | |||
| }, | |||
| handleOk () { | |||
| const that = this; | |||
| // 触发表单验证 | |||
| this.$refs.form.validate(valid => { | |||
| if (valid) { | |||
| that.confirmLoading = true; | |||
| let httpurl = ''; | |||
| let method = ''; | |||
| if(!this.model.id){ | |||
| httpurl+=this.url.add; | |||
| method = 'post'; | |||
| }else{ | |||
| httpurl+=this.url.edit; | |||
| method = 'put'; | |||
| } | |||
| if(this.model.id && this.model.id === this.model[this.pidField]){ | |||
| that.$message.warning("父级节点不能选择自己"); | |||
| that.confirmLoading = false; | |||
| return; | |||
| } | |||
| httpAction(httpurl,this.model,method).then((res)=>{ | |||
| if(res.success){ | |||
| that.$message.success(res.message); | |||
| this.$emit('ok'); | |||
| }else{ | |||
| that.$message.warning(res.message); | |||
| } | |||
| }).finally(() => { | |||
| that.confirmLoading = false; | |||
| that.close(); | |||
| }) | |||
| }else{ | |||
| return false | |||
| } | |||
| }) | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| }, | |||
| submitSuccess(formData,flag){ | |||
| if(!formData.id){ | |||
| let treeData = this.$refs.treeSelect.getCurrTreeData() | |||
| this.expandedRowKeys=[] | |||
| this.getExpandKeysByPid(formData[this.pidField],treeData,treeData) | |||
| this.$emit('ok',formData,this.expandedRowKeys.reverse()); | |||
| }else{ | |||
| this.$emit('ok',formData,flag); | |||
| } | |||
| }, | |||
| getExpandKeysByPid(pid,arr,all){ | |||
| if(pid && arr && arr.length>0){ | |||
| for(let i=0;i<arr.length;i++){ | |||
| if(arr[i].key==pid){ | |||
| this.expandedRowKeys.push(arr[i].key) | |||
| this.getExpandKeysByPid(arr[i]['parentId'],all,all) | |||
| }else{ | |||
| this.getExpandKeysByPid(pid,arr[i].children,all) | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,82 @@ | |||
| import {defHttp} from "/@/utils/http/axios"; | |||
| import {Modal} from 'ant-design-vue'; | |||
| enum Api { | |||
| list = '/educationCategoryThesis/educationCategoryThesis/rootList', | |||
| save='/educationCategoryThesis/educationCategoryThesis/add', | |||
| edit='/educationCategoryThesis/educationCategoryThesis/edit', | |||
| deleteEducationCategoryThesis = '/sys/educationCategoryThesis/delete', | |||
| deleteBatch = '/educationCategoryThesis/educationCategoryThesis/deleteBatch', | |||
| importExcel = '/educationCategoryThesis/educationCategoryThesis/importExcel', | |||
| exportXls = '/educationCategoryThesis/educationCategoryThesis/exportXls', | |||
| loadTreeData = '/educationCategoryThesis/educationCategoryThesis/loadTreeRoot', | |||
| getChildList = '/educationCategoryThesis/educationCategoryThesis/childList', | |||
| getChildListBatch = '/educationCategoryThesis/educationCategoryThesis/getChildListBatch', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| * @param params | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 列表接口 | |||
| * @param params | |||
| */ | |||
| export const list = (params) => | |||
| defHttp.get({url: Api.list, params}); | |||
| /** | |||
| * 删除 | |||
| */ | |||
| export const deleteEducationCategoryThesis = (params,handleSuccess) => { | |||
| return defHttp.delete({url: Api.deleteEducationCategoryThesis, params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * @param params | |||
| */ | |||
| export const batchDeleteEducationCategoryThesis = (params, handleSuccess) => { | |||
| Modal.confirm({ | |||
| title: '确认删除', | |||
| content: '是否删除选中数据', | |||
| okText: '确认', | |||
| cancelText: '取消', | |||
| onOk: () => { | |||
| return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 保存或者更新 | |||
| * @param params | |||
| */ | |||
| export const saveOrUpdateDict = (params, isUpdate) => { | |||
| let url = isUpdate ? Api.edit : Api.save; | |||
| return defHttp.post({url: url, params}); | |||
| } | |||
| /** | |||
| * 查询全部树形节点数据 | |||
| * @param params | |||
| */ | |||
| export const loadTreeData = (params) => | |||
| defHttp.get({url: Api.loadTreeData,params}); | |||
| /** | |||
| * 查询子节点数据 | |||
| * @param params | |||
| */ | |||
| export const getChildList = (params) => | |||
| defHttp.get({url: Api.getChildList, params}); | |||
| /** | |||
| * 批量查询子节点数据 | |||
| * @param params | |||
| */ | |||
| export const getChildListBatch = (params) => | |||
| defHttp.get({url: Api.getChildListBatch, params},{isTransformResponse:false}); | |||
| @ -0,0 +1,28 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '分类名称', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '分类名称', | |||
| field: 'title', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '父级节点', | |||
| field: 'pid', | |||
| component: 'Input', | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,272 @@ | |||
| <template> | |||
| <div class="p-4"> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection" :expandedRowKeys="expandedRowKeys" @expand="handleExpand" @fetch-success="onFetchSuccess"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" @click="handleCreate" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <template #overlay> | |||
| <a-menu> | |||
| <a-menu-item key="1" @click="batchHandleDelete"> | |||
| <Icon icon="ant-design:delete-outlined"></Icon> | |||
| 删除 | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </template> | |||
| <a-button>批量操作 | |||
| <Icon icon="ant-design:down-outlined"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)"/> | |||
| </template> | |||
| </BasicTable> | |||
| <!--字典弹窗--> | |||
| <EducationCategoryThesisModal @register="registerModal" @success="handleSuccess"/> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="educationCategoryThesis-educationCategoryThesis" setup> | |||
| //ts语法 | |||
| import {ref, computed, unref, toRaw, nextTick} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/src/components/Table'; | |||
| import {useModal} from '/src/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import EducationCategoryThesisModal from './components/EducationCategoryThesisModal.vue'; | |||
| import {columns} from './EducationCategoryThesis.data'; | |||
| import {list, deleteEducationCategoryThesis, batchDeleteEducationCategoryThesis, getExportUrl,getImportUrl, getChildList,getChildListBatch} from './EducationCategoryThesis.api'; | |||
| const expandedRowKeys = ref([]); | |||
| //字典model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '论文分类表', | |||
| columns, | |||
| canResize:false, | |||
| actionColumn: { | |||
| width: 120, | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"论文分类表", | |||
| url: getExportUrl, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl, | |||
| success: importSuccess | |||
| }, | |||
| }) | |||
| const [registerTable, {reload, collapseAll, updateTableDataRecord, findTableDataRecord,getDataSource},{ rowSelection, selectedRowKeys }] = tableContext | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| function handleCreate() { | |||
| openModal(true, { | |||
| isUpdate: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 编辑事件 | |||
| */ | |||
| async function handleEdit(record) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 详情 | |||
| */ | |||
| async function handleDetail(record) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| hideFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 删除事件 | |||
| */ | |||
| async function handleDelete(record) { | |||
| await deleteEducationCategoryThesis({id: record.id}, importSuccess); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| const ids = selectedRowKeys.value.filter(item => !item.includes('loading')) | |||
| await batchDeleteEducationCategoryThesis({ids: ids}, importSuccess); | |||
| } | |||
| /** | |||
| * 导入 | |||
| */ | |||
| function importSuccess() { | |||
| reload() && (expandedRowKeys.value = []); | |||
| } | |||
| /** | |||
| * 添加下级 | |||
| */ | |||
| function handleAddSub(record) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| async function handleSuccess({isUpdate, values, expandedArr}) { | |||
| if (isUpdate) { | |||
| //编辑回调 | |||
| updateTableDataRecord(values.id, values); | |||
| } else { | |||
| if(!values['pid']){ | |||
| //新增根节点 | |||
| reload(); | |||
| }else{ | |||
| //新增子集 | |||
| expandedRowKeys.value = []; | |||
| for (let key of unref(expandedArr)) { | |||
| await expandTreeNode(key) | |||
| } | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * 接口请求成功后回调 | |||
| */ | |||
| function onFetchSuccess(result) { | |||
| getDataByResult(result.items)&&loadDataByExpandedRows(); | |||
| } | |||
| /** | |||
| * 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据) | |||
| */ | |||
| async function loadDataByExpandedRows() { | |||
| if (unref(expandedRowKeys).length > 0) { | |||
| const res = await getChildListBatch({ parentIds: unref(expandedRowKeys).join(',')}); | |||
| if (res.success && res.result.records.length>0) { | |||
| //已展开的数据批量子节点 | |||
| let records = res.result.records | |||
| const listMap = new Map(); | |||
| for (let item of records) { | |||
| let pid = item['pid']; | |||
| if (unref(expandedRowKeys).includes(pid)) { | |||
| let mapList = listMap.get(pid); | |||
| if (mapList == null) { | |||
| mapList = []; | |||
| } | |||
| mapList.push(item); | |||
| listMap.set(pid, mapList); | |||
| } | |||
| } | |||
| let childrenMap = listMap; | |||
| let fn = (list) => { | |||
| if(list) { | |||
| list.forEach(data => { | |||
| if (unref(expandedRowKeys).includes(data.id)) { | |||
| data.children = getDataByResult(childrenMap.get(data.id)) | |||
| fn(data.children) | |||
| } | |||
| }) | |||
| } | |||
| }; | |||
| fn(getDataSource()) | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * 处理数据集 | |||
| */ | |||
| function getDataByResult(result){ | |||
| if(result && result.length>0){ | |||
| return result.map(item=>{ | |||
| //判断是否标记了带有子节点 | |||
| if(item["hasChild"]=='1'){ | |||
| let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true } | |||
| item.children = [loadChild] | |||
| } | |||
| return item | |||
| }) | |||
| } | |||
| } | |||
| /** | |||
| *树节点展开合并 | |||
| * */ | |||
| async function handleExpand(expanded, record) { | |||
| // 判断是否是展开状态,展开状态(expanded)并且存在子集(children)并且未加载过(isLoading)的就去查询子节点数据 | |||
| if (expanded) { | |||
| expandedRowKeys.value.push(record.id) | |||
| if (record.children.length > 0 && !!record.children[0].isLoading) { | |||
| let result = await getChildList({pid: record.id}); | |||
| result=result.records?result.records:result; | |||
| if (result && result.length > 0) { | |||
| record.children = getDataByResult(result); | |||
| } else { | |||
| record.children = null | |||
| record.hasChild = '0' | |||
| } | |||
| } | |||
| } else { | |||
| let keyIndex = expandedRowKeys.value.indexOf(record.id) | |||
| if (keyIndex >= 0) { | |||
| expandedRowKeys.value.splice(keyIndex, 1); | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| *操作表格后处理树节点展开合并 | |||
| * */ | |||
| async function expandTreeNode(key) { | |||
| let record = findTableDataRecord(key) | |||
| expandedRowKeys.value.push(key); | |||
| let result = await getChildList({pid: key}); | |||
| if (result && result.length > 0) { | |||
| record.children = getDataByResult(result); | |||
| } else { | |||
| record.children = null | |||
| record.hasChild = '0' | |||
| } | |||
| updateTableDataRecord(key, record); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record) { | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| }, | |||
| { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '确定删除吗?', | |||
| confirm: handleDelete.bind(null, record), | |||
| }, | |||
| }, | |||
| { | |||
| label: '添加下级', | |||
| onClick: handleAddSub.bind(null, {pid: record.id}), | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| </style> | |||
| @ -0,0 +1,87 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm"/> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/src/components/Modal'; | |||
| import {BasicForm, useForm} from '/src/components/Form'; | |||
| import {formSchema} from '../educationCategoryThesis.data'; | |||
| import {loadTreeData, saveOrUpdateDict} from '../educationCategoryThesis.api'; | |||
| // 获取emit | |||
| const emit = defineEmits(['register', 'success']); | |||
| const isUpdate = ref(true); | |||
| const expandedRowKeys = ref([]); | |||
| const treeData = ref([]); | |||
| //表单配置 | |||
| const [registerForm, {resetFields, setFieldsValue, validate, updateSchema}] = useForm({ | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| labelCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 4 }, | |||
| }, | |||
| wrapperCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 18 }, | |||
| }, | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| expandedRowKeys.value = []; | |||
| setModalProps({confirmLoading: false, minHeight: 80}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| if (data?.record) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| //父级节点树信息 | |||
| treeData.value = await loadTreeData({'async': false,'pcode':''}); | |||
| updateSchema({ | |||
| field: 'pid', | |||
| componentProps: {treeData}, | |||
| }); | |||
| }); | |||
| //设置标题 | |||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增字典' : '编辑字典')); | |||
| /** | |||
| * 根据pid获取展开的节点 | |||
| * @param pid | |||
| * @param arr | |||
| */ | |||
| function getExpandKeysByPid(pid,arr){ | |||
| if(pid && arr && arr.length>0){ | |||
| for(let i=0;i<arr.length;i++){ | |||
| if(arr[i].key==pid && unref(expandedRowKeys).indexOf(pid)<0){ | |||
| expandedRowKeys.value.push(arr[i].key); | |||
| getExpandKeysByPid(arr[i]['parentId'],unref(treeData)) | |||
| }else{ | |||
| getExpandKeysByPid(pid,arr[i].children) | |||
| } | |||
| } | |||
| } | |||
| } | |||
| //表单提交事件 | |||
| async function handleSubmit() { | |||
| try { | |||
| let values = await validate(); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdateDict(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //展开的节点信息 | |||
| await getExpandKeysByPid(values['pid'],unref(treeData)) | |||
| //刷新列表(isUpdate:是否编辑;values:表单信息;expandedArr:展开的节点信息) | |||
| emit('success', {isUpdate: unref(isUpdate), values:{...values},expandedArr: unref(expandedRowKeys).reverse()}); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,171 @@ | |||
| package org.jeecg.modules.educationConfig.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.educationConfig.entity.EducationConfig; | |||
| import org.jeecg.modules.educationConfig.service.IEducationConfigService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 配置信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="配置信息表") | |||
| @RestController | |||
| @RequestMapping("/educationConfig/educationConfig") | |||
| @Slf4j | |||
| public class EducationConfigController extends JeecgController<EducationConfig, IEducationConfigService> { | |||
| @Autowired | |||
| private IEducationConfigService educationConfigService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param educationConfig | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "配置信息表-分页列表查询") | |||
| @ApiOperation(value="配置信息表-分页列表查询", notes="配置信息表-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<EducationConfig>> queryPageList(EducationConfig educationConfig, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<EducationConfig> queryWrapper = QueryGenerator.initQueryWrapper(educationConfig, req.getParameterMap()); | |||
| Page<EducationConfig> page = new Page<EducationConfig>(pageNo, pageSize); | |||
| IPage<EducationConfig> pageList = educationConfigService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param educationConfig | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "配置信息表-添加") | |||
| @ApiOperation(value="配置信息表-添加", notes="配置信息表-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody EducationConfig educationConfig) { | |||
| educationConfigService.save(educationConfig); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param educationConfig | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "配置信息表-编辑") | |||
| @ApiOperation(value="配置信息表-编辑", notes="配置信息表-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody EducationConfig educationConfig) { | |||
| educationConfigService.updateById(educationConfig); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "配置信息表-通过id删除") | |||
| @ApiOperation(value="配置信息表-通过id删除", notes="配置信息表-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| educationConfigService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "配置信息表-批量删除") | |||
| @ApiOperation(value="配置信息表-批量删除", notes="配置信息表-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.educationConfigService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "配置信息表-通过id查询") | |||
| @ApiOperation(value="配置信息表-通过id查询", notes="配置信息表-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<EducationConfig> queryById(@RequestParam(name="id",required=true) String id) { | |||
| EducationConfig educationConfig = educationConfigService.getById(id); | |||
| if(educationConfig==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(educationConfig); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param educationConfig | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, EducationConfig educationConfig) { | |||
| return super.exportXls(request, educationConfig, EducationConfig.class, "配置信息表"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, EducationConfig.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,70 @@ | |||
| package org.jeecg.modules.educationConfig.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 配置信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("education_config") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @ApiModel(value="education_config对象", description="配置信息表") | |||
| public class EducationConfig implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**参数编码*/ | |||
| @Excel(name = "参数编码", width = 15) | |||
| @ApiModelProperty(value = "参数编码") | |||
| private java.lang.String paramCode; | |||
| /**参数值_普通文本*/ | |||
| @Excel(name = "参数值_普通文本", width = 15) | |||
| @ApiModelProperty(value = "参数值_普通文本") | |||
| private java.lang.String paramText; | |||
| /**参数值_图片*/ | |||
| @Excel(name = "参数值_图片", width = 15) | |||
| @ApiModelProperty(value = "参数值_图片") | |||
| private java.lang.String paramImage; | |||
| /**参数值_富文本*/ | |||
| @Excel(name = "参数值_富文本", width = 15) | |||
| @ApiModelProperty(value = "参数值_富文本") | |||
| private java.lang.String paramTextarea; | |||
| /**参数描述*/ | |||
| @Excel(name = "参数描述", width = 15) | |||
| @ApiModelProperty(value = "参数描述") | |||
| private java.lang.String paramDesc; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.educationConfig.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.educationConfig.entity.EducationConfig; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 配置信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface EducationConfigMapper extends BaseMapper<EducationConfig> { | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| <?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="org.jeecg.modules.educationConfig.mapper.EducationConfigMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.educationConfig.service; | |||
| import org.jeecg.modules.educationConfig.entity.EducationConfig; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 配置信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IEducationConfigService extends IService<EducationConfig> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.educationConfig.service.impl; | |||
| import org.jeecg.modules.educationConfig.entity.EducationConfig; | |||
| import org.jeecg.modules.educationConfig.mapper.EducationConfigMapper; | |||
| import org.jeecg.modules.educationConfig.service.IEducationConfigService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 配置信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class EducationConfigServiceImpl extends ServiceImpl<EducationConfigMapper, EducationConfig> implements IEducationConfigService { | |||
| } | |||
| @ -0,0 +1,197 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('配置信息表')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| :scroll="{x:true}" | |||
| bordered | |||
| rowKey="id" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
| class="j-table-force-nowrap" | |||
| @change="handleTableChange"> | |||
| <template slot="htmlSlot" slot-scope="text"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleDetail(record)">详情</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <education-config-modal ref="modalForm" @ok="modalFormOk"></education-config-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import '@/assets/less/TableExpand.less' | |||
| import { mixinDevice } from '@/utils/mixin' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import EducationConfigModal from './modules/EducationConfigModal' | |||
| export default { | |||
| name: 'EducationConfigList', | |||
| mixins:[JeecgListMixin, mixinDevice], | |||
| components: { | |||
| EducationConfigModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '配置信息表管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title: '#', | |||
| dataIndex: '', | |||
| key:'rowIndex', | |||
| width:60, | |||
| align:"center", | |||
| customRender:function (t,r,index) { | |||
| return parseInt(index)+1; | |||
| } | |||
| }, | |||
| { | |||
| title:'参数编码', | |||
| align:"center", | |||
| dataIndex: 'paramCode' | |||
| }, | |||
| { | |||
| title:'参数值_普通文本', | |||
| align:"center", | |||
| dataIndex: 'paramText' | |||
| }, | |||
| { | |||
| title:'参数值_图片', | |||
| align:"center", | |||
| dataIndex: 'paramImage', | |||
| scopedSlots: {customRender: 'imgSlot'} | |||
| }, | |||
| { | |||
| title:'参数值_富文本', | |||
| align:"center", | |||
| dataIndex: 'paramTextarea', | |||
| scopedSlots: {customRender: 'htmlSlot'} | |||
| }, | |||
| { | |||
| title:'参数描述', | |||
| align:"center", | |||
| dataIndex: 'paramDesc' | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' } | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/educationConfig/educationConfig/list", | |||
| delete: "/educationConfig/educationConfig/delete", | |||
| deleteBatch: "/educationConfig/educationConfig/deleteBatch", | |||
| exportXlsUrl: "/educationConfig/educationConfig/exportXls", | |||
| importExcelUrl: "educationConfig/educationConfig/importExcel", | |||
| }, | |||
| dictOptions:{}, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl: function(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| }, | |||
| methods: { | |||
| initDictConfig(){ | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'string',value:'paramCode',text:'参数编码',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'paramText',text:'参数值_普通文本',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'paramImage',text:'参数值_图片',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'paramTextarea',text:'参数值_富文本',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'paramDesc',text:'参数描述',dictCode:''}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,124 @@ | |||
| <template> | |||
| <a-spin :spinning="confirmLoading"> | |||
| <j-form-container :disabled="formDisabled"> | |||
| <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
| <a-row> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="参数编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="paramCode"> | |||
| <a-input v-model="model.paramCode" placeholder="请输入参数编码" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="参数值_普通文本" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="paramText"> | |||
| <a-input v-model="model.paramText" placeholder="请输入参数值_普通文本" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="参数值_图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="paramImage"> | |||
| <j-image-upload isMultiple v-model="model.paramImage" ></j-image-upload> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="参数值_富文本" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="paramTextarea"> | |||
| <j-editor v-model="model.paramTextarea" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="参数描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="paramDesc"> | |||
| <a-input v-model="model.paramDesc" placeholder="请输入参数描述" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| </a-row> | |||
| </a-form-model> | |||
| </j-form-container> | |||
| </a-spin> | |||
| </template> | |||
| <script> | |||
| import { httpAction, getAction } from '@/api/manage' | |||
| import { validateDuplicateValue } from '@/utils/util' | |||
| export default { | |||
| name: 'EducationConfigForm', | |||
| components: { | |||
| }, | |||
| props: { | |||
| //表单禁用 | |||
| disabled: { | |||
| type: Boolean, | |||
| default: false, | |||
| required: false | |||
| } | |||
| }, | |||
| data () { | |||
| return { | |||
| model:{ | |||
| }, | |||
| labelCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 5 }, | |||
| }, | |||
| wrapperCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 16 }, | |||
| }, | |||
| confirmLoading: false, | |||
| validatorRules: { | |||
| }, | |||
| url: { | |||
| add: "/educationConfig/educationConfig/add", | |||
| edit: "/educationConfig/educationConfig/edit", | |||
| queryById: "/educationConfig/educationConfig/queryById" | |||
| } | |||
| } | |||
| }, | |||
| computed: { | |||
| formDisabled(){ | |||
| return this.disabled | |||
| }, | |||
| }, | |||
| created () { | |||
| //备份model原始值 | |||
| this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.edit(this.modelDefault); | |||
| }, | |||
| edit (record) { | |||
| this.model = Object.assign({}, record); | |||
| this.visible = true; | |||
| }, | |||
| submitForm () { | |||
| const that = this; | |||
| // 触发表单验证 | |||
| this.$refs.form.validate(valid => { | |||
| if (valid) { | |||
| that.confirmLoading = true; | |||
| let httpurl = ''; | |||
| let method = ''; | |||
| if(!this.model.id){ | |||
| httpurl+=this.url.add; | |||
| method = 'post'; | |||
| }else{ | |||
| httpurl+=this.url.edit; | |||
| method = 'put'; | |||
| } | |||
| httpAction(httpurl,this.model,method).then((res)=>{ | |||
| if(res.success){ | |||
| that.$message.success(res.message); | |||
| that.$emit('ok'); | |||
| }else{ | |||
| that.$message.warning(res.message); | |||
| } | |||
| }).finally(() => { | |||
| that.confirmLoading = false; | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,84 @@ | |||
| <template> | |||
| <a-drawer | |||
| :title="title" | |||
| :width="width" | |||
| placement="right" | |||
| :closable="false" | |||
| @close="close" | |||
| destroyOnClose | |||
| :visible="visible"> | |||
| <education-config-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></education-config-form> | |||
| <div class="drawer-footer"> | |||
| <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
| <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
| </div> | |||
| </a-drawer> | |||
| </template> | |||
| <script> | |||
| import EducationConfigForm from './EducationConfigForm' | |||
| export default { | |||
| name: 'EducationConfigModal', | |||
| components: { | |||
| EducationConfigForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:"操作", | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }); | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** Button按钮间距 */ | |||
| .ant-btn { | |||
| margin-left: 30px; | |||
| margin-bottom: 30px; | |||
| float: right; | |||
| } | |||
| .drawer-footer{ | |||
| position: absolute; | |||
| bottom: -8px; | |||
| width: 100%; | |||
| border-top: 1px solid #e8e8e8; | |||
| padding: 10px 16px; | |||
| text-align: right; | |||
| left: 0; | |||
| background: #fff; | |||
| border-radius: 0 0 2px 2px; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,60 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <education-config-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></education-config-form> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import EducationConfigForm from './EducationConfigForm' | |||
| export default { | |||
| name: 'EducationConfigModal', | |||
| components: { | |||
| EducationConfigForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:'', | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }) | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,61 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import {Modal} from 'ant-design-vue'; | |||
| enum Api { | |||
| list = '/educationConfig/educationConfig/list', | |||
| save='/educationConfig/educationConfig/add', | |||
| edit='/educationConfig/educationConfig/edit', | |||
| deleteOne = '/educationConfig/educationConfig/delete', | |||
| deleteBatch = '/educationConfig/educationConfig/deleteBatch', | |||
| importExcel = '/educationConfig/educationConfig/importExcel', | |||
| exportXls = '/educationConfig/educationConfig/exportXls', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 列表接口 | |||
| * @param params | |||
| */ | |||
| export const list = (params) => | |||
| defHttp.get({url: Api.list, params}); | |||
| /** | |||
| * 删除单个 | |||
| */ | |||
| export const deleteOne = (params,handleSuccess) => { | |||
| return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * @param params | |||
| */ | |||
| export const batchDelete = (params, handleSuccess) => { | |||
| Modal.confirm({ | |||
| title: '确认删除', | |||
| content: '是否删除选中数据', | |||
| okText: '确认', | |||
| cancelText: '取消', | |||
| onOk: () => { | |||
| return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 保存或者更新 | |||
| * @param params | |||
| */ | |||
| export const saveOrUpdate = (params, isUpdate) => { | |||
| let url = isUpdate ? Api.edit : Api.save; | |||
| return defHttp.post({url: url, params}); | |||
| } | |||
| @ -0,0 +1,67 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '参数编码', | |||
| align:"center", | |||
| dataIndex: 'paramCode' | |||
| }, | |||
| { | |||
| title: '参数值_普通文本', | |||
| align:"center", | |||
| dataIndex: 'paramText' | |||
| }, | |||
| { | |||
| title: '参数值_图片', | |||
| align:"center", | |||
| dataIndex: 'paramImage', | |||
| customRender:render.renderAvatar, | |||
| }, | |||
| { | |||
| title: '参数值_富文本', | |||
| align:"center", | |||
| dataIndex: 'paramTextarea', | |||
| slots: { customRender: 'htmlSlot' }, | |||
| }, | |||
| { | |||
| title: '参数描述', | |||
| align:"center", | |||
| dataIndex: 'paramDesc' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '参数编码', | |||
| field: 'paramCode', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '参数值_普通文本', | |||
| field: 'paramText', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '参数值_图片', | |||
| field: 'paramImage', | |||
| component: 'JImageUpload', | |||
| componentProps:{ | |||
| }, | |||
| }, | |||
| { | |||
| label: '参数值_富文本', | |||
| field: 'paramTextarea', | |||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||
| }, | |||
| { | |||
| label: '参数描述', | |||
| field: 'paramDesc', | |||
| component: 'Input', | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,162 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
| <a-dropdown v-if="checkedKeys.length > 0"> | |||
| <template #overlay> | |||
| <a-menu> | |||
| <a-menu-item key="1" @click="batchHandleDelete"> | |||
| <Icon icon="ant-design:delete-outlined"></Icon> | |||
| 删除 | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </template> | |||
| <a-button>批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template #htmlSlot="{text}"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template #fileSlot="{text}"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <EducationConfigModal @register="registerModal" @success="handleSuccess"></EducationConfigModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="educationConfig-educationConfig" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import EducationConfigModal from './components/EducationConfigModal.vue' | |||
| import {columns, searchFormSchema} from './educationConfig.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './educationConfig.api'; | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '配置信息表', | |||
| api: list, | |||
| columns, | |||
| canResize:false, | |||
| formConfig: { | |||
| labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"配置信息表", | |||
| url: getExportUrl, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| function handleAdd() { | |||
| openModal(true, { | |||
| isUpdate: false, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 编辑事件 | |||
| */ | |||
| function handleEdit(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 详情 | |||
| */ | |||
| function handleDetail(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 删除事件 | |||
| */ | |||
| async function handleDelete(record) { | |||
| await deleteOne({id: record.id}, reload); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: checkedKeys.value}, reload); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| } | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| </style> | |||
| @ -0,0 +1,58 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm"/> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../educationConfig.data'; | |||
| import {saveOrUpdate} from '../educationConfig.api'; | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| </style> | |||
| @ -0,0 +1,171 @@ | |||
| package org.jeecg.modules.educationSummary.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.educationSummary.entity.EducationSummary; | |||
| import org.jeecg.modules.educationSummary.service.IEducationSummaryService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 概述信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="概述信息表") | |||
| @RestController | |||
| @RequestMapping("/educationSummary/educationSummary") | |||
| @Slf4j | |||
| public class EducationSummaryController extends JeecgController<EducationSummary, IEducationSummaryService> { | |||
| @Autowired | |||
| private IEducationSummaryService educationSummaryService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param educationSummary | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "概述信息表-分页列表查询") | |||
| @ApiOperation(value="概述信息表-分页列表查询", notes="概述信息表-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<EducationSummary>> queryPageList(EducationSummary educationSummary, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<EducationSummary> queryWrapper = QueryGenerator.initQueryWrapper(educationSummary, req.getParameterMap()); | |||
| Page<EducationSummary> page = new Page<EducationSummary>(pageNo, pageSize); | |||
| IPage<EducationSummary> pageList = educationSummaryService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param educationSummary | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "概述信息表-添加") | |||
| @ApiOperation(value="概述信息表-添加", notes="概述信息表-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody EducationSummary educationSummary) { | |||
| educationSummaryService.save(educationSummary); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param educationSummary | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "概述信息表-编辑") | |||
| @ApiOperation(value="概述信息表-编辑", notes="概述信息表-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody EducationSummary educationSummary) { | |||
| educationSummaryService.updateById(educationSummary); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "概述信息表-通过id删除") | |||
| @ApiOperation(value="概述信息表-通过id删除", notes="概述信息表-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| educationSummaryService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "概述信息表-批量删除") | |||
| @ApiOperation(value="概述信息表-批量删除", notes="概述信息表-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.educationSummaryService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "概述信息表-通过id查询") | |||
| @ApiOperation(value="概述信息表-通过id查询", notes="概述信息表-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<EducationSummary> queryById(@RequestParam(name="id",required=true) String id) { | |||
| EducationSummary educationSummary = educationSummaryService.getById(id); | |||
| if(educationSummary==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(educationSummary); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param educationSummary | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, EducationSummary educationSummary) { | |||
| return super.exportXls(request, educationSummary, EducationSummary.class, "概述信息表"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, EducationSummary.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,66 @@ | |||
| package org.jeecg.modules.educationSummary.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 概述信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("education_summary") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @ApiModel(value="education_summary对象", description="概述信息表") | |||
| public class EducationSummary implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**参数编码*/ | |||
| @Excel(name = "参数编码", width = 15) | |||
| @ApiModelProperty(value = "参数编码") | |||
| private java.lang.String paramCode; | |||
| /**标题*/ | |||
| @Excel(name = "标题", width = 15) | |||
| @ApiModelProperty(value = "标题") | |||
| private java.lang.String title; | |||
| /**详情*/ | |||
| @Excel(name = "详情", width = 15) | |||
| @ApiModelProperty(value = "详情") | |||
| private java.lang.String details; | |||
| /**参数描述*/ | |||
| @Excel(name = "参数描述", width = 15) | |||
| @ApiModelProperty(value = "参数描述") | |||
| private java.lang.String paramDesc; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.educationSummary.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.educationSummary.entity.EducationSummary; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 概述信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface EducationSummaryMapper extends BaseMapper<EducationSummary> { | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| <?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="org.jeecg.modules.educationSummary.mapper.EducationSummaryMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.educationSummary.service; | |||
| import org.jeecg.modules.educationSummary.entity.EducationSummary; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 概述信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IEducationSummaryService extends IService<EducationSummary> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.educationSummary.service.impl; | |||
| import org.jeecg.modules.educationSummary.entity.EducationSummary; | |||
| import org.jeecg.modules.educationSummary.mapper.EducationSummaryMapper; | |||
| import org.jeecg.modules.educationSummary.service.IEducationSummaryService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 概述信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-07-24 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class EducationSummaryServiceImpl extends ServiceImpl<EducationSummaryMapper, EducationSummary> implements IEducationSummaryService { | |||
| } | |||
| @ -0,0 +1,190 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('概述信息表')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| :scroll="{x:true}" | |||
| bordered | |||
| rowKey="id" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
| class="j-table-force-nowrap" | |||
| @change="handleTableChange"> | |||
| <template slot="htmlSlot" slot-scope="text"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleDetail(record)">详情</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <education-summary-modal ref="modalForm" @ok="modalFormOk"></education-summary-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import '@/assets/less/TableExpand.less' | |||
| import { mixinDevice } from '@/utils/mixin' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import EducationSummaryModal from './modules/EducationSummaryModal' | |||
| export default { | |||
| name: 'EducationSummaryList', | |||
| mixins:[JeecgListMixin, mixinDevice], | |||
| components: { | |||
| EducationSummaryModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '概述信息表管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title: '#', | |||
| dataIndex: '', | |||
| key:'rowIndex', | |||
| width:60, | |||
| align:"center", | |||
| customRender:function (t,r,index) { | |||
| return parseInt(index)+1; | |||
| } | |||
| }, | |||
| { | |||
| title:'参数编码', | |||
| align:"center", | |||
| dataIndex: 'paramCode' | |||
| }, | |||
| { | |||
| title:'标题', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title:'详情', | |||
| align:"center", | |||
| dataIndex: 'details', | |||
| scopedSlots: {customRender: 'htmlSlot'} | |||
| }, | |||
| { | |||
| title:'参数描述', | |||
| align:"center", | |||
| dataIndex: 'paramDesc' | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' } | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/educationSummary/educationSummary/list", | |||
| delete: "/educationSummary/educationSummary/delete", | |||
| deleteBatch: "/educationSummary/educationSummary/deleteBatch", | |||
| exportXlsUrl: "/educationSummary/educationSummary/exportXls", | |||
| importExcelUrl: "educationSummary/educationSummary/importExcel", | |||
| }, | |||
| dictOptions:{}, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl: function(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| }, | |||
| methods: { | |||
| initDictConfig(){ | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'string',value:'paramCode',text:'参数编码',dictCode:''}) | |||
| fieldList.push({type:'string',value:'title',text:'标题',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'details',text:'详情',dictCode:''}) | |||
| fieldList.push({type:'string',value:'paramDesc',text:'参数描述',dictCode:''}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,119 @@ | |||
| <template> | |||
| <a-spin :spinning="confirmLoading"> | |||
| <j-form-container :disabled="formDisabled"> | |||
| <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
| <a-row> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="参数编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="paramCode"> | |||
| <a-input v-model="model.paramCode" placeholder="请输入参数编码" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="title"> | |||
| <a-input v-model="model.title" placeholder="请输入标题" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="详情" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="details"> | |||
| <j-editor v-model="model.details" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="参数描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="paramDesc"> | |||
| <a-input v-model="model.paramDesc" placeholder="请输入参数描述" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| </a-row> | |||
| </a-form-model> | |||
| </j-form-container> | |||
| </a-spin> | |||
| </template> | |||
| <script> | |||
| import { httpAction, getAction } from '@/api/manage' | |||
| import { validateDuplicateValue } from '@/utils/util' | |||
| export default { | |||
| name: 'EducationSummaryForm', | |||
| components: { | |||
| }, | |||
| props: { | |||
| //表单禁用 | |||
| disabled: { | |||
| type: Boolean, | |||
| default: false, | |||
| required: false | |||
| } | |||
| }, | |||
| data () { | |||
| return { | |||
| model:{ | |||
| }, | |||
| labelCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 5 }, | |||
| }, | |||
| wrapperCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 16 }, | |||
| }, | |||
| confirmLoading: false, | |||
| validatorRules: { | |||
| }, | |||
| url: { | |||
| add: "/educationSummary/educationSummary/add", | |||
| edit: "/educationSummary/educationSummary/edit", | |||
| queryById: "/educationSummary/educationSummary/queryById" | |||
| } | |||
| } | |||
| }, | |||
| computed: { | |||
| formDisabled(){ | |||
| return this.disabled | |||
| }, | |||
| }, | |||
| created () { | |||
| //备份model原始值 | |||
| this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.edit(this.modelDefault); | |||
| }, | |||
| edit (record) { | |||
| this.model = Object.assign({}, record); | |||
| this.visible = true; | |||
| }, | |||
| submitForm () { | |||
| const that = this; | |||
| // 触发表单验证 | |||
| this.$refs.form.validate(valid => { | |||
| if (valid) { | |||
| that.confirmLoading = true; | |||
| let httpurl = ''; | |||
| let method = ''; | |||
| if(!this.model.id){ | |||
| httpurl+=this.url.add; | |||
| method = 'post'; | |||
| }else{ | |||
| httpurl+=this.url.edit; | |||
| method = 'put'; | |||
| } | |||
| httpAction(httpurl,this.model,method).then((res)=>{ | |||
| if(res.success){ | |||
| that.$message.success(res.message); | |||
| that.$emit('ok'); | |||
| }else{ | |||
| that.$message.warning(res.message); | |||
| } | |||
| }).finally(() => { | |||
| that.confirmLoading = false; | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,84 @@ | |||
| <template> | |||
| <a-drawer | |||
| :title="title" | |||
| :width="width" | |||
| placement="right" | |||
| :closable="false" | |||
| @close="close" | |||
| destroyOnClose | |||
| :visible="visible"> | |||
| <education-summary-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></education-summary-form> | |||
| <div class="drawer-footer"> | |||
| <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
| <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
| </div> | |||
| </a-drawer> | |||
| </template> | |||
| <script> | |||
| import EducationSummaryForm from './EducationSummaryForm' | |||
| export default { | |||
| name: 'EducationSummaryModal', | |||
| components: { | |||
| EducationSummaryForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:"操作", | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }); | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** Button按钮间距 */ | |||
| .ant-btn { | |||
| margin-left: 30px; | |||
| margin-bottom: 30px; | |||
| float: right; | |||
| } | |||
| .drawer-footer{ | |||
| position: absolute; | |||
| bottom: -8px; | |||
| width: 100%; | |||
| border-top: 1px solid #e8e8e8; | |||
| padding: 10px 16px; | |||
| text-align: right; | |||
| left: 0; | |||
| background: #fff; | |||
| border-radius: 0 0 2px 2px; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,60 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <education-summary-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></education-summary-form> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import EducationSummaryForm from './EducationSummaryForm' | |||
| export default { | |||
| name: 'EducationSummaryModal', | |||
| components: { | |||
| EducationSummaryForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:'', | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }) | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||