更新页面

This commit is contained in:
2025-07-08 20:10:24 +08:00
parent 28d7d0e8f0
commit f6390c9002
33 changed files with 1277 additions and 5106 deletions

View File

@ -0,0 +1,102 @@
<template>
<el-dialog :title="title" width="800px" :model-value="modelShow" append-to-body @close="closed" :close-on-click-modal="false">
<el-form :model="listQuery" inline :rules="rules" ref="formRef" :label-width="130" >
<el-form-item label="区域名称" prop="qymc">
<MOSTY.Other width="100%" clearable v-model="listQuery.qymc" placeholder="请输入区域名称"/>
</el-form-item>
<el-form-item label="区域类型" prop="qylx">
<MOSTY.Select v-model="listQuery.qylx" filterable :dictEnum="props.dic.D_ZDY_QYLX" width="100%" clearable placeholder="请选择区域类型"/>
</el-form-item>
<el-form-item label="区域级别" prop="qyjb">
<MOSTY.Select v-model="listQuery.qyjb" filterable :dictEnum="props.dic.D_ZDY_QYJB" width="100%" clearable placeholder="请选择区域类型"/>
</el-form-item>
<el-form-item label="行政区划" prop="xzqh" v-if="listQuery.qylx">
<MOSTY.Select v-model="listQuery.qyjb" filterable :dictEnum="props.dic.D_BZ_XZQHDM" width="100%" clearable placeholder="请选择行政区划"/>
</el-form-item>
<el-form-item label="感知源信息" prop="fwmc" class="ww100">
<div class="flex ww100">
<el-input v-model="listQuery.fwmc" placeholder="请输入感知元信息" style="flex: 1;"></el-input>
<el-button type="primary" style="width: 136px;" class="ml10">
<el-icon style="vertical-align: middle"><CirclePlus /></el-icon>
<span style="vertical-align: middle">选择感知源</span>
</el-button>
</div>
</el-form-item>
<el-form-item label="地图范围" prop="dtfw" class="ww100">
<div class="flex ww100">
<el-input v-model="listQuery.fwmc" placeholder="请输入地图范围" style="flex: 1;"></el-input>
<el-button type="primary" style="width: 136px;" class="ml10">
<el-icon style="vertical-align: middle"><CirclePlus /></el-icon>
<span style="vertical-align: middle">选择地图范围</span>
</el-button>
</div>
</el-form-item>
<div class="mapbox" v-if="showMap"><GdMap></GdMap></div>
<div class="mt10 flex just-center">
<el-button @click="closed"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</div>
</el-form>
</el-dialog>
</template>
<script setup>
import GdMap from "@/components/GdMap/index.vue";
import * as MOSTY from "@/components/MyComponents/index";
import { ref, defineProps, watch, nextTick } from "vue";
const props = defineProps({
dic: {
type: Object,
default: () => ({})
},
});
const modelShow = ref(false);
const emit = defineEmits(["change"]);
const title = ref("新增区域");
const listQuery = ref({});
const formRef = ref();
const showMap = ref(false);
const rules = {
qymc: [{ required: true, message: "请输入区域名称", trigger: "blur" }],
qylx: [{ required: true, message: "请选择区域类型", trigger: "change" }],
qyjb: [{ required: true, message: "请选择区域级别", trigger: "change" }],
xzqh: [{ required: true, message: "请选择行政区划", trigger: "change" }],
fwmc: [{ required: true, message: "请输入感知元信息", trigger: "blur" }],
dtfw: [{ required: true, message: "请输入地图范围", trigger: "blur" }]
};
const init = (type,val) => {
title.value = type === "add" ? "新增区域" : "编辑区域";
modelShow.value = true;
nextTick(() => {
showMap.value = true;
});
};
const closed = () => {
modelShow.value = false;
formRef.value.resetFields();
showMap.value = false;
};
const submit = () => {
formRef.value.validate(valid => {
if(!valid) return false;
console.log("提交的数据:", listQuery.value);
closed();
});
};
defineExpose({
init
});
</script>
<style scoped lang="scss">
.mapbox{
position: relative;
margin-left: 40px;
width: calc(100% - 40px);
height: 320px;
background: red;
}
</style>

View File

