修改大屏问题

dev_xd
lj7788@126.com 2025-06-11 22:01:29 +08:00
parent b3ddd1ae17
commit 9db50321d6
4 changed files with 191 additions and 174 deletions

View File

@ -1,5 +1,5 @@
import request from "@/utils/request"; import request from "@/utils/request";
import dayjs from 'dayjs' import dayjs from "dayjs";
const groupByAll = (data) => { const groupByAll = (data) => {
return new Promise((resolve) => { return new Promise((resolve) => {
return request({ return request({
@ -7,24 +7,24 @@ const groupByAll = (data) => {
method: "get", method: "get",
params: data, params: data,
}).then((d) => { }).then((d) => {
let tmps=(d.data||[]).map(it=>{ let tmps = (d.data || []).map((it) => {
it.sumEmissionReduction = (it.sumEstimateValue || 0) - (it.sumPracticalValue || 0); it.sumEmissionReduction = (it.sumEstimateValue || 0) - (it.sumPracticalValue || 0);
it.emissionReduction = (it.estimateValue || 0) - (it.practicalValue || 0); it.emissionReduction = (it.estimateValue || 0) - (it.practicalValue || 0);
return it; return it;
}) });
let sumEmissionReduction = 0; let sumEmissionReduction = 0;
let sumEstimateValue = 0; let sumEstimateValue = 0;
let sumPracticalValue = 0; let sumPracticalValue = 0;
let emissionReduction = 0; let emissionReduction = 0;
let estimateValue = 0; let estimateValue = 0;
let practicalValue = 0; let practicalValue = 0;
tmps.forEach(it=>{ tmps.forEach((it) => {
sumEmissionReduction+=(it.sumEmissionReduction||0); sumEmissionReduction += it.sumEmissionReduction || 0;
sumEstimateValue+=(it.sumEstimateValue||0); sumEstimateValue += it.sumEstimateValue || 0;
sumPracticalValue+=(it.sumPracticalValue||0); sumPracticalValue += it.sumPracticalValue || 0;
emissionReduction+=(it.emissionReduction||0); emissionReduction += it.emissionReduction || 0;
estimateValue+=(it.estimateValue||0); estimateValue += it.estimateValue || 0;
practicalValue+=(it.practicalValue||0); practicalValue += it.practicalValue || 0;
}); });
tmps.push({ tmps.push({
factorType: 0, factorType: 0,
@ -33,9 +33,9 @@ const groupByAll = (data) => {
sumPracticalValue: sumPracticalValue, sumPracticalValue: sumPracticalValue,
emissionReduction: emissionReduction, emissionReduction: emissionReduction,
estimateValue: estimateValue, estimateValue: estimateValue,
practicalValue:practicalValue practicalValue: practicalValue,
}) });
resolve(tmps) resolve(tmps);
}); });
}); });
}; };
@ -46,26 +46,26 @@ const groupCurrentMonth = (data) => {
url: "/manage/greenCarbonData/groupCurrentMonth", url: "/manage/greenCarbonData/groupCurrentMonth",
method: "get", method: "get",
params: data, params: data,
}).then(d=>{ }).then((d) => {
let tmps=(d.data||[]).map(it=>{ let tmps = (d.data || []).map((it) => {
it.emissionReduction = (it.estimateValue || 0) - (it.practicalValue || 0); it.emissionReduction = (it.estimateValue || 0) - (it.practicalValue || 0);
return it; return it;
}) });
let emissionReduction = 0; let emissionReduction = 0;
let estimateValue = 0; let estimateValue = 0;
let practicalValue = 0; let practicalValue = 0;
tmps.forEach(it=>{ tmps.forEach((it) => {
emissionReduction+=(it.emissionReduction||0); emissionReduction += it.emissionReduction || 0;
estimateValue+=(it.estimateValue||0); estimateValue += it.estimateValue || 0;
practicalValue+=(it.practicalValue||0); practicalValue += it.practicalValue || 0;
}); });
tmps.push({ tmps.push({
factorType: 0, factorType: 0,
emissionReduction: emissionReduction, emissionReduction: emissionReduction,
estimateValue: estimateValue, estimateValue: estimateValue,
practicalValue:practicalValue practicalValue: practicalValue,
}) });
resolve(tmps) resolve(tmps);
}); });
}); });
}; };
@ -78,26 +78,28 @@ const getGroupData=(tmps,data,factorType,dataType)=>{
let year = date.$y; let year = date.$y;
let month = date.$M + 1; let month = date.$M + 1;
titles.push(month + "月"); titles.push(month + "月");
let objs=tmps.filter(it=>(it.factorType==factorType||factorType==0)&& it.comId==year && it.projectId==month); let objs = tmps.filter((it) => (it.factorType == factorType || factorType == 0) && it.comId == year && it.projectId == month);
let val=null; let val = 0;
if (objs.length > 0) { if (objs.length > 0) {
objs.forEach((obj) => {
if (dataType == 1) { if (dataType == 1) {
val=objs[0].estimateValue/1000.0 val += obj.estimateValue / 1000.0;
} }
if (dataType == 2) { if (dataType == 2) {
val=objs[0].practicalValue/1000.0 val += obj.practicalValue / 1000.0;
} }
if (dataType == 3) { if (dataType == 3) {
val=((objs[0].estimateValue||0) - (val=objs[0].practicalValue||0))/1000.0 val += ((obj.estimateValue || 0) - (val = obj.practicalValue || 0)) / 1000.0;
} }
});
} }
res.push(val); res.push(val);
} }
return { return {
titles: titles, titles: titles,
datas:res datas: res,
} };
} };
const groupByYearMonth = (data) => { const groupByYearMonth = (data) => {
return new Promise((resolve) => { return new Promise((resolve) => {
@ -105,7 +107,7 @@ const groupByYearMonth = (data) => {
url: "/manage/greenCarbonData/groupByYearMonth", url: "/manage/greenCarbonData/groupByYearMonth",
method: "get", method: "get",
params: data, params: data,
}).then(d=>{ }).then((d) => {
let tmps = d.data || []; let tmps = d.data || [];
let buildData = { let buildData = {
//预估 //预估
@ -144,8 +146,7 @@ const groupByYearMonth = (data) => {
oilData: oilData, oilData: oilData,
powerData: powerData, powerData: powerData,
totalData: totalData, totalData: totalData,
}) });
}); });
}); });
}; };

