fix: BUG修改

This commit is contained in:
kun 2023-09-21 15:23:51 +08:00
parent 8c90f18ed6
commit 27a5f2eba2
9 changed files with 150 additions and 39 deletions

View File

@ -98,3 +98,12 @@ export const noticeReadMyPost = (params: { noticeId: string }) => {
export const singleEngineer = (params: any) => { export const singleEngineer = (params: any) => {
return http.post(BASEURL + `/project/engineering/querySingle`, params); return http.post(BASEURL + `/project/engineering/querySingle`, params);
}; };
// 消息推送列表
export const infoList = () => {
return http.get(BASEURL + `/xmgl/messageRecord/list`);
};
// 更改消息状态
export const infoStatusEdit = (params: any) => {
return http.post(BASEURL + `/xmgl/messageRecord/edit`, params);
};

View File

@ -3,8 +3,8 @@
<el-popover placement="bottom" :width="310" trigger="click"> <el-popover placement="bottom" :width="310" trigger="click">
<template #reference> <template #reference>
<el-badge <el-badge
:value="newInfoNum" :value="notReadNum"
:hidden="newInfoNum ? false : true" :hidden="notReadNum ? false : true"
style="display: flex; justify-content: center; align-items: center" style="display: flex; justify-content: center; align-items: center"
class="item" class="item"
> >
@ -20,11 +20,11 @@
class="message-item" class="message-item"
v-for="(item, index) in messageList" v-for="(item, index) in messageList"
:key="index" :key="index"
@dblclick="item.isRead = true" @dblclick="changeStatus(item)"
> >
<div class="message-content"> <div class="message-content">
<span class="message-title">{{ item.title }}</span> <span class="message-title">{{ item.type == 1 ? "通知公告" : item.type == 2 ? "政策法规" : "无标题" }}</span>
<span class="message-date">{{ item.subTitle }}</span> <span class="message-date">{{ item.title }}</span>
</div> </div>
</div> </div>
</div> </div>
@ -50,13 +50,10 @@
import { ref, onMounted, onBeforeUnmount } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import * as mqtt from "mqtt/dist/mqtt.min.js"; import * as mqtt from "mqtt/dist/mqtt.min.js";
import { GlobalStore } from "@/stores"; import { GlobalStore } from "@/stores";
import { infoList, infoStatusEdit } from "@/api/modules/common";
const store = GlobalStore(); const store = GlobalStore();
const messageList = ref([ const notReadNum = ref(0);
{ title: "主标题1", subTitle: "副标题1", isRead: false }, const messageList = ref([] as any);
{ title: "主标题2", subTitle: "副标题2", isRead: false },
{ title: "主标题3", subTitle: "副标题3", isRead: false }
] as any);
const newInfoNum = ref(0);
const activeName = ref("first"); const activeName = ref("first");
const clientInstance = ref(); const clientInstance = ref();
const connectOption = ref({ const connectOption = ref({
@ -66,6 +63,37 @@ const connectOption = ref({
username: "admin", username: "admin",
password: "JXJ@admin" password: "JXJ@admin"
}); });
//
const changeStatus = async (obj: any) => {
if (obj.isRead == 0) {
let requestData = {
messageId: obj.messageId,
type: obj.type
};
const res = await infoStatusEdit(requestData);
console.log(res);
if (res && res.success) {
getInfoList();
}
}
};
//
const getInfoList = async () => {
notReadNum.value = 0;
const res = await infoList();
console.log(res);
if (res.result && res.result.length > 0) {
messageList.value = res.result;
messageList.value.map(item => {
if (item.isRead == 0) {
notReadNum.value++;
}
});
} else {
messageList.value = [];
notReadNum.value = 0;
}
};
// tabs // tabs
const tabsChange = (val: any) => { const tabsChange = (val: any) => {
console.log(val); console.log(val);
@ -93,16 +121,14 @@ const createMqttConnect = () => {
clientInstance.value.on("connect", con => { clientInstance.value.on("connect", con => {
console.log("连接成功", con); console.log("连接成功", con);
// //
clientInstance.value.subscribe(`message/${store.userInfo.userId}`, { qos: 1 }, (error, res) => { clientInstance.value.subscribe(`wisdomSite/message/${store.userInfo.userId}`, { qos: 1 }, (error, res) => {
console.log(error, res); console.log(error, res);
}); });
}); });
clientInstance.value.on("message", (topic, message) => { clientInstance.value.on("message", (topic, message) => {
console.log(topic, JSON.parse(message.toString()));
let val = JSON.parse(message.toString()); let val = JSON.parse(message.toString());
if (Object.keys(val).length > 0) { console.log(val);
newInfoNum.value++; getInfoList();
}
}); });
}; };
// //
@ -118,7 +144,8 @@ const destroyConnection = () => {
} }
}; };
onMounted(() => { onMounted(() => {
// createMqttConnect(); getInfoList();
createMqttConnect();
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
destroyConnection(); destroyConnection();
@ -137,6 +164,12 @@ onBeforeUnmount(() => {
.message-list { .message-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 300px;
overflow-y: scroll;
/* 隐藏滚动条 */
&::-webkit-scrollbar {
display: none;
}
.message-item { .message-item {
display: flex; display: flex;
align-items: center; align-items: center;

View File

@ -133,11 +133,12 @@ const headerList = reactive([
{ label: "未开始", color: "#35e5fd" }, { label: "未开始", color: "#35e5fd" },
{ label: "进行中", color: "#f1d520" }, { label: "进行中", color: "#f1d520" },
{ label: "已完成", color: "#4fd389" }, { label: "已完成", color: "#4fd389" },
{ label: "逾期未开始", color: "#F80840" }, { label: "逾期", color: "#F80840" }
{ label: "逾期进行中", color: "#fc6f8e" }, // { label: "", color: "#F80840" },
{ label: "逾期已完成", color: "#C13F5B" } // { label: "", color: "#fc6f8e" },
// { label: "", color: "#C13F5B" }
]); ]);
const colors = ref(["#35e5fd", "#f1d520", "#4fd389", "#F80840", "#fc6f8e", "#C13F5B"]); const colors = ref(["#35e5fd", "#f1d520", "#4fd389", "#F80840"]);
const projects = ref([]); const projects = ref([]);
// const projects = ref([ // const projects = ref([
// { // {

View File

@ -373,11 +373,12 @@ const saveItem = async (form: any) => {
onMounted(async () => { onMounted(async () => {
const res = await getRoleNamelist({}); const res = await getRoleNamelist({});
const res1 = await getTreeList({ deptId: "", status: 1 }); const res1 = await getTreeList({ deptId: "" });
formConfig.formItemConfig[7].data = res1.result.map(i => { formConfig.formItemConfig[7].data = res1.result.map(i => {
return { return {
label: i.deptName, label: i.deptName,
value: i.deptId value: i.deptId,
disabled: i.status == 0 ? true : false
}; };
}); });
formConfig.formItemConfig[9].data = res.result.map(i => { formConfig.formItemConfig[9].data = res.result.map(i => {

View File

@ -180,9 +180,71 @@ const onSearch = async (params: ResAiEngineerPage | ResAiProjectPage) => {
active.value === 0 ? item.projectSn === params.projectSn : item.engineeringSn === params.engineeringSn active.value === 0 ? item.projectSn === params.projectSn : item.engineeringSn === params.engineeringSn
); );
monitorList.value = monitorList.value.map(item => (item === curr ? { ...curr, showGif: true } : { ...item, showGif: false })); monitorList.value = monitorList.value.map(item => (item === curr ? { ...curr, showGif: true } : { ...item, showGif: false }));
params.longitude !== "" && params.longitude !== null if (params.longitude && params.latitude) {
? map.value?.setCenter([params.longitude, +params.latitude]) console.log(111);
: map.value?.setCenter([116.481181, 39.90923]); map.value?.setCenter([+params.longitude, +params.latitude]);
showInfoPage(curr);
}
// params.longitude !== "" && params.longitude !== null
// ? map.value?.setCenter([params.longitude, +params.latitude])
// : map.value?.setCenter([116.481181, 39.90923]);
};
//
const showInfoPage = async (obj: any) => {
const createMarkerImage = (state: string) => new URL(`../../../assets/images/AIwaring/${state}`, import.meta.url).href;
// Icon
let selectIcon = getIcon(
"selected",
obj.environAlarmFlag === false ? createMarkerImage("clouding.gif") : createMarkerImage("warnclouding.gif")
);
// icon marker
let startMarker = new AMapRef.value.Marker({
position: new AMapRef.value.LngLat(Number(obj.longitude) || 113, Number(obj.latitude) || 21),
icon: selectIcon,
offset: new AMapRef.value.Pixel(-13, -30)
});
map.value?.add([startMarker]);
monitorList.value = monitorList.value.map(val =>
val.latitude == obj.latitude && val.longitude == obj.longitude
? { ...obj, showGif: true }
: { ...val, showGif: false, showInfo: false }
);
const curr = monitorList.value.find(item => item.showGif);
curr.showInfo = !curr.showInfo;
// addMarker();
environAlarmFlag.value = obj.environAlarmFlag;
// e.target.setIcon(selectIcon);
if (active.value === 0) {
infoName.value = obj.projectName;
const res = await getproDetail({ projectId: obj.projectId });
// @ts-expect-error
infoWindowData.value = res.result;
} else {
infoName.value = obj.engineeringName;
const res = await getengDetail({ id: obj.id });
// @ts-expect-error
infoWindowData.value = res.result;
}
if (curr.showInfo) {
infoShow.value = true;
const infowindow = new AMapRef.value.InfoWindow({
isCustom: true, //使
content: infoWindowPage.value,
offset: new AMap.Pixel(16, -45)
});
infowindow.open(map.value, startMarker.getPosition());
} else {
infoShow.value = false;
onClose();
}
}; };
// //
@ -302,7 +364,7 @@ const addMarker = () => {
const mapData = async () => { const mapData = async () => {
const AMap = await initAMap(); const AMap = await initAMap();
AMapRef.value = AMap; AMapRef.value = AMap;
map.value = new AMap.Map("map-container", { zoom: 10, center: [116.481181, 39.90923], viewMode: "2D", resizeEnable: true }); map.value = new AMap.Map("map-container", { zoom: 7, center: [116.481181, 39.90923], viewMode: "2D", resizeEnable: true });
// map.value?.on("click", function (e) { // map.value?.on("click", function (e) {
// map.value?.clearInfoWindow(); // map.value?.clearInfoWindow();
// }); // });

View File

@ -152,11 +152,13 @@ const headerList = reactive([
{ label: "未开始", color: "#35e5fd" }, { label: "未开始", color: "#35e5fd" },
{ label: "进行中", color: "#f1d520" }, { label: "进行中", color: "#f1d520" },
{ label: "已完成", color: "#4fd389" }, { label: "已完成", color: "#4fd389" },
{ label: "逾期未开始", color: "#F80840" }, ,
{ label: "逾期进行中", color: "#fc6f8e" }, { label: "逾期", color: "#F80840" }
{ label: "逾期已完成", color: "#C13F5B" } // { label: "", color: "#F80840" },
// { label: "", color: "#fc6f8e" },
// { label: "", color: "#C13F5B" }
]); ]);
const colors = ref(["#35e5fd", "#f1d520", "#4fd389", "#F80840", "#fc6f8e", "#C13F5B"]); const colors = ref(["#35e5fd", "#f1d520", "#4fd389", "#F80840"]);
const active = ref(0); const active = ref(0);
const records = ref([]); const records = ref([]);
const projects = ref([]); const projects = ref([]);

View File

@ -355,11 +355,12 @@ const saveItem = async (form: any) => {
onMounted(async () => { onMounted(async () => {
const res = await getRoleNamelist({}); const res = await getRoleNamelist({});
const res1 = await getTreeList({ deptId: "", status: 1 }); const res1 = await getTreeList({ deptId: "" });
formConfig.formItemConfig[7].data = res1.result.map(i => { formConfig.formItemConfig[7].data = res1.result.map(i => {
return { return {
label: i.deptName, label: i.deptName,
value: i.deptId value: i.deptId,
disabled: i.status == 0 ? true : false
}; };
}); });
formConfig.formItemConfig[9].data = res.result.map(i => { formConfig.formItemConfig[9].data = res.result.map(i => {

View File

@ -136,11 +136,12 @@ const headerList = reactive([
{ label: "未开始", color: "#35e5fd" }, { label: "未开始", color: "#35e5fd" },
{ label: "进行中", color: "#f1d520" }, { label: "进行中", color: "#f1d520" },
{ label: "已完成", color: "#4fd389" }, { label: "已完成", color: "#4fd389" },
{ label: "逾期未开始", color: "#F80840" }, { label: "逾期", color: "#F80840" }
{ label: "逾期进行中", color: "#fc6f8e" }, // { label: "", color: "#F80840" },
{ label: "逾期已完成", color: "#C13F5B" } // { label: "", color: "#fc6f8e" },
// { label: "", color: "#C13F5B" }
]); ]);
const colors = ref(["#35e5fd", "#f1d520", "#4fd389", "#F80840", "#fc6f8e", "#C13F5B"]); const colors = ref(["#35e5fd", "#f1d520", "#4fd389", "#F80840"]);
const projects = ref([]); const projects = ref([]);
// const projects = ref([ // const projects = ref([
// { // {

View File

@ -373,11 +373,12 @@ const saveItem = async (form: any) => {
onMounted(async () => { onMounted(async () => {
const res = await getRoleNamelist({}); const res = await getRoleNamelist({});
const res1 = await getTreeList({ deptId: "", status: 1 }); const res1 = await getTreeList({ deptId: "" });
formConfig.formItemConfig[7].data = res1.result.map(i => { formConfig.formItemConfig[7].data = res1.result.map(i => {
return { return {
label: i.deptName, label: i.deptName,
value: i.deptId value: i.deptId,
disabled: i.status == 0 ? true : false
}; };
}); });
formConfig.formItemConfig[9].data = res.result.map(i => { formConfig.formItemConfig[9].data = res.result.map(i => {