forked from integrated_whb/integrated_whb_vue
修改地图图层
parent
15e017eda5
commit
53175a7546
|
@ -32,3 +32,4 @@ export const setPathPlanningDelete = (params) =>
|
||||||
export const setPositioning = (params) =>
|
export const setPositioning = (params) =>
|
||||||
post("/videomanager/setPositioning", params); // 摆放摄像头
|
post("/videomanager/setPositioning", params); // 摆放摄像头
|
||||||
export const setLayAdd = (params) => post("/positAlarm/save", params); // 新建图层
|
export const setLayAdd = (params) => post("/positAlarm/save", params); // 新建图层
|
||||||
|
export const setLayEdit = (params) => post("/positAlarm/edit", params); // 新建图层
|
||||||
|
|
|
@ -4,27 +4,28 @@
|
||||||
:title="type === 'add' ? '新增' : '修改'"
|
:title="type === 'add' ? '新增' : '修改'"
|
||||||
:on-close="fnClose"
|
:on-close="fnClose"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form ref="formRef" :rules="rules" :model="form" label-width="150px">
|
||||||
ref="formRef"
|
|
||||||
:rules="rules"
|
|
||||||
:model="data.form"
|
|
||||||
label-width="150px"
|
|
||||||
>
|
|
||||||
<el-form-item label="名称" prop="layName">
|
<el-form-item label="名称" prop="layName">
|
||||||
<el-input v-model="data.form.layName" />
|
<el-input v-model="form.layName" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分组" prop="layGroup">
|
<el-form-item label="分组" prop="layGroup">
|
||||||
<el-input v-model="data.form.layGroup" />
|
<el-input v-model="form.layGroup" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="楼层" prop="floor">
|
<el-form-item label="楼层" prop="floor">
|
||||||
<el-input v-model="data.form.floor" />
|
<el-input v-model="form.floor" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="list" prop="floor">
|
||||||
|
<el-input v-model="form.list" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="modUuid" prop="floor">
|
||||||
|
<el-input v-model="form.modUuid" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<map-tools
|
<map-tools
|
||||||
v-if="visible"
|
v-if="visible"
|
||||||
ref="mapToolsRef"
|
ref="mapToolsRef"
|
||||||
v-model:positions="positions"
|
v-model:positions="form.list"
|
||||||
v-model:modUuid="modUuid"
|
v-model:modUuid="form.modUuid"
|
||||||
:type="1"
|
:type="1"
|
||||||
/>
|
/>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
@ -39,8 +40,8 @@ import { useVModels } from "@vueuse/core";
|
||||||
import { debounce } from "throttle-debounce";
|
import { debounce } from "throttle-debounce";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import MapTools from "@/components/map_tools";
|
import MapTools from "@/components/map_tools";
|
||||||
import { reactive, ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { setLayAdd } from "@/request/map_settings.js";
|
import { setLayAdd, setLayEdit } from "@/request/map_settings.js";
|
||||||
import useFormValidate from "@/assets/js/useFormValidate.js";
|
import useFormValidate from "@/assets/js/useFormValidate.js";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -54,22 +55,20 @@ const props = defineProps({
|
||||||
required: true,
|
required: true,
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
});
|
|
||||||
const data = reactive({
|
|
||||||
form: {
|
form: {
|
||||||
layName: "",
|
type: Object,
|
||||||
layGroup: "",
|
required: true,
|
||||||
floor: "",
|
default: () => {},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const formRef = ref(null);
|
const formRef = ref(null);
|
||||||
const emits = defineEmits(["update:visible", "get-data"]);
|
const emits = defineEmits(["update:visible", "update:form", "get-data"]);
|
||||||
const rules = {
|
const rules = {
|
||||||
layName: [{ required: true, message: "名称不能为空", trigger: "blur" }],
|
layName: [{ required: true, message: "名称不能为空", trigger: "blur" }],
|
||||||
layGroup: [{ required: true, message: "分组不能为空", trigger: "blur" }],
|
layGroup: [{ required: true, message: "分组不能为空", trigger: "blur" }],
|
||||||
floor: [{ required: true, message: "楼层不能为空", trigger: "blur" }],
|
floor: [{ required: true, message: "楼层不能为空", trigger: "blur" }],
|
||||||
};
|
};
|
||||||
const { visible } = useVModels(props, emits);
|
const { visible, form } = useVModels(props, emits);
|
||||||
const fnClose = () => {
|
const fnClose = () => {
|
||||||
positions.value = [];
|
positions.value = [];
|
||||||
modUuid.value = "";
|
modUuid.value = "";
|
||||||
|
@ -82,14 +81,18 @@ const fnSubmit = debounce(
|
||||||
1000,
|
1000,
|
||||||
async () => {
|
async () => {
|
||||||
await useFormValidate(formRef);
|
await useFormValidate(formRef);
|
||||||
if (positions.value.length === 0 || modUuid.value === "") {
|
if (props.form.list.length === 0 || props.form.modUuid === "") {
|
||||||
ElMessage.error("未选择建筑,或者未扎点");
|
ElMessage.error("未选择建筑,或者未扎点");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await setLayAdd({
|
props.form.layId
|
||||||
...data.form,
|
? await setLayAdd({
|
||||||
list: JSON.stringify(positions.value),
|
...props.form,
|
||||||
modUuid: modUuid.value,
|
list: JSON.stringify(props.form.list),
|
||||||
|
})
|
||||||
|
: await setLayEdit({
|
||||||
|
...props.form,
|
||||||
|
list: JSON.stringify(props.form.list),
|
||||||
});
|
});
|
||||||
ElMessage.success("保存成功");
|
ElMessage.success("保存成功");
|
||||||
fnClose();
|
fnClose();
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
text
|
text
|
||||||
link
|
link
|
||||||
@click="fnAddOrEdit(row.layId, 'edit')"
|
@click="fnAddOrEdit(row, 'edit')"
|
||||||
>
|
>
|
||||||
修改图层
|
修改图层
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -73,6 +73,7 @@
|
||||||
<add
|
<add
|
||||||
v-model:visible="data.addOrEditDialog.visible"
|
v-model:visible="data.addOrEditDialog.visible"
|
||||||
:type="data.addOrEditDialog.type"
|
:type="data.addOrEditDialog.type"
|
||||||
|
:form="data.addOrEditDialog.form"
|
||||||
@get-data="fnResetPagination"
|
@get-data="fnResetPagination"
|
||||||
/>
|
/>
|
||||||
<edit-layer-info
|
<edit-layer-info
|
||||||
|
@ -102,8 +103,7 @@ const { list, searchForm, tableRef, pagination, fnGetData, fnResetPagination } =
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
addOrEditDialog: {
|
addOrEditDialog: {
|
||||||
visible: false,
|
visible: false,
|
||||||
layId: "",
|
form: {},
|
||||||
type: "",
|
|
||||||
},
|
},
|
||||||
editLayerInfoDialog: {
|
editLayerInfoDialog: {
|
||||||
visible: false,
|
visible: false,
|
||||||
|
@ -140,8 +140,8 @@ const fnBatchDelete = debounce(
|
||||||
},
|
},
|
||||||
{ atBegin: true }
|
{ atBegin: true }
|
||||||
);
|
);
|
||||||
const fnAddOrEdit = (layId, type) => {
|
const fnAddOrEdit = (row, type) => {
|
||||||
data.addOrEditDialog.layId = layId;
|
data.addOrEditDialog.form = row;
|
||||||
data.addOrEditDialog.type = type;
|
data.addOrEditDialog.type = type;
|
||||||
data.addOrEditDialog.visible = true;
|
data.addOrEditDialog.visible = true;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue