Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspection-pad-web
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
专网
inspection-pad-web
Commits
089bc4bd
提交
089bc4bd
authored
4月 15, 2025
作者:
zs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
edit
上级
8c52db57
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
20 行增加
和
39 行删除
+20
-39
App.vue
App.vue
+1
-1
init.js
api/sqllite/init.js
+19
-38
没有找到文件。
App.vue
浏览文件 @
089bc4bd
...
...
@@ -88,7 +88,7 @@ export default {
*/
async
init
()
{
initService
.
init
();
return
;
return
checkAndCreateDirectory
(
SYNCHRONIZE_DATA_PAD
)
.
then
(()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
api/sqllite/init.js
浏览文件 @
089bc4bd
...
...
@@ -13,7 +13,6 @@ export default {
// app初始化
async
init
()
{
const
BASE_PATH
=
"_documents/data/asmzx/pad"
;
// 基础路径
// uni.showLoading({
// title: '正在初始化...',
// })
...
...
@@ -25,11 +24,7 @@ export default {
await
this
.
initSqlLite
(
sqllitedb
);
// 确保表被创建
console
.
log
(
'Tables created.'
);
await
ioUtil
.
createDir
(
BASE_PATH
,
'发送数据'
)
await
ioUtil
.
createDir
(
BASE_PATH
,
'日志文件'
)
await
ioUtil
.
createDir
(
BASE_PATH
,
'巡检数据'
)
await
ioUtil
.
createDir
(
BASE_PATH
,
'history'
)
await
ioUtil
.
createDir
(
BASE_PATH
,
'fssj'
)
await
this
.
initDir
()
let
isInit
=
await
SqlliteDbUtil
.
checkIfDataImported
(
sqllitedb
);
// 确保表存在后再查询
console
.
log
(
'Data imported:'
,
isInit
);
if
(
!
isInit
)
{
...
...
@@ -97,44 +92,30 @@ export default {
// 初始化目录
async
initDir
()
{
const
BASE_PATH
=
"_documents/data/asmzx/pad"
;
// 基础路径
try
{
const
downloadEntry
=
await
ioUtil
.
getFileEntry
()
const
_doc
=
_Path
.
getPrivateDOC
()
const
docEntry
=
await
ioUtil
.
getFileEntry
(
_doc
)
if
(
docEntry
){
const
parentPaths
=
[
'_documents'
,
'_documents/data'
,
'_documents/data/asmzx'
,
'_documents/data/asmzx/pad'
];
if
(
downloadEntry
)
{
await
ioUtil
.
createDir
(
BASE_PATH
,
'base'
)
await
ioUtil
.
createDir
(
BASE_PATH
,
'export'
)
await
ioUtil
.
createDir
(
BASE_PATH
,
'import'
)
await
ioUtil
.
createDir
(
BASE_PATH
,
'doc'
)
await
ioUtil
.
createDir
(
BASE_PATH
,
'error'
)
for
(
const
path
of
parentPaths
)
{
const
parts
=
path
.
split
(
'/'
);
const
parent
=
parts
.
slice
(
0
,
-
1
).
join
(
'/'
)
||
'/'
;
await
ioUtil
.
createDir
(
parent
,
parts
.
pop
());
}
// 获取设备名称
uni
.
getSystemInfo
({
success
:
async
function
(
e
)
{
const
deviceData
=
{
deviceId
:
e
.
deviceId
,
brand
:
e
.
deviceBrand
,
deviceModel
:
e
.
deviceModel
,
const
subDirs
=
[
'发送数据'
,
'日志文件'
,
'巡检数据'
,
'history'
,
'fssj'
];
await
Promise
.
all
(
subDirs
.
map
(
dir
=>
ioUtil
.
createDir
(
BASE_PATH
,
dir
))
);
}
const
deviceFilePath
=
BASE_PATH
+
'name.txt'
await
ioUtil
.
removeExistFile
(
deviceFilePath
)
await
ioUtil
.
writeFile
(
'name.txt'
,
downloadEntry
,
JSON
.
stringify
(
deviceData
))
},
});
// 文件目录
if
(
docEntry
)
{
await
ioUtil
.
createDir
(
docEntry
.
fullPath
,
'file'
)
}
// 临时目录
let
tempEntry
=
await
ioUtil
.
getFileEntry
(
_temp
)
if
(
!
tempEntry
)
{
await
ioUtil
.
createDir
(
_temp
)
tempEntry
=
await
ioUtil
.
createDir
(
_Path
.
getTempParent
(),
'inspectTemp'
)
}
await
ioUtil
.
createDir
(
tempEntry
.
fullPath
,
'db'
)
}
catch
(
e
)
{
console
.
log
(
e
.
message
)
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论