Compare commits
3 Commits
0ffc0cd01e
...
2025-10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b396686b61 | ||
|
|
1a0a42c5a5 | ||
|
|
980d5a22b3 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -11,6 +11,8 @@ node_modules
|
||||
dist
|
||||
|
||||
offline
|
||||
# tiles
|
||||
# tiles1
|
||||
dist-ssr
|
||||
*.local
|
||||
# Editor directories and files
|
||||
|
||||
@@ -303,3 +303,12 @@ export function exportLineData() {
|
||||
responseType: "blob",
|
||||
});
|
||||
}
|
||||
|
||||
// 无锡地图查询
|
||||
export function stationMap(data: object) {
|
||||
return service({
|
||||
url: "/scale/stationMap",
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
BIN
src/assets/bdz.png
Normal file
BIN
src/assets/bdz.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -5,7 +5,7 @@ import store from "@/store/index";
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: "/api",
|
||||
timeout: 60 * 1000,
|
||||
timeout: 60 * 1000 * 3,
|
||||
headers: { "Content-Type": "application/json;charset=utf-8" },
|
||||
});
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class HttpRequest {
|
||||
getInsideConfig() {
|
||||
const config = {
|
||||
baseURL: this.baseUrl, // 所有的请求地址前缀部分(没有后端请求不用写)
|
||||
timeout: 80000, // 请求超时时间(毫秒)
|
||||
timeout: 60 * 1000 * 3, // 请求超时时间(毫秒)
|
||||
};
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
<div v-loading="loading" element-loading-background="#343849c7">
|
||||
<div class="iconBox">
|
||||
<div class="div">
|
||||
<img src="@/assets/jcd.png" alt="" />
|
||||
<img src="@/assets/bdz.png" alt="" />
|
||||
<span>变电站</span>
|
||||
</div>
|
||||
|
||||
<div class="div">
|
||||
<!-- <div class="div">
|
||||
<img src="@/assets/img/txzcwzj.png" alt="" />
|
||||
<span>监测点</span>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="bmSelect">
|
||||
<el-select
|
||||
@@ -45,26 +45,26 @@
|
||||
:double-click-zoom="false"
|
||||
>
|
||||
<!-- 线-->
|
||||
<div v-if="zoom > 13">
|
||||
<!-- <div v-if="zoom > 13">
|
||||
<bm-polyline
|
||||
:path="path"
|
||||
v-for="(path, index) in polyline"
|
||||
:key="index"
|
||||
></bm-polyline>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- 变电站-->
|
||||
<template v-if="zoom > 13">
|
||||
<template>
|
||||
<bm-marker
|
||||
:position="path"
|
||||
v-for="path in siteList"
|
||||
:key="path.subId"
|
||||
:icon="path.icon"
|
||||
@click="markerClick(path)"
|
||||
@click="pointClick(path)"
|
||||
></bm-marker>
|
||||
</template>
|
||||
<!-- 点 -->
|
||||
<div maxZoom="12">
|
||||
<!-- <div maxZoom="12">
|
||||
<bm-marker
|
||||
:position="path"
|
||||
v-for="path in areaLineInfo"
|
||||
@@ -72,7 +72,7 @@
|
||||
:icon="path.icon"
|
||||
@click="pointClick(path)"
|
||||
></bm-marker>
|
||||
</div>
|
||||
</div> -->
|
||||
<bm-marker
|
||||
:position="infoWindowPoint"
|
||||
:icon="{ url: '1', size: { width: 0, height: 0 } }"
|
||||
@@ -89,7 +89,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, nextTick, onMounted } from "vue";
|
||||
import { substationCount } from "@/api/statistics/index";
|
||||
import { stationMap } from "@/api/statistics/index";
|
||||
import { useStore } from "vuex";
|
||||
// import { BmlMarkerClusterer } from "vue-baidu-map-3x";
|
||||
const emit = defineEmits(["pointClick"]);
|
||||
@@ -129,7 +129,7 @@ const handler = async ({ BMap, map }: any) => {
|
||||
const markerClick = (e: any) => {
|
||||
zoom.value = 15;
|
||||
infoWindowPoint.value = e;
|
||||
infoWindowPoint.value.show = true;
|
||||
// infoWindowPoint.value.show = true;
|
||||
center.value.lng = 120.124367;
|
||||
center.value.lat = 31.555421;
|
||||
|
||||
@@ -150,87 +150,87 @@ const init = () => {
|
||||
polyline.value = [];
|
||||
dataList.value = [];
|
||||
areaLineInfo.value = [];
|
||||
// substationCount({
|
||||
// deptId: store.state.deptId,
|
||||
// type: store.state.timeType,
|
||||
// startTime: store.state.timeValue[0],
|
||||
// endTime: store.state.timeValue[1],
|
||||
// }).then((res: any) => {
|
||||
// dataList.value = res.data;
|
||||
dataList.value = [
|
||||
{
|
||||
stationId: 156,
|
||||
stationName: "110kV北京电视台变",
|
||||
gdName: "检修分公司",
|
||||
longitude: 120.33,
|
||||
latitude: 31.52,
|
||||
lineCount: 1,
|
||||
eventCount: 1,
|
||||
lineEventDetails: [
|
||||
{
|
||||
gdName: "检修分公司",
|
||||
pictureId: "5debb8bd0ce26527675eedffd74a3198",
|
||||
pictureName: "无锡线上",
|
||||
},
|
||||
{
|
||||
gdName: "检修分公司",
|
||||
pictureId: "35b1301833e3fdfc872b1a27a17c7245",
|
||||
pictureName: "无锡修改1011--工程部",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
stationMap({
|
||||
deptId: store.state.deptId,
|
||||
type: store.state.timeType,
|
||||
startTime: store.state.timeValue[0],
|
||||
endTime: store.state.timeValue[1],
|
||||
}).then((res: any) => {
|
||||
dataList.value = res.data;
|
||||
// dataList.value = [
|
||||
// {
|
||||
// stationId: 156,
|
||||
// stationName: "110kV北京电视台变",
|
||||
// gdName: "检修分公司",
|
||||
// longitude: 120.33,
|
||||
// latitude: 31.52,
|
||||
// lineCount: 1,
|
||||
// eventCount: 1,
|
||||
// lineEventDetails: [
|
||||
// // {
|
||||
// // gdName: "检修分公司",
|
||||
// // pictureId: "5debb8bd0ce26527675eedffd74a3198",
|
||||
// // pictureName: "无锡线上",
|
||||
// // },
|
||||
// {
|
||||
// gdName: "检修分公司",
|
||||
// pictureId: "35b1301833e3fdfc872b1a27a17c7245",
|
||||
// pictureName: "无锡修改1011--工程部",
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// ];
|
||||
let data = dataList.value;
|
||||
let r = 0.0035;
|
||||
let list = data.filter((item: any) => item.latitude != 0);
|
||||
let list = data.filter((item: any) => item.lat != 0);
|
||||
list.forEach((item: any) => {
|
||||
// 变电站图标
|
||||
item.icon = {
|
||||
url: new URL("@/assets/jcd.png", import.meta.url).href,
|
||||
url: new URL("@/assets/bdz.png", import.meta.url).href,
|
||||
size: {
|
||||
width: 40,
|
||||
height: 40,
|
||||
},
|
||||
};
|
||||
if (
|
||||
item.lineEventDetails?.length > 10 &&
|
||||
item.lineEventDetails?.length < 100
|
||||
) {
|
||||
r = 0.0055;
|
||||
} else if (item.lineEventDetails.length >= 100) {
|
||||
r = 0.01055;
|
||||
}
|
||||
item.lng = item.longitude;
|
||||
item.lat = item.latitude;
|
||||
item.lineEventDetails.forEach((val: any, i: number) => {
|
||||
val.lng =
|
||||
item.longitude +
|
||||
r * Math.cos((2 * Math.PI * i) / item.lineEventDetails.length);
|
||||
val.lat =
|
||||
item.latitude +
|
||||
r * Math.sin((2 * Math.PI * i) / item.lineEventDetails.length);
|
||||
// 监测点图标
|
||||
val.icon = {
|
||||
url: new URL("@/assets/img/txzcwzj.png", import.meta.url).href,
|
||||
size: {
|
||||
width: 40,
|
||||
height: 40,
|
||||
},
|
||||
};
|
||||
// if (
|
||||
// item.lineEventDetails?.length > 10 &&
|
||||
// item.lineEventDetails?.length < 100
|
||||
// ) {
|
||||
// r = 0.0055;
|
||||
// } else if (item.lineEventDetails.length >= 100) {
|
||||
// r = 0.01055;
|
||||
// }
|
||||
// item.lng = item.longitude;
|
||||
// item.lat = item.latitude;
|
||||
// item.lineEventDetails.forEach((val: any, i: number) => {
|
||||
// val.lng =
|
||||
// item.longitude +
|
||||
// r * Math.cos((2 * Math.PI * i) / item.lineEventDetails.length);
|
||||
// val.lat =
|
||||
// item.latitude +
|
||||
// r * Math.sin((2 * Math.PI * i) / item.lineEventDetails.length);
|
||||
// // 监测点图标
|
||||
// val.icon = {
|
||||
// url: new URL("@/assets/img/txzcwzj.png", import.meta.url).href,
|
||||
// size: {
|
||||
// width: 40,
|
||||
// height: 40,
|
||||
// },
|
||||
// };
|
||||
|
||||
polyline.value.push([
|
||||
{
|
||||
lng: item.lng,
|
||||
lat: item.lat,
|
||||
},
|
||||
{
|
||||
lng: val.lng,
|
||||
lat: val.lat,
|
||||
},
|
||||
]);
|
||||
});
|
||||
// polyline.value.push([
|
||||
// {
|
||||
// lng: item.lng,
|
||||
// lat: item.lat,
|
||||
// },
|
||||
// {
|
||||
// lng: val.lng,
|
||||
// lat: val.lat,
|
||||
// },
|
||||
// ]);
|
||||
// });
|
||||
|
||||
areaLineInfo.value.push(...item.lineEventDetails);
|
||||
// areaLineInfo.value.push(...item.lineEventDetails);
|
||||
});
|
||||
|
||||
siteList.value = list;
|
||||
@@ -239,7 +239,7 @@ const init = () => {
|
||||
setTimeout(() => {
|
||||
loading.value = false;
|
||||
}, 0);
|
||||
// });
|
||||
});
|
||||
};
|
||||
const moveenFlag = ref(true);
|
||||
|
||||
@@ -268,11 +268,11 @@ const checkMapData = () => {
|
||||
console.warn("当前区域无离线地图数据,将返回默认位置");
|
||||
|
||||
// 使用正确的BMap.Point创建方式
|
||||
const point = new BMapInstance.value.Point(116.404367, 39.915421);
|
||||
const point = new BMapInstance.value.Point(120.124367,31.555421);
|
||||
|
||||
// 平滑移动并设置合适缩放级别
|
||||
mapInstance.value.panTo(point);
|
||||
mapInstance.value.setZoom(12);
|
||||
mapInstance.value.setZoom(11);
|
||||
// zoom.value = 12;
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -364,7 +364,7 @@ defineExpose({
|
||||
left: 10px;
|
||||
z-index: 1;
|
||||
width: 110px;
|
||||
height: 70px;
|
||||
height: 40px;
|
||||
padding: 10px;
|
||||
background: #ffffff10 !important;
|
||||
border: 1px solid #ccc;
|
||||
|
||||
@@ -65,22 +65,9 @@
|
||||
<Edit @click="editd(item)" />
|
||||
</el-icon>
|
||||
</el-tooltip>
|
||||
|
||||
<!-- <el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
content="修改项目"
|
||||
placement="top"
|
||||
>
|
||||
<Edit
|
||||
style="margin-left: 5px; width: 16px"
|
||||
class="xiaoshou color"
|
||||
@click="editd(item)"
|
||||
/> </el-tooltip
|
||||
> -->
|
||||
</span>
|
||||
<div style="display: flex; justify-content: end">
|
||||
<el-button
|
||||
<!-- <el-button
|
||||
v-if="item.active == 0"
|
||||
class="color"
|
||||
:icon="Compass"
|
||||
@@ -95,7 +82,7 @@
|
||||
style="padding: 3px 0; color: #82bd51"
|
||||
type="text"
|
||||
>已激活</el-button
|
||||
>
|
||||
> -->
|
||||
<el-button
|
||||
class="color"
|
||||
:icon="Share"
|
||||
@@ -163,17 +150,21 @@
|
||||
placeholder="请输入项目名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="工程项目" prop="projectIds">
|
||||
<el-form-item label="变电站名称">
|
||||
<el-select
|
||||
v-model="ruleForm.projectIds"
|
||||
v-model="ruleForm.substionIds"
|
||||
placeholder="请选择"
|
||||
:popper-append-to-body="false"
|
||||
popper-class="custom-select-dropdown"
|
||||
multiple
|
||||
>
|
||||
<el-option label="Zone one111" value="shanghai" />
|
||||
<el-option label="Zone two" value="beijing" />
|
||||
<el-option
|
||||
v-for="item in dataList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:disabled="item.bindFlag==true"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="项目排序" prop="orderBy">
|
||||
<el-input v-model="ruleForm.orderBy" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
@@ -218,11 +209,14 @@ import {
|
||||
active,
|
||||
getActive,
|
||||
} from "@/api/manage_wx/index";
|
||||
import { stationMap } from "@/api/statistics/index";
|
||||
import { useStore } from "vuex";
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "project-change", project: { id: string; name: string }): void;
|
||||
}>();
|
||||
|
||||
const store = useStore();
|
||||
const projectData = ref([]);
|
||||
|
||||
// 系统配置弹框
|
||||
@@ -240,6 +234,8 @@ const firstForm = ref({
|
||||
id: "",
|
||||
});
|
||||
|
||||
const dataList = ref([]); //变电站
|
||||
|
||||
const params = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
@@ -251,6 +247,7 @@ interface RuleForm {
|
||||
projectIds: [];
|
||||
orderBy: string;
|
||||
remark: string;
|
||||
substionIds:[];
|
||||
}
|
||||
|
||||
const formSize = ref("default");
|
||||
@@ -260,17 +257,18 @@ const ruleForm = reactive<RuleForm>({
|
||||
projectIds: [],
|
||||
orderBy: "100",
|
||||
remark: "",
|
||||
substionIds:[],
|
||||
});
|
||||
|
||||
const rules = reactive<FormRules<RuleForm>>({
|
||||
name: [{ required: true, message: "请输入项目名称", trigger: "blur" }],
|
||||
projectIds: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
// projectIds: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: "请选择",
|
||||
// trigger: "change",
|
||||
// },
|
||||
// ],
|
||||
orderBy: [
|
||||
{
|
||||
required: true,
|
||||
@@ -280,6 +278,17 @@ const rules = reactive<FormRules<RuleForm>>({
|
||||
],
|
||||
});
|
||||
|
||||
const init = () => {
|
||||
stationMap({
|
||||
deptId: store.state.deptId,
|
||||
type: store.state.timeType,
|
||||
startTime: store.state.timeValue[0],
|
||||
endTime: store.state.timeValue[1],
|
||||
}).then((res: any) => {
|
||||
dataList.value = res.data;
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
fetachData();
|
||||
});
|
||||
@@ -342,6 +351,7 @@ const onSubmitadd = () => {
|
||||
orderBy: "100",
|
||||
projectIds: ["1dd1b076e104f15459ac401fc1b902c4"],
|
||||
remark: "",
|
||||
substionIds:[],
|
||||
});
|
||||
//Object.keys(ruleForm).forEach((key) => delete ruleForm[key]); //生效,但是有默认值的,一进去会直接报校验
|
||||
};
|
||||
@@ -359,6 +369,7 @@ const editd = (row: any) => {
|
||||
orderBy: row.orderBy,
|
||||
projectIds: row.projectIds,
|
||||
remark: row.remark,
|
||||
substionIds:row.substionIds,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -526,6 +537,7 @@ const activeItem = (item: any) => {
|
||||
|
||||
const open = () => {
|
||||
dialogVisible.value = true;
|
||||
init();
|
||||
};
|
||||
defineExpose({
|
||||
open,
|
||||
|
||||
@@ -57,7 +57,7 @@ watch(
|
||||
);
|
||||
// 点击监测点传入 接线图id
|
||||
const pointClick = (row: any) => {
|
||||
setUrl(row.pictureId, row.pictureName);
|
||||
setUrl(row.configId, row.configName);
|
||||
keyof.value += 1;
|
||||
};
|
||||
|
||||
@@ -73,8 +73,8 @@ onMounted(() => {
|
||||
});
|
||||
const setUrl = (url: string, nam: string) => {
|
||||
iframeSrc.value =
|
||||
// window.location.origin +
|
||||
"http://192.168.1.179:4001" +
|
||||
window.location.origin +
|
||||
// "http://192.168.1.179:4001" +
|
||||
`/zutai/?id=${url}&&name=${encodeURIComponent(
|
||||
nam
|
||||
)}&&preview=true&&display=true&&graphicDisplay=wx#/preview`;
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
v-for="(value, index) in infoWindowPoint.objName.split(
|
||||
';'
|
||||
)"
|
||||
style="white-space: nowrap"
|
||||
style="white-space: nowrap; font-size: 13px"
|
||||
>
|
||||
{{ value }}
|
||||
</div>
|
||||
@@ -198,8 +198,8 @@ const markerClick = (e: any) => {
|
||||
zoom.value = 15;
|
||||
infoWindowPoint.value = e;
|
||||
infoWindowPoint.value.show = true;
|
||||
center.value.lng = 116.404367;
|
||||
center.value.lat = 39.915421;
|
||||
center.value.lng = e.lng;
|
||||
center.value.lat = e.lat+ 0.01000001;;
|
||||
|
||||
setTimeout(() => {
|
||||
center.value.lng = e.lng;
|
||||
@@ -285,41 +285,41 @@ const init = () => {
|
||||
const moveenFlag = ref(true);
|
||||
|
||||
const checkMapData = () => {
|
||||
if (!mapInstance.value || !BMapInstance.value || !moveenFlag.value) return;
|
||||
// if (!mapInstance.value || !BMapInstance.value || !moveenFlag.value) return;
|
||||
|
||||
// 获取地图容器
|
||||
const container = mapInstance.value.getContainer();
|
||||
// // 获取地图容器
|
||||
// const container = mapInstance.value.getContainer();
|
||||
|
||||
setTimeout(() => {
|
||||
try {
|
||||
// 1. 获取所有图片瓦片
|
||||
const tiles = Array.from(container.querySelectorAll("img"));
|
||||
// setTimeout(() => {
|
||||
// try {
|
||||
// // 1. 获取所有图片瓦片
|
||||
// const tiles = Array.from(container.querySelectorAll("img"));
|
||||
|
||||
// 2. 检查是否有离线地图瓦片
|
||||
const hasOfflineTiles = tiles.some((tile: any) => {
|
||||
// 确保tile是有效的DOM元素
|
||||
if (!tile || !tile.src) return false;
|
||||
// // 2. 检查是否有离线地图瓦片
|
||||
// const hasOfflineTiles = tiles.some((tile: any) => {
|
||||
// // 确保tile是有效的DOM元素
|
||||
// if (!tile || !tile.src) return false;
|
||||
|
||||
// 检查是否是离线瓦片
|
||||
return tile.src.includes("/plugin/offline/tiles/");
|
||||
});
|
||||
// // 检查是否是离线瓦片
|
||||
// return tile.src.includes("/plugin/offline/tiles/");
|
||||
// });
|
||||
|
||||
// 3. 如果没有离线瓦片,回到默认位置
|
||||
if (!hasOfflineTiles) {
|
||||
console.warn("当前区域无离线地图数据,将返回默认位置");
|
||||
// // 3. 如果没有离线瓦片,回到默认位置
|
||||
// if (!hasOfflineTiles) {
|
||||
// console.warn("当前区域无离线地图数据,将返回默认位置");
|
||||
|
||||
// 使用正确的BMap.Point创建方式
|
||||
const point = new BMapInstance.value.Point(116.404367, 39.915421);
|
||||
// // 使用正确的BMap.Point创建方式
|
||||
// const point = new BMapInstance.value.Point(116.404367, 39.915421);
|
||||
|
||||
// 平滑移动并设置合适缩放级别
|
||||
mapInstance.value.panTo(point);
|
||||
mapInstance.value.setZoom(12);
|
||||
// zoom.value = 12;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("地图检测出错:", error);
|
||||
}
|
||||
}, 1000); // 适当缩短延迟时间
|
||||
// // 平滑移动并设置合适缩放级别
|
||||
// mapInstance.value.panTo(point);
|
||||
// mapInstance.value.setZoom(12);
|
||||
// // zoom.value = 12;
|
||||
// }
|
||||
// } catch (error) {/
|
||||
// console.error("地图检测出错:", error);
|
||||
// }
|
||||
// }, 1000); // 适当缩短延迟时间
|
||||
};
|
||||
|
||||
// 处理地图滚轮缩放,修正scale导致的坐标偏移
|
||||
|
||||
@@ -1,25 +1,56 @@
|
||||
<!--报表导出-->
|
||||
<template>
|
||||
<el-dialog :close-on-click-modal="false" draggable v-model="machineVisible" :title="title" width="500">
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
v-model="machineVisible"
|
||||
:title="title"
|
||||
width="500"
|
||||
>
|
||||
<div>
|
||||
<div class="smsConfig">
|
||||
<el-form :model="form" inline label-width="auto" class=" ml30 mt10">
|
||||
<el-form :model="form" inline label-width="auto" class="ml30 mt10">
|
||||
<el-form-item label="时间">
|
||||
<el-date-picker v-model="timeValue" size="small" type="daterange" :disabled-date="isFutureDate"
|
||||
style="width: 250px; margin-right: 10px" unlink-panels :clearable="false" range-separator="至"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD HH:mm:ss" />
|
||||
<el-date-picker
|
||||
v-model="timeValue"
|
||||
size="small"
|
||||
type="datetimerange"
|
||||
:disabled-date="isFutureDate"
|
||||
style="width: 250px; margin-right: 10px"
|
||||
unlink-panels
|
||||
:clearable="false"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="部门集合">
|
||||
<el-select v-model="form.deptList" placeholder="请选择部门集合" style="width: 250px" size="small" multiple
|
||||
collapse-tags collapse-tags-tooltip>
|
||||
<el-select
|
||||
v-model="form.deptList"
|
||||
placeholder="请选择部门集合"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
multiple
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
>
|
||||
<template #header>
|
||||
<el-checkbox v-model="checkAll" :indeterminate="indeterminate" @change="handleCheckAll">
|
||||
<el-checkbox
|
||||
v-model="checkAll"
|
||||
:indeterminate="indeterminate"
|
||||
@change="handleCheckAll"
|
||||
>
|
||||
全部
|
||||
</el-checkbox>
|
||||
</template>
|
||||
<el-option v-for="item in deptLists" :key="item.deptsIndex" :label="item.deptsname"
|
||||
:value="item.deptsIndex" />
|
||||
<el-option
|
||||
v-for="item in deptLists"
|
||||
:key="item.deptsIndex"
|
||||
:label="item.deptsname"
|
||||
:value="item.deptsIndex"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -32,7 +63,9 @@
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button :icon="Close" @click="setUp" size="small">取消</el-button>
|
||||
<el-button type="primary" :icon="Check" @click="save" size="small">确定</el-button>
|
||||
<el-button type="primary" :icon="Check" @click="save" size="small"
|
||||
>确定</el-button
|
||||
>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -41,7 +74,7 @@ import { ref, watch, inject, onMounted } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { Check, Close } from "@element-plus/icons-vue";
|
||||
import { getDept, exportForms } from "@/api/statistics/index";
|
||||
import type { CheckboxValueType } from 'element-plus'
|
||||
import type { CheckboxValueType } from "element-plus";
|
||||
import { useStore } from "vuex";
|
||||
const store = useStore();
|
||||
const machineVisible = ref(false);
|
||||
@@ -50,8 +83,8 @@ const timeValue = ref([]);
|
||||
const deptLists = ref();
|
||||
//form表单校验规则
|
||||
const emit = defineEmits(["flushed"]);
|
||||
const checkAll = ref(false)
|
||||
const indeterminate = ref(false)
|
||||
const checkAll = ref(false);
|
||||
const indeterminate = ref(false);
|
||||
const form = ref({
|
||||
searchBeginTime: "",
|
||||
searchEndTime: "",
|
||||
@@ -88,28 +121,28 @@ const init = () => {
|
||||
// }
|
||||
// })
|
||||
watch(
|
||||
() => form.value.deptList, // 使用函数返回值的形式
|
||||
() => form.value.deptList, // 使用函数返回值的形式
|
||||
(val) => {
|
||||
if (val.length == 0) {
|
||||
checkAll.value = false
|
||||
indeterminate.value = false
|
||||
checkAll.value = false;
|
||||
indeterminate.value = false;
|
||||
} else if (val.length == deptLists.value.length) {
|
||||
checkAll.value = true
|
||||
indeterminate.value = false
|
||||
checkAll.value = true;
|
||||
indeterminate.value = false;
|
||||
} else {
|
||||
indeterminate.value = true
|
||||
indeterminate.value = true;
|
||||
}
|
||||
},
|
||||
{ deep: true } // 添加深度监听选项
|
||||
)
|
||||
{ deep: true } // 添加深度监听选项
|
||||
);
|
||||
const handleCheckAll = (val: CheckboxValueType) => {
|
||||
indeterminate.value = false
|
||||
indeterminate.value = false;
|
||||
if (val) {
|
||||
form.value.deptList = deptLists.value.map((_) => _.deptsIndex)
|
||||
form.value.deptList = deptLists.value.map((_) => _.deptsIndex);
|
||||
} else {
|
||||
form.value.deptList = []
|
||||
form.value.deptList = [];
|
||||
}
|
||||
}
|
||||
};
|
||||
const save = () => {
|
||||
if (!timeValue.value[0]) {
|
||||
ElMessage.warning("请选择时间!");
|
||||
@@ -122,9 +155,8 @@ const save = () => {
|
||||
|
||||
(form.value.deptId = store.state.deptId),
|
||||
(form.value.searchBeginTime = timeValue.value[0]),
|
||||
(form.value.searchEndTime = timeValue.value[1]
|
||||
? timeValue.value[1].split(" ")[0] + " 23:59:59"
|
||||
: "");
|
||||
(form.value.searchEndTime = timeValue.value[1]);
|
||||
|
||||
exportForms(form.value).then((res: any) => {
|
||||
let blob = new Blob([res], {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8",
|
||||
|
||||
Reference in New Issue
Block a user