傅行帆 6 gadus atpakaļ
vecāks
revīzija
5147d7157c

+ 57
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/TpShopController.java Parādīt failu

@@ -0,0 +1,57 @@
1
+package com.community.huiju.controller;
2
+
3
+
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.common.base.BaseController;
7
+import com.community.huiju.service.ITpShopService;
8
+import io.swagger.annotations.ApiImplicitParam;
9
+import io.swagger.annotations.ApiImplicitParams;
10
+import io.swagger.annotations.ApiOperation;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestMethod;
14
+import org.springframework.web.bind.annotation.RequestParam;
15
+import org.springframework.web.bind.annotation.RestController;
16
+
17
+import javax.servlet.http.HttpSession;
18
+
19
+/**
20
+ * <p>
21
+ * 小区商铺表 前端控制器
22
+ * </p>
23
+ *
24
+ * @author jobob
25
+ * @since 2019-05-10
26
+ */
27
+@RestController
28
+@RequestMapping("/")
29
+public class TpShopController extends BaseController {
30
+	
31
+	@Autowired
32
+	private ITpShopService shopService;
33
+	
34
+	@ApiOperation(value = "根据搜索条件获取角色列表", notes = "根据搜索条件获取角色列表")
35
+	@ApiImplicitParams({
36
+			@ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "商铺编号"),
37
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "shopName", value = "商铺名称"),
38
+			@ApiImplicitParam(paramType = "query", dataType = "Integer", name = "shopTypeId", value = "商铺类型"),
39
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "shopStatus", value = "上架状态"),
40
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
41
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
42
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token"),
43
+	})
44
+	@RequestMapping(value = "/shops",method = RequestMethod.GET)
45
+	public ResponseBean getShopList(@RequestParam(value = "id") Integer id,
46
+	                                @RequestParam(value = "shopName") String shopName,
47
+	                                @RequestParam(value = "shopTypeId") Integer shopTypeId,
48
+	                                @RequestParam(value = "shopStatus") String shopStatus,
49
+	                                @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
50
+	                                @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
51
+	                                HttpSession session) {
52
+		ResponseBean responseBean = new ResponseBean();
53
+		UserElement userElement = getUserElement(session);
54
+		responseBean = shopService.getShopList(id,shopName,shopTypeId,shopStatus,userElement,pageNum,pageSize);
55
+		return responseBean;
56
+	}
57
+}

+ 20
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/TpShopTypeController.java Parādīt failu

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.controller;
2 2
 
3 3
 
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.community.commom.mode.ResponseBean;
5 6
 import com.community.commom.session.UserElement;
6 7
 import com.community.huiju.common.base.BaseController;
@@ -120,4 +121,23 @@ public class TpShopTypeController extends BaseController {
120 121
 		responseBean = shopTypeService.deleteShopType(jsonString);
121 122
 		return responseBean;
122 123
 	}
124
+	
125
+	@ApiOperation(value = "获取商铺配置列表", notes = "获取商铺配置列表")
126
+	@ApiImplicitParams({
127
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
128
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
129
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
130
+	})
131
+	@RequestMapping(value = "/shop/type/select",method = RequestMethod.GET)
132
+	public ResponseBean getTypesSelect(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
133
+	                                 @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize, HttpSession session){
134
+		ResponseBean responseBean = new ResponseBean();
135
+		UserElement userElement = getUserElement(session);
136
+		QueryWrapper<TpShopType> queryWrapper = new QueryWrapper<>();
137
+		queryWrapper.eq("community_id",userElement.getCommunityId());
138
+		queryWrapper.orderByAsc("sort");
139
+		queryWrapper.orderByAsc("create_date");
140
+		responseBean.addSuccess(shopTypeService.list(queryWrapper));
141
+		return responseBean;
142
+	}
123 143
 }

+ 23
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TpShopMapper.java Parādīt failu

