feat:隐患点位

This commit is contained in:
lijianzhong 2024-01-30 17:05:58 +08:00
parent 0e2bff8038
commit 837ebd76e7
6 changed files with 410 additions and 31 deletions

View File

@ -204,7 +204,7 @@ export function delOtheWareHouse(data) {
*/
export function getOthplanPage(params) {
return request({
url: `admin/Othplan/getOthplanPage`,
url: `admin/Othplan/saveOthplan`,
method: "GET",
params: params
});

View File

@ -92,6 +92,17 @@ export default {
title: '应急预案',
breadcrumb: true, //是否显示面包屑
}
},
{
path: 'point',
name: 'point',
component: () => import('@/views/emergency/danger-points/index.vue'),
meta: {
icon: 'point',
auth: "emer.plan",
title: '隐患点位',
breadcrumb: true, //是否显示面包屑
}
}
]
}

View File

@ -0,0 +1,133 @@
<template>
<BaseDialog
:dialogVisible="props.visible"
@close="onclone"
:titleName="titleName + '隐患点'"
width="50%"
@onSubmit="handleSubmit"
:footerclosed="true"
:diafooter="true"
>
<div class="detailForm-content">
<el-form
ref="formRef"
label-width="120"
:rules="ruleForm"
:model="formData"
class="center-form"
>
<el-form-item label="点位名称" prop="name">
<el-input placeholder="请输入" type="input" v-model="formData.name" />
</el-form-item>
<el-form-item label="点位类型" prop="type">
<el-select
v-model="type"
@change="getList"
clearable
placeholder="请选择"
>
<el-option
v-for="item in types"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="详细地址" prop="address" style="width: 94%">
<el-input
placeholder="请输入"
type="input"
v-model="formData.address"
/>
</el-form-item>
<el-form-item label="简介/备注" prop="remarks" style="width: 94%">
<el-input
placeholder="请输入"
:rows="4"
type="textarea"
v-model="formData.remarks"
/></el-form-item>
</el-form>
</div>
</BaseDialog>
</template>
<script setup lang='ts'>
import { reactive, ref, onMounted, watch } from "vue";
import { ElMessage, FormInstance, FormRules } from "element-plus";
import { getUUID } from "@/utils/common";
const uuid = ref(getUUID());
import { inListAdd } from "@/api/industry";
const props = defineProps({
visible: {
type: Boolean,
default: false,
},
form: Object,
});
const emits = defineEmits(["close"]);
const titleName = ref("新增");
//
const formRef = ref<FormInstance>();
const ruleForm = reactive<FormRules>({
name: [{ required: true, message: "请输入名字", trigger: "blur" }],
type: [{ required: true, message: "请选择类型", trigger: "blur" }],
address: [{ required: true, message: "请输入地址", trigger: "blur" }],
remarks: [{ required: true, message: "请输入简介/备注", trigger: "blur" }],
});
const formData = ref<any>({});
const types = ref([
{ label: "防汛", value: 1 },
{ label: "火灾", value: 2 },
{ label: "治安", value: 3 },
{ label: "安全生产", value: 4 },
]);
//退
const handleSubmit = () => {
formRef.value?.validate((valid) => {
if (valid) {
formData.value.sortId = formData.value.sortId || 1;
formData.value.industryId = props.id;
formData.value.delState = formData.value.delState || 1;
inListAdd(formData.value).then((res: any) => {
if (res.code == 1) {
ElMessage.success({
message: "操作成功",
type: "success",
});
onclone();
} else {
ElMessage.error({
message: res.message,
type: "error",
});
}
});
}
return false;
});
};
//
const onclone = () => {
formRef.value?.clearValidate();
formData.value = {};
emits("close");
};
onMounted(() => {});
watch(
() => props.form,
(val: any) => {
titleName.value = val.id ? "编辑" : "新增";
formData.value = JSON.parse(JSON.stringify(val));
}
);
</script>
<style scoped></style>

