4373acf5
wesley88
1
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
|
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="其他图片/视频" prop="otherImageVideos">
<el-upload :auto-upload="false" class="video-uploader" :action="uploadFileUrl" :on-remove="hefuRemove"
:on-change="hefuSuccess" :file-list="fileData">
<el-button style="background-color: #fff;color: #3F9B6A;border: 1px solid #dcdfe6;" class="buttonHover"
v-if="fileData.length==0">+点击上传</el-button>
<!-- <div v-if="fileData.length==0" slot="tip" class="el-upload__tip">(不超过50M,格式支持word、excel、ppt、pdf)</div> -->
</el-upload>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item>
<div style="margin-top: 20px">
<el-button @click="add()" style="background-color: #3F9B6A;color: #fff;">确定</el-button>
<el-button @click="close()" class="buttonHover"
style="color: #606266;border: 1px solid #DBDBDB;background-color: #fff;">取消</el-button>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import MapMark from "@/components/MapContainer/MapMark";
import upimg from "@/components/ImageUpload/index"
import {
uploadUrl
} from '@/utils/request'
import {
miniioupload
} from '../../api/commodityLease.js'
import {
gongyuan,
lvdaoduan,
addList,
editList
} from '../../api/information.js';
export default {
components: {
upimg,
MapMark
},
data() {
return {
uploadFileUrl: uploadUrl, // 请求地址
ruleForm: {
shopName: '',
venueNumber: '',
houseNumber: '',
architecturalForm: '',
actualUsableArea: '',
belongingRegion: '',
belongingDepartment: '',
head: '',
detailedLocation: '',
mapPunctuation: '',
shopDescription: '',
belongingGreenwaySection: '',
belongingParkTrail: '',
floorSpace: ''
},
rulesHetong: {
shopName: [{
required: true,
message: '请输入商铺名称',
trigger: 'blur'
}, ],
houseNumber: [{
required: true,
message: '请输入门牌号',
trigger: 'blur'
}, ],
architecturalForm: [{
required: true,
message: '请选择建筑形式',
trigger: 'change'
}],
actualUsableArea: [{
required: true,
message: '请输入实际使用面积',
trigger: 'blur'
}],
belongingRegion: [{
required: true,
message: '请选择所属区域',
trigger: 'change'
}],
head: [{
required: true,
message: '请输入负责人',
trigger: 'blur'
}, ],
detailedLocation: [{
required: true,
message: '请输入详细位置',
trigger: 'blur'
}, ],
// displayMainImage: [{
// required: true,
// message: '请上传主图',
// trigger: 'blur'
// }, ],
// belongingGreenwaySection: [{
// required: true,
// message: '请选择所属绿道段',
// trigger: 'change'
// }],
},
uploadFiles: [],
filesLength: 1,
lvdaoList: [],
gongyuanList: [],
fileData: [],
parentMessage:{},
edit:true
};
},
props: {
info: {
type: Object,
default: {}
}
},
async created() {
console.error(this.info)
if (this.info.id) {
this.ruleForm = this.info
this.fileData = []
if (typeof this.info.mapPunctuation == 'string') {
this.parentMessage = JSON.parse(this.info.mapPunctuation)
} else {
this.parentMessage = this.info.mapPunctuation
}
const fileMsg = {
name: '文件',
url: this.info.otherImageVideos
}
// 将文件地址存储在 uploadedFiles 数组中
this.fileData.push(fileMsg)
this.$nextTick(() => {
this.edit = false
})
}
const lvdao = await lvdaoduan()
this.lvdaoList = lvdao.data
},
methods: {
//获取当前时间
updateCurrentTime() {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
//获取地图点击的经纬度
getChildDate(mapData) {
this.mapData = mapData
},
lvdaoSel(vaule) {
this.ruleForm.belongingParkTrail = ''
this.gongyuan(vaule)
},
async gongyuan(value) {
const gongyaun = await gongyuan()
this.gongyuanList = gongyaun.data.filter(item => item.superior == value);
},
add() {
if (this.ruleForm.id) {
this.$refs.heForm.validate((valid) => {
console.log(valid)
if (valid) {
if (this.fileData.length != 0) {
this.ruleForm.otherImageVideos = this.fileData[0].url
}
this.ruleForm.updateDate = this.updateCurrentTime()
// if (Object.keys(this.mapData).length != 0) {
// this.ruleForm.mapPunctuation = JSON.stringify(this.mapData)
// }
editList(this.ruleForm).then(res => {
if (res.code == 200) {
this.$message({
message: '修改成功',
type: 'success'
})
this.$emit('removeonaction', '1')
} else {
this.$message({
message: res.msg,
type: 'error'
})
}
})
} else {
this.$message({
message: '请填写完整信息',
type: 'error'
})
return false;
}
})
} else {
this.$refs.heForm.validate((valid) => {
console.log(valid)
if (valid) {
if (this.fileData.length != 0) {
this.ruleForm.otherImageVideos = this.fileData[0].url
}
this.ruleForm.createDate = this.updateCurrentTime()
this.ruleForm.mapPunctuation = JSON.stringify(this.mapData)
this.ruleForm.rentalStatus = 0
this.ruleForm.publishStatus = 0
addList(this.ruleForm).then(res => {
if (res.code == 200) {
this.$message({
message: '添加成功',
type: 'success'
})
this.$emit('removeonaction', '1')
} else {
this.$message({
message: res.msg,
type: 'error'
})
}
})
} else {
this.$message({
message: '请填写完整信息',
type: 'error'
})
return false;
}
})
}
},
close() {
this.$emit('removeonaction', '1')
},
|