Browse Source

王子文 特种设备 通知公告 置顶

wangggziwen 2 years ago
parent
commit
2279d380c0

+ 11 - 0
master/src/main/java/com/ruoyi/project/system/domain/SysNotice.java

@@ -32,6 +32,9 @@ public class SysNotice extends BaseEntity
 
 
     private Long userId;
     private Long userId;
 
 
+    /** 是否置顶(1是0否) */
+    private String isPinned;
+
     public Long getNoticeId()
     public Long getNoticeId()
     {
     {
         return noticeId;
         return noticeId;
@@ -92,6 +95,14 @@ public class SysNotice extends BaseEntity
         this.userId = userId;
         this.userId = userId;
     }
     }
 
 
+    public String getIsPinned() {
+        return isPinned;
+    }
+
+    public void setIsPinned(String isPinned) {
+        this.isPinned = isPinned;
+    }
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 7 - 4
master/src/main/resources/mybatis/system/SysNoticeMapper.xml

@@ -16,11 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime"     column="update_time"     />
         <result property="updateTime"     column="update_time"     />
         <result property="remark"         column="remark"          />
         <result property="remark"         column="remark"          />
         <result property="userId"         column="user_id"          />
         <result property="userId"         column="user_id"          />
+        <result property="isPinned"         column="is_pinned"          />
         <!--<result property="readFlag"       column="read_flag"       />-->
         <!--<result property="readFlag"       column="read_flag"       />-->
     </resultMap>
     </resultMap>
 
 
     <sql id="selectNoticeVo">
     <sql id="selectNoticeVo">
-        select d.notice_id, d.notice_title, d.notice_type, d.notice_content, d.status, d.create_by, d.create_time, d.update_by, d.update_time, d.remark
+        select d.notice_id, d.notice_title, d.notice_type, d.notice_content, d.status, d.create_by, d.create_time, d.update_by, d.update_time, d.remark, d.is_pinned
 		from sys_notice d
 		from sys_notice d
     </sql>
     </sql>
 
 
@@ -30,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     </select>
 
 
     <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
     <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
-        select n.user_id, d.notice_id, d.notice_title, d.notice_type, d.notice_content, d.status, d.create_by, d.create_time, d.update_by, d.update_time, d.remark
+        select n.user_id, d.notice_id, d.notice_title, d.notice_type, d.notice_content, d.status, d.create_by, d.create_time, d.update_by, d.update_time, d.remark, d.is_pinned
         from sys_notice d
         from sys_notice d
         LEFT JOIN SYS_USER_NOTICE n on d.NOTICE_ID = n.NOTICE_ID
         LEFT JOIN SYS_USER_NOTICE n on d.NOTICE_ID = n.NOTICE_ID
         <if test="userId != null and userId != ''">
         <if test="userId != null and userId != ''">
@@ -47,17 +48,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND d.create_by like concat(concat('%',#{createBy}),'%')
 				AND d.create_by like concat(concat('%',#{createBy}),'%')
 			</if>
 			</if>
 		</where>
 		</where>
-         order by n.user_id
+         order by n.user_id, d.IS_PINNED desc
     </select>
     </select>
 
 
     <select id="selectNoticeUnList" parameterType="SysNotice" resultMap="SysNoticeResult">
     <select id="selectNoticeUnList" parameterType="SysNotice" resultMap="SysNoticeResult">
-        select n.user_id, d.notice_id, d.notice_title, d.notice_type, d.notice_content, d.status, d.create_by, d.create_time, d.update_by, d.update_time, d.remark
+        select n.user_id, d.notice_id, d.notice_title, d.notice_type, d.notice_content, d.status, d.create_by, d.create_time, d.update_by, d.update_time, d.remark, d.is_pinned
         from sys_notice d
         from sys_notice d
         LEFT JOIN SYS_USER_NOTICE n on d.NOTICE_ID = n.NOTICE_ID
         LEFT JOIN SYS_USER_NOTICE n on d.NOTICE_ID = n.NOTICE_ID
         <if test="userId != null and userId != ''">
         <if test="userId != null and userId != ''">
             and n.USER_ID = #{userId}
             and n.USER_ID = #{userId}
         </if>
         </if>
         where n.user_id is null
         where n.user_id is null
+        order by d.IS_PINNED desc
     </select>
     </select>
 
 
     <insert id="insertNotice" parameterType="SysNotice">
     <insert id="insertNotice" parameterType="SysNotice">
@@ -93,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="noticeContent != null">notice_content = #{noticeContent}, </if>
             <if test="noticeContent != null">notice_content = #{noticeContent}, </if>
             <if test="status != null and status != ''">status = #{status}, </if>
             <if test="status != null and status != ''">status = #{status}, </if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+            <if test="isPinned != null and isPinned != ''">is_pinned = #{isPinned},</if>
  			update_time = sysdate
  			update_time = sysdate
         </set>
         </set>
         where notice_id = #{noticeId}
         where notice_id = #{noticeId}

+ 9 - 0
ui/src/lang/en.js

@@ -1752,4 +1752,13 @@ export default {
   周五:'Friday',
   周五:'Friday',
   周六:'Saturday',
   周六:'Saturday',
   '如果是多腔压力容器': 'If it is a multi chamber pressure vessel, the information and parameters of each pressure chamber shall be filled in separately, indicating which pressure chamber the information and parameters are filled in, and separated by "/".',
   '如果是多腔压力容器': 'If it is a multi chamber pressure vessel, the information and parameters of each pressure chamber shall be filled in separately, indicating which pressure chamber the information and parameters are filled in, and separated by "/".',
+  // 特种设备通知公告置顶
+  '置顶': 'Pin',
+  '已置顶': 'Pinned',
+  '取消置顶': 'Unpin',
+  '置顶成功': 'Pin success',
+  '取消置顶成功': 'Unpin success',
+  '是否置顶': 'Pinned',
+  '是否确认置顶公告编号为 ':'Whether to pin the announcement No.',
+  '是否确认取消置顶公告编号为 ':'Whether to unpin the announcement No.',
 }
 }

+ 46 - 2
ui/src/views/system/notice/index.vue

@@ -35,8 +35,6 @@
       </el-form-item>
       </el-form-item>
     </el-form>
     </el-form>
 
 
-
-
     <el-row :gutter="10" class="mb8">
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
       <el-col :span="1.5">
         <el-button
         <el-button
@@ -80,6 +78,7 @@
         :show-overflow-tooltip="true"
         :show-overflow-tooltip="true"
       >
       >
         <template slot-scope="scope">
         <template slot-scope="scope">
+          <el-tag type="success" v-if="scope.row.isPinned == 1">{{$t('已置顶')}}</el-tag>
          <i v-if="scope.row.userId == null" style="width:5px;height:5px;border-radius:50%;background-color:red;display: inline-block;margin-right: 2px;margin-bottom: 2px;"></i>{{scope.row.noticeTitle}}
          <i v-if="scope.row.userId == null" style="width:5px;height:5px;border-radius:50%;background-color:red;display: inline-block;margin-right: 2px;margin-bottom: 2px;"></i>{{scope.row.noticeTitle}}
         </template>
         </template>
       </el-table-column>
       </el-table-column>
@@ -106,6 +105,22 @@
 
 
       <el-table-column :label="$t('操作')" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
       <el-table-column :label="$t('操作')" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
         <template slot-scope="scope">
         <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-select"
+            @click="handlePin (scope.row)"
+            v-if="scope.row.isPinned == 0"
+            v-hasPermi="['system:notice:edit']"
+          >{{ $t('置顶') }}</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-select"
+            @click="handlePin (scope.row)"
+            v-if="scope.row.isPinned == 1"
+            v-hasPermi="['system:notice:edit']"
+          >{{ $t('取消置顶') }}</el-button>
           <el-button
           <el-button
             size="mini"
             size="mini"
             type="text"
             type="text"
@@ -444,6 +459,35 @@ export default {
     });
     });
   },
   },
   methods: {
   methods: {
+    /** 处理置顶 */
+    handlePin(row) {
+      let notice = row;
+      if (notice.isPinned == 0) {
+        this.$confirm(this.$t('是否确认置顶公告编号为 ')+ ' '+notice.noticeId+ this.$t(' 的数据项?'), this.$t('警告'), {
+          confirmButtonText: this.$t('确定'),
+          cancelButtonText: this.$t('取消'),
+          type: 'warning'
+        }).then(() => {
+          notice.isPinned = 1;
+          updateNotice(notice).then(() => {
+            this.msgSuccess(this.$t('置顶成功'));
+            this.getList();
+          });
+        })
+      } else {
+        this.$confirm(this.$t('是否确认取消置顶公告编号为 ')+ ' '+notice.noticeId+ this.$t(' 的数据项?'), this.$t('警告'), {
+          confirmButtonText: this.$t('确定'),
+          cancelButtonText: this.$t('取消'),
+          type: 'warning'
+        }).then(() => {
+          notice.isPinned = 0;
+          updateNotice(notice).then(() => {
+            this.msgSuccess(this.$t('取消置顶成功'));
+            this.getList();
+          });
+        })
+      }
+    },
 
 
     //查询公告是否已读
     //查询公告是否已读