10 changed files with 1194 additions and 0 deletions
-
38chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuUserController.java
-
126chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysInfoReleaseController.java
-
117chenhai-system/src/main/java/com/chenhai/system/domain/SysInfoRelease.java
-
77chenhai-system/src/main/java/com/chenhai/system/mapper/SysInfoReleaseMapper.java
-
78chenhai-system/src/main/java/com/chenhai/system/service/ISysInfoReleaseService.java
-
136chenhai-system/src/main/java/com/chenhai/system/service/impl/SysInfoReleaseServiceImpl.java
-
119chenhai-system/src/main/resources/mapper/system/SysInfoReleaseMapper.xml
-
61chenhai-ui/src/api/system/infoRelease.js
-
1chenhai-ui/src/assets/icons/svg/infoRelease.svg
-
441chenhai-ui/src/views/system/infoRelease/index.vue
@ -0,0 +1,38 @@ |
|||||
|
package com.chenhai.web.controller.muhu; |
||||
|
|
||||
|
import com.chenhai.common.core.controller.BaseController; |
||||
|
import com.chenhai.common.core.domain.AjaxResult; |
||||
|
import com.chenhai.common.core.domain.entity.SysArea; |
||||
|
import com.chenhai.system.service.ISysAreaService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author : mazhongxu |
||||
|
* @date : 2026-01-14 17:08 |
||||
|
* @modyified By : |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/muhu/user") |
||||
|
public class MuhuUserController extends BaseController |
||||
|
{ |
||||
|
|
||||
|
@Autowired |
||||
|
private ISysAreaService sysAreaService; |
||||
|
|
||||
|
@PreAuthorize("@ss.hasRole('muhu')") |
||||
|
@GetMapping("/areaChildren") |
||||
|
public AjaxResult getAreaChildren(@RequestParam(value = "parentCode", required = false, defaultValue = "152900") String parentCode) { |
||||
|
SysArea query = new SysArea(); |
||||
|
query.setParentCode(parentCode); |
||||
|
query.setDeleted(0); |
||||
|
List<SysArea> list = sysAreaService.selectSysAreaList(query); |
||||
|
return success(list); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,126 @@ |
|||||
|
package com.chenhai.web.controller.system; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.PutMapping; |
||||
|
import org.springframework.web.bind.annotation.DeleteMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
import com.chenhai.common.annotation.Log; |
||||
|
import com.chenhai.common.core.controller.BaseController; |
||||
|
import com.chenhai.common.core.domain.AjaxResult; |
||||
|
import com.chenhai.common.enums.BusinessType; |
||||
|
import com.chenhai.system.domain.SysInfoRelease; |
||||
|
import com.chenhai.system.service.ISysInfoReleaseService; |
||||
|
import com.chenhai.common.utils.poi.ExcelUtil; |
||||
|
import com.chenhai.common.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* 资讯发布Controller |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-19 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/system/infoRelease") |
||||
|
public class SysInfoReleaseController extends BaseController |
||||
|
{ |
||||
|
@Autowired |
||||
|
private ISysInfoReleaseService sysInfoReleaseService; |
||||
|
|
||||
|
/** |
||||
|
* 查询资讯发布列表 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:infoRelease:list')") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo list(SysInfoRelease sysInfoRelease) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List<SysInfoRelease> list = sysInfoReleaseService.selectSysInfoReleaseList(sysInfoRelease); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出资讯发布列表 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:infoRelease:export')") |
||||
|
@Log(title = "资讯发布", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(HttpServletResponse response, SysInfoRelease sysInfoRelease) |
||||
|
{ |
||||
|
List<SysInfoRelease> list = sysInfoReleaseService.selectSysInfoReleaseList(sysInfoRelease); |
||||
|
ExcelUtil<SysInfoRelease> util = new ExcelUtil<SysInfoRelease>(SysInfoRelease.class); |
||||
|
util.exportExcel(response, list, "资讯发布数据"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取资讯发布详细信息 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:infoRelease:query')") |
||||
|
@GetMapping(value = "/{id}") |
||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) |
||||
|
{ |
||||
|
return success(sysInfoReleaseService.selectSysInfoReleaseById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增资讯发布 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:infoRelease:add')") |
||||
|
@Log(title = "资讯发布", businessType = BusinessType.INSERT) |
||||
|
@PostMapping |
||||
|
public AjaxResult add(@RequestBody SysInfoRelease sysInfoRelease) |
||||
|
{ |
||||
|
return toAjax(sysInfoReleaseService.insertSysInfoRelease(sysInfoRelease)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改资讯发布 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:infoRelease:edit')") |
||||
|
@Log(title = "资讯发布", businessType = BusinessType.UPDATE) |
||||
|
@PutMapping |
||||
|
public AjaxResult edit(@RequestBody SysInfoRelease sysInfoRelease) |
||||
|
{ |
||||
|
return toAjax(sysInfoReleaseService.updateSysInfoRelease(sysInfoRelease)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除资讯发布 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:infoRelease:remove')") |
||||
|
@Log(title = "资讯发布", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public AjaxResult remove(@PathVariable Long[] ids) |
||||
|
{ |
||||
|
return toAjax(sysInfoReleaseService.deleteSysInfoReleaseByIds(ids)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 上架资讯 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:infoRelease:publish')") |
||||
|
@Log(title = "资讯发布", businessType = BusinessType.UPDATE) |
||||
|
@PutMapping("/publish/{id}") |
||||
|
public AjaxResult publish(@PathVariable Long id) |
||||
|
{ |
||||
|
return toAjax(sysInfoReleaseService.publishSysInfoRelease(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 下架资讯 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:infoRelease:remove')") |
||||
|
@Log(title = "资讯发布", businessType = BusinessType.UPDATE) |
||||
|
@PutMapping("/remove/{id}") |
||||
|
public AjaxResult remove(@PathVariable Long id, @RequestBody(required = false) String removalReason) |
||||
|
{ |
||||
|
return toAjax(sysInfoReleaseService.removeSysInfoRelease(id, removalReason)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,117 @@ |
|||||
|
package com.chenhai.system.domain; |
||||
|
|
||||
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
import com.chenhai.common.annotation.Excel; |
||||
|
import com.chenhai.common.core.domain.BaseEntity; |
||||
|
|
||||
|
/** |
||||
|
* 资讯发布对象 sys_info_release |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-19 |
||||
|
*/ |
||||
|
public class SysInfoRelease extends BaseEntity |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 主键 */ |
||||
|
private Long id; |
||||
|
|
||||
|
/** 标题 */ |
||||
|
@Excel(name = "标题") |
||||
|
private String title; |
||||
|
|
||||
|
/** 内容 */ |
||||
|
@Excel(name = "内容") |
||||
|
private String content; |
||||
|
|
||||
|
/** 分类 */ |
||||
|
@Excel(name = "分类") |
||||
|
private String category; |
||||
|
|
||||
|
/** 上架状态(0-未上架 1-已上架) */ |
||||
|
@Excel(name = "上架状态(0-未上架 1-已上架)") |
||||
|
private String publishStatus; |
||||
|
|
||||
|
/** |
||||
|
* 下架原因 |
||||
|
* @param |
||||
|
*/ |
||||
|
@Excel(name = "下架原因") |
||||
|
private String removalReason; |
||||
|
|
||||
|
public void setId(Long id) |
||||
|
{ |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public Long getId() |
||||
|
{ |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setTitle(String title) |
||||
|
{ |
||||
|
this.title = title; |
||||
|
} |
||||
|
|
||||
|
public String getTitle() |
||||
|
{ |
||||
|
return title; |
||||
|
} |
||||
|
|
||||
|
public void setContent(String content) |
||||
|
{ |
||||
|
this.content = content; |
||||
|
} |
||||
|
|
||||
|
public String getContent() |
||||
|
{ |
||||
|
return content; |
||||
|
} |
||||
|
|
||||
|
public void setCategory(String category) |
||||
|
{ |
||||
|
this.category = category; |
||||
|
} |
||||
|
|
||||
|
public String getCategory() |
||||
|
{ |
||||
|
return category; |
||||
|
} |
||||
|
|
||||
|
public void setPublishStatus(String publishStatus) |
||||
|
{ |
||||
|
this.publishStatus = publishStatus; |
||||
|
} |
||||
|
|
||||
|
public String getPublishStatus() |
||||
|
{ |
||||
|
return publishStatus; |
||||
|
} |
||||
|
|
||||
|
public String getRemovalReason() { |
||||
|
return removalReason; |
||||
|
} |
||||
|
|
||||
|
public void setRemovalReason(String removalReason) { |
||||
|
this.removalReason = removalReason; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
|
.append("id", getId()) |
||||
|
.append("title", getTitle()) |
||||
|
.append("content", getContent()) |
||||
|
.append("category", getCategory()) |
||||
|
.append("publishStatus", getPublishStatus()) |
||||
|
.append("createBy", getCreateBy()) |
||||
|
.append("createTime", getCreateTime()) |
||||
|
.append("updateBy", getUpdateBy()) |
||||
|
.append("updateTime", getUpdateTime()) |
||||
|
.append("remark", getRemark()) |
||||
|
.toString(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,77 @@ |
|||||
|
package com.chenhai.system.mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.chenhai.system.domain.SysInfoRelease; |
||||
|
|
||||
|
/** |
||||
|
* 资讯发布Mapper接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-19 |
||||
|
*/ |
||||
|
public interface SysInfoReleaseMapper |
||||
|
{ |
||||
|
/** |
||||
|
* 查询资讯发布 |
||||
|
* |
||||
|
* @param id 资讯发布主键 |
||||
|
* @return 资讯发布 |
||||
|
*/ |
||||
|
public SysInfoRelease selectSysInfoReleaseById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询资讯发布列表 |
||||
|
* |
||||
|
* @param sysInfoRelease 资讯发布 |
||||
|
* @return 资讯发布集合 |
||||
|
*/ |
||||
|
public List<SysInfoRelease> selectSysInfoReleaseList(SysInfoRelease sysInfoRelease); |
||||
|
|
||||
|
/** |
||||
|
* 新增资讯发布 |
||||
|
* |
||||
|
* @param sysInfoRelease 资讯发布 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertSysInfoRelease(SysInfoRelease sysInfoRelease); |
||||
|
|
||||
|
/** |
||||
|
* 修改资讯发布 |
||||
|
* |
||||
|
* @param sysInfoRelease 资讯发布 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateSysInfoRelease(SysInfoRelease sysInfoRelease); |
||||
|
|
||||
|
/** |
||||
|
* 删除资讯发布 |
||||
|
* |
||||
|
* @param id 资讯发布主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSysInfoReleaseById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除资讯发布 |
||||
|
* |
||||
|
* @param ids 需要删除的数据主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSysInfoReleaseByIds(Long[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 上架资讯 |
||||
|
* |
||||
|
* @param sysInfoRelease 资讯发布 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int publishSysInfoRelease(SysInfoRelease sysInfoRelease); |
||||
|
|
||||
|
/** |
||||
|
* 下架资讯 |
||||
|
* |
||||
|
* @param sysInfoRelease 资讯发布 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int removeSysInfoRelease(SysInfoRelease sysInfoRelease); |
||||
|
} |
||||
@ -0,0 +1,78 @@ |
|||||
|
package com.chenhai.system.service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.chenhai.system.domain.SysInfoRelease; |
||||
|
|
||||
|
/** |
||||
|
* 资讯发布Service接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-19 |
||||
|
*/ |
||||
|
public interface ISysInfoReleaseService |
||||
|
{ |
||||
|
/** |
||||
|
* 查询资讯发布 |
||||
|
* |
||||
|
* @param id 资讯发布主键 |
||||
|
* @return 资讯发布 |
||||
|
*/ |
||||
|
public SysInfoRelease selectSysInfoReleaseById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询资讯发布列表 |
||||
|
* |
||||
|
* @param sysInfoRelease 资讯发布 |
||||
|
* @return 资讯发布集合 |
||||
|
*/ |
||||
|
public List<SysInfoRelease> selectSysInfoReleaseList(SysInfoRelease sysInfoRelease); |
||||
|
|
||||
|
/** |
||||
|
* 新增资讯发布 |
||||
|
* |
||||
|
* @param sysInfoRelease 资讯发布 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertSysInfoRelease(SysInfoRelease sysInfoRelease); |
||||
|
|
||||
|
/** |
||||
|
* 修改资讯发布 |
||||
|
* |
||||
|
* @param sysInfoRelease 资讯发布 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateSysInfoRelease(SysInfoRelease sysInfoRelease); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除资讯发布 |
||||
|
* |
||||
|
* @param ids 需要删除的资讯发布主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSysInfoReleaseByIds(Long[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 删除资讯发布信息 |
||||
|
* |
||||
|
* @param id 资讯发布主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSysInfoReleaseById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 上架资讯 |
||||
|
* |
||||
|
* @param id 资讯发布主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int publishSysInfoRelease(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 下架资讯 |
||||
|
* |
||||
|
* @param id 资讯发布主键 |
||||
|
* @param removalReason 下架原因 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int removeSysInfoRelease(Long id, String removalReason); |
||||
|
} |
||||
@ -0,0 +1,136 @@ |
|||||
|
package com.chenhai.system.service.impl; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.chenhai.common.utils.DateUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.chenhai.system.mapper.SysInfoReleaseMapper; |
||||
|
import com.chenhai.system.domain.SysInfoRelease; |
||||
|
import com.chenhai.system.service.ISysInfoReleaseService; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
/** |
||||
|
* 资讯发布Service业务层处理 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-19 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SysInfoReleaseServiceImpl implements ISysInfoReleaseService |
||||
|
{ |
||||
|
@Autowired |
||||
|
private SysInfoReleaseMapper sysInfoReleaseMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查询资讯发布 |
||||
|
* |
||||
|
* @param id 资讯发布主键 |
||||
|
* @return 资讯发布 |
||||
|
*/ |
||||
|
@Override |
||||
|
public SysInfoRelease selectSysInfoReleaseById(Long id) |
||||
|
{ |
||||
|
return sysInfoReleaseMapper.selectSysInfoReleaseById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询资讯发布列表 |
||||
|
* |
||||
|
* @param sysInfoRelease 资讯发布 |
||||
|
* @return 资讯发布 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<SysInfoRelease> selectSysInfoReleaseList(SysInfoRelease sysInfoRelease) |
||||
|
{ |
||||
|
return sysInfoReleaseMapper.selectSysInfoReleaseList(sysInfoRelease); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增资讯发布 |
||||
|
* |
||||
|
* @param sysInfoRelease 资讯发布 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int insertSysInfoRelease(SysInfoRelease sysInfoRelease) |
||||
|
{ |
||||
|
sysInfoRelease.setCreateTime(DateUtils.getNowDate()); |
||||
|
sysInfoRelease.setPublishStatus("0"); |
||||
|
return sysInfoReleaseMapper.insertSysInfoRelease(sysInfoRelease); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改资讯发布 |
||||
|
* |
||||
|
* @param sysInfoRelease 资讯发布 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateSysInfoRelease(SysInfoRelease sysInfoRelease) |
||||
|
{ |
||||
|
sysInfoRelease.setUpdateTime(DateUtils.getNowDate()); |
||||
|
return sysInfoReleaseMapper.updateSysInfoRelease(sysInfoRelease); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除资讯发布 |
||||
|
* |
||||
|
* @param ids 需要删除的资讯发布主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteSysInfoReleaseByIds(Long[] ids) |
||||
|
{ |
||||
|
return sysInfoReleaseMapper.deleteSysInfoReleaseByIds(ids); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除资讯发布信息 |
||||
|
* |
||||
|
* @param id 资讯发布主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteSysInfoReleaseById(Long id) |
||||
|
{ |
||||
|
return sysInfoReleaseMapper.deleteSysInfoReleaseById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 上架资讯 |
||||
|
* |
||||
|
* @param id 资讯发布主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional |
||||
|
public int publishSysInfoRelease(Long id) |
||||
|
{ |
||||
|
SysInfoRelease sysInfoRelease = new SysInfoRelease(); |
||||
|
sysInfoRelease.setId(id); |
||||
|
sysInfoRelease.setUpdateTime(DateUtils.getNowDate()); |
||||
|
|
||||
|
// 调用独立的上架方法 |
||||
|
return sysInfoReleaseMapper.publishSysInfoRelease(sysInfoRelease); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 下架资讯 |
||||
|
* |
||||
|
* @param id 资讯发布主键 |
||||
|
* @param removalReason 下架原因 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional |
||||
|
public int removeSysInfoRelease(Long id, String removalReason) |
||||
|
{ |
||||
|
SysInfoRelease sysInfoRelease = new SysInfoRelease(); |
||||
|
sysInfoRelease.setId(id); |
||||
|
sysInfoRelease.setRemovalReason(removalReason); |
||||
|
sysInfoRelease.setUpdateTime(DateUtils.getNowDate()); |
||||
|
|
||||
|
// 调用独立的下架方法 |
||||
|
return sysInfoReleaseMapper.removeSysInfoRelease(sysInfoRelease); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,119 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.chenhai.system.mapper.SysInfoReleaseMapper"> |
||||
|
|
||||
|
<resultMap type="SysInfoRelease" id="SysInfoReleaseResult"> |
||||
|
<result property="id" column="id" /> |
||||
|
<result property="title" column="title" /> |
||||
|
<result property="content" column="content" /> |
||||
|
<result property="category" column="category" /> |
||||
|
<result property="publishStatus" column="publish_status" /> |
||||
|
<result property="removalReason" column="removal_reason" /> |
||||
|
<result property="createBy" column="create_by" /> |
||||
|
<result property="createTime" column="create_time" /> |
||||
|
<result property="updateBy" column="update_by" /> |
||||
|
<result property="updateTime" column="update_time" /> |
||||
|
<result property="remark" column="remark" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="selectSysInfoReleaseVo"> |
||||
|
select id, title, content, category, publish_status, removal_reason, create_by, create_time, update_by, update_time, remark from sys_info_release |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectSysInfoReleaseList" parameterType="SysInfoRelease" resultMap="SysInfoReleaseResult"> |
||||
|
<include refid="selectSysInfoReleaseVo"/> |
||||
|
<where> |
||||
|
<if test="title != null and title != ''"> and title = #{title}</if> |
||||
|
<if test="content != null and content != ''"> and content = #{content}</if> |
||||
|
<if test="category != null and category != ''"> and category = #{category}</if> |
||||
|
<if test="publishStatus != null and publishStatus != ''"> and publish_status = #{publishStatus}</if> |
||||
|
<if test="removalReason != null and removalReason != ''"> and removal_reason = #{removalReason}</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectSysInfoReleaseById" parameterType="Long" resultMap="SysInfoReleaseResult"> |
||||
|
<include refid="selectSysInfoReleaseVo"/> |
||||
|
where id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="insertSysInfoRelease" parameterType="SysInfoRelease" useGeneratedKeys="true" keyProperty="id"> |
||||
|
insert into sys_info_release |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="title != null and title != ''">title,</if> |
||||
|
<if test="content != null and content != ''">content,</if> |
||||
|
<if test="category != null and category != ''">category,</if> |
||||
|
<if test="publishStatus != null">publish_status,</if> |
||||
|
<if test="removalReason != null">removal_reason,</if> |
||||
|
<if test="createBy != null">create_by,</if> |
||||
|
<if test="createTime != null">create_time,</if> |
||||
|
<if test="updateBy != null">update_by,</if> |
||||
|
<if test="updateTime != null">update_time,</if> |
||||
|
<if test="remark != null">remark,</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="title != null and title != ''">#{title},</if> |
||||
|
<if test="content != null and content != ''">#{content},</if> |
||||
|
<if test="category != null and category != ''">#{category},</if> |
||||
|
<if test="publishStatus != null">#{publishStatus},</if> |
||||
|
<if test="removalReason != null">#{removalReason},</if> |
||||
|
<if test="createBy != null">#{createBy},</if> |
||||
|
<if test="createTime != null">#{createTime},</if> |
||||
|
<if test="updateBy != null">#{updateBy},</if> |
||||
|
<if test="updateTime != null">#{updateTime},</if> |
||||
|
<if test="remark != null">#{remark},</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateSysInfoRelease" parameterType="SysInfoRelease"> |
||||
|
update sys_info_release |
||||
|
<trim prefix="SET" suffixOverrides=","> |
||||
|
<if test="title != null and title != ''">title = #{title},</if> |
||||
|
<if test="content != null and content != ''">content = #{content},</if> |
||||
|
<if test="category != null and category != ''">category = #{category},</if> |
||||
|
<if test="publishStatus != null">publish_status = #{publishStatus},</if> |
||||
|
<if test="removalReason != null">removal_reason = #{removalReason},</if> |
||||
|
<if test="createBy != null">create_by = #{createBy},</if> |
||||
|
<if test="createTime != null">create_time = #{createTime},</if> |
||||
|
<if test="updateBy != null">update_by = #{updateBy},</if> |
||||
|
<if test="updateTime != null">update_time = #{updateTime},</if> |
||||
|
<if test="remark != null">remark = #{remark},</if> |
||||
|
</trim> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<!-- 上架资讯 - 独立的更新方法 --> |
||||
|
<update id="publishSysInfoRelease" parameterType="SysInfoRelease"> |
||||
|
update sys_info_release |
||||
|
set publish_status = '1', |
||||
|
removal_reason = null, |
||||
|
update_time = #{updateTime} |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<!-- 下架资讯 - 独立的更新方法 --> |
||||
|
<update id="removeSysInfoRelease" parameterType="SysInfoRelease"> |
||||
|
update sys_info_release |
||||
|
set publish_status = '0', |
||||
|
<if test="removalReason != null"> |
||||
|
removal_reason = #{removalReason}, |
||||
|
</if> |
||||
|
<if test="removalReason == null"> |
||||
|
removal_reason = null, |
||||
|
</if> |
||||
|
update_time = #{updateTime} |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteSysInfoReleaseById" parameterType="Long"> |
||||
|
delete from sys_info_release where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteSysInfoReleaseByIds" parameterType="String"> |
||||
|
delete from sys_info_release where id in |
||||
|
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
</mapper> |
||||
@ -0,0 +1,61 @@ |
|||||
|
import request from '@/utils/request' |
||||
|
|
||||
|
// 查询资讯发布列表
|
||||
|
export function listInfoRelease(query) { |
||||
|
return request({ |
||||
|
url: '/system/infoRelease/list', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 查询资讯发布详细
|
||||
|
export function getInfoRelease(id) { |
||||
|
return request({ |
||||
|
url: '/system/infoRelease/' + id, |
||||
|
method: 'get' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 新增资讯发布
|
||||
|
export function addInfoRelease(data) { |
||||
|
return request({ |
||||
|
url: '/system/infoRelease', |
||||
|
method: 'post', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 修改资讯发布
|
||||
|
export function updateInfoRelease(data) { |
||||
|
return request({ |
||||
|
url: '/system/infoRelease', |
||||
|
method: 'put', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 删除资讯发布
|
||||
|
export function delInfoRelease(id) { |
||||
|
return request({ |
||||
|
url: '/system/infoRelease/' + id, |
||||
|
method: 'delete' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 上架资讯发布
|
||||
|
export function publishInfoRelease(id) { |
||||
|
return request({ |
||||
|
url: '/system/infoRelease/publish/' + id, |
||||
|
method: 'put' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 下架资讯发布
|
||||
|
export function removeInfoRelease(id, removalReason) { |
||||
|
return request({ |
||||
|
url: '/system/infoRelease/remove/' + id, |
||||
|
method: 'put', |
||||
|
data: removalReason |
||||
|
}) |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
<svg t="1768818902968" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5288" width="200" height="200"><path d="M814.08 122.88H192c-76.8 0-138.24 61.44-138.24 138.24v343.04c0 76.8 61.44 138.24 138.24 138.24h130.56c7.68 0 15.36 7.68 15.36 15.36l-15.36 130.56c-2.56 15.36 17.92 25.6 30.72 15.36l171.52-153.6c5.12-5.12 28.16-28.16 40.96-35.84l391.68-194.56v-256c-5.12-79.36-66.56-140.8-143.36-140.8zM512 529.92c-7.68 7.68-17.92 12.8-30.72 12.8H307.2c-23.04 0-40.96-17.92-40.96-40.96 0-10.24 5.12-23.04 12.8-30.72 7.68-7.68 17.92-12.8 30.72-12.8h174.08c23.04 0 40.96 17.92 40.96 40.96 0 12.8-5.12 23.04-12.8 30.72z m215.04-163.84c-7.68 7.68-17.92 12.8-30.72 12.8H309.76c-23.04 0-40.96-17.92-40.96-40.96 0-10.24 5.12-23.04 12.8-30.72 7.68-7.68 17.92-12.8 30.72-12.8h389.12c23.04 0 40.96 17.92 40.96 40.96-2.56 12.8-7.68 23.04-15.36 30.72z" fill="#6CAB86" p-id="5289"></path><path d="M972.8 552.96l-335.36 168.96c-12.8 7.68-12.8 20.48-2.56 25.6l79.36 51.2c7.68 5.12 15.36 2.56 20.48-2.56l176.64-161.28 7.68 2.56-161.28 171.52c-2.56 2.56-2.56 5.12-2.56 10.24v74.24c0 7.68 2.56 12.8 10.24 17.92 5.12 2.56 12.8 0 17.92-2.56l40.96-40.96 79.36 53.76c12.8 7.68 23.04 2.56 25.6-10.24l66.56-335.36c2.56-20.48-7.68-30.72-23.04-23.04z" fill="#6CAB86" p-id="5290"></path></svg> |
||||
@ -0,0 +1,441 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
||||
|
<el-form-item label="标题" prop="title"> |
||||
|
<el-input |
||||
|
v-model="queryParams.title" |
||||
|
placeholder="请输入标题" |
||||
|
clearable |
||||
|
@keyup.enter.native="handleQuery" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="分类" prop="category"> |
||||
|
<el-input |
||||
|
v-model="queryParams.category" |
||||
|
placeholder="请输入分类" |
||||
|
clearable |
||||
|
@keyup.enter.native="handleQuery" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="上架状态" prop="publishStatus"> |
||||
|
<el-select v-model="queryParams.publishStatus" placeholder="请选择上架状态" clearable> |
||||
|
<el-option |
||||
|
v-for="dict in dict.type.sys_publish_status" |
||||
|
:key="dict.value" |
||||
|
:label="dict.label" |
||||
|
:value="dict.value" |
||||
|
/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
|
||||
|
<el-row :gutter="10" class="mb8"> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="primary" |
||||
|
plain |
||||
|
icon="el-icon-plus" |
||||
|
size="mini" |
||||
|
@click="handleAdd" |
||||
|
v-hasPermi="['system:infoRelease:add']" |
||||
|
>新增</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="success" |
||||
|
plain |
||||
|
icon="el-icon-edit" |
||||
|
size="mini" |
||||
|
:disabled="single" |
||||
|
@click="handleUpdate" |
||||
|
v-hasPermi="['system:infoRelease:edit']" |
||||
|
>修改</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="danger" |
||||
|
plain |
||||
|
icon="el-icon-delete" |
||||
|
size="mini" |
||||
|
:disabled="multiple" |
||||
|
@click="handleDelete" |
||||
|
v-hasPermi="['system:infoRelease:remove']" |
||||
|
>删除</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="warning" |
||||
|
plain |
||||
|
icon="el-icon-download" |
||||
|
size="mini" |
||||
|
@click="handleExport" |
||||
|
v-hasPermi="['system:infoRelease:export']" |
||||
|
>导出</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="success" |
||||
|
plain |
||||
|
icon="el-icon-top" |
||||
|
size="mini" |
||||
|
:disabled="single" |
||||
|
@click="handlePublish" |
||||
|
v-hasPermi="['system:infoRelease:publish']" |
||||
|
>上架</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="warning" |
||||
|
plain |
||||
|
icon="el-icon-bottom" |
||||
|
size="mini" |
||||
|
:disabled="single" |
||||
|
@click="handleRemove" |
||||
|
v-hasPermi="['system:infoRelease:remove']" |
||||
|
>下架</el-button> |
||||
|
</el-col> |
||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
|
</el-row> |
||||
|
|
||||
|
<el-table v-loading="loading" :data="infoReleaseList" @selection-change="handleSelectionChange"> |
||||
|
<el-table-column type="selection" width="55" align="center" /> |
||||
|
<el-table-column label="主键" align="center" prop="id" /> |
||||
|
<el-table-column label="标题" align="center" prop="title" /> |
||||
|
<el-table-column label="内容" align="center" prop="content" :show-overflow-tooltip="true" /> |
||||
|
<el-table-column label="分类" align="center" prop="category" /> |
||||
|
<el-table-column label="上架状态" align="center" prop="publishStatus"> |
||||
|
<template slot-scope="scope"> |
||||
|
<dict-tag :options="dict.type.sys_publish_status" :value="scope.row.publishStatus"/> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="下架原因" align="center" prop="removalReason" :show-overflow-tooltip="true" /> |
||||
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> |
||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-button |
||||
|
size="mini" |
||||
|
type="text" |
||||
|
icon="el-icon-edit" |
||||
|
@click="handleUpdate(scope.row)" |
||||
|
v-hasPermi="['system:infoRelease:edit']" |
||||
|
>修改</el-button> |
||||
|
<el-button |
||||
|
size="mini" |
||||
|
type="text" |
||||
|
icon="el-icon-delete" |
||||
|
@click="handleDelete(scope.row)" |
||||
|
v-hasPermi="['system:infoRelease:remove']" |
||||
|
style="color: #F56C6C;" |
||||
|
>删除</el-button> |
||||
|
<el-button |
||||
|
size="mini" |
||||
|
type="text" |
||||
|
icon="el-icon-top" |
||||
|
@click="handlePublish(scope.row)" |
||||
|
v-if="scope.row.publishStatus === '0'" |
||||
|
v-hasPermi="['system:infoRelease:publish']" |
||||
|
style="color: #67C23A;" |
||||
|
>上架</el-button> |
||||
|
<el-button |
||||
|
size="mini" |
||||
|
type="text" |
||||
|
icon="el-icon-bottom" |
||||
|
@click="handleRemove(scope.row)" |
||||
|
v-if="scope.row.publishStatus === '1'" |
||||
|
v-hasPermi="['system:infoRelease:remove']" |
||||
|
style="color: #E6A23C;" |
||||
|
>下架</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<pagination |
||||
|
v-show="total>0" |
||||
|
:total="total" |
||||
|
:page.sync="queryParams.pageNum" |
||||
|
:limit.sync="queryParams.pageSize" |
||||
|
@pagination="getList" |
||||
|
/> |
||||
|
|
||||
|
<!-- 添加或修改资讯发布对话框 --> |
||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
|
<el-form-item label="标题" prop="title"> |
||||
|
<el-input v-model="form.title" placeholder="请输入标题" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="内容"> |
||||
|
<editor v-model="form.content" :min-height="192"/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="分类" prop="category"> |
||||
|
<el-input v-model="form.category" placeholder="请输入分类" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="上架状态" prop="publishStatus"> |
||||
|
<el-radio-group v-model="form.publishStatus"> |
||||
|
<el-radio |
||||
|
v-for="dict in dict.type.sys_publish_status" |
||||
|
:key="dict.value" |
||||
|
:label="dict.value" |
||||
|
>{{dict.label}}</el-radio> |
||||
|
</el-radio-group> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="备注" prop="remark"> |
||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<div slot="footer" class="dialog-footer"> |
||||
|
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
|
<el-button @click="cancel">取 消</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
|
||||
|
<!-- 下架原因对话框 --> |
||||
|
<el-dialog title="下架原因" :visible.sync="removeOpen" width="400px" append-to-body> |
||||
|
<el-form ref="removeForm" :model="removeForm" label-width="80px"> |
||||
|
<el-form-item label="下架原因"> |
||||
|
<el-input |
||||
|
v-model="removeForm.removalReason" |
||||
|
type="textarea" |
||||
|
:rows="4" |
||||
|
placeholder="请输入下架原因(选填)" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<div slot="footer" class="dialog-footer"> |
||||
|
<el-button type="primary" @click="submitRemove">确 定</el-button> |
||||
|
<el-button @click="cancelRemove">取 消</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { listInfoRelease, getInfoRelease, delInfoRelease, addInfoRelease, updateInfoRelease, publishInfoRelease, removeInfoRelease } from "@/api/system/infoRelease" |
||||
|
|
||||
|
export default { |
||||
|
name: "InfoRelease", |
||||
|
dicts: ['sys_publish_status'], |
||||
|
data() { |
||||
|
return { |
||||
|
// 遮罩层 |
||||
|
loading: true, |
||||
|
// 选中数组 |
||||
|
ids: [], |
||||
|
// 非单个禁用 |
||||
|
single: true, |
||||
|
// 非多个禁用 |
||||
|
multiple: true, |
||||
|
// 显示搜索条件 |
||||
|
showSearch: true, |
||||
|
// 总条数 |
||||
|
total: 0, |
||||
|
// 资讯发布表格数据 |
||||
|
infoReleaseList: [], |
||||
|
// 弹出层标题 |
||||
|
title: "", |
||||
|
// 是否显示弹出层 |
||||
|
open: false, |
||||
|
// 是否显示下架对话框 |
||||
|
removeOpen: false, |
||||
|
// 查询参数 |
||||
|
queryParams: { |
||||
|
pageNum: 1, |
||||
|
pageSize: 10, |
||||
|
title: null, |
||||
|
content: null, |
||||
|
category: null, |
||||
|
publishStatus: null, |
||||
|
}, |
||||
|
// 表单参数 |
||||
|
form: {}, |
||||
|
// 下架表单参数 |
||||
|
removeForm: { |
||||
|
id: null, |
||||
|
removalReason: null |
||||
|
}, |
||||
|
// 表单校验 |
||||
|
rules: { |
||||
|
title: [ |
||||
|
{ required: true, message: "标题不能为空", trigger: "blur" } |
||||
|
], |
||||
|
content: [ |
||||
|
{ required: true, message: "内容不能为空", trigger: "blur" } |
||||
|
], |
||||
|
category: [ |
||||
|
{ required: true, message: "分类不能为空", trigger: "blur" } |
||||
|
], |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
this.getList() |
||||
|
}, |
||||
|
methods: { |
||||
|
/** 查询资讯发布列表 */ |
||||
|
getList() { |
||||
|
this.loading = true |
||||
|
listInfoRelease(this.queryParams).then(response => { |
||||
|
this.infoReleaseList = response.rows |
||||
|
this.total = response.total |
||||
|
this.loading = false |
||||
|
}) |
||||
|
}, |
||||
|
// 取消按钮 |
||||
|
cancel() { |
||||
|
this.open = false |
||||
|
this.reset() |
||||
|
}, |
||||
|
// 取消下架 |
||||
|
cancelRemove() { |
||||
|
this.removeOpen = false |
||||
|
this.removeForm = { |
||||
|
id: null, |
||||
|
removalReason: null |
||||
|
} |
||||
|
}, |
||||
|
// 表单重置 |
||||
|
reset() { |
||||
|
this.form = { |
||||
|
id: null, |
||||
|
title: null, |
||||
|
content: null, |
||||
|
category: null, |
||||
|
publishStatus: null, |
||||
|
removalReason: null, |
||||
|
createBy: null, |
||||
|
createTime: null, |
||||
|
updateBy: null, |
||||
|
updateTime: null, |
||||
|
remark: null |
||||
|
} |
||||
|
this.resetForm("form") |
||||
|
}, |
||||
|
/** 搜索按钮操作 */ |
||||
|
handleQuery() { |
||||
|
this.queryParams.pageNum = 1 |
||||
|
this.getList() |
||||
|
}, |
||||
|
/** 重置按钮操作 */ |
||||
|
resetQuery() { |
||||
|
this.resetForm("queryForm") |
||||
|
this.handleQuery() |
||||
|
}, |
||||
|
// 多选框选中数据 |
||||
|
handleSelectionChange(selection) { |
||||
|
this.ids = selection.map(item => item.id) |
||||
|
this.single = selection.length!==1 |
||||
|
this.multiple = !selection.length |
||||
|
}, |
||||
|
/** 新增按钮操作 */ |
||||
|
handleAdd() { |
||||
|
this.reset() |
||||
|
this.open = true |
||||
|
this.title = "添加资讯发布" |
||||
|
}, |
||||
|
/** 修改按钮操作 */ |
||||
|
handleUpdate(row) { |
||||
|
this.reset() |
||||
|
const id = row.id || this.ids |
||||
|
getInfoRelease(id).then(response => { |
||||
|
this.form = response.data |
||||
|
this.open = true |
||||
|
this.title = "修改资讯发布" |
||||
|
}) |
||||
|
}, |
||||
|
/** 提交按钮 */ |
||||
|
submitForm() { |
||||
|
this.$refs["form"].validate(valid => { |
||||
|
if (valid) { |
||||
|
if (this.form.id != null) { |
||||
|
updateInfoRelease(this.form).then(response => { |
||||
|
this.$modal.msgSuccess("修改成功") |
||||
|
this.open = false |
||||
|
this.getList() |
||||
|
}) |
||||
|
} else { |
||||
|
addInfoRelease(this.form).then(response => { |
||||
|
this.$modal.msgSuccess("新增成功") |
||||
|
this.open = false |
||||
|
this.getList() |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
/** 上架按钮操作 */ |
||||
|
handlePublish(row) { |
||||
|
const id = row.id || this.ids[0] |
||||
|
this.$modal.confirm('是否确认上架资讯发布编号为"' + id + '"的数据项?').then(() => { |
||||
|
return publishInfoRelease(id) |
||||
|
}).then(() => { |
||||
|
this.getList() |
||||
|
this.$modal.msgSuccess("上架成功") |
||||
|
}).catch(() => {}) |
||||
|
}, |
||||
|
/** 下架按钮操作 */ |
||||
|
handleRemove(row) { |
||||
|
const id = row.id || this.ids[0] |
||||
|
this.removeForm.id = id |
||||
|
this.removeOpen = true |
||||
|
}, |
||||
|
/** 提交下架 */ |
||||
|
submitRemove() { |
||||
|
const { id, removalReason } = this.removeForm |
||||
|
this.$modal.confirm('是否确认下架资讯发布编号为"' + id + '"的数据项?').then(() => { |
||||
|
return removeInfoRelease(id, removalReason) |
||||
|
}).then(() => { |
||||
|
this.removeOpen = false |
||||
|
this.getList() |
||||
|
this.$modal.msgSuccess("下架成功") |
||||
|
this.removeForm = { |
||||
|
id: null, |
||||
|
removalReason: null |
||||
|
} |
||||
|
}).catch(() => {}) |
||||
|
}, |
||||
|
/** 删除按钮操作 */ |
||||
|
handleDelete(row) { |
||||
|
const ids = row.id || this.ids |
||||
|
this.$modal.confirm('是否确认删除资讯发布编号为"' + ids + '"的数据项?').then(function() { |
||||
|
return delInfoRelease(ids) |
||||
|
}).then(() => { |
||||
|
this.getList() |
||||
|
this.$modal.msgSuccess("删除成功") |
||||
|
}).catch(() => {}) |
||||
|
}, |
||||
|
/** 导出按钮操作 */ |
||||
|
handleExport() { |
||||
|
this.download('system/infoRelease/export', { |
||||
|
...this.queryParams |
||||
|
}, `infoRelease_${new Date().getTime()}.xlsx`) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
/* 可以添加额外的样式来美化按钮颜色 */ |
||||
|
.el-button--text { |
||||
|
font-size: 12px; |
||||
|
padding: 5px 8px; |
||||
|
} |
||||
|
|
||||
|
/* 如果需要更明显的颜色,可以使用更亮的颜色 */ |
||||
|
.el-button--text[style*="color: #67C23A"]:hover { |
||||
|
color: #85ce61 !important; |
||||
|
background-color: rgba(103, 194, 58, 0.1); |
||||
|
} |
||||
|
|
||||
|
.el-button--text[style*="color: #E6A23C"]:hover { |
||||
|
color: #ebb563 !important; |
||||
|
background-color: rgba(230, 162, 60, 0.1); |
||||
|
} |
||||
|
|
||||
|
.el-button--text[style*="color: #F56C6C"]:hover { |
||||
|
color: #f78989 !important; |
||||
|
background-color: rgba(245, 108, 108, 0.1); |
||||
|
} |
||||
|
</style> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue