Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspection-pad-web
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
专网
inspection-pad-web
Commits
21d7b477
提交
21d7b477
authored
4月 14, 2025
作者:
zs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
edit
上级
b15b1d72
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
67 行增加
和
14 行删除
+67
-14
inspect.js
api/inspect.js
+19
-0
home.vue
pages/home/home.vue
+4
-5
dialog.vue
pages/inspectionManagement/dialog.vue
+4
-3
systemCofig.js
utils/systemCofig.js
+40
-6
没有找到文件。
api/inspect.js
浏览文件 @
21d7b477
...
...
@@ -6,6 +6,25 @@ import {
// 巡检
export
default
{
async
selectLastData
(
data
)
{
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
try
{
let
rs
=
await
sqllitedb
.
selectSQL
(
`SELECT *
FROM
${
table
.
inspectionRecordName
}
WHERE userId = '
${
data
}
'
AND createTime >= strftime('%s', 'now') - 7*24*60*60
AND inspectionType = 1
ORDER BY createTime DESC
LIMIT 1;`
);
return
rs
;
}
catch
(
e
)
{
console
.
log
(
e
.
message
);
}
finally
{
await
sqllitedb
.
closeDB
();
}
},
async
selectList
()
{
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
try
{
...
...
pages/home/home.vue
浏览文件 @
21d7b477
...
...
@@ -55,6 +55,7 @@
import
{
copyDirectory
}
from
"@/utils/IoReadingAndWriting.js"
import
inspectApi
from
"@/api/inspect.js"
export
default
{
data
()
{
return
{
...
...
@@ -86,11 +87,9 @@
console
.
log
(
this
.
$store
.
state
);
},
methods
:
{
copyFile
()
{
const
SYNCHRONIZE_DATA_PAD
=
"_documents/data"
;
// 存储pad端的生产数据
const
directoryPath
=
`
${
SYNCHRONIZE_DATA_PAD
}
/photos`
;
const
targetDirectoryPath
=
`
${
SYNCHRONIZE_DATA_PAD
}
/asmzx/pad/巡检数据/
${
this
.
userName
}
`
;
copyDirectory
(
directoryPath
,
targetDirectoryPath
)
async
copyFile
()
{
let
res
=
await
inspectApi
.
selectLastData
(
this
.
$store
.
state
.
now_user
.
userId
)
console
.
log
(
res
,
'========='
)
},
// 修改密码
...
...
pages/inspectionManagement/dialog.vue
浏览文件 @
21d7b477
...
...
@@ -135,7 +135,7 @@
async
clickHandle
()
{
if
(
this
.
loading
)
return
;
const
directoryPath
=
`
${
SYNCHRONIZE_DATA_PAD
}
/发送数据`
;
const
targetDirectoryPath
=
`
${
SYNCHRONIZE_DATA_PAD
}
/history`
;
const
targetDirectoryPath
=
`
${
SYNCHRONIZE_DATA_PAD
}
/history
/
${
new
Date
().
getTime
()}
`
;
// checkAndCreateDirectory(directoryPath).then(() => {
copyDirectory
(
directoryPath
,
targetDirectoryPath
)
...
...
@@ -246,11 +246,12 @@
let
ids
=
this
.
list
.
map
((
e
)
=>
e
.
id
);
// 复制照片
await
this
.
copyPhotos
();
await
zipCompress
(
`
${
SYNCHRONIZE_DATA_PAD
}
/发送数据`
,
zipCompress
(
`
${
SYNCHRONIZE_DATA_PAD
}
/发送数据`
,
`
${
SYNCHRONIZE_DATA_PAD
}
/fssj/
${
userName
}
_JFXJ_
${
timeStr
}
.zip`
);
debugger
// zip
await
inspectApi
.
updateSyncData
(
ids
);
//
await inspectApi.updateSyncData(ids);
this
.
close
();
this
.
loading
=
false
;
...
...
utils/systemCofig.js
浏览文件 @
21d7b477
...
...
@@ -473,15 +473,48 @@ export function getUserList() {
export
function
zipCompress
(
sourceDir
,
zipPath
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// 递归函数,用于收集目录中的所有文件路径
function
collectFiles
(
dirEntry
,
filePaths
=
[])
{
return
new
Promise
((
resolveCollect
,
rejectCollect
)
=>
{
var
directoryReader
=
dirEntry
.
createReader
();
directoryReader
.
readEntries
(
function
(
entries
)
{
var
promises
=
[];
entries
.
forEach
(
function
(
entry
)
{
if
(
entry
.
isFile
)
{
filePaths
.
push
(
entry
.
toLocalURL
());
}
else
if
(
entry
.
isDirectory
)
{
promises
.
push
(
collectFiles
(
entry
,
filePaths
));
}
});
Promise
.
all
(
promises
).
then
(()
=>
resolveCollect
(
filePaths
)).
catch
(
rejectCollect
);
},
function
(
e
)
{
rejectCollect
(
e
);
});
});
}
// 开始收集文件
plus
.
io
.
resolveLocalFileSystemURL
(
sourceDir
,
function
(
dirEntry
)
{
if
(
dirEntry
.
isDirectory
)
{
collectFiles
(
dirEntry
).
then
(
function
(
allFilePaths
)
{
debugger
// 使用收集到的文件路径进行压缩
plus
.
zip
.
compress
(
plus
.
io
.
convertLocalFileSystemURL
(
sourceDir
)
,
allFilePaths
,
plus
.
io
.
convertLocalFileSystemURL
(
zipPath
),
{
recursive
:
true
,
overwrite
:
true
,
function
()
{
resolve
(
zipPath
);
},
()
=>
resolve
(
zipPath
),
(
error
)
=>
reject
(
`压缩失败:
${
error
.
message
}
`
)
function
(
error
)
{
reject
(
`压缩失败:
${
error
.
message
}
`
);
}
);
}).
catch
(
reject
);
}
else
{
reject
(
'提供的路径不是一个目录'
);
}
},
function
(
e
)
{
reject
(
`解析文件系统URL失败:
${
e
.
message
}
`
);
});
});
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论