diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsArticleController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsArticleController.java index f9f20716..8a9abd1a 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsArticleController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsArticleController.java @@ -19,6 +19,7 @@ import org.jeecg.modules.demo.cms.entity.CmsColumn; import org.jeecg.modules.demo.cms.service.ICmsArticleService; import org.jeecg.modules.demo.cms.service.ICmsColumnService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -80,9 +81,10 @@ public class CmsArticleController extends JeecgController edit(@RequestBody CmsArticle cmsArticle) { + CmsColumn cmsColumn = cmsColumnService.getById(cmsArticle.getColumnId()); + if (!ObjectUtils.isEmpty(cmsColumn)) { + cmsArticle.setColumnName(cmsColumn.getName()); + } cmsArticleService.updateById(cmsArticle); return Result.OK("编辑成功!"); } diff --git a/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticleList.vue b/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticleList.vue index 3b4ad49c..986a66ab 100644 --- a/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticleList.vue +++ b/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticleList.vue @@ -93,6 +93,7 @@ import { } from './CmsArticle.api'; // import {updateStatus} from './CmsArticle.api'; import {Update} from "/@/views/topic/Topic.api"; +import {defHttp} from "/@/utils/http/axios"; // import { downloadFile } from '/@/utils/common/renderUtils'; const checkedKeys = ref>([]); //注册model @@ -150,9 +151,11 @@ function handleEdit(record: Recordable) { }); } -function update2(record: Recordable, isopen) { - record.isopen = isopen; +function update2(record: Recordable, val) { + record.status = val; updateStatus(record) + //第2种方法 + // defHttp.post({ url: '/cms/cmsArticle/operationStatus', params: record }); reload() } @@ -206,15 +209,15 @@ function getTableAction(record) { } ]; if (record.status == "1") { - actions.unshift({ + actions.unshift({ label: '取消发布', - onClick: update2.bind(null, record, "0"), + onClick: update2.bind(null,record, "0"), }); } if (record.status == "0") { - actions.unshift({ + actions.unshift({ label: '发布', - onClick: update2.bind("1", record, "1"), + onClick: update2.bind(null,record, "1"), }); } return actions;