From 51e0db66dbc8e441dabade9e6c50a98c0c6af558 Mon Sep 17 00:00:00 2001 From: Gitea Date: Thu, 12 Oct 2023 16:11:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../compexp/controller/CompExpController.java | 178 +++++++++ .../modules/demo/compexp/entity/CompExp.java | 75 ++++ .../demo/compexp/mapper/CompExpMapper.java | 17 + .../demo/compexp/mapper/xml/CompExpMapper.xml | 5 + .../demo/compexp/service/ICompExpService.java | 14 + .../service/impl/CompExpServiceImpl.java | 19 + .../expert/controller/ExpertController.java | 339 ++++++++++++++++++ .../modules/demo/expert/entity/Expert.java | 92 +++++ .../demo/expert/mapper/ExpertMapper.java | 17 + .../demo/expert/mapper/xml/ExpertMapper.xml | 5 + .../demo/expert/service/IExpertService.java | 14 + .../service/impl/ExpertServiceImpl.java | 19 + .../src/components/DrawerZJ/index.ts | 6 + .../components/DrawerZJ/src/BasicDrawerZJ.vue | 237 ++++++++++++ .../DrawerZJ/src/components/DrawerFooter.vue | 75 ++++ .../DrawerZJ/src/components/DrawerHeader.vue | 74 ++++ .../src/components/DrawerZJ/src/props.ts | 45 +++ .../src/components/DrawerZJ/src/typing.ts | 196 ++++++++++ .../components/DrawerZJ/src/useDrawerZJ.ts | 146 ++++++++ .../src/views/system/user/UserDrawerZJ.vue | 171 +++++++++ .../src/views/system/user/index.vue | 60 +++- .../src/views/system/user/user.api.js | 26 +- .../src/views/system/user/user.api.ts | 25 ++ .../src/views/system/user/user.data.js | 239 +++++++++++- .../src/views/system/user/user.data.ts | 238 ++++++++++++ 25 files changed, 2319 insertions(+), 13 deletions(-) create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/controller/CompExpController.java create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/entity/CompExp.java create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/mapper/CompExpMapper.java create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/mapper/xml/CompExpMapper.xml create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/service/ICompExpService.java create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/service/impl/CompExpServiceImpl.java create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/entity/Expert.java create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/mapper/ExpertMapper.java create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/mapper/xml/ExpertMapper.xml create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/service/IExpertService.java create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/service/impl/ExpertServiceImpl.java create mode 100644 jeecgboot-vue3-master/src/components/DrawerZJ/index.ts create mode 100644 jeecgboot-vue3-master/src/components/DrawerZJ/src/BasicDrawerZJ.vue create mode 100644 jeecgboot-vue3-master/src/components/DrawerZJ/src/components/DrawerFooter.vue create mode 100644 jeecgboot-vue3-master/src/components/DrawerZJ/src/components/DrawerHeader.vue create mode 100644 jeecgboot-vue3-master/src/components/DrawerZJ/src/props.ts create mode 100644 jeecgboot-vue3-master/src/components/DrawerZJ/src/typing.ts create mode 100644 jeecgboot-vue3-master/src/components/DrawerZJ/src/useDrawerZJ.ts create mode 100644 jeecgboot-vue3-master/src/views/system/user/UserDrawerZJ.vue diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/controller/CompExpController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/controller/CompExpController.java new file mode 100644 index 00000000..7b94cdf1 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/controller/CompExpController.java @@ -0,0 +1,178 @@ +package org.jeecg.modules.demo.compexp.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.compexp.entity.CompExp; +import org.jeecg.modules.demo.compexp.service.ICompExpService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.apache.shiro.authz.annotation.RequiresPermissions; + + /** + * @Description: 比赛专家 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Api(tags="比赛专家") +@RestController +@RequestMapping("/compexp/compExp") +@Slf4j +public class CompExpController extends JeecgController { + @Autowired + private ICompExpService compExpService; + + /** + * 分页列表查询 + * + * @param compExp + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "比赛专家-分页列表查询") + @ApiOperation(value="比赛专家-分页列表查询", notes="比赛专家-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(CompExp compExp, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(compExp, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = compExpService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param compExp + * @return + */ + @AutoLog(value = "比赛专家-添加") + @ApiOperation(value="比赛专家-添加", notes="比赛专家-添加") + @RequiresPermissions("compexp:comp_exp:add") + @PostMapping(value = "/add") + public Result add(@RequestBody CompExp compExp) { + compExpService.save(compExp); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param compExp + * @return + */ + @AutoLog(value = "比赛专家-编辑") + @ApiOperation(value="比赛专家-编辑", notes="比赛专家-编辑") + @RequiresPermissions("compexp:comp_exp:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody CompExp compExp) { + compExpService.updateById(compExp); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "比赛专家-通过id删除") + @ApiOperation(value="比赛专家-通过id删除", notes="比赛专家-通过id删除") + @RequiresPermissions("compexp:comp_exp:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + compExpService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "比赛专家-批量删除") + @ApiOperation(value="比赛专家-批量删除", notes="比赛专家-批量删除") + @RequiresPermissions("compexp:comp_exp:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.compExpService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "比赛专家-通过id查询") + @ApiOperation(value="比赛专家-通过id查询", notes="比赛专家-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + CompExp compExp = compExpService.getById(id); + if(compExp==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(compExp); + } + + /** + * 导出excel + * + * @param request + * @param compExp + */ + @RequiresPermissions("compexp:comp_exp:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, CompExp compExp) { + return super.exportXls(request, compExp, CompExp.class, "比赛专家"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequiresPermissions("compexp:comp_exp:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, CompExp.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/entity/CompExp.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/entity/CompExp.java new file mode 100644 index 00000000..d9ed6567 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/entity/CompExp.java @@ -0,0 +1,75 @@ +package org.jeecg.modules.demo.compexp.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 lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 比赛专家 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Data +@TableName("comp_exp") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="comp_exp对象", description="比赛专家") +public class CompExp implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private java.lang.String sysOrgCode; + /**比赛*/ + @Excel(name = "比赛", width = 15) + @ApiModelProperty(value = "比赛") + private java.lang.String compid; + /**专家*/ + @Excel(name = "专家", width = 15, dictTable = "expert", dicText = "name", dicCode = "id") + @Dict(dictTable = "expert", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "专家") + private java.lang.String expid; + /**状态*/ + @Excel(name = "状态", width = 15) + @ApiModelProperty(value = "状态") + private java.lang.String stat; + /**比赛名称*/ + @Excel(name = "比赛名称", width = 15) + @ApiModelProperty(value = "比赛名称") + private java.lang.String compName; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/mapper/CompExpMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/mapper/CompExpMapper.java new file mode 100644 index 00000000..2668a383 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/mapper/CompExpMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.compexp.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.compexp.entity.CompExp; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 比赛专家 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +public interface CompExpMapper extends BaseMapper { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/mapper/xml/CompExpMapper.xml b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/mapper/xml/CompExpMapper.xml new file mode 100644 index 00000000..b3cf2248 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/mapper/xml/CompExpMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/service/ICompExpService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/service/ICompExpService.java new file mode 100644 index 00000000..3ec7047d --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/service/ICompExpService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.demo.compexp.service; + +import org.jeecg.modules.demo.compexp.entity.CompExp; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 比赛专家 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +public interface ICompExpService extends IService { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/service/impl/CompExpServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/service/impl/CompExpServiceImpl.java new file mode 100644 index 00000000..4b08a933 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compexp/service/impl/CompExpServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.demo.compexp.service.impl; + +import org.jeecg.modules.demo.compexp.entity.CompExp; +import org.jeecg.modules.demo.compexp.mapper.CompExpMapper; +import org.jeecg.modules.demo.compexp.service.ICompExpService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 比赛专家 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Service +public class CompExpServiceImpl extends ServiceImpl implements ICompExpService { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java new file mode 100644 index 00000000..8704291a --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java @@ -0,0 +1,339 @@ +package org.jeecg.modules.demo.expert.controller; + +import java.util.Arrays; +import java.util.Date; +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 com.alibaba.fastjson.JSONObject; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.PasswordUtil; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.base.service.BaseCommonService; +import org.jeecg.modules.demo.compexp.entity.CompExp; +import org.jeecg.modules.demo.compexp.service.ICompExpService; +import org.jeecg.modules.demo.expert.entity.Expert; +import org.jeecg.modules.demo.expert.service.IExpertService; + +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.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysUserService; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.apache.shiro.authz.annotation.RequiresPermissions; + + /** + * @Description: 专家表 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Api(tags="专家表") +@RestController +@RequestMapping("/expert/expert") +@Slf4j +public class ExpertController extends JeecgController { + @Autowired + private IExpertService expertService; + + @Autowired + private ICompExpService compExpService; + + @Autowired + private BaseCommonService baseCommonService; + + @Autowired + private ISysUserService sysUserService; + + /** + * 分页列表查询 + * + * @param expert + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "专家表-分页列表查询") + @ApiOperation(value="专家表-分页列表查询", notes="专家表-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(Expert expert, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(expert, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = expertService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param expert + * @return + */ + @AutoLog(value = "专家表-添加") + @ApiOperation(value="专家表-添加", notes="专家表-添加") + @RequiresPermissions("expert:expert:add") + @PostMapping(value = "/add") + public Result add(@RequestBody Expert expert) { + expertService.save(expert); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param expert + * @return + */ + @AutoLog(value = "专家表-编辑") + @ApiOperation(value="专家表-编辑", notes="专家表-编辑") + @RequiresPermissions("expert:expert:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody Expert expert) { + expertService.updateById(expert); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "专家表-通过id删除") + @ApiOperation(value="专家表-通过id删除", notes="专家表-通过id删除") + @RequiresPermissions("expert:expert:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + expertService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "专家表-批量删除") + @ApiOperation(value="专家表-批量删除", notes="专家表-批量删除") + @RequiresPermissions("expert:expert:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.expertService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "专家表-通过id查询") + @ApiOperation(value="专家表-通过id查询", notes="专家表-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id,HttpServletRequest req) { + Expert expert = new Expert(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(expert, req.getParameterMap()); + queryWrapper.eq("user_id",id); + List list = expertService.list(queryWrapper); + CompExp compExp = new CompExp(); + QueryWrapper queryWrapper1 = QueryGenerator.initQueryWrapper(compExp, req.getParameterMap()); + queryWrapper1.eq("expid",list.get(0).getId()); + List list1 = compExpService.list(queryWrapper1); + if(list.size()==0) { + return Result.error("未找到对应数据"); + } + list.get(0).setCompid(list1.get(0).getCompid()); + list.get(0).setStat(list1.get(0).getStat()); + list.get(0).setCompName(list1.get(0).getCompName()); + return Result.OK(list.get(0)); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "专家表-通过id查询") + @ApiOperation(value="专家表-通过id查询", notes="专家表-通过id查询") + @GetMapping(value = "/queryByUserId") + public Result queryByUserId(@RequestParam(name="id",required=true) String id,HttpServletRequest req) { + Expert expert = new Expert(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(expert, req.getParameterMap()); + queryWrapper.eq("user_id",id); + List list = expertService.list(queryWrapper); + if(list.size()>0) { + return Result.OK("zj"); + }else{ + return Result.OK("pt"); + } + } + + @RequestMapping(value = "/addZJ", method = RequestMethod.POST) + public Result addZJ(@RequestBody JSONObject jsonObject) { + Result result = new Result(); + String selectedRoles = jsonObject.getString("selectedroles"); + String selectedDeparts = jsonObject.getString("selecteddeparts"); + String expSc = jsonObject.getString("expSc"); + String expResume = jsonObject.getString("expResume"); + String expTitle = jsonObject.getString("expTitle"); + String compid = jsonObject.getString("compid"); + String compName = jsonObject.getString("compName"); + String stat = jsonObject.getString("stat"); + try { + SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class); + user.setCreateTime(new Date());//设置创建时间 + String salt = oConvertUtils.randomGen(8); + user.setSalt(salt); + String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), salt); + user.setPassword(passwordEncode); + user.setStatus(1); + user.setDelFlag(CommonConstant.DEL_FLAG_0); + //用户表字段org_code不能在这里设置他的值 + user.setOrgCode(null); + // 保存用户走一个service 保证事务 + //获取租户ids + String relTenantIds = jsonObject.getString("relTenantIds"); + sysUserService.saveUser(user, selectedRoles, selectedDeparts, relTenantIds); + baseCommonService.addLog("添加用户,username: " +user.getUsername() ,CommonConstant.LOG_TYPE_2, 2); + Expert expert = new Expert(); + expert.setUserId(user.getId()); + expert.setExpImg(user.getAvatar()); + expert.setExpSc(expSc); + expert.setExpResume(expResume); + expert.setExpTitle(expTitle); + expert.setName(user.getRealname()); + expertService.save(expert); + CompExp compExp = new CompExp(); + compExp.setCompid(compid); + compExp.setCompName(compName); + compExp.setExpid(expert.getId()); + compExp.setStat(stat); + compExpService.save(compExp); + result.success("添加成功!"); + } catch (Exception e) { + log.error(e.getMessage(), e); + result.error500("操作失败"); + } + return result; + } + + @RequestMapping(value = "/editZJ", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result editZJ(@RequestBody JSONObject jsonObject,HttpServletRequest req) { + Result result = new Result(); + try { + SysUser sysUser = sysUserService.getById(jsonObject.getString("id")); + baseCommonService.addLog("编辑用户,username: " +sysUser.getUsername() ,CommonConstant.LOG_TYPE_2, 2); + if(sysUser==null) { + result.error500("未找到对应实体"); + }else { + SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class); + user.setUpdateTime(new Date()); + //String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), sysUser.getSalt()); + user.setPassword(sysUser.getPassword()); + String roles = jsonObject.getString("selectedroles"); + String departs = jsonObject.getString("selecteddeparts"); + String expSc = jsonObject.getString("expSc"); + String expResume = jsonObject.getString("expResume"); + String expTitle = jsonObject.getString("expTitle"); + String compid = jsonObject.getString("compid"); + String compName = jsonObject.getString("compName"); + String stat = jsonObject.getString("stat"); + if(oConvertUtils.isEmpty(departs)){ + //vue3.0前端只传递了departIds + departs=user.getDepartIds(); + } + //用户表字段org_code不能在这里设置他的值 + user.setOrgCode(null); + // 修改用户走一个service 保证事务 + //获取租户ids + String relTenantIds = jsonObject.getString("relTenantIds"); + sysUserService.editUser(user, roles, departs, relTenantIds); + Expert expert = new Expert(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(expert, req.getParameterMap()); + queryWrapper.eq("user_id",user.getId()); + List listex = expertService.list(queryWrapper); + expert = listex.get(0); + expert.setUserId(user.getId()); + expert.setExpImg(user.getAvatar()); + expert.setExpSc(expSc); + expert.setExpResume(expResume); + expert.setExpTitle(expTitle); + expert.setName(user.getRealname()); + expertService.updateById(expert); + CompExp compExp = new CompExp(); + QueryWrapper queryWrapper1 = QueryGenerator.initQueryWrapper(compExp, req.getParameterMap()); + queryWrapper1.eq("expid",expert.getId()); + List listce = compExpService.list(queryWrapper1); + compExp = listce.get(0); + compExp.setCompid(compid); + compExp.setCompName(compName); + compExp.setExpid(expert.getId()); + compExp.setStat(stat); + compExpService.updateById(compExp); + result.success("修改成功!"); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + result.error500("操作失败"); + } + return result; + } + + /** + * 导出excel + * + * @param request + * @param expert + */ + @RequiresPermissions("expert:expert:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, Expert expert) { + return super.exportXls(request, expert, Expert.class, "专家表"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequiresPermissions("expert:expert:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, Expert.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/entity/Expert.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/entity/Expert.java new file mode 100644 index 00000000..d5b7e988 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/entity/Expert.java @@ -0,0 +1,92 @@ +package org.jeecg.modules.demo.expert.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 专家表 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Data +@TableName("expert") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="expert对象", description="专家表") +public class Expert implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private java.lang.String sysOrgCode; + /**用户id*/ + @Excel(name = "用户id", width = 15) + @ApiModelProperty(value = "用户id") + private java.lang.String userId; + /**专家照片*/ + @Excel(name = "专家照片", width = 15) + @ApiModelProperty(value = "专家照片") + private java.lang.String expImg; + /**专家毕业院校*/ + @Excel(name = "专家毕业院校", width = 15) + @ApiModelProperty(value = "专家毕业院校") + private java.lang.String expSc; + /**专家履历*/ + @Excel(name = "专家履历", width = 15) + @ApiModelProperty(value = "专家履历") + private java.lang.String expResume; + /**专家学历*/ + @Excel(name = "专家学历", width = 15) + @ApiModelProperty(value = "专家学历") + private java.lang.String expTitle; + /**专家名称*/ + @Excel(name = "专家名称", width = 15) + @ApiModelProperty(value = "专家名称") + private java.lang.String name; + /**比赛*/ + @TableField(exist =false) + @ApiModelProperty(value = "比赛") + private java.lang.String compid; + /**状态*/ + @TableField(exist =false) + @ApiModelProperty(value = "状态") + private java.lang.String stat; + /**比赛名称*/ + @TableField(exist =false) + @ApiModelProperty(value = "比赛名称") + private java.lang.String compName; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/mapper/ExpertMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/mapper/ExpertMapper.java new file mode 100644 index 00000000..02c4645a --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/mapper/ExpertMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.expert.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.expert.entity.Expert; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 专家表 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +public interface ExpertMapper extends BaseMapper { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/mapper/xml/ExpertMapper.xml b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/mapper/xml/ExpertMapper.xml new file mode 100644 index 00000000..63436645 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/mapper/xml/ExpertMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/service/IExpertService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/service/IExpertService.java new file mode 100644 index 00000000..796c54c9 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/service/IExpertService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.demo.expert.service; + +import org.jeecg.modules.demo.expert.entity.Expert; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 专家表 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +public interface IExpertService extends IService { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/service/impl/ExpertServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/service/impl/ExpertServiceImpl.java new file mode 100644 index 00000000..57912c55 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/service/impl/ExpertServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.demo.expert.service.impl; + +import org.jeecg.modules.demo.expert.entity.Expert; +import org.jeecg.modules.demo.expert.mapper.ExpertMapper; +import org.jeecg.modules.demo.expert.service.IExpertService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 专家表 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Service +public class ExpertServiceImpl extends ServiceImpl implements IExpertService { + +} diff --git a/jeecgboot-vue3-master/src/components/DrawerZJ/index.ts b/jeecgboot-vue3-master/src/components/DrawerZJ/index.ts new file mode 100644 index 00000000..84b5b933 --- /dev/null +++ b/jeecgboot-vue3-master/src/components/DrawerZJ/index.ts @@ -0,0 +1,6 @@ +import { withInstall } from '/@/utils'; +import basicDrawerZJ from './src/BasicDrawerZJ.vue'; + +export const BasicDrawerZJ = withInstall(basicDrawerZJ); +export * from './src/typing'; +export { useDrawerZJ, useDrawerInner } from './src/useDrawerZJ'; diff --git a/jeecgboot-vue3-master/src/components/DrawerZJ/src/BasicDrawerZJ.vue b/jeecgboot-vue3-master/src/components/DrawerZJ/src/BasicDrawerZJ.vue new file mode 100644 index 00000000..d3a454b3 --- /dev/null +++ b/jeecgboot-vue3-master/src/components/DrawerZJ/src/BasicDrawerZJ.vue @@ -0,0 +1,237 @@ + + + diff --git a/jeecgboot-vue3-master/src/components/DrawerZJ/src/components/DrawerFooter.vue b/jeecgboot-vue3-master/src/components/DrawerZJ/src/components/DrawerFooter.vue new file mode 100644 index 00000000..9e6d3226 --- /dev/null +++ b/jeecgboot-vue3-master/src/components/DrawerZJ/src/components/DrawerFooter.vue @@ -0,0 +1,75 @@ + + + + diff --git a/jeecgboot-vue3-master/src/components/DrawerZJ/src/components/DrawerHeader.vue b/jeecgboot-vue3-master/src/components/DrawerZJ/src/components/DrawerHeader.vue new file mode 100644 index 00000000..82321287 --- /dev/null +++ b/jeecgboot-vue3-master/src/components/DrawerZJ/src/components/DrawerHeader.vue @@ -0,0 +1,74 @@ + + + + diff --git a/jeecgboot-vue3-master/src/components/DrawerZJ/src/props.ts b/jeecgboot-vue3-master/src/components/DrawerZJ/src/props.ts new file mode 100644 index 00000000..8d134ee3 --- /dev/null +++ b/jeecgboot-vue3-master/src/components/DrawerZJ/src/props.ts @@ -0,0 +1,45 @@ +import type { PropType } from 'vue'; + +import { useI18n } from '/@/hooks/web/useI18n'; +const { t } = useI18n(); + +export const footerProps = { + confirmLoading: { type: Boolean }, + /** + * @description: Show close button + */ + showCancelBtn: { type: Boolean, default: true }, + cancelButtonProps: Object as PropType, + cancelText: { type: String, default: t('common.cancelText') }, + /** + * @description: Show confirmation button + */ + showOkBtn: { type: Boolean, default: true }, + okButtonProps: Object as PropType, + okText: { type: String, default: t('common.okText') }, + okType: { type: String, default: 'primary' }, + showFooter: { type: Boolean }, + footerHeight: { + type: [String, Number] as PropType, + default: 60, + }, +}; +export const basicProps = { + class: {type: [String, Object, Array]}, + isDetail: { type: Boolean }, + title: { type: String, default: '' }, + loadingText: { type: String }, + showDetailBack: { type: Boolean, default: true }, + visible: { type: Boolean }, + loading: { type: Boolean }, + maskClosable: { type: Boolean, default: true }, + getContainer: { + type: [Object, String] as PropType, + }, + closeFunc: { + type: [Function, Object] as PropType, + default: null, + }, + destroyOnClose: { type: Boolean }, + ...footerProps, +}; diff --git a/jeecgboot-vue3-master/src/components/DrawerZJ/src/typing.ts b/jeecgboot-vue3-master/src/components/DrawerZJ/src/typing.ts new file mode 100644 index 00000000..27544a4d --- /dev/null +++ b/jeecgboot-vue3-master/src/components/DrawerZJ/src/typing.ts @@ -0,0 +1,196 @@ +import type { ButtonProps } from 'ant-design-vue/lib/button/buttonTypes'; +import type { CSSProperties, VNodeChild, ComputedRef } from 'vue'; +import type { ScrollContainerOptions } from '/@/components/Container/index'; + +export interface DrawerInstance { + setDrawerProps: (props: Partial | boolean) => void; + emitVisible?: (visible: boolean, uid: number) => void; +} + +export interface ReturnMethods extends DrawerInstance { + openDrawerZJ: (visible?: boolean, data?: T, openOnSet?: boolean) => void; + closeDrawer: () => void; + getVisible?: ComputedRef; +} + +export type RegisterFn = (drawerInstance: DrawerInstance, uuid?: string) => void; + +export interface ReturnInnerMethods extends DrawerInstance { + closeDrawer: () => void; + changeLoading: (loading: boolean) => void; + changeOkLoading: (loading: boolean) => void; + getVisible?: ComputedRef; +} + +export type UseDrawerReturnType = [RegisterFn, ReturnMethods]; + +export type UseDrawerInnerReturnType = [RegisterFn, ReturnInnerMethods]; + +export interface DrawerFooterProps { + showOkBtn: boolean; + showCancelBtn: boolean; + /** + * Text of the Cancel button + * @default 'cancel' + * @type string + */ + cancelText: string; + /** + * Text of the OK button + * @default 'OK' + * @type string + */ + okText: string; + + /** + * Button type of the OK button + * @default 'primary' + * @type string + */ + okType: 'primary' | 'danger' | 'dashed' | 'ghost' | 'default'; + /** + * The ok button props, follow jsx rules + * @type object + */ + okButtonProps: { props: ButtonProps; on: {} }; + + /** + * The cancel button props, follow jsx rules + * @type object + */ + cancelButtonProps: { props: ButtonProps; on: {} }; + /** + * Whether to apply loading visual effect for OK button or not + * @default false + * @type boolean + */ + confirmLoading: boolean; + + showFooter: boolean; + footerHeight: string | number; +} +export interface DrawerProps extends DrawerFooterProps { + isDetail?: boolean; + loading?: boolean; + showDetailBack?: boolean; + visible?: boolean; + /** + * Built-in ScrollContainer component configuration + * @type ScrollContainerOptions + */ + scrollOptions?: ScrollContainerOptions; + closeFunc?: () => Promise; + triggerWindowResize?: boolean; + /** + * Whether a close (x) button is visible on top right of the Drawer dialog or not. + * @default true + * @type boolean + */ + closable?: boolean; + + /** + * Whether to unmount child components on closing drawer or not. + * @default false + * @type boolean + */ + destroyOnClose?: boolean; + + /** + * Return the mounted node for Drawer. + * @default 'body' + * @type any ( HTMLElement| () => HTMLElement | string) + */ + getContainer?: () => HTMLElement | string; + + /** + * Whether to show mask or not. + * @default true + * @type boolean + */ + mask?: boolean; + + /** + * Clicking on the mask (area outside the Drawer) to close the Drawer or not. + * @default true + * @type boolean + */ + maskClosable?: boolean; + + /** + * Style for Drawer's mask element. + * @default {} + * @type object + */ + maskStyle?: CSSProperties; + + /** + * The title for Drawer. + * @type any (string | slot) + */ + title?: VNodeChild | JSX.Element; + + /** + * The class name of the container of the Drawer dialog. + * @type string + */ + class?: string; + // 兼容老版本的写法(后续可能会删除,优先写class) + wrapClassName?: string; + + /** + * Style of wrapper element which **contains mask** compare to `drawerStyle` + * @type object + */ + wrapStyle?: CSSProperties; + + /** + * Style of the popup layer element + * @type object + */ + drawerStyle?: CSSProperties; + + /** + * Style of floating layer, typically used for adjusting its position. + * @type object + */ + bodyStyle?: CSSProperties; + headerStyle?: CSSProperties; + + /** + * Width of the Drawer dialog. + * @default 256 + * @type string | number + */ + width?: string | number; + + /** + * placement is top or bottom, height of the Drawer dialog. + * @type string | number + */ + height?: string | number; + + /** + * The z-index of the Drawer. + * @default 1000 + * @type number + */ + zIndex?: number; + + /** + * The placement of the Drawer. + * @default 'right' + * @type string + */ + placement?: 'top' | 'right' | 'bottom' | 'left'; + afterVisibleChange?: (visible?: boolean) => void; + keyboard?: boolean; + /** + * Specify a callback that will be called when a user clicks mask, close button or Cancel button. + */ + onClose?: (e?: Event) => void; +} +export interface DrawerActionType { + scrollBottom: () => void; + scrollTo: (to: number) => void; + getScrollWrap: () => Element | null; +} diff --git a/jeecgboot-vue3-master/src/components/DrawerZJ/src/useDrawerZJ.ts b/jeecgboot-vue3-master/src/components/DrawerZJ/src/useDrawerZJ.ts new file mode 100644 index 00000000..9a3c24d8 --- /dev/null +++ b/jeecgboot-vue3-master/src/components/DrawerZJ/src/useDrawerZJ.ts @@ -0,0 +1,146 @@ +import type { UseDrawerReturnType, DrawerInstance, ReturnMethods, DrawerProps, UseDrawerInnerReturnType } from './typing'; +import { ref, getCurrentInstance, unref, reactive, watchEffect, nextTick, toRaw, computed } from 'vue'; +import { isProdMode } from '/@/utils/env'; +import { isFunction } from '/@/utils/is'; +import { tryOnUnmounted } from '@vueuse/core'; +import { isEqual } from 'lodash-es'; +import { error } from '/@/utils/log'; + +const dataTransferRef = reactive({}); + +const visibleData = reactive<{ [key: number]: boolean }>({}); + +/** + * @description: Applicable to separate drawer and call outside + */ +export function useDrawerZJ(): UseDrawerReturnType { + if (!getCurrentInstance()) { + throw new Error('useDrawerZJ() can only be used inside setup() or functional components!'); + } + const drawer = ref(null); + const loaded = ref>(false); + const uid = ref(''); + + function register(drawerInstance: DrawerInstance, uuid: string) { + isProdMode() && + tryOnUnmounted(() => { + drawer.value = null; + loaded.value = null; + dataTransferRef[unref(uid)] = null; + }); + + if (unref(loaded) && isProdMode() && drawerInstance === unref(drawer)) { + return; + } + uid.value = uuid; + drawer.value = drawerInstance; + loaded.value = true; + + drawerInstance.emitVisible = (visible: boolean, uid: number) => { + visibleData[uid] = visible; + }; + } + + const getInstance = () => { + const instance = unref(drawer); + if (!instance) { + error('useDrawerZJ instance is undefined!'); + } + return instance; + }; + + const methods: ReturnMethods = { + setDrawerProps: (props: Partial): void => { + getInstance()?.setDrawerProps(props); + }, + + getVisible: computed((): boolean => { + return visibleData[~~unref(uid)]; + }), + + openDrawerZJ: (visible = true, data?: T, openOnSet = true): void => { + getInstance()?.setDrawerProps({ + visible: visible, + }); + if (!data) return; + + if (openOnSet) { + dataTransferRef[unref(uid)] = null; + dataTransferRef[unref(uid)] = toRaw(data); + return; + } + const equal = isEqual(toRaw(dataTransferRef[unref(uid)]), toRaw(data)); + if (!equal) { + dataTransferRef[unref(uid)] = toRaw(data); + } + }, + closeDrawer: () => { + getInstance()?.setDrawerProps({ visible: false }); + }, + }; + + return [register, methods]; +} + +export const useDrawerInner = (callbackFn?: Fn): UseDrawerInnerReturnType => { + const drawerInstanceRef = ref>(null); + const currentInstance = getCurrentInstance(); + const uidRef = ref(''); + + if (!getCurrentInstance()) { + throw new Error('useDrawerInner() can only be used inside setup() or functional components!'); + } + + const getInstance = () => { + const instance = unref(drawerInstanceRef); + if (!instance) { + error('useDrawerInner instance is undefined!'); + return; + } + return instance; + }; + + const register = (modalInstance: DrawerInstance, uuid: string) => { + isProdMode() && + tryOnUnmounted(() => { + drawerInstanceRef.value = null; + }); + + uidRef.value = uuid; + drawerInstanceRef.value = modalInstance; + currentInstance?.emit('register', modalInstance, uuid); + }; + + watchEffect(() => { + const data = dataTransferRef[unref(uidRef)]; + if (!data) return; + if (!callbackFn || !isFunction(callbackFn)) return; + nextTick(() => { + callbackFn(data); + }); + }); + + return [ + register, + { + changeLoading: (loading = true) => { + getInstance()?.setDrawerProps({ loading }); + }, + + changeOkLoading: (loading = true) => { + getInstance()?.setDrawerProps({ confirmLoading: loading }); + }, + getVisible: computed((): boolean => { + return visibleData[~~unref(uidRef)]; + }), + + closeDrawer: () => { + getInstance()?.setDrawerProps({ visible: false }); + }, + + setDrawerProps: (props: Partial) => { + getInstance()?.setDrawerProps(props); + }, + }, + ]; +}; diff --git a/jeecgboot-vue3-master/src/views/system/user/UserDrawerZJ.vue b/jeecgboot-vue3-master/src/views/system/user/UserDrawerZJ.vue new file mode 100644 index 00000000..c77f6999 --- /dev/null +++ b/jeecgboot-vue3-master/src/views/system/user/UserDrawerZJ.vue @@ -0,0 +1,171 @@ + + diff --git a/jeecgboot-vue3-master/src/views/system/user/index.vue b/jeecgboot-vue3-master/src/views/system/user/index.vue index e700dccb..f0fa5f67 100644 --- a/jeecgboot-vue3-master/src/views/system/user/index.vue +++ b/jeecgboot-vue3-master/src/views/system/user/index.vue @@ -5,6 +5,7 @@