初次提交

This commit is contained in:
2025-06-30 10:21:25 +08:00
commit 150b39dfea
396 changed files with 80277 additions and 0 deletions

250
common/common.js Normal file
View File

@ -0,0 +1,250 @@
/**
* 通用js方法封装处理
*/
import CryptoJS from 'crypto-js'
import JSEncrypt from 'jsencrypt'
export function replaceAll (text, stringToFind, stringToReplace) {
if (stringToFind == stringToReplace) return this
var temp = text
var index = temp.indexOf(stringToFind)
while (index != -1) {
temp = temp.replace(stringToFind, stringToReplace)
index = temp.indexOf(stringToFind)
}
return temp
}
export function encryptPsd (data) {
const RamKey = getRamNumber()
const RamIv = getRamNumber()
const key = CryptoJS.enc.Utf8.parse(RamKey)
const iv = CryptoJS.enc.Utf8.parse(RamIv)
const srcs = CryptoJS.enc.Utf8.parse(data)
var encrypted = CryptoJS.AES.encrypt(srcs, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
})
return {
key: RamKey,
iv: RamIv,
password: CryptoJS.enc.Base64.stringify(encrypted.ciphertext)
}
}
export function encryptUpdatePsd (RamIv,RamKey,data) {
const key = CryptoJS.enc.Utf8.parse(RamKey)
const iv = CryptoJS.enc.Utf8.parse(RamIv)
const srcs = CryptoJS.enc.Utf8.parse(data)
var encrypted = CryptoJS.AES.encrypt(srcs, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
})
return CryptoJS.enc.Base64.stringify(encrypted.ciphertext)
}
export function getRamNumber () {
var result = ''
for (var i = 0; i < 16; i++) {
result += Math.floor(Math.random() * 16).toString(16)// 获取0-15并通过toString转16进制
}
// 默认字母小写,手动转大写
return result.toUpperCase()// 另toLowerCase()转小写
}
export function JSEncryptData (iv, key) {
const encrypt = new JSEncrypt()
// 将公钥存入内
const publicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuG6ZABNgLQCI9iVPDuJEb7xb5zR9UGKyKXshLuJFZxyNtaEzfpjSMqsshUYA1QpwUvkmZE0lcRE4F4QtZO9rDnH2PoW1FWRbjgg0+MKWOmZr9hSPKM/BIE+knTtTaj4/0TK7QwDd9q/QAIduC1hIyxIIkxfWx0gFuTnxui0waCwIDAQAB'
encrypt.setPublicKey(publicKey)
const ivData = encrypt.encrypt(iv)
const keyData = encrypt.encrypt(key)
return {
ivData: ivData,
keyData: keyData
}
}
/**
* Parse the time to string
* @param {(Object|string|number)} time
* @param {string} cFormat
* @returns {string | null}
*/
export function parseTime (time, cFormat) {
if (arguments.length === 0 || !time) {
return null
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string')) {
if ((/^[0-9]+$/.test(time))) {
// support "1548221490638"
time = parseInt(time)
} else {
// support safari
// https://stackoverflow.com/questions/4310953/invalid-date-in-safari
time = time.replace(new RegExp(/-/gm), '/')
}
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
const value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
return value.toString().padStart(2, '0')
})
return time_str
}
export function getLastYear (yearNum = 1) {
const today = new Date() // 当天
today.setFullYear(today.getFullYear() - yearNum)
return today
}
export function getLastDay (yearNum = 1) {
const today = new Date() // 当天
today.setDate(today.getDate() - yearNum)
return today
}
export function transformTree (array, id_key, parentId_key, isRoot) {
if (!array) return []
const idsObj = array.reduce((pre, cur) => Object.assign(pre, { [cur[id_key]]: cur }), {})
return Object.values(idsObj).reduce((pre, cur) => {
const parent = idsObj[cur[parentId_key]]
if (!isRoot(cur, parent)) {
!parent.children && (parent.children = [])
const children = parent.children
!children.includes(cur) && children.push(cur)
} else {
pre.push(cur)
}
return pre
}, [])
}
//判断值为空的状态
export function formatValue(type,value){
if(type === 'number'){
if(value === null || value === undefined){
return 0
}
return value
}else if(type ==='string'){
if(value === null || value === undefined){
return ''
}
return value
}
return value
}
export function dataConversion(target) {
let date = new Date(target);
let y = date.getFullYear(); // 年
let MM = date.getMonth() + 1; // 月
MM = MM < 10 ? ('0' + MM) : MM;
let d = date.getDate(); // 日
d = d < 10 ? ('0' + d) : d;
let h = date.getHours(); // 时
h = h < 10 ? ('0' + h) : h;
let m = date.getMinutes(); // 分
m = m < 10 ? ('0' + m) : m;
let s = date.getSeconds(); // 秒
s = s < 10 ? ('0' + s) : s;
return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
}
export function chartYIndex(value) {
if (value.name.toLowerCase().includes('pcs') || value.name.includes('有功功率')) {
return 0
} else if (value.name.toLowerCase().includes('bms') || value.name.toLowerCase().includes('soc')) {
return 1
} else {
return 0
}
}
export function beforeDayTime() {
// 获取当前时间
var now = new Date();
// 将时间调整到24小时前
now.setHours(now.getHours() - 24);
// 格式化输出开始时间
var year_start = now.getFullYear();
var month_start = now.getMonth() + 1;
month_start = month_start < 10 ? "0" + month_start : month_start;
var day_start = now.getDate();
day_start = day_start < 10 ? "0" + day_start : day_start;
var hours_start = now.getHours();
hours_start = hours_start < 10 ? "0" + hours_start : hours_start;
var minutes_start = now.getMinutes();
minutes_start = minutes_start < 10 ? "0" + minutes_start : minutes_start;
var seconds_start = now.getSeconds();
seconds_start = seconds_start < 10 ? "0" + seconds_start : seconds_start;
var formattedTime_start =
year_start +
"-" +
month_start +
"-" +
day_start +
" " +
hours_start +
":" +
minutes_start +
":" +
seconds_start;
// 获取当前时间
var now_end = new Date();
// 格式化输出结束时间
var year_end = now_end.getFullYear();
var month_end = now_end.getMonth() + 1;
month_end = month_end < 10 ? "0" + month_end : month_end;
var day_end = now_end.getDate();
day_end = day_end < 10 ? "0" + day_end : day_end;
var hours_end = now_end.getHours();
hours_end = hours_end < 10 ? "0" + hours_end : hours_end;
var minutes_end = now_end.getMinutes();
minutes_end = minutes_end < 10 ? "0" + minutes_end : minutes_end;
var seconds_end = now_end.getSeconds();
seconds_end = seconds_end < 10 ? "0" + seconds_end : seconds_end;
var formattedTime_end =
year_end +
"-" +
month_end +
"-" +
day_end +
" " +
hours_end +
":" +
minutes_end +
":" +
seconds_end;
return [formattedTime_start, formattedTime_end];
}