@@ -0,0 +1,23 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
+import com.community.huiju.model.TpShop;
6
+import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+import java.util.List;
10
+
11
+/**
12
+ * <p>
13
+ * 小区商铺表 Mapper 接口
14
+ * </p>
15
+ *
16
+ * @author jobob
17
+ * @since 2019-05-10
18
+ */
19
+@Mapper
20
+public interface TpShopMapper extends BaseMapper<TpShop> {
21
+	
22
+	List<TpShop> getShopList(Page page,@Param("tpShop") TpShop tpShop);
23
+}

+ 128
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpShop.java Parādīt failu

@@ -0,0 +1,128 @@
1
+package com.community.huiju.model;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+import java.time.LocalDateTime;
12
+
13
+/**
14
+ * <p>
15
+ * 小区商铺表
16
+ * </p>
17
+ *
18
+ * @author jobob
19
+ * @since 2019-05-10
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+public class TpShop implements Serializable {
25
+
26
+    private static final long serialVersionUID = 1L;
27
+    
28
+    @TableId(value = "id", type = IdType.AUTO)
29
+    private Integer id;
30
+    
31
+    /**
32
+     * 小区ID
33
+     */
34
+    private Integer communityId;
35
+
36
+    /**
37
+     * 商铺名称
38
+     */
39
+    private String shopName;
40
+
41
+    /**
42
+     * 商铺说明
43
+     */
44
+    private String remark;
45
+
46
+    /**
47
+     * 排序(权重)
48
+     */
49
+    private String sort;
50
+
51
+    /**
52
+     * 商铺类型
53
+     */
54
+    private Integer shopTypeId;
55
+
56
+    /**
57
+     * 商铺状态 1是已上架 2是已下架
58
+     */
59
+    private String shopStatus;
60
+
61
+    /**
62
+     * 商铺电话
63
+     */
64
+    private String shopTel;
65
+
66
+    /**
67
+     * 商铺地址
68
+     */
69
+    private String shopAddress;
70
+
71
+    /**
72
+     * 均价
73
+     */
74
+    private String averagePrice;
75
+
76
+    /**
77
+     * 商铺经度
78
+     */
79
+    private String shopLongitude;
80
+
81
+    /**
82
+     * 商铺纬度
83
+     */
84
+    private String shopLatitude;
85
+
86
+    /**
87
+     * 商铺介绍
88
+     */
89
+    private String shopIntroduction;
90
+
91
+    /**
92
+     * 创建时间
93
+     */
94
+    private LocalDateTime createDate;
95
+
96
+    /**
97
+     * 创建人
98
+     */
99
+    private Integer createUser;
100
+
101
+    /**
102
+     * 更新时间
103
+     */
104
+    private LocalDateTime updateDate;
105
+
106
+    /**
107
+     * 更新人
108
+     */
109
+    private Integer updateUser;
110
+    
111
+    /**
112
+     * 类型名称
113
+     */
114
+    @TableField(exist = false)
115
+    private String typeName;
116
+    
117
+    /**
118
+     * 首页图片地址
119
+     */
120
+    @TableField(exist = false)
121
+    private String imgUrl;
122
+    
123
+    /**
124
+     * 更新人姓名
125
+     */
126
+    @TableField(exist = false)
127
+    private String userName;
128
+}

+ 30
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/ITpShopService.java Parādīt failu

@@ -0,0 +1,30 @@
1
+package com.community.huiju.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.model.TpShop;
7
+
8
+/**
9
+ * <p>
10
+ * 小区商铺表 服务类
11
+ * </p>
12
+ *
13
+ * @author jobob
14
+ * @since 2019-05-10
15
+ */
16
+public interface ITpShopService extends IService<TpShop> {
17
+	
18
+	/**
19
+	 * 根据条件查询商铺列表
20
+	 * @param id
21
+	 * @param shopName
22
+	 * @param shopTypeId
23
+	 * @param shopStatus
24
+	 * @param userElement
25
+	 * @param pageNum
26
+	 * @param pageSize
27
+	 * @return
28
+	 */
29
+	ResponseBean getShopList(Integer id, String shopName, Integer shopTypeId, String shopStatus, UserElement userElement, Integer pageNum, Integer pageSize);
30
+}

+ 60
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpShopServiceImpl.java Parādīt failu

