cms 文章管理 功能添加

dev
hechao.zhu 1 year ago
parent 1422736b7e
commit 303f10c000
  1. 10
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsArticleController.java
  2. 9
      jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticleList.vue

@ -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<CmsArticle, ICmsArticl
cmsArticle.setCreateBy(principal.getUsername());
CmsColumn cmsColumn = cmsColumnService.getById(cmsArticle.getColumnId());
cmsArticle.setColumnName(cmsColumn.getName());
if (StringUtils.equals("1", cmsArticle.getStatus())) {
// if (StringUtils.equals("1", cmsArticle.getStatus())) {
cmsArticle.setPublishTime(new Date());
}
cmsArticle.setStatus("1");
// }
cmsArticleService.save(cmsArticle);
return Result.OK("添加成功!");
}
@ -109,6 +111,10 @@ public class CmsArticleController extends JeecgController<CmsArticle, ICmsArticl
// @RequiresPermissions("cms:cms_article:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody CmsArticle cmsArticle) {
CmsColumn cmsColumn = cmsColumnService.getById(cmsArticle.getColumnId());
if (!ObjectUtils.isEmpty(cmsColumn)) {
cmsArticle.setColumnName(cmsColumn.getName());
}
cmsArticleService.updateById(cmsArticle);
return Result.OK("编辑成功!");
}

@ -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<Array<string | number>>([]);
//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()
}
@ -214,7 +217,7 @@ function getTableAction(record) {
if (record.status == "0") {
actions.unshift({
label: '发布',
onClick: update2.bind("1", record, "1"),
onClick: update2.bind(null,record, "1"),
});
}
return actions;

Loading…
Cancel
Save