27
common/config.js Normal file
View File

@ -0,0 +1,27 @@
const config = {
// 产品名称
productName: 'Hoenery',
// 公司名称
companyName: 'Hoenery',
// 产品版本号
productVersion: 'V1.0.0',
// 版本检查标识
appCode: 'android',
// 内部版本号码
appVersion: '1.0.0',
// 管理基础路径
adminPath: ''
}
// 设置后台接口服务的基础地址
config.baseUrl = "https://ecloud.hoenergypower.cn/api"
export default config

229
common/filters.js Normal file
View File

@ -0,0 +1,229 @@
// import parseTime, formatTime and set to filter
// export { parseTime, formatTime } from '@/utils'
/**
* Show plural label if time is plural number
* @param {number} time
* @param {string} label
* @return {string}
*/
function pluralize(time, label) {
if (time === 1) {
return time + label
}
return time + label + 's'
}
/**
* @param {number} time
*/
export function timeAgo(time) {
const between = Date.now() / 1000 - Number(time)
if (between < 3600) {
return pluralize(~~(between / 60), ' minute')
} else if (between < 86400) {
return pluralize(~~(between / 3600), ' hour')
} else {
return pluralize(~~(between / 86400), ' day')
}
}
/**
* Number formatting
* like 10000 => 10k
* @param {number} num
* @param {number} digits
*/
export function numberFormatter(num, digits) {
const si = [
{ value: 1E18, symbol: 'E' },
{ value: 1E15, symbol: 'P' },
{ value: 1E12, symbol: 'T' },
{ value: 1E9, symbol: 'G' },
{ value: 1E6, symbol: 'M' },
{ value: 1E3, symbol: 'k' }
]
for (let i = 0; i < si.length; i++) {
if (num >= si[i].value) {
return (num / si[i].value).toFixed(digits).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + si[i].symbol
}
}
return num.toString()
}
/**
* 10000 => "10,000"
* @param {number} num
*/
export function toThousandFilter(num) {
return (+num || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
}
/**
* Upper case first char
* @param {String} string
*/
export function uppercaseFirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1)
}
/**
* Number formatting
* kwh 转化 Mwh
* @param {number} num
* @param {number} digits
*/
export function kwhFormat(num, digits) {
if (!num) {
return 0
}
if (!digits) {
digits = 2
}
if(Number(num) >= 1E7){
return (Number(num) / 1E6).toFixed(digits) + ''
}else if (Number(num) >= 1E4) {
return (Number(num) / 1E3).toFixed(digits) + ''
}
return Number(num).toFixed(digits) + ''
}
/**
* Number formatting
* kwh 转化 Mwh
* @param {number} num
* @param {number} digits
*/
export function kWFormat(num, digits) {
if (!num) {
return 0
}
if (!digits) {
digits = 2
}
if (Number(num) >= 1E4) {
return (Number(num) / 1E3).toFixed(digits) + ''
}
return Number(num).toFixed(digits) + ''
}
/**
* unit formatting
* kwh 转化 Mwh
* @param {number} num
* @param {number} digits
*/
export function kwhUnitFormat(num) {
if (!num) {
return 'kWh'
}
if(Number(num) >= 1E7){
return 'GWh'
}else if (Number(num) >= 1E4) {
return 'MWh'
}
return 'kWh'
}
/**
* unit formatting
* kwh 转化 Mwh
* @param {number} num
* @param {number} digits
*/
export function kwpUnitFormat(num) {
if (!num) {
return 'kWp'
}
if (Number(num) >= 1E4) {
return 'Mwp'
}
return 'kWp'
}
/**
* unit formatting
* kwh 转化 Mwh
* @param {number} num
* @param {number} digits
*/
export function kwUnitFormat(num) {
if (!num) {
return 'kW'
}
if (Number(num) >= 1E4) {
return 'MW'
}
return 'kW'
}
/**
* mone formatting
* 元 转化 万元
* @param {number} num
* @param {number} digits
*/
export function moneyFormat(num, digits) {
if (!num) {
return 0
}
if (!digits) {
digits = 2
}
if (Number(num) >= 1E4) {
return (Number(num) / 1E4).toFixed(digits)
}
return Number(num).toFixed(digits)
}
/**
* mone formatting
* kg 转化 吨
* @param {number} num
* @param {number} digits
*/
export function kgFormat(num, digits) {
if (!num) {
return 0 + ''
}
if (!digits) {
digits = 2
}
if (Number(num) >= 1E3) {
return (Number(num) / 1E3).toFixed(digits) + ''
}
return Number(num).toFixed(digits) + ''
}
/**
* unit formatting
* 元 转化 万元
* @param {number} num
* @param {number} digits
*/
export function moneyUnitFormat(num) {
if (!num) {
return '元'
}
if (Number(num) >= 1E4) {
return '万元'
}
return '元'
}
/**
* unit formatting
* kg 转化 吨
* @param {number} num
* @param {number} digits
*/
export function KgUnitFormat(num) {
if (!num) {
return 'kg'
}
if (Number(num) >= 1E3) {
return '吨'
}
return 'kg'
}
export function isNull(num){
if(!num && num !== 0 || num === 'NaN'){
return ''
}else{
return num
}
}

489
common/http.api.js Normal file
View File

@ -0,0 +1,489 @@
// 此处第二个参数vm就是我们在页面使用的this你可以通过vm获取vuex等操作
const install = (Vue, vm) => {
// 参数配置对象
const config = vm.vuex_config
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
vm.$u.api = {
// 基础服务:登录登出、身份信息、菜单授权、切换系统、字典数据等
login: (params = {}) => vm.$u.post(config.adminPath + "/sys/user/login", params),
getMenuList: (params = {}) => vm.$u.get(config.adminPath + "/sys/user/get"),
getAllDict: (params = {}) => vm.$u.post(config.adminPath + "/sys/dict/typeAll", params),
getStationByUser: (params = {}) => vm.$u.post(config.adminPath + "/business/station"),
getUserInfo: (params = {}) => vm.$u.get(config.adminPath + "/sys/user/get", params),
changePsd: (params = {}) => vm.$u.put(config.adminPath + "/sys/user/pwd", params),
logout: (params = {}) => vm.$u.get(config.adminPath + "/sys/user/logout", params),
GetDictListByType: (params = {}) => vm.$u.post(config.adminPath + "/sys/dict/typeList", params),
GetNewFile: (params = {}) => vm.$u.post(config.adminPath + "/business/station/selectLastOne?version=" +
params),
lang: (params = {}) => vm.$u.get("/lang/" + params.lang),
index: (params = {}) => vm.$u.get(config.adminPath + "/mobile/index", params),
sendCode: (params = {}) =>
vm.$u.post(config.adminPath + "/mobile/login/sendCode", params),
registerUser: (params = {}) =>
vm.$u.post(config.adminPath + "/mobile/user/registerUser", params),
//首页相关api
getIndexCardInfo: (params = {}) =>
vm.$u.get(config.adminPath + "/mobile/index/getIndexCardInfo", params),
getM2mOrderFlowList: (params = {}) =>
vm.$u.get(config.adminPath + "/mobile/index/getM2mOrderFlowList", params),
//获取卡可购买套餐包
getM2mOrderPackageList: (params = {}) =>
vm.$u.get(
config.adminPath + "/mobile/index/getM2mOrderPackageList",
params
),
authInfo: (params = {}) =>
vm.$u.get(config.adminPath + "/authInfo", params),
menuTree: (params = {}) =>
vm.$u.get(config.adminPath + "/menuTree", params),
switchSys: (params = {}) =>
vm.$u.get(config.adminPath + "/switch/" + params.sysCode),
dictData: (params = {}) =>
vm.$u.get(config.adminPath + "/system/dict/data/type/" + params.dictType),
// 账号服务:验证码接口、忘记密码接口、注册账号接口等
validCode: (params = {}) => vm.$u.getText("/validCode", params),
getFpValidCode: (params = {}) =>
vm.$u.post("/account/getFpValidCode", params),
savePwdByValidCode: (params = {}) =>
vm.$u.post("/account/savePwdByValidCode", params),
getRegValidCode: (params = {}) =>
vm.$u.post("/account/getRegValidCode", params),
saveRegByValidCode: (params = {}) =>
vm.$u.post("/account/saveRegByValidCode", params),
// APP公共服务
upgradeCheck: () =>
vm.$u.post("/app/upgrade/check", {
appCode: config.appCode,
appVersion: config.appVersion,
}),
commentSave: (params = {}) => vm.$u.post("/app/comment/save", params),
//获取通知
GetMessage: (params = {}) =>
vm.$u.post("/business/messageInfo/selectMessageInfo", params),
UpdateMessageStatus: (params = {}) =>
vm.$u.post("/business/messageInfo/updateMessageReadStatus", params),
GetLanguageConfig:(params = {}) =>
vm.$u.post("/business/station/getTermDictionary", params),
// 个人信息修改
user: {
saveUserInfo: (params = {}) =>
vm.$u.post(config.adminPath + "/mobile/user/saveUserInfo", params),
infoSavePwd: (params = {}) =>
vm.$u.put(config.adminPath + "/system/user/profile/updatePwd", params),
infoSavePqa: (params = {}) =>
vm.$u.post(config.adminPath + "/sys/user/infoSavePqa", params),
},
// 员工用户查询
empUser: {
listData: (params = {}) =>
vm.$u.get(config.adminPath + "/sys/empUser/listData", params),
},
// 组织机构查询
office: {
treeData: (params = {}) =>
vm.$u.get(config.adminPath + "/sys/office/treeData", params),
},
//实时告警
alarm: {
// 获取告警事件列表
GetAlarmList: (params = {}) =>
vm.$u.post(config.adminPath + "/flow/event/page", params),
// 获取告警事件列表
GetHistoryAlarmList: (params = {}) =>
vm.$u.post(config.adminPath + "/flow/event/hispage", params),
//获取电站数据
GetStationlist: (params = {}) =>
vm.$u.post(config.adminPath + "/business/station", params),
//获取联级电站数据
GetNewStationlist: (params = {}) =>
vm.$u.post(config.adminPath + "/business/station/nationStation", params),
// 获取设备类型
GetDeviceType: (params = {}) =>
vm.$u.post(config.adminPath + "/business/device/treeDevices", params),
// 获取历史告警数据
GetAlarmHistoryList: (params = {}) =>
vm.$u.post(config.adminPath + "/business/event/hispage", params),
// 确认告警
SetAlarmConfirm: (params = {}) =>
vm.$u.put(config.adminPath + "/flow/event/confirm", params),
// 告警数量
GetEventNumber: (params = {}) =>
vm.$u.post(config.adminPath + "flow/event/eventNum"),
},
// 增删改查例子
testData: {
form: (params = {}) =>
vm.$u.post(config.adminPath + "/test/testData/form", params),
list: (params = {}) =>
vm.$u.post(config.adminPath + "/test/testData/listData", params),
save: (params = {}) =>
vm.$u.postJson(config.adminPath + "/test/testData/save", params),
disable: (params = {}) =>
vm.$u.post(config.adminPath + "/test/testData/disable", params),
enable: (params = {}) =>
vm.$u.post(config.adminPath + "/test/testData/enable", params),
delete: (params = {}) =>
vm.$u.post(config.adminPath + "/test/testData/delete", params),
},
// 工单
workOrder: {
// 获取工单数量
GetQueryTodoList: (params = {}) =>
vm.$u.post(config.adminPath + "/flow/processFlow/queryTodoList", params),
// 获取单个工单信息
GetWorkOrderDetail: (params = {}) =>
vm.$u.post(config.adminPath + "/flow/processFlow/workOrderDetails", params),
// 保存工单
saveOrder: (params = {}) =>
vm.$u.post(config.adminPath + "/flow/processFlow/saveOrder", params),
// 完成工单
doTask: (params = {}) =>
vm.$u.post(config.adminPath + "/flow/processFlow/doTask", params),
// 文件下载
FileDownload: (params = {}) =>
vm.$u.post(config.adminPath + "/media/currencyFile/download", params),
},
//电站
station: {
//获取电站状态
GetStationStatus: (params = {}) =>
vm.$u.post(config.adminPath + "/business/station/findStationStatus", params),
// 根据电站状态查询电站
getStationListByStatus: (params = {}) =>
vm.$u.post(config.adminPath + "/business/station/findListByStationStatus ", params),
getStationPostionData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/dynamicConfig/pointListData", params)
},
//设备
device: {
//按电站查询设备类型,维护设备的设备类型时使用
GetDeviceType: (params = {}) =>
vm.$u.post(config.adminPath + "/business/deviceConfig/queryDeviceTypeByGroup", params),
// 电站下的设备
GetDeviceByStationId: (id = {}) =>
vm.$u.get(config.adminPath + "/business/device/" + id),
// 电站下的设备
GetDeviceByType: (params = {}) =>
vm.$u.post(config.adminPath + "/business/device/page", params),
},
//告警
warning: {
// 设备下的告警
getWarningListById: (params = {}) =>
vm.$u.post(config.adminPath + "/flow/event/dropDownList", params),
},
//集团数据
groupData: {
// 给电站用的大屏数据----总览页面
getForStationCockpit: (params = {}) =>
vm.$u.post(config.adminPath + "/business/pvStation/forStationCockpit", params),
///分页查询电站
getStationPage: (params = {}) =>
vm.$u.post(config.adminPath + "/business/station/page", params),
//根据电站id查询电站详情
getStationDetailById: (id = {}) =>
vm.$u.post(config.adminPath + "/business/station/" + id),
//根据电站id查询电站数据
getStationData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/pvStation/pvPanel", params),
//根据电站id查询电站实时曲线
getStationRealtimeCurve: (params = {}) =>
vm.$u.post(config.adminPath + "/business/pvStation/realtimeCurve", params),
//根据电站id查询电站设备
getStationDevice: (params = {}) =>
vm.$u.post(config.adminPath + "/business/pvStation/inverterList", params),
//根据设备的数据
getDevicePanelData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/inverter/panelData", params),
//根据设备的功率曲线
getDeviceCurve: (params = {}) =>
vm.$u.post(config.adminPath + "/business/inverter/curve", params),
//根据设备的点
getDeviceDot: (params = {}) =>
vm.$u.post(config.adminPath + "/business/inverter/attribute", params),
},
//策略模块
policy: {
// 查询下发设备接口
getIssueDevices: (params = {}) =>
vm.$u.post(config.adminPath + "/business/planningIssue/getIssueDevices", params),
// 查询计划曲线模板接口
getTemplate: (params = {}) =>
vm.$u.post(config.adminPath + "/business/planningIssue/getTemplate", params),
// 查询下发模型数据取出data数据发给下发接口
getIssueDatas: (params = {}) =>
vm.$u.post(config.adminPath + "/business/planningIssue/getIssueDatas", params),
// 查看设备下发状态
queryIssueStatus: (params = {}) =>
vm.$u.post(config.adminPath + "/business/planningIssue/queryIssueStatus", params),
// 查看设备下发状态
insertIssueStatus: (params = {}) =>
vm.$u.post(config.adminPath + "/business/planningIssue/insertIssueStatus", params),
// 查看详情
lookPlanningCurveTemplateDetail: (params = {}) =>
vm.$u.post(config.adminPath + "/business/planning/planningCurveTemplateDetail", params),
// 查看曲线详情
lookPlanningCurveTemplateChartData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/planning/planningCurveTemplateChartData", params),
// 下发
SetOrderIssued: (params = {}) =>
vm.$u.post(config.adminPath + "/media/orderSend/orderIssued", params),
// 指令下发
GetOrderProgressBar: (params = {}) =>
vm.$u.post(config.adminPath + "/media/orderSend/progressBar", params),
// 获取修改值
GetSubstitutionValueList: (params = {}) =>
vm.$u.post(config.adminPath + "/business/substitutionValue/page", params),
// 保存修改值
SaveSubstitutionValue: (params = {}) =>
vm.$u.post(config.adminPath + "/business/substitutionValue/add", params),
// 控制下发
GetPlanCurveIssueData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/planningIssue/getPlanCurveIssueData", params),
},
homePageData: {
// 获取电站配置信息
GetHomePageComponents: (id = {}) =>
vm.$u.post(config.adminPath + `/business/homeConfig/${id}`),
// 充放电量
GetElecData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/elecData", params),
// 数据总览
GetPcsTotalData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/pcsTotalData", params),
// 运行曲线
GetRealtimeCurve: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/realtimeCurve", params),
// 拓扑图--状态监控
GetOpenStationMiddle: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/middle", params),
// 拓扑图--状态监控
GetOpenStationMiddlePart: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/middlePart", params),
// 环控数据
GetAirCondition: (params = {}) =>
vm.$u.post(config.adminPath + "/business/common/getAirCondition", params),
// 拓扑图--电表
GetMiddlePart: (params = {}) =>
vm.$u.post(config.adminPath + "/business/common/middlePart", params),
// 拓扑图--状态监控
GetbozhouTuopuStatus: (params = {}) =>
vm.$u.post(config.adminPath + "/business/bozhou/status", params),
// 上海科技园充放电量
GetKJYElecData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/getPCSElecData", params),
// 上海科技园电站数据
GetKJYPcsTotalData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/getEleTotalData", params),
// 上海科技园空调数据
GetShanghaiKJYAirData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/common/commonAirCondition", params),
// 查询历史曲线
GetHistoryData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/point/getPointCurve", params),
// 瑞安汽车
GetRAPcsTotalData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/getPcsTotalData", params),
// 瑞安汽车充放电
GetPCSElecData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/getPCSElecData", params),
// 慈溪环控
GetCircleCtr: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/circleCtr", params),
// 晶科数据
GetJingKeData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/jingke/status", params),
// 获取soc曲线
GetSocCurve: (params = {}) =>
vm.$u.post(config.adminPath + "/business/batteryStack/socCurve", params),
GetJKCurve: (params = {}) =>
vm.$u.post(config.adminPath + "/business/jingke/realtimeCurve", params),
GetWSHStatus: (params = {}) =>
vm.$u.post(config.adminPath + "/business/weiShanHu/status", params),
GetZzhbtatus: (params = {}) =>
vm.$u.post(config.adminPath + "/business/zhongZiHuanBao/status", params),
// 中自环保光伏数据
GetZZHBPv: (params = {}) =>
vm.$u.post(config.adminPath + "/business/zhongZiHuanBao/getStationData", params),
// 微山湖光伏数据
GetWSHPv: (params = {}) =>
vm.$u.post(config.adminPath + "/business/weiShanHu/getStationData", params),
//获取动态配置
GetDynamicConfig: (params = {}) =>
vm.$u.post(config.adminPath + "/business/dynamicConfig/pointListData", params),
//横沥光伏
GetMiddlePartInverter: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/middlePartInverter", params),
//并网负载侧电表
GetElec: (params = {}) =>
vm.$u.post(config.adminPath + "/business/common/getElec", params),
//横沥103电表
GetEleMeter: (params = {}) =>
vm.$u.post(config.adminPath + "/business/common/getEleMeter", params),
//横沥103光伏
GetOpticalStorage: (params = {}) =>
vm.$u.post(config.adminPath + "/business/common/getOpticalStorage", params),
// 挚达光伏
GetZhiDaPv: (params = {}) =>
vm.$u.post(config.adminPath + "/business/common/getPVElec", params),
//获取配置曲线
GetDynamicRealTimeCurve: (params = {}) =>
vm.$u.post(config.adminPath + "/business/openStation/dynamicRealtimeCurve", params),
GetFireConfig: (params = {}) =>
vm.$u.post(config.adminPath + "/business/topologyAttribute/DataConfig", params),
},
//设备列表
deviceList: {
// 获取设备列表
GetTreeVirtualDevices: (params = {}) =>
vm.$u.post(config.adminPath + "/business/device/treeVirtualDevices", params),
// 获取设备数据
GetNewValue: (params = {}) =>
vm.$u.post(config.adminPath + "/business/common/newValue", params),
// 获取组数据
GetPackTemperatureVoltageData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/common/packTemperatureVoltageData", params),
// 电池包温度电压柱状图以及运行数据
GetTemVolData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/common/packTemperatureVoltageData", params),
// 温度电压正太分布
GetTemperatureVoltageData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/station/temperatureVoltageData", params),
//获取电度表曲线
GetTtackHisData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/batteryStack/stackHisData", params),
//获取电站下的设备
// GetPageDevice: (params = {}) =>
// vm.$u.post(config.adminPath + "/business/device/appHomePageDevices", params),
GetPageDevice: (params = {}) =>
vm.$u.post(config.adminPath + "/business/device/homePageTreeDevices", params),
//功率曲线
GetPCSCurve: (params = {}) =>
vm.$u.post(config.adminPath + "/business/pcs/pcsCurve", params),
// 遥信遥测数据
GetPCSPoint: (params = {}) =>
vm.$u.post(config.adminPath + "/business/point/page", params),
},
//收益
enrnings: {
GetTotal: (params = {}) =>
vm.$u.post(config.adminPath + "/business/earningsCalculate/getTotal", params),
},
proxyPrice: {
// 查询区域
GetIndustrialElecRegionList: (params = {}) => vm.$u.post(config.adminPath +
"/business/industrialElecRegion/list", params),
/** 查询所有代理电价-分页*/
GetIndustrialElecPricePage: (params = {}) => vm.$u.post(config.adminPath +
"/business/industrialElecPrice/page", params),
//根据id查询分时电价折线图
GetTouLineById: (id = {}) => vm.$u.get(config.adminPath +
`/business/industrialElecPrice/getTouLineById/${id}`),
//根据id查询分时电价历史数据图表/表格
GetTouLineHistoryById: (id = {}) => vm.$u.get(config.adminPath +
`/business/industrialElecPrice/getTouLineHistoryById/${id}`),
//根据id查询峰谷电差价折线图/表格
GetMaxPriceDiffById: (id = {}) => vm.$u.get(config.adminPath +
`/business/industrialElecPrice/getMaxPriceDiffById/${id}`),
}
}
}
export default {
install,
}

