From 0ce0bab975ab34fa02f9b8a05afbf29d532efbfa Mon Sep 17 00:00:00 2001 From: "hechao.zhu" Date: Sat, 14 Oct 2023 17:54:21 +0800 Subject: [PATCH] =?UTF-8?q?cms=E6=A0=8F=E7=9B=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cms/controller/CmsColumnController.java | 181 ++++++++++++- .../modules/demo/cms/entity/CmsColumn.java | 3 + .../demo/cms/mapper/CmsColumnMapper.java | 19 ++ .../demo/cms/mapper/xml/CmsColumnMapper.xml | 19 ++ .../demo/cms/service/ICmsColumnService.java | 40 ++- .../service/impl/CmsColumnServiceImpl.java | 189 +++++++++++++- .../views/cms/admin/column/CmsColumn.api.ts | 32 ++- .../views/cms/admin/column/CmsColumn.data.ts | 56 ++-- .../views/cms/admin/column/CmsColumnList.vue | 243 ++++++++++++++---- .../admin/column/components/CmsColumnForm.vue | 4 +- .../column/components/CmsColumnModal.vue | 106 +++++--- 11 files changed, 776 insertions(+), 116 deletions(-) diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsColumnController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsColumnController.java index 8fe5ded4..c0e183ea 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsColumnController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsColumnController.java @@ -6,11 +6,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; -import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.apache.commons.lang.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.SelectTreeModel; +import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.demo.cms.entity.CmsColumn; import org.jeecg.modules.demo.cms.service.ICmsColumnService; import org.springframework.beans.factory.annotation.Autowired; @@ -20,6 +22,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; +import java.util.List; /** * @Description: cms栏目 @@ -58,6 +61,168 @@ public class CmsColumnController extends JeecgController> rootList(CmsColumn CmsColumn, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { +// String hasQuery = req.getParameter("hasQuery"); +// if (hasQuery != null && "true".equals(hasQuery)) { +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(CmsColumn, req.getParameterMap()); +// List list = cmsColumnService.queryTreeListNoPage(queryWrapper); +// IPage pageList = new Page<>(1, 10, list.size()); +// pageList.setRecords(list); +// return Result.OK(pageList); +// } else { +// String parentId = CmsColumn.getPid(); +// if (oConvertUtils.isEmpty(parentId)) { +// parentId = "0"; +// } +// CmsColumn.setPid(null); +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(CmsColumn, req.getParameterMap()); +// // 使用 eq 防止模糊查询 +// queryWrapper.eq("pid", parentId); +// Page page = new Page(pageNo, pageSize); +// IPage pageList = cmsColumnService.page(page, queryWrapper); +// for (CmsColumn CmsColumn1 : pageList.getRecords()) { +// if (CmsColumn1.getPid().equals("0")) +// CmsColumn1.setPid("无上级"); +// } +// +// return Result.OK(pageList); +// } + + if (oConvertUtils.isEmpty(CmsColumn.getPid())) { + CmsColumn.setPid("0"); + } + Result> result = new Result<>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(CmsColumn, req.getParameterMap()); + String name = CmsColumn.getName(); + if (StringUtils.isBlank(name)) { + queryWrapper.eq("pid", CmsColumn.getPid()); + } + Page page = new Page(pageNo, pageSize); + IPage pageList = cmsColumnService.page(page, queryWrapper); + result.setSuccess(true); + result.setResult(pageList); + return result; + } + + /** + * 【vue3专用】加载节点的子数据 + * + * @param pid + * @return + */ + @RequestMapping(value = "/loadTreeChildren", method = RequestMethod.GET) + public Result> loadTreeChildren(@RequestParam(name = "pid") String pid) { + Result> result = new Result<>(); + try { + List ls = cmsColumnService.queryListByPid(pid); + result.setResult(ls); + result.setSuccess(true); + } catch (Exception e) { + e.printStackTrace(); + result.setMessage(e.getMessage()); + result.setSuccess(false); + } + return result; + } + + /** + * 【vue3专用】加载一级节点/如果是同步 则所有数据 + * + * @param async + * @param pcode + * @return + */ + @RequestMapping(value = "/loadTreeRoot", method = RequestMethod.GET) + public Result> loadTreeRoot(@RequestParam(name = "async") Boolean async, + @RequestParam(name = "pcode") String pcode) { + Result> result = new Result<>(); + try { + List ls = cmsColumnService.queryListByCode(pcode); + if (!async) { + loadAllChildren(ls); + } + result.setResult(ls); + result.setSuccess(true); + } catch (Exception e) { + e.printStackTrace(); + result.setMessage(e.getMessage()); + result.setSuccess(false); + } + return result; + } + + /** + * 【vue3专用】递归求子节点 同步加载用到 + * + * @param ls + */ + private void loadAllChildren(List ls) { + for (SelectTreeModel tsm : ls) { + List temp = cmsColumnService.queryListByPid(tsm.getKey()); + if (temp != null && temp.size() > 0) { + tsm.setChildren(temp); + loadAllChildren(temp); + } + } + } + + /** + * 获取子数据 + * + * @param CmsColumn + * @param req + * @return + */ + //@AutoLog(value = "基础能力设置-获取子数据") + @ApiOperation(value = "基础能力设置-获取子数据", notes = "基础能力设置-获取子数据") + @GetMapping(value = "/childList") + public Result> queryPageList(CmsColumn CmsColumn, HttpServletRequest req) { + Result> result = new Result(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(CmsColumn, req.getParameterMap()); + List list = cmsColumnService.list(queryWrapper); + result.setSuccess(true); + result.setResult(list); + return result; + } + + /** + * 批量查询子节点 + * + * @param parentIds 父ID(多个采用半角逗号分割) + * @param parentIds + * @return + */ + //@AutoLog(value = "基础能力设置-批量获取子数据") + @ApiOperation(value = "基础能力设置-批量获取子数据", notes = "基础能力设置-批量获取子数据") + @GetMapping("/getChildListBatch") + public Result getChildListBatch(@RequestParam("parentIds") String parentIds) { + try { + QueryWrapper queryWrapper = new QueryWrapper<>(); + List parentIdList = Arrays.asList(parentIds.split(",")); + queryWrapper.in("pid", parentIdList); + List list = cmsColumnService.list(queryWrapper); + IPage pageList = new Page<>(1, 10, list.size()); + pageList.setRecords(list); + return Result.OK(pageList); + } catch (Exception e) { + log.error(e.getMessage(), e); + return Result.error("批量查询子节点失败:" + e.getMessage()); + } + } + /** * 添加 * @@ -96,11 +261,17 @@ public class CmsColumnController extends JeecgController delete(@RequestParam(name = "id", required = true) String id) { - cmsColumnService.removeById(id); - return Result.OK("删除成功!"); + public Result delete(@RequestParam(name = "id", required = true) String id) { + Result result = new Result(); + CmsColumn sysCategory = cmsColumnService.getById(id); + if (sysCategory == null) { + result.error500("未找到对应实体"); + } else { + this.cmsColumnService.delete(id); + result.success("删除成功!"); + } + return result; } /** diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/entity/CmsColumn.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/entity/CmsColumn.java index ecd51b30..29858f6b 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/entity/CmsColumn.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/entity/CmsColumn.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import org.jeecg.common.aspect.annotation.Dict; import org.jeecgframework.poi.excel.annotation.Excel; import java.io.Serializable; @@ -64,6 +65,7 @@ public class CmsColumn implements Serializable { */ @Excel(name = "显示", width = 15) @ApiModelProperty(value = "显示") + @Dict(dicCode = "captain_code") private String isShow; /** * 名称 @@ -82,5 +84,6 @@ public class CmsColumn implements Serializable { */ @Excel(name = "是否有子节点", width = 15) @ApiModelProperty(value = "是否有子节点") + @Dict(dicCode = "captain_code") private String hasChild; } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/CmsColumnMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/CmsColumnMapper.java index ab4b3391..5cc99d3c 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/CmsColumnMapper.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/CmsColumnMapper.java @@ -1,8 +1,10 @@ package org.jeecg.modules.demo.cms.mapper; import java.util.List; +import java.util.Map; import org.apache.ibatis.annotations.Param; +import org.jeecg.common.system.vo.SelectTreeModel; import org.jeecg.modules.demo.cms.entity.CmsColumn; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -14,4 +16,21 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; */ public interface CmsColumnMapper extends BaseMapper { + /** + * 编辑节点状态 + * @param id + * @param status + */ + void updateTreeNodeStatus(@Param("id") String id,@Param("status") String status); + + /** + * 【vue3专用】根据父级ID查询树节点数据 + * + * @param pid + * @param query + * @return + */ + List queryListByPid(@Param("pid") String pid, @Param("query") Map query); + + } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/xml/CmsColumnMapper.xml b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/xml/CmsColumnMapper.xml index 58e0e128..7a686fb5 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/xml/CmsColumnMapper.xml +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/xml/CmsColumnMapper.xml @@ -2,4 +2,23 @@ + + + + update has_child set has_child = #{status} where id = #{id} + + \ No newline at end of file diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/ICmsColumnService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/ICmsColumnService.java index de79b344..6ca389bb 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/ICmsColumnService.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/ICmsColumnService.java @@ -1,7 +1,11 @@ package org.jeecg.modules.demo.cms.service; -import org.jeecg.modules.demo.cms.entity.CmsColumn; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.system.vo.SelectTreeModel; +import org.jeecg.modules.demo.cms.entity.CmsColumn; + +import java.util.List; /** * @Description: cms栏目 @@ -11,4 +15,38 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface ICmsColumnService extends IService { + /**根节点父ID的值*/ + public static final String ROOT_PID_VALUE = "0"; + + /**树节点有子节点状态值*/ + public static final String HASCHILD = "1"; + + /**树节点无子节点状态值*/ + public static final String NOCHILD = "0"; + + /** + * 查询所有数据,无分页 + * + * @param queryWrapper + * @return List + */ + List queryTreeListNoPage(QueryWrapper queryWrapper); + + /** + * 【vue3专用】根据父级编码加载分类字典的数据 + * + * @param parentCode + * @return + */ + List queryListByCode(String parentCode); + + /** + * 【vue3专用】根据pid查询子节点集合 + * + * @param pid + * @return + */ + List queryListByPid(String pid); + + void delete(String id); } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/impl/CmsColumnServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/impl/CmsColumnServiceImpl.java index 944b3597..70f33ffd 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/impl/CmsColumnServiceImpl.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/impl/CmsColumnServiceImpl.java @@ -1,19 +1,204 @@ package org.jeecg.modules.demo.cms.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.constant.SymbolConstant; +import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.common.system.vo.SelectTreeModel; +import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.demo.cms.entity.CmsColumn; import org.jeecg.modules.demo.cms.mapper.CmsColumnMapper; import org.jeecg.modules.demo.cms.service.ICmsColumnService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; /** * @Description: cms栏目 * @Author: jeecg-boot - * @Date: 2023-10-11 + * @Date: 2023-10-11 * @Version: V1.0 */ @Service public class CmsColumnServiceImpl extends ServiceImpl implements ICmsColumnService { + @Override + public List queryTreeListNoPage(QueryWrapper queryWrapper) { + List dataList = baseMapper.selectList(queryWrapper); + List mapList = new ArrayList<>(); + for (CmsColumn data : dataList) { + String pidVal = data.getPid(); + //递归查询子节点的根节点 + if (pidVal != null && !ICmsColumnService.NOCHILD.equals(pidVal)) { + CmsColumn rootVal = this.getTreeRoot(pidVal); + if (rootVal != null && !mapList.contains(rootVal)) { + mapList.add(rootVal); + } + } else { + if (!mapList.contains(data)) { + mapList.add(data); + } + } + } + return mapList; + } + + @Override + public List queryListByCode(String parentCode) { + String pid = ROOT_PID_VALUE; + if (oConvertUtils.isNotEmpty(parentCode)) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CmsColumn::getPid, parentCode); + List list = baseMapper.selectList(queryWrapper); + if (list == null || list.size() == 0) { + throw new JeecgBootException("该编码【" + parentCode + "】不存在,请核实!"); + } + if (list.size() > 1) { + throw new JeecgBootException("该编码【" + parentCode + "】存在多个,请核实!"); + } + pid = list.get(0).getId(); + } + return baseMapper.queryListByPid(pid, null); + + } + + @Override + public List queryListByPid(String pid) { + if (oConvertUtils.isEmpty(pid)) { + pid = ROOT_PID_VALUE; + } + return baseMapper.queryListByPid(pid, null); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String ids) { + String allIds = this.queryTreeChildIds(ids); + String pids = this.queryTreePids(ids); + //1.删除时将节点下所有子节点一并删除 + this.baseMapper.deleteBatchIds(Arrays.asList(allIds.split(","))); + //2.将父节点中已经没有下级的节点,修改为没有子节点 + if (oConvertUtils.isNotEmpty(pids)) { + LambdaUpdateWrapper updateWrapper = new UpdateWrapper() + .lambda() + .in(CmsColumn::getId, Arrays.asList(pids.split(","))) + .set(CmsColumn::getHasChild, "0"); + this.update(updateWrapper); + } + } + + /** + * 查询需修改标识的父节点ids + * + * @param ids + * @return + */ + private String queryTreePids(String ids) { + StringBuffer sb = new StringBuffer(); + //获取id数组 + String[] idArr = ids.split(","); + for (String id : idArr) { + if (id != null) { + CmsColumn category = this.baseMapper.selectById(id); + //根据id查询pid值 + String metaPid = category.getPid(); + //查询此节点上一级是否还有其他子节点 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CmsColumn::getPid, metaPid); + queryWrapper.notIn(CmsColumn::getId, Arrays.asList(idArr)); + List dataList = this.baseMapper.selectList(queryWrapper); + boolean flag = (dataList == null || dataList.size() == 0) && !Arrays.asList(idArr).contains(metaPid) + && !sb.toString().contains(metaPid); + if (flag) { + //如果当前节点原本有子节点 现在木有了,更新状态 + sb.append(metaPid).append(","); + } + } + } + if (sb.toString().endsWith(SymbolConstant.COMMA)) { + sb = sb.deleteCharAt(sb.length() - 1); + } + return sb.toString(); + } + + /** + * 根据所传pid查询旧的父级节点的子节点并修改相应状态值 + * + * @param pid + */ + private void updateOldParentNode(String pid) { + if (!ICmsColumnService.ROOT_PID_VALUE.equals(pid)) { + Long count = baseMapper.selectCount(new QueryWrapper().eq("pid", pid)); + if (count == null || count <= 1) { +// baseMapper.updateTreeNodeStatus(pid, ICmsColumnService.NOCHILD); + this.lambdaUpdate().set(CmsColumn::getPid, ICmsColumnService.NOCHILD) + .eq(CmsColumn::getPid, pid).update(); + } + } + } + + /** + * 递归查询节点的根节点 + * + * @param pidVal + * @return + */ + private CmsColumn getTreeRoot(String pidVal) { + CmsColumn data = baseMapper.selectById(pidVal); + if (data != null && !ICmsColumnService.ROOT_PID_VALUE.equals(data.getPid())) { + return this.getTreeRoot(data.getPid()); + } else { + return data; + } + } + + /** + * 根据id查询所有子节点id + * + * @param ids + * @return + */ + private String queryTreeChildIds(String ids) { + //获取id数组 + String[] idArr = ids.split(","); + StringBuffer sb = new StringBuffer(); + for (String pidVal : idArr) { + if (pidVal != null) { + if (!sb.toString().contains(pidVal)) { + if (sb.toString().length() > 0) { + sb.append(","); + } + sb.append(pidVal); + this.getTreeChildIds(pidVal, sb); + } + } + } + return sb.toString(); + } + + /** + * 递归查询所有子节点 + * + * @param pidVal + * @param sb + * @return + */ + private StringBuffer getTreeChildIds(String pidVal, StringBuffer sb) { + List dataList = baseMapper.selectList(new QueryWrapper().eq("pid", pidVal)); + if (dataList != null && dataList.size() > 0) { + for (CmsColumn tree : dataList) { + if (!sb.toString().contains(tree.getId())) { + sb.append(",").append(tree.getId()); + } + this.getTreeChildIds(tree.getId(), sb); + } + } + return sb; + } } diff --git a/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.api.ts b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.api.ts index e3bd0a62..be0f65bd 100644 --- a/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.api.ts +++ b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.api.ts @@ -4,13 +4,16 @@ import { useMessage } from "/@/hooks/web/useMessage"; const { createConfirm } = useMessage(); enum Api { - list = '/cms/cmsColumn/list', + list = '/cms/cmsColumn/rootList', save='/cms/cmsColumn/add', edit='/cms/cmsColumn/edit', deleteOne = '/cms/cmsColumn/delete', deleteBatch = '/cms/cmsColumn/deleteBatch', importExcel = '/cms/cmsColumn/importExcel', exportXls = '/cms/cmsColumn/exportXls', + loadTreeData = '/cms/cmsColumn/loadTreeRoot', + getChildList = '/cms/cmsColumn/childList', + getChildListBatch = '/cms/cmsColumn/getChildListBatch', } /** * 导出api @@ -58,7 +61,32 @@ export const batchDelete = (params, handleSuccess) => { * 保存或者更新 * @param params */ -export const saveOrUpdate = (params, isUpdate) => { +// export const saveOrUpdate = (params, isUpdate) => { +// let url = isUpdate ? Api.edit : Api.save; +// return defHttp.post({url: url, params}); +// } + +export const saveOrUpdateDict = (params, isUpdate) => { let url = isUpdate ? Api.edit : Api.save; return defHttp.post({url: url, params}); } + +/** + * 查询全部树形节点数据 + * @param params + */ +export const loadTreeData = (params) => + defHttp.get({url: Api.loadTreeData,params}); +/** + * 查询子节点数据 + * @param params + */ +export const getChildList = (params) => + defHttp.get({url: Api.getChildList, params}); +/** + * 批量查询子节点数据 + * @param params + */ +export const getChildListBatch = (params) => + defHttp.get({url: Api.getChildListBatch, params},{isTransformResponse:false}); + diff --git a/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.data.ts b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.data.ts index 40fa2d80..cff4b5c0 100644 --- a/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.data.ts +++ b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.data.ts @@ -4,20 +4,21 @@ import { rules} from '/@/utils/helper/validator'; import { render } from '/@/utils/common/renderUtils'; //列表数据 export const columns: BasicColumn[] = [ + // { + // title: '父级节点', + // align:"center", + // dataIndex: 'pid' + // }, { title: '栏目名称', - align:"center", - dataIndex: 'name' - }, - { - title: '父级节点', - align:"center", - dataIndex: 'pid' + align:"left", + dataIndex: 'name', + width: 350, }, { - title: '是否有子节点', + title: '显示', align:"center", - dataIndex: 'hasChild' + dataIndex: 'isShow_dictText' }, { title: '排序', @@ -36,6 +37,18 @@ export const searchFormSchema: FormSchema[] = [ ]; //表单数据 export const formSchema: FormSchema[] = [ + { + label: '父级节点', + field: 'pid', + component: 'JTreeSelect', + componentProps: { + dict: 'cms_column,name,id', + pidField: 'pid', + pidValue: '0', + hasChildField: 'has_child', + }, + dynamicDisabled: true, + }, { label: '栏目名称', field: 'name', @@ -46,15 +59,24 @@ export const formSchema: FormSchema[] = [ ]; }, }, + // { + // label: '是否有子节点', + // field: 'hasChild', + // component: 'Input', + // }, + { - label: '父级节点', - field: 'pid', - component: 'Input', - }, - { - label: '是否有子节点', - field: 'hasChild', - component: 'Input', + label: '显示', + field: 'isShow', + component: 'RadioGroup', + componentProps: { + //options里面由一个一个的radio组成,支持disabled + options: [ + { label: '是', value: 1, }, + { label: '否', value: 0 }, + ], + defaultValue:1, + }, }, { label: '排序', diff --git a/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumnList.vue b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumnList.vue index 50c67877..6013f3c7 100644 --- a/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumnList.vue +++ b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumnList.vue @@ -1,17 +1,20 @@