@ -0,0 +1,222 @@
<template>
<div>
<div class="titleBox">
<PageTitle title="我的布控" />
</div>
<!-- 搜索 -->
<div ref="searchBox">
<Search :searchArr="searchConfiger" @submit="onSearch" />
</div>
<!-- 按钮组 -->
<div class="content">
<div class="btns">
<el-button type="primary" @click="handleRow('add', '')">
<el-icon style="vertical-align: middle"><CirclePlus /></el-icon>
<span style="vertical-align: middle">新增</span>
</el-button>
<el-button type="danger" @click="handleRow('moreDelete', '')">批量删除</el-button>
</div>
<!-- 表格 -->
<div class="tabBox">
<MyTable
:tableData="pageData.tableData"
:tableColumn="pageData.tableColumn"
:tableHeight="pageData.tableHeight"
:key="pageData.keyCount"
:tableConfiger="pageData.tableConfiger"
:controlsWidth="pageData.controlsWidth"
@chooseData="chooseData"
>
<template #qydj="{ row }">
<DictTag :tag="false" :value="row.qydj" :options="D_ZDY_QYJB" />
</template>
<template #fwlx="{ row }">
<DictTag :tag="false" :value="row.fwlx" :options="D_ZDY_QYLX" />
</template>
<template #sfqy="{ row }">
<el-switch
v-model="row.sfqy"
inline-prompt
active-value="1"
inactive-value="0"
active-text=""
inactive-text=""
/>
</template>
<!-- 操作 -->
<template #controls="{ row }">
<el-link size="small" type="primary" @click="handleRow('edit', row)">编辑</el-link>
<el-link size="small" type="danger" @click="handleRow('delete', row)">删除</el-link>
</template>
</MyTable>
<Pages
@changeNo="changeNo"
@changeSize="changeSize"
:tableHeight="pageData.tableHeight"
:pageConfiger="{
...pageData.pageConfiger,
total: pageData.total
}"
></Pages>
</div>
</div>
</div>
<!-- 新增区域 -->
<AddForm ref="addVisible" :dic="{D_BZ_SF, D_ZDY_QYJB, D_ZDY_QYLX,D_BZ_XZQHDM }"></AddForm>
</template>
<script setup>
import AddForm from "./components/addForm.vue";
import PageTitle from "@/components/aboutTable/PageTitle.vue";
import MyTable from "@/components/aboutTable/MyTable.vue";
import Pages from "@/components/aboutTable/Pages.vue";
import Search from "@/components/aboutTable/Search.vue";
import { qcckGet, qcckPost } from "@/api/qcckApi.js";
import { reactive, ref, onMounted, getCurrentInstance } from "vue";
const { proxy } = getCurrentInstance();
const { D_BZ_SF, D_ZDY_QYJB, D_ZDY_QYLX,D_BZ_XZQHDM } = proxy.$dict("D_BZ_SF","D_ZDY_QYJB","D_ZDY_QYLX","D_BZ_XZQHDM"); //获取字典数据
const searchBox = ref(); //搜索框
const addVisible = ref(); //新增区域组件
const searchConfiger = ref([
{
label: "区域等级",
prop: "qydj",
placeholder: "请选择区域等级",
showType: "select",
options: D_ZDY_QYJB
},
{
label: "范围名称",
prop: "fwmc",
placeholder: "请输入范围名称",
showType: "input"
},
{
label: "范围类型",
prop: "fwlx",
placeholder: "请选择范围类型",
showType: "select",
options: D_ZDY_QYLX
},
{
label: "是否启用",
prop: "sfqy",
placeholder: "请选择是否启用",
showType: "select",
options: D_BZ_SF
}
]);
const queryFrom = ref({});
const pageData = reactive({
tableData: [
{
qydj: "一级",
fwmc: "测试范围1",
fwlx: "区域",
gzyxx: "感知源信息1",
glrysl: 10,
glqtsl: 5,
sfqy: "1"
},
{
qydj: "二级",
fwmc: "测试范围2",
fwlx: "区域",
gzyxx: "感知源信息2",
glrysl: 20,
glqtsl: 15,
sfqy: "0"
}
], //表格数据
keyCount: 0,
tableConfiger: {
rowHieght: 61,
showSelectType: "checkBox",
loading: false
},
total: 0,
pageConfiger: {
pageSize: 20,
pageCurrent: 1
}, //分页
controlsWidth: 120, //操作栏宽度
tableColumn: [
{ label: "区域等级", prop: "qydj", showSolt: true },
{ label: "范围名称", prop: "fwmc" },
{ label: "范围类型", prop: "fwlx", showSolt: true },
{ label: "感知源信息", prop: "gzyxx" },
{ label: "关联人员数量", prop: "glrysl" },
{ label: "关联群体数量", prop: "glqtsl" },
{ label: "是否启用", prop: "sfqy", showSolt: true }
]
});
onMounted(() => {
getList();
tabHeightFn();
});
// 搜索
const onSearch = (val) => {
queryFrom.value = { ...val };
pageData.pageConfiger.pageCurrent = 1;
getList();
};
const changeNo = (val) => {
pageData.pageConfiger.pageNum = val;
getList();
};
const changeSize = (val) => {
pageData.pageConfiger.pageSize = val;
getList();
};
// 获取列表
const getList = () => {
// pageData.tableConfiger.loading = true;
// let data = { ...pageData.pageConfiger, ...queryFrom.value };
// qcckGet(data, "/mosty-gsxt/tbGsxtBk/selectPage").then((res) => {
// pageData.tableData = res.records || [];
// pageData.total = res.total;
// pageData.tableConfiger.loading = false;
// }).catch(() => {
// pageData.tableConfiger.loading = false;
// });
};
const handleRow = (type, row) => {
switch (type) {
case "add"://新增
case "edit": //编辑
addVisible.value.init(type, row);
break;
case "delete"://删除
case "moreDelete": //批量删除
break;
default:
break;
}
};
// 表格高度计算
const tabHeightFn = () => {
pageData.tableHeight = window.innerHeight - searchBox.value.offsetHeight - 292;
window.onresize = function () {
tabHeightFn();
};
};
</script>
<style lang="scss" scoped>
.el-loading-mask {
background: rgba(0, 0, 0, 0.5) !important;
}
.content {
background-color: #fff;
border-radius: 4px;
padding-top: 10px;
.btns {
padding: 0 10px;
}
}
</style>