|
@@ -1,463 +0,0 @@
|
|
|
-import { createStore } from 'vuex'
|
|
|
-
|
|
|
-export default createStore({
|
|
|
- state: {
|
|
|
- query: null,
|
|
|
- siteId: 1, //公共api请求参数->siteId
|
|
|
- Time_Data: [], //公共api请求参数->Time_Data
|
|
|
- timearr: [], //公共处理开始时间和结束时间中的时间段天数 值存储
|
|
|
- itemStyle: [{
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(0,244,253,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(0,244,253,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(253,143,0,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(253,143,0,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(0,255,18,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(0,255,18,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(0,255,230,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(0,255,230,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(142,51,255,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(142,51,255,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(77,200,120,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(77,200,120,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(255,47,47,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(255,47,47,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(70,100,255,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(70,100,255,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(255,143,53,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(255,143,53,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(150,150,50,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(150,150,50,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(70,192,255,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(70,192,255,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(20,99,100,1)",
|
|
|
- borderWidth: 2,
|
|
|
- color: "rgba(6, 68, 83, 1)",
|
|
|
- lineStyle: {
|
|
|
- width: 2, //折线宽度
|
|
|
- color: "rgba(20,99,100,1)",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- ], //公共echarts图表样式
|
|
|
- Time_All: [], //公共时间 返回数组 -> 年月日时分秒 时间戳
|
|
|
-
|
|
|
-
|
|
|
- queryType: '', //设备监控--->数据报表api请求参数->queryType
|
|
|
- run_off_Status: null, //设备监控--->运行状态统计->echarts->OFF次数分布和运行状态曲线图表 api信息存储
|
|
|
- HistoricalCurve: null, //设备监控--->历史趋势->echarts->曲线图表 api信息存储
|
|
|
- se_defaultTime: [], //设备监控--->历史趋势时间选择器v-model
|
|
|
- th_defaultTime: [], //设备监控--->数据报表时间选择器v-model
|
|
|
- fh_defaultTime: [], //设备监控--->运行状态统计时间选择器v-model
|
|
|
- table_list: [{
|
|
|
- name: "电流",
|
|
|
- list: [
|
|
|
- { name: "A相电流", value: "Ia" },
|
|
|
- { name: "B相电流", value: "Ib" },
|
|
|
- { name: "C相电流", value: "Ic" },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "功率",
|
|
|
- list: [
|
|
|
- { name: "A相有功功率 kW", value: "Pa" },
|
|
|
- { name: "A相无功功率 kVar", value: "Qa" },
|
|
|
- { name: "B相有功功率 kW", value: "Pb" },
|
|
|
- { name: "B相无功功率 kVar", value: "Qb" },
|
|
|
- { name: "C相有功功率 kW", value: "Pc" },
|
|
|
- { name: "C相无功功率 kVar", value: "Qc" },
|
|
|
- { name: "总有功功率 kW", value: "P" },
|
|
|
- { name: "总无功功率 kW", value: "Q" },
|
|
|
- { name: "实时需量 kW", value: "Demand" },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "电度",
|
|
|
- list: [
|
|
|
- { name: "正有功电度 kWh", value: "Epp" },
|
|
|
- { name: "负有功电度 kWh", value: "Epn" },
|
|
|
- { name: "正无功电度 kvarh", value: "Eqp" },
|
|
|
- { name: "负无功电度 kvarh", value: "Eqn" },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "电压",
|
|
|
- list: [
|
|
|
- { name: "A相电压 kV", value: "Ua" },
|
|
|
- { name: "B相电压 kV", value: "Ub" },
|
|
|
- { name: "C相电压 kV", value: "Uc" },
|
|
|
- { name: "回路电压 V", value: "Ul" },
|
|
|
- { name: "AB线电压 V", value: "Uab" },
|
|
|
- { name: "BC线电压 V", value: "Ubc" },
|
|
|
- { name: "CA线电压 V", value: "Uca" },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "温度 ℃",
|
|
|
- list: [
|
|
|
- { name: "外接温度1", value: "T1" },
|
|
|
- { name: "外接温度2", value: "T2" },
|
|
|
- { name: "外接温度3", value: "T3" },
|
|
|
- { name: "外接温度4", value: "T4" },
|
|
|
- { name: "环境温度", value: "DeviceTemp" },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "频率 Hz",
|
|
|
- list: [{ name: "频率", value: "F" }],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "功率因数",
|
|
|
- list: [
|
|
|
- { name: "A相功率因数", value: "COSa" },
|
|
|
- { name: "B相功率因数", value: "COSb" },
|
|
|
- { name: "C相功率因数", value: "COSc" },
|
|
|
- { name: "功率因数", value: "COS" },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "谐波电流有效值 A",
|
|
|
- list: [
|
|
|
- { name: "Ia总谐波电流", value: "IHa" },
|
|
|
- { name: "Ib总谐波电流", value: "IHa" },
|
|
|
- { name: "Ic总谐波电流", value: "IHc" },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "通讯参数",
|
|
|
- list: [{ name: "设备信号强度", value: "SignalIntensity" }],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "电压突变 次",
|
|
|
- list: [
|
|
|
- { name: "电压暂升次数", value: "Upt" },
|
|
|
- { name: "电压暂降次数", value: "Udt" },
|
|
|
- { name: "电压中断次数", value: "Ust" },
|
|
|
- ],
|
|
|
- },
|
|
|
- ], //设备监控--->数据报表->默认tabs数据
|
|
|
- se_tabs: [
|
|
|
- { label: '电流', name: "I" },
|
|
|
- { label: '功率', name: "P" },
|
|
|
- { label: '电度', name: "KWh" },
|
|
|
- { label: '电压', name: "V" },
|
|
|
- { label: '温度', name: "C" },
|
|
|
- { label: '频率', name: "HZ" },
|
|
|
- { label: '功率因数', name: "PS" },
|
|
|
- { label: '谐波电流有效值', name: "RMS" },
|
|
|
- { label: '通讯参数', name: "DDB" },
|
|
|
- { label: '电压突变', name: "VT" },
|
|
|
- ], //设备监控--->历史趋势->默认tabs数据
|
|
|
-
|
|
|
- trendIco: null, //事件告警--->事件告警统计->echarts->柱状图 api信息存储
|
|
|
- trendIco_state: null, //事件告警--->事件告警统计->select状态api信息存储
|
|
|
- trendIco_table: [
|
|
|
- { label: '发生时间', porp: 'soeTime' },
|
|
|
- { label: '告警描述', porp: 'measName' },
|
|
|
- { label: '设备', porp: 'deviceCode' },
|
|
|
- { label: '告警类型', porp: 'alarmName' },
|
|
|
- { label: '状态', porp: 'handlingStatus' },
|
|
|
- { label: '处理人', porp: 'handler' },
|
|
|
- { label: '处理时间', porp: 'handlingTime' },
|
|
|
- ], //事件告警--->事件告警统计->表格默认值存储
|
|
|
-
|
|
|
-
|
|
|
- trendIcoCount: null,
|
|
|
- },
|
|
|
- mutations: {
|
|
|
- /**
|
|
|
- * @公共api请求参数siteId
|
|
|
- * @param {*}} state
|
|
|
- * @param {*} val
|
|
|
- */
|
|
|
- increment(state, val) {
|
|
|
- state.siteId = val
|
|
|
- },
|
|
|
- /**
|
|
|
- * @数据报表 —> 多选按钮数据处理
|
|
|
- * @param {*} state
|
|
|
- * @param {*} checked_list
|
|
|
- */
|
|
|
- checkedCities_all(state, checked_list) {
|
|
|
- state.queryType = ''
|
|
|
- var checked = ''
|
|
|
- for (let i in checked_list) {
|
|
|
- checked_list[i] === "电流" ?
|
|
|
- checked = "I" :
|
|
|
- checked_list[i] === "功率" ?
|
|
|
- checked = "P" :
|
|
|
- checked_list[i] === "电度" ?
|
|
|
- checked = "KWh" :
|
|
|
- checked_list[i] === "电压" ?
|
|
|
- checked = "V" :
|
|
|
- checked_list[i] === "温度" ?
|
|
|
- checked = "C" :
|
|
|
- checked_list[i] === "频率" ?
|
|
|
- checked = "HZ" :
|
|
|
- checked_list[i] === "功率因数" ?
|
|
|
- checked = "PS" :
|
|
|
- checked_list[i] === "谐波电流有效值" ?
|
|
|
- checked = "RMS" :
|
|
|
- checked_list[i] === "通讯参数" ?
|
|
|
- checked = "DDB" :
|
|
|
- checked_list[i] === "电压突变" ?
|
|
|
- checked = "VT" :
|
|
|
- ""
|
|
|
- state.queryType += checked_list.length > 1 ? checked + "," : checked;
|
|
|
- }
|
|
|
- state.queryType = checked_list.length > 1 ? state.queryType.slice(0, state.queryType.length - 1) : state.queryType
|
|
|
- },
|
|
|
- /**
|
|
|
- * @历史趋势 -> echarts ->曲线图表 api信息存储
|
|
|
- */
|
|
|
- HistoricalCurve(state, data) {
|
|
|
- state.HistoricalCurve = data
|
|
|
- },
|
|
|
- /**
|
|
|
- * @公共处理时区方法
|
|
|
- */
|
|
|
- TimeAll_function(state, time) {
|
|
|
- state.Time_Data = []
|
|
|
- for (let i in time) {
|
|
|
- var Y = time[i].getFullYear() < 10 ? '0' + time[i].getFullYear() : time[i].getFullYear()
|
|
|
- var M = (time[i].getMonth() + 1) < 10 ? '0' + (time[i].getMonth() + 1) : (time[i].getMonth() + 1)
|
|
|
- var D = time[i].getDate() < 10 ? '0' + time[i].getDate() : time[i].getDate()
|
|
|
- var HH = time[i].getHours() < 10 ? '0' + time[i].getHours() : time[i].getHours()
|
|
|
- var MM = time[i].getMinutes() < 10 ? '0' + time[i].getMinutes() : time[i].getMinutes()
|
|
|
- var SS = time[i].getSeconds() < 10 ? '0' + time[i].getSeconds() : time[i].getSeconds()
|
|
|
- // console.log(Y + '-' + M + '-' + D + ' ' + HH + ':' + MM + ':' + SS)
|
|
|
- state.Time_Data.push(Y + '-' + M + '-' + D + ' ' + HH + ':' + MM + ':' + SS)
|
|
|
- }
|
|
|
- },
|
|
|
- /**
|
|
|
- * @公共处理开始时间和结束时间中的时间段天数
|
|
|
- * @param {*} state
|
|
|
- * @param {*} begin 开始时间和结束时间
|
|
|
- */
|
|
|
- getAll(state, begin) {
|
|
|
- let arr1 = begin[0].split("-");
|
|
|
- let arr2 = begin[1].split("-");
|
|
|
- let arr1_ = new Date();
|
|
|
- let arrTime = [];
|
|
|
- arr1_.setUTCFullYear(arr1[0], arr1[1] - 1, arr1[2]);
|
|
|
- let arr2_ = new Date();
|
|
|
- arr2_.setUTCFullYear(arr2[0], arr2[1] - 1, arr2[2]);
|
|
|
- let unixDb = arr1_.getTime();
|
|
|
- let unixDe = arr2_.getTime();
|
|
|
- for (let k = unixDb; k <= unixDe;) {
|
|
|
- arrTime.push(datetimeparse(k, "YY-MM-DD"));
|
|
|
- k = k + 24 * 60 * 60 * 1000;
|
|
|
- }
|
|
|
- state.timearr = arrTime
|
|
|
- // return arrTime;
|
|
|
- // 时间格式处理
|
|
|
- function datetimeparse(timestamp, format, prefix) {
|
|
|
- if (typeof timestamp == "string") {
|
|
|
- timestamp = Number(timestamp);
|
|
|
- }
|
|
|
- //转换时区
|
|
|
- let currentZoneTime = new Date(timestamp);
|
|
|
- let currentTimestamp = currentZoneTime.getTime();
|
|
|
- let offsetZone = currentZoneTime.getTimezoneOffset() / 60; //如果offsetZone>0是西区,西区晚
|
|
|
- let offset = null;
|
|
|
- //客户端时间与服务器时间保持一致,固定北京时间东八区。
|
|
|
- offset = offsetZone + 8;
|
|
|
- currentTimestamp = currentTimestamp + offset * 3600 * 1000;
|
|
|
-
|
|
|
- let newtimestamp = null;
|
|
|
- if (currentTimestamp) {
|
|
|
- if (currentTimestamp.toString().length === 13) {
|
|
|
- newtimestamp = currentTimestamp.toString();
|
|
|
- } else if (currentTimestamp.toString().length === 10) {
|
|
|
- newtimestamp = currentTimestamp + "000";
|
|
|
- } else {
|
|
|
- newtimestamp = null;
|
|
|
- }
|
|
|
- } else {
|
|
|
- newtimestamp = null;
|
|
|
- }
|
|
|
- let dateobj = newtimestamp ?
|
|
|
- new Date(parseInt(newtimestamp)) :
|
|
|
- new Date();
|
|
|
- let YYYY = dateobj.getFullYear();
|
|
|
- let MM =
|
|
|
- dateobj.getMonth() > 8 ?
|
|
|
- dateobj.getMonth() + 1 :
|
|
|
- "0" + (dateobj.getMonth() + 1);
|
|
|
- let DD =
|
|
|
- dateobj.getDate() > 9 ? dateobj.getDate() : "0" + dateobj.getDate();
|
|
|
- let HH =
|
|
|
- dateobj.getHours() > 9 ? dateobj.getHours() : "0" + dateobj.getHours();
|
|
|
- let mm =
|
|
|
- dateobj.getMinutes() > 9 ?
|
|
|
- dateobj.getMinutes() :
|
|
|
- "0" + dateobj.getMinutes();
|
|
|
- let ss =
|
|
|
- dateobj.getSeconds() > 9 ?
|
|
|
- dateobj.getSeconds() :
|
|
|
- "0" + dateobj.getSeconds();
|
|
|
- let output = "";
|
|
|
- let separator = "/";
|
|
|
- if (format) {
|
|
|
- separator = format.match(/-/) ? "-" : "/";
|
|
|
- output += format.match(/yy/i) ? YYYY : "";
|
|
|
- output += format.match(/MM/) ?
|
|
|
- (output.length ? separator : "") + MM :
|
|
|
- "";
|
|
|
- output += format.match(/dd/i) ?
|
|
|
- (output.length ? separator : "") + DD :
|
|
|
- "";
|
|
|
- output += format.match(/hh/i) ? (output.length ? " " : "") + HH : "";
|
|
|
- output += format.match(/mm/) ? (output.length ? ":" : "") + mm : "";
|
|
|
- output += format.match(/ss/i) ? (output.length ? ":" : "") + ss : "";
|
|
|
- } else {
|
|
|
- output += YYYY + separator + MM + separator + DD;
|
|
|
- }
|
|
|
- output = prefix ? prefix + output : output;
|
|
|
- return newtimestamp ? output : "";
|
|
|
- }
|
|
|
- },
|
|
|
- /**
|
|
|
- * @公共echarts图表下载
|
|
|
- */
|
|
|
- getConnectedDataURL(state, refs) {
|
|
|
- state || refs
|
|
|
- var url = refs[0].getConnectedDataURL({
|
|
|
- pixelRatio: 15,
|
|
|
- backgroundColor: "black",
|
|
|
- excludeComponents: ["toolbox"],
|
|
|
- type: "png",
|
|
|
- });
|
|
|
- var $a = document.createElement("a");
|
|
|
- var type = "png";
|
|
|
- //图片名称
|
|
|
- $a.download = refs[1] + "." + type;
|
|
|
- $a.target = "_blank";
|
|
|
- $a.href = url;
|
|
|
- if (typeof MouseEvent === "function") {
|
|
|
- var evt = new MouseEvent("click", {
|
|
|
- view: window,
|
|
|
- bubbles: true,
|
|
|
- cancelable: false,
|
|
|
- });
|
|
|
- $a.dispatchEvent(evt);
|
|
|
- }
|
|
|
- },
|
|
|
- /**
|
|
|
- * @公共时间 返回数组 -> 年月日时分秒 时间戳
|
|
|
- */
|
|
|
- getTimeAll(state) {
|
|
|
- const time = new Date();
|
|
|
- const Y = time.getFullYear(); //年
|
|
|
- const M = time.getMonth(); //月
|
|
|
- const D = time.getDate(); //日
|
|
|
- const HH = time.getHours(); //时,
|
|
|
- const MM = time.getMinutes(); //分
|
|
|
- const SS = time.getSeconds(); //秒
|
|
|
- const timestamp = new Date().getTime(); //时间戳
|
|
|
- state.Time_All = [Y, M, D, HH, MM, SS, timestamp]
|
|
|
- state.se_defaultTime = [new Date(Y, M, D, 0, 0, 0), new Date()] //设备监控--->历史趋势时间选择器v-model //home设备总数
|
|
|
- state.th_defaultTime = [new Date(Y, M, D, 0, 0, 0), new Date()] //设备监控--->数据报表时间选择器v-model //home运维管理
|
|
|
- state.fh_defaultTime = [new Date(Y, M, 1, 0, 0, 0), new Date()] //设备监控--->运行状态统计时间选择器v-model //概览 -> 告警统计折线图
|
|
|
- },
|
|
|
- }
|
|
|
-})
|