fix: 区域管理的编辑的修改

This commit is contained in:
100011797 2023-10-27 10:19:21 +08:00
parent 67309da698
commit 6c1917d9c3
3 changed files with 65 additions and 27 deletions

View File

@ -1,21 +1,45 @@
<template> <template>
<j-button v-if="!_value.length" type="link">请在地图上描点</j-button> <j-button @click="onClick" v-if="!_value.length" type="link"
<div v-else> >请在地图上描点</j-button
已完成描点<j-button type="link">编辑</j-button> >
</div> <div v-else>已完成描点<j-button type="link" @click="onEdit">编辑</j-button></div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue" import { ref, watch, inject } from 'vue';
const props = defineProps({ const props = defineProps({
value: { value: {
type: Array, type: Array,
default: () => [] default: () => [],
} },
}) });
const emits = defineEmits(['update:value']) const emits = defineEmits(['update:value', 'close']);
const _value = ref<any[]>([]) const _value = ref<any[]>([]);
const __data: any = inject('system-region')
const onClick = () => {
console.log(__data)
__data.type.value = 'edit'
emits('close')
};
const onEdit = () => {
// __data.type.value = 'edit'
// emits('close')
}
watch(
() => props.value,
() => {
console.log(props.value)
},
{
deep: true,
immediate: true,
},
);
</script> </script>

View File

@ -97,7 +97,7 @@
required required
name="features" name="features"
> >
<TracePoint v-model:value="modelRef.features" /> <TracePoint @close="emit('close')" v-model:value="modelRef.features" />
</j-form-item> </j-form-item>
</j-form> </j-form>
</div> </div>

View File

@ -1,15 +1,16 @@
<template> <template>
<page-container> <page-container>
<full-page> <full-page>
<div class="region"> <div class="region">
<div class="left"> <div class="left">
<LeftTree /> <LeftTree />
<div class="mask" v-if="type === 'edit'"></div>
</div>
<div class="right">
<Map :path="path" :type="mapType" />
</div>
</div> </div>
<div class="right"> </full-page>
<Map :path="path" type="create" />
</div>
</div>
</full-page>
</page-container> </page-container>
</template> </template>
@ -17,15 +18,17 @@
import LeftTree from './LeftTree/index.vue' import LeftTree from './LeftTree/index.vue'
import Map from './MapTool/map.vue' import Map from './MapTool/map.vue'
import FullPage from "components/Layout/FullPage.vue"; import FullPage from "components/Layout/FullPage.vue";
import { provide } from 'vue'
const searchValue = ref()
const current = ref<any>({})
const path = ref([[121.5273285, 31.21515044], [121.5293285, 31.21515044], [121.5293285, 31.21915044], [121.5273285, 31.21515044]]) const path = ref([[121.5273285, 31.21515044], [121.5293285, 31.21515044], [121.5293285, 31.21915044], [121.5273285, 31.21515044]])
const type = ref<'view' | 'edit'>('view')
const mapType = ref<string>('create')
const onSave = () => { provide('system-region', {
type,
} mapType: '',
path
})
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@ -37,12 +40,23 @@ const onSave = () => {
.left { .left {
width: 300px; width: 300px;
position: relative;
.btn { .btn {
width: 100%; width: 100%;
margin: 18px 0; margin: 18px 0;
} }
.mask {
width: 100%;
position: absolute;
height: 100%;
background-color: lightgray;
opacity: .5;
left: 0;
top: 0;
z-index: 10;
}
} }
.right { .right {
flex: 1; flex: 1;