104
common/http.interceptor.js Normal file
View File

@ -0,0 +1,104 @@
// 此处第二个参数vm就是我们在页面使用的this你可以通过vm获取vuex等操作
const install = (Vue, vm) => {
// 通用请求头设定
const ajaxHeader = "x-ajax";
const sessionIdHeader = "Authorization";
const rememberMeHeader = "x-remember";
const lang = 'lang';
// 请求参数默认配置
Vue.prototype.$u.http.setConfig({
baseUrl: vm.vuex_config.baseUrl,
originalData: true,
// 默认头部http2约定header名称统一小写
header: {
"content-type": "application/json",
"x-requested-with": "XMLHttpRequest",
},
});
// 请求拦截配置Token等参数
Vue.prototype.$u.http.interceptor.request = (req) => {
if (!req.header) {
req.header = [];
}
req.header["source"] = "app";
// 默认指定返回 JSON 数据
if (!req.header[ajaxHeader]) {
req.header[ajaxHeader] = "json";
}
// 设定传递 Token 认证参数
if (!req.header[sessionIdHeader] && vm.vuex_token) {
req.header[sessionIdHeader] = vm.vuex_token;
req.header[lang] = vm.vuex_language;
}
// 为节省流量,记住我数据不是每次都发送的,当会话失效后,尝试重试登录
if (!req.header[rememberMeHeader] && vm.vuex_remember && req.remember) {
req.header[rememberMeHeader] = vm.vuex_remember;
req.remember = false;
}
return req;
};
// 响应拦截,判断状态码是否通过
Vue.prototype.$u.http.interceptor.response = async (res, req) => {
let data = res.data;
if (!data) {
// vm.$u.toast("未连接到服务器");
return false;
}
if (res.data.code !== 200) {
if (res.data.code === 401002 || res.data.code === 401001 || res.data.code === 50014) {
uni.showToast({
title: data.msg ? data.msg : '请重新登陆!',
duration: 3000,
icon:'none'
})
setTimeout(() => {
uni.reLaunch({
url: "/pages/login/index"
});
}, 3000)
}else{
uni.showToast({
title: data.msg ? data.msg : '接口报错,请联系管理员!',
duration:3000,
icon:'none'
})
}
} else {
return res.data
}
};
// 封装 get text 请求
vm.$u.getText = (url, data = {}, header = {}) => {
return vm.$u.http.request({
dataType: "text",
method: "GET",
url,
header,
data,
});
};
// 封装 post json 请求
vm.$u.postJson = (url, data = {}, header = {}) => {
header["content-type"] = "application/json";
return vm.$u.http.request({
url,
method: "POST",
header,
data,
});
};
};
export default {
install,
};

