Browse Source

+ 全局提示信息管理

chen.cheng 11 months ago
parent
commit
8661d93523

+ 104 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/CpsGlbMsgController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.system.controller;
+
+import java.util.List;
+import javax.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.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.CpsGlbMsg;
+import com.ruoyi.system.service.ICpsGlbMsgService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * cps_glb_msg 全局消息Controller
+ * 
+ * @author ruoyi
+ * @date 2024-08-14
+ */
+@RestController
+@RequestMapping("/cp/msg")
+public class CpsGlbMsgController extends BaseController
+{
+    @Autowired
+    private ICpsGlbMsgService cpsGlbMsgService;
+
+    /**
+     * 查询cps_glb_msg 全局消息列表
+     */
+    @PreAuthorize("@ss.hasPermi('cp:msg:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CpsGlbMsg cpsGlbMsg)
+    {
+        startPage();
+        List<CpsGlbMsg> list = cpsGlbMsgService.selectCpsGlbMsgList(cpsGlbMsg);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出cps_glb_msg 全局消息列表
+     */
+    @PreAuthorize("@ss.hasPermi('cp:msg:export')")
+    @Log(title = "cps_glb_msg 全局消息", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, CpsGlbMsg cpsGlbMsg)
+    {
+        List<CpsGlbMsg> list = cpsGlbMsgService.selectCpsGlbMsgList(cpsGlbMsg);
+        ExcelUtil<CpsGlbMsg> util = new ExcelUtil<CpsGlbMsg>(CpsGlbMsg.class);
+        util.exportExcel(response, list, "cps_glb_msg 全局消息数据");
+    }
+
+    /**
+     * 获取cps_glb_msg 全局消息详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('cp:msg:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(cpsGlbMsgService.selectCpsGlbMsgById(id));
+    }
+
+    /**
+     * 新增cps_glb_msg 全局消息
+     */
+    @PreAuthorize("@ss.hasPermi('cp:msg:add')")
+    @Log(title = "cps_glb_msg 全局消息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CpsGlbMsg cpsGlbMsg)
+    {
+        return toAjax(cpsGlbMsgService.insertCpsGlbMsg(cpsGlbMsg));
+    }
+
+    /**
+     * 修改cps_glb_msg 全局消息
+     */
+    @PreAuthorize("@ss.hasPermi('cp:msg:edit')")
+    @Log(title = "cps_glb_msg 全局消息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CpsGlbMsg cpsGlbMsg)
+    {
+        return toAjax(cpsGlbMsgService.updateCpsGlbMsg(cpsGlbMsg));
+    }
+
+    /**
+     * 删除cps_glb_msg 全局消息
+     */
+    @PreAuthorize("@ss.hasPermi('cp:msg:remove')")
+    @Log(title = "cps_glb_msg 全局消息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(cpsGlbMsgService.deleteCpsGlbMsgByIds(ids));
+    }
+}

+ 69 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/CpsGlbMsg.java

@@ -0,0 +1,69 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * cps_glb_msg 全局消息对象 cps_glb_msg
+ * 
+ * @author ruoyi
+ * @date 2024-08-14
+ */
+public class CpsGlbMsg extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long id;
+
+    /** uri */
+    @Excel(name = "uri")
+    private String uri;
+
+    /** msg */
+    @Excel(name = "msg")
+    private String msg;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setUri(String uri) 
+    {
+        this.uri = uri;
+    }
+
+    public String getUri() 
+    {
+        return uri;
+    }
+    public void setMsg(String msg) 
+    {
+        this.msg = msg;
+    }
+
+    public String getMsg() 
+    {
+        return msg;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("uri", getUri())
+            .append("msg", getMsg())
+            .append("updateTime", getUpdateTime())
+            .append("createTime", getCreateTime())
+            .append("createBy", getCreateBy())
+            .append("updateBy", getUpdateBy())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CpsGlbMsgMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.CpsGlbMsg;
+
+/**
+ * cps_glb_msg 全局消息Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-08-14
+ */
+public interface CpsGlbMsgMapper 
+{
+    /**
+     * 查询cps_glb_msg 全局消息
+     * 
+     * @param id cps_glb_msg 全局消息主键
+     * @return cps_glb_msg 全局消息
+     */
+    public CpsGlbMsg selectCpsGlbMsgById(Long id);
+
+    /**
+     * 查询cps_glb_msg 全局消息列表
+     * 
+     * @param cpsGlbMsg cps_glb_msg 全局消息
+     * @return cps_glb_msg 全局消息集合
+     */
+    public List<CpsGlbMsg> selectCpsGlbMsgList(CpsGlbMsg cpsGlbMsg);
+
+    /**
+     * 新增cps_glb_msg 全局消息
+     * 
+     * @param cpsGlbMsg cps_glb_msg 全局消息
+     * @return 结果
+     */
+    public int insertCpsGlbMsg(CpsGlbMsg cpsGlbMsg);
+
+    /**
+     * 修改cps_glb_msg 全局消息
+     * 
+     * @param cpsGlbMsg cps_glb_msg 全局消息
+     * @return 结果
+     */
+    public int updateCpsGlbMsg(CpsGlbMsg cpsGlbMsg);
+
+    /**
+     * 删除cps_glb_msg 全局消息
+     * 
+     * @param id cps_glb_msg 全局消息主键
+     * @return 结果
+     */
+    public int deleteCpsGlbMsgById(Long id);
+
+    /**
+     * 批量删除cps_glb_msg 全局消息
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteCpsGlbMsgByIds(Long[] ids);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ICpsGlbMsgService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.CpsGlbMsg;
+
+/**
+ * cps_glb_msg 全局消息Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-08-14
+ */
+public interface ICpsGlbMsgService 
+{
+    /**
+     * 查询cps_glb_msg 全局消息
+     * 
+     * @param id cps_glb_msg 全局消息主键
+     * @return cps_glb_msg 全局消息
+     */
+    public CpsGlbMsg selectCpsGlbMsgById(Long id);
+
+    /**
+     * 查询cps_glb_msg 全局消息列表
+     * 
+     * @param cpsGlbMsg cps_glb_msg 全局消息
+     * @return cps_glb_msg 全局消息集合
+     */
+    public List<CpsGlbMsg> selectCpsGlbMsgList(CpsGlbMsg cpsGlbMsg);
+
+    /**
+     * 新增cps_glb_msg 全局消息
+     * 
+     * @param cpsGlbMsg cps_glb_msg 全局消息
+     * @return 结果
+     */
+    public int insertCpsGlbMsg(CpsGlbMsg cpsGlbMsg);
+
+    /**
+     * 修改cps_glb_msg 全局消息
+     * 
+     * @param cpsGlbMsg cps_glb_msg 全局消息
+     * @return 结果
+     */
+    public int updateCpsGlbMsg(CpsGlbMsg cpsGlbMsg);
+
+    /**
+     * 批量删除cps_glb_msg 全局消息
+     * 
+     * @param ids 需要删除的cps_glb_msg 全局消息主键集合
+     * @return 结果
+     */
+    public int deleteCpsGlbMsgByIds(Long[] ids);
+
+    /**
+     * 删除cps_glb_msg 全局消息信息
+     * 
+     * @param id cps_glb_msg 全局消息主键
+     * @return 结果
+     */
+    public int deleteCpsGlbMsgById(Long id);
+}

+ 96 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CpsGlbMsgServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.CpsGlbMsgMapper;
+import com.ruoyi.system.domain.CpsGlbMsg;
+import com.ruoyi.system.service.ICpsGlbMsgService;
+
+/**
+ * cps_glb_msg 全局消息Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-08-14
+ */
+@Service
+public class CpsGlbMsgServiceImpl implements ICpsGlbMsgService 
+{
+    @Autowired
+    private CpsGlbMsgMapper cpsGlbMsgMapper;
+
+    /**
+     * 查询cps_glb_msg 全局消息
+     * 
+     * @param id cps_glb_msg 全局消息主键
+     * @return cps_glb_msg 全局消息
+     */
+    @Override
+    public CpsGlbMsg selectCpsGlbMsgById(Long id)
+    {
+        return cpsGlbMsgMapper.selectCpsGlbMsgById(id);
+    }
+
+    /**
+     * 查询cps_glb_msg 全局消息列表
+     * 
+     * @param cpsGlbMsg cps_glb_msg 全局消息
+     * @return cps_glb_msg 全局消息
+     */
+    @Override
+    public List<CpsGlbMsg> selectCpsGlbMsgList(CpsGlbMsg cpsGlbMsg)
+    {
+        return cpsGlbMsgMapper.selectCpsGlbMsgList(cpsGlbMsg);
+    }
+
+    /**
+     * 新增cps_glb_msg 全局消息
+     * 
+     * @param cpsGlbMsg cps_glb_msg 全局消息
+     * @return 结果
+     */
+    @Override
+    public int insertCpsGlbMsg(CpsGlbMsg cpsGlbMsg)
+    {
+        cpsGlbMsg.setCreateTime(DateUtils.getNowDate());
+        return cpsGlbMsgMapper.insertCpsGlbMsg(cpsGlbMsg);
+    }
+
+    /**
+     * 修改cps_glb_msg 全局消息
+     * 
+     * @param cpsGlbMsg cps_glb_msg 全局消息
+     * @return 结果
+     */
+    @Override
+    public int updateCpsGlbMsg(CpsGlbMsg cpsGlbMsg)
+    {
+        cpsGlbMsg.setUpdateTime(DateUtils.getNowDate());
+        return cpsGlbMsgMapper.updateCpsGlbMsg(cpsGlbMsg);
+    }
+
+    /**
+     * 批量删除cps_glb_msg 全局消息
+     * 
+     * @param ids 需要删除的cps_glb_msg 全局消息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCpsGlbMsgByIds(Long[] ids)
+    {
+        return cpsGlbMsgMapper.deleteCpsGlbMsgByIds(ids);
+    }
+
+    /**
+     * 删除cps_glb_msg 全局消息信息
+     * 
+     * @param id cps_glb_msg 全局消息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCpsGlbMsgById(Long id)
+    {
+        return cpsGlbMsgMapper.deleteCpsGlbMsgById(id);
+    }
+}

+ 76 - 0
ruoyi-system/src/main/resources/mapper/cp/CpsGlbMsgMapper.xml

@@ -0,0 +1,76 @@
+<?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.ruoyi.system.mapper.CpsGlbMsgMapper">
+
+    <resultMap type="com.ruoyi.system.domain.CpsGlbMsg" id="CpsGlbMsgResult">
+        <result property="id"    column="id"    />
+        <result property="uri"    column="uri"    />
+        <result property="msg"    column="msg"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="updateBy"    column="update_by"    />
+    </resultMap>
+
+    <sql id="selectCpsGlbMsgVo">
+        select id, uri, msg, update_time, create_time, create_by, update_by from cps_glb_msg
+    </sql>
+
+    <select id="selectCpsGlbMsgList" parameterType="com.ruoyi.system.domain.CpsGlbMsg" resultMap="CpsGlbMsgResult">
+        <include refid="selectCpsGlbMsgVo"/>
+        <where>
+            <if test="msg != null  and msg != ''"> and msg like concat('%', #{msg}, '%')</if>
+        </where>
+    </select>
+
+    <select id="selectCpsGlbMsgById" parameterType="Long" resultMap="CpsGlbMsgResult">
+        <include refid="selectCpsGlbMsgVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertCpsGlbMsg" parameterType="com.ruoyi.system.domain.CpsGlbMsg" useGeneratedKeys="true" keyProperty="id">
+        insert into cps_glb_msg
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="uri != null">uri,</if>
+            <if test="msg != null and msg != ''">msg,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateBy != null">update_by,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="uri != null">#{uri},</if>
+            <if test="msg != null and msg != ''">#{msg},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCpsGlbMsg" parameterType="com.ruoyi.system.domain.CpsGlbMsg">
+        update cps_glb_msg
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="uri != null">uri = #{uri},</if>
+            <if test="msg != null and msg != ''">msg = #{msg},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCpsGlbMsgById" parameterType="Long">
+        delete from cps_glb_msg where id = #{id}
+    </delete>
+
+    <delete id="deleteCpsGlbMsgByIds" parameterType="String">
+        delete from cps_glb_msg where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 44 - 0
ruoyi-ui/src/api/cp/msg.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询cps_glb_msg 全局消息列表
+export function listMsg(query) {
+  return request({
+    url: '/cp/msg/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询cps_glb_msg 全局消息详细
+export function getMsg(id) {
+  return request({
+    url: '/cp/msg/' + id,
+    method: 'get'
+  })
+}
+
+// 新增cps_glb_msg 全局消息
+export function addMsg(data) {
+  return request({
+    url: '/cp/msg',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改cps_glb_msg 全局消息
+export function updateMsg(data) {
+  return request({
+    url: '/cp/msg',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除cps_glb_msg 全局消息
+export function delMsg(id) {
+  return request({
+    url: '/cp/msg/' + id,
+    method: 'delete'
+  })
+}

+ 257 - 0
ruoyi-ui/src/views/cp/msg/index.vue

@@ -0,0 +1,257 @@
+<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="msg" prop="msg">
+        <el-input
+          v-model="queryParams.msg"
+          placeholder="请输入msg"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </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="['cp:msg: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="['cp:msg: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="['cp:msg: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="['cp:msg:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="msgList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="主键" align="center" prop="id" />
+      <el-table-column label="uri" align="center" prop="uri" />
+      <el-table-column label="msg" align="center" prop="msg" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['cp:msg:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['cp:msg:remove']"
+          >删除</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"
+    />
+
+    <!-- 添加或修改cps_glb_msg 全局消息对话框 -->
+    <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="uri" prop="uri">
+          <el-input v-model="form.uri" placeholder="请输入uri" />
+        </el-form-item>
+        <el-form-item label="msg" prop="msg">
+          <el-input v-model="form.msg" placeholder="请输入msg" />
+        </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>
+  </div>
+</template>
+
+<script>
+import { listMsg, getMsg, delMsg, addMsg, updateMsg } from "@/api/cp/msg";
+
+export default {
+  name: "Msg",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // cps_glb_msg 全局消息表格数据
+      msgList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        msg: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        msg: [
+          { required: true, message: "msg不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询cps_glb_msg 全局消息列表 */
+    getList() {
+      this.loading = true;
+      listMsg(this.queryParams).then(response => {
+        this.msgList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        uri: null,
+        msg: null,
+        updateTime: null,
+        createTime: null,
+        createBy: null,
+        updateBy: 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 = "添加cps_glb_msg 全局消息";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getMsg(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改cps_glb_msg 全局消息";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateMsg(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addMsg(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认删除cps_glb_msg 全局消息编号为"' + ids + '"的数据项?').then(function() {
+        return delMsg(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('cp/msg/export', {
+        ...this.queryParams
+      }, `msg_${new Date().getTime()}.xlsx`)
+    }
+  }
+};
+</script>