Blame view

admin-web-master/src/components/add/addcd.vue 14.1 KB
4373acf5   wesley88   1
1
2
  <template>
    <div>
a182f238   wesley88   1
3
      <el-form :model="ruleForm" :rules="rulesSt" ref="ruleForm" label-width="130px" class="demo-ruleForm">
4373acf5   wesley88   1
4
        <el-row :gutter="20">
a182f238   wesley88   1
5
6
7
8
9
10
11
12
          <el-col :span="12">
            <el-form-item label="场地名称" prop="venueName">
              <el-input v-model="ruleForm.venueName" placeholder="请输入"  maxlength="50"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="场地类型" prop="venueType">
              <el-select v-model="ruleForm.venueType" placeholder="请选择" style="width: 100%;">
04473319   wesley88   1
13
14
15
                <!-- <el-option label="草地" value="草地"></el-option> -->
                <el-option v-for="(item,index) in siteTypeList"
                :key="index" :label="item.label" :value="item.value"></el-option>
a182f238   wesley88   1
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="实际使用面积" prop="actualArea">
              <el-input v-model="ruleForm.actualArea" placeholder="请输入" >
                <template slot="append">M<sup>2</sup></template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="所属区域" prop="district">
              <el-select v-model="ruleForm.district" placeholder="请选择" style="width: 100%;">
                <el-option v-for="(item,index) in regionOptions"
                    :key="index" :label="item.label" :value="item.value"></el-option>
                </el-select>
            </el-form-item>
          </el-col>
        </el-row>
542e27d5   wesley88   1
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="所属绿道段" prop="belongingGreenwaySection">
              <el-select v-model="ruleForm.belongingGreenwaySection" placeholder="请选择"
                style="margin-top:5px;width: 100%;" @change="lvdaoSel">
                <el-option :label="item.name" :value="item.code" v-for="(item,index) in lvdaoList"
                  :key="index"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
  		
          <el-col :span="12">
            <el-form-item label="所属公园/步道" prop="belongingParkTrail">
              <el-select v-model="ruleForm.belongingParkTrail" placeholder="请选择" style="width: 100%;">
                <el-option :label="item.name" :value="item.code" v-for="(item,index) in gongyuanList"
                  :key="index"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
a182f238   wesley88   1
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="归属部门" prop="department">
              <el-input v-model="ruleForm.department" placeholder="请输入"  maxlength="50">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="负责人" prop="responsiblePerson">
              <el-input v-model="ruleForm.responsiblePerson" placeholder="请输入"  maxlength="20">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="联系人" prop="contact">
cf438595   wesley88   1
74
              <el-input v-model="ruleForm.contact" placeholder="请输入"  maxlength="50">
a182f238   wesley88   1
75
76
77
78
79
80
81
82
83
84
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联系电话" prop="phoneNumber">
              <el-input v-model="ruleForm.phoneNumber" placeholder="请输入"  maxlength="20">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
0c8ae4d9   wesley88   1
85
        <!-- <el-form-item label="详细位置" prop="detailedLocation">
a182f238   wesley88   1
86
87
          <el-input v-model="ruleForm.detailedLocation" placeholder="请输入"  maxlength="100">
          </el-input>
0c8ae4d9   wesley88   1
88
        </el-form-item> -->
c3f8e431   wesley88   1
89
        <el-form-item label="地图标点" prop="detailedLocation">
a182f238   wesley88   1
90
91
92
93
94
          <div style="width: 100%;height: 300px;">
            <newmap :isonloed="info.id?true:false" :lat="lat" :lng="lng" @updatecenter="updatecenter"></newmap>
          </div>
        </el-form-item>
        <el-form-item label="场地描述" prop="description">
1dbc0b2d   wesley88   1
95
96
          <!-- <el-input maxlength="200" show-word-limit rows="4" v-model="ruleForm.description" placeholder="请输入"
            type="textarea" /> -->
0e7a57c2   杨鑫   '最新'
97
            <wangEditor v-model="ruleForm.description" ref="editor" :height="200"></wangEditor>
a182f238   wesley88   1
98
99
100
101
102
103
104
105
106
        </el-form-item>
        <el-form-item label="规划图纸" prop="planningDrawing">
          <upimg filePath="cd" inputtype="planningDrawing" :value="ruleForm.planningDrawing" :cmpOption="{disabled:false,isSetCover:false}"
            @changimg="e=>changimg(e,'planningDrawing')"></upimg>
        </el-form-item>
        <el-form-item label="展示主图" prop="displayImage">
          <upimg  filePath="cd" inputtype="displayImage" :value="ruleForm.displayImage"
            @changimg="e=>changimg(e,'displayImage')"></upimg>
        </el-form-item>