4
common/locales/en_EN.js Normal file
View File

@ -0,0 +1,4 @@
import homePage from './homePage/en'
export default {
homePage
}

View File

@ -0,0 +1,35 @@
export default {
home: {
login: 'Login',
account: 'Account',
password: 'Password',
placeAccount: "Place input account",
placePassword: 'Place input password',
noLogin: 'The feature is not available yet',
loadAmmeter: 'Load Meter',
dieselGeneratorMeter: 'Diesel Meter',
energyStorageMeter: 'Cabinet Meter',
alarmTypeList: [{
name: 'Real-Time Alarm'
}, {
name: 'History Alarm'
}],
lang: 'Switch languages',
ydty: 'Read and agree',
yhxy: 'User Agreement',
and: 'and',
yszc: 'Privacy Policy',
yhxyhyszc: 'User Agreement and Privacy Policy',
msgf: 'Welcome to the "Small Savings and Great Energy" APP, we attach great importance to the protection of your personal information and privacy. Please read this app carefully before you use it',
msgs: 'When you use this application, it means that you have read, understood and agreed to accept all the terms of this agreement. If you do not agree with any of the contents of this Agreement, please stop using this Application immediately.',
agree: 'Agree',
quit: 'Disagree',
guestLogin: 'Guest Login',
checkFirst: 'Please check the box to agree to the User Agreement and Privacy Policy',
stationType:[{
name:'China Station'
},{
name:'Overseas Station'
}]
},
}

