|
|
@@ -31,12 +31,6 @@
|
|
|
<i slot="default" class="el-icon-plus"/>
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="描述">
|
|
|
- <el-input v-model="form.describe" type="textarea"/>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="简介">
|
|
|
- <el-input v-model="form.brief" type="textarea"/>
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="地址">
|
|
|
<el-input v-model="form.address"/>
|
|
|
</el-form-item>
|
|
|
@@ -52,6 +46,13 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+
|
|
|
+ <el-form-item label="简介">
|
|
|
+ <el-input v-model="form.brief" type="textarea" rows="10"/>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <div id="amapcontainer" style="width: 100%;height: 400px"/>
|
|
|
+
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="visible = false">取 消</el-button>
|
|
|
@@ -62,8 +63,9 @@
|
|
|
|
|
|
<script>
|
|
|
|
|
|
-import { save, updateById } from '@/api/role'
|
|
|
import { uploaderHandle } from '@/api/upload'
|
|
|
+import AMapLoader from '@amap/amap-jsapi-loader'
|
|
|
+import { save, updateById } from '@/api/bz/base/venue'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -72,10 +74,14 @@ export default {
|
|
|
isLoading: false,
|
|
|
listAllAuthorities: [],
|
|
|
form: {},
|
|
|
- fileList: []
|
|
|
+ fileList: [],
|
|
|
+ map: null,
|
|
|
+ marker: null,
|
|
|
+ lng: null,
|
|
|
+ lat: null
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
+ mounted() {
|
|
|
},
|
|
|
methods: {
|
|
|
uploaderHandle,
|
|
|
@@ -85,27 +91,65 @@ export default {
|
|
|
},
|
|
|
open(data) {
|
|
|
this.visible = true
|
|
|
- // this.fileList = [{ url: 'http://127.0.0.1:9800/src/2022/01/25/2ce4b244c380c7e178f982bad02d844c.png' }]
|
|
|
+ this.isLoading = false
|
|
|
this.form = Object.assign({}, data)
|
|
|
+ this.initMap()
|
|
|
+ },
|
|
|
+ initMap() {
|
|
|
+ const _this = this
|
|
|
+ AMapLoader.load({
|
|
|
+ key: '173fa0186964179b9c6f43d59f72172f',
|
|
|
+ version: '2.0',
|
|
|
+ plugins: ['AMap.ToolBar', 'AMap.Scale']
|
|
|
+ }).then((AMap) => {
|
|
|
+ this.map = new AMap.Map('amapcontainer', {
|
|
|
+ zoom: 15
|
|
|
+ })
|
|
|
+
|
|
|
+ _this.map.on('click', function(e) {
|
|
|
+ _this.lng = e.lnglat.lng
|
|
|
+ _this.lat = e.lnglat.lat
|
|
|
+ if (_this.marker) {
|
|
|
+ _this.marker.setPosition([e.lnglat.lng, e.lnglat.lat])
|
|
|
+ } else {
|
|
|
+ _this.marker = new AMap.Marker({
|
|
|
+ position: [e.lnglat.lng, e.lnglat.lat],
|
|
|
+ clickable: true,
|
|
|
+ map: _this.map
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(e => {
|
|
|
+ console.log(e)
|
|
|
+ })
|
|
|
},
|
|
|
handleSubmit() {
|
|
|
+ console.log(this.fileList)
|
|
|
+ console.log(this.lng)
|
|
|
+ console.log(this.lat)
|
|
|
console.log(this.form)
|
|
|
- // this.isLoading = true
|
|
|
- // if (this.form.id) {
|
|
|
- // updateById(this.form.id, this.form).then(() => {
|
|
|
- // this.visible = false
|
|
|
- // this.$emit('ok')
|
|
|
- // }).finally(() => {
|
|
|
- // this.isLoading = false
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // save(this.form).then(res => {
|
|
|
- // this.visible = false
|
|
|
- // this.$emit('ok')
|
|
|
- // }).finally(() => {
|
|
|
- // this.isLoading = false
|
|
|
- // })
|
|
|
- // }
|
|
|
+ const litpics = []
|
|
|
+ this.fileList.forEach(o => {
|
|
|
+ litpics.push(o.url)
|
|
|
+ })
|
|
|
+ this.isLoading = true
|
|
|
+ const param = { ...this.form, lng: this.lng, lat: this.lat, litpics }
|
|
|
+ if (this.form.id) {
|
|
|
+ console.log(param)
|
|
|
+ updateById(this.form.id, param).then(() => {
|
|
|
+ this.visible = false
|
|
|
+ this.$emit('ok')
|
|
|
+ }).finally(() => {
|
|
|
+ this.isLoading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ save(param).then(res => {
|
|
|
+ this.visible = false
|
|
|
+ this.$emit('ok')
|
|
|
+ }).finally(() => {
|
|
|
+ this.isLoading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|