440bccda   wesley88   1
107
108
        <el-form-item label="其他视频" prop="otherMedia">
          <upfile filePath="cd" inputtype="otherMedia" :value="ruleForm.otherMedia" @changimg="e=>changimg(e,'otherMedia')"></upfile>
a182f238   wesley88   1
109
        </el-form-item>
4373acf5   wesley88   1
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
        <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"
a182f238   wesley88   1
128
    import upfile from "@/components/fujianUpload/fujianList"
4373acf5   wesley88   1
129
130
131
132
133
134
135
    import {
      uploadUrl
    } from '@/utils/request'
    import {
      miniioupload
    } from '../../api/commodityLease.js'
    import {
4373acf5   wesley88   1
136
137
138
      changadd,
      changedit
    } from '../../api/information'
0c8ae4d9   wesley88   1
139
    import newmap from "@/components/newmap/indexall";
1dbc0b2d   wesley88   1
140
     import wangEditor from "@/components/editor/index"
542e27d5   wesley88   1
141
142
143
144
145
     import {
      lvdaoduan,
  	parkTrails,
    gongyuan
    } from '@/api/information.js';
4373acf5   wesley88   1
146
147
148
    export default {
      components: {
        upimg,
d64cd58f   wesley88   上传验收小程序
149
        MapMark,
a182f238   wesley88   1
150
        upfile,
1dbc0b2d   wesley88   1
151
152
        newmap,
        wangEditor
4373acf5   wesley88   1
153
154
155
      },
      data() {
        return {
542e27d5   wesley88   1
156
          
a182f238   wesley88   1
157
158
159
160
161
162
          lat: 30.67,
          lng: 104.06,
          ontype: '线上广告位',
          typelist: [{
              name: '线上广告位',
              vaule: '线上广告位'
4373acf5   wesley88   1
163
164
            },
            {
a182f238   wesley88   1
165
166
              name: '实体广告位',
              vaule: '实体广告位'
4373acf5   wesley88   1
167
168
169
170
171
172
            },
          ],
          //地图标点的经纬度
          mapData: {},
          uploadFileUrl: uploadUrl, // 请求地址
          ruleForm: {
a182f238   wesley88   1
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
            venueName: '', // 场地名称
            venueType: '', // 场地类型
            actualArea: '', // 实际使用面积(单位:平方米)
            district: '', // 所属区域
            department: '', // 归属部门
            responsiblePerson: '', // 负责人
            detailedLocation: '', // 详细位置
            mapMarker: '', // 地图标点(如经纬度)
            description: '', // 场地描述
            planningDrawing: '', // 规划图纸(二进制大对象)
            displayImage: '', // 展示主图(二进制大对象)
            otherMedia: '', // 其他图片/视频(可存储URL或路径)
            rentalStatus: '', // 租赁状态(0.待租  1.已租)
            publishStatus: '', // 发布状态
            contractNumber: '', // 合同编号
            contact: '', // 联系人
            phoneNumber: '', // 联系电话
            createDate: '', // 创建时间
            createUser: '', // 创建人
542e27d5   wesley88   1
192
193
            belongingGreenwaySection: '', // 所属绿道段
            belongingParkTrail: '', // 所属公园/步道
4373acf5   wesley88   1
194
195
          },
          rulesSt: {
542e27d5   wesley88   1
196
197
198
199
200
            belongingGreenwaySection: [{
              required: true,
              message: '请填写所属绿道段',
              trigger: 'blur'
            }, ],
4373acf5   wesley88   1
201
202
203
            venueName: [{
              required: true,
              message: '请输入场地名称',
a182f238   wesley88   1
204
              trigger: 'blur'
4373acf5   wesley88   1
205
206
207
208
            }, ],
            venueType: [{
              required: true,
              message: '请选择场地类型',
a182f238   wesley88   1
209
              trigger: 'change'
4373acf5   wesley88   1
210
211
212
213
            }, ],
            actualArea: [{
              required: true,
              message: '请输入实际使用面积',
a182f238   wesley88   1
214
              trigger: 'blur'
4373acf5   wesley88   1
215
216
217
218
            }, ],
            district: [{
              required: true,
              message: '请选择所属区域',
a182f238   wesley88   1
219
              trigger: 'change'
4373acf5   wesley88   1
220
221
222
            }],
            detailedLocation: [{
              required: true,
c3f8e431   wesley88   1
223
              message: '请地图标点选择位置',
a182f238   wesley88   1
224
225
226
227
228
229
230
231
232
233
234
235
              trigger: 'blur'
            }, ],
            mapMarker: [{
              required: true,
              message: '请选择地图标点',
              trigger: 'blur'
            }, ],
            displayImage: [{
              required: true,
              message: '请上传宣传图',
              trigger: 'change'
            }]
4373acf5   wesley88   1
236
237
238
239
          },
          uploadFiles: [],
          filesLength: 1,
          gongyuanList: [],
542e27d5   wesley88   1
240
          lvdaoList: [],
4373acf5   wesley88   1
241
242
243
244
245
          fileData: [],
          parentMessage: {},
          edit: true
        };
      },
a182f238   wesley88   1
246
247
      computed: {
        regionOptions() {
04473319   wesley88   1
248
249
250
251
          return this.$store.state.cent.regionList;
        },
        siteTypeList() {
          return this.$store.state.cent.siteTypeList;
a182f238   wesley88   1
252
253
        }
      },
4373acf5   wesley88   1
254
255
256
257
258
259
260
261
262
263
      props: {
        info: {
          type: Object,
          default: {}
        },
  
      },
      async created() {
        if (this.info && this.info.id) {
          this.ruleForm = this.info
a182f238   wesley88   1
264
265
266
267
          if (this.ruleForm.mapMarker) {
            this.lat = this.ruleForm.mapMarker.split(',')[0]
            this.lng = this.ruleForm.mapMarker.split(',')[1]
          }
4373acf5   wesley88   1
268
269
270
        } else {
  
        }
542e27d5   wesley88   1
271
272
273
        const lvdao = await lvdaoduan()
  	const gongyua  = await parkTrails() 
  	  this.lvdaoList = lvdao.data.concat(gongyua.data)
4373acf5   wesley88   1
274
275
      },
      methods: {
a182f238   wesley88   1
276
277
278
        
        updatecenter(e) {
          console.error('-----------', e)
0c8ae4d9   wesley88   1
279
280
281
282
          this.lat = e[0].lat
          this.lng = e[0].lng
          this.ruleForm.detailedLocation = JSON.stringify(e)
         
a182f238   wesley88   1
283
284
        },
        changimg(e, type) {
d64cd58f   wesley88   上传验收小程序
285
286
          this.ruleForm[type] = e
        },
a182f238   wesley88   1
287
        changeadvertisingType(e) {
4373acf5   wesley88   1
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
          console.error(e)
          this.ontype = e
        },
        //获取当前时间
        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() {
a182f238   wesley88   1
317
318
319
          if(this.lat) {
            this.ruleForm.mapMarker = this.lat + ',' + this.lng
          }
4373acf5   wesley88   1
320
321
322
323
          if (this.ruleForm.id) {
            this.$refs.ruleForm.validate((valid) => {
              console.log(valid)
              if (valid) {
a182f238   wesley88   1
324
                this.ruleForm.updateUser = localStorage.getItem('roleName')
4373acf5   wesley88   1
325
                this.ruleForm.updateDate = this.updateCurrentTime()
4373acf5   wesley88   1
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
                changedit(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;
              }
4373acf5   wesley88   1
347
348
349
350
351
            })
          } else {
            this.$refs.ruleForm.validate((valid) => {
              console.log(valid)
              if (valid) {
4373acf5   wesley88   1
352
                this.ruleForm.createDate = this.updateCurrentTime()
a182f238   wesley88   1
353
                this.ruleForm.createUser = localStorage.getItem('roleName')
4373acf5   wesley88   1
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
                this.ruleForm.rentalStatus = 0
                this.ruleForm.publishStatus = 0
                changadd(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')
        },
        hefuRemove() {
          this.hefuData = []
        },
        hefuSuccess(response, file, fileList) {
          this.fileData = []
          console.error(response)
          let fd = new FormData()
          fd.append('file', response.raw)
          fd.append('filePath', 'hetong')
          miniioupload(fd).then(res => {
            console.error(res)
            const fileMsg = {
              name: response.name,
              url: res.data,
            }
            this.fileData.push(fileMsg)
          })
        },
  
  
      },
    };
  </script>
  <style lang="scss">
    .el-upload {
      display: block;
      /* text-align: left; */
    }
  
    .video-uploader {
      .el-upload {
        text-align: left;
      }
    }
  
    .el-dialog__header {
      background-color: #F2F3F5;
      text-align: left;
    }
  
    .el-dialog__title {
      line-height: 30px;
      font-size: 15px;
      color: #303133;
    }
  </style>