@@ -0,0 +1,60 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.community.commom.mode.ResponseBean;
6
+import com.community.commom.session.UserElement;
7
+import com.community.huiju.dao.TpShopMapper;
8
+import com.community.huiju.model.TpShop;
9
+import com.community.huiju.service.ITpShopService;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.stereotype.Service;
12
+
13
+import java.util.HashMap;
14
+import java.util.List;
15
+import java.util.Map;
16
+
17
+/**
18
+ * <p>
19
+ * 小区商铺表 服务实现类
20
+ * </p>
21
+ *
22
+ * @author jobob
23
+ * @since 2019-05-10
24
+ */
25
+@Service
26
+public class TpShopServiceImpl extends ServiceImpl<TpShopMapper, TpShop> implements ITpShopService {
27
+
28
+	@Autowired
29
+	private TpShopMapper shopMapper;
30
+	
31
+	/**
32
+	 * 根据条件查询商铺列表
33
+	 *
34
+	 * @param id
35
+	 * @param shopName
36
+	 * @param shopTypeId
37
+	 * @param shopStatus
38
+	 * @param userElement
39
+	 * @param pageNum
40
+	 * @param pageSize
41
+	 * @return
42
+	 */
43
+	@Override
44
+	public ResponseBean getShopList(Integer id, String shopName, Integer shopTypeId, String shopStatus, UserElement userElement, Integer pageNum, Integer pageSize) {
45
+		ResponseBean responseBean = new ResponseBean();
46
+		Page page = new Page(pageNum,pageSize);
47
+		TpShop tpShop = new TpShop();
48
+		tpShop.setId(id);
49
+		tpShop.setShopName(shopName);
50
+		tpShop.setShopTypeId(shopTypeId);
51
+		tpShop.setShopStatus(shopStatus);
52
+		tpShop.setCommunityId(userElement.getCommunityId());
53
+		List<TpShop> list = shopMapper.getShopList(page,tpShop);
54
+		Map<String,Object> map = new HashMap<>();
55
+		map.put("list", list);
56
+		map.put("total", page.getTotal());
57
+		responseBean.addSuccess(map);
58
+		return responseBean;
59
+	}
60
+}

+ 38
- 0
CODE/smart-community/property-api/src/main/resources/mapper/TpShopMapper.xml Parādīt failu

@@ -0,0 +1,38 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.community.huiju.dao.TpShopMapper">
4
+
5
+    <select id="getShopList" resultType="com.community.huiju.model.TpShop">
6
+        SELECT
7
+            t.id,
8
+            t.shop_name,
9
+            t.sort,
10
+            t.shop_type_id,
11
+            t.shop_status,
12
+            t.update_user,
13
+            t.update_date,
14
+            s.type_name,
15
+            i.img_url,
16
+            u.user_name
17
+        FROM
18
+            tp_shop t
19
+            LEFT JOIN tp_shop_img i ON t.id = i.shop_id AND i.img_type = 1
20
+            LEFT JOIN  tp_shop_type s on t.shop_type_id = s.id
21
+            LEFT JOIN tp_user u on t.update_user = u.id
22
+        where 1=1
23
+        and t.community_id = #{tpShop.communityId}
24
+        <if test="tpShop.id != null and tpShop.id != ''">
25
+            and t.id like concat('%',#{tpShop.id},'%')
26
+        </if>
27
+        <if test="tpShop.shopName != null and tpShop.shopName != ''">
28
+            and t.shop_name like concat('%',#{tpShop.shopName},'%')
29
+        </if>
30
+        <if test="tpShop.shopTypeId != null and tpShop.shopTypeId != ''">
31
+            and t.shop_type_id  = #{tpShop.shopTypeId}
32
+        </if>
33
+        <if test="tpShop.shopStatus != null and tpShop.shopStatus != ''">
34
+            and t.shop_status  = #{tpShop.shopStatus}
35
+        </if>
36
+    </select>
37
+
38
+</mapper>

+ 15
- 0
VUECODE/smart-property-manage/src/api/shopType.js Parādīt failu

@@ -51,3 +51,18 @@ export function deleteShopType(ids) {
51 51
   })
52 52
 }
53 53
 
