소스 검색

做了公告列表

dingxin 6 년 전
부모
커밋
f51e025a3d

+ 4
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TpAnnouncementMapper.java 파일 보기

@@ -9,12 +9,12 @@ import org.apache.ibatis.annotations.Mapper;
9 9
 import org.apache.ibatis.annotations.Param;
10 10
 
11 11
 import java.util.List;
12
+import java.util.Map;
12 13
 
13 14
 @Mapper
14 15
 public interface TpAnnouncementMapper extends BaseMapper<TpAnnouncement> {
15 16
     int deleteByPrimaryKey(Integer id);
16 17
 
17
-    @Override
18 18
     int insert(TpAnnouncement record);
19 19
 
20 20
     int insertSelective(TpAnnouncement record);
@@ -25,7 +25,9 @@ public interface TpAnnouncementMapper extends BaseMapper<TpAnnouncement> {
25 25
 
26 26
     int updateByPrimaryKey(TpAnnouncement record);
27 27
 
28
-    IPage<TpAnnouncement> getAnnouncements(Page page ,@Param("communityId") Integer communityId);
28
+    IPage<TpAnnouncement> getAnnouncements(Page page ,@Param("record")TpAnnouncement record);
29
+
30
+    List<TpAnnouncement> getById( @Param("record")TpAnnouncement record);
29 31
 
30 32
     /**
31 33
      * 公告轮播图

+ 2
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/UserMapper.java 파일 보기

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.community.huiju.model.TaUser;
5 5
 import com.community.huiju.model.User;
6 6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
7 8
 
8 9
 /**
9 10
  * <p>
@@ -15,5 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
15 16
  */
16 17
 @Mapper
17 18
 public interface UserMapper extends BaseMapper<User> {
19
+    String selectByIdCreateUserName(@Param("id") Integer id);
18 20
 
19 21
 }

+ 2
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpAnnouncement.java 파일 보기

@@ -42,13 +42,13 @@ public class TpAnnouncement implements Serializable {
42 42
     /**0 是已作废 1 是已发布   2 是草稿 3 是已修改**/
43 43
     private String status;
44 44
 
45
-    /**创建人**/
45
+    /**创建人编号**/
46 46
     private Integer createUser;
47 47
 
48 48
     /**创建时间**/
49 49
     private Date createDate;
50 50
 
51
-    /**更新人**/
51
+    /**更新人编号**/
52 52
     private Integer updateUser;
53 53
 
54 54
     /**更新时间**/

+ 32
- 5
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpAnnouncementServiceImpl.java 파일 보기

@@ -1,21 +1,28 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 8
 import com.community.commom.mode.ResponseBean;
8 9
 import com.community.huiju.dao.TpAnnouncementMapper;
10
+import com.community.huiju.dao.UserMapper;
9 11
 import com.community.huiju.model.TpAnnouncement;
10 12
 import com.community.huiju.model.TpBuildingOwnerInfo;
13
+import com.community.huiju.model.User;
11 14
 import com.community.huiju.service.TpAnnouncementService;
15
+import com.community.huiju.vo.AnnouncementTable;
12 16
 import com.google.common.collect.Maps;
13 17
 import lombok.extern.slf4j.Slf4j;
18
+import org.springframework.beans.BeanUtils;
14 19
 import org.springframework.beans.factory.annotation.Autowired;
15 20
 import org.springframework.stereotype.Service;
21
+import org.springframework.transaction.annotation.Transactional;
16 22
 
17 23
 import java.util.List;
18 24
 import java.util.Map;
25
+import java.util.stream.Collectors;
19 26
 
20 27
 /**
21 28
  * version V1.0
@@ -26,11 +33,15 @@ import java.util.Map;
26 33
  * creat_time: 2018/12/28
27 34
  **/
28 35
 @Slf4j
36
+@Transactional
29 37
 @Service
30 38
 public class TpAnnouncementServiceImpl extends ServiceImpl<TpAnnouncementMapper, TpAnnouncement> implements TpAnnouncementService {
31 39
 
32 40
 @Autowired
33 41
 private  TpAnnouncementMapper tpAnnouncementMapper;
42
+
43
+    @Autowired
44
+    private UserMapper userMapper;
34 45
     @Override
35 46
     public ResponseBean tpAnnouncemenList(String paramets, Integer CommunityId) {
36 47
         ResponseBean responseBean = new ResponseBean();
@@ -39,19 +50,35 @@ private  TpAnnouncementMapper tpAnnouncementMapper;
39 50
         tpAnnouncement.setCommunityId(CommunityId);
40 51
         JSONObject jsonobject = JSONObject.parseObject(paramets);
41 52
         Integer pageNum = jsonobject.getInteger("pageNum");
53
+        Integer announcementNumber = jsonobject.getInteger("announcementNumber");
42 54
         Integer pageSize = jsonobject.getInteger("pageSize");
55
+        tpAnnouncement.setId(announcementNumber);
43 56
         // 分页
44 57
         Page<TpBuildingOwnerInfo> page = new Page<>();
45 58
         page.setSize(pageSize == null ? 10 : pageSize);
46 59
         page.setCurrent(pageNum == null ? 1 : pageNum);
60
+        // page.setDesc("sort", "create_date");
61
+
62
+        IPage<TpAnnouncement> pageInfo = tpAnnouncementMapper.getAnnouncements(page,tpAnnouncement);
63
+        List<TpAnnouncement> tpAnnouncementList = pageInfo.getRecords();
47 64
 
48
-        IPage<TpAnnouncement> tpAnnouncementList= tpAnnouncementMapper.getAnnouncements(page,CommunityId);
65
+        List<AnnouncementTable> tableList = tpAnnouncementList.stream().map(e->{
66
+            AnnouncementTable announcementTable = new AnnouncementTable();
67
+            BeanUtils.copyProperties(e, announcementTable);
68
+            //创建人
69
+            String createUserName = userMapper.selectByIdCreateUserName(e.getUpdateUser());
70
+            //修改人
71
+            String updateDateName = userMapper.selectByIdCreateUserName(e.getCreateUser());
72
+            announcementTable.setCreateUserName(createUserName);
73
+            announcementTable.setUpdateDateName(updateDateName);
74
+            return announcementTable;
75
+        }).collect(Collectors.toList());
49 76
 
50 77
         Map<String, Object> map = Maps.newHashMap();
51
-        map.put("list", tpAnnouncementList.getRecords());
52
-        map.put("total", tpAnnouncementList.getTotal());
53
-        map.put("pageNum", tpAnnouncementList.getCurrent());
54
-        map.put("pageSize", tpAnnouncementList.getSize());
78
+        map.put("list", tableList);
79
+        map.put("total", pageInfo.getTotal());
80
+        map.put("pageNum", pageInfo.getCurrent());
81
+        map.put("pageSize", pageInfo.getSize());
55 82
         responseBean.addSuccess(map);
56 83
         return responseBean;
57 84
     }

+ 21
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/vo/AnnouncementTable.java 파일 보기

@@ -0,0 +1,21 @@
1
+package com.community.huiju.vo;
2
+
3
+import com.community.huiju.model.TpAnnouncement;
4
+import lombok.Data;
5
+
6
+/**
7
+ * version V1.0
8
+ * class_name: $METHOD_NAME$
9
+ * param: $METHOD_PARAM$
10
+ * describe: TODO
11
+ * creat_user:fannaixi
12
+ * creat_time: 2018/12/29
13
+ **/
14
+@Data
15
+public class AnnouncementTable extends TpAnnouncement {
16
+    /**创建人**/
17
+    private String createUserName;
18
+
19
+    /**修改人**/
20
+    private String updateDateName;
21
+}

+ 23
- 159
CODE/smart-community/property-api/src/main/resources/mapper/TpAnnouncementMapper.xml 파일 보기

@@ -1,172 +1,36 @@
1 1
 <?xml version="1.0" encoding="UTF-8" ?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 3
 <mapper namespace="com.community.huiju.dao.TpAnnouncementMapper" >
4
-  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpAnnouncement" >
5
-    <id column="id" property="id" jdbcType="INTEGER" />
6
-    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
-    <result column="announcement_title" property="announcementTitle" jdbcType="VARCHAR" />
8
-    <result column="announcement_carousel_img" property="announcementCarouselImg" jdbcType="VARCHAR" />
9
-    <result column="announcement_content" property="announcementContent" jdbcType="VARCHAR" />
10
-    <result column="user_name" property="userName" jdbcType="VARCHAR" />
11
-    <result column="sort" property="sort" jdbcType="INTEGER" />
12
-    <result column="view_count" property="viewCount" jdbcType="INTEGER" />
13
-    <result column="set_up_carousel" property="setUpCarousel" jdbcType="CHAR" />
14
-    <result column="status" property="status" jdbcType="CHAR" />
15
-    <result column="create_user" property="createUser" jdbcType="INTEGER" />
16
-    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
17
-    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
18
-    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
19
-  </resultMap>
20 4
   <sql id="Base_Column_List" >
21 5
     id, community_id, announcement_title, announcement_carousel_img, announcement_content,
22 6
     sort, view_count, set_up_carousel, status, create_user, create_date, update_user,
23 7
     update_date
24 8
   </sql>
25
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap">
26
-    select
27
-    <include refid="Base_Column_List" />
28
-    from tp_announcement
29
-    where id = #{id,jdbcType=INTEGER} and community_id = #{communityId,jdbcType=INTEGER}
30
-  </select>
31
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
32
-    delete from tp_announcement
33
-    where id = #{id,jdbcType=INTEGER}
34
-  </delete>
35
-  <insert id="insert" parameterType="com.community.huiju.model.TpAnnouncement" >
36
-    insert into tp_announcement (id, community_id, announcement_title,
37
-      announcement_carousel_img, announcement_content,
38
-      sort, view_count, set_up_carousel,
39
-      status, create_user, create_date,
40
-      update_user, update_date)
41
-    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{announcementTitle,jdbcType=VARCHAR},
42
-      #{announcementCarouselImg,jdbcType=VARCHAR}, #{announcementContent,jdbcType=VARCHAR},
43
-      #{sort,jdbcType=INTEGER}, #{viewCount,jdbcType=INTEGER}, #{setUpCarousel,jdbcType=CHAR},
44
-      #{status,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP},
45
-      #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
46
-  </insert>
47
-  <insert id="insertSelective" parameterType="com.community.huiju.model.TpAnnouncement" >
48
-    insert into tp_announcement
49
-    <trim prefix="(" suffix=")" suffixOverrides="," >
50
-      <if test="id != null" >
51
-        id,
52
-      </if>
53
-      <if test="communityId != null" >
54
-        community_id,
55
-      </if>
56
-      <if test="announcementTitle != null" >
57
-        announcement_title,
58
-      </if>
59
-      <if test="announcementCarouselImg != null" >
60
-        announcement_carousel_img,
61
-      </if>
62
-      <if test="announcementContent != null" >
63
-        announcement_content,
64
-      </if>
65
-      <if test="sort != null" >
66
-        sort,
67
-      </if>
68
-      <if test="viewCount != null" >
69
-        view_count,
70
-      </if>
71
-      <if test="setUpCarousel != null" >
72
-        set_up_carousel,
73
-      </if>
74
-      <if test="status != null" >
75
-        status,
76
-      </if>
77
-      <if test="createUser != null" >
78
-        create_user,
79
-      </if>
80
-      <if test="createDate != null" >
81
-        create_date,
82
-      </if>
83
-      <if test="updateUser != null" >
84
-        update_user,
85
-      </if>
86
-      <if test="updateDate != null" >
87
-        update_date,
88
-      </if>
89
-    </trim>
90
-    <trim prefix="values (" suffix=")" suffixOverrides="," >
91
-      <if test="id != null" >
92
-        #{id,jdbcType=INTEGER},
93
-      </if>
94
-      <if test="communityId != null" >
95
-        #{communityId,jdbcType=INTEGER},
96
-      </if>
97
-      <if test="announcementTitle != null" >
98
-        #{announcementTitle,jdbcType=VARCHAR},
99
-      </if>
100
-      <if test="announcementCarouselImg != null" >
101
-        #{announcementCarouselImg,jdbcType=VARCHAR},
102
-      </if>
103
-      <if test="announcementContent != null" >
104
-        #{announcementContent,jdbcType=VARCHAR},
105
-      </if>
106
-      <if test="sort != null" >
107
-        #{sort,jdbcType=INTEGER},
108
-      </if>
109
-      <if test="viewCount != null" >
110
-        #{viewCount,jdbcType=INTEGER},
111
-      </if>
112
-      <if test="setUpCarousel != null" >
113
-        #{setUpCarousel,jdbcType=CHAR},
114
-      </if>
115
-      <if test="status != null" >
116
-        #{status,jdbcType=CHAR},
117
-      </if>
118
-      <if test="createUser != null" >
119
-        #{createUser,jdbcType=INTEGER},
120
-      </if>
121
-      <if test="createDate != null" >
122
-        #{createDate,jdbcType=TIMESTAMP},
123
-      </if>
124
-      <if test="updateUser != null" >
125
-        #{updateUser,jdbcType=INTEGER},
126
-      </if>
127
-      <if test="updateDate != null" >
128
-        #{updateDate,jdbcType=TIMESTAMP},
129
-      </if>
130
-    </trim>
131
-  </insert>
132
-  <update id="updateByPrimaryKeySelective" >
133
-    update tp_announcement
134
-    <set >
135
-      <if test="viewCount != null" >
136
-        view_count = #{viewCount,jdbcType=INTEGER},
137
-      </if>
138
-    </set>
139
-    where id = #{id,jdbcType=INTEGER}
140
-  </update>
141
-  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpAnnouncement" >
142
-    update tp_announcement
143
-    set community_id = #{communityId,jdbcType=INTEGER},
144
-      announcement_title = #{announcementTitle,jdbcType=VARCHAR},
145
-      announcement_carousel_img = #{announcementCarouselImg,jdbcType=VARCHAR},
146
-      announcement_content = #{announcementContent,jdbcType=VARCHAR},
147
-      sort = #{sort,jdbcType=INTEGER},
148
-      view_count = #{viewCount,jdbcType=INTEGER},
149
-      set_up_carousel = #{setUpCarousel,jdbcType=CHAR},
150
-      status = #{status,jdbcType=CHAR},
151
-      create_user = #{createUser,jdbcType=INTEGER},
152
-      create_date = #{createDate,jdbcType=TIMESTAMP},
153
-      update_user = #{updateUser,jdbcType=INTEGER},
154
-      update_date = #{updateDate,jdbcType=TIMESTAMP}
155
-    where id = #{id,jdbcType=INTEGER}
156
-  </update>
157
-
158
-  <select id="getAnnouncements" resultType="com.community.huiju.model.TpAnnouncement" parameterType="map">
9
+  <select id="getAnnouncements" resultType="com.community.huiju.model.TpAnnouncement">
159 10
     SELECT
160
-    <include refid="Base_Column_List" />
11
+    id, community_id, announcement_title, announcement_carousel_img, announcement_content,
12
+    sort, view_count, set_up_carousel, status, create_user, create_date, update_user,
13
+    update_date
161 14
    FROM
162
-      tp_announcement WHERE  community_id = #{communityId,jdbcType=INTEGER}
163
-
15
+      tp_announcement
16
+      <where>
17
+        <if test="record.id != null and record.id != ''" >
18
+          AND id =  #{record.id,jdbcType=INTEGER}
19
+        </if>
20
+        <if test="record.announcementTitle != null and record.announcementTitle != ''" >
21
+          AND announcement_title like concat('%',#{record.announcementTitle,jdbcType=VARCHAR},'%')
22
+        </if>
23
+          AND community_id = #{record.communityId,jdbcType=INTEGER}
24
+      </where>
164 25
   </select>
165
-
166
-  <select id="getAnnouncement" resultMap="BaseResultMap" parameterType="com.community.huiju.model.TpAnnouncement">
167
-    select
168
-    <include refid="Base_Column_List" />
169
-    from tp_announcement
170
-    where community_id = #{communityId,jdbcType=INTEGER}  and status=1  order by create_date DESC limit  #{sum,jdbcType=INTEGER}
26
+  <select id="getById" resultType="com.community.huiju.model.TpAnnouncement">
27
+    SELECT
28
+    id, community_id, announcement_title, announcement_carousel_img, announcement_content,
29
+    sort, view_count, set_up_carousel, status, create_user, create_date, update_user,
30
+    update_date
31
+    FROM
32
+    tp_announcement
33
+    WHERE community_id = #{record.communityId,jdbcType=INTEGER}
171 34
   </select>
35
+
172 36
 </mapper>

+ 7
- 0
CODE/smart-community/property-api/src/main/resources/mapper/UserMapper.xml 파일 보기

@@ -1,5 +1,12 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.community.huiju.dao.UserMapper">
4
+    <select id="selectByIdCreateUserName" parameterType="int" resultType="string">
5
+        SELECT
6
+         user_name
7
+        FROM
8
+        tp_user
9
+        WHERE id=#{id,jdbcType=INTEGER}
10
+    </select>
4 11
 
5 12
 </mapper>

+ 16
- 0
VUECODE/smart-property-manage/src/api/announcement.js 파일 보기

@@ -0,0 +1,16 @@
1
+import request from '@/utils/request'
2
+
3
+// 获取当前小区的所有公告
4
+export function listAnnouncement(data) {
5
+  return request({
6
+    url: '/tpAnnouncement',
7
+    method: 'post',
8
+    data: {
9
+      announcementNumber: data.announcementNumber,
10
+      announcementTitle: data.announcementTitle,
11
+      pageNum: data.pageNum,
12
+      pageSize: data.pageSize
13
+    }
14
+  })
15
+}
16
+

+ 3
- 1
VUECODE/smart-property-manage/src/store/index.js 파일 보기

@@ -7,6 +7,7 @@ import community from './modules/community'
7 7
 import trunkIndex from './modules/trunkIndex'
8 8
 import batchImport from './modules/batchImport'
9 9
 import getters from './getters'
10
+import announcement from './modules/announcement'
10 11
 import buildingOwnerInfo from './modules/buildingOwnerInfo'
11 12
 
12 13
 Vue.use(Vuex)
@@ -19,7 +20,8 @@ const store = new Vuex.Store({
19 20
     banner,
20 21
     trunkIndex,
21 22
     batchImport,
22
-    buildingOwnerInfo
23
+    buildingOwnerInfo,
24
+    announcement
23 25
   },
24 26
   getters
25 27
 })

+ 20
- 0
VUECODE/smart-property-manage/src/store/modules/announcement.js 파일 보기

@@ -0,0 +1,20 @@
1
+import { listAnnouncement } from '@/api/announcement'
2
+
3
+const announcement = {
4
+  actions: {
5
+    /**
6
+     *获取当前小区的所有公告
7
+     */
8
+    ListAnnouncement({ commit }, data) {
9
+      return new Promise((resolve, reject) => {
10
+        listAnnouncement(data).then(response => {
11
+          resolve(response)
12
+        }).catch(error => {
13
+          reject(error)
14
+        })
15
+      })
16
+    }
17
+  }
18
+}
19
+
20
+export default announcement

+ 3
- 3
VUECODE/smart-property-manage/src/views/owner/index.vue 파일 보기

@@ -143,7 +143,7 @@ export default {
143 143
     handleSelectionChange(data) {
144 144
 
145 145
     },
146
-	search(){
146
+	  search() {
147 147
       this.listQuery.pageNum = 1
148 148
       this.dataQuery()
149 149
     },
@@ -151,8 +151,8 @@ export default {
151 151
       this.listQuery.pageNum = 1
152 152
       this.listQuery.pageSize = 10
153 153
       this.listQuery.ownerName = ''
154
-      this.listQuery.ownerTel = ''
155
-	  this.listQuery.verifyStatus= ''
154
+      this.listQuery.ownerTel =''
155
+	  this.listQuery.verifyStatus=''
156 156
       this.dataQuery()
157 157
     },
158 158
     open3(ownerTel, verifyStatus) {

+ 165
- 3
VUECODE/smart-property-manage/src/views/social/announcement/index.vue 파일 보기

@@ -1,13 +1,175 @@
1 1
 
2 2
 <template>
3
-  <div>公告</div>
3
+  <div class="root">
4
+    <el-form :inline="true" :model="listQuery" class="form-listQuery">
5
+      <el-form-item class="filter-item" label="公告编号">
6
+        <el-input v-model.trim="listQuery.announcementNumber" onkeyup="this.value=this.value.replace(/\D/g,'')" placeholder="公告编号" />
7
+      </el-form-item>
8
+      <el-form-item class="filter-item" label="公告标题" >
9
+        <el-input v-model.trim="listQuery.announcementTitle" placeholder="公告标题" />
10
+      </el-form-item>
11
+      <el-form-item>
12
+        <el-button type="info" class="filter-item" @click="handleFilter">清空</el-button>
13
+        <el-button type="primary" @click="search">查询</el-button>
14
+      </el-form-item>
15
+    </el-form>
16
+    <div class="button">
17
+      <el-button type="primary">添加</el-button>
18
+      <el-button type="warning">修改</el-button>
19
+      <el-button type="danger">作废</el-button>
20
+    </div>
21
+    <el-table
22
+      v-loading="listLoading"
23
+      ref="multipleTable"
24
+      :data="listAnnouncement"
25
+      border
26
+      tooltip-effect="dark"
27
+      style="width: 100%; margin-top: 20px;"
28
+      @selection-change="handleSelectionChange">
29
+      <el-table-column
30
+        type="selection"
31
+        width="55"/>
32
+      <el-table-column prop="id" label="编号" align="center"/>
33
+      <el-table-column prop="announcementTitle" label="标题" align="center" />
34
+      <el-table-column prop="viewCount" label="查看数量" align="center"/>
35
+      <el-table-column prop="sort" label="权重" align="center"/>
36
+      <el-table-column prop="status" label="状态" align="center"/>
37
+      <el-table-column prop="createDate" label="发布时间" align="center"/>
38
+      <el-table-column prop="createUserName" label="发布人" align="center"/>
39
+      <el-table-column prop="updateDate" label="修改时间" align="center" />
40
+      <el-table-column prop="updateDateName" label="修改人" align="center"/>
41
+    </el-table>
42
+    <div class="block">
43
+      <el-pagination
44
+        :current-page="listQuery.pageNum"
45
+        :page-sizes="[10, 20, 50, 100]"
46
+        :page-size="listQuery.pageSize"
47
+        :total="total"
48
+        layout="total, sizes, prev, pager, next, jumper"
49
+        @size-change="handleSizeChange"
50
+        @current-change="handleCurrentChange"/>
51
+    </div>
52
+  </div>
4 53
 </template>
54
+
5 55
 <script>
56
+import { mapActions } from 'vuex'
57
+
6 58
 export default {
7
-  name: 'Index'
59
+  data() {
60
+    return {
61
+      listQuery: {
62
+        number: '',
63
+        announcementTitle: '',
64
+        viewCount: '',
65
+        sort: '',
66
+        status: '',
67
+        createDate: '',
68
+        createUser: '',
69
+        updateUser: '',
70
+        updateDate: '',
71
+        createUserName: '',
72
+        updateDateName: '',
73
+        pageNum: 1,
74
+        pageSize: 10
75
+      },
76
+      total: 0, // 数据总数
77
+      listAnnouncement: [],
78
+      buildingList: [],
79
+      unitList: [],
80
+      levelList: [],
81
+      roomNoList: [],
82
+      listLoading: true // 加载圈
83
+    }
84
+  },
85
+  mounted() {
86
+    // 获取数据
87
+    this.dataQuery()
88
+  },
89
+  methods: {
90
+    ...mapActions('listAnnouncement', [
91
+      'BserPassCertification'
92
+    ]),
93
+    handleSizeChange(val) {
94
+      console.log(`每页 ${val} 条`)
95
+      this.pageNum = 1
96
+      this.listQuery.pageSize = val
97
+      this.dataQuery()
98
+    },
99
+    handleCurrentChange(val) {
100
+      console.log(`当前页: ${val}`)
101
+      this.listQuery.pageNum = val
102
+      this.dataQuery()
103
+    },
104
+    padDate(value) {
105
+      value = value < 10 ? '0' + value : value
106
+      return value
107
+    },
108
+    formatDate(val) {
109
+      var value = new Date(val)
110
+      var year = value.getFullYear()
111
+      var month = this.padDate(value.getMonth() + 1)
112
+      var day = this.padDate(value.getDate())
113
+      var hour = this.padDate(value.getHours())
114
+      var minutes = this.padDate(value.getMinutes())
115
+      var seconds = this.padDate(value.getSeconds())
116
+      return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
117
+    },
118
+    dataQuery() { // 查询数据
119
+      this.listLoading = true
120
+      this.$store.dispatch('ListAnnouncement', this.listQuery).then((res) => {
121
+        const resData = res.data
122
+        this.listAnnouncement = resData.list
123
+        this.listQuery.pageNum = resData.pageNum
124
+        this.listQuery.pageSize = 10
125
+        this.total = resData.total
126
+        this.listLoading = false
127
+      }).catch(() => {
128
+        this.listLoading = false
129
+        console.log('error ListAnnouncement')
130
+      })
131
+    },
132
+    handleSelectionChange(data) {
133
+
134
+    },
135
+	  search() {
136
+      this.listQuery.pageNum = 1
137
+      this.dataQuery()
138
+    },
139
+    handleFilter() {
140
+      this.listQuery.pageNum = 1
141
+      this.listQuery.pageSize = 10
142
+      this.listQuery.ownerName = ''
143
+      this.listQuery.announcementNumber= ''
144
+      this.listQuery.announcementTitle= ''
145
+      this.dataQuery()
146
+    }
147
+  }
8 148
 }
9 149
 </script>
10 150
 
11 151
 <style scoped>
12
-
152
+.root{
153
+  display: flex;
154
+  flex-flow: column;
155
+}
156
+.form-listQuery{
157
+  margin-top: 20px;
158
+  margin-left: 30px;
159
+}
160
+.operation{
161
+  display: flex;
162
+  justify-content: space-between;
163
+  margin-left: 20px;
164
+  margin-right: 20px;
165
+}
166
+.block{
167
+  display: flex;
168
+  justify-content: flex-end;
169
+  margin-top: 10px;
170
+}
171
+.button {
172
+  margin-left: 20px;
173
+}
13 174
 </style>
175
+