修改地图图层

pull/1/head
dearlin 2024-02-26 16:42:30 +08:00
parent 28e6e12999
commit 15e017eda5
3 changed files with 59 additions and 3 deletions

View File

@ -31,3 +31,4 @@ export const setPathPlanningDelete = (params) =>
post("/positAlarm/coordinateLine/batchDelete", params); // 路径规划删除 post("/positAlarm/coordinateLine/batchDelete", 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); // 新建图层

View File

@ -529,10 +529,10 @@ const rules = {
{ required: true, message: "请选择入职日期", trigger: "change" }, { required: true, message: "请选择入职日期", trigger: "change" },
], ],
CARDNO: [ CARDNO: [
{ required: false, message: "请输入定位卡号(4位纯数字)", trigger: "blur" }, { required: false, message: "请输入定位卡号", trigger: "blur" },
{ {
pattern: /^-?[0-9]\d*$/, pattern: /^-?[0-9]\d*$/,
message: "请输入正确的定位卡号(4位纯数字)", message: "请输入正确的定位卡号",
trigger: "blur", trigger: "blur",
}, },
], ],

View File

@ -4,6 +4,29 @@
:title="type === 'add' ? '新增' : '修改'" :title="type === 'add' ? '新增' : '修改'"
:on-close="fnClose" :on-close="fnClose"
> >
<el-form
ref="formRef"
:rules="rules"
:model="data.form"
label-width="150px"
>
<el-form-item label="名称" prop="layName">
<el-input v-model="data.form.layName" />
</el-form-item>
<el-form-item label="分组" prop="layGroup">
<el-input v-model="data.form.layGroup" />
</el-form-item>
<el-form-item label="楼层" prop="floor">
<el-input v-model="data.form.floor" />
</el-form-item>
</el-form>
<map-tools
v-if="visible"
ref="mapToolsRef"
v-model:positions="positions"
v-model:modUuid="modUuid"
:type="1"
/>
<template #footer> <template #footer>
<el-button @click="fnClose"></el-button> <el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"></el-button> <el-button type="primary" @click="fnSubmit"></el-button>
@ -15,6 +38,10 @@
import { useVModels } from "@vueuse/core"; 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 { reactive, ref } from "vue";
import { setLayAdd } from "@/request/map_settings.js";
import useFormValidate from "@/assets/js/useFormValidate.js";
const props = defineProps({ const props = defineProps({
visible: { visible: {
@ -28,14 +55,42 @@ const props = defineProps({
default: "", default: "",
}, },
}); });
const data = reactive({
form: {
layName: "",
layGroup: "",
floor: "",
},
});
const formRef = ref(null);
const emits = defineEmits(["update:visible", "get-data"]); const emits = defineEmits(["update:visible", "get-data"]);
const rules = {
layName: [{ required: true, message: "名称不能为空", trigger: "blur" }],
layGroup: [{ required: true, message: "分组不能为空", trigger: "blur" }],
floor: [{ required: true, message: "楼层不能为空", trigger: "blur" }],
};
const { visible } = useVModels(props, emits); const { visible } = useVModels(props, emits);
const fnClose = () => { const fnClose = () => {
positions.value = [];
modUuid.value = "";
formRef.value.resetFields();
visible.value = false; visible.value = false;
}; };
const positions = ref([]);
const modUuid = ref("");
const fnSubmit = debounce( const fnSubmit = debounce(
1000, 1000,
async () => { async () => {
await useFormValidate(formRef);
if (positions.value.length === 0 || modUuid.value === "") {
ElMessage.error("未选择建筑,或者未扎点");
return;
}
await setLayAdd({
...data.form,
list: JSON.stringify(positions.value),
modUuid: modUuid.value,
});
ElMessage.success("保存成功"); ElMessage.success("保存成功");
fnClose(); fnClose();
emits("get-data"); emits("get-data");