地图设置

pull/1/head
LiuJiaNan 2024-02-23 09:06:53 +08:00
parent d977e8e4cb
commit 2e172df365
8 changed files with 596 additions and 1 deletions

View File

@ -85,7 +85,13 @@ export function post(url, params) {
res.data.result = "success"; res.data.result = "success";
} }
if (res.data.result === "success") { if (res.data.result === "success") {
resolve(res.data); if (res.config.url.split("/")[1] === "positAlarm") {
if (res.data.code === 200 || res.data.code === 0) resolve(res.data);
else {
ElMessage.error(res.data.msg || "系统开小差了");
reject(res.data);
}
} else resolve(res.data);
} else { } else {
ElMessage.error( ElMessage.error(
res.data.msg || res.data.msg ||

View File

@ -0,0 +1,17 @@
import { post } from "@/request/axios.js";
export const getLayerSettingsList = (params) =>
post("/positAlarm/list", params); // 图层设置列表
export const getLayerSettingsView = (params) =>
post("/positAlarm/goEdit", params); // 图层设置查看
export const setLayerSettingsDelete = (params) =>
post("/positAlarm/remove", params); // 图层设置删除
export const setLayerSettingsAdd = (params) => post("/positAlarm/save", params); // 图层设置新增
export const setLayerSettingsEdit = (params) =>
post("/positAlarm/edit", params); // 图层设置编辑
export const getAssignmentTicketAreaSettingsList = (params) =>
post("/positAlarm/otherRegion/list", params); // 作业票区域设置列表
export const setAssignmentTicketAreaSettingsDeactivateOrEnable = (params) =>
post("/positAlarm/otherRegion/editStatus", params); // 作业票区域设置停用启用
export const setAssignmentTicketAreaSettingsDelete = (params) =>
post("/positAlarm/otherRegion/regionDelete", params); // 作业票区域设置删除

View File

@ -0,0 +1,74 @@
<template>
<el-dialog
v-model="visible"
:title="type === 'add' ? '新增' : '修改'"
:on-close="fnClose"
>
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="名称" prop="regName">
<el-input v-model="form.regName" />
</el-form-item>
<el-form-item label="所属图层" prop="layId">
<el-input v-model="form.layId" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"></el-button>
</template>
</el-dialog>
</template>
<script setup>
import { useVModels } from "@vueuse/core";
import { debounce } from "throttle-debounce";
import { ElMessage } from "element-plus";
import { ref } from "vue";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { setLayerSettingsEdit } from "@/request/map_settings.js";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
form: {
type: Object,
required: true,
default: () => ({}),
},
type: {
type: String,
required: true,
default: "",
},
});
const emits = defineEmits(["update:visible", "update:form", "get-data"]);
const { visible, form } = useVModels(props, emits);
const rules = {
regName: [{ required: true, message: "请输入名称", trigger: "blur" }],
layId: [{ required: true, message: "请新增所属图层", trigger: "change" }],
};
const formRef = ref(null);
const fnClose = () => {
formRef.value.resetFields();
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
await setLayerSettingsEdit({
...form.value,
list: JSON.stringify(form.value.list),
});
ElMessage.success("保存成功");
fnClose();
emits("get-data");
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,38 @@
<template>
<el-dialog v-model="visible" title="选点" :on-close="fnClose">
<template #footer>
<el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"></el-button>
</template>
</el-dialog>
</template>
<script setup>
import { useVModels } from "@vueuse/core";
import { debounce } from "throttle-debounce";
import { ElMessage } from "element-plus";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
});
const emits = defineEmits(["update:visible", "get-data"]);
const { visible } = useVModels(props, emits);
const fnClose = () => {
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
ElMessage.success("保存成功");
fnClose();
emits("get-data");
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,188 @@
<template>
<div>
<el-card>
<el-form
:model="searchForm"
label-width="60px"
@submit.prevent="fnResetPagination"
>
<el-row>
<el-col :span="6">
<el-form-item label="关键字" prop="str">
<el-input v-model="searchForm.str" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="30px">
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="fnResetPagination">
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
ref="tableRef"
v-model:pagination="pagination"
row-key="id"
:data="list"
@get-data="fnGetData"
>
<el-table-column reserve-selection type="selection" width="55" />
<el-table-column label="序号" width="70">
<template #default="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column label="名称" prop="regName" />
<el-table-column label="类型"> 作业票区域 </el-table-column>
<el-table-column label="所属图层" prop="layName" />
<el-table-column label="定位状态" width="100">
<template #default="{ row }">
{{ row.list.length > 0 ? "已定位" : "未选点" }}
</template>
</el-table-column>
<el-table-column label="状态" width="100">
<template #default="{ row }">
{{ row.status === "1" ? "停用" : "启用" }}
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template #default="{ row }">
<el-button
v-if="row.list.length === 0"
type="primary"
text
link
@click="fnSelectingPoints(row.id)"
>
选点
</el-button>
<el-button
type="primary"
text
link
@click="
fnDeactivateOrEnable(row.id, row.status === '1' ? '0' : '1')
"
>
{{ row.status === "1" ? "启用" : "停用" }}
</el-button>
<el-button
type="primary"
text
link
@click="fnAddOrEdit(row.id, 'edit')"
>
修改
</el-button>
<el-button type="primary" text link @click="fnDelete(row.id)">
删除
</el-button>
</template>
</el-table-column>
<template #button>
<el-button type="primary" @click="fnAddOrEdit('', 'add')">
新增
</el-button>
<el-button type="danger" @click="fnBatchDelete"></el-button>
</template>
</layout-table>
</layout-card>
<add
v-model:visible="data.addOrEditDialog.visible"
v-model:form="data.addOrEditDialog.form"
:type="data.addOrEditDialog.type"
@get-data="fnResetPagination"
/>
<selecting-points
v-model:visible="data.selectingPointsDialog.visible"
@get-data="fnResetPagination"
/>
</div>
</template>
<script setup>
import useListData from "@/assets/js/useListData.js";
import {
getAssignmentTicketAreaSettingsList,
setAssignmentTicketAreaSettingsDeactivateOrEnable,
setAssignmentTicketAreaSettingsDelete,
} from "@/request/map_settings.js";
import { serialNumber } from "@/assets/js/utils.js";
import { debounce } from "throttle-debounce";
import { ElMessage, ElMessageBox } from "element-plus";
import { reactive } from "vue";
import Add from "./components/add.vue";
import SelectingPoints from "./components/selecting_points.vue";
const { list, searchForm, tableRef, pagination, fnGetData, fnResetPagination } =
useListData(getAssignmentTicketAreaSettingsList, {
otherParams: { type: 1 },
key: "rows",
});
const data = reactive({
addOrEditDialog: {
visible: false,
type: "",
form: {
regName: "",
layId: "",
},
},
selectingPointsDialog: {
id: "",
visible: false,
},
});
const fnDeactivateOrEnable = debounce(
1000,
async (id, status) => {
const message = status === "1" ? "停用" : "启用";
await ElMessageBox.confirm(`确定要${message}吗?`, { type: "warning" });
await setAssignmentTicketAreaSettingsDeactivateOrEnable({ id, status });
ElMessage.success(`${message}成功`);
fnResetPagination();
},
{ atBegin: true }
);
const fnDelete = debounce(
1000,
async (DATA_IDS) => {
await ElMessageBox.confirm("确定要删除吗?", { type: "warning" });
await setAssignmentTicketAreaSettingsDelete({ DATA_IDS });
ElMessage.success("删除成功");
fnResetPagination();
},
{ atBegin: true }
);
const fnBatchDelete = debounce(
1000,
async () => {
const selectionData = tableRef.value.getSelectionRows();
if (selectionData.length === 0) {
ElMessage.warning("请选中要删除的项");
return;
}
await ElMessageBox.confirm("确定要删除选中的数据吗?", { type: "warning" });
const DATA_IDS = selectionData.map((item) => item.id).join(",");
await setAssignmentTicketAreaSettingsDelete({ DATA_IDS });
ElMessage.success("删除成功");
fnResetPagination();
},
{ atBegin: true }
);
const fnAddOrEdit = (id, type) => {
data.addOrEditDialog.type = type;
data.addOrEditDialog.visible = true;
};
const fnSelectingPoints = (id) => {
data.selectingPointsDialog.id = id;
data.selectingPointsDialog.visible = true;
};
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,47 @@
<template>
<el-dialog
v-model="visible"
:title="type === 'add' ? '新增' : '修改'"
:on-close="fnClose"
>
<template #footer>
<el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"></el-button>
</template>
</el-dialog>
</template>
<script setup>
import { useVModels } from "@vueuse/core";
import { debounce } from "throttle-debounce";
import { ElMessage } from "element-plus";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
type: {
type: String,
required: true,
default: "",
},
});
const emits = defineEmits(["update:visible", "get-data"]);
const { visible } = useVModels(props, emits);
const fnClose = () => {
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
ElMessage.success("保存成功");
fnClose();
emits("get-data");
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,69 @@
<template>
<el-dialog v-model="visible" title="编辑图层信息" :on-close="fnClose">
<el-form ref="formRef" :model="form" :rules="rules" label-width="60px">
<el-form-item label="名称" prop="layName">
<el-input v-model="form.layName" />
</el-form-item>
<el-form-item label="分组" prop="layGroup">
<el-input v-model="form.layGroup" />
</el-form-item>
<el-form-item label="楼层" prop="floor">
<el-input v-model="form.floor" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"></el-button>
</template>
</el-dialog>
</template>
<script setup>
import { useVModels } from "@vueuse/core";
import { debounce } from "throttle-debounce";
import { ElMessage } from "element-plus";
import { ref } from "vue";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { setLayerSettingsEdit } from "@/request/map_settings.js";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
form: {
type: Object,
required: true,
default: () => ({}),
},
});
const emits = defineEmits(["update:visible", "update:form", "get-data"]);
const { visible, form } = useVModels(props, emits);
const rules = {
layName: [{ required: true, message: "请输入名称", trigger: "blur" }],
layGroup: [{ required: true, message: "请输入分组", trigger: "blur" }],
floor: [{ required: true, message: "请输入楼层", trigger: "blur" }],
};
const formRef = ref(null);
const fnClose = () => {
formRef.value.resetFields();
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
await setLayerSettingsEdit({
...form.value,
list: JSON.stringify(form.value.list),
});
ElMessage.success("保存成功");
fnClose();
emits("get-data");
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,156 @@
<template>
<div>
<el-card>
<el-form
:model="searchForm"
label-width="60px"
@submit.prevent="fnResetPagination"
>
<el-row>
<el-col :span="6">
<el-form-item label="关键字" prop="str">
<el-input v-model="searchForm.str" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="30px">
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="fnResetPagination">
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
ref="tableRef"
v-model:pagination="pagination"
row-key="layId"
:data="list"
@get-data="fnGetData"
>
<el-table-column reserve-selection type="selection" width="55" />
<el-table-column label="序号" width="70">
<template #default="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column label="名称" prop="layName" />
<el-table-column label="区域分组" prop="layGroup" />
<el-table-column label="操作" width="230">
<template #default="{ row }">
<el-button
type="primary"
text
link
@click="fnEditLayerInfo(row.layId)"
>
修改图层信息
</el-button>
<el-button
type="primary"
text
link
@click="fnAddOrEdit(row.layId, 'edit')"
>
修改图层
</el-button>
<el-button type="primary" text link @click="fnDelete(row.layId)">
删除
</el-button>
</template>
</el-table-column>
<template #button>
<el-button type="primary" @click="fnAddOrEdit('', 'add')">
新增
</el-button>
<el-button type="danger" @click="fnBatchDelete"></el-button>
</template>
</layout-table>
</layout-card>
<add
v-model:visible="data.addOrEditDialog.visible"
:type="data.addOrEditDialog.type"
@get-data="fnResetPagination"
/>
<edit-layer-info
v-model:visible="data.editLayerInfoDialog.visible"
v-model:form="data.editLayerInfoDialog.form"
@get-data="fnResetPagination"
/>
</div>
</template>
<script setup>
import useListData from "@/assets/js/useListData.js";
import {
getLayerSettingsList,
getLayerSettingsView,
setLayerSettingsDelete,
} from "@/request/map_settings.js";
import { serialNumber } from "@/assets/js/utils.js";
import { debounce } from "throttle-debounce";
import { ElMessage, ElMessageBox } from "element-plus";
import { nextTick, reactive } from "vue";
import Add from "./components/add.vue";
import EditLayerInfo from "./components/edit_layer_info.vue";
const { list, searchForm, tableRef, pagination, fnGetData, fnResetPagination } =
useListData(getLayerSettingsList);
const data = reactive({
addOrEditDialog: {
visible: false,
layId: "",
type: "",
},
editLayerInfoDialog: {
visible: false,
form: {
layName: "",
layGroup: "",
floor: "",
},
},
});
const fnDelete = debounce(
1000,
async (DATA_IDS) => {
await ElMessageBox.confirm("确定要删除吗?", { type: "warning" });
await setLayerSettingsDelete({ DATA_IDS });
ElMessage.success("删除成功");
fnResetPagination();
},
{ atBegin: true }
);
const fnBatchDelete = debounce(
1000,
async () => {
const selectionData = tableRef.value.getSelectionRows();
if (selectionData.length === 0) {
ElMessage.warning("请选中要删除的项");
return;
}
await ElMessageBox.confirm("确定要删除选中的数据吗?", { type: "warning" });
const DATA_IDS = selectionData.map((item) => item.layId).join(",");
await setLayerSettingsDelete({ DATA_IDS });
ElMessage.success("删除成功");
fnResetPagination();
},
{ atBegin: true }
);
const fnAddOrEdit = (layId, type) => {
data.addOrEditDialog.layId = layId;
data.addOrEditDialog.type = type;
data.addOrEditDialog.visible = true;
};
const fnEditLayerInfo = async (layId) => {
data.editLayerInfoDialog.visible = true;
await nextTick();
const resData = await getLayerSettingsView({ layId });
data.editLayerInfoDialog.form = resData.data;
};
</script>
<style scoped lang="scss"></style>