|
@@ -11,18 +11,29 @@
|
|
|
custom-class="xl-dialog"
|
|
|
center
|
|
|
>
|
|
|
- <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="100px">
|
|
|
+ <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="100px" :insertSlotArr="[4]">
|
|
|
+ <div slot="OI4" class="scoped-other-form">
|
|
|
+ <el-form-item label="点位坐标" class="scoped-item-two">
|
|
|
+ N<el-input v-model="cObj.latitude" disabled />
|
|
|
+ E<el-input v-model="cObj.longitude" disabled />
|
|
|
+ <el-button type="primary" class="map-btn" size="small" @click="openMap">点击从地图获取</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
<div slot="footer" style="padding-top: 20px;">
|
|
|
<el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
|
|
|
<el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
|
|
|
</div>
|
|
|
</base-form>
|
|
|
</el-dialog>
|
|
|
+ <handle-map :is-show="isShowMap" @close="closeMap" />
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import handleMap from '@/components/Common/Map'
|
|
|
export default {
|
|
|
- components: { },
|
|
|
+ components: {
|
|
|
+ handleMap
|
|
|
+ },
|
|
|
mixins,
|
|
|
props: {
|
|
|
isShow: Boolean,
|
|
@@ -31,24 +42,61 @@ export default {
|
|
|
inject: ['parentData'],
|
|
|
data() {
|
|
|
return {
|
|
|
+ isShowMap: false,
|
|
|
formData: [],
|
|
|
loading: true,
|
|
|
+ cObj: {},
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
isShow: function(val) {
|
|
|
if (val) {
|
|
|
- this.getDef()
|
|
|
+ if (this.curObj.id) {
|
|
|
+ this.$api.other.admareainfodetail({
|
|
|
+ id: this.curObj.id
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.cObj = {...res}
|
|
|
+ this.getDef()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.getDef()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ openMap() { // 定位
|
|
|
+ this.isShowMap = true
|
|
|
+ const pointObj = {
|
|
|
+ latitude: this.cObj.latitude || '',
|
|
|
+ longitude: this.cObj.longitude || '',
|
|
|
+ }
|
|
|
+ this.$root.$emit('handleMap', pointObj)
|
|
|
+ },
|
|
|
+ closeMap(obj) {
|
|
|
+ if (obj) {
|
|
|
+ const oldform = this.$refs.ruleForm.baseForm
|
|
|
+ const newForm = { ...oldform, ...obj }
|
|
|
+ this.cObj = newForm
|
|
|
+ this.setDefaultValue(newForm)
|
|
|
+ }
|
|
|
+ this.isShowMap = false
|
|
|
+ },
|
|
|
getDef() {
|
|
|
- let params = { ...this.curObj }
|
|
|
+ let params = { ...this.cObj }
|
|
|
+ let disabled = false
|
|
|
+ if (this.cObj.id) disabled = true
|
|
|
this.formData = [
|
|
|
- { label: '区域', key: 'area_type', type: 'select', class: 'c-2', options: this.$dictData.area_type },
|
|
|
- { label: '区域图', key: 'pri_image', type: 'uploads' },
|
|
|
+ { label: '区域名', key: 'area_name'},
|
|
|
+ { label: '区域图', key: 'pri_image', type: 'uploads', class: 'c-2' },
|
|
|
+ { label: '上级区域', key: 'parent_id', type: 'selectRemote', class: 'c-2', disabled,
|
|
|
+ remoteParams: { skey: 'area_name', api: `other.admareainfolist`, opKey: 'area_name', opVal: 'id' },
|
|
|
+ remoteOptions: [{ keyRO: params.parent_name, valRO: params.parent_id }]
|
|
|
+ },
|
|
|
{ label: '描述', key: 'remark', type: 'textarea'},
|
|
|
+ { label: '预设1', key: 'option1', class: 'c-2'},
|
|
|
+ { label: '预设2', key: 'option2', class: 'c-2'},
|
|
|
]
|
|
|
this.setDefaultValue(params)
|
|
|
},
|
|
@@ -60,7 +108,14 @@ export default {
|
|
|
const newForm = { ...oldform }
|
|
|
if (this.curObj.id) newForm.id = this.curObj.id
|
|
|
let apiStr = 'admareainfoadd'
|
|
|
- if (newForm.id) apiStr = 'admareainfoedit'
|
|
|
+ if (newForm.id) {
|
|
|
+ apiStr = 'admareainfoedit'
|
|
|
+ delete newForm.parent_id
|
|
|
+ }
|
|
|
+ newForm.longitude = this.cObj.longitude
|
|
|
+ newForm.latitude = this.cObj.latitude
|
|
|
+ if (!newForm.longitude) return this.$msgw('请选择经度!')
|
|
|
+ else if (!newForm.latitude) return this.$msgw('请选择纬度!')
|
|
|
this.$api.other[apiStr](newForm).then(data => {
|
|
|
this.$msgs(newForm.id ? '编辑成功' : '新增成功')
|
|
|
this.$emit('close', newForm)
|
|
@@ -69,6 +124,7 @@ export default {
|
|
|
})
|
|
|
} else {
|
|
|
this.$emit('close')
|
|
|
+ this.cObj = {}
|
|
|
this.setDefaultValue()
|
|
|
}
|
|
|
},
|
|
@@ -88,34 +144,32 @@ export default {
|
|
|
}
|
|
|
::v-deep .img-upload {
|
|
|
height: 180px;
|
|
|
+ height: 110px;
|
|
|
overflow: hidden;
|
|
|
.icon {
|
|
|
- width: 278px;
|
|
|
+ width: 180px;
|
|
|
+ height: 100px;
|
|
|
+ line-height: 100px;
|
|
|
}
|
|
|
.img {
|
|
|
- width: 278px;
|
|
|
+ width: 180px;
|
|
|
}
|
|
|
}
|
|
|
-.scoped-tips {
|
|
|
- position: absolute;
|
|
|
- width: 110px;
|
|
|
- top: 160px;
|
|
|
- right: 150px;
|
|
|
- color: #666;
|
|
|
- font-size: 14px;
|
|
|
- .s {
|
|
|
- display: block;
|
|
|
- color: #f15264;
|
|
|
- font-weight: bold;
|
|
|
+
|
|
|
+
|
|
|
+.scoped-other-form {
|
|
|
+ .map-btn{
|
|
|
+ display: inline-block;
|
|
|
+ vertical-align: bottom;
|
|
|
+ height: 36px;
|
|
|
+ }
|
|
|
+ .scoped-item-two {
|
|
|
+ .el-input {
|
|
|
+ display: inline-block;
|
|
|
+ vertical-align: bottom;
|
|
|
+ width: 140px;
|
|
|
+ margin: 0 10px;
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
-.scoped-tips2 {
|
|
|
- position: absolute;
|
|
|
- width: 260px;
|
|
|
- top: 350px;
|
|
|
- right: 0;
|
|
|
- color: #f15264;
|
|
|
- font-size: 14px;
|
|
|
- font-weight: bold;
|
|
|
}
|
|
|
</style>
|