Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
夜猫逐梦
MyOpen
提交
2620b747
M
MyOpen
项目概览
夜猫逐梦
/
MyOpen
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
MyOpen
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
2620b747
编写于
11月 22, 2023
作者:
S
sw_pc
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://gitcode.net/kinghzking/MyOpen
上级
6b33f16c
a8743d98
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
380 addition
and
2 deletion
+380
-2
package-lock.json
package-lock.json
+72
-2
package.json
package.json
+1
-0
utils/js/object.js
utils/js/object.js
+26
-0
utils/js/request/tesla111.js
utils/js/request/tesla111.js
+48
-0
utils/js/ruoyi/ruoyi.js
utils/js/ruoyi/ruoyi.js
+233
-0
未找到文件。
package-lock.json
浏览文件 @
2620b747
...
...
@@ -9,6 +9,7 @@
"version"
:
"1.0.0"
,
"license"
:
"ISC"
,
"dependencies"
:
{
"axios"
:
"^1.6.2"
,
"leaflet"
:
"^1.9.4"
,
"lodash"
:
"^4.17.21"
},
...
...
@@ -123,6 +124,11 @@
"integrity"
:
"sha512-c646jH1avxr+aVpndVMeAfYw7wAa6idufrlN3LPA4PmKS0QEGp6PIC9nwz0WQkkvBGAMEki3pFdtxaF39J9vvg=="
,
"dev"
:
true
},
"node_modules/asynckit"
:
{
"version"
:
"0.4.0"
,
"resolved"
:
"https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz"
,
"integrity"
:
"sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/atob"
:
{
"version"
:
"2.1.2"
,
"resolved"
:
"https://registry.npmmirror.com/atob/-/atob-2.1.2.tgz"
,
...
...
@@ -135,6 +141,16 @@
"node"
:
">= 4.5.0"
}
},
"node_modules/axios"
:
{
"version"
:
"1.6.2"
,
"resolved"
:
"https://registry.npmjs.org/axios/-/axios-1.6.2.tgz"
,
"integrity"
:
"sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A=="
,
"dependencies"
:
{
"follow-redirects"
:
"^1.15.0"
,
"form-data"
:
"^4.0.0"
,
"proxy-from-env"
:
"^1.1.0"
}
},
"node_modules/base"
:
{
"version"
:
"0.11.2"
,
"resolved"
:
"https://registry.npmmirror.com/base/-/base-0.11.2.tgz"
,
...
...
@@ -334,6 +350,17 @@
"node"
:
">=0.1.90"
}
},
"node_modules/combined-stream"
:
{
"version"
:
"1.0.8"
,
"resolved"
:
"https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz"
,
"integrity"
:
"sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="
,
"dependencies"
:
{
"delayed-stream"
:
"~1.0.0"
},
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/component-emitter"
:
{
"version"
:
"1.3.0"
,
"resolved"
:
"https://registry.npmmirror.com/component-emitter/-/component-emitter-1.3.0.tgz"
,
...
...
@@ -414,6 +441,14 @@
"node"
:
">=0.10.0"
}
},
"node_modules/delayed-stream"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
,
"integrity"
:
"sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
,
"engines"
:
{
"node"
:
">=0.4.0"
}
},
"node_modules/depd"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz"
,
...
...
@@ -622,6 +657,25 @@
"node"
:
">= 0.8"
}
},
"node_modules/follow-redirects"
:
{
"version"
:
"1.15.3"
,
"resolved"
:
"https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz"
,
"integrity"
:
"sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q=="
,
"funding"
:
[
{
"type"
:
"individual"
,
"url"
:
"https://github.com/sponsors/RubenVerborgh"
}
],
"engines"
:
{
"node"
:
">=4.0"
},
"peerDependenciesMeta"
:
{
"debug"
:
{
"optional"
:
true
}
}
},
"node_modules/for-in"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmmirror.com/for-in/-/for-in-1.0.2.tgz"
,
...
...
@@ -631,6 +685,19 @@
"node"
:
">=0.10.0"
}
},
"node_modules/form-data"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz"
,
"integrity"
:
"sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww=="
,
"dependencies"
:
{
"asynckit"
:
"^0.4.0"
,
"combined-stream"
:
"^1.0.8"
,
"mime-types"
:
"^2.1.12"
},
"engines"
:
{
"node"
:
">= 6"
}
},
"node_modules/fragment-cache"
:
{
"version"
:
"0.2.1"
,
"resolved"
:
"https://registry.npmmirror.com/fragment-cache/-/fragment-cache-0.2.1.tgz"
,
...
...
@@ -1115,7 +1182,6 @@
"version"
:
"1.52.0"
,
"resolved"
:
"https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz"
,
"integrity"
:
"sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
,
"dev"
:
true
,
"engines"
:
{
"node"
:
">= 0.6"
}
...
...
@@ -1124,7 +1190,6 @@
"version"
:
"2.1.35"
,
"resolved"
:
"https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz"
,
"integrity"
:
"sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="
,
"dev"
:
true
,
"dependencies"
:
{
"mime-db"
:
"1.52.0"
},
...
...
@@ -1423,6 +1488,11 @@
"integrity"
:
"sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
,
"dev"
:
true
},
"node_modules/proxy-from-env"
:
{
"version"
:
"1.1.0"
,
"resolved"
:
"https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz"
,
"integrity"
:
"sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/proxy-middleware"
:
{
"version"
:
"0.15.0"
,
"resolved"
:
"https://registry.npmmirror.com/proxy-middleware/-/proxy-middleware-0.15.0.tgz"
,
...
...
package.json
浏览文件 @
2620b747
...
...
@@ -16,6 +16,7 @@
"author"
:
"yemao"
,
"license"
:
"
ISC
"
,
"dependencies"
:
{
"
axios
"
:
"
^1.6.2
"
,
"
leaflet
"
:
"
^1.9.4
"
,
"
lodash
"
:
"
^4.17.21
"
},
...
...
utils/js/object.js
浏览文件 @
2620b747
...
...
@@ -63,8 +63,34 @@ function kebabCaseObject(originObj) {
return
ret
}
// 转换为数据库接受的数据
function
convert4db
(
originObj
)
{
if
(
!
_
.
isObject
(
originObj
))
{
return
originObj
}
const
ret
=
{};
for
(
let
key
in
originObj
)
{
// 数据库中不定义bool类型的数据,转换为1和0
let
val
=
originObj
[
key
]
if
(
_
.
isBoolean
(
val
))
{
val
=
val
?
1
:
0
}
// 对象转换为字符串
if
(
_
.
isObject
(
val
))
{
val
=
JSON
.
stringify
(
val
)
}
ret
[
key
]
=
val
}
return
ret
}
export
{
camelCaseObject
,
snakeCaseObject
,
kebabCaseObject
,
convert4db
,
}
\ No newline at end of file
utils/js/request/tesla111.js
0 → 100644
浏览文件 @
2620b747
import
axios
from
'
axios
'
// eslint-disable-next-line no-undef
const
Message
=
{
error
:
(
msg
)
=>
{
console
.
log
(
'
Message.error
'
,
msg
)
}
}
function
genServer
(
baseURL
)
{
const
serves
=
axios
.
create
({
baseURL
:
baseURL
,
timeout
:
60
*
1000
})
// 设置请求发送之前的拦截器
serves
.
interceptors
.
request
.
use
(
config
=>
{
// 设置发送之前数据需要做什么处理
return
config
},
err
=>
Promise
.
reject
(
err
))
// 设置请求接受拦截器
serves
.
interceptors
.
response
.
use
(
res
=>
{
// console.log('res = ', res)
// 设置接受数据之后,做什么处理
// if (res.data.errmsg !== '') {
if
(
res
.
data
.
status
!==
200
)
{
Message
.
error
(
res
.
data
)
Promise
.
reject
(
res
.
data
)
}
return
res
.
data
},
err
=>
{
// 判断请求异常信息中是否含有超时timeout字符串
if
(
err
.
message
.
includes
(
'
timeout
'
))
{
console
.
log
(
'
错误回调
'
,
err
.
message
)
Message
.
error
(
'
网络超时
'
)
}
if
(
err
.
message
.
includes
(
'
Network Error
'
))
{
console
.
log
(
'
错误回调
'
,
err
.
message
)
Message
.
error
(
'
服务端未启动,或网络连接错误
'
)
}
return
Promise
.
reject
(
err
)
})
return
serves
}
export
{
genServer
}
utils/js/ruoyi/ruoyi.js
0 → 100644
浏览文件 @
2620b747
/**
* 通用js方法封装处理
* Copyright (c) 2019 ruoyi
*/
// 日期格式化
export
function
parseTime
(
time
,
pattern
)
{
if
(
arguments
.
length
===
0
||
!
time
)
{
return
null
}
const
format
=
pattern
||
'
{y}-{m}-{d} {h}:{i}:{s}
'
let
date
if
(
typeof
time
===
'
object
'
)
{
date
=
time
}
else
{
if
((
typeof
time
===
'
string
'
)
&&
(
/^
[
0-9
]
+$/
.
test
(
time
)))
{
time
=
parseInt
(
time
)
}
else
if
(
typeof
time
===
'
string
'
)
{
time
=
time
.
replace
(
new
RegExp
(
/-/gm
),
'
/
'
).
replace
(
'
T
'
,
'
'
).
replace
(
new
RegExp
(
/
\.[\d]{3}
/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
(
/{
(
y|m|d|h|i|s|a
)
+}/g
,
(
result
,
key
)
=>
{
let
value
=
formatObj
[
key
]
// Note: getDay() returns 0 on Sunday
if
(
key
===
'
a
'
)
{
return
[
'
日
'
,
'
一
'
,
'
二
'
,
'
三
'
,
'
四
'
,
'
五
'
,
'
六
'
][
value
]
}
if
(
result
.
length
>
0
&&
value
<
10
)
{
value
=
'
0
'
+
value
}
return
value
||
0
})
return
time_str
}
// 表单重置
export
function
resetForm
(
refName
)
{
if
(
this
.
$refs
[
refName
])
{
this
.
$refs
[
refName
].
resetFields
();
}
}
// 添加日期范围
export
function
addDateRange
(
params
,
dateRange
,
propName
)
{
let
search
=
params
;
search
.
params
=
typeof
(
search
.
params
)
===
'
object
'
&&
search
.
params
!==
null
&&
!
Array
.
isArray
(
search
.
params
)
?
search
.
params
:
{};
dateRange
=
Array
.
isArray
(
dateRange
)
?
dateRange
:
[];
if
(
typeof
(
propName
)
===
'
undefined
'
)
{
search
.
params
[
'
beginTime
'
]
=
dateRange
[
0
];
search
.
params
[
'
endTime
'
]
=
dateRange
[
1
];
}
else
{
search
.
params
[
'
begin
'
+
propName
]
=
dateRange
[
0
];
search
.
params
[
'
end
'
+
propName
]
=
dateRange
[
1
];
}
return
search
;
}
// 回显数据字典
export
function
selectDictLabel
(
datas
,
value
)
{
if
(
value
===
undefined
)
{
return
""
;
}
var
actions
=
[];
Object
.
keys
(
datas
).
some
((
key
)
=>
{
if
(
datas
[
key
].
value
==
(
''
+
value
))
{
actions
.
push
(
datas
[
key
].
label
);
return
true
;
}
})
if
(
actions
.
length
===
0
)
{
actions
.
push
(
value
);
}
return
actions
.
join
(
''
);
}
// 回显数据字典(字符串、数组)
export
function
selectDictLabels
(
datas
,
value
,
separator
)
{
if
(
value
===
undefined
||
value
.
length
===
0
)
{
return
""
;
}
if
(
Array
.
isArray
(
value
))
{
value
=
value
.
join
(
"
,
"
);
}
var
actions
=
[];
var
currentSeparator
=
undefined
===
separator
?
"
,
"
:
separator
;
var
temp
=
value
.
split
(
currentSeparator
);
Object
.
keys
(
value
.
split
(
currentSeparator
)).
some
((
val
)
=>
{
var
match
=
false
;
Object
.
keys
(
datas
).
some
((
key
)
=>
{
if
(
datas
[
key
].
value
==
(
''
+
temp
[
val
]))
{
actions
.
push
(
datas
[
key
].
label
+
currentSeparator
);
match
=
true
;
}
})
if
(
!
match
)
{
actions
.
push
(
temp
[
val
]
+
currentSeparator
);
}
})
return
actions
.
join
(
''
).
substring
(
0
,
actions
.
join
(
''
).
length
-
1
);
}
// 字符串格式化(%s )
export
function
sprintf
(
str
)
{
var
args
=
arguments
,
flag
=
true
,
i
=
1
;
str
=
str
.
replace
(
/%s/g
,
function
()
{
var
arg
=
args
[
i
++
];
if
(
typeof
arg
===
'
undefined
'
)
{
flag
=
false
;
return
''
;
}
return
arg
;
});
return
flag
?
str
:
''
;
}
// 转换字符串,undefined,null等转化为""
export
function
parseStrEmpty
(
str
)
{
if
(
!
str
||
str
==
"
undefined
"
||
str
==
"
null
"
)
{
return
""
;
}
return
str
;
}
// 数据合并
export
function
mergeRecursive
(
source
,
target
)
{
for
(
var
p
in
target
)
{
try
{
if
(
target
[
p
].
constructor
==
Object
)
{
source
[
p
]
=
mergeRecursive
(
source
[
p
],
target
[
p
]);
}
else
{
source
[
p
]
=
target
[
p
];
}
}
catch
(
e
)
{
source
[
p
]
=
target
[
p
];
}
}
return
source
;
};
/**
* 构造树型结构数据
* @param {*} data 数据源
* @param {*} id id字段 默认 'id'
* @param {*} parentId 父节点字段 默认 'parentId'
* @param {*} children 孩子节点字段 默认 'children'
*/
export
function
handleTree
(
data
,
id
,
parentId
,
children
)
{
let
config
=
{
id
:
id
||
'
id
'
,
parentId
:
parentId
||
'
parentId
'
,
childrenList
:
children
||
'
children
'
};
var
childrenListMap
=
{};
var
nodeIds
=
{};
var
tree
=
[];
for
(
let
d
of
data
)
{
let
parentId
=
d
[
config
.
parentId
];
if
(
childrenListMap
[
parentId
]
==
null
)
{
childrenListMap
[
parentId
]
=
[];
}
nodeIds
[
d
[
config
.
id
]]
=
d
;
childrenListMap
[
parentId
].
push
(
d
);
}
for
(
let
d
of
data
)
{
let
parentId
=
d
[
config
.
parentId
];
if
(
nodeIds
[
parentId
]
==
null
)
{
tree
.
push
(
d
);
}
}
for
(
let
t
of
tree
)
{
adaptToChildrenList
(
t
);
}
function
adaptToChildrenList
(
o
)
{
if
(
childrenListMap
[
o
[
config
.
id
]]
!==
null
)
{
o
[
config
.
childrenList
]
=
childrenListMap
[
o
[
config
.
id
]];
}
if
(
o
[
config
.
childrenList
])
{
for
(
let
c
of
o
[
config
.
childrenList
])
{
adaptToChildrenList
(
c
);
}
}
}
return
tree
;
}
/**
* 参数处理
* @param {*} params 参数
*/
export
function
tansParams
(
params
)
{
let
result
=
''
for
(
const
propName
of
Object
.
keys
(
params
))
{
const
value
=
params
[
propName
];
var
part
=
encodeURIComponent
(
propName
)
+
"
=
"
;
if
(
value
!==
null
&&
value
!==
""
&&
typeof
(
value
)
!==
"
undefined
"
)
{
if
(
typeof
value
===
'
object
'
)
{
for
(
const
key
of
Object
.
keys
(
value
))
{
if
(
value
[
key
]
!==
null
&&
value
[
key
]
!==
""
&&
typeof
(
value
[
key
])
!==
'
undefined
'
)
{
let
params
=
propName
+
'
[
'
+
key
+
'
]
'
;
var
subPart
=
encodeURIComponent
(
params
)
+
"
=
"
;
result
+=
subPart
+
encodeURIComponent
(
value
[
key
])
+
"
&
"
;
}
}
}
else
{
result
+=
part
+
encodeURIComponent
(
value
)
+
"
&
"
;
}
}
}
return
result
}
// 验证是否为blob格式
export
function
blobValidate
(
data
)
{
return
data
.
type
!==
'
application/json
'
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录