|
@@ -1,454 +1,546 @@
|
1
|
1
|
<template>
|
2
|
|
- <div class="edit-carousel">
|
3
|
|
- <el-form ref="form" :model="building" label-width="180px">
|
4
|
|
- <el-form-item label="所属项目:">
|
5
|
|
- <el-select v-model="buildingProperty" multiple placeholder="请选择">
|
6
|
|
- <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
|
7
|
|
- </el-select>
|
8
|
|
- </el-form-item>
|
9
|
|
- <el-form-item label="主图:">
|
10
|
|
- <el-upload
|
11
|
|
- :action="upFileUrl"
|
12
|
|
- name='file'
|
13
|
|
- list-type="picture-card"
|
14
|
|
- :headers="uploadHeaders"
|
15
|
|
- :file-list="imgList"
|
16
|
|
- :show-file-list="true"
|
17
|
|
- :before-upload="beforeImgUpload"
|
18
|
|
- :on-success="handleAvatarSuccess"
|
19
|
|
- :on-remove="handleRemove">
|
20
|
|
- <i class="el-icon-plus"></i>
|
21
|
|
- </el-upload>
|
22
|
|
- <el-dialog :visible.sync="dialogVisible">
|
23
|
|
- <img width="100%" :src="dialogImageUrl" alt="">
|
24
|
|
- </el-dialog>
|
25
|
|
- </el-form-item>
|
26
|
|
- <el-form-item label="标题:">
|
27
|
|
- <el-input v-model="building.tel"></el-input>
|
28
|
|
- </el-form-item>
|
29
|
|
- <el-form-item label="类型:">
|
30
|
|
- <el-select v-model="buildingProperty" multiple placeholder="请选择">
|
31
|
|
- <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
|
32
|
|
- </el-select>
|
33
|
|
- </el-form-item>
|
34
|
|
- <el-form-item label="发布内容:">
|
35
|
|
- <div id="websiteEditorElem" style="height: 400px"></div>
|
36
|
|
- </el-form-item>
|
37
|
|
- <el-form-item label="发布内容:" class="publish">
|
38
|
|
- <p>活动名称展示处<span class="choose" v-popover:popover4>{{showPlace?showPlace:'请选择'}}</span></p>
|
39
|
|
- <el-popover ref="popover4" placement="right" width="560" v-model="popover4" trigger="click">
|
40
|
|
- <el-table :data="gridData">
|
41
|
|
- <el-table-column width="360" property="name" label="标题"></el-table-column>
|
42
|
|
- <el-table-column width="200" label="操作">
|
43
|
|
- <template slot-scope="scope">
|
44
|
|
- <el-button type="text" @click="handleEdit(scope.row)" size="small">选择</el-button>
|
45
|
|
- </template>
|
46
|
|
- </el-table-column>
|
47
|
|
- </el-table>
|
48
|
|
- </el-popover>
|
49
|
|
- </el-form-item>
|
50
|
|
- <el-form-item label="状态:">
|
51
|
|
- <el-select v-model="buildingProperty" multiple placeholder="请选择">
|
52
|
|
- <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
|
53
|
|
- </el-select>
|
54
|
|
- </el-form-item>
|
55
|
|
- <el-form-item>
|
56
|
|
- <el-button type="primary" @click="onSubmit">保存</el-button>
|
57
|
|
- <el-button @click="onCancel">取消</el-button>
|
58
|
|
- </el-form-item>
|
59
|
|
- </el-form>
|
60
|
|
- </div>
|
|
2
|
+ <div class="edit-carousel">
|
|
3
|
+ <el-form ref="form" :model="form" label-width="180px">
|
|
4
|
+ <el-form-item label="所属项目:">
|
|
5
|
+ <el-select v-model="form.buildingId" placeholder="请选择">
|
|
6
|
+ <el-option
|
|
7
|
+ v-for="item in buildingList"
|
|
8
|
+ :key="item.buildingId"
|
|
9
|
+ :label="item.buildingName"
|
|
10
|
+ :value="item.buildingId">
|
|
11
|
+ </el-option>
|
|
12
|
+ </el-select>
|
|
13
|
+ </el-form-item>
|
|
14
|
+ <el-form-item label="主图:">
|
|
15
|
+ <el-upload
|
|
16
|
+ :headers="uploadHeaders"
|
|
17
|
+ :action="upFileUrl"
|
|
18
|
+ :show-file-list="false"
|
|
19
|
+ :on-success="handleAvatarSuccess">
|
|
20
|
+ <img v-if="imageUrl" :src="imageUrl" class="avatar">
|
|
21
|
+ <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
22
|
+ </el-upload>
|
|
23
|
+ </el-form-item>
|
|
24
|
+ <el-form-item label="标题:">
|
|
25
|
+ <el-input v-model="form.title"></el-input>
|
|
26
|
+ </el-form-item>
|
|
27
|
+ <el-form-item label="发布位置:">
|
|
28
|
+ <el-select v-model="form.showPosition" placeholder="请选择">
|
|
29
|
+ <el-option v-for="(item,i) in showPositionList" :key="i" :label="item.name" :value="item.value"></el-option>
|
|
30
|
+ </el-select>
|
|
31
|
+ </el-form-item>
|
|
32
|
+ <el-form-item label="类型:">
|
|
33
|
+ <el-select v-model="form.contentType" placeholder="请选择">
|
|
34
|
+ <el-option v-for="(t,i) in contentTypeList" :key="i" :label="t.name" :value="t.value"></el-option>
|
|
35
|
+ </el-select>
|
|
36
|
+ </el-form-item>
|
|
37
|
+ <el-form-item label="发布内容:" v-if=" form.contentType === 'other'">
|
|
38
|
+ <rich-editor v-model="form.content" style="height: 400px; width: 1000px;" />
|
|
39
|
+ </el-form-item>
|
|
40
|
+ <el-form-item label="发布活动:" class="publish" v-if=" form.contentType === 'activity'">
|
|
41
|
+ <p>{{ showPlace }}<span class="choose" @click="showDial">请选择</span></p>
|
|
42
|
+ </el-form-item>
|
|
43
|
+ <el-form-item label="状态:">
|
|
44
|
+ <el-select v-model="form.status" placeholder="请选择">
|
|
45
|
+ <el-option v-for="(t,i) in extendContentStatus" :key="i" :label="t.name" :value="t.value"></el-option>
|
|
46
|
+ </el-select>
|
|
47
|
+ </el-form-item>
|
|
48
|
+ <el-form-item>
|
|
49
|
+ <el-button type="primary" @click="submitAddOrUpdate">保存</el-button>
|
|
50
|
+ <el-button @click="onCancel">取消</el-button>
|
|
51
|
+ </el-form-item>
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+ <el-dialog title="选择活动" :visible.sync="dialogTableVisible">
|
|
55
|
+ <el-table :data="activityList">
|
|
56
|
+ <el-table-column property="title" label="活动名称"></el-table-column>
|
|
57
|
+ <el-table-column fixed="right" label="操作">
|
|
58
|
+ <template slot-scope="scope">
|
|
59
|
+ <el-button type="text" @click="handleDel(scope.row)" size="small">选择</el-button>
|
|
60
|
+ </template>
|
|
61
|
+ </el-table-column>
|
|
62
|
+ </el-table>
|
|
63
|
+ <el-pagination
|
|
64
|
+ @size-change="dialogHandleSizeChange"
|
|
65
|
+ @current-change="dialogHandleCurrentChange"
|
|
66
|
+ :current-page.sync="activityForm.pageNum"
|
|
67
|
+ :page-size="activityForm.pageSize"
|
|
68
|
+ layout="total, prev, pager, next"
|
|
69
|
+ :total="activityTotal">
|
|
70
|
+ </el-pagination>
|
|
71
|
+ </el-dialog>
|
|
72
|
+ </el-form>
|
|
73
|
+ </div>
|
61
|
74
|
</template>
|
62
|
75
|
|
63
|
76
|
<script>
|
64
|
|
-import { createNamespacedHelpers } from "vuex";
|
65
|
|
-import apis from "../../config/api";
|
66
|
|
-import { mapState } from "vuex";
|
67
|
|
-import E from "wangeditor";
|
|
77
|
+ import { createNamespacedHelpers } from "vuex";
|
|
78
|
+ import apis from "../../config/api";
|
|
79
|
+ import { mapState } from "vuex";
|
|
80
|
+ import E from "wangeditor";
|
68
|
81
|
|
69
|
|
-const {
|
70
|
|
- mapState: mapBuildingState,
|
71
|
|
- mapActions: mapBuildingActions,
|
72
|
|
- mapMutations: mapBuildingMutations
|
73
|
|
-} = createNamespacedHelpers("building");
|
|
82
|
+ const {
|
|
83
|
+ mapState: mapBuildingState,
|
|
84
|
+ mapActions: mapBuildingActions,
|
|
85
|
+ mapMutations: mapBuildingMutations
|
|
86
|
+ } = createNamespacedHelpers("building");
|
74
|
87
|
|
75
|
|
-const { mapActions: mapApartmentActions } = createNamespacedHelpers(
|
76
|
|
- "apartment"
|
77
|
|
-);
|
|
88
|
+ const { mapActions: mapApartmentActions } = createNamespacedHelpers(
|
|
89
|
+ "apartment"
|
|
90
|
+ );
|
78
|
91
|
|
79
|
|
-const { mapActions: mapImgActions } = createNamespacedHelpers("img");
|
|
92
|
+ const { mapActions: mapImgActions } = createNamespacedHelpers("img");
|
80
|
93
|
|
81
|
|
-export default {
|
82
|
|
- data() {
|
83
|
|
- var _self = this;
|
84
|
|
- return {
|
85
|
|
- popover4:false,//弹框
|
86
|
|
- showPlace:'',//活动名称展示处
|
87
|
|
- gridData: [
|
88
|
|
- {
|
89
|
|
- date: "2016-05-02",
|
90
|
|
- name: "高奢生活,在遇到它之前你想象不到"
|
|
94
|
+ export default {
|
|
95
|
+ data() {
|
|
96
|
+ var _self = this;
|
|
97
|
+ return {
|
|
98
|
+ form: {
|
|
99
|
+ contentId: '',
|
|
100
|
+ buildingId: '',
|
|
101
|
+ image: '',
|
|
102
|
+ title: '',
|
|
103
|
+ showPosition: '',
|
|
104
|
+ contentType: '',
|
|
105
|
+ content: '',
|
|
106
|
+ status: 0,
|
|
107
|
+ targetId: '',
|
|
108
|
+ showType: 'banner'
|
91
|
109
|
},
|
92
|
|
- {
|
93
|
|
- date: "2016-05-04",
|
94
|
|
- name: "欢乐套圈圈,福利大放送"
|
|
110
|
+ imageUrl: '',
|
|
111
|
+ buildingList: [], // 所属项目
|
|
112
|
+ buildingForm: { // 所属项目条件
|
|
113
|
+ pageNum: 1,
|
|
114
|
+ pageSize: 100
|
95
|
115
|
},
|
96
|
|
- {
|
97
|
|
- date: "2016-05-01",
|
98
|
|
- name: "上海市普陀区金沙江路 1518 弄"
|
99
|
|
- }
|
100
|
|
- ],
|
101
|
|
- upFileUrl: apis.file.upload.url,
|
102
|
|
- commPrefix: "",
|
103
|
|
- imgurl: "",
|
104
|
|
- loadingZm: false,
|
105
|
|
- activeName: "detail",
|
106
|
|
- dialogImageUrl: "",
|
107
|
|
- dialogVisible: false,
|
108
|
|
- dialogApartImageUrl: "",
|
109
|
|
- dialogApartVisible: false,
|
110
|
|
- showHx: false,
|
111
|
|
- imgList: [],
|
112
|
|
- tags: [],
|
113
|
|
- buildingProperty: [],
|
114
|
|
- aparments: [],
|
115
|
|
- aparmentInfo: {},
|
116
|
|
- aparmentImg: [],
|
117
|
|
- saleType: [
|
118
|
|
- {
|
119
|
|
- id: 1,
|
120
|
|
- name: "待定"
|
|
116
|
+ showPositionList: [
|
|
117
|
+ {
|
|
118
|
+ name: '首页',
|
|
119
|
+ value: 'index'
|
|
120
|
+ },
|
|
121
|
+ {
|
|
122
|
+ name: '商城',
|
|
123
|
+ value: 'mall'
|
|
124
|
+ }
|
|
125
|
+ ],
|
|
126
|
+ contentTypeList: [
|
|
127
|
+ {
|
|
128
|
+ name: '活动',
|
|
129
|
+ value: 'activity'
|
|
130
|
+ },
|
|
131
|
+ {
|
|
132
|
+ name: '项目',
|
|
133
|
+ value: 'project'
|
|
134
|
+ },
|
|
135
|
+ {
|
|
136
|
+ name: '资讯',
|
|
137
|
+ value: 'news'
|
|
138
|
+ },
|
|
139
|
+ {
|
|
140
|
+ name: '其他',
|
|
141
|
+ value: 'other'
|
|
142
|
+ }
|
|
143
|
+ ],
|
|
144
|
+ extendContentStatus: [ // 状态
|
|
145
|
+ {
|
|
146
|
+ name: "启用",
|
|
147
|
+ value: 1
|
|
148
|
+ },
|
|
149
|
+ {
|
|
150
|
+ name: "停用",
|
|
151
|
+ value: 0
|
|
152
|
+ },
|
|
153
|
+ ],
|
|
154
|
+ activityForm: { // 活动查询条件
|
|
155
|
+ pageNum: 1,
|
|
156
|
+ pageSize: 10
|
121
|
157
|
},
|
122
|
|
- {
|
123
|
|
- id: 2,
|
124
|
|
- name: "售罄"
|
125
|
|
- },
|
126
|
|
- {
|
127
|
|
- id: 3,
|
128
|
|
- name: "在售"
|
129
|
|
- }
|
130
|
|
- ]
|
131
|
|
- };
|
132
|
|
- },
|
133
|
|
- computed: {
|
134
|
|
- ...mapBuildingState({
|
135
|
|
- detail: x => x.detail
|
136
|
|
- }),
|
137
|
|
- ...mapState({
|
138
|
|
- dicts: x => x.dicts
|
139
|
|
- }),
|
140
|
|
- building: {
|
141
|
|
- get() {
|
142
|
|
- return this.detail;
|
143
|
|
- },
|
144
|
|
- set(val) {
|
145
|
|
- return this.updateDetail(val);
|
146
|
|
- }
|
147
|
|
- },
|
148
|
|
- propertyType() {
|
149
|
|
- return (this.dicts || []).filter(x => x.type === "propertyType");
|
150
|
|
- },
|
151
|
|
- uploadHeaders() {
|
152
|
|
- const token = localStorage.getItem("x-token") || "";
|
153
|
|
- return {
|
154
|
|
- Authorization: `Bearer ${token}`
|
155
|
|
- };
|
156
|
|
- }
|
157
|
|
- },
|
158
|
|
- methods: {
|
159
|
|
- ...mapBuildingMutations(["updateDetail"]),
|
160
|
|
- ...mapBuildingActions(["getDetail", "addBuilding", "editBuilding"]),
|
161
|
|
- ...mapApartmentActions([
|
162
|
|
- "getApartments",
|
163
|
|
- "getApartmentDetail",
|
164
|
|
- "addApartment",
|
165
|
|
- "editApartment",
|
166
|
|
- "deleteApartment"
|
167
|
|
- ]),
|
168
|
|
- ...mapImgActions(["uploadImg"]),
|
169
|
|
- getSaleTypeName(id) {
|
170
|
|
- return (this.saleType.filter(x => x.id == id)[0] || {}).name;
|
171
|
|
- },
|
172
|
|
- onCancel() {
|
173
|
|
- this.$router.push({ name: "buildinglist" });
|
174
|
|
- },
|
175
|
|
- handleRemove(file, fileList) {
|
176
|
|
- this.imgList = fileList;
|
177
|
|
- },
|
178
|
|
- handleAparmentRemove(file, fileList) {
|
179
|
|
- this.aparmentImg = fileList;
|
180
|
|
- },
|
|
158
|
+ activityTotal: 0, // 活动总数
|
|
159
|
+ dialogTableVisible: false, //选择活动弹框
|
|
160
|
+ activityList: [], // 活动列表
|
181
|
161
|
|
182
|
|
- beforeImgUpload(file) {
|
183
|
|
- if (file.type !== "image/jpeg" && file.type !== "image/png") {
|
184
|
|
- this.$message.error("上传图片只能是 JPG 或 PNG 格式!");
|
185
|
|
- return false;
|
186
|
|
- }
|
187
|
|
- // if (file.size / 1024 > 300) {
|
188
|
|
- // this.$message.error('图片大小不允许超过300k!')
|
189
|
|
- // return false
|
190
|
|
- // }
|
191
|
|
- this.loading = this.$loading({
|
192
|
|
- lock: true,
|
193
|
|
- text: "上传中...",
|
194
|
|
- spinner: "el-icon-loading",
|
195
|
|
- background: "rgba(0, 0, 0, 0.7)"
|
196
|
|
- });
|
197
|
162
|
|
198
|
|
- return true;
|
199
|
|
- },
|
200
|
|
- handleAvatarSuccess(res) {
|
201
|
|
- this.imgList = [
|
202
|
|
- ...this.imgList,
|
203
|
|
- {
|
204
|
|
- url: res.data
|
205
|
|
- }
|
206
|
|
- ];
|
207
|
|
- this.loading.close();
|
208
|
|
- },
|
209
|
|
- handleMapImgSuccess(res) {
|
210
|
|
- this.building = { ...this.building, mapImg: res.data };
|
211
|
|
- this.loading.close();
|
212
|
|
- },
|
213
|
|
- handlePosterSuccess(res) {
|
214
|
|
- this.building = { ...this.building, poster: res.data };
|
215
|
|
- this.loading.close();
|
216
|
|
- },
|
217
|
|
- handleAparmentSuccess(res) {
|
218
|
|
- this.aparmentImg = [
|
219
|
|
- ...this.aparmentImg,
|
220
|
|
- {
|
221
|
|
- url: res.data
|
222
|
|
- }
|
223
|
|
- ];
|
224
|
|
- this.loading.close();
|
225
|
|
- },
|
226
|
|
- onSubmit() {
|
227
|
|
- const imgs = this.imgList.map((x, i) => {
|
228
|
|
- return {
|
229
|
|
- imgType: "banner",
|
230
|
|
- url: x.url,
|
231
|
|
- orderNo: i + 1
|
232
|
|
- };
|
233
|
|
- });
|
234
|
|
- const tag = this.tags.map(x => {
|
235
|
|
- return {
|
236
|
|
- tagName: x
|
237
|
|
- };
|
238
|
|
- });
|
239
|
|
- const building = {
|
240
|
|
- ...this.building,
|
241
|
|
- img: imgs,
|
242
|
|
- propertyType: this.buildingProperty.join(","),
|
243
|
|
- tag
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+ // 下面的不敢删除
|
|
168
|
+ popover4:false,//弹框
|
|
169
|
+ showPlace:'',//活动名称展示处
|
|
170
|
+ gridData: [
|
|
171
|
+ {
|
|
172
|
+ date: "2016-05-02",
|
|
173
|
+ name: "高奢生活,在遇到它之前你想象不到"
|
|
174
|
+ },
|
|
175
|
+ {
|
|
176
|
+ date: "2016-05-04",
|
|
177
|
+ name: "欢乐套圈圈,福利大放送"
|
|
178
|
+ },
|
|
179
|
+ {
|
|
180
|
+ date: "2016-05-01",
|
|
181
|
+ name: "上海市普陀区金沙江路 1518 弄"
|
|
182
|
+ }
|
|
183
|
+ ],
|
|
184
|
+ upFileUrl: apis.file.upload.url,
|
|
185
|
+ commPrefix: "",
|
|
186
|
+ imgurl: "",
|
|
187
|
+ loadingZm: false,
|
|
188
|
+ activeName: "detail",
|
|
189
|
+ dialogImageUrl: "",
|
|
190
|
+ dialogVisible: false,
|
|
191
|
+ dialogApartImageUrl: "",
|
|
192
|
+ dialogApartVisible: false,
|
|
193
|
+ showHx: false,
|
|
194
|
+ imgList: [],
|
|
195
|
+ tags: [],
|
|
196
|
+ buildingProperty: [],
|
|
197
|
+ aparments: [],
|
|
198
|
+ aparmentInfo: {},
|
|
199
|
+ aparmentImg: [],
|
|
200
|
+ saleType: [
|
|
201
|
+ {
|
|
202
|
+ id: 1,
|
|
203
|
+ name: "待定"
|
|
204
|
+ },
|
|
205
|
+ {
|
|
206
|
+ id: 2,
|
|
207
|
+ name: "售罄"
|
|
208
|
+ },
|
|
209
|
+ {
|
|
210
|
+ id: 3,
|
|
211
|
+ name: "在售"
|
|
212
|
+ }
|
|
213
|
+ ]
|
244
|
214
|
};
|
245
|
|
- if (!building.buildingId) {
|
246
|
|
- // 新增
|
247
|
|
- this.addBuilding({
|
248
|
|
- onSuccess: this.onCancel,
|
249
|
|
- detail: JSON.stringify(building)
|
250
|
|
- });
|
251
|
|
- } else {
|
252
|
|
- // 修改
|
253
|
|
- this.editBuilding({
|
254
|
|
- onSuccess: this.onCancel,
|
255
|
|
- detail: JSON.stringify(building)
|
256
|
|
- });
|
257
|
|
- }
|
258
|
215
|
},
|
259
|
|
- FormatDate(date) {
|
260
|
|
- return (date || "").split("T")[0] === "0001-01-01"
|
261
|
|
- ? ""
|
262
|
|
- : (date || "").split("T")[0];
|
263
|
|
- },
|
264
|
|
- saveAparment() {
|
265
|
|
- const imgs = this.aparmentImg.map((x, i) => {
|
|
216
|
+ computed: {
|
|
217
|
+ ...mapBuildingState({
|
|
218
|
+ detail: x => x.detail
|
|
219
|
+ }),
|
|
220
|
+ ...mapState({
|
|
221
|
+ dicts: x => x.dicts
|
|
222
|
+ }),
|
|
223
|
+ building: {
|
|
224
|
+ get() {
|
|
225
|
+ return this.detail;
|
|
226
|
+ },
|
|
227
|
+ set(val) {
|
|
228
|
+ return this.updateDetail(val);
|
|
229
|
+ }
|
|
230
|
+ },
|
|
231
|
+ propertyType() {
|
|
232
|
+ return (this.dicts || []).filter(x => x.type === "propertyType");
|
|
233
|
+ },
|
|
234
|
+ uploadHeaders() {
|
|
235
|
+ const token = localStorage.getItem("x-token") || "";
|
266
|
236
|
return {
|
267
|
|
- imgType: "aparment",
|
268
|
|
- url: x.url,
|
269
|
|
- orderNo: i + 1
|
|
237
|
+ Authorization: `Bearer ${token}`
|
270
|
238
|
};
|
271
|
|
- });
|
272
|
|
- if (!this.aparmentInfo.apartmentId) {
|
273
|
|
- this.addApartment(
|
274
|
|
- JSON.stringify({
|
275
|
|
- ...this.aparmentInfo,
|
276
|
|
- img: imgs
|
277
|
|
- })
|
278
|
|
- ).then(() => {
|
279
|
|
- this.getAparmentList();
|
280
|
|
- this.showHx = false;
|
281
|
|
- });
|
282
|
|
- } else {
|
283
|
|
- this.editApartment(
|
284
|
|
- JSON.stringify({
|
285
|
|
- ...this.aparmentInfo,
|
286
|
|
- img: imgs
|
287
|
|
- })
|
288
|
|
- ).then(() => {
|
289
|
|
- this.getAparmentList();
|
290
|
|
- this.showHx = false;
|
291
|
|
- });
|
292
|
239
|
}
|
293
|
240
|
},
|
294
|
|
- addHx() {
|
295
|
|
- this.aparmentImg = [];
|
296
|
|
- this.aparmentInfo = { buildingId: this.building.buildingId };
|
297
|
|
- this.showHx = true;
|
298
|
|
- },
|
299
|
|
- getAparmentList() {
|
300
|
|
- this.getApartments({ buildingId: this.$route.query.id }).then(data => {
|
301
|
|
- this.aparments = data;
|
302
|
|
- });
|
303
|
|
- },
|
304
|
|
- handleEdit(row){
|
305
|
|
- this.showPlace = row.name
|
306
|
|
- this.popover4 = false
|
307
|
|
-
|
|
241
|
+ methods: {
|
|
242
|
+ ...mapBuildingMutations(["updateDetail"]),
|
|
243
|
+ ...mapBuildingActions(["getDetail", "addBuilding", "editBuilding"]),
|
|
244
|
+ ...mapApartmentActions([
|
|
245
|
+ "getApartments",
|
|
246
|
+ "getApartmentDetail",
|
|
247
|
+ "addApartment",
|
|
248
|
+ "editApartment",
|
|
249
|
+ "deleteApartment"
|
|
250
|
+ ]),
|
|
251
|
+ ...mapImgActions(["uploadImg"]),
|
|
252
|
+ getSaleTypeName(id) {
|
|
253
|
+ return (this.saleType.filter(x => x.id == id)[0] || {}).name;
|
|
254
|
+ },
|
|
255
|
+ onCancel() {
|
|
256
|
+ this.$router.push({ name: "buildinglist" });
|
|
257
|
+ },
|
|
258
|
+ handleRemove(file, fileList) {
|
|
259
|
+ this.imgList = fileList;
|
|
260
|
+ },
|
|
261
|
+ handleAparmentRemove(file, fileList) {
|
|
262
|
+ this.aparmentImg = fileList;
|
|
263
|
+ },
|
308
|
264
|
|
309
|
|
- },
|
310
|
|
- // handleEdit(row) {
|
311
|
|
- // this.aparmentImg = [];
|
312
|
|
- // this.getApartmentDetail({
|
313
|
|
- // id: row.apartmentId
|
314
|
|
- // }).then(data => {
|
315
|
|
- // console.log("...", data);
|
316
|
|
- // this.aparmentImg = data.buildingImgList.map(x => {
|
317
|
|
- // return {
|
318
|
|
- // name: x.imgId,
|
319
|
|
- // url: x.url
|
320
|
|
- // };
|
321
|
|
- // });
|
322
|
|
- // this.aparmentInfo = data;
|
323
|
|
- // this.showHx = true;
|
324
|
|
- // });
|
325
|
|
- // },
|
326
|
|
- handleDel(row) {
|
327
|
|
- this.$confirm("确认删除此数据?", "提示", {
|
328
|
|
- confirmButtonText: "确定",
|
329
|
|
- cancelButtonText: "取消",
|
330
|
|
- type: "warning"
|
331
|
|
- }).then(() => {
|
332
|
|
- if (this.building.status === 1) {
|
333
|
|
- this.$message.error("当前楼盘处于发布状态,不允许删除!");
|
|
265
|
+ beforeImgUpload(file) {
|
|
266
|
+ if (file.type !== "image/jpeg" && file.type !== "image/png") {
|
|
267
|
+ this.$message.error("上传图片只能是 JPG 或 PNG 格式!");
|
334
|
268
|
return false;
|
335
|
269
|
}
|
336
|
|
- this.deleteApartment({
|
337
|
|
- id: row.apartmentId
|
338
|
|
- }).then(() => {
|
339
|
|
- this.getAparmentList();
|
|
270
|
+ // if (file.size / 1024 > 300) {
|
|
271
|
+ // this.$message.error('图片大小不允许超过300k!')
|
|
272
|
+ // return false
|
|
273
|
+ // }
|
|
274
|
+ this.loading = this.$loading({
|
|
275
|
+ lock: true,
|
|
276
|
+ text: "上传中...",
|
|
277
|
+ spinner: "el-icon-loading",
|
|
278
|
+ background: "rgba(0, 0, 0, 0.7)"
|
340
|
279
|
});
|
341
|
|
- });
|
342
|
|
- }
|
343
|
|
- },
|
344
|
|
- mounted() {
|
345
|
|
- const _that = this;
|
346
|
|
- const phoneEditor = new E("#websiteEditorElem");
|
347
|
|
- phoneEditor.customConfig.onchange = function(html) {
|
348
|
|
- _that.building = { ..._that.building, remark: html };
|
349
|
|
- };
|
350
|
|
- phoneEditor.customConfig.customUploadImg = function(files, insert) {
|
351
|
|
- _that.uploadImg(files[0]).then(data => {
|
352
|
|
- insert(data[0]);
|
353
|
|
- });
|
354
|
|
- };
|
355
|
|
- phoneEditor.customConfig.menus = [
|
356
|
|
- "head", // 标题
|
357
|
|
- "bold", // 粗体
|
358
|
|
- "fontSize", // 字号
|
359
|
|
- "fontName", // 字体
|
360
|
|
- "italic", // 斜体
|
361
|
|
- "underline", // 下划线
|
362
|
|
- "strikeThrough", // 删除线
|
363
|
|
- "foreColor", // 文字颜色
|
364
|
|
- "backColor", // 背景颜色
|
365
|
|
- "justify", // 对齐方式
|
366
|
|
- "image" // 插入图片
|
367
|
|
- ];
|
368
|
|
- phoneEditor.create();
|
369
|
|
- if ((this.$route.query.id || "") !== "") {
|
370
|
|
- this.getAparmentList();
|
371
|
|
- window.console.log(this.getDetail);
|
372
|
|
- this.getDetail({ id: this.$route.query.id }).then(data => {
|
373
|
|
- this.buildingProperty = data.propertyType.split(",");
|
374
|
|
- phoneEditor.txt.html(data.remark);
|
375
|
|
- this.imgList = data.buildingImg.map(x => {
|
|
280
|
+
|
|
281
|
+ return true;
|
|
282
|
+ },
|
|
283
|
+ handleAvatarSuccess(res) {
|
|
284
|
+ this.imageUrl = res.data
|
|
285
|
+ this.form.image = res.data
|
|
286
|
+ },
|
|
287
|
+ handleMapImgSuccess(res) {
|
|
288
|
+ this.building = { ...this.building, mapImg: res.data };
|
|
289
|
+ this.loading.close();
|
|
290
|
+ },
|
|
291
|
+ handlePosterSuccess(res) {
|
|
292
|
+ this.building = { ...this.building, poster: res.data };
|
|
293
|
+ this.loading.close();
|
|
294
|
+ },
|
|
295
|
+ handleAparmentSuccess(res) {
|
|
296
|
+ this.aparmentImg = [
|
|
297
|
+ ...this.aparmentImg,
|
|
298
|
+ {
|
|
299
|
+ url: res.data
|
|
300
|
+ }
|
|
301
|
+ ];
|
|
302
|
+ this.loading.close();
|
|
303
|
+ },
|
|
304
|
+ onSubmit() {
|
|
305
|
+ const imgs = this.imgList.map((x, i) => {
|
|
306
|
+ return {
|
|
307
|
+ imgType: "banner",
|
|
308
|
+ url: x.url,
|
|
309
|
+ orderNo: i + 1
|
|
310
|
+ };
|
|
311
|
+ });
|
|
312
|
+ const tag = this.tags.map(x => {
|
|
313
|
+ return {
|
|
314
|
+ tagName: x
|
|
315
|
+ };
|
|
316
|
+ });
|
|
317
|
+ const building = {
|
|
318
|
+ ...this.building,
|
|
319
|
+ img: imgs,
|
|
320
|
+ propertyType: this.buildingProperty.join(","),
|
|
321
|
+ tag
|
|
322
|
+ };
|
|
323
|
+ if (!building.buildingId) {
|
|
324
|
+ // 新增
|
|
325
|
+ this.addBuilding({
|
|
326
|
+ onSuccess: this.onCancel,
|
|
327
|
+ detail: JSON.stringify(building)
|
|
328
|
+ });
|
|
329
|
+ } else {
|
|
330
|
+ // 修改
|
|
331
|
+ this.editBuilding({
|
|
332
|
+ onSuccess: this.onCancel,
|
|
333
|
+ detail: JSON.stringify(building)
|
|
334
|
+ });
|
|
335
|
+ }
|
|
336
|
+ },
|
|
337
|
+ FormatDate(date) {
|
|
338
|
+ return (date || "").split("T")[0] === "0001-01-01"
|
|
339
|
+ ? ""
|
|
340
|
+ : (date || "").split("T")[0];
|
|
341
|
+ },
|
|
342
|
+ saveAparment() {
|
|
343
|
+ const imgs = this.aparmentImg.map((x, i) => {
|
376
|
344
|
return {
|
377
|
|
- name: x.imgId,
|
378
|
|
- url: x.url
|
|
345
|
+ imgType: "aparment",
|
|
346
|
+ url: x.url,
|
|
347
|
+ orderNo: i + 1
|
379
|
348
|
};
|
380
|
349
|
});
|
381
|
|
- this.tags = data.buildingTag.map(x => x.tagName);
|
382
|
|
- });
|
383
|
|
- } else {
|
384
|
|
- phoneEditor.txt.html("");
|
|
350
|
+ if (!this.aparmentInfo.apartmentId) {
|
|
351
|
+ this.addApartment(
|
|
352
|
+ JSON.stringify({
|
|
353
|
+ ...this.aparmentInfo,
|
|
354
|
+ img: imgs
|
|
355
|
+ })
|
|
356
|
+ ).then(() => {
|
|
357
|
+ this.getAparmentList();
|
|
358
|
+ this.showHx = false;
|
|
359
|
+ });
|
|
360
|
+ } else {
|
|
361
|
+ this.editApartment(
|
|
362
|
+ JSON.stringify({
|
|
363
|
+ ...this.aparmentInfo,
|
|
364
|
+ img: imgs
|
|
365
|
+ })
|
|
366
|
+ ).then(() => {
|
|
367
|
+ this.getAparmentList();
|
|
368
|
+ this.showHx = false;
|
|
369
|
+ });
|
|
370
|
+ }
|
|
371
|
+ },
|
|
372
|
+ addHx() {
|
|
373
|
+ this.aparmentImg = [];
|
|
374
|
+ this.aparmentInfo = { buildingId: this.building.buildingId };
|
|
375
|
+ this.showHx = true;
|
|
376
|
+ },
|
|
377
|
+ getAparmentList() {
|
|
378
|
+ this.getApartments({ buildingId: this.$route.query.id }).then(data => {
|
|
379
|
+ this.aparments = data;
|
|
380
|
+ });
|
|
381
|
+ },
|
|
382
|
+ handleEdit(row){
|
|
383
|
+ this.showPlace = row.name
|
|
384
|
+ this.popover4 = false
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+ },
|
|
388
|
+ // handleEdit(row) {
|
|
389
|
+ // this.aparmentImg = [];
|
|
390
|
+ // this.getApartmentDetail({
|
|
391
|
+ // id: row.apartmentId
|
|
392
|
+ // }).then(data => {
|
|
393
|
+ // console.log("...", data);
|
|
394
|
+ // this.aparmentImg = data.buildingImgList.map(x => {
|
|
395
|
+ // return {
|
|
396
|
+ // name: x.imgId,
|
|
397
|
+ // url: x.url
|
|
398
|
+ // };
|
|
399
|
+ // });
|
|
400
|
+ // this.aparmentInfo = data;
|
|
401
|
+ // this.showHx = true;
|
|
402
|
+ // });
|
|
403
|
+ // },
|
|
404
|
+ handleDel(row) { // 选择
|
|
405
|
+ this.form.targetId = row.dynamicId
|
|
406
|
+ this.showPlace = row.title
|
|
407
|
+ this.dialogTableVisible = false
|
|
408
|
+ },
|
|
409
|
+
|
|
410
|
+ showDial() { // 显示活动弹窗
|
|
411
|
+ this.dialogTableVisible = true
|
|
412
|
+ this.getActivityList()
|
|
413
|
+ },
|
|
414
|
+ getExtendContentById() {
|
|
415
|
+ this.$store.dispatch('carouselFigure/getByIdExtendContent', this.form).then((res) => {
|
|
416
|
+ console.log('carouselFigure/getByIdExtendContent', res)
|
|
417
|
+ this.form = res
|
|
418
|
+ this.imageUrl = res.image
|
|
419
|
+ this.showPlace = res.targetName
|
|
420
|
+ }).catch(() => {
|
|
421
|
+ console.log('carouselFigure/getByIdExtendContent err')
|
|
422
|
+ })
|
|
423
|
+ },
|
|
424
|
+ getBuildList() {
|
|
425
|
+ this.$store.dispatch('building/getBuildings', this.buildingForm).then((res) => {
|
|
426
|
+ this.buildingList = res.records
|
|
427
|
+ }).catch(() => {
|
|
428
|
+ console.log('building/getBuildings err')
|
|
429
|
+ })
|
|
430
|
+ },
|
|
431
|
+ getActivityList() { // 活动列表
|
|
432
|
+ this.$store.dispatch('activity/getActivityList',this.activityForm).then(res => {
|
|
433
|
+ this.activityList = res.list;
|
|
434
|
+ this.activityForm.pageSize = res.pageSize
|
|
435
|
+ this.activityForm.pageNum = res.pageNum
|
|
436
|
+ this.activityTotal = res.total
|
|
437
|
+ }).catch(err => {
|
|
438
|
+ this.$notify.error(err.msg || err.message);
|
|
439
|
+ });
|
|
440
|
+ },
|
|
441
|
+ dialogHandleSizeChange(value) {
|
|
442
|
+ this.activityForm.pageSize = value
|
|
443
|
+ this.getActivityList()
|
|
444
|
+ },
|
|
445
|
+ dialogHandleCurrentChange(value) {
|
|
446
|
+ this.activityForm.pageNum = value
|
|
447
|
+ this.getActivityList()
|
|
448
|
+ },
|
|
449
|
+ submitAddOrUpdate() { // 添加或者修改
|
|
450
|
+
|
|
451
|
+ // 添加
|
|
452
|
+ if (this.form.contentId === undefined || this.form.contentId === '') {
|
|
453
|
+ this.$store.dispatch('carouselFigure/addExtendContent', this.form).then((res) => {
|
|
454
|
+ this.$message.success('操作成功')
|
|
455
|
+ this.$router.go(-1)
|
|
456
|
+ }).catch(() => {
|
|
457
|
+
|
|
458
|
+ })
|
|
459
|
+ return
|
|
460
|
+ }
|
|
461
|
+
|
|
462
|
+ // 修改
|
|
463
|
+ this.$store.dispatch('carouselFigure/updateExtendContent', this.form).then((res) => {
|
|
464
|
+ this.$message.success('操作成功')
|
|
465
|
+ this.$router.go(-1)
|
|
466
|
+ }).catch(() => {
|
|
467
|
+ console.log('carouselFigure/updateExtendContent err')
|
|
468
|
+ })
|
|
469
|
+ },
|
|
470
|
+
|
|
471
|
+ },
|
|
472
|
+ created() {
|
|
473
|
+ this.form.contentId = this.$route.query.id
|
|
474
|
+ if (this.$route.query.id !== undefined) {
|
|
475
|
+ this.getExtendContentById()
|
|
476
|
+ }
|
|
477
|
+ this.getBuildList()
|
385
|
478
|
}
|
386
|
|
- }
|
387
|
|
-};
|
|
479
|
+ };
|
388
|
480
|
</script>
|
389
|
481
|
|
390
|
482
|
<style lang="scss">
|
391
|
|
-.header {
|
392
|
|
- width: 50px;
|
393
|
|
- height: 50px;
|
394
|
|
- img {
|
395
|
|
- width: 100%;
|
396
|
|
- height: 100%;
|
|
483
|
+ .header {
|
|
484
|
+ width: 50px;
|
|
485
|
+ height: 50px;
|
|
486
|
+ img {
|
|
487
|
+ width: 100%;
|
|
488
|
+ height: 100%;
|
|
489
|
+ }
|
397
|
490
|
}
|
398
|
|
-}
|
399
|
|
-.avatar-uploader .el-upload {
|
400
|
|
- border: 1px dashed #d9d9d9;
|
401
|
|
- border-radius: 6px;
|
402
|
|
- cursor: pointer;
|
403
|
|
- position: relative;
|
404
|
|
- overflow: hidden;
|
405
|
|
-}
|
406
|
|
-.avatar-uploader .el-upload:hover {
|
407
|
|
- border-color: #409eff;
|
408
|
|
-}
|
409
|
|
-.avatar-uploader-icon {
|
410
|
|
- font-size: 28px;
|
411
|
|
- color: #8c939d;
|
412
|
|
- width: 178px;
|
413
|
|
- height: 178px;
|
414
|
|
- line-height: 178px;
|
415
|
|
- text-align: center;
|
416
|
|
-}
|
417
|
|
-.avatar {
|
418
|
|
- width: 178px;
|
419
|
|
- height: 178px;
|
420
|
|
- display: block;
|
421
|
|
-}
|
422
|
|
-.edit-carousel {
|
423
|
|
- .el-select {
|
424
|
|
- max-width: 300px !important;
|
|
491
|
+ .avatar-uploader .el-upload {
|
|
492
|
+ border: 1px dashed #d9d9d9;
|
|
493
|
+ border-radius: 6px;
|
|
494
|
+ cursor: pointer;
|
|
495
|
+ position: relative;
|
|
496
|
+ overflow: hidden;
|
425
|
497
|
}
|
426
|
|
- .el-input {
|
427
|
|
- max-width: 400px;
|
|
498
|
+ .avatar-uploader .el-upload:hover {
|
|
499
|
+ border-color: #409eff;
|
428
|
500
|
}
|
429
|
|
- .publish {
|
430
|
|
- p {
|
431
|
|
- margin: 0;
|
432
|
|
- font-size: 15.4px;
|
433
|
|
- .choose {
|
434
|
|
- color: blue;
|
435
|
|
- margin-left: 15px;
|
|
501
|
+ .avatar-uploader-icon {
|
|
502
|
+ font-size: 28px;
|
|
503
|
+ color: #8c939d;
|
|
504
|
+ width: 178px;
|
|
505
|
+ height: 178px;
|
|
506
|
+ line-height: 178px;
|
|
507
|
+ text-align: center;
|
|
508
|
+ }
|
|
509
|
+ .avatar {
|
|
510
|
+ width: 178px;
|
|
511
|
+ height: 178px;
|
|
512
|
+ display: block;
|
|
513
|
+ }
|
|
514
|
+ .edit-carousel {
|
|
515
|
+ .el-select {
|
|
516
|
+ max-width: 300px !important;
|
|
517
|
+ }
|
|
518
|
+ .el-input {
|
|
519
|
+ max-width: 400px;
|
|
520
|
+ }
|
|
521
|
+ .publish {
|
|
522
|
+ p {
|
|
523
|
+ margin: 0;
|
|
524
|
+ font-size: 15.4px;
|
|
525
|
+ .choose {
|
|
526
|
+ color: blue;
|
|
527
|
+ margin-left: 15px;
|
|
528
|
+ }
|
436
|
529
|
}
|
437
|
530
|
}
|
438
|
531
|
}
|
439
|
|
-}
|
440
|
|
-.el-popover {
|
441
|
|
- z-index: 10004 !important;
|
442
|
|
- .el-table .cell{
|
443
|
|
- text-align: center;
|
|
532
|
+ .el-popover {
|
|
533
|
+ z-index: 10004 !important;
|
|
534
|
+ .el-table .cell{
|
|
535
|
+ text-align: center;
|
|
536
|
+ }
|
444
|
537
|
}
|
445
|
|
-}
|
446
|
538
|
|
447
|
|
-.el-select-dropdown {
|
448
|
|
- z-index: 10003 !important;
|
449
|
|
-}
|
|
539
|
+ .el-select-dropdown {
|
|
540
|
+ z-index: 10003 !important;
|
|
541
|
+ }
|
450
|
542
|
|
451
|
|
-.el-date-picker {
|
452
|
|
- z-index: 10002 !important;
|
453
|
|
-}
|
|
543
|
+ .el-date-picker {
|
|
544
|
+ z-index: 10002 !important;
|
|
545
|
+ }
|
454
|
546
|
</style>
|