forked from integrated_whb/integrated_whb_vue
修改地图图层
parent
28e6e12999
commit
15e017eda5
|
@ -31,3 +31,4 @@ export const setPathPlanningDelete = (params) =>
|
|||
post("/positAlarm/coordinateLine/batchDelete", params); // 路径规划删除
|
||||
export const setPositioning = (params) =>
|
||||
post("/videomanager/setPositioning", params); // 摆放摄像头
|
||||
export const setLayAdd = (params) => post("/positAlarm/save", params); // 新建图层
|
||||
|
|
|
@ -529,10 +529,10 @@ const rules = {
|
|||
{ required: true, message: "请选择入职日期", trigger: "change" },
|
||||
],
|
||||
CARDNO: [
|
||||
{ required: false, message: "请输入定位卡号(4位纯数字)", trigger: "blur" },
|
||||
{ required: false, message: "请输入定位卡号", trigger: "blur" },
|
||||
{
|
||||
pattern: /^-?[0-9]\d*$/,
|
||||
message: "请输入正确的定位卡号(4位纯数字)",
|
||||
message: "请输入正确的定位卡号",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
|
|
|
@ -4,6 +4,29 @@
|
|||
:title="type === 'add' ? '新增' : '修改'"
|
||||
: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>
|
||||
<el-button @click="fnClose">关闭</el-button>
|
||||
<el-button type="primary" @click="fnSubmit">保存</el-button>
|
||||
|
@ -15,6 +38,10 @@
|
|||
import { useVModels } from "@vueuse/core";
|
||||
import { debounce } from "throttle-debounce";
|
||||
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({
|
||||
visible: {
|
||||
|
@ -28,14 +55,42 @@ const props = defineProps({
|
|||
default: "",
|
||||
},
|
||||
});
|
||||
const data = reactive({
|
||||
form: {
|
||||
layName: "",
|
||||
layGroup: "",
|
||||
floor: "",
|
||||
},
|
||||
});
|
||||
const formRef = ref(null);
|
||||
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 fnClose = () => {
|
||||
positions.value = [];
|
||||
modUuid.value = "";
|
||||
formRef.value.resetFields();
|
||||
visible.value = false;
|
||||
};
|
||||
const positions = ref([]);
|
||||
const modUuid = ref("");
|
||||
const fnSubmit = debounce(
|
||||
1000,
|
||||
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("保存成功");
|
||||
fnClose();
|
||||
emits("get-data");
|
||||
|
|
Loading…
Reference in New Issue