From 303f10c000b062eb3eeb31ab945ebbcbf0584d8e Mon Sep 17 00:00:00 2001 From: "hechao.zhu" Date: Fri, 13 Oct 2023 16:11:34 +0800 Subject: [PATCH] =?UTF-8?q?cms=20=E6=96=87=E7=AB=A0=E7=AE=A1=E7=90=86=20?= =?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 --- .../demo/cms/controller/CmsArticleController.java | 10 ++++++++-- .../views/cms/admin/articel/CmsArticleList.vue | 15 +++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) 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;