View File

@ -0,0 +1,35 @@
export default {
home: {
login: '登录',
account: '账号',
password: '密码',
placeAccount: "请输入账号",
placePassword: '请输入密码',
noLogin: '功能暂未开放',
loadAmmeter: '负载电表',
dieselGeneratorMeter: '柴发电表',
energyStorageMeter: '储能电表',
alarmTypeList: [{
name: '实时告警'
}, {
name: '历史告警'
}],
lang:'切换语言',
ydty:'阅读并同意',
yhxy:'用户协议',
and:'和',
yszc:'隐私政策',
yhxyhyszc:'用户协议和隐私政策',
msgf:'欢迎使用“小储大能”APP我们非常重视您的个人信息和隐私保护。在您使用本应用前请仔细阅读',
msgs:'您在使用本应用时,即表示您已阅读、理解并同意接受本协议的所有条款。如果您不同意本协议的任何内容,请立即停止使用本应用。',
agree:'同意',
quit:'不同意',
guestLogin: '游客登录',
checkFirst:'请先勾选同意用户协议和隐私政策',
stationType:[{
name:'中国站'
},{
name:'海外站'
}]
}
};

4
common/locales/zh_CN.js Normal file
View File

@ -0,0 +1,4 @@
import homePage from './homePage/zh'
export default {
homePage,
}

1459
common/uni.css Normal file

File diff suppressed because it is too large Load Diff

1022
common/vue-i18n.min.js vendored Normal file

File diff suppressed because it is too large Load Diff