Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspection-pad-web
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
专网
inspection-pad-web
Commits
d191c3fa
提交
d191c3fa
authored
4月 14, 2025
作者:
zs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
edit
上级
0892dbfe
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
69 行增加
和
58 行删除
+69
-58
inspect.js
api/inspect.js
+1
-1
init.js
api/sqllite/init.js
+9
-15
dialog.vue
pages/inspectionManagement/dialog.vue
+49
-25
systemCofig.js
utils/systemCofig.js
+10
-17
没有找到文件。
api/inspect.js
浏览文件 @
d191c3fa
...
...
@@ -45,7 +45,7 @@ export default {
,inspectionTime
,isException
,synFlag
,createTime,delFlag
,createTime,delFlag
,inspectionData
FROM
${
table
.
inspectionRecordName
}
where 1=1
${
data
.
inspectionType
?
`AND inspectionType = '
${
data
.
inspectionType
}
'`
:
''
}
...
...
api/sqllite/init.js
浏览文件 @
d191c3fa
...
...
@@ -13,7 +13,7 @@ export default {
// app初始化
async
init
()
{
const
BASE_PATH
=
"_documents/data/asmzx/pad"
;
// 基础路径
// uni.showLoading({
// title: '正在初始化...',
// })
...
...
@@ -25,7 +25,7 @@ export default {
await
this
.
initSqlLite
(
sqllitedb
);
// 确保表被创建
console
.
log
(
'Tables created.'
);
await
ioUtil
.
createDir
(
BASE_PATH
,
'发送数据'
)
let
isInit
=
await
SqlliteDbUtil
.
checkIfDataImported
(
sqllitedb
);
// 确保表存在后再查询
console
.
log
(
'Data imported:'
,
isInit
);
if
(
!
isInit
)
{
...
...
@@ -94,20 +94,14 @@ export default {
// 初始化目录
async
initDir
()
{
try
{
const
_www
=
_Path
.
getPrivateWWW
()
const
_doc
=
_Path
.
getPrivateDOC
()
const
_download
=
_Path
.
getDownloads
()
const
_temp
=
_Path
.
getTempPath
()
const
wwwEntry
=
await
ioUtil
.
getFileEntry
(
_www
)
const
docEntry
=
await
ioUtil
.
getFileEntry
(
_doc
)
const
downloadEntry
=
await
ioUtil
.
getFileEntry
(
_download
)
const
downloadEntry
=
await
ioUtil
.
getFileEntry
()
if
(
downloadEntry
)
{
await
ioUtil
.
createDir
(
downloadEntry
.
fullPath
,
'base'
)
await
ioUtil
.
createDir
(
downloadEntry
.
fullPath
,
'export'
)
await
ioUtil
.
createDir
(
downloadEntry
.
fullPath
,
'import'
)
await
ioUtil
.
createDir
(
downloadEntry
.
fullPath
,
'doc'
)
await
ioUtil
.
createDir
(
downloadEntry
.
fullPath
,
'error'
)
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'
)
}
// 获取设备名称
...
...
@@ -118,7 +112,7 @@ export default {
brand
:
e
.
deviceBrand
,
deviceModel
:
e
.
deviceModel
,
}
const
deviceFilePath
=
downloadEntry
.
fullPath
+
'name.txt'
const
deviceFilePath
=
BASE_PATH
+
'name.txt'
await
ioUtil
.
removeExistFile
(
deviceFilePath
)
await
ioUtil
.
writeFile
(
'name.txt'
,
downloadEntry
,
JSON
.
stringify
(
deviceData
))
},
...
...
pages/inspectionManagement/dialog.vue
浏览文件 @
d191c3fa
...
...
@@ -38,30 +38,40 @@
</
template
>
<
script
>
import
{
import
{
SYNCHRONIZE_DATA_PAD
,
checkAndCreateDirectory
,
createFileWithPlusIO
,
setSm2
,
USER_FILE_NAME
,
getUserList
,
}
from
"@/utils/systemCofig"
;
import
{
findPhotosUrls
}
from
"@/utils/index.js"
;
import
{
copySelectedFiles
}
from
"@/utils/plus.js"
;
import
{
zipCompress
}
from
"@/utils/systemCofig"
;
import
{
findPhotosUrls
}
from
"@/utils/index.js"
;
import
{
copySelectedFiles
}
from
"@/utils/plus.js"
;
import
{
writeInspectionData
,
copyDirectory
,
deleteAllFilesInDirectory
,
addLog
,
getLogContent
,
LOG_TYPE_ENUM
,
}
from
"@/utils/IoReadingAndWriting.js"
;
import
moment
from
"moment"
;
import
{
getAllInspections
}
from
"@/request/index.js"
;
import
{
Base64
}
from
"js-base64"
;
import
inspectApi
from
"@/api/inspect"
;
export
default
{
}
from
"@/utils/IoReadingAndWriting.js"
;
import
moment
from
"moment"
;
import
{
getAllInspections
}
from
"@/request/index.js"
;
import
{
Base64
}
from
"js-base64"
;
import
inspectApi
from
"@/api/inspect"
;
import
inspect
from
"@/api/inspect"
;
export
default
{
props
:
{
list
:
{
type
:
Array
,
...
...
@@ -127,7 +137,7 @@ export default {
const
directoryPath
=
`
${
SYNCHRONIZE_DATA_PAD
}
/发送数据`
;
const
targetDirectoryPath
=
`
${
SYNCHRONIZE_DATA_PAD
}
/history`
;
checkAndCreateDirectory
(
directoryPath
).
then
(()
=>
{
//
checkAndCreateDirectory(directoryPath).then(() => {
copyDirectory
(
directoryPath
,
targetDirectoryPath
)
.
then
(()
=>
{
return
deleteAllFilesInDirectory
(
directoryPath
);
...
...
@@ -142,14 +152,17 @@ export default {
duration
:
1000
,
});
});
});
//
});
},
copyPhotos
()
{
this
.
list
.
forEach
(
e
=>
{
e
.
inspectionData
=
JSON
.
parse
(
e
.
inspectionData
)
||
'{}'
})
const
urls
=
findPhotosUrls
(
this
.
list
).
map
((
url
)
=>
url
.
split
(
"/"
).
pop
());
console
.
log
(
"urls"
,
urls
);
return
copySelectedFiles
(
"_documents/data/photos"
,
`
${
SYNCHRONIZE_DATA_PAD
}
/发送数据/
${
this
.
userInfo
.
user
}
`
,
`
${
SYNCHRONIZE_DATA_PAD
}
/发送数据
`
,
urls
);
},
...
...
@@ -231,6 +244,12 @@ export default {
duration
:
2000
,
});
let
ids
=
this
.
list
.
map
((
e
)
=>
e
.
id
);
// 复制照片
await
this
.
copyPhotos
();
await
zipCompress
(
`
${
SYNCHRONIZE_DATA_PAD
}
/发送数据`
,
`
${
SYNCHRONIZE_DATA_PAD
}
/fssj/
${
userName
}
_JFXJ_
${
timeStr
}
.zip`
);
// zip
await
inspectApi
.
updateSyncData
(
ids
);
this
.
close
();
this
.
loading
=
false
;
...
...
@@ -249,9 +268,7 @@ export default {
// 更新同步时间
this
.
updateSysTime
();
// 复制照片
await
this
.
copyPhotos
();
// zip
},
2
*
1000
);
})
.
catch
((
error
)
=>
{
...
...
@@ -276,6 +293,8 @@ export default {
});
},
// 使用示例
// 打包文件
packedData
(
content
,
fileName
)
{
// const fileContent = setSm2(content);
...
...
@@ -326,10 +345,10 @@ export default {
});
},
},
};
};
</
script
>
<
style
scoped
lang=
"less"
>
.synchronous-dialog {
.synchronous-dialog {
position: fixed;
z-index: 999;
top: 0;
...
...
@@ -340,18 +359,17 @@ export default {
display: flex;
align-items: center;
justify-content: center;
.synchronous-content {
padding: 3% 20px 32px 24px;
width: 400px;
height: 60%;
box-sizing: border-box;
background-image: linear-gradient(
-6deg,
background-image: linear-gradient(-6deg,
#f9ffe7 0%,
#ffffff 12%,
#fcfeff 73%,
#ccf1ff 100%
);
#ccf1ff 100%);
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 12px;
position: relative;
...
...
@@ -370,9 +388,11 @@ export default {
line-height: 26px;
font-weight: 500;
}
.count-num {
margin: 5% 0 5% 0;
align-items: flex-end;
.num {
display: inline-block;
font-family: AlibabaPuHuiTi_2_65_Medium;
...
...
@@ -385,6 +405,7 @@ export default {
.operating-instructions {
margin-bottom: 8%;
.title {
font-size: 13px;
color: #4a4a4a;
...
...
@@ -392,6 +413,7 @@ export default {
font-weight: 600;
text-align: left;
}
.instructions-item {
font-size: 12px;
color: #7c7c7c;
...
...
@@ -426,10 +448,11 @@ export default {
bottom: -40px;
left: 50%;
transform: translateX(-50%);
.iconfont {
font-size: 24px;
}
}
}
}
}
</
style
>
\ No newline at end of file
utils/systemCofig.js
浏览文件 @
d191c3fa
...
...
@@ -471,25 +471,17 @@ export function getUserList() {
});
}
export
function
zipCompress
(
name
)
{
const
BASE_PATH
=
"_documents/data"
;
const
targetPath
=
plus
.
io
.
convertLocalFileSystemURL
(
BASE_PATH
+
'/photos'
);
const
zipfile
=
plus
.
io
.
convertLocalFileSystemURL
(
BASE_PATH
+
`/
${
name
}
.zip`
);
export
function
zipCompress
(
sourceDir
,
zipPath
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
plus
.
zip
.
compress
(
targetPath
,
zipfile
,
{
plus
.
io
.
convertLocalFileSystemURL
(
sourceDir
),
plus
.
io
.
convertLocalFileSystemURL
(
zipPath
),
{
recursive
:
true
,
overwrite
:
true
},
function
()
{
plus
.
io
.
resolveLocalFileSystemURL
(
zipfile
,
function
(
zipEntry
)
{
zipEntry
.
file
(
function
(
file
)
{
console
.
log
(
"ZIP 文件大小: "
+
file
.
size
+
" 字节"
);
});
});
overwrite
:
true
,
},
function
(
error
)
{
alert
(
"压缩失败: "
+
error
.
message
);
}
()
=>
resolve
(
zipPath
),
(
error
)
=>
reject
(
`压缩失败:
${
error
.
message
}
`
)
);
});
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论