提交 198631c3 authored 作者: 邓文彬's avatar 邓文彬

fix(pad): 数据导出格式和PC端对齐,能够成功导出PC

上级 e0881957
......@@ -58,7 +58,8 @@ export default {
},
onShow: function () {
const now_user = uni.getStorageSync("now_user") || {};
if (now_use.user) {
console.log("--now_user-", now_user)
if (now_user.user) {
this.$store.commit("SET_USER", now_user);
}
this.init();
......
......@@ -12,7 +12,7 @@
details.synchronization == 0 ? "待同步" : "已同步"
}}</text>
<view v-if="details.isException == 2" class="status alarm">
<view v-if="details.isException == 1" class="status alarm">
<text class="iconfont icon-yichang1"></text>
<text>有异常</text></view
>
......
......@@ -103,7 +103,7 @@ export default {
init() {
this.formData = {
inspectionType: "1",
inspectionCode: `JFXJ${moment().format("yyyyMMDDhhmmss")}`,
inspectionCode: `JFXJ${moment().format("yyyyMMDDhhmmss")}${(Math.floor(Math.random() * 900) + 100)}`,
recordName: `${moment().format("yyyyMMDD")}-机房巡检记录`,
inspectionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
inspectionBy: this.$store.state.now_user.user,
......@@ -136,7 +136,7 @@ export default {
const inspectionCode = `${
val.detail.value == 1 ? "JFXJ" : "JDXJ"
}${moment().format("yyyyMMDDhhmmss")}`;
this.formData.inspectionCode = inspectionCode;
this.formData.inspectionCode = inspectionCode + (Math.floor(Math.random() * 900) + 100);
},
back() {
......
......@@ -366,7 +366,7 @@ export default {
lookTable() {
uni.navigateTo({
url: "/pages/report/sampleTable",
url: "/pages/report/sampleTable?isJF=1",
});
},
......@@ -427,8 +427,8 @@ export default {
});
const isException = items.filter((item) => item.inspectionResult > 0)
.length
? 2
: 1;
? 1
: 0;
return {
...temp,
......
......@@ -114,6 +114,7 @@ export default {
this.person.user == this.personList[key].user &&
this.person.pd == this.personList[key].passWord
) {
console.log("-userInfo---",userInfo)
const userInfo = this.personList[key];
this.$store.commit("SET_USER", userInfo);
uni.setStorageSync("now_user", userInfo);
......
......@@ -14,25 +14,23 @@
</uni-nav-bar>
<view class="main">
<!-- 占位---不可删除 -->
<view class="seize-seat"> </view>
<!-- 占位---不可删除 -->
<view class="seize-seat"> </view>
<view class="container box-shaow-box">
<!-- <view class="image-item top-image">
<view v-if="isJF" class="image-item top-image">
<image
src="@/static/img/add-img/jf_table.png"
mode="widthFix"
></image>
</view> -->
</view>
<view class="image-item top-image">
<view v-else class="image-item top-image">
<image
src="@/static/img/add-img/jd_bg.png"
src="@/static/img/add-img/jd_table.png"
mode="widthFix"
></image>
</view>
</view>
</view>
</view>
......@@ -40,10 +38,18 @@
<script>
export default {
data() {
return {
isJF: false,
};
},
onNavigationBarButtonTap(val) {
// console.log(val);
uni.navigateBack();
},
onLoad(options) {
this.isJF = options.isJF == 1;
},
methods: {
checkImage(val) {
let res = "";
......@@ -62,23 +68,23 @@ export default {
width: 100%;
height: 100%;
background-image: linear-gradient(
90deg,
#e9f7fe 0%,
#dceffe 40%,
#d5ebfd 66%,
#c9e8fe 100%
);
90deg,
#e9f7fe 0%,
#dceffe 40%,
#d5ebfd 66%,
#c9e8fe 100%
);
.main {
margin-top: -44px;
margin-top: -44px;
width: 100%;
background-size: 100% 40rpx;
background-repeat: no-repeat;
.container {
margin: 0 auto;
width: 730rpx;
height: calc(100vh - 44px - var(--status-bar-height) - 20px);
height: calc(100vh - 44px - var(--status-bar-height) - 20px);
padding: 23.53rpx 17.65rpx;
padding-bottom: 0;
......@@ -90,6 +96,7 @@ export default {
justify-sampletable: space-between;
.image-item {
text-align: center;
width: 60%;
// height: 100%;
background-color: #ffffff;
......
......@@ -286,7 +286,7 @@ export default {
},
lookTable() {
uni.navigateTo({
url: "/pages/report/sampleTable",
url: "/pages/report/sampleTable?isJF=0",
});
},
......@@ -316,8 +316,8 @@ export default {
const isException = ((tempForm[index] || {}).temp || []).filter(
(item) => item.inspectionResult > 0
).length
? 2
: 1;
? 1
: 0;
return {
...baseInfo,
......@@ -334,7 +334,7 @@ export default {
...temp[0],
isSubmit: 0,
isException: temp.filter((item) => item.isException > 1).length ? 2 : 1, // 总的数据
isException: temp.filter((item) => item.isException > 1).length ? 1 : 0, // 总的数据
items: [],
synchronization: 0, // 是否导出过
submitTime: moment().format("yyyy-MM-DD"), // 记录提交时间
......
......@@ -289,7 +289,7 @@
}
let timeStr = getDateTime.dateTimeStr('y-m-d h:i')
let operData = {
name: this.$store.state.now_use.user,
name: this.$store.state.now_user.user,
level: '秘密',
user: this.$store.state.now_user.user,
module: moduleName,
......@@ -336,7 +336,7 @@
}
let timeStr = getDateTime.dateTimeStr('y-m-d h:i')
let operData = {
name: this.$store.state.now_use.user,
name: this.$store.state.now_user.user,
level: '秘密',
user: this.$store.state.now_user.user,
module: moduleName,
......@@ -371,7 +371,7 @@
// }
// let timeStr = getDateTime.dateTimeStr('y-m-d h:i')
// let operData = {
// name: this.$store.state.now_use.user,
// name: this.$store.state.now_user.user,
// level: '秘密',
// user: this.$store.state.now_user.user,
// module: moduleName,
......
......@@ -114,6 +114,8 @@ export default {
})
.then(() => {
console.log("---文件删除成功----");
console.log("coverData----", this.$store.state.now_user.user);
this.coverData();
})
.catch((error) => {
......@@ -128,15 +130,13 @@ export default {
},
// 处理数据
coverData() {
const userName = this.$store.state.now_use.user;
const userName = this.$store.state.now_user.user;
const notSynchronizationList = this.notSynchronizationList;
const allList = this.allList;
// console.log("-同步数据--", notSynchronizationList);
let timeStr = moment().format("yyyy-MM-DD_hh:mm:ss");
let JFXJ_DATA_FILE_NAME = `${userName}_JFXJ_${timeStr}.txt`;
let JDXJ_DATA_FILE_NAME = `${userName}_JDXJ_${timeStr}.txt`;
let timeStr = moment().format("yyyy_MM_DD_hh_mm_ss");
const JFXJ_DATA = notSynchronizationList
.filter((item) => item.inspectionType == 1)
......@@ -147,12 +147,11 @@ export default {
};
}); // 机房数据类型是 1
const JDXJ_DATA = notSynchronizationList.filter(
(item) => item.inspectionType == 2
).map(item => {
return item[item.inspectionCode]
})// 井道数据类型是 2
const JDXJ_DATA = notSynchronizationList
.filter((item) => item.inspectionType == 2)
.map((item) => {
return item[item.inspectionCode];
}); // 井道数据类型是 2
// console.log("---源数据", [...JDXJ_DATA,...JFXJ_DATA] )
......@@ -160,11 +159,21 @@ export default {
// return console.log("--- [...JDXJ_DATA,...JFXJ_DATA]", fileContent )
this.loading = true;
const tmepList = [];
if (JFXJ_DATA.length) {
let JFXJ_DATA_FILE_NAME = `${userName}_JFXJ_${timeStr}.txt`;
// console.log("---机房数据===", JFXJ_DATA);
tmepList.push(this.packedData(JFXJ_DATA, JFXJ_DATA_FILE_NAME));
}
Promise.all([
this.packedData(JFXJ_DATA, JFXJ_DATA_FILE_NAME),
this.packedData(JDXJ_DATA, JDXJ_DATA_FILE_NAME),
])
JDXJ_DATA.forEach((item, index) => {
let JDXJ_DATA_FILE_NAME = `${userName}_JDXJ_${timeStr}_${index}.txt`;
// console.log("---井道数据===", item);
tmepList.push(this.packedData(item, JDXJ_DATA_FILE_NAME));
});
Promise.all(tmepList)
.then(() => {
// 更新巡检数据状态
const synchronizationUids = notSynchronizationList.map((item) => {
......@@ -185,7 +194,6 @@ export default {
}
});
this.$store.commit("SET_ALL_DATA", allList);
console.log("---userData---", userData);
const keys = Object.keys(userData);
const promiseArr = keys.map((key) => {
......@@ -246,6 +254,7 @@ export default {
// 打包文件
packedData(content, fileName) {
console.log("--------发送数据内容----", fileName, content);
const fileContent = setSm2(content);
return createFileWithPlusIO(
......@@ -258,16 +267,17 @@ export default {
// 更新最近一次同步时间
updateSysTime() {
getUserList().then((personList) => {
const now_user = this.$store.state.now_user;
const key = personList.findIndex(item => item.userId == now_user.userId)
const key = personList.findIndex(
(item) => item.userId == now_user.userId
);
// 更新用户同步时间
const userInfo = personList[key];
const LastSynchronizationTime = moment().format("yyyy-MM-DD HH:mm");
personList[key].LastSynchronizationTime = LastSynchronizationTime;
userInfo.LastSynchronizationTime = LastSynchronizationTime;
console.log("---更新最近一次同步时间--", userInfo)
console.log("---更新最近一次同步时间--", userInfo);
this.$store.commit("SET_USER", userInfo);
uni.setStorageSync("last_time", userInfo.LastSynchronizationTime || "");
......
static/img/add-img/jd_table.png

26.5 KB | W: | H:

static/img/add-img/jd_table.png

797.5 KB | W: | H:

static/img/add-img/jd_table.png
static/img/add-img/jd_table.png
static/img/add-img/jd_table.png
static/img/add-img/jd_table.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -68,7 +68,7 @@ export const USER_LiST = [
LastSynchronizationTime: "", // 上次同步时间
},
{
userId: 2, // 有用
userId: 262, // 有用
user: "test1", // 有用 谁创建,谁有权限编辑和删除
passWord: "JF123456", // 有用
roleName: "巡检员", // 有用
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论