提交 d191c3fa authored 作者: zs's avatar zs

edit

上级 0892dbfe
......@@ -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}'` : ''}
......
......@@ -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))
},
......
......@@ -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`);
plus.zip.compress(
targetPath,
zipfile, {
recursive: true,
overwrite: true
},
function() {
plus.io.resolveLocalFileSystemURL(zipfile, function(zipEntry) {
zipEntry.file(function(file) {
console.log("ZIP 文件大小: " + file.size + " 字节");
});
});
},
function(error) {
alert("压缩失败: " + error.message);
}
);
export function zipCompress(sourceDir, zipPath) {
return new Promise((resolve, reject) => {
plus.zip.compress(
plus.io.convertLocalFileSystemURL(sourceDir),
plus.io.convertLocalFileSystemURL(zipPath),
{
recursive: true,
overwrite: true,
},
() => resolve(zipPath),
(error) => reject(`压缩失败: ${error.message}`)
);
});
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论