更新
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="dialog" v-if="dialogForm">
|
||||
<div class="head_box">
|
||||
<span class="title">巡逻路线{{ title }}</span>
|
||||
<span class="title">保安视频库{{ title }}</span>
|
||||
<div>
|
||||
<el-button size="small" v-if="openType != 'detail'" @click="save" type="primary" :loading="loading">保存</el-button>
|
||||
<el-button size="small" @click="close">关闭</el-button>
|
||||
@ -9,36 +9,17 @@
|
||||
</div>
|
||||
<div class="cntinfo">
|
||||
<FormMessage ref="FormRef" v-model="listQuery" :disabled="openType == 'detail'" :rules="rules" :formList="formList">
|
||||
<template #jwd>
|
||||
<div class="flex align-center ww100">
|
||||
<el-input style="width: 48%;" v-model="listQuery.jd" placeholder="请选择经度"/>
|
||||
<el-input style="width: 48%;" v-model="listQuery.wd" placeholder="请选择纬度"/>
|
||||
<el-button type="primary" @click="changePoint">选择点位</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</FormMessage>
|
||||
<div class="mapBox relative">
|
||||
<GdMap></GdMap>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import emitter from "@/utils/eventBus.js";
|
||||
import GdMap from "@/components/GdMap/index.vue";
|
||||
import { qcckPost , qcckGet} from "@/api/qcckApi.js";
|
||||
import FormMessage from "@/components/aboutTable/FormMessage.vue";
|
||||
import { ref,defineProps, reactive,defineEmits,getCurrentInstance, onMounted } from 'vue';
|
||||
import { color } from "echarts";
|
||||
import { ref, reactive,defineEmits,getCurrentInstance } from 'vue';
|
||||
const emit = defineEmits(["refresh"]);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const props = defineProps({
|
||||
dic: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
});
|
||||
const dialogForm = ref(false);
|
||||
const title = ref('');
|
||||
const FormRef = ref();
|
||||
@ -46,32 +27,17 @@ const loading = ref(false);
|
||||
const listQuery = ref({});
|
||||
const openType = ref("")
|
||||
const rules = reactive({
|
||||
zsdMc: [{ required: true, message: "请输入值守点名称", trigger: "blur" }],
|
||||
spbt: [{ required: true, message: "请输入视频标题", trigger: "blur" }],
|
||||
});
|
||||
const formList = reactive([
|
||||
[
|
||||
{ label: "值守点名称", prop: "zsdMc", type: "input" },
|
||||
{ label: "所属辖区", prop: "ssbmdm", type: "department" },
|
||||
{ label: "视频标题", prop: "spbt", type: "input" },
|
||||
],
|
||||
[
|
||||
{ label: "地址", prop: "xxdz", type: "input"},
|
||||
],
|
||||
[
|
||||
{ label: "选择点位", prop: "jwd", type: "slot"},
|
||||
{ label: "附件", prop: "fjdz", type: "upload"},
|
||||
],
|
||||
])
|
||||
|
||||
// 获取数据
|
||||
onMounted(()=>{
|
||||
emitter.on("coordString", (res => {
|
||||
if(res.type == 'point') {
|
||||
listQuery.value.jd = res.coord[0];
|
||||
listQuery.value.wd = res.coord[1];
|
||||
let icon = require('@/assets/point/zsd1.png');
|
||||
emitter.emit("showPoint", { coords: [{jd:res.coord[0],wd:res.coord[1]}], icon, flag: 'bxd'});
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
// 初始化数据
|
||||
const init = (type, id,) => {
|
||||
@ -81,43 +47,20 @@ const init = (type, id,) => {
|
||||
if(id) getDateById(id)
|
||||
};
|
||||
|
||||
// 根据id获取数据
|
||||
const getDateById = (id) =>{
|
||||
emitter.emit("deletePointArea", 'bxd');
|
||||
qcckGet({id}, `/mosty-jbld/jbldzsd/selectByid`).then((res) => {
|
||||
listQuery.value = res || {};
|
||||
if(res.jd && res.wd){
|
||||
let icon = require('@/assets/point/zsd1.png');
|
||||
emitter.emit("showPoint", { coords: [{jd:res.jd,wd:res.wd}], icon, flag: 'bxd'});
|
||||
emitter.emit("setMapCenter", { location: [res.jd,res.wd], zoomLevel:12});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 选择点位
|
||||
const changePoint = () =>{
|
||||
listQuery.value.jd = ''
|
||||
listQuery.value.wd = ''
|
||||
emitter.emit("removePlot", 'point');
|
||||
emitter.emit("deletePointArea", 'bxd');
|
||||
emitter.emit("drawShape", { type: 'point', flag: 'point'});
|
||||
}
|
||||
|
||||
const save = () => {
|
||||
FormRef.value.submit(()=>{
|
||||
loading.value = true;
|
||||
let url = title.value == '新增' ? `/mosty-jbld/jbldzsd/add` : `/mosty-jbld/jbldzsd/update`;
|
||||
qcckPost(listQuery.value, url).then(() => {
|
||||
loading.value = false;
|
||||
// loading.value = true;
|
||||
// let url = title.value == '新增' ? `/mosty-jbld/jbldzsd/add` : `/mosty-jbld/jbldzsd/update`;
|
||||
// qcckPost(listQuery.value, url).then(() => {
|
||||
// loading.value = false;
|
||||
proxy.$message.success("保存成功");
|
||||
emit("refresh");
|
||||
// emit("refresh");
|
||||
close();
|
||||
}).catch(() => {
|
||||
loading.value = false;
|
||||
})
|
||||
// }).catch(() => {
|
||||
// loading.value = false;
|
||||
// })
|
||||
});
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
dialogForm.value = false;
|
||||
FormRef.value.reset()
|
||||
|
||||
Reference in New Issue
Block a user