| @ -0,0 +1,268 @@ | |||
| package org.jeecg.modules.demo.appletPaperReport.controller; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.io.IOException; | |||
| import java.net.URLDecoder; | |||
| import java.util.ArrayList; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.util.HashMap; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| 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.vo.LoginUser; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.system.query.QueryRuleEnum; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReportItem; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReport; | |||
| import org.jeecg.modules.demo.appletPaperReport.vo.AppletPaperReportPage; | |||
| import org.jeecg.modules.demo.appletPaperReport.service.IAppletPaperReportService; | |||
| import org.jeecg.modules.demo.appletPaperReport.service.IAppletPaperReportItemService; | |||
| import org.springframework.beans.BeanUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| 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 com.alibaba.fastjson.JSON; | |||
| import io.swagger.v3.oas.annotations.tags.Tag; | |||
| import io.swagger.v3.oas.annotations.Operation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
| /** | |||
| * @Description: 试卷报告 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Tag(name="试卷报告") | |||
| @RestController | |||
| @RequestMapping("/appletPaperReport/appletPaperReport") | |||
| @Slf4j | |||
| public class AppletPaperReportController { | |||
| @Autowired | |||
| private IAppletPaperReportService appletPaperReportService; | |||
| @Autowired | |||
| private IAppletPaperReportItemService appletPaperReportItemService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param appletPaperReport | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "试卷报告-分页列表查询") | |||
| @Operation(summary="试卷报告-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<AppletPaperReport>> queryPageList(AppletPaperReport appletPaperReport, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<AppletPaperReport> queryWrapper = QueryGenerator.initQueryWrapper(appletPaperReport, req.getParameterMap()); | |||
| Page<AppletPaperReport> page = new Page<AppletPaperReport>(pageNo, pageSize); | |||
| IPage<AppletPaperReport> pageList = appletPaperReportService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param appletPaperReportPage | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "试卷报告-添加") | |||
| @Operation(summary="试卷报告-添加") | |||
| @RequiresPermissions("appletPaperReport:applet_paper_report:add") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody AppletPaperReportPage appletPaperReportPage) { | |||
| AppletPaperReport appletPaperReport = new AppletPaperReport(); | |||
| BeanUtils.copyProperties(appletPaperReportPage, appletPaperReport); | |||
| appletPaperReportService.saveMain(appletPaperReport, appletPaperReportPage.getAppletPaperReportItemList()); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param appletPaperReportPage | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "试卷报告-编辑") | |||
| @Operation(summary="试卷报告-编辑") | |||
| @RequiresPermissions("appletPaperReport:applet_paper_report:edit") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody AppletPaperReportPage appletPaperReportPage) { | |||
| AppletPaperReport appletPaperReport = new AppletPaperReport(); | |||
| BeanUtils.copyProperties(appletPaperReportPage, appletPaperReport); | |||
| AppletPaperReport appletPaperReportEntity = appletPaperReportService.getById(appletPaperReport.getId()); | |||
| if(appletPaperReportEntity==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| appletPaperReportService.updateMain(appletPaperReport, appletPaperReportPage.getAppletPaperReportItemList()); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "试卷报告-通过id删除") | |||
| @Operation(summary="试卷报告-通过id删除") | |||
| @RequiresPermissions("appletPaperReport:applet_paper_report:delete") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| appletPaperReportService.delMain(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "试卷报告-批量删除") | |||
| @Operation(summary="试卷报告-批量删除") | |||
| @RequiresPermissions("appletPaperReport:applet_paper_report:deleteBatch") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.appletPaperReportService.delBatchMain(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "试卷报告-通过id查询") | |||
| @Operation(summary="试卷报告-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<AppletPaperReport> queryById(@RequestParam(name="id",required=true) String id) { | |||
| AppletPaperReport appletPaperReport = appletPaperReportService.getById(id); | |||
| if(appletPaperReport==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(appletPaperReport); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "试卷报告子项通过主表ID查询") | |||
| @Operation(summary="试卷报告子项主表ID查询") | |||
| @GetMapping(value = "/queryAppletPaperReportItemByMainId") | |||
| public Result<List<AppletPaperReportItem>> queryAppletPaperReportItemListByMainId(@RequestParam(name="id",required=true) String id) { | |||
| List<AppletPaperReportItem> appletPaperReportItemList = appletPaperReportItemService.selectByMainId(id); | |||
| return Result.OK(appletPaperReportItemList); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param appletPaperReport | |||
| */ | |||
| @RequiresPermissions("appletPaperReport:applet_paper_report:exportXls") | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, AppletPaperReport appletPaperReport) { | |||
| // Step.1 组装查询条件查询数据 | |||
| QueryWrapper<AppletPaperReport> queryWrapper = QueryGenerator.initQueryWrapper(appletPaperReport, request.getParameterMap()); | |||
| LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); | |||
| //配置选中数据查询条件 | |||
| String selections = request.getParameter("selections"); | |||
| if(oConvertUtils.isNotEmpty(selections)) { | |||
| List<String> selectionList = Arrays.asList(selections.split(",")); | |||
| queryWrapper.in("id",selectionList); | |||
| } | |||
| //Step.2 获取导出数据 | |||
| List<AppletPaperReport> appletPaperReportList = appletPaperReportService.list(queryWrapper); | |||
| // Step.3 组装pageList | |||
| List<AppletPaperReportPage> pageList = new ArrayList<AppletPaperReportPage>(); | |||
| for (AppletPaperReport main : appletPaperReportList) { | |||
| AppletPaperReportPage vo = new AppletPaperReportPage(); | |||
| BeanUtils.copyProperties(main, vo); | |||
| List<AppletPaperReportItem> appletPaperReportItemList = appletPaperReportItemService.selectByMainId(main.getId()); | |||
| vo.setAppletPaperReportItemList(appletPaperReportItemList); | |||
| pageList.add(vo); | |||
| } | |||
| // Step.4 AutoPoi 导出Excel | |||
| ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | |||
| mv.addObject(NormalExcelConstants.FILE_NAME, "试卷报告列表"); | |||
| mv.addObject(NormalExcelConstants.CLASS, AppletPaperReportPage.class); | |||
| mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("试卷报告数据", "导出人:"+sysUser.getRealname(), "试卷报告")); | |||
| mv.addObject(NormalExcelConstants.DATA_LIST, pageList); | |||
| return mv; | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequiresPermissions("appletPaperReport:applet_paper_report:importExcel") | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | |||
| Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); | |||
| for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { | |||
| // 获取上传文件对象 | |||
| MultipartFile file = entity.getValue(); | |||
| ImportParams params = new ImportParams(); | |||
| params.setTitleRows(2); | |||
| params.setHeadRows(1); | |||
| params.setNeedSave(true); | |||
| try { | |||
| List<AppletPaperReportPage> list = ExcelImportUtil.importExcel(file.getInputStream(), AppletPaperReportPage.class, params); | |||
| for (AppletPaperReportPage page : list) { | |||
| AppletPaperReport po = new AppletPaperReport(); | |||
| BeanUtils.copyProperties(page, po); | |||
| appletPaperReportService.saveMain(po, page.getAppletPaperReportItemList()); | |||
| } | |||
| return Result.OK("文件导入成功!数据行数:" + list.size()); | |||
| } catch (Exception e) { | |||
| log.error(e.getMessage(),e); | |||
| return Result.error("文件导入失败:"+e.getMessage()); | |||
| } finally { | |||
| try { | |||
| file.getInputStream().close(); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| } | |||
| return Result.OK("文件导入失败!"); | |||
| } | |||
| } | |||
| @ -0,0 +1,117 @@ | |||
| package org.jeecg.modules.demo.appletPaperReport.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableLogic; | |||
| import org.jeecg.common.constant.ProvinceCityArea; | |||
| import org.jeecg.common.util.SpringContextUtils; | |||
| import org.jeecg.modules.demo.appletProduct.entity.AppletProduct; | |||
| 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.v3.oas.annotations.media.Schema; | |||
| /** | |||
| * @Description: 试卷报告 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Schema(description="试卷报告") | |||
| @Data | |||
| @TableName("applet_paper_report") | |||
| public class AppletPaperReport implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @Schema(description = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @Schema(description = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| @Schema(description = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @Schema(description = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| @Schema(description = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**所属部门*/ | |||
| @Schema(description = "所属部门") | |||
| private java.lang.String sysOrgCode; | |||
| /**试卷名称*/ | |||
| @Excel(name = "试卷名称", width = 15) | |||
| @Schema(description = "试卷名称") | |||
| private java.lang.String title; | |||
| /**英文名称*/ | |||
| @Excel(name = "英文名称", width = 15) | |||
| @Schema(description = "英文名称") | |||
| private java.lang.String enTitle; | |||
| /**小提示*/ | |||
| @Excel(name = "小提示", width = 15) | |||
| @Schema(description = "小提示") | |||
| private java.lang.String tips; | |||
| /**小提示*/ | |||
| @Excel(name = "状态 0未完成 1已完成", width = 15) | |||
| @Schema(description = "状态 0未完成 1已完成") | |||
| private java.lang.String status; | |||
| /**试卷*/ | |||
| @Excel(name = "试卷", width = 15, dictTable = "applet_paper", dicText = "title", dicCode = "id") | |||
| @Dict(dictTable = "applet_paper", dicText = "title", dicCode = "id") | |||
| @Schema(description = "试卷") | |||
| private java.lang.String paperId; | |||
| /**用户*/ | |||
| @Excel(name = "用户", width = 15, dictTable = "applet_user", dicText = "name", dicCode = "id") | |||
| @Dict(dictTable = "applet_user", dicText = "name", dicCode = "id") | |||
| @Schema(description = "用户") | |||
| private java.lang.String userId; | |||
| /**得分*/ | |||
| @Excel(name = "得分", width = 15) | |||
| @Schema(description = "得分") | |||
| private java.lang.Double score; | |||
| /**方案json*/ | |||
| @Excel(name = "方案json", width = 15) | |||
| @Schema(description = "方案json") | |||
| private java.lang.String json; | |||
| /**商品ID列表*/ | |||
| @Excel(name = "商品ID列表", width = 15) | |||
| @Schema(description = "商品ID列表,多个用逗号分隔") | |||
| private java.lang.String productIds; | |||
| /**方案ID列表*/ | |||
| @Excel(name = "方案ID列表", width = 15) | |||
| @Schema(description = "方案ID列表,多个用逗号分隔") | |||
| private java.lang.String schemeIds; | |||
| /**健康评分详情*/ | |||
| @Excel(name = "健康评分详情", width = 15) | |||
| @Schema(description = "健康评分详情JSON,包含饮食、作息、体质、心理、运动五个维度的分数") | |||
| private java.lang.String scoreDetail; | |||
| @TableField(exist = false) | |||
| @Schema(description = "答题记录列表") | |||
| private List<AppletPaperReportItem> reportItems; | |||
| @TableField(exist = false) | |||
| @Schema(description = "商品列表") | |||
| private List<AppletProduct> productList; | |||
| } | |||
| @ -0,0 +1,81 @@ | |||
| package org.jeecg.modules.demo.appletPaperReport.entity; | |||
| import java.io.Serializable; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.baomidou.mybatisplus.annotation.TableLogic; | |||
| import org.jeecg.common.constant.ProvinceCityArea; | |||
| import org.jeecg.common.util.SpringContextUtils; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import java.util.Date; | |||
| import io.swagger.v3.oas.annotations.media.Schema; | |||
| import java.io.UnsupportedEncodingException; | |||
| /** | |||
| * @Description: 试卷报告子项 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Schema(description="试卷报告子项") | |||
| @Data | |||
| @TableName("applet_paper_report_item") | |||
| public class AppletPaperReportItem implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @Schema(description = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @Schema(description = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| @Schema(description = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @Schema(description = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| @Schema(description = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**所属部门*/ | |||
| @Schema(description = "所属部门") | |||
| private java.lang.String sysOrgCode; | |||
| /**报告*/ | |||
| @Schema(description = "报告") | |||
| private java.lang.String reportId; | |||
| /**题目*/ | |||
| @Excel(name = "题目", width = 15) | |||
| @Schema(description = "题目") | |||
| private java.lang.String questionsId; | |||
| /**题目内容*/ | |||
| @Excel(name = "题目内容", width = 15) | |||
| @Schema(description = "题目内容") | |||
| private java.lang.String questionsName; | |||
| /**商品*/ | |||
| @Excel(name = "商品", width = 15, dictTable = "applet_product", dicText = "name", dicCode = "id") | |||
| @Schema(description = "商品") | |||
| private java.lang.String productId; | |||
| /**答案*/ | |||
| @Excel(name = "答案", width = 15) | |||
| @Schema(description = "答案") | |||
| private java.lang.String answer; | |||
| /**题目类型*/ | |||
| @Excel(name = "题目类型", width = 15) | |||
| @Schema(description = "题目类型") | |||
| private java.lang.String type; | |||
| /**方案*/ | |||
| @Excel(name = "方案", width = 15, dictTable = "applet_scheme", dicText = "title", dicCode = "id") | |||
| @Schema(description = "方案") | |||
| private java.lang.String schemeId; | |||
| } | |||
| @ -0,0 +1,31 @@ | |||
| package org.jeecg.modules.demo.appletPaperReport.mapper; | |||
| import java.util.List; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReportItem; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| /** | |||
| * @Description: 试卷报告子项 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface AppletPaperReportItemMapper extends BaseMapper<AppletPaperReportItem> { | |||
| /** | |||
| * 通过主表id删除子表数据 | |||
| * | |||
| * @param mainId 主表id | |||
| * @return boolean | |||
| */ | |||
| public boolean deleteByMainId(@Param("mainId") String mainId); | |||
| /** | |||
| * 通过主表id查询子表数据 | |||
| * | |||
| * @param mainId 主表id | |||
| * @return List<AppletPaperReportItem> | |||
| */ | |||
| public List<AppletPaperReportItem> selectByMainId(@Param("mainId") String mainId); | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.demo.appletPaperReport.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReport; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 试卷报告 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface AppletPaperReportMapper extends BaseMapper<AppletPaperReport> { | |||
| } | |||
| @ -0,0 +1,16 @@ | |||
| <?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.demo.appletPaperReport.mapper.AppletPaperReportItemMapper"> | |||
| <delete id="deleteByMainId" parameterType="java.lang.String"> | |||
| DELETE | |||
| FROM applet_paper_report_item | |||
| WHERE | |||
| report_id = #{mainId} </delete> | |||
| <select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReportItem"> | |||
| SELECT * | |||
| FROM applet_paper_report_item | |||
| WHERE | |||
| report_id = #{mainId} </select> | |||
| </mapper> | |||
| @ -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.demo.appletPaperReport.mapper.AppletPaperReportMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,22 @@ | |||
| package org.jeecg.modules.demo.appletPaperReport.service; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReportItem; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| import java.util.List; | |||
| /** | |||
| * @Description: 试卷报告子项 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IAppletPaperReportItemService extends IService<AppletPaperReportItem> { | |||
| /** | |||
| * 通过主表id查询子表数据 | |||
| * | |||
| * @param mainId 主表id | |||
| * @return List<AppletPaperReportItem> | |||
| */ | |||
| public List<AppletPaperReportItem> selectByMainId(String mainId); | |||
| } | |||
| @ -0,0 +1,48 @@ | |||
| package org.jeecg.modules.demo.appletPaperReport.service; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReportItem; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReport; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| import java.io.Serializable; | |||
| import java.util.Collection; | |||
| import java.util.List; | |||
| /** | |||
| * @Description: 试卷报告 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IAppletPaperReportService extends IService<AppletPaperReport> { | |||
| /** | |||
| * 添加一对多 | |||
| * | |||
| * @param appletPaperReport | |||
| * @param appletPaperReportItemList | |||
| */ | |||
| public void saveMain(AppletPaperReport appletPaperReport,List<AppletPaperReportItem> appletPaperReportItemList) ; | |||
| /** | |||
| * 修改一对多 | |||
| * | |||
| * @param appletPaperReport | |||
| * @param appletPaperReportItemList | |||
| */ | |||
| public void updateMain(AppletPaperReport appletPaperReport,List<AppletPaperReportItem> appletPaperReportItemList); | |||
| /** | |||
| * 删除一对多 | |||
| * | |||
| * @param id | |||
| */ | |||
| public void delMain (String id); | |||
| /** | |||
| * 批量删除一对多 | |||
| * | |||
| * @param idList | |||
| */ | |||
| public void delBatchMain (Collection<? extends Serializable> idList); | |||
| } | |||
| @ -0,0 +1,27 @@ | |||
| package org.jeecg.modules.demo.appletPaperReport.service.impl; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReportItem; | |||
| import org.jeecg.modules.demo.appletPaperReport.mapper.AppletPaperReportItemMapper; | |||
| import org.jeecg.modules.demo.appletPaperReport.service.IAppletPaperReportItemService; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.List; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| /** | |||
| * @Description: 试卷报告子项 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class AppletPaperReportItemServiceImpl extends ServiceImpl<AppletPaperReportItemMapper, AppletPaperReportItem> implements IAppletPaperReportItemService { | |||
| @Autowired | |||
| private AppletPaperReportItemMapper appletPaperReportItemMapper; | |||
| @Override | |||
| public List<AppletPaperReportItem> selectByMainId(String mainId) { | |||
| return appletPaperReportItemMapper.selectByMainId(mainId); | |||
| } | |||
| } | |||
| @ -0,0 +1,77 @@ | |||
| package org.jeecg.modules.demo.appletPaperReport.service.impl; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReport; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReportItem; | |||
| import org.jeecg.modules.demo.appletPaperReport.mapper.AppletPaperReportItemMapper; | |||
| import org.jeecg.modules.demo.appletPaperReport.mapper.AppletPaperReportMapper; | |||
| import org.jeecg.modules.demo.appletPaperReport.service.IAppletPaperReportService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| import java.util.Collection; | |||
| /** | |||
| * @Description: 试卷报告 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class AppletPaperReportServiceImpl extends ServiceImpl<AppletPaperReportMapper, AppletPaperReport> implements IAppletPaperReportService { | |||
| @Autowired | |||
| private AppletPaperReportMapper appletPaperReportMapper; | |||
| @Autowired | |||
| private AppletPaperReportItemMapper appletPaperReportItemMapper; | |||
| @Override | |||
| @Transactional(rollbackFor = Exception.class) | |||
| public void saveMain(AppletPaperReport appletPaperReport, List<AppletPaperReportItem> appletPaperReportItemList) { | |||
| appletPaperReportMapper.insert(appletPaperReport); | |||
| if(appletPaperReportItemList!=null && appletPaperReportItemList.size()>0) { | |||
| for(AppletPaperReportItem entity:appletPaperReportItemList) { | |||
| //外键设置 | |||
| entity.setReportId(appletPaperReport.getId()); | |||
| appletPaperReportItemMapper.insert(entity); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = Exception.class) | |||
| public void updateMain(AppletPaperReport appletPaperReport,List<AppletPaperReportItem> appletPaperReportItemList) { | |||
| appletPaperReportMapper.updateById(appletPaperReport); | |||
| //1.先删除子表数据 | |||
| appletPaperReportItemMapper.deleteByMainId(appletPaperReport.getId()); | |||
| //2.子表数据重新插入 | |||
| if(appletPaperReportItemList!=null && appletPaperReportItemList.size()>0) { | |||
| for(AppletPaperReportItem entity:appletPaperReportItemList) { | |||
| //外键设置 | |||
| entity.setReportId(appletPaperReport.getId()); | |||
| appletPaperReportItemMapper.insert(entity); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = Exception.class) | |||
| public void delMain(String id) { | |||
| appletPaperReportItemMapper.deleteByMainId(id); | |||
| appletPaperReportMapper.deleteById(id); | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = Exception.class) | |||
| public void delBatchMain(Collection<? extends Serializable> idList) { | |||
| for(Serializable id:idList) { | |||
| appletPaperReportItemMapper.deleteByMainId(id.toString()); | |||
| appletPaperReportMapper.deleteById(id); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,86 @@ | |||
| package org.jeecg.modules.demo.appletPaperReport.vo; | |||
| import java.util.List; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReport; | |||
| import org.jeecg.modules.demo.appletPaperReport.entity.AppletPaperReportItem; | |||
| import lombok.Data; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecgframework.poi.excel.annotation.ExcelEntity; | |||
| import org.jeecgframework.poi.excel.annotation.ExcelCollection; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import java.util.Date; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import org.jeecg.common.constant.ProvinceCityArea; | |||
| import org.jeecg.common.util.SpringContextUtils; | |||
| import io.swagger.v3.oas.annotations.media.Schema; | |||
| /** | |||
| * @Description: 试卷报告 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @Schema(description="试卷报告") | |||
| public class AppletPaperReportPage { | |||
| /**主键*/ | |||
| @Schema(description = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @Schema(description = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| @Schema(description = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @Schema(description = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| @Schema(description = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**所属部门*/ | |||
| @Schema(description = "所属部门") | |||
| private java.lang.String sysOrgCode; | |||
| /**试卷名称*/ | |||
| @Excel(name = "试卷名称", width = 15) | |||
| @Schema(description = "试卷名称") | |||
| private java.lang.String title; | |||
| /**英文名称*/ | |||
| @Excel(name = "英文名称", width = 15) | |||
| @Schema(description = "英文名称") | |||
| private java.lang.String enTitle; | |||
| /**小提示*/ | |||
| @Excel(name = "小提示", width = 15) | |||
| @Schema(description = "小提示") | |||
| private java.lang.String tips; | |||
| /**试卷*/ | |||
| @Excel(name = "试卷", width = 15, dictTable = "applet_paper", dicText = "title", dicCode = "id") | |||
| @Dict(dictTable = "applet_paper", dicText = "title", dicCode = "id") | |||
| @Schema(description = "试卷") | |||
| private java.lang.String paperId; | |||
| /**用户*/ | |||
| @Excel(name = "用户", width = 15, dictTable = "applet_user", dicText = "name", dicCode = "id") | |||
| @Dict(dictTable = "applet_user", dicText = "name", dicCode = "id") | |||
| @Schema(description = "用户") | |||
| private java.lang.String userId; | |||
| /**得分*/ | |||
| @Excel(name = "得分", width = 15) | |||
| @Schema(description = "得分") | |||
| private java.lang.Double score; | |||
| /**方案json*/ | |||
| @Excel(name = "方案json", width = 15) | |||
| @Schema(description = "方案json") | |||
| private java.lang.String json; | |||
| @ExcelCollection(name="试卷报告子项") | |||
| @Schema(description = "试卷报告子项") | |||
| private List<AppletPaperReportItem> appletPaperReportItemList; | |||
| } | |||
| @ -0,0 +1,71 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import { useMessage } from "/@/hooks/web/useMessage"; | |||
| const { createConfirm } = useMessage(); | |||
| enum Api { | |||
| list = '/appletPaperReport/appletPaperReport/list', | |||
| save='/appletPaperReport/appletPaperReport/add', | |||
| edit='/appletPaperReport/appletPaperReport/edit', | |||
| deleteOne = '/appletPaperReport/appletPaperReport/delete', | |||
| deleteBatch = '/appletPaperReport/appletPaperReport/deleteBatch', | |||
| importExcel = '/appletPaperReport/appletPaperReport/importExcel', | |||
| exportXls = '/appletPaperReport/appletPaperReport/exportXls', | |||
| appletPaperReportItemList = '/appletPaperReport/appletPaperReport/queryAppletPaperReportItemByMainId', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 查询子表数据 | |||
| * @param params | |||
| */ | |||
| export const appletPaperReportItemList = Api.appletPaperReportItemList; | |||
| /** | |||
| * 列表接口 | |||
| * @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) => { | |||
| createConfirm({ | |||
| iconType: 'warning', | |||
| 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,185 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types' | |||
| import { getWeekMonthQuarterYear } from '/@/utils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '试卷名称', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '英文名称', | |||
| align:"center", | |||
| dataIndex: 'enTitle' | |||
| }, | |||
| { | |||
| title: '小提示', | |||
| align:"center", | |||
| dataIndex: 'tips' | |||
| }, | |||
| { | |||
| title: '试卷', | |||
| align:"center", | |||
| dataIndex: 'paperId_dictText' | |||
| }, | |||
| { | |||
| title: '用户', | |||
| align:"center", | |||
| dataIndex: 'userId_dictText' | |||
| }, | |||
| { | |||
| title: '得分', | |||
| align:"center", | |||
| dataIndex: 'score' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| { | |||
| label: "试卷", | |||
| field: "paperId", | |||
| component: 'JSearchSelect', | |||
| componentProps:{ | |||
| dict:"applet_paper,title,id" | |||
| }, | |||
| //colProps: {span: 6}, | |||
| }, | |||
| { | |||
| label: "用户", | |||
| field: "userId", | |||
| component: 'JSearchSelect', | |||
| componentProps:{ | |||
| dict:"applet_user,name,id" | |||
| }, | |||
| //colProps: {span: 6}, | |||
| }, | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '试卷名称', | |||
| field: 'title', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '英文名称', | |||
| field: 'enTitle', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '小提示', | |||
| field: 'tips', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '试卷', | |||
| field: 'paperId', | |||
| component: 'JSearchSelect', | |||
| componentProps:{ | |||
| dict:"applet_paper,title,id" | |||
| }, | |||
| }, | |||
| { | |||
| label: '用户', | |||
| field: 'userId', | |||
| component: 'JSearchSelect', | |||
| componentProps:{ | |||
| dict:"applet_user,name,id" | |||
| }, | |||
| }, | |||
| { | |||
| label: '得分', | |||
| field: 'score', | |||
| component: 'InputNumber', | |||
| }, | |||
| // TODO 主键隐藏字段,目前写死为ID | |||
| { | |||
| label: '', | |||
| field: 'id', | |||
| component: 'Input', | |||
| show: false | |||
| }, | |||
| ]; | |||
| //子表单数据 | |||
| //子表表格配置 | |||
| export const appletPaperReportItemColumns: JVxeColumn[] = [ | |||
| { | |||
| title: '题目', | |||
| key: 'questionsId', | |||
| type: JVxeTypes.input, | |||
| width:"200px", | |||
| placeholder: '请输入${title}', | |||
| defaultValue:'', | |||
| }, | |||
| { | |||
| title: '题目内容', | |||
| key: 'questionsName', | |||
| type: JVxeTypes.input, | |||
| width:"200px", | |||
| placeholder: '请输入${title}', | |||
| defaultValue:'', | |||
| }, | |||
| { | |||
| title: '商品', | |||
| key: 'productId', | |||
| type: JVxeTypes.selectMultiple, | |||
| options:[], | |||
| dictCode:"applet_product,name,id", | |||
| width:"250px", | |||
| placeholder: '请输入${title}', | |||
| defaultValue:'', | |||
| }, | |||
| { | |||
| title: '答案', | |||
| key: 'answer', | |||
| type: JVxeTypes.input, | |||
| width:"200px", | |||
| placeholder: '请输入${title}', | |||
| defaultValue:'', | |||
| }, | |||
| { | |||
| title: '题目类型', | |||
| key: 'type', | |||
| type: JVxeTypes.input, | |||
| width:"200px", | |||
| placeholder: '请输入${title}', | |||
| defaultValue:'', | |||
| }, | |||
| { | |||
| title: '方案', | |||
| key: 'schemeId', | |||
| type: JVxeTypes.selectMultiple, | |||
| options:[], | |||
| dictCode:"applet_scheme,title,id", | |||
| width:"250px", | |||
| placeholder: '请输入${title}', | |||
| defaultValue:'', | |||
| }, | |||
| ] | |||
| // 高级查询数据 | |||
| export const superQuerySchema = { | |||
| title: {title: '试卷名称',order: 0,view: 'text', type: 'string',}, | |||
| enTitle: {title: '英文名称',order: 1,view: 'text', type: 'string',}, | |||
| tips: {title: '小提示',order: 2,view: 'text', type: 'string',}, | |||
| paperId: {title: '试卷',order: 3,view: 'sel_search', type: 'string',dictTable: "applet_paper", dictCode: 'id', dictText: 'title',}, | |||
| userId: {title: '用户',order: 4,view: 'sel_search', type: 'string',dictTable: "applet_user", dictCode: 'id', dictText: 'name',}, | |||
| score: {title: '得分',order: 5,view: 'number', type: 'number',}, | |||
| //子表高级查询 | |||
| appletPaperReportItem: { | |||
| title: '试卷报告子项', | |||
| view: 'table', | |||
| fields: { | |||
| questionsId: {title: '题目',order: 0,view: 'text', type: 'string',}, | |||
| questionsName: {title: '题目内容',order: 1,view: 'text', type: 'string',}, | |||
| productId: {title: '商品',order: 2,view: 'list_multi', type: 'string',dictTable: "applet_product", dictCode: 'id', dictText: 'name',}, | |||
| answer: {title: '答案',order: 3,view: 'text', type: 'string',}, | |||
| type: {title: '题目类型',order: 4,view: 'text', type: 'string',}, | |||
| schemeId: {title: '方案',order: 5,view: 'list_multi', type: 'string',dictTable: "applet_scheme", dictCode: 'id', dictText: 'title',}, | |||
| } | |||
| }, | |||
| }; | |||
| @ -0,0 +1,206 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" v-auth="'appletPaperReport:applet_paper_report:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" v-auth="'appletPaperReport:applet_paper_report:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" v-auth="'appletPaperReport:applet_paper_report:importExcel'" 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 v-auth="'appletPaperReport:applet_paper_report:deleteBatch'">批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| <!-- 高级查询 --> | |||
| <super-query :config="superQueryConfig" @search="handleSuperQuery" /> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template v-slot:bodyCell="{ column, record, index, text }"> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <AppletPaperReportModal @register="registerModal" @success="handleSuccess"></AppletPaperReportModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="appletPaperReport-appletPaperReport" setup> | |||
| import {ref, reactive, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import {useModal} from '/@/components/Modal'; | |||
| import AppletPaperReportModal from './components/AppletPaperReportModal.vue' | |||
| import {columns, searchFormSchema, superQuerySchema} from './AppletPaperReport.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AppletPaperReport.api'; | |||
| import {downloadFile} from '/@/utils/common/renderUtils'; | |||
| import { useUserStore } from '/@/store/modules/user'; | |||
| import { useMessage } from '/@/hooks/web/useMessage'; | |||
| import { getDateByPicker } from '/@/utils'; | |||
| //日期个性化选择 | |||
| const fieldPickers = reactive({ | |||
| }); | |||
| const queryParam = reactive<any>({}); | |||
| const userStore = useUserStore(); | |||
| const { createMessage } = useMessage(); | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '试卷报告', | |||
| api: list, | |||
| columns, | |||
| canResize:true, | |||
| formConfig: { | |||
| //labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToNumber: [ | |||
| ], | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| fixed:'right' | |||
| }, | |||
| beforeFetch: (params) => { | |||
| if (params && fieldPickers) { | |||
| for (let key in fieldPickers) { | |||
| if (params[key]) { | |||
| params[key] = getDateByPicker(params[key], fieldPickers[key]); | |||
| } | |||
| } | |||
| } | |||
| return Object.assign(params, queryParam); | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"试卷报告", | |||
| url: getExportUrl, | |||
| params: queryParam, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl, | |||
| success: handleSuccess | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| // 高级查询配置 | |||
| const superQueryConfig = reactive(superQuerySchema); | |||
| /** | |||
| * 高级查询事件 | |||
| */ | |||
| function handleSuperQuery(params) { | |||
| Object.keys(params).map((k) => { | |||
| queryParam[k] = params[k]; | |||
| }); | |||
| reload(); | |||
| } | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| 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}, handleSuccess); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: selectedRowKeys.value}, handleSuccess); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| (selectedRowKeys.value = []) && reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| auth: 'appletPaperReport:applet_paper_report:edit' | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| placement: 'topLeft' | |||
| }, | |||
| auth: 'appletPaperReport:applet_paper_report:delete' | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| :deep(.ant-picker),:deep(.ant-input-number){ | |||
| width: 100%; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,26 @@ | |||
| -- 注意:该页面对应的前台目录为views/appletPaperReport文件夹下 | |||
| -- 如果你想更改到其他目录,请修改sql中component字段对应的值 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) | |||
| VALUES ('202508280435930390', NULL, '试卷报告', '/appletPaperReport/appletPaperReportList', 'appletPaperReport/AppletPaperReportList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-08-28 16:35:39', NULL, NULL, 0); | |||
| -- 权限控制sql | |||
| -- 新增 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('202508280435930391', '202508280435930390', '添加试卷报告', NULL, NULL, 0, NULL, NULL, 2, 'appletPaperReport:applet_paper_report:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:39', NULL, NULL, 0, 0, '1', 0); | |||
| -- 编辑 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('202508280435930392', '202508280435930390', '编辑试卷报告', NULL, NULL, 0, NULL, NULL, 2, 'appletPaperReport:applet_paper_report:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:39', NULL, NULL, 0, 0, '1', 0); | |||
| -- 删除 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('202508280435930393', '202508280435930390', '删除试卷报告', NULL, NULL, 0, NULL, NULL, 2, 'appletPaperReport:applet_paper_report:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:39', NULL, NULL, 0, 0, '1', 0); | |||
| -- 批量删除 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('202508280435930394', '202508280435930390', '批量删除试卷报告', NULL, NULL, 0, NULL, NULL, 2, 'appletPaperReport:applet_paper_report:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:39', NULL, NULL, 0, 0, '1', 0); | |||
| -- 导出excel | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('202508280435930395', '202508280435930390', '导出excel_试卷报告', NULL, NULL, 0, NULL, NULL, 2, 'appletPaperReport:applet_paper_report:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:39', NULL, NULL, 0, 0, '1', 0); | |||
| -- 导入excel | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('202508280435930396', '202508280435930390', '导入excel_试卷报告', NULL, NULL, 0, NULL, NULL, 2, 'appletPaperReport:applet_paper_report:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:39', NULL, NULL, 0, 0, '1', 0); | |||
| @ -0,0 +1,171 @@ | |||
| <template> | |||
| <div> | |||
| <!-- 子表单区域 --> | |||
| <a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs"> | |||
| <!--主表区域 --> | |||
| <a-tab-pane tab="试卷报告" :key="refKeys[0]" :forceRender="true" :style="tabsStyle"> | |||
| <BasicForm @register="registerForm" ref="formRef"/> | |||
| </a-tab-pane> | |||
| <!--子表单区域 --> | |||
| <a-tab-pane tab="试卷报告子项" key="appletPaperReportItem" :forceRender="true" :style="tabsStyle"> | |||
| <JVxeTable | |||
| keep-source | |||
| resizable | |||
| ref="appletPaperReportItem" | |||
| v-if="appletPaperReportItemTable.show" | |||
| :loading="appletPaperReportItemTable.loading" | |||
| :columns="appletPaperReportItemTable.columns" | |||
| :dataSource="appletPaperReportItemTable.dataSource" | |||
| :height="340" | |||
| :disabled="formDisabled" | |||
| :rowNumber="true" | |||
| :rowSelection="true" | |||
| :toolbar="true" | |||
| /> | |||
| </a-tab-pane> | |||
| </a-tabs> | |||
| <div style="width: 100%;text-align: center;margin-top: 10px;" v-if="showFlowSubmitButton"> | |||
| <a-button preIcon="ant-design:check-outlined" style="width: 126px" type="primary" @click="handleSubmit">提 交</a-button> | |||
| </div> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import { defHttp } from '/@/utils/http/axios'; | |||
| import {ref, computed, unref,reactive, onMounted, defineProps } from 'vue'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import { JVxeTable } from '/@/components/jeecg/JVxeTable' | |||
| import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods.ts' | |||
| import {formSchema,appletPaperReportItemColumns} from '../AppletPaperReport.data'; | |||
| import {saveOrUpdate,appletPaperReportItemList} from '../AppletPaperReport.api'; | |||
| import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils' | |||
| const refKeys = ref(['appletPaperReport','appletPaperReportItem', ]); | |||
| const activeKey = ref('appletPaperReport'); | |||
| const appletPaperReportItem = ref(); | |||
| const tableRefs = {appletPaperReportItem, }; | |||
| const appletPaperReportItemTable = reactive({ | |||
| loading: false, | |||
| dataSource: [], | |||
| columns:appletPaperReportItemColumns, | |||
| show: false | |||
| }) | |||
| const props = defineProps({ | |||
| formData: { type: Object, default: ()=>{} }, | |||
| formBpm: { type: Boolean, default: true } | |||
| }); | |||
| const formDisabled = computed(()=>{ | |||
| if(props.formBpm === true){ | |||
| if(props.formData.disabled === false){ | |||
| return false; | |||
| } | |||
| } | |||
| return true; | |||
| }); | |||
| // 是否显示提交按钮 | |||
| const showFlowSubmitButton = computed(()=>{ | |||
| if(props.formBpm === true){ | |||
| if(props.formData.disabled === false){ | |||
| return true | |||
| } | |||
| } | |||
| return false | |||
| }); | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| baseColProps: {span: 24} | |||
| }); | |||
| onMounted(()=>{ | |||
| initFormData(); | |||
| }); | |||
| //渲染流程表单数据 | |||
| const queryByIdUrl = '/appletPaperReport/appletPaperReport/queryById'; | |||
| async function initFormData(){ | |||
| if(props.formBpm === true){ | |||
| await reset(); | |||
| let params = {id: props.formData.dataId}; | |||
| const data = await defHttp.get({url: queryByIdUrl, params}); | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data | |||
| }); | |||
| requestSubTableData(appletPaperReportItemList, {id: data.id}, appletPaperReportItemTable, ()=>{ | |||
| appletPaperReportItemTable.show = true; | |||
| }) | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: formDisabled.value }) | |||
| } | |||
| } | |||
| //方法配置 | |||
| const [handleChangeTabs,handleSubmit,requestSubTableData,formRef] = useJvxeMethod(requestAddOrEdit,classifyIntoFormData,tableRefs,activeKey,refKeys); | |||
| // 弹窗tabs滚动区域的高度 | |||
| const tabsStyle = computed(() => { | |||
| let height: Nullable<string> = null | |||
| let minHeight = '100px' | |||
| // 弹窗wrapper | |||
| let overflow = 'auto'; | |||
| return {height, minHeight, overflow}; | |||
| }) | |||
| async function reset(){ | |||
| await resetFields(); | |||
| activeKey.value = 'appletPaperReport'; | |||
| appletPaperReportItemTable.dataSource = []; | |||
| } | |||
| function classifyIntoFormData(allValues) { | |||
| let main = Object.assign({}, allValues.formValue) | |||
| return { | |||
| ...main, // 展开 | |||
| appletPaperReportItemList: allValues.tablesValue[0].tableData, | |||
| } | |||
| } | |||
| //表单提交事件 | |||
| async function requestAddOrEdit(values) { | |||
| //提交表单 | |||
| await saveOrUpdate(values, true); | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** 时间和数字输入框样式 */ | |||
| :deep(.ant-input-number) { | |||
| width: 100%; | |||
| } | |||
| :deep(.ant-calendar-picker) { | |||
| width: 100%; | |||
| } | |||
| </style> | |||
| <style lang="less"> | |||
| // Online表单Tab风格专属样式 | |||
| .j-cgform-tab-modal { | |||
| .ant-modal-header { | |||
| padding-top: 8px; | |||
| padding-bottom: 8px; | |||
| border-bottom: none !important; | |||
| } | |||
| .ant-modal .ant-modal-body > .scrollbar, | |||
| .ant-tabs-nav .ant-tabs-tab { | |||
| padding-top: 0; | |||
| } | |||
| .ant-tabs-top-bar { | |||
| width: calc(100% - 55px); | |||
| position: relative; | |||
| left: -14px; | |||
| } | |||
| .ant-tabs .ant-tabs-top-content > .ant-tabs-tabpane { | |||
| overflow: hidden auto; | |||
| } | |||
| } | |||
| </style> | |||
| @ -0,0 +1,240 @@ | |||
| <template> | |||
| <BasicModal ref="modalRef" destroyOnClose wrapClassName="j-cgform-tab-modal" v-bind="$attrs" @register="registerModal" :width="800" @ok="handleSubmit"> | |||
| <!-- 标题区域 --> | |||
| <template #title> | |||
| <div class="titleArea"> | |||
| <div class="title">{{ title }}</div> | |||
| <div class="right"> | |||
| <a-radio-group v-model:value="activeKey"> | |||
| <template v-for="(item, index) in tabNav" :key="index"> | |||
| <a-radio-button :value="item.tableName">{{ item.tableTxt }}</a-radio-button> | |||
| </template> | |||
| </a-radio-group> | |||
| </div> | |||
| </div> | |||
| </template> | |||
| <!--表单区域 --> | |||
| <div class="contentArea"> | |||
| <!--主表区域 --> | |||
| <BasicForm @register="registerForm" ref="formRef" v-show="activeKey == refKeys[0]" name="AppletPaperReportForm"/> | |||
| <!--子表区域 --> | |||
| <JVxeTable | |||
| v-show="activeKey == 'appletPaperReportItem'" | |||
| keep-source | |||
| resizable | |||
| ref="appletPaperReportItem" | |||
| :loading="appletPaperReportItemTable.loading" | |||
| :columns="appletPaperReportItemTable.columns" | |||
| :dataSource="appletPaperReportItemTable.dataSource" | |||
| :height="340" | |||
| :disabled="formDisabled" | |||
| :rowNumber="true" | |||
| :rowSelection="true" | |||
| :toolbar="true" | |||
| /> | |||
| </div> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref,reactive} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import { JVxeTable } from '/@/components/jeecg/JVxeTable' | |||
| import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods.ts' | |||
| import {formSchema,appletPaperReportItemColumns} from '../AppletPaperReport.data'; | |||
| import {saveOrUpdate,appletPaperReportItemList} from '../AppletPaperReport.api'; | |||
| import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils' | |||
| import { useMessage } from '/@/hooks/web/useMessage'; | |||
| import { getDateByPicker } from '/@/utils'; | |||
| //日期个性化选择 | |||
| const fieldPickers = reactive({ | |||
| }); | |||
| const appletPaperReportItemFieldPickers = reactive({ | |||
| }); | |||
| const { createMessage } = useMessage(); | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| const formDisabled = ref(false); | |||
| const modalRef = ref(); | |||
| const refKeys = ref(['appletPaperReport','appletPaperReportItem', ]); | |||
| const tabNav = ref<any>([ | |||
| { tableName: 'appletPaperReport', tableTxt: '试卷报告' }, | |||
| { tableName: 'appletPaperReportItem', tableTxt: '试卷报告子项' }, | |||
| ]); | |||
| const activeKey = ref('appletPaperReport'); | |||
| const appletPaperReportItem = ref(); | |||
| const tableRefs = {appletPaperReportItem, }; | |||
| const appletPaperReportItemTable = reactive({ | |||
| loading: false, | |||
| dataSource: [], | |||
| columns:appletPaperReportItemColumns | |||
| }) | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| baseColProps: {span: 24} | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await reset(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:data?.showFooter,showOkBtn:data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| formDisabled.value = !data?.showFooter; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| requestSubTableData(appletPaperReportItemList, {id:data?.record?.id}, appletPaperReportItemTable) | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //方法配置 | |||
| const [handleChangeTabs,handleSubmit,requestSubTableData,formRef] = useJvxeMethod(requestAddOrEdit,classifyIntoFormData,tableRefs,activeKey,refKeys); | |||
| // 弹窗tabs滚动区域的高度 | |||
| const tabsStyle = computed(() => { | |||
| let height: Nullable<string> = null | |||
| let minHeight = '100px' | |||
| let maxHeight: Nullable<string> = '500px' | |||
| // 弹窗wrapper | |||
| let modalWrapperRef = modalRef.value?.modalWrapperRef | |||
| if (modalWrapperRef) { | |||
| if (modalWrapperRef.fullScreen) { | |||
| height = 'calc(' + modalWrapperRef.spinStyle.height + ' - 50px)'; | |||
| maxHeight = null | |||
| } | |||
| } | |||
| let overflow = 'auto'; | |||
| return {height, minHeight, maxHeight, overflow}; | |||
| }) | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(formDisabled) ? '编辑' : '详情')); | |||
| //重置 | |||
| async function reset(){ | |||
| await resetFields(); | |||
| activeKey.value = 'appletPaperReport'; | |||
| appletPaperReportItemTable.dataSource = []; | |||
| } | |||
| function classifyIntoFormData(allValues) { | |||
| let main = Object.assign({}, allValues.formValue) | |||
| return { | |||
| ...main, // 展开 | |||
| appletPaperReportItemList: allValues.tablesValue[0].tableData, | |||
| } | |||
| } | |||
| //表单提交事件 | |||
| async function requestAddOrEdit(values) { | |||
| try { | |||
| // 预处理日期数据 | |||
| changeDateValue(values); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| /** | |||
| * 处理日期值 | |||
| * @param formData 表单数据 | |||
| */ | |||
| const changeDateValue = (formData) => { | |||
| if (formData && fieldPickers) { | |||
| for (let key in fieldPickers) { | |||
| if (formData[key]) { | |||
| formData[key] = getDateByPicker(formData[key], fieldPickers[key]); | |||
| } | |||
| } | |||
| } | |||
| if(formData && formData.appletPaperReportItemList && formData.appletPaperReportItemList.length > 0){ | |||
| formData.appletPaperReportItemList.forEach(subFormData=>{ | |||
| for (let key in appletPaperReportItemFieldPickers) { | |||
| if (subFormData[key]) { | |||
| subFormData[key] = getDateByPicker(subFormData[key], appletPaperReportItemFieldPickers[key]); | |||
| } | |||
| } | |||
| }) | |||
| } | |||
| }; | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** 时间和数字输入框样式 */ | |||
| :deep(.ant-input-number) { | |||
| width: 100%; | |||
| } | |||
| :deep(.ant-calendar-picker) { | |||
| width: 100%; | |||
| } | |||
| .titleArea { | |||
| display: flex; | |||
| align-content: center; | |||
| padding-right: 70px; | |||
| .title { | |||
| margin-right: 16px; | |||
| line-height: 32px; | |||
| } | |||
| .right { | |||
| overflow-x: auto; | |||
| overflow-y: hidden; | |||
| flex: 1; | |||
| white-space: nowrap; | |||
| .ant-radio-group { | |||
| font-weight: normal; | |||
| } | |||
| } | |||
| } | |||
| html[data-theme='light'] { | |||
| .right { | |||
| .ant-radio-group { | |||
| :deep(.ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked)) { | |||
| color: #555; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| </style> | |||
| <style lang="less"> | |||
| // Online表单Tab风格专属样式 | |||
| .j-cgform-tab-modal { | |||
| .contentArea { | |||
| padding: 20px 1.5% 0; | |||
| } | |||
| //.ant-modal-header { | |||
| // padding-top: 8px; | |||
| // padding-bottom: 8px; | |||
| // border-bottom: none !important; | |||
| //} | |||
| .ant-modal .ant-modal-body > .scrollbar, | |||
| .ant-tabs-nav .ant-tabs-tab { | |||
| padding-top: 0; | |||
| } | |||
| .ant-tabs-top-bar { | |||
| width: calc(100% - 55px); | |||
| position: relative; | |||
| left: -14px; | |||
| } | |||
| .ant-tabs .ant-tabs-top-content > .ant-tabs-tabpane { | |||
| overflow: hidden auto; | |||
| } | |||
| } | |||
| </style> | |||
| @ -0,0 +1,182 @@ | |||
| package org.jeecg.modules.demo.appletScheme.controller; | |||
| import java.util.Arrays; | |||
| import java.util.HashMap; | |||
| 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.system.query.QueryRuleEnum; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.demo.appletScheme.entity.AppletScheme; | |||
| import org.jeecg.modules.demo.appletScheme.service.IAppletSchemeService; | |||
| 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.v3.oas.annotations.tags.Tag; | |||
| import io.swagger.v3.oas.annotations.Operation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
| /** | |||
| * @Description: 方案 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Tag(name="方案") | |||
| @RestController | |||
| @RequestMapping("/appletScheme/appletScheme") | |||
| @Slf4j | |||
| public class AppletSchemeController extends JeecgController<AppletScheme, IAppletSchemeService> { | |||
| @Autowired | |||
| private IAppletSchemeService appletSchemeService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param appletScheme | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "方案-分页列表查询") | |||
| @Operation(summary="方案-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<AppletScheme>> queryPageList(AppletScheme appletScheme, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<AppletScheme> queryWrapper = QueryGenerator.initQueryWrapper(appletScheme, req.getParameterMap()); | |||
| Page<AppletScheme> page = new Page<AppletScheme>(pageNo, pageSize); | |||
| IPage<AppletScheme> pageList = appletSchemeService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param appletScheme | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "方案-添加") | |||
| @Operation(summary="方案-添加") | |||
| @RequiresPermissions("appletScheme:applet_scheme:add") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody AppletScheme appletScheme) { | |||
| appletSchemeService.save(appletScheme); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param appletScheme | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "方案-编辑") | |||
| @Operation(summary="方案-编辑") | |||
| @RequiresPermissions("appletScheme:applet_scheme:edit") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody AppletScheme appletScheme) { | |||
| appletSchemeService.updateById(appletScheme); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "方案-通过id删除") | |||
| @Operation(summary="方案-通过id删除") | |||
| @RequiresPermissions("appletScheme:applet_scheme:delete") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| appletSchemeService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "方案-批量删除") | |||
| @Operation(summary="方案-批量删除") | |||
| @RequiresPermissions("appletScheme:applet_scheme:deleteBatch") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.appletSchemeService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "方案-通过id查询") | |||
| @Operation(summary="方案-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<AppletScheme> queryById(@RequestParam(name="id",required=true) String id) { | |||
| AppletScheme appletScheme = appletSchemeService.getById(id); | |||
| if(appletScheme==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(appletScheme); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param appletScheme | |||
| */ | |||
| @RequiresPermissions("appletScheme:applet_scheme:exportXls") | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, AppletScheme appletScheme) { | |||
| return super.exportXls(request, appletScheme, AppletScheme.class, "方案"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequiresPermissions("appletScheme:applet_scheme:importExcel") | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, AppletScheme.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,72 @@ | |||
| package org.jeecg.modules.demo.appletScheme.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 com.baomidou.mybatisplus.annotation.TableLogic; | |||
| import org.jeecg.common.constant.ProvinceCityArea; | |||
| import org.jeecg.common.util.SpringContextUtils; | |||
| 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.v3.oas.annotations.media.Schema; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 方案 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("applet_scheme") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @Schema(description="方案") | |||
| public class AppletScheme implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @Schema(description = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @Schema(description = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| @Schema(description = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @Schema(description = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| @Schema(description = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**所属部门*/ | |||
| @Schema(description = "所属部门") | |||
| private java.lang.String sysOrgCode; | |||
| /**标题*/ | |||
| @Excel(name = "标题", width = 15) | |||
| @Schema(description = "标题") | |||
| private java.lang.String title; | |||
| /**描述*/ | |||
| @Excel(name = "描述", width = 15) | |||
| @Schema(description = "描述") | |||
| private java.lang.String info; | |||
| /**分类*/ | |||
| @Excel(name = "分类", width = 15, dictTable = "applet_scheme_category", dicText = "name", dicCode = "id") | |||
| @Dict(dictTable = "applet_scheme_category", dicText = "name", dicCode = "id") | |||
| @Schema(description = "分类") | |||
| private java.lang.String schemeCategory; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.demo.appletScheme.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.demo.appletScheme.entity.AppletScheme; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 方案 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface AppletSchemeMapper extends BaseMapper<AppletScheme> { | |||
| } | |||
| @ -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.demo.appletScheme.mapper.AppletSchemeMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.demo.appletScheme.service; | |||
| import org.jeecg.modules.demo.appletScheme.entity.AppletScheme; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 方案 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IAppletSchemeService extends IService<AppletScheme> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.demo.appletScheme.service.impl; | |||
| import org.jeecg.modules.demo.appletScheme.entity.AppletScheme; | |||
| import org.jeecg.modules.demo.appletScheme.mapper.AppletSchemeMapper; | |||
| import org.jeecg.modules.demo.appletScheme.service.IAppletSchemeService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 方案 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class AppletSchemeServiceImpl extends ServiceImpl<AppletSchemeMapper, AppletScheme> implements IAppletSchemeService { | |||
| } | |||
| @ -0,0 +1,95 @@ | |||
| <template> | |||
| <view> | |||
| <!--标题和返回--> | |||
| <cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName"> | |||
| <block slot="backText">返回</block> | |||
| <block slot="content">方案</block> | |||
| </cu-custom> | |||
| <!--表单区域--> | |||
| <view> | |||
| <form> | |||
| <view class="cu-form-group"> | |||
| <view class="flex align-center"> | |||
| <view class="title"><text space="ensp">标题:</text></view> | |||
| <input placeholder="请输入标题" v-model="model.title"/> | |||
| </view> | |||
| </view> | |||
| <view class="cu-form-group"> | |||
| <view class="flex align-center"> | |||
| <view class="title"><text space="ensp">描述:</text></view> | |||
| <input placeholder="请输入描述" v-model="model.info"/> | |||
| </view> | |||
| </view> | |||
| <view class="cu-form-group"> | |||
| <view class="flex align-center"> | |||
| <view class="title"><text space="ensp">分类:</text></view> | |||
| <input placeholder="请输入分类" v-model="model.schemeCategory"/> | |||
| </view> | |||
| </view> | |||
| <view class="padding"> | |||
| <button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit"> | |||
| <text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交 | |||
| </button> | |||
| </view> | |||
| </form> | |||
| </view> | |||
| </view> | |||
| </template> | |||
| <script> | |||
| import myDate from '@/components/my-componets/my-date.vue' | |||
| export default { | |||
| name: "AppletSchemeForm", | |||
| components:{ myDate }, | |||
| props:{ | |||
| formData:{ | |||
| type:Object, | |||
| default:()=>{}, | |||
| required:false | |||
| } | |||
| }, | |||
| data(){ | |||
| return { | |||
| CustomBar: this.CustomBar, | |||
| NavBarColor: this.NavBarColor, | |||
| loading:false, | |||
| model: {}, | |||
| backRouteName:'index', | |||
| url: { | |||
| queryById: "/appletScheme/appletScheme/queryById", | |||
| add: "/appletScheme/appletScheme/add", | |||
| edit: "/appletScheme/appletScheme/edit", | |||
| }, | |||
| } | |||
| }, | |||
| created(){ | |||
| this.initFormData(); | |||
| }, | |||
| methods:{ | |||
| initFormData(){ | |||
| if(this.formData){ | |||
| let dataId = this.formData.dataId; | |||
| this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{ | |||
| if(res.data.success){ | |||
| console.log("表单数据",res); | |||
| this.model = res.data.result; | |||
| } | |||
| }) | |||
| } | |||
| }, | |||
| onSubmit() { | |||
| let myForm = {...this.model}; | |||
| this.loading = true; | |||
| let url = myForm.id?this.url.edit:this.url.add; | |||
| this.$http.post(url,myForm).then(res=>{ | |||
| console.log("res",res) | |||
| this.loading = false | |||
| this.$Router.push({name:this.backRouteName}) | |||
| }).catch(()=>{ | |||
| this.loading = false | |||
| }); | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,44 @@ | |||
| <template> | |||
| <view> | |||
| <!--标题和返回--> | |||
| <cu-custom :bgColor="NavBarColor" isBack> | |||
| <block slot="backText">返回</block> | |||
| <block slot="content">方案</block> | |||
| </cu-custom> | |||
| <!--滚动加载列表--> | |||
| <mescroll-body ref="mescrollRef" bottom="88" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback"> | |||
| <view class="cu-list menu"> | |||
| <view class="cu-item" v-for="(item,index) in list" :key="index" @click="goHome"> | |||
| <view class="flex" style="width:100%"> | |||
| <text class="text-lg" style="color: #000;"> | |||
| {{ item.createBy}} | |||
| </text> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| </mescroll-body> | |||
| </view> | |||
| </template> | |||
| <script> | |||
| import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; | |||
| import Mixin from "@/common/mixin/Mixin.js"; | |||
| export default { | |||
| name: '方案', | |||
| mixins: [MescrollMixin,Mixin], | |||
| data() { | |||
| return { | |||
| CustomBar:this.CustomBar, | |||
| NavBarColor:this.NavBarColor, | |||
| url: "/appletScheme/appletScheme/list", | |||
| }; | |||
| }, | |||
| methods: { | |||
| goHome(){ | |||
| this.$Router.push({name: "index"}) | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,19 @@ | |||
| import { render } from '@/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns = [ | |||
| { | |||
| title: '标题', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '描述', | |||
| align:"center", | |||
| dataIndex: 'info' | |||
| }, | |||
| { | |||
| title: '分类', | |||
| align:"center", | |||
| dataIndex: 'schemeCategory_dictText' | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,232 @@ | |||
| <route lang="json5" type="page"> | |||
| { | |||
| layout: 'default', | |||
| style: { | |||
| navigationStyle: 'custom', | |||
| navigationBarTitleText: '方案', | |||
| }, | |||
| } | |||
| </route> | |||
| <template> | |||
| <PageLayout :navTitle="navTitle" :backRouteName="backRouteName"> | |||
| <scroll-view class="scrollArea" scroll-y> | |||
| <view class="form-container"> | |||
| <wd-form ref="form" :model="myFormData"> | |||
| <wd-cell-group border> | |||
| <view class="{ 'mt-14px': 0 == 0 }"> | |||
| <wd-input | |||
| label-width="100px" | |||
| v-model="myFormData['title']" | |||
| :label="get4Label('标题')" | |||
| name='title' | |||
| prop='title' | |||
| placeholder="请选择标题" | |||
| :rules="[ | |||
| ]" | |||
| clearable | |||
| /> | |||
| </view> | |||
| <view class="{ 'mt-14px': 1 == 0 }"> | |||
| <wd-input | |||
| label-width="100px" | |||
| v-model="myFormData['info']" | |||
| :label="get4Label('描述')" | |||
| name='info' | |||
| prop='info' | |||
| placeholder="请选择描述" | |||
| :rules="[ | |||
| ]" | |||
| clearable | |||
| /> | |||
| </view> | |||
| <view class="{ 'mt-14px': 0 == 0 }"> | |||
| <online-select | |||
| :label="get4Label('分类')" | |||
| labelWidth="100px" | |||
| type="sel_search" | |||
| name='schemeCategory' | |||
| dict="applet_scheme_category,name,id" | |||
| v-model="myFormData['schemeCategory']" | |||
| ></online-select> | |||
| </view> | |||
| </wd-cell-group> | |||
| </wd-form> | |||
| </view> | |||
| </scroll-view> | |||
| <view class="footer"> | |||
| <wd-button :disabled="loading" block :loading="loading" @click="handleSubmit">提交</wd-button> | |||
| </view> | |||
| </PageLayout> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import { onLoad } from '@dcloudio/uni-app' | |||
| import { http } from '@/utils/http' | |||
| import { useToast } from 'wot-design-uni' | |||
| import { useRouter } from '@/plugin/uni-mini-router' | |||
| import { ref, onMounted, computed,reactive } from 'vue' | |||
| import OnlineImage from '@/components/online/view/online-image.vue' | |||
| import OnlineFile from '@/components/online/view/online-file.vue' | |||
| import OnlineFileCustom from '@/components/online/view/online-file-custom.vue' | |||
| import OnlineSelect from '@/components/online/view/online-select.vue' | |||
| import OnlineTime from '@/components/online/view/online-time.vue' | |||
| import OnlineDate from '@/components/online/view/online-date.vue' | |||
| import OnlineRadio from '@/components/online/view/online-radio.vue' | |||
| import OnlineCheckbox from '@/components/online/view/online-checkbox.vue' | |||
| import OnlineMulti from '@/components/online/view/online-multi.vue' | |||
| import OnlinePopupLinkRecord from '@/components/online/view/online-popup-link-record.vue' | |||
| import OnlinePca from '@/components/online/view/online-pca.vue' | |||
| import SelectDept from '@/components/SelectDept/SelectDept.vue' | |||
| import SelectUser from '@/components/SelectUser/SelectUser.vue' | |||
| import {duplicateCheck} from "@/service/api"; | |||
| defineOptions({ | |||
| name: 'AppletSchemeForm', | |||
| options: { | |||
| styleIsolation: 'shared', | |||
| }, | |||
| }) | |||
| const toast = useToast() | |||
| const router = useRouter() | |||
| const form = ref(null) | |||
| // 定义响应式数据 | |||
| const myFormData = reactive({}) | |||
| const loading = ref(false) | |||
| const navTitle = ref('新增') | |||
| const dataId = ref('') | |||
| const backRouteName = ref('AppletSchemeList') | |||
| // 定义 initForm 方法 | |||
| const initForm = (item) => { | |||
| console.log('initForm item', item) | |||
| if(item?.dataId){ | |||
| dataId.value = item.dataId; | |||
| navTitle.value = item.dataId?'编辑':'新增'; | |||
| initData(); | |||
| } | |||
| } | |||
| // 初始化数据 | |||
| const initData = () => { | |||
| http.get("/appletScheme/appletScheme/queryById",{id:dataId.value}).then((res) => { | |||
| if (res.success) { | |||
| let obj = res.result | |||
| Object.assign(myFormData, { ...obj }) | |||
| }else{ | |||
| toast.error(res?.message || '表单加载失败!') | |||
| } | |||
| }) | |||
| } | |||
| const handleSuccess = () => { | |||
| uni.$emit('refreshList'); | |||
| router.back() | |||
| } | |||
| /** | |||
| * 校验唯一 | |||
| * @param values | |||
| * @returns {boolean} | |||
| */ | |||
| async function fieldCheck(values: any) { | |||
| const onlyField = [ | |||
| ]; | |||
| for (const field of onlyField) { | |||
| if (values[field]) { | |||
| // 仅校验有值的字段 | |||
| const res: any = await duplicateCheck({ | |||
| tableName: 'applet_scheme', | |||
| fieldName: field, // 使用处理后的字段名 | |||
| fieldVal: values[field], | |||
| dataId: values.id, | |||
| }); | |||
| if (!res.success) { | |||
| toast.warning(res.message); | |||
| return true; // 校验失败 | |||
| } | |||
| } | |||
| } | |||
| return false; // 校验通过 | |||
| } | |||
| // 提交表单 | |||
| const handleSubmit = async () => { | |||
| // 判断字段必填和正则 | |||
| if (await fieldCheck(myFormData)) { | |||
| return | |||
| } | |||
| let url = dataId.value?'/appletScheme/appletScheme/edit':'/appletScheme/appletScheme/add'; | |||
| form.value | |||
| .validate() | |||
| .then(({ valid, errors }) => { | |||
| if (valid) { | |||
| loading.value = true; | |||
| http.post(url,myFormData).then((res) => { | |||
| loading.value = false; | |||
| if (res.success) { | |||
| toast.success('保存成功'); | |||
| handleSuccess() | |||
| }else{ | |||
| toast.error(res?.message || '表单保存失败!') | |||
| } | |||
| }) | |||
| } | |||
| }) | |||
| .catch((error) => { | |||
| console.log(error, 'error') | |||
| loading.value = false; | |||
| }) | |||
| } | |||
| // 标题 | |||
| const get4Label = computed(() => { | |||
| return (label) => { | |||
| return label && label.length > 4 ? label.substring(0, 4) : label; | |||
| } | |||
| }) | |||
| // 标题 | |||
| const getFormSchema = computed(() => { | |||
| return (dictTable,dictCode,dictText) => { | |||
| return { | |||
| dictCode, | |||
| dictTable, | |||
| dictText | |||
| }; | |||
| } | |||
| }) | |||
| /** | |||
| * 获取日期控件的扩展类型 | |||
| * @param picker | |||
| * @returns {string} | |||
| */ | |||
| const getDateExtendType = (picker: string) => { | |||
| let mapField = { | |||
| month: 'year-month', | |||
| year: 'year', | |||
| quarter: 'quarter', | |||
| week: 'week', | |||
| day: 'date', | |||
| } | |||
| return picker && mapField[picker] | |||
| ? mapField[picker] | |||
| : 'date' | |||
| } | |||
| //设置pop返回值 | |||
| const setFieldsValue = (data) => { | |||
| Object.assign(myFormData, {...data }) | |||
| } | |||
| // onLoad 生命周期钩子 | |||
| onLoad((option) => { | |||
| initForm(option) | |||
| }) | |||
| </script> | |||
| <style lang="scss" scoped> | |||
| .footer { | |||
| width: 100%; | |||
| padding: 10px 20px; | |||
| padding-bottom: calc(constant(safe-area-inset-bottom) + 10px); | |||
| padding-bottom: calc(env(safe-area-inset-bottom) + 10px); | |||
| } | |||
| :deep(.wd-cell__label) { | |||
| font-size: 14px; | |||
| color: #444; | |||
| } | |||
| :deep(.wd-cell__value) { | |||
| text-align: left; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,148 @@ | |||
| <route lang="json5" type="page"> | |||
| { | |||
| layout: 'default', | |||
| style: { | |||
| navigationBarTitleText: '方案', | |||
| navigationStyle: 'custom', | |||
| }, | |||
| } | |||
| </route> | |||
| <template> | |||
| <PageLayout navTitle="方案" backRouteName="index" routeMethod="pushTab"> | |||
| <view class="wrap"> | |||
| <z-paging | |||
| ref="paging" | |||
| :fixed="false" | |||
| v-model="dataList" | |||
| @query="queryList" | |||
| :default-page-size="15" | |||
| > | |||
| <template v-for="item in dataList" :key="item.id"> | |||
| <wd-swipe-action> | |||
| <view class="list" @click="handleEdit(item)"> | |||
| <template v-for="(cItem, cIndex) in columns" :key="cIndex"> | |||
| <view v-if="cIndex < 3" class="box" :style="getBoxStyle"> | |||
| <view class="field ellipsis">{{ cItem.title }}</view> | |||
| <view class="value cu-text-grey">{{ item[cItem.dataIndex] }}</view> | |||
| </view> | |||
| </template> | |||
| </view> | |||
| <template #right> | |||
| <view class="action"> | |||
| <view class="button" @click="handleAction('del', item)">删除</view> | |||
| </view> | |||
| </template> | |||
| </wd-swipe-action> | |||
| </template> | |||
| </z-paging> | |||
| <view class="add u-iconfont u-icon-add" @click="handleAdd"></view> | |||
| </view> | |||
| </PageLayout> | |||
| </template> | |||
| <script setup lang="ts"> | |||
| import { ref, onMounted, computed } from 'vue' | |||
| import { http } from '@/utils/http' | |||
| import usePageList from '@/hooks/usePageList' | |||
| import {columns} from './AppletSchemeData'; | |||
| defineOptions({ | |||
| name: 'AppletSchemeList', | |||
| options: { | |||
| styleIsolation: 'shared', | |||
| } | |||
| }) | |||
| //分页加载配置 | |||
| let { toast, router, paging, dataList, queryList } = usePageList('/appletScheme/appletScheme/list'); | |||
| //样式 | |||
| const getBoxStyle = computed(() => { | |||
| return { width: "calc(33% - 5px)" } | |||
| }) | |||
| // 其他操作 | |||
| const handleAction = (val, item) => { | |||
| if (val == 'del') { | |||
| http.delete("/appletScheme/appletScheme/delete?id="+item.id,{id:item.id}).then((res) => { | |||
| toast.success('删除成功~') | |||
| paging.value.reload() | |||
| }) | |||
| } | |||
| } | |||
| // go 新增页 | |||
| const handleAdd = () => { | |||
| router.push({ | |||
| name: 'AppletSchemeForm' | |||
| }) | |||
| } | |||
| //go 编辑页 | |||
| const handleEdit = (record) => { | |||
| router.push({ | |||
| name: 'AppletSchemeForm', | |||
| params: {dataId: record.id}, | |||
| }) | |||
| } | |||
| onMounted(() => { | |||
| // 监听刷新列表事件 | |||
| uni.$on('refreshList', () => { | |||
| queryList(1,10) | |||
| }) | |||
| }) | |||
| </script> | |||
| <style lang="scss" scoped> | |||
| .wrap { | |||
| height: 100%; | |||
| } | |||
| :deep(.wd-swipe-action) { | |||
| margin-top: 10px; | |||
| background-color: #fff; | |||
| } | |||
| .list { | |||
| padding: 10px 10px; | |||
| width: 100%; | |||
| text-align: left; | |||
| display: flex; | |||
| justify-content: space-between; | |||
| .box { | |||
| width: 33%; | |||
| .field { | |||
| margin-bottom: 10px; | |||
| line-height: 20px; | |||
| } | |||
| } | |||
| } | |||
| .action { | |||
| width: 60px; | |||
| height: 100%; | |||
| display: flex; | |||
| align-items: center; | |||
| justify-content: center; | |||
| .button { | |||
| display: flex; | |||
| align-items: center; | |||
| justify-content: center; | |||
| flex: 1; | |||
| height: 100%; | |||
| color: #fff; | |||
| &:first-child { | |||
| background-color: #fa4350; | |||
| } | |||
| } | |||
| } | |||
| .add { | |||
| height: 70upx; | |||
| width: 70upx; | |||
| text-align: center; | |||
| line-height: 70upx; | |||
| background-color: #fff; | |||
| border-radius: 50%; | |||
| position: fixed; | |||
| bottom: 80upx; | |||
| right: 30upx; | |||
| box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.1); | |||
| color: #666; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,64 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import { useMessage } from "/@/hooks/web/useMessage"; | |||
| const { createConfirm } = useMessage(); | |||
| enum Api { | |||
| list = '/appletScheme/appletScheme/list', | |||
| save='/appletScheme/appletScheme/add', | |||
| edit='/appletScheme/appletScheme/edit', | |||
| deleteOne = '/appletScheme/appletScheme/delete', | |||
| deleteBatch = '/appletScheme/appletScheme/deleteBatch', | |||
| importExcel = '/appletScheme/appletScheme/importExcel', | |||
| exportXls = '/appletScheme/appletScheme/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) => { | |||
| createConfirm({ | |||
| iconType: 'warning', | |||
| 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,79 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| import { getWeekMonthQuarterYear } from '/@/utils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '标题', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '描述', | |||
| align:"center", | |||
| dataIndex: 'info' | |||
| }, | |||
| { | |||
| title: '分类', | |||
| align:"center", | |||
| dataIndex: 'schemeCategory_dictText' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| { | |||
| label: "分类", | |||
| field: 'schemeCategory', | |||
| component: 'JSearchSelect', | |||
| componentProps:{ | |||
| dict:"applet_scheme_category,name,id" | |||
| }, | |||
| //colProps: {span: 6}, | |||
| }, | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '标题', | |||
| field: 'title', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '描述', | |||
| field: 'info', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '分类', | |||
| field: 'schemeCategory', | |||
| component: 'JSearchSelect', | |||
| componentProps:{ | |||
| dict:"applet_scheme_category,name,id" | |||
| }, | |||
| }, | |||
| // TODO 主键隐藏字段,目前写死为ID | |||
| { | |||
| label: '', | |||
| field: 'id', | |||
| component: 'Input', | |||
| show: false | |||
| }, | |||
| ]; | |||
| // 高级查询数据 | |||
| export const superQuerySchema = { | |||
| title: {title: '标题',order: 0,view: 'text', type: 'string',}, | |||
| info: {title: '描述',order: 1,view: 'text', type: 'string',}, | |||
| schemeCategory: {title: '分类',order: 2,view: 'sel_search', type: 'string',dictTable: "applet_scheme_category", dictCode: 'id', dictText: 'name',}, | |||
| }; | |||
| /** | |||
| * 流程表单调用这个方法获取formSchema | |||
| * @param param | |||
| */ | |||
| export function getBpmFormSchema(_formData): FormSchema[]{ | |||
| // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema | |||
| return formSchema; | |||
| } | |||
| @ -0,0 +1,206 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" v-auth="'appletScheme:applet_scheme:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" v-auth="'appletScheme:applet_scheme:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" v-auth="'appletScheme:applet_scheme:importExcel'" 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 v-auth="'appletScheme:applet_scheme:deleteBatch'">批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| <!-- 高级查询 --> | |||
| <super-query :config="superQueryConfig" @search="handleSuperQuery" /> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template v-slot:bodyCell="{ column, record, index, text }"> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <AppletSchemeModal @register="registerModal" @success="handleSuccess"></AppletSchemeModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="appletScheme-appletScheme" setup> | |||
| import {ref, reactive, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import AppletSchemeModal from './components/AppletSchemeModal.vue' | |||
| import {columns, searchFormSchema, superQuerySchema} from './AppletScheme.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AppletScheme.api'; | |||
| import { downloadFile } from '/@/utils/common/renderUtils'; | |||
| import { useUserStore } from '/@/store/modules/user'; | |||
| import { useMessage } from '/@/hooks/web/useMessage'; | |||
| import { getDateByPicker } from '/@/utils'; | |||
| //日期个性化选择 | |||
| const fieldPickers = reactive({ | |||
| }); | |||
| const queryParam = reactive<any>({}); | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| const userStore = useUserStore(); | |||
| const { createMessage } = useMessage(); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '方案', | |||
| api: list, | |||
| columns, | |||
| canResize:true, | |||
| formConfig: { | |||
| //labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToNumber: [ | |||
| ], | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| fixed:'right' | |||
| }, | |||
| beforeFetch: (params) => { | |||
| if (params && fieldPickers) { | |||
| for (let key in fieldPickers) { | |||
| if (params[key]) { | |||
| params[key] = getDateByPicker(params[key], fieldPickers[key]); | |||
| } | |||
| } | |||
| } | |||
| return Object.assign(params, queryParam); | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"方案", | |||
| url: getExportUrl, | |||
| params: queryParam, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl, | |||
| success: handleSuccess | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| // 高级查询配置 | |||
| const superQueryConfig = reactive(superQuerySchema); | |||
| /** | |||
| * 高级查询事件 | |||
| */ | |||
| function handleSuperQuery(params) { | |||
| Object.keys(params).map((k) => { | |||
| queryParam[k] = params[k]; | |||
| }); | |||
| reload(); | |||
| } | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| 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}, handleSuccess); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: selectedRowKeys.value}, handleSuccess); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| (selectedRowKeys.value = []) && reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| auth: 'appletScheme:applet_scheme:edit' | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| placement: 'topLeft', | |||
| }, | |||
| auth: 'appletScheme:applet_scheme:delete' | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| :deep(.ant-picker),:deep(.ant-input-number){ | |||
| width: 100%; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,26 @@ | |||
| -- 注意:该页面对应的前台目录为views/appletScheme文件夹下 | |||
| -- 如果你想更改到其他目录,请修改sql中component字段对应的值 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) | |||
| VALUES ('2025082804362650160', NULL, '方案', '/appletScheme/appletSchemeList', 'appletScheme/AppletSchemeList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-08-28 16:36:16', NULL, NULL, 0); | |||
| -- 权限控制sql | |||
| -- 新增 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804362650161', '2025082804362650160', '添加方案', NULL, NULL, 0, NULL, NULL, 2, 'appletScheme:applet_scheme:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:36:16', NULL, NULL, 0, 0, '1', 0); | |||
| -- 编辑 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804362650162', '2025082804362650160', '编辑方案', NULL, NULL, 0, NULL, NULL, 2, 'appletScheme:applet_scheme:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:36:16', NULL, NULL, 0, 0, '1', 0); | |||
| -- 删除 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804362650163', '2025082804362650160', '删除方案', NULL, NULL, 0, NULL, NULL, 2, 'appletScheme:applet_scheme:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:36:16', NULL, NULL, 0, 0, '1', 0); | |||
| -- 批量删除 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804362650164', '2025082804362650160', '批量删除方案', NULL, NULL, 0, NULL, NULL, 2, 'appletScheme:applet_scheme:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:36:16', NULL, NULL, 0, 0, '1', 0); | |||
| -- 导出excel | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804362650165', '2025082804362650160', '导出excel_方案', NULL, NULL, 0, NULL, NULL, 2, 'appletScheme:applet_scheme:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:36:16', NULL, NULL, 0, 0, '1', 0); | |||
| -- 导入excel | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804362650166', '2025082804362650160', '导入excel_方案', NULL, NULL, 0, NULL, NULL, 2, 'appletScheme:applet_scheme:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:36:16', NULL, NULL, 0, 0, '1', 0); | |||
| @ -0,0 +1,70 @@ | |||
| <template> | |||
| <div style="min-height: 400px"> | |||
| <BasicForm @register="registerForm"></BasicForm> | |||
| <div style="width: 100%;text-align: center" v-if="!formDisabled"> | |||
| <a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button> | |||
| </div> | |||
| </div> | |||
| </template> | |||
| <script lang="ts"> | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {computed, defineComponent} from 'vue'; | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import { propTypes } from '/@/utils/propTypes'; | |||
| import {getBpmFormSchema} from '../AppletScheme.data'; | |||
| import {saveOrUpdate} from '../AppletScheme.api'; | |||
| export default defineComponent({ | |||
| name: "AppletSchemeForm", | |||
| components:{ | |||
| BasicForm | |||
| }, | |||
| props:{ | |||
| formData: propTypes.object.def({}), | |||
| formBpm: propTypes.bool.def(true), | |||
| }, | |||
| setup(props){ | |||
| const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: getBpmFormSchema(props.formData), | |||
| showActionButtonGroup: false, | |||
| baseColProps: {span: 24} | |||
| }); | |||
| const formDisabled = computed(()=>{ | |||
| if(props.formData.disabled === false){ | |||
| return false; | |||
| } | |||
| return true; | |||
| }); | |||
| let formData = {}; | |||
| const queryByIdUrl = '/appletScheme/appletScheme/queryById'; | |||
| async function initFormData(){ | |||
| let params = {id: props.formData.dataId}; | |||
| const data = await defHttp.get({url: queryByIdUrl, params}); | |||
| formData = {...data} | |||
| //设置表单的值 | |||
| await setFieldsValue(formData); | |||
| //默认是禁用 | |||
| await setProps({disabled: formDisabled.value}) | |||
| } | |||
| async function submitForm() { | |||
| let data = getFieldsValue(); | |||
| let params = Object.assign({}, formData, data); | |||
| console.log('表单数据', params) | |||
| await saveOrUpdate(params, true) | |||
| } | |||
| initFormData(); | |||
| return { | |||
| registerForm, | |||
| formDisabled, | |||
| submitForm, | |||
| } | |||
| } | |||
| }); | |||
| </script> | |||
| @ -0,0 +1,99 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm" name="AppletSchemeForm" /> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref, reactive} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../AppletScheme.data'; | |||
| import {saveOrUpdate} from '../AppletScheme.api'; | |||
| import { useMessage } from '/@/hooks/web/useMessage'; | |||
| import { getDateByPicker } from '/@/utils'; | |||
| const { createMessage } = useMessage(); | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| const isDetail = ref(false); | |||
| //表单配置 | |||
| const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| baseColProps: {span: 24} | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| isDetail.value = !!data?.showFooter; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //日期个性化选择 | |||
| const fieldPickers = reactive({ | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| // 预处理日期数据 | |||
| changeDateValue(values); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } catch ({ errorFields }) { | |||
| if (errorFields) { | |||
| const firstField = errorFields[0]; | |||
| if (firstField) { | |||
| scrollToField(firstField.name, { behavior: 'smooth', block: 'center' }); | |||
| } | |||
| } | |||
| return Promise.reject(errorFields); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| /** | |||
| * 处理日期值 | |||
| * @param formData 表单数据 | |||
| */ | |||
| const changeDateValue = (formData) => { | |||
| if (formData && fieldPickers) { | |||
| for (let key in fieldPickers) { | |||
| if (formData[key]) { | |||
| formData[key] = getDateByPicker(formData[key], fieldPickers[key]); | |||
| } | |||
| } | |||
| } | |||
| }; | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** 时间和数字输入框样式 */ | |||
| :deep(.ant-input-number) { | |||
| width: 100%; | |||
| } | |||
| :deep(.ant-calendar-picker) { | |||
| width: 100%; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,186 @@ | |||
| package org.jeecg.modules.demo.appletSchemeCategory.controller; | |||
| import java.util.Arrays; | |||
| import java.util.HashMap; | |||
| 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.system.query.QueryRuleEnum; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.demo.appletSchemeCategory.entity.AppletSchemeCategory; | |||
| import org.jeecg.modules.demo.appletSchemeCategory.service.IAppletSchemeCategoryService; | |||
| 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.v3.oas.annotations.tags.Tag; | |||
| import io.swagger.v3.oas.annotations.Operation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
| /** | |||
| * @Description: 方案分类 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Tag(name="方案分类") | |||
| @RestController | |||
| @RequestMapping("/appletSchemeCategory/appletSchemeCategory") | |||
| @Slf4j | |||
| public class AppletSchemeCategoryController extends JeecgController<AppletSchemeCategory, IAppletSchemeCategoryService> { | |||
| @Autowired | |||
| private IAppletSchemeCategoryService appletSchemeCategoryService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param appletSchemeCategory | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "方案分类-分页列表查询") | |||
| @Operation(summary="方案分类-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<AppletSchemeCategory>> queryPageList(AppletSchemeCategory appletSchemeCategory, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| // 自定义查询规则 | |||
| Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>(); | |||
| // 自定义多选的查询规则为:LIKE_WITH_OR | |||
| customeRuleMap.put("type", QueryRuleEnum.LIKE_WITH_OR); | |||
| QueryWrapper<AppletSchemeCategory> queryWrapper = QueryGenerator.initQueryWrapper(appletSchemeCategory, req.getParameterMap(),customeRuleMap); | |||
| Page<AppletSchemeCategory> page = new Page<AppletSchemeCategory>(pageNo, pageSize); | |||
| IPage<AppletSchemeCategory> pageList = appletSchemeCategoryService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param appletSchemeCategory | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "方案分类-添加") | |||
| @Operation(summary="方案分类-添加") | |||
| @RequiresPermissions("appletSchemeCategory:applet_scheme_category:add") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody AppletSchemeCategory appletSchemeCategory) { | |||
| appletSchemeCategoryService.save(appletSchemeCategory); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param appletSchemeCategory | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "方案分类-编辑") | |||
| @Operation(summary="方案分类-编辑") | |||
| @RequiresPermissions("appletSchemeCategory:applet_scheme_category:edit") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody AppletSchemeCategory appletSchemeCategory) { | |||
| appletSchemeCategoryService.updateById(appletSchemeCategory); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "方案分类-通过id删除") | |||
| @Operation(summary="方案分类-通过id删除") | |||
| @RequiresPermissions("appletSchemeCategory:applet_scheme_category:delete") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| appletSchemeCategoryService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "方案分类-批量删除") | |||
| @Operation(summary="方案分类-批量删除") | |||
| @RequiresPermissions("appletSchemeCategory:applet_scheme_category:deleteBatch") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.appletSchemeCategoryService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "方案分类-通过id查询") | |||
| @Operation(summary="方案分类-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<AppletSchemeCategory> queryById(@RequestParam(name="id",required=true) String id) { | |||
| AppletSchemeCategory appletSchemeCategory = appletSchemeCategoryService.getById(id); | |||
| if(appletSchemeCategory==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(appletSchemeCategory); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param appletSchemeCategory | |||
| */ | |||
| @RequiresPermissions("appletSchemeCategory:applet_scheme_category:exportXls") | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, AppletSchemeCategory appletSchemeCategory) { | |||
| return super.exportXls(request, appletSchemeCategory, AppletSchemeCategory.class, "方案分类"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequiresPermissions("appletSchemeCategory:applet_scheme_category:importExcel") | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, AppletSchemeCategory.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,80 @@ | |||
| package org.jeecg.modules.demo.appletSchemeCategory.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 com.baomidou.mybatisplus.annotation.TableLogic; | |||
| import org.jeecg.common.constant.ProvinceCityArea; | |||
| import org.jeecg.common.util.SpringContextUtils; | |||
| 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.v3.oas.annotations.media.Schema; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 方案分类 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("applet_scheme_category") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @Schema(description="方案分类") | |||
| public class AppletSchemeCategory implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @Schema(description = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @Schema(description = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| @Schema(description = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @Schema(description = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| @Schema(description = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**所属部门*/ | |||
| @Schema(description = "所属部门") | |||
| private java.lang.String sysOrgCode; | |||
| /**分类名称*/ | |||
| @Excel(name = "分类名称", width = 15) | |||
| @Schema(description = "分类名称") | |||
| private java.lang.String name; | |||
| /**类型*/ | |||
| @Excel(name = "类型", width = 15, dicCode = "applet_scheme_type") | |||
| @Dict(dicCode = "applet_scheme_type") | |||
| @Schema(description = "类型") | |||
| private java.lang.String type; | |||
| /**英文名称*/ | |||
| @Excel(name = "英文名称", width = 15) | |||
| @Schema(description = "英文名称") | |||
| private java.lang.String enTitle; | |||
| /**图标*/ | |||
| @Excel(name = "图标", width = 15) | |||
| @Schema(description = "图标") | |||
| private java.lang.String icon; | |||
| /**排序*/ | |||
| @Excel(name = "排序", width = 15) | |||
| @Schema(description = "排序") | |||
| private java.lang.Integer sort; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.demo.appletSchemeCategory.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.demo.appletSchemeCategory.entity.AppletSchemeCategory; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 方案分类 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface AppletSchemeCategoryMapper extends BaseMapper<AppletSchemeCategory> { | |||
| } | |||
| @ -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.demo.appletSchemeCategory.mapper.AppletSchemeCategoryMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.demo.appletSchemeCategory.service; | |||
| import org.jeecg.modules.demo.appletSchemeCategory.entity.AppletSchemeCategory; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 方案分类 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IAppletSchemeCategoryService extends IService<AppletSchemeCategory> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.demo.appletSchemeCategory.service.impl; | |||
| import org.jeecg.modules.demo.appletSchemeCategory.entity.AppletSchemeCategory; | |||
| import org.jeecg.modules.demo.appletSchemeCategory.mapper.AppletSchemeCategoryMapper; | |||
| import org.jeecg.modules.demo.appletSchemeCategory.service.IAppletSchemeCategoryService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 方案分类 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-08-28 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class AppletSchemeCategoryServiceImpl extends ServiceImpl<AppletSchemeCategoryMapper, AppletSchemeCategory> implements IAppletSchemeCategoryService { | |||
| } | |||
| @ -0,0 +1,101 @@ | |||
| <template> | |||
| <view> | |||
| <!--标题和返回--> | |||
| <cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName"> | |||
| <block slot="backText">返回</block> | |||
| <block slot="content">方案分类</block> | |||
| </cu-custom> | |||
| <!--表单区域--> | |||
| <view> | |||
| <form> | |||
| <view class="cu-form-group"> | |||
| <view class="flex align-center"> | |||
| <view class="title"><text space="ensp">分类名称:</text></view> | |||
| <input placeholder="请输入分类名称" v-model="model.name"/> | |||
| </view> | |||
| </view> | |||
| <view class="cu-form-group"> | |||
| <view class="flex align-center"> | |||
| <view class="title"><text space="ensp">类型:</text></view> | |||
| <input placeholder="请输入类型" v-model="model.type"/> | |||
| </view> | |||
| </view> | |||
| <view class="cu-form-group"> | |||
| <view class="flex align-center"> | |||
| <view class="title"><text space="ensp">英文名称:</text></view> | |||
| <input placeholder="请输入英文名称" v-model="model.enTitle"/> | |||
| </view> | |||
| </view> | |||
| <view class="cu-form-group"> | |||
| <view class="flex align-center"> | |||
| <view class="title"><text space="ensp">排序:</text></view> | |||
| <input type="number" placeholder="请输入排序" v-model="model.sort"/> | |||
| </view> | |||
| </view> | |||
| <view class="padding"> | |||
| <button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit"> | |||
| <text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交 | |||
| </button> | |||
| </view> | |||
| </form> | |||
| </view> | |||
| </view> | |||
| </template> | |||
| <script> | |||
| import myDate from '@/components/my-componets/my-date.vue' | |||
| export default { | |||
| name: "AppletSchemeCategoryForm", | |||
| components:{ myDate }, | |||
| props:{ | |||
| formData:{ | |||
| type:Object, | |||
| default:()=>{}, | |||
| required:false | |||
| } | |||
| }, | |||
| data(){ | |||
| return { | |||
| CustomBar: this.CustomBar, | |||
| NavBarColor: this.NavBarColor, | |||
| loading:false, | |||
| model: {}, | |||
| backRouteName:'index', | |||
| url: { | |||
| queryById: "/appletSchemeCategory/appletSchemeCategory/queryById", | |||
| add: "/appletSchemeCategory/appletSchemeCategory/add", | |||
| edit: "/appletSchemeCategory/appletSchemeCategory/edit", | |||
| }, | |||
| } | |||
| }, | |||
| created(){ | |||
| this.initFormData(); | |||
| }, | |||
| methods:{ | |||
| initFormData(){ | |||
| if(this.formData){ | |||
| let dataId = this.formData.dataId; | |||
| this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{ | |||
| if(res.data.success){ | |||
| console.log("表单数据",res); | |||
| this.model = res.data.result; | |||
| } | |||
| }) | |||
| } | |||
| }, | |||
| onSubmit() { | |||
| let myForm = {...this.model}; | |||
| this.loading = true; | |||
| let url = myForm.id?this.url.edit:this.url.add; | |||
| this.$http.post(url,myForm).then(res=>{ | |||
| console.log("res",res) | |||
| this.loading = false | |||
| this.$Router.push({name:this.backRouteName}) | |||
| }).catch(()=>{ | |||
| this.loading = false | |||
| }); | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,44 @@ | |||
| <template> | |||
| <view> | |||
| <!--标题和返回--> | |||
| <cu-custom :bgColor="NavBarColor" isBack> | |||
| <block slot="backText">返回</block> | |||
| <block slot="content">方案分类</block> | |||
| </cu-custom> | |||
| <!--滚动加载列表--> | |||
| <mescroll-body ref="mescrollRef" bottom="88" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback"> | |||
| <view class="cu-list menu"> | |||
| <view class="cu-item" v-for="(item,index) in list" :key="index" @click="goHome"> | |||
| <view class="flex" style="width:100%"> | |||
| <text class="text-lg" style="color: #000;"> | |||
| {{ item.createBy}} | |||
| </text> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| </mescroll-body> | |||
| </view> | |||
| </template> | |||
| <script> | |||
| import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; | |||
| import Mixin from "@/common/mixin/Mixin.js"; | |||
| export default { | |||
| name: '方案分类', | |||
| mixins: [MescrollMixin,Mixin], | |||
| data() { | |||
| return { | |||
| CustomBar:this.CustomBar, | |||
| NavBarColor:this.NavBarColor, | |||
| url: "/appletSchemeCategory/appletSchemeCategory/list", | |||
| }; | |||
| }, | |||
| methods: { | |||
| goHome(){ | |||
| this.$Router.push({name: "index"}) | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,25 @@ | |||
| import { render } from '@/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns = [ | |||
| { | |||
| title: '分类名称', | |||
| align:"center", | |||
| dataIndex: 'name' | |||
| }, | |||
| { | |||
| title: '类型', | |||
| align:"center", | |||
| dataIndex: 'type_dictText' | |||
| }, | |||
| { | |||
| title: '英文名称', | |||
| align:"center", | |||
| dataIndex: 'enTitle' | |||
| }, | |||
| { | |||
| title: '排序', | |||
| align:"center", | |||
| sorter: true, | |||
| dataIndex: 'sort' | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,246 @@ | |||
| <route lang="json5" type="page"> | |||
| { | |||
| layout: 'default', | |||
| style: { | |||
| navigationStyle: 'custom', | |||
| navigationBarTitleText: '方案分类', | |||
| }, | |||
| } | |||
| </route> | |||
| <template> | |||
| <PageLayout :navTitle="navTitle" :backRouteName="backRouteName"> | |||
| <scroll-view class="scrollArea" scroll-y> | |||
| <view class="form-container"> | |||
| <wd-form ref="form" :model="myFormData"> | |||
| <wd-cell-group border> | |||
| <view class="{ 'mt-14px': 0 == 0 }"> | |||
| <wd-input | |||
| label-width="100px" | |||
| v-model="myFormData['name']" | |||
| :label="get4Label('分类名称')" | |||
| name='name' | |||
| prop='name' | |||
| placeholder="请选择分类名称" | |||
| :rules="[ | |||
| ]" | |||
| clearable | |||
| /> | |||
| </view> | |||
| <view class="{ 'mt-14px': 1 == 0 }"> | |||
| <online-radio | |||
| :label="get4Label('类型')" | |||
| labelWidth="100px" | |||
| type="radio" | |||
| name='type' | |||
| dict="applet_scheme_type" | |||
| v-model="myFormData['type']" | |||
| ></online-radio> | |||
| </view> | |||
| <view class="{ 'mt-14px': 0 == 0 }"> | |||
| <wd-input | |||
| label-width="100px" | |||
| v-model="myFormData['enTitle']" | |||
| :label="get4Label('英文名称')" | |||
| name='enTitle' | |||
| prop='enTitle' | |||
| placeholder="请选择英文名称" | |||
| :rules="[ | |||
| ]" | |||
| clearable | |||
| /> | |||
| </view> | |||
| <view class="{ 'mt-14px': 1 == 0 }"> | |||
| <wd-input | |||
| label-width="100px" | |||
| v-model="myFormData['sort']" | |||
| :label="get4Label('排序')" | |||
| name='sort' | |||
| prop='sort' | |||
| placeholder="请选择排序" | |||
| inputMode="numeric" | |||
| :rules="[ | |||
| ]" | |||
| clearable | |||
| /> | |||
| </view> | |||
| </wd-cell-group> | |||
| </wd-form> | |||
| </view> | |||
| </scroll-view> | |||
| <view class="footer"> | |||
| <wd-button :disabled="loading" block :loading="loading" @click="handleSubmit">提交</wd-button> | |||
| </view> | |||
| </PageLayout> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import { onLoad } from '@dcloudio/uni-app' | |||
| import { http } from '@/utils/http' | |||
| import { useToast } from 'wot-design-uni' | |||
| import { useRouter } from '@/plugin/uni-mini-router' | |||
| import { ref, onMounted, computed,reactive } from 'vue' | |||
| import OnlineImage from '@/components/online/view/online-image.vue' | |||
| import OnlineFile from '@/components/online/view/online-file.vue' | |||
| import OnlineFileCustom from '@/components/online/view/online-file-custom.vue' | |||
| import OnlineSelect from '@/components/online/view/online-select.vue' | |||
| import OnlineTime from '@/components/online/view/online-time.vue' | |||
| import OnlineDate from '@/components/online/view/online-date.vue' | |||
| import OnlineRadio from '@/components/online/view/online-radio.vue' | |||
| import OnlineCheckbox from '@/components/online/view/online-checkbox.vue' | |||
| import OnlineMulti from '@/components/online/view/online-multi.vue' | |||
| import OnlinePopupLinkRecord from '@/components/online/view/online-popup-link-record.vue' | |||
| import OnlinePca from '@/components/online/view/online-pca.vue' | |||
| import SelectDept from '@/components/SelectDept/SelectDept.vue' | |||
| import SelectUser from '@/components/SelectUser/SelectUser.vue' | |||
| import {duplicateCheck} from "@/service/api"; | |||
| defineOptions({ | |||
| name: 'AppletSchemeCategoryForm', | |||
| options: { | |||
| styleIsolation: 'shared', | |||
| }, | |||
| }) | |||
| const toast = useToast() | |||
| const router = useRouter() | |||
| const form = ref(null) | |||
| // 定义响应式数据 | |||
| const myFormData = reactive({}) | |||
| const loading = ref(false) | |||
| const navTitle = ref('新增') | |||
| const dataId = ref('') | |||
| const backRouteName = ref('AppletSchemeCategoryList') | |||
| // 定义 initForm 方法 | |||
| const initForm = (item) => { | |||
| console.log('initForm item', item) | |||
| if(item?.dataId){ | |||
| dataId.value = item.dataId; | |||
| navTitle.value = item.dataId?'编辑':'新增'; | |||
| initData(); | |||
| } | |||
| } | |||
| // 初始化数据 | |||
| const initData = () => { | |||
| http.get("/appletSchemeCategory/appletSchemeCategory/queryById",{id:dataId.value}).then((res) => { | |||
| if (res.success) { | |||
| let obj = res.result | |||
| Object.assign(myFormData, { ...obj }) | |||
| }else{ | |||
| toast.error(res?.message || '表单加载失败!') | |||
| } | |||
| }) | |||
| } | |||
| const handleSuccess = () => { | |||
| uni.$emit('refreshList'); | |||
| router.back() | |||
| } | |||
| /** | |||
| * 校验唯一 | |||
| * @param values | |||
| * @returns {boolean} | |||
| */ | |||
| async function fieldCheck(values: any) { | |||
| const onlyField = [ | |||
| ]; | |||
| for (const field of onlyField) { | |||
| if (values[field]) { | |||
| // 仅校验有值的字段 | |||
| const res: any = await duplicateCheck({ | |||
| tableName: 'applet_scheme_category', | |||
| fieldName: field, // 使用处理后的字段名 | |||
| fieldVal: values[field], | |||
| dataId: values.id, | |||
| }); | |||
| if (!res.success) { | |||
| toast.warning(res.message); | |||
| return true; // 校验失败 | |||
| } | |||
| } | |||
| } | |||
| return false; // 校验通过 | |||
| } | |||
| // 提交表单 | |||
| const handleSubmit = async () => { | |||
| // 判断字段必填和正则 | |||
| if (await fieldCheck(myFormData)) { | |||
| return | |||
| } | |||
| let url = dataId.value?'/appletSchemeCategory/appletSchemeCategory/edit':'/appletSchemeCategory/appletSchemeCategory/add'; | |||
| form.value | |||
| .validate() | |||
| .then(({ valid, errors }) => { | |||
| if (valid) { | |||
| loading.value = true; | |||
| http.post(url,myFormData).then((res) => { | |||
| loading.value = false; | |||
| if (res.success) { | |||
| toast.success('保存成功'); | |||
| handleSuccess() | |||
| }else{ | |||
| toast.error(res?.message || '表单保存失败!') | |||
| } | |||
| }) | |||
| } | |||
| }) | |||
| .catch((error) => { | |||
| console.log(error, 'error') | |||
| loading.value = false; | |||
| }) | |||
| } | |||
| // 标题 | |||
| const get4Label = computed(() => { | |||
| return (label) => { | |||
| return label && label.length > 4 ? label.substring(0, 4) : label; | |||
| } | |||
| }) | |||
| // 标题 | |||
| const getFormSchema = computed(() => { | |||
| return (dictTable,dictCode,dictText) => { | |||
| return { | |||
| dictCode, | |||
| dictTable, | |||
| dictText | |||
| }; | |||
| } | |||
| }) | |||
| /** | |||
| * 获取日期控件的扩展类型 | |||
| * @param picker | |||
| * @returns {string} | |||
| */ | |||
| const getDateExtendType = (picker: string) => { | |||
| let mapField = { | |||
| month: 'year-month', | |||
| year: 'year', | |||
| quarter: 'quarter', | |||
| week: 'week', | |||
| day: 'date', | |||
| } | |||
| return picker && mapField[picker] | |||
| ? mapField[picker] | |||
| : 'date' | |||
| } | |||
| //设置pop返回值 | |||
| const setFieldsValue = (data) => { | |||
| Object.assign(myFormData, {...data }) | |||
| } | |||
| // onLoad 生命周期钩子 | |||
| onLoad((option) => { | |||
| initForm(option) | |||
| }) | |||
| </script> | |||
| <style lang="scss" scoped> | |||
| .footer { | |||
| width: 100%; | |||
| padding: 10px 20px; | |||
| padding-bottom: calc(constant(safe-area-inset-bottom) + 10px); | |||
| padding-bottom: calc(env(safe-area-inset-bottom) + 10px); | |||
| } | |||
| :deep(.wd-cell__label) { | |||
| font-size: 14px; | |||
| color: #444; | |||
| } | |||
| :deep(.wd-cell__value) { | |||
| text-align: left; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,148 @@ | |||
| <route lang="json5" type="page"> | |||
| { | |||
| layout: 'default', | |||
| style: { | |||
| navigationBarTitleText: '方案分类', | |||
| navigationStyle: 'custom', | |||
| }, | |||
| } | |||
| </route> | |||
| <template> | |||
| <PageLayout navTitle="方案分类" backRouteName="index" routeMethod="pushTab"> | |||
| <view class="wrap"> | |||
| <z-paging | |||
| ref="paging" | |||
| :fixed="false" | |||
| v-model="dataList" | |||
| @query="queryList" | |||
| :default-page-size="15" | |||
| > | |||
| <template v-for="item in dataList" :key="item.id"> | |||
| <wd-swipe-action> | |||
| <view class="list" @click="handleEdit(item)"> | |||
| <template v-for="(cItem, cIndex) in columns" :key="cIndex"> | |||
| <view v-if="cIndex < 3" class="box" :style="getBoxStyle"> | |||
| <view class="field ellipsis">{{ cItem.title }}</view> | |||
| <view class="value cu-text-grey">{{ item[cItem.dataIndex] }}</view> | |||
| </view> | |||
| </template> | |||
| </view> | |||
| <template #right> | |||
| <view class="action"> | |||
| <view class="button" @click="handleAction('del', item)">删除</view> | |||
| </view> | |||
| </template> | |||
| </wd-swipe-action> | |||
| </template> | |||
| </z-paging> | |||
| <view class="add u-iconfont u-icon-add" @click="handleAdd"></view> | |||
| </view> | |||
| </PageLayout> | |||
| </template> | |||
| <script setup lang="ts"> | |||
| import { ref, onMounted, computed } from 'vue' | |||
| import { http } from '@/utils/http' | |||
| import usePageList from '@/hooks/usePageList' | |||
| import {columns} from './AppletSchemeCategoryData'; | |||
| defineOptions({ | |||
| name: 'AppletSchemeCategoryList', | |||
| options: { | |||
| styleIsolation: 'shared', | |||
| } | |||
| }) | |||
| //分页加载配置 | |||
| let { toast, router, paging, dataList, queryList } = usePageList('/appletSchemeCategory/appletSchemeCategory/list'); | |||
| //样式 | |||
| const getBoxStyle = computed(() => { | |||
| return { width: "calc(33% - 5px)" } | |||
| }) | |||
| // 其他操作 | |||
| const handleAction = (val, item) => { | |||
| if (val == 'del') { | |||
| http.delete("/appletSchemeCategory/appletSchemeCategory/delete?id="+item.id,{id:item.id}).then((res) => { | |||
| toast.success('删除成功~') | |||
| paging.value.reload() | |||
| }) | |||
| } | |||
| } | |||
| // go 新增页 | |||
| const handleAdd = () => { | |||
| router.push({ | |||
| name: 'AppletSchemeCategoryForm' | |||
| }) | |||
| } | |||
| //go 编辑页 | |||
| const handleEdit = (record) => { | |||
| router.push({ | |||
| name: 'AppletSchemeCategoryForm', | |||
| params: {dataId: record.id}, | |||
| }) | |||
| } | |||
| onMounted(() => { | |||
| // 监听刷新列表事件 | |||
| uni.$on('refreshList', () => { | |||
| queryList(1,10) | |||
| }) | |||
| }) | |||
| </script> | |||
| <style lang="scss" scoped> | |||
| .wrap { | |||
| height: 100%; | |||
| } | |||
| :deep(.wd-swipe-action) { | |||
| margin-top: 10px; | |||
| background-color: #fff; | |||
| } | |||
| .list { | |||
| padding: 10px 10px; | |||
| width: 100%; | |||
| text-align: left; | |||
| display: flex; | |||
| justify-content: space-between; | |||
| .box { | |||
| width: 33%; | |||
| .field { | |||
| margin-bottom: 10px; | |||
| line-height: 20px; | |||
| } | |||
| } | |||
| } | |||
| .action { | |||
| width: 60px; | |||
| height: 100%; | |||
| display: flex; | |||
| align-items: center; | |||
| justify-content: center; | |||
| .button { | |||
| display: flex; | |||
| align-items: center; | |||
| justify-content: center; | |||
| flex: 1; | |||
| height: 100%; | |||
| color: #fff; | |||
| &:first-child { | |||
| background-color: #fa4350; | |||
| } | |||
| } | |||
| } | |||
| .add { | |||
| height: 70upx; | |||
| width: 70upx; | |||
| text-align: center; | |||
| line-height: 70upx; | |||
| background-color: #fff; | |||
| border-radius: 50%; | |||
| position: fixed; | |||
| bottom: 80upx; | |||
| right: 30upx; | |||
| box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.1); | |||
| color: #666; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,64 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import { useMessage } from "/@/hooks/web/useMessage"; | |||
| const { createConfirm } = useMessage(); | |||
| enum Api { | |||
| list = '/appletSchemeCategory/appletSchemeCategory/list', | |||
| save='/appletSchemeCategory/appletSchemeCategory/add', | |||
| edit='/appletSchemeCategory/appletSchemeCategory/edit', | |||
| deleteOne = '/appletSchemeCategory/appletSchemeCategory/delete', | |||
| deleteBatch = '/appletSchemeCategory/appletSchemeCategory/deleteBatch', | |||
| importExcel = '/appletSchemeCategory/appletSchemeCategory/importExcel', | |||
| exportXls = '/appletSchemeCategory/appletSchemeCategory/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) => { | |||
| createConfirm({ | |||
| iconType: 'warning', | |||
| 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,92 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| import { getWeekMonthQuarterYear } from '/@/utils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '分类名称', | |||
| align:"center", | |||
| dataIndex: 'name' | |||
| }, | |||
| { | |||
| title: '类型', | |||
| align:"center", | |||
| dataIndex: 'type_dictText' | |||
| }, | |||
| { | |||
| title: '英文名称', | |||
| align:"center", | |||
| dataIndex: 'enTitle' | |||
| }, | |||
| { | |||
| title: '排序', | |||
| align:"center", | |||
| sorter: true, | |||
| dataIndex: 'sort' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| { | |||
| label: "类型", | |||
| field: 'type', | |||
| component: 'JSelectMultiple', | |||
| componentProps:{ | |||
| dictCode:"applet_scheme_type" | |||
| }, | |||
| //colProps: {span: 6}, | |||
| }, | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '分类名称', | |||
| field: 'name', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '类型', | |||
| field: 'type', | |||
| component: 'JDictSelectTag', | |||
| componentProps:{ | |||
| dictCode:"applet_scheme_type", | |||
| type: "radio" | |||
| }, | |||
| }, | |||
| { | |||
| label: '英文名称', | |||
| field: 'enTitle', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '排序', | |||
| field: 'sort', | |||
| component: 'InputNumber', | |||
| }, | |||
| // TODO 主键隐藏字段,目前写死为ID | |||
| { | |||
| label: '', | |||
| field: 'id', | |||
| component: 'Input', | |||
| show: false | |||
| }, | |||
| ]; | |||
| // 高级查询数据 | |||
| export const superQuerySchema = { | |||
| name: {title: '分类名称',order: 0,view: 'text', type: 'string',}, | |||
| type: {title: '类型',order: 1,view: 'radio', type: 'string',dictCode: 'applet_scheme_type',}, | |||
| enTitle: {title: '英文名称',order: 2,view: 'text', type: 'string',}, | |||
| sort: {title: '排序',order: 3,view: 'number', type: 'number',}, | |||
| }; | |||
| /** | |||
| * 流程表单调用这个方法获取formSchema | |||
| * @param param | |||
| */ | |||
| export function getBpmFormSchema(_formData): FormSchema[]{ | |||
| // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema | |||
| return formSchema; | |||
| } | |||
| @ -0,0 +1,206 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" v-auth="'appletSchemeCategory:applet_scheme_category:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" v-auth="'appletSchemeCategory:applet_scheme_category:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" v-auth="'appletSchemeCategory:applet_scheme_category:importExcel'" 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 v-auth="'appletSchemeCategory:applet_scheme_category:deleteBatch'">批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| <!-- 高级查询 --> | |||
| <super-query :config="superQueryConfig" @search="handleSuperQuery" /> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template v-slot:bodyCell="{ column, record, index, text }"> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <AppletSchemeCategoryModal @register="registerModal" @success="handleSuccess"></AppletSchemeCategoryModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="appletSchemeCategory-appletSchemeCategory" setup> | |||
| import {ref, reactive, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import AppletSchemeCategoryModal from './components/AppletSchemeCategoryModal.vue' | |||
| import {columns, searchFormSchema, superQuerySchema} from './AppletSchemeCategory.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AppletSchemeCategory.api'; | |||
| import { downloadFile } from '/@/utils/common/renderUtils'; | |||
| import { useUserStore } from '/@/store/modules/user'; | |||
| import { useMessage } from '/@/hooks/web/useMessage'; | |||
| import { getDateByPicker } from '/@/utils'; | |||
| //日期个性化选择 | |||
| const fieldPickers = reactive({ | |||
| }); | |||
| const queryParam = reactive<any>({}); | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| const userStore = useUserStore(); | |||
| const { createMessage } = useMessage(); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '方案分类', | |||
| api: list, | |||
| columns, | |||
| canResize:true, | |||
| formConfig: { | |||
| //labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToNumber: [ | |||
| ], | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| fixed:'right' | |||
| }, | |||
| beforeFetch: (params) => { | |||
| if (params && fieldPickers) { | |||
| for (let key in fieldPickers) { | |||
| if (params[key]) { | |||
| params[key] = getDateByPicker(params[key], fieldPickers[key]); | |||
| } | |||
| } | |||
| } | |||
| return Object.assign(params, queryParam); | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"方案分类", | |||
| url: getExportUrl, | |||
| params: queryParam, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl, | |||
| success: handleSuccess | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| // 高级查询配置 | |||
| const superQueryConfig = reactive(superQuerySchema); | |||
| /** | |||
| * 高级查询事件 | |||
| */ | |||
| function handleSuperQuery(params) { | |||
| Object.keys(params).map((k) => { | |||
| queryParam[k] = params[k]; | |||
| }); | |||
| reload(); | |||
| } | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| 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}, handleSuccess); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: selectedRowKeys.value}, handleSuccess); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| (selectedRowKeys.value = []) && reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| auth: 'appletSchemeCategory:applet_scheme_category:edit' | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| placement: 'topLeft', | |||
| }, | |||
| auth: 'appletSchemeCategory:applet_scheme_category:delete' | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| :deep(.ant-picker),:deep(.ant-input-number){ | |||
| width: 100%; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,26 @@ | |||
| -- 注意:该页面对应的前台目录为views/appletSchemeCategory文件夹下 | |||
| -- 如果你想更改到其他目录,请修改sql中component字段对应的值 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) | |||
| VALUES ('2025082804359300550', NULL, '方案分类', '/appletSchemeCategory/appletSchemeCategoryList', 'appletSchemeCategory/AppletSchemeCategoryList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-08-28 16:35:55', NULL, NULL, 0); | |||
| -- 权限控制sql | |||
| -- 新增 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804359300551', '2025082804359300550', '添加方案分类', NULL, NULL, 0, NULL, NULL, 2, 'appletSchemeCategory:applet_scheme_category:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:55', NULL, NULL, 0, 0, '1', 0); | |||
| -- 编辑 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804359300552', '2025082804359300550', '编辑方案分类', NULL, NULL, 0, NULL, NULL, 2, 'appletSchemeCategory:applet_scheme_category:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:55', NULL, NULL, 0, 0, '1', 0); | |||
| -- 删除 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804359300553', '2025082804359300550', '删除方案分类', NULL, NULL, 0, NULL, NULL, 2, 'appletSchemeCategory:applet_scheme_category:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:55', NULL, NULL, 0, 0, '1', 0); | |||
| -- 批量删除 | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804359300554', '2025082804359300550', '批量删除方案分类', NULL, NULL, 0, NULL, NULL, 2, 'appletSchemeCategory:applet_scheme_category:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:55', NULL, NULL, 0, 0, '1', 0); | |||
| -- 导出excel | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804359300555', '2025082804359300550', '导出excel_方案分类', NULL, NULL, 0, NULL, NULL, 2, 'appletSchemeCategory:applet_scheme_category:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:55', NULL, NULL, 0, 0, '1', 0); | |||
| -- 导入excel | |||
| INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
| VALUES ('2025082804359300556', '2025082804359300550', '导入excel_方案分类', NULL, NULL, 0, NULL, NULL, 2, 'appletSchemeCategory:applet_scheme_category:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-28 16:35:55', NULL, NULL, 0, 0, '1', 0); | |||
| @ -0,0 +1,70 @@ | |||
| <template> | |||
| <div style="min-height: 400px"> | |||
| <BasicForm @register="registerForm"></BasicForm> | |||
| <div style="width: 100%;text-align: center" v-if="!formDisabled"> | |||
| <a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button> | |||
| </div> | |||
| </div> | |||
| </template> | |||
| <script lang="ts"> | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {computed, defineComponent} from 'vue'; | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import { propTypes } from '/@/utils/propTypes'; | |||
| import {getBpmFormSchema} from '../AppletSchemeCategory.data'; | |||
| import {saveOrUpdate} from '../AppletSchemeCategory.api'; | |||
| export default defineComponent({ | |||
| name: "AppletSchemeCategoryForm", | |||
| components:{ | |||
| BasicForm | |||
| }, | |||
| props:{ | |||
| formData: propTypes.object.def({}), | |||
| formBpm: propTypes.bool.def(true), | |||
| }, | |||
| setup(props){ | |||
| const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: getBpmFormSchema(props.formData), | |||
| showActionButtonGroup: false, | |||
| baseColProps: {span: 24} | |||
| }); | |||
| const formDisabled = computed(()=>{ | |||
| if(props.formData.disabled === false){ | |||
| return false; | |||
| } | |||
| return true; | |||
| }); | |||
| let formData = {}; | |||
| const queryByIdUrl = '/appletSchemeCategory/appletSchemeCategory/queryById'; | |||
| async function initFormData(){ | |||
| let params = {id: props.formData.dataId}; | |||
| const data = await defHttp.get({url: queryByIdUrl, params}); | |||
| formData = {...data} | |||
| //设置表单的值 | |||
| await setFieldsValue(formData); | |||
| //默认是禁用 | |||
| await setProps({disabled: formDisabled.value}) | |||
| } | |||
| async function submitForm() { | |||
| let data = getFieldsValue(); | |||
| let params = Object.assign({}, formData, data); | |||
| console.log('表单数据', params) | |||
| await saveOrUpdate(params, true) | |||
| } | |||
| initFormData(); | |||
| return { | |||
| registerForm, | |||
| formDisabled, | |||
| submitForm, | |||
| } | |||
| } | |||
| }); | |||
| </script> | |||
| @ -0,0 +1,99 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm" name="AppletSchemeCategoryForm" /> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref, reactive} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../AppletSchemeCategory.data'; | |||
| import {saveOrUpdate} from '../AppletSchemeCategory.api'; | |||
| import { useMessage } from '/@/hooks/web/useMessage'; | |||
| import { getDateByPicker } from '/@/utils'; | |||
| const { createMessage } = useMessage(); | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| const isDetail = ref(false); | |||
| //表单配置 | |||
| const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| baseColProps: {span: 24} | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| isDetail.value = !!data?.showFooter; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //日期个性化选择 | |||
| const fieldPickers = reactive({ | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| // 预处理日期数据 | |||
| changeDateValue(values); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } catch ({ errorFields }) { | |||
| if (errorFields) { | |||
| const firstField = errorFields[0]; | |||
| if (firstField) { | |||
| scrollToField(firstField.name, { behavior: 'smooth', block: 'center' }); | |||
| } | |||
| } | |||
| return Promise.reject(errorFields); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| /** | |||
| * 处理日期值 | |||
| * @param formData 表单数据 | |||
| */ | |||
| const changeDateValue = (formData) => { | |||
| if (formData && fieldPickers) { | |||
| for (let key in fieldPickers) { | |||
| if (formData[key]) { | |||
| formData[key] = getDateByPicker(formData[key], fieldPickers[key]); | |||
| } | |||
| } | |||
| } | |||
| }; | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** 时间和数字输入框样式 */ | |||
| :deep(.ant-input-number) { | |||
| width: 100%; | |||
| } | |||
| :deep(.ant-calendar-picker) { | |||
| width: 100%; | |||
| } | |||
| </style> | |||