54
+export function fetchShopList(query) {
55
+  return request({
56
+    url: '/shops',
57
+    method: 'get',
58
+    params: query
59
+  })
60
+}
61
+
62
+export function fetchShopTypeSelect(query) {
63
+  return request({
64
+    url: '/shop/type/select',
65
+    method: 'get'
66
+  })
67
+}
68
+

+ 19
- 1
VUECODE/smart-property-manage/src/store/modules/shopType.js Parādīt failu

@@ -1,4 +1,4 @@
1
-import { fetchShopTypeList, changeShopSetting, addShopType, getShopType, updateShopType, deleteShopType } from '@/api/shopType'
1
+import { fetchShopTypeList, changeShopSetting, addShopType, getShopType, updateShopType, deleteShopType, fetchShopList, fetchShopTypeSelect } from '@/api/shopType'
2 2
 
3 3
 const transaction = {
4 4
   namespaced: true,
@@ -65,6 +65,24 @@ const transaction = {
65 65
           reject(error)
66 66
         })
67 67
       })
68
+    },
69
+    FetchShopList({ commit }, listQuery) {
70
+      return new Promise((resolve, reject) => {
71
+        fetchShopList(listQuery).then(response => {
72
+          resolve(response)
73
+        }).catch(error => {
74
+          reject(error)
75
+        })
76
+      })
77
+    },
78
+    FetchShopTypeSelect({ commit }, listQuery) {
79
+      return new Promise((resolve, reject) => {
80
+        fetchShopTypeSelect(listQuery).then(response => {
81
+          resolve(response)
82
+        }).catch(error => {
83
+          reject(error)
84
+        })
85
+      })
68 86
     }
69 87
   }
70 88
 }

+ 279
- 2
VUECODE/smart-property-manage/src/views/shop/shopIndex.vue Parādīt failu

@@ -1,9 +1,286 @@
1
+
1 2
 <template>
2
-  <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.id" 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.shopName" placeholder="商铺名称" />
10
+      </el-form-item>
11
+      <el-form-item class="filter-item" label="商铺类型" >
12
+        <el-select v-model="listQuery.shopTypeId" placeholder="商铺类型" clearable class="filter-item" style="width: 200px">
13
+          <el-option v-for="item in shopTypeList" :key="item.id" :value="item.id" :label="item.typeName"/>
14
+        </el-select>
15
+      </el-form-item>
16
+      <el-form-item class="filter-item" label="上架状态" >
17
+        <el-select v-model="listQuery.shopStatus" placeholder="请选择">
18
+            <el-option label="已上架" value="1"/>
19
+            <el-option label="已下架" value="2"/>
20
+          </el-select>
21
+      </el-form-item>
22
+      <el-form-item>
23
+        <el-button type="info" class="filter-item" @click="handleFilter">清空</el-button>
24
+        <el-button type="primary" @click="search">查询</el-button>
25
+      </el-form-item>
26
+    </el-form>
27
+    <div class="button">
28
+      <el-button type="primary" @click="add">添加</el-button>
29
+      <el-button type="warning" @click="edit">修改</el-button>
30
+      <el-button type="danger" @click="deleteAnnouncement">作废</el-button>
31
+    </div>
32
+    <el-table
33
+      v-loading="listLoading"
34
+      ref="multipleTable"
35
+      :data="shopList"
36
+      border
37
+      tooltip-effect="dark"
38
+      style="width: 100%; margin-top: 20px;"
39
+      @selection-change="handleSelectionChange">
40
+      <el-table-column
41
+        type="selection"
42
+        width="55"/>
43
+      <el-table-column prop="id" label="商铺编号" align="center"/>
44
+      <el-table-column prop="shopName" label="商铺名称" align="center" >
45
+        <template slot-scope="scope"><a><span style="color: #63B8FF" @click="clickTitle(scope.row.shopName)">{{ scope.row.shopName }}</span></a></template>
46
+      </el-table-column>
47
+      <el-table-column prop="imgUrl" label="首页展示图" align="center">
48
+        <template scope="scope">
49
+          <img :src="scope.row.imgUrl" width="100%"/>
50
+        </template>
51
+      </el-table-column>
52
+      <el-table-column prop="sort" label="权重" align="center"/>
53
+      <el-table-column prop="typeName" label="商铺类型" align="center"/>
54
+      <el-table-column prop="shopStatus" label="上架状态" align="center">\
55
+        <template slot-scope="scope">
56
+          <span v-if="scope.row.shopStatus === '1'">已上架</span>
57
+          <span v-if="scope.row.shopStatus === '2'">已下架</span>
58
+        </template>
59
+      </el-table-column>
60
+      <el-table-column prop="updateDate" label="编辑时间" align="center" ><template slot-scope="scope">{{ formatDate(scope.row.updateDate) }}</template></el-table-column>
61
+      <el-table-column prop="userName" label="编辑人" align="center"/>
62
+    </el-table>
63
+    <div class="block">
64
+      <el-pagination
65
+        :current-page.sync="listQuery.pageNum"
66
+        :page-sizes="[10, 20, 50, 100]"
67
+        :page-size.sync="listQuery.pageSize"
68
+        :total="total"
69
+        layout="total, sizes, prev, pager, next, jumper"
70
+        @size-change="handleSizeChange"
71
+        @current-change="handleCurrentChange"/>
72
+    </div>
73
+  </div>
3 74
 </template>
