lcw
This commit is contained in:
187
src/views/backOfficeSystem/PoliceIncidentMonitoring/addForm.vue
Normal file
187
src/views/backOfficeSystem/PoliceIncidentMonitoring/addForm.vue
Normal file
@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<div class="dialog" v-if="dialogForm">
|
||||
<div class="head_box">
|
||||
<span class="title">{{ title }}警情监测</span>
|
||||
<div>
|
||||
<el-button type="primary" size="small" v-if="!disabled" :loading="loading" @click="submit">保存</el-button>
|
||||
<el-button size="small" @click="close">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form_cnt">
|
||||
<FormMessage ref="elform" :disabled="disabled" v-model="listQuery" :formList="formData" labelWidth="100px"
|
||||
:rules="rules">
|
||||
<template #jqzldm>
|
||||
<el-cascader v-model="listQuery.jqzldm" :options="props.dict.jqTree" clearable filterable :show-all-levels="false" :props="{label: 'zdmc', value: 'dm', children: 'itemList',checkStrictly: true }" />
|
||||
</template>
|
||||
</FormMessage>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as rule from "@/utils/rules.js";
|
||||
import FormMessage from "@/components/aboutTable/FormMessage.vue";
|
||||
import { qcckGet, qcckPost, qcckPut } from "@/api/qcckApi.js";
|
||||
import { ref, defineExpose, reactive, onMounted, defineEmits, getCurrentInstance, watch, onUnmounted } from "vue";
|
||||
const emit = defineEmits(["getList"]);
|
||||
const props = defineProps({
|
||||
dict: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
});
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const dialogForm = ref(false); //弹窗
|
||||
const rules = reactive({
|
||||
// jqgjz: [{ required: true, message: "请输入内容关键字", trigger: "blur" }],
|
||||
// gzms: [{ required: true, message: "请输入规则描述", trigger: "blur" }],
|
||||
// jqzldm: [{ required: true, message: "请选择警情子类", trigger: "blur" }],
|
||||
// jqdjdm: [{ required: true, message: "请选择警情等级", trigger: "blur" }],
|
||||
});
|
||||
const listQuery = ref({}); //表单
|
||||
const formData = ref();
|
||||
const loading = ref(false);
|
||||
const elform = ref();
|
||||
const title = ref("");
|
||||
const disabled = ref(false);
|
||||
|
||||
// 初始化数据
|
||||
const init = (type, row) => {
|
||||
title.value = type == 'edit' ? '编辑' : type == 'add' ? '新增' : '详情'
|
||||
dialogForm.value = true;
|
||||
|
||||
formData.value = [
|
||||
{ label: "警情等级", prop: "jqdjdm", type: "select", options: props.dict.D_BZ_JQDJ || [] },
|
||||
{ label: "警情子类", prop: "jqzldm", type: "slot" },
|
||||
{ label: "内容关键字", prop: "jqgjz", type: "textarea", width: "100%" },
|
||||
{ label: "规则描述", prop: "gzms", type: "textarea", width: "100%" },
|
||||
]
|
||||
if (type != 'add') {
|
||||
// 处理级联选择器的回显
|
||||
if (row.jqzldm && props.dict.jqTree) {
|
||||
const fullPath = findFullPath(props.dict.jqTree, row.jqzldm);
|
||||
if (fullPath.length > 0) {
|
||||
listQuery.value = {
|
||||
...row,
|
||||
jqzldm: fullPath
|
||||
};
|
||||
} else {
|
||||
listQuery.value = row;
|
||||
}
|
||||
} else {
|
||||
listQuery.value = row;
|
||||
}
|
||||
if (type == 'detail') {
|
||||
disabled.value = true;
|
||||
} else {
|
||||
disabled.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// 查找完整的级联路径
|
||||
const findFullPath = (tree, targetValue, currentPath = []) => {
|
||||
for (const node of tree) {
|
||||
const newPath = [...currentPath, node.dm];
|
||||
if (node.dm === targetValue) {
|
||||
return newPath;
|
||||
}
|
||||
if (node.itemList && node.itemList.length > 0) {
|
||||
const result = findFullPath(node.itemList, targetValue, newPath);
|
||||
if (result.length > 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return [];
|
||||
};
|
||||
// 提交
|
||||
const submit = () => {
|
||||
// 处理级联选择器的值,只提交最后一个值
|
||||
const promes = {
|
||||
...listQuery.value,
|
||||
jqzldm: Array.isArray(listQuery.value.jqzldm) ? listQuery.value.jqzldm[listQuery.value.jqzldm.length - 1] : listQuery.value.jqzldm
|
||||
}
|
||||
elform.value.submit((data) => {
|
||||
loading.value = true;
|
||||
if (title.value == "新增") {
|
||||
qcckPost(promes, '/mosty-gsxt/jqjczg/addEntity').then(() => {
|
||||
proxy.$message({ type: "success", message: title.value + "成功" });
|
||||
emit("getList");
|
||||
close();
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
} else {
|
||||
qcckPut(promes, '/mosty-gsxt/jqjczg/editEntity').then(() => {
|
||||
proxy.$message({ type: "success", message: title.value + "成功" });
|
||||
emit("getList");
|
||||
close();
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
// 关闭
|
||||
const close = () => {
|
||||
listQuery.value = {};
|
||||
dialogForm.value = false;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
onUnmounted(() => {
|
||||
})
|
||||
defineExpose({ init });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "~@/assets/css/layout.scss";
|
||||
@import "~@/assets/css/element-plus.scss";
|
||||
|
||||
::v-deep .el-tabs--card>.el-tabs__header .el-tabs__item.is-active {
|
||||
color: #0072ff;
|
||||
background: rgba(0, 114, 255, 0.3);
|
||||
}
|
||||
|
||||
.boxlist {
|
||||
width: calc(99% - 50px);
|
||||
margin-top: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.depBox {
|
||||
border: 1px solid #e9e9e9;
|
||||
padding: 0 0 0 4px;
|
||||
border-radius: 4px;
|
||||
width: 100%;
|
||||
|
||||
.coolor {
|
||||
color: #d3d3d3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.zdy-taf {
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
min-height: 32px;
|
||||
border: 1px solid #e9e9e9;
|
||||
border-radius: 4px;
|
||||
padding: 0px 5px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.map {
|
||||
height: 520px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
101
src/views/backOfficeSystem/PoliceIncidentMonitoring/gljqLod.vue
Normal file
101
src/views/backOfficeSystem/PoliceIncidentMonitoring/gljqLod.vue
Normal file
@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<el-dialog :model-value="modelValue" :title="title" width="80%" @close="closeDialog" destroy-on-close append-to-body
|
||||
:close-on-click-modal="false">
|
||||
<div style="width: 100%;height: 500px;">
|
||||
<MyTable :tableData="pageData.tableData" :tableColumn="pageData.tableColumn" :key="pageData.keyCount"
|
||||
:tableConfiger="pageData.tableConfiger" :controlsWidth="pageData.controlsWidth">
|
||||
<template #jqdjdm="{ row }">
|
||||
<DictTag :tag="false" :value="row.jqdjdm" :options="dict.D_GS_BQ_DJ" />
|
||||
</template>
|
||||
<template #jqlbdm="{ row }">
|
||||
<DictTag :tag="false" :value="row.jqlbdm" :options="dict.JQLB" />
|
||||
</template>
|
||||
<!-- 操作 -->
|
||||
<!-- <template #controls="{ row }">
|
||||
<el-link type="primary" size="small" @click="handleAdd('detail', row)">详情</el-link>
|
||||
</template> -->
|
||||
</MyTable>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="flex just-center">
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确认</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, watch, onUnmounted, getCurrentInstance } from 'vue'
|
||||
import MyTable from "@/components/aboutTable/MyTable.vue";
|
||||
import { qcckGet, qcckPost, qcckPut } from "@/api/qcckApi.js";
|
||||
const { proxy } = getCurrentInstance()
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}, zdsjLod: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
dict: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
});
|
||||
|
||||
const pageData = reactive({
|
||||
tableData: [], //表格数据
|
||||
keyCount: 0,
|
||||
tableConfiger: {
|
||||
rowHieght: 61,
|
||||
showSelectType: "null", //选择类型
|
||||
loading: false
|
||||
},
|
||||
total: 0,
|
||||
pageConfiger: {
|
||||
pageSize: 20,
|
||||
pageCurrent: 1
|
||||
}, //分页
|
||||
controlsWidth: 250, //操作栏宽度
|
||||
tableColumn: [
|
||||
{ label: "接警单编号", prop: "jjdbh" },
|
||||
{ label: "报警电话", prop: "bjdh" },
|
||||
{ label: "报警时间", prop: "bjsj" },
|
||||
{ label: "报警内容", prop: "bjnr", showOverflowTooltip: true },
|
||||
{ label: "接警员姓名", prop: "jjyxm" },
|
||||
{ label: "警情级别", prop: "jqdjdm", showSolt: true },
|
||||
{ label: "警情类型", prop: "jqlbdm", showSolt: true },
|
||||
{ label: "警情地址", prop: "jqdz" },
|
||||
{ label: "补充接警内容", prop: "bcjjnr", showOverflowTooltip: true },
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "addZdsjLodList"]);
|
||||
const title = ref("关联警情");
|
||||
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
handleGljq()
|
||||
console.log(props.dict);
|
||||
|
||||
})
|
||||
|
||||
// 查询关联警情
|
||||
const handleGljq = () => {
|
||||
qcckGet({ jcgzid: props.zdsjLod.id }, "/mosty-gsxt/lzJcjPjdb/selectList").then((res) => {
|
||||
pageData.tableData = res;
|
||||
pageData.keyCount++;
|
||||
});
|
||||
}
|
||||
const closeDialog = () => {
|
||||
// 关闭对话框时移除事件监听器
|
||||
emit("update:modelValue", false);
|
||||
};
|
||||
|
||||
const submitForm = () => {
|
||||
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
214
src/views/backOfficeSystem/PoliceIncidentMonitoring/index.vue
Normal file
214
src/views/backOfficeSystem/PoliceIncidentMonitoring/index.vue
Normal file
@ -0,0 +1,214 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 搜索 -->
|
||||
<div ref="searchBox" class="mt10">
|
||||
<Search :searchArr="searchConfiger" @submit="onSearch">
|
||||
<el-button type="primary" size="small" @click="handleAdd('add', null)">添加规则</el-button>
|
||||
<el-button type="danger" size="small" @click="handleRow()">批量删除</el-button>
|
||||
</Search>
|
||||
</div>
|
||||
<!-- 按钮组 -->
|
||||
<div class="content">
|
||||
<!-- 表格 -->
|
||||
<div class="margTop">
|
||||
<MyTable :tableData="pageData.tableData" :tableColumn="pageData.tableColumn" :tableHeight="pageData.tableHeight"
|
||||
:key="pageData.keyCount" :tableConfiger="pageData.tableConfiger" :controlsWidth="pageData.controlsWidth"
|
||||
@chooseData="handleChooseData">
|
||||
<template #jqdjdm="{ row }">
|
||||
<DictTag :options="D_BZ_JQDJ" :tag="false" :value="row.jqdjdm"></DictTag>
|
||||
</template>
|
||||
<template #jqzldm="{ row }">
|
||||
{{ getJqName(row.jqzldm) }}
|
||||
</template>
|
||||
<!-- 操作 -->
|
||||
<template #controls="{ row }">
|
||||
<el-link type="primary" size="small" @click="handleGljq( row)">关联警情</el-link>
|
||||
<el-link type="primary" size="small" @click="handleAdd('edit', row)">编辑</el-link>
|
||||
<el-link type="primary" size="small" @click="handleAdd('detail', row)">详情</el-link>
|
||||
<el-link type="danger" size="small" @click="handleRow(row.id)">删除</el-link>
|
||||
</template>
|
||||
</MyTable>
|
||||
<Pages @changeNo="changeNo" @changeSize="changeSize" :tableHeight="pageData.tableHeight" :pageConfiger="{
|
||||
...pageData.pageConfiger,
|
||||
total: pageData.total
|
||||
}"></Pages>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<AddForm ref="addForm" @getList="getList" :dict="{ D_BZ_JQDJ, jqTree }" />
|
||||
<GljqLod v-model="gljqShow" :dict="{D_GS_BQ_DJ,JQLB}" :zdsjLod="zdsjLod" />
|
||||
</template>
|
||||
<script setup>
|
||||
import MyTable from "@/components/aboutTable/MyTable.vue";
|
||||
import Pages from "@/components/aboutTable/Pages.vue";
|
||||
import Search from "@/components/aboutTable/Search.vue";
|
||||
import { qcckGet, qcckPost, qcckDelete } from "@/api/qcckApi.js";
|
||||
import { reactive, ref, onMounted, getCurrentInstance } from "vue";
|
||||
import GljqLod from "./gljqLod.vue";
|
||||
import AddForm from "./addForm.vue";
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { D_BZ_JQDJ ,D_GS_BQ_DJ,JQLB} = proxy.$dict("D_BZ_JQDJ","D_GS_BQ_DJ","JQLB");
|
||||
const searchBox = ref(); //搜索框
|
||||
const searchConfiger = ref([
|
||||
{
|
||||
label: "内容关键字",
|
||||
prop: "jqgjz",
|
||||
placeholder: "请输入警情内容关键字",
|
||||
showType: "input",
|
||||
},
|
||||
{
|
||||
label: "值班日期",
|
||||
prop: "startTime",
|
||||
placeholder: "请选择值班日期",
|
||||
showType: "datetimerange",
|
||||
}, {
|
||||
label: "警情等级",
|
||||
prop: "jqdjdm",
|
||||
placeholder: "请选择警情等级",
|
||||
showType: "select",
|
||||
options: D_BZ_JQDJ,
|
||||
}
|
||||
]);
|
||||
const queryFrom = ref({});
|
||||
const pageData = reactive({
|
||||
tableData: [], //表格数据
|
||||
keyCount: 0,
|
||||
tableConfiger: {
|
||||
rowHieght: 61,
|
||||
showSelectType: "checkbox", //选择类型
|
||||
loading: false
|
||||
},
|
||||
total: 0,
|
||||
pageConfiger: {
|
||||
pageSize: 20,
|
||||
pageCurrent: 1
|
||||
}, //分页
|
||||
controlsWidth: 250, //操作栏宽度
|
||||
tableColumn: [
|
||||
{ label: "规则描述", prop: "gzms", showOverflowTooltip: true },
|
||||
{ label: "内容关键字", prop: "jqgjz", showOverflowTooltip: true },
|
||||
{ label: "警情等级", prop: "jqdjdm", showOverflowTooltip: true, showSolt: true },
|
||||
{ label: "警情类型", prop: "jqzldm", showOverflowTooltip: true, showSolt: true },
|
||||
{ label: "录入人姓名", prop: "lrrXm", showOverflowTooltip: true },
|
||||
{ label: "录入人身份证号", prop: "lrrSfzh", showOverflowTooltip: true },
|
||||
{ label: "所属部门", prop: "ssbm" },
|
||||
]
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getJqTree()
|
||||
getList();
|
||||
tabHeightFn();
|
||||
});
|
||||
|
||||
// 搜索
|
||||
const onSearch = (val) => {
|
||||
queryFrom.value = {
|
||||
...val,
|
||||
startTime: val.startTime ? val.startTime[0] : '',
|
||||
endTime: val.startTime ? val.startTime[1] : ''
|
||||
};
|
||||
pageData.pageConfiger.pageCurrent = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
const changeNo = (val) => {
|
||||
pageData.pageConfiger.pageCurrent = val;
|
||||
getList();
|
||||
};
|
||||
const changeSize = (val) => {
|
||||
pageData.pageConfiger.pageSize = val;
|
||||
getList();
|
||||
};
|
||||
|
||||
// 获取列表
|
||||
const getList = () => {
|
||||
const promes = {
|
||||
...pageData.pageConfiger,
|
||||
...queryFrom.value,
|
||||
}
|
||||
qcckGet(promes, "/mosty-gsxt/jqjczg/getPageList").then((res) => {
|
||||
pageData.tableData = res.records || [];
|
||||
pageData.total = res.total;
|
||||
pageData.tableConfiger.loading = false;
|
||||
}).catch(() => {
|
||||
pageData.tableConfiger.loading = false;
|
||||
});
|
||||
};
|
||||
// 获取警情树
|
||||
|
||||
const jqTree = ref([])
|
||||
const getJqTree = () => {
|
||||
qcckGet({}, "/mosty-gsxt/lzJcjPjdb/getDictTree").then((res) => {
|
||||
jqTree.value = res
|
||||
});
|
||||
}
|
||||
|
||||
// 根据值获取警情名称
|
||||
const getJqName = (value) => {
|
||||
if (!value || !jqTree.value || jqTree.value.length === 0) {
|
||||
return value || '';
|
||||
}
|
||||
|
||||
const findName = (tree, targetValue) => {
|
||||
for (const node of tree) {
|
||||
if (node.dm === targetValue) {
|
||||
return node.zdmc;
|
||||
}
|
||||
if (node.itemList && node.itemList.length > 0) {
|
||||
const result = findName(node.itemList, targetValue);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const name = findName(jqTree.value, value);
|
||||
return name || value;
|
||||
};
|
||||
// 删除
|
||||
const ids = ref([])
|
||||
const handleChooseData = (val) => {
|
||||
ids.value = val.map(item => item.id)
|
||||
}
|
||||
const handleRow = (id) => {
|
||||
const promes = {
|
||||
ids: id ? [id] : ids.value
|
||||
}
|
||||
proxy.$confirm("确定要删除?", "警告", { type: "warning" }).then(() => {
|
||||
qcckDelete(promes, "/mosty-gsxt/jqjczg/deleteEntity").then(() => {
|
||||
proxy.$message({ type: "success", message: "删除成功" });
|
||||
getList();
|
||||
});
|
||||
})
|
||||
};
|
||||
// 值班操作
|
||||
const addForm = ref(null);
|
||||
const handleAdd = (type, row) => {
|
||||
addForm.value.init(type, row);
|
||||
};
|
||||
// 关联警情
|
||||
const gljqShow = ref(false)
|
||||
const zdsjLod = ref()
|
||||
const handleGljq = (row) => {
|
||||
gljqShow.value = true
|
||||
zdsjLod.value=row
|
||||
}
|
||||
|
||||
// 表格高度计算
|
||||
const tabHeightFn = () => {
|
||||
pageData.tableHeight = window.innerHeight - searchBox.value.offsetHeight - 220;
|
||||
window.onresize = function () {
|
||||
tabHeightFn();
|
||||
};
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-loading-mask {
|
||||
background: rgba(0, 0, 0, 0.5) !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user