View File

@ -268,7 +268,7 @@ export default {
series: [ series: [
{ {
type: 'pie', type: 'pie',
radius: '70%', radius: '50%',
avoidLabelOverlap: false, avoidLabelOverlap: false,
bottom: is1K ? '5%' : is2K ? '15%' : '10%', bottom: is1K ? '5%' : is2K ? '15%' : '10%',
top: '-10%', top: '-10%',

View File

@ -276,6 +276,10 @@ public class SysUserController extends BaseController {
@GetMapping("/getInfo") @GetMapping("/getInfo")
public AjaxResult getInfo() { public AjaxResult getInfo() {
SysUser user = SecurityUtils.getLoginUser().getSysUser(); SysUser user = SecurityUtils.getLoginUser().getSysUser();
SysDept dept= deptService.selectDeptById(user.getDeptId());
user.setComId(dept.getComId());
user.setActiveComId(dept.getComId());
user.setDept(dept);
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("user", user); ajax.put("user", user);
if(Objects.nonNull(user.getRoles()) && user.getRoles().size()>0){ if(Objects.nonNull(user.getRoles()) && user.getRoles().size()>0){

View File

@ -109,7 +109,11 @@ import useUserStore from "@/store/modules/user";
import { listBimModel } from "@/api/bim/bimModel"; import { listBimModel } from "@/api/bim/bimModel";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { emitter } from "@/router/index.js"; import { emitter } from "@/router/index.js";
import { devicePositionGet,devicePositionAddItems, devicePositionUpdateItems} from "@/api/bim/bim.js"; import {
devicePositionGet,
devicePositionAddItems,
devicePositionUpdateItems,
} from "@/api/bim/bim.js";
import icons from "./icons.js"; import icons from "./icons.js";
export default { export default {
name: "SandTableSetting", name: "SandTableSetting",
@ -159,51 +163,55 @@ export default {
confirmButtonText: "确 认", confirmButtonText: "确 认",
cancelButtonText: "取 消", cancelButtonText: "取 消",
}).then(() => { }).then(() => {
let adds=this.devices.filter((item)=>{ let adds = this.devices
return item.id==null .filter((item) => {
}).map(item=>{ return item.id == null;
})
.map((item) => {
return { return {
deviceId: item.deviceId, deviceId: item.deviceId,
deviceType: item.deviceType, deviceType: item.deviceType,
position: JSON.stringify(item.position), position: JSON.stringify(item.position),
enabled: item.show ? 1 : 0, enabled: item.show ? 1 : 0,
currentUser: this.userStore.name, currentUser: this.userStore.name,
remark:'', remark: "",
} };
});
let updates = this.devices
.filter((item) => {
return item.id != null;
}) })
let updates=this.devices.filter((item)=>{ .map((item) => {
return item.id!=null
}).map(item=>{
return { return {
id: item.id, id: item.id,
position: JSON.stringify(item.position), position: JSON.stringify(item.position),
currentUser: this.userStore.name, currentUser: this.userStore.name,
enabled: item.show ? 1 : 0, enabled: item.show ? 1 : 0,
} };
}) });
console.log("-->",adds,updates) console.log("-->", adds, updates);
let ajaxs = []; let ajaxs = [];
if (adds.length > 0) { if (adds.length > 0) {
ajaxs.push(devicePositionAddItems({items:adds})) ajaxs.push(devicePositionAddItems({ items: adds }));
} }
if (updates.length > 0) { if (updates.length > 0) {
ajaxs.push(devicePositionUpdateItems({items:updates})) ajaxs.push(devicePositionUpdateItems({ items: updates }));
} }
Promise.all(ajaxs).then((res) => { Promise.all(ajaxs).then((res) => {
ElMessage.success("保存成功") ElMessage.success("保存成功");
}) });
}); });
}, },
clearLabels() { clearLabels() {
this.addLabels.forEach(id=>{ this.addLabels.forEach((id) => {
window.sandSettingApi.Label.removeBalloon(id); window.sandSettingApi.Label.removeBalloon(id);
}) });
this.addLabels = []; this.addLabels = [];
}, },
addDeviceLabel() { addDeviceLabel() {
this.devices.forEach(d=>{ this.devices.forEach((d) => {
if (d.position && d.position.length > 0) { if (d.position && d.position.length > 0) {
this.AddLable(d) this.AddLable(d);
} }
}); });
}, },
@ -249,18 +257,22 @@ export default {
window.sandSettingApi.Feature.getByPosition([e.x, e.y], (n) => { window.sandSettingApi.Feature.getByPosition([e.x, e.y], (n) => {
if (n && n["id"]) { if (n && n["id"]) {
this.positionByModalId = n.id.split("^")[0]; this.positionByModalId = n.id.split("^")[0];
} else {
ElMessage.warning("请在模型上选点!");
}
});
});
window.sandSettingApi.Public.pickupCoordinate(true, (e) => { window.sandSettingApi.Public.pickupCoordinate(true, (e) => {
if (!this.positionByModalId) {
return;
}
this.selItem.position = e; this.selItem.position = e;
window.sandSettingApi.Label.removeBalloon(item.elId); window.sandSettingApi.Label.removeBalloon(item.elId);
this.AddLable(this.selItem); this.AddLable(this.selItem);
window.sandSettingApi.Public.pickupCoordinate(false); window.sandSettingApi.Public.pickupCoordinate(false);
window.sandSettingApi.Public.clearHandler(); window.sandSettingApi.Public.clearHandler();
}); });
} else {
ElMessage.warning("请在模型上选点!");
}
});
});
}, },
doToolsClose() { doToolsClose() {
this.activeMenu = 0; this.activeMenu = 0;