提交 d8641917 authored 作者: JaxBBLL's avatar JaxBBLL

fix

上级 6909d900
......@@ -38,40 +38,32 @@
</template>
<script>
import {
import {
SYNCHRONIZE_DATA_PAD,
checkAndCreateDirectory,
createFileWithPlusIO,
setSm2,
USER_FILE_NAME,
getUserList,
zipCompress
} 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";
import inspect 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,
......@@ -155,9 +147,11 @@
// });
},
copyPhotos() {
this.list.forEach(e => {
e.inspectionData = JSON.parse(e.inspectionData) || '{}'
})
this.list.forEach((e) => {
if (typeof e.inspectionData === "string") {
e.inspectionData = JSON.parse(e.inspectionData) || "{}";
}
});
const urls = findPhotosUrls(this.list).map((url) => url.split("/").pop());
console.log("urls", urls);
return copySelectedFiles(
......@@ -200,10 +194,10 @@
tmepList.push(this.packedData(JFXJ_DATA, JFXJ_DATA_FILE_NAME));
}
JDXJ_DATA.forEach((item, index) => {
let JDXJ_DATA_FILE_NAME = `${userName}_JDXJ_${timeStr}_${index}.txt`;
tmepList.push(this.packedData(item, JDXJ_DATA_FILE_NAME));
});
if (JDXJ_DATA.length) {
let JDXJ_DATA_FILE_NAME = `${userName}_JDXJ_${timeStr}.txt`;
tmepList.push(this.packedData(JDXJ_DATA, JDXJ_DATA_FILE_NAME));
}
console.log("同步窗口");
console.log("同步窗口", tmepList);
......@@ -246,7 +240,8 @@
let ids = this.list.map((e) => e.id);
// 复制照片
await this.copyPhotos();
zipCompress(`${SYNCHRONIZE_DATA_PAD}/发送数据`,
zipCompress(
`${SYNCHRONIZE_DATA_PAD}/发送数据`,
`${SYNCHRONIZE_DATA_PAD}/fssj/${userName}_JFXJ_${timeStr}.zip`
);
// zip
......@@ -267,8 +262,6 @@
// 更新同步时间
this.updateSysTime();
}, 2 * 1000);
})
.catch((error) => {
......@@ -293,7 +286,6 @@
});
},
// 使用示例
// 打包文件
packedData(content, fileName) {
......@@ -345,10 +337,10 @@
});
},
},
};
};
</script>
<style scoped lang="less">
.synchronous-dialog {
.synchronous-dialog {
position: fixed;
z-index: 999;
top: 0;
......@@ -365,11 +357,13 @@
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;
......@@ -454,5 +448,5 @@
}
}
}
}
}
</style>
......@@ -113,18 +113,16 @@ export default {
* 读取上一次打包的文件, 复制到 [ history ] 文件夹中
*/
clickHandle() {
if(this.loading) return;
if (this.loading) return;
const directoryPath = `${SYNCHRONIZE_DATA_PAD}/发送数据`;
const targetDirectoryPath = `${SYNCHRONIZE_DATA_PAD}/history`;
checkAndCreateDirectory(directoryPath).then(() => {
copyDirectory(directoryPath, targetDirectoryPath)
.then(() => {
return deleteAllFilesInDirectory(directoryPath);
})
.then(() => {
this.coverData();
})
.catch((error) => {
......@@ -142,7 +140,6 @@ export default {
const notSynchronizationList = this.notSynchronizationList;
const allList = this.allList;
let timeStr = moment().format("yyyy_MM_DD_hh_mm_ss");
const JFXJ_DATA = notSynchronizationList
......@@ -160,19 +157,17 @@ export default {
return item[item.inspectionCode];
}); // 井道数据类型是 2
this.loading = true;
const tmepList = [];
if (JFXJ_DATA.length) {
let JFXJ_DATA_FILE_NAME = `${userName}_JFXJ_${timeStr}.txt`;
tmepList.push(this.packedData(JFXJ_DATA, JFXJ_DATA_FILE_NAME));
tmepList.push(this.packedData(JDXJ_DATA, JFXJ_DATA_FILE_NAME));
}
if (JDXJ_DATA.length) {
let JDXJ_DATA_FILE_NAME = `${userName}_JDXJ_${timeStr}.txt`;
tmepList.push(this.packedData(JDXJ_DATA, JDXJ_DATA_FILE_NAME));
}
JDXJ_DATA.forEach((item, index) => {
let JDXJ_DATA_FILE_NAME = `${userName}_JDXJ_${timeStr}_${index}.txt`;
tmepList.push(this.packedData(item, JDXJ_DATA_FILE_NAME));
});
Promise.all(tmepList)
.then(() => {
......@@ -223,8 +218,7 @@ export default {
const log_list = this.$store.state.log_list;
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => {
});
addLog(log_list).then((res) => {});
// 更新同步时间
this.updateSysTime();
......@@ -290,12 +284,13 @@ export default {
console.log("APP.vue 存储数据失败", error);
},
});
createFileWithPlusIO(SYNCHRONIZE_DATA_PAD, USER_FILE_NAME, fileContent).then(() => {
console.log("---用户数据更新成功")
}).catch(error => {
console.log("---用户数据更新失败", error)
createFileWithPlusIO(SYNCHRONIZE_DATA_PAD, USER_FILE_NAME, fileContent)
.then(() => {
console.log("---用户数据更新成功");
})
.catch((error) => {
console.log("---用户数据更新失败", error);
});
});
},
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论