4 75
 
5 76
 <script>
77
+import { mapState, mapActions, mapMutations } from 'vuex'
78
+
79
+export default {
80
+  data() {
81
+    return {
82
+      listQuery: {
83
+        id: '',
84
+        shopName: '',
85
+        shopTypeId: '',
86
+        shopStatus: '',
87
+        pageNum: 1,
88
+        pageSize: 10
89
+      },
90
+      total: 0, // 数据总数
91
+      shopList: [],
92
+      shopTypeList: [],
93
+      deleteIds: [], // 选择的id集合
94
+      listLoading: true // 加载圈
95
+    }
96
+  },
97
+  mounted() {
98
+    // 获取数据
99
+    this.dataQuery()
100
+    this.getShopTypeList()
101
+  },
102
+  methods: {
103
+    ...mapActions('shopType', [
104
+      'FetchShopList',
105
+      'FetchShopTypeSelect'
106
+    ]),
107
+    handleSizeChange(val) {
108
+      console.log(`每页 ${val} 条`)
109
+      this.listQuery.pageSize = val
110
+      this.dataQuery()
111
+    },
112
+    handleCurrentChange(val) {
113
+      console.log(`当前页: ${val}`)
114
+      this.listQuery.pageNum = val
115
+      this.dataQuery()
116
+    },
117
+    padDate(value) {
118
+      value = value < 10 ? '0' + value : value
119
+      return value
120
+    },
121
+    getStatus(row) { // 获取状态
122
+      let statusName = ''
123
+
124
+      // 判断状态
125
+      switch (row.status) {
126
+        case '0':
127
+          statusName = '已作废'
128
+          break
129
+        case '1':
130
+          statusName = '已发布'
131
+          break
132
+        case '2':
133
+          statusName = '草稿'
134
+          break
135
+      }
136
+
137
+      // 如果修改时间和创建时间不一致, 就显示已修改
138
+      if (row.status === '1' && (row.updateDate > row.createDate)) {
139
+        statusName = '已修改'
140
+      }
141
+
142
+      return statusName
143
+    },
144
+    dataQuery() { // 查询数据
145
+      this.listLoading = true
146
+      this.$store.dispatch('shopType/FetchShopList', this.listQuery).then((res) => {
147
+        const resData = res.data
148
+        this.shopList = resData.list
149
+        this.total = resData.total
150
+        this.listLoading = false
151
+      }).catch(() => {
152
+        this.listLoading = false
153
+        console.log('error ListAnnouncement')
154
+      })
155
+    },
156
+    getShopTypeList() {
157
+      this.$store.dispatch('shopType/FetchShopTypeSelect', this.listQuery).then((res) => {
158
+        this.shopTypeList = res.data
159
+      }).catch(() => {
160
+        console.log('error ListAnnouncement')
161
+      })
162
+    },
163
+    handleSelectionChange(data) {
164
+      // 设置为 空
165
+      this.deleteIds = []
166
+      for (let i = 0; i < data.length; i++) {
167
+        this.deleteIds.push(data[i].id)
168
+      }
169
+    },
170
+	  search() {
171
+      this.listQuery.pageNum = 1
172
+      this.dataQuery()
173
+    },
174
+    handleFilter() {
175
+      this.listQuery.pageNum = 1
176
+      this.listQuery.pageSize = 10
177
+      this.listQuery.id =''
178
+      this.listQuery.shopName=''
179
+      this.listQuery.shopTypeId=''
180
+      this.listQuery.shopStatus=''
181
+      this.dataQuery()
182
+    },
183
+    // 添加公告
184
+    add() {
185
+      this.$router.push({ name: 'announcement-add' })
186
+    },
187
+    edit(){// 编辑公告
188
+      const ids = this.deleteIds
189
+      if (ids.length > 1) {
190
+        this.$message.error('只能选择一行数据进行修改!')
191
+        return
192
+      }
193
+      if (ids < 1) {
194
+        this.$message.error('请选择一行数据进行修改!')
195
+        return
196
+      }
197
+       let ide= this.deleteIds[0]
198
+       this.listQuery.id = ide
199
+      this.$store.dispatch('AnnouncementById', this.listQuery).then((res) => {
200
+        const resData = res.data
201
+        const announcement = resData.tpAnnouncement
202
+        const imgList = resData.studentList
203
+        this.listQuery = announcement
204
+        this.listQuery.announcementTitle = ''
205
+        console.log("1",this.listQuery.status)
206
+        if(this.listQuery.status == 0){
207
+          this.$message.error('已作废不可以修改')
208
+          return
209
+        } 
210
+       this.$router.push({ name: 'announcement-edit', query: { id: ide }})
211
+      }) 
212
+      },
213
+    deleteAnnouncement(){
214
+       let ide= this.deleteIds[0]
215
+       this.listQuery.id = ide 
216
+      this.$store.dispatch('AnnouncementById', this.listQuery).then((res) => {
217
+        const resData = res.data
218
+        const announcement = resData.tpAnnouncement
219
+        const imgList = resData.studentList
220
+        this.listQuery.status= announcement.status
221
+        console.log("1",this.listQuery.status)
222
+        if(this.listQuery.status == 0){
223
+          this.$message.error('已作废不可以作废')
224
+          return
225
+        }
226
+        this.deleteId()     
227
+      })    
228
+    },
229
+
230
+    deleteId(){
231
+       const ids = this.deleteIds
232
+      this.listLoading = true
233
+      console.log(ids)
234
+      this.$store.dispatch('DeleteAnnouncement', ids).then((res) => {
235
+        this.listLoading = false
236
+        this.listQuery.announcementTitle = ''
237
+        this.dataQuery()
238
+      }).catch(() => {
239
+        this.listLoading = false
240
+        console.log('error DeleteAnnouncement')
241
+      })
242
+    },
243
+
244
+
245
+    clickTitle(id) {
246
+      this.$router.push({ name: 'contentParticulars-details', query: { id: id }})
247
+    },
248
+    formatDate(val) {
249
+      if (val === null) {
250
+        return ''
251
+      }
252
+      var value = new Date(val)
253
+      var year = value.getFullYear()
254
+      var month = value.getMonth() + 1
255
+      var day = value.getDate()
256
+      return year + '-' + month + '-' + day
257
+    }
258
+  }
259
+}
6 260
 </script>
7 261
 
8
-<style lang="scss" scoped>
262
+<style scoped>
263
+.root{
264
+  display: flex;
265
+  flex-flow: column;
266
+}
267
+.form-listQuery{
268
+  margin-top: 20px;
269
+  margin-left: 30px;
270
+}
271
+.operation{
272
+  display: flex;
273
+  justify-content: space-between;
274
+  margin-left: 20px;
275
+  margin-right: 20px;
276
+}
277
+.block{
278
+  display: flex;
279
+  justify-content: flex-end;
280
+  margin-top: 10px;
281
+}
282
+.button {
283
+  margin-left: 20px;
284
+}
9 285
 </style>
286
+