View File

@ -0,0 +1,236 @@
<!-- 应急值守 -->
<template>
<div class="percentage-content">
<div class="content">
<div style="margin-bottom: 16px" class="h-layout space-between h-center">
<div>
<div class="h-layout h-center">
<div
class="tool-item"
@click="(dialogVisible = true), (form = {}), (readonly = false)"
>
<svg-icon name="add" class="icon" />
<span>新增</span>
</div>
<div class="tool-item" @click="getList">
<svg-icon name="refurbish" class="icon" />
<span>刷新</span>
</div>
<div class="label-select filter-tab">
<label>点位类型</label>
<el-select
v-model="type"
@change="getList"
clearable
placeholder="请选择"
>
<el-option
v-for="item in types"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
</div>
</div>
<div style="width: 30%">
<div>
<el-input
v-model="search"
@keydown.enter.native="getList"
placeholder="请输入关键字"
class="search-input"
>
<template #append>
<span @click="getList" class="search-bottom">
<svg-icon name="search" class="icon_class" />
<span>搜索</span>
</span>
</template>
</el-input>
</div>
</div>
</div>
<el-table
ref="loading"
v-loading="tableDataloading"
:data="tableData"
header-row-class-name="el-one-header"
@selection-change="handleSelectionChange"
border
>
<el-table-column
type="index"
align="center"
label="序列"
width="60"
></el-table-column>
<el-table-column
prop="name"
:resizable="true"
align="center"
label="点位名称"
></el-table-column>
<el-table-column
prop="address"
:resizable="true"
align="center"
label="点位类型"
></el-table-column>
<el-table-column
prop="phone"
:resizable="true"
align="center"
label="详细地址"
></el-table-column>
<el-table-column
:resizable="true"
align="center"
width="260"
label="操作"
>
<template #default="scope">
<span
class="operate"
@click="
(dialogVisible = true), (form = scope.row), (readonly = false)
"
>
<svg-icon name="edit" class="icon"></svg-icon>
<span class="edit">编辑</span>
</span>
<span
class="operate"
@click="
(dialogVisible = true), (form = scope.row), (readonly = true)
"
>
<svg-icon name="detail" class="icon"></svg-icon>
<span class="detail">详情</span>
</span>
<span class="operate" @click="deletelist(scope.row.othequipmentid)">
<svg-icon name="delete" class="icon"></svg-icon>
<span class="func">删除</span>
</span>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination
class="pagination"
@size-change="getList"
@current-change="getList"
v-model:current-page.sync="currentPage"
:page-sizes="[10, 15, 20, 30]"
v-model:page-size.sync="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
background
>
</el-pagination>
<!-- 新增 -->
<AddEdit :visible="dialogVisible" :form="form" @close="onclone" />
</div>
</div>
</template>
<script lang='ts' setup>
import { onMounted, reactive, ref } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { getOthequipmentPage, delOthequipment } from "@/api/Othteam";
import AddEdit from "./dialog/add-edit.vue";
import useUserStore from "@/store/modules/user";
const userStore = useUserStore();
const user = ref(JSON.parse(userStore.userInfo));
const userId = ref(user.value.userId);
const types = ref([
{ label: "防汛", value: 1 },
{ label: "火灾", value: 2 },
{ label: "治安", value: 3 },
{ label: "安全生产", value: 4 },
]);
const type = ref();
const search = ref([]);
const tableData = ref([]);
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(0);
const dialogVisible = ref(false);
const form = ref({});
const readonly = ref(false);
const handleSelectionChange = () => {};
//
const tableDataloading = ref(false);
const getList = () => {
tableDataloading.value = true;
let params = {
equname: search.value,
equtype: null,
houseId: null,
limit: pageSize.value,
page: currentPage.value,
};
getOthequipmentPage(params).then((res: any) => {
tableData.value = res.data.list;
total.value = res.data.total;
tableDataloading.value = false;
});
};
//
const deletelist = (id) => {
ElMessageBox.confirm("是否确认删除?", "提示", {
confirmButtonText: "是",
cancelButtonText: "否",
type: "warning",
}).then(() => {
delOthequipment(id, userId.value).then((res: any) => {
if (res.code == 1) {
ElMessage.success({
message: "删除成功",
type: "success",
});
} else {
ElMessage.error({
message: res.message,
type: "error",
});
}
getList();
});
});
};
//
const onclone = () => {
dialogVisible.value = false;
form.value = {};
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.content {
width: 100%;
background: #fff;
border-radius: 0.26042vw;
box-shadow: 0 0 0.41667vw 0 rgba(8, 33, 85, 0.1);
height: 100%;
padding: 0.83333vw;
overflow-y: auto;
overflow-x: hidden !important;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-o-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
</style>

View File

@ -3,7 +3,7 @@
<div class="content">
<div style="margin-bottom: 16px" class="h-layout space-between h-center">
<div>
<div class="h-layout">
<div class="h-layout h-center">
<div
class="tool-item"
@click="(dialogVisible = true), (form = {}), (readonly = false)"
@ -11,40 +11,20 @@
<svg-icon name="add" class="icon" />
<span>新增</span>
</div>
<div class="tool-item" @click="getCompanyList">
<div class="tool-item" @click="getList">
<svg-icon name="refurbish" class="icon" />
<span>刷新</span>
</div>
<div class="tool-item" @click="getCompanyList">
<div class="tool-item" @click="getList">
<svg-icon name="export" class="icon" />
<span>导出</span>
</div>
</div>
</div>
<div style="width: 30%">
<div>
<el-input
v-model="search"
@keydown.enter="getCompanyList"
placeholder="输入预案名称"
class="search-input"
>
<template #append>
<span @click="getCompanyList" class="search-bottom">
<svg-icon name="search" class="icon_class" />
<span>搜索</span>
</span>
</template>
</el-input>
</div>
</div>
</div>
<div style="display: flex; margin-bottom: 10px">
<div class="label-select filter-tab">
<label>预案类型</label>
<el-select
v-model="type"
@change="getCompanyList"
@change="getList"
clearable
placeholder="请选择"
>
@ -58,6 +38,25 @@
</el-select>
</div>
</div>
</div>
<div style="width: 30%">
<div>
<el-input
v-model="search"
@keydown.enter="getList"
placeholder="输入预案名称"
class="search-input"
>
<template #append>
<span @click="getList" class="search-bottom">
<svg-icon name="search" class="icon_class" />
<span>搜索</span>
</span>
</template>
</el-input>
</div>
</div>
</div>
<el-table
ref="loading"
v-loading="tableDataloading"
@ -115,8 +114,8 @@
<!-- 分页 -->
<el-pagination
class="pagination"
@size-change="getCompanyList"
@current-change="getCompanyList"
@size-change="getList"
@current-change="getList"
v-model:current-page="currentPage"
:page-sizes="[10, 15, 20, 30]"
v-model:page-size="pageSize"
@ -159,7 +158,7 @@ const readonly = ref(false);
const handleSelectionChange = () => {};
//
const tableDataloading = ref(false);
const getCompanyList = () => {
const getList = () => {
tableDataloading.value = true;
let params = {
planname: search.value,
@ -183,10 +182,10 @@ const OthtypeList = () => {
const onclone = () => {
dialogVisible.value = false;
form.value = {};
getCompanyList();
getList();
};
onMounted(() => {
getCompanyList();
getList();
OthtypeList();
});
</script>

View File

@ -2,7 +2,7 @@
<BaseDialog
:dialogVisible="props.visible"
@close="onclone"
:titleName="titleName + '应急值守'"
:titleName="titleName + '避难场所'"
width="50%"
@onSubmit="handleSubmit"
:footerclosed="true"