提交 3bb66450 authored 作者: 邓文彬's avatar 邓文彬

fix(文件读取): 文件读取

上级 4669d370
<script>
import {
BASE_PATH,
SYNCHRONIZE_DATA_PATH,
SYNCHRONIZE_DATA_PAD,
checkAndCreateDirectory,
checkFileExists,
......@@ -13,7 +11,6 @@ import {
import { Base64 } from "js-base64";
import {differenceBy} from "lodash";
import { readDirectoryData } from "@/utils/IoReadingAndWriting.js";
export default {
onLaunch: function () {
// #ifdef APP-PLUS
......
......@@ -2,52 +2,18 @@
<view class="search-com">
<view class="search-com-left">
<uni-data-select
v-if="!hiddenSearch.includes('inspectionType')"
class="uni-search-item"
v-model="searchFrom.inspectionType"
v-model="searchFrom.reportTime"
:localdata="inspectArr"
@change="(e) => change(e, 'inspectionType')"
placeholder="巡检类型:全部"
@change="(e) => change(e, 'reportTime')"
placeholder="选择月份"
:clear="true"
:key="new Date().getTime()"
></uni-data-select>
<uni-data-select
v-if="!hiddenSearch.includes('synchronization')"
class="uni-search-item"
v-model="searchFrom.synchronization"
:localdata="synchronization"
placeholder="是否同步:全部"
@change="(e) => change(e, 'synchronization')"
:clear="true"
:key="new Date().getTime()"
></uni-data-select>
<uni-data-select
v-if="!hiddenSearch.includes('isException')"
class="uni-search-item"
v-model="searchFrom.isException"
:localdata="exceptionArr"
placeholder="有无异常:全部"
@change="(e) => change(e, 'isException')"
:clear="true"
:key="new Date().getTime()"
></uni-data-select>
</view>
<view
class="search-com-right"
v-if="!hiddenSearch.includes('inspectionTime')"
>
<uni-datetime-picker
class="uni-datetime-picker"
type="daterange"
v-model="searchFrom.inspectionTime"
:border="false"
@change="(e) => change(e, 'inspectionTime')"
/>
</view>
</view>
</template>
<script>
......@@ -64,27 +30,14 @@ export default {
data() {
return {
searchFrom: {
inspectionType: "", // 巡检类型
synchronization: "", // 同部数据
isException: "", // 有无异常
inspectionTime: "", // 时间选择
reportTime: "202410",
},
inspectArr: [
{ value: "all", text: "全部" },
{ value: "1", text: "机房巡检" },
{ value: "2", text: "井道巡检" },
],
synchronization: [
{ value: "all", text: "全部" },
{ value: "0", text: "未同步" },
{ value: "1", text: "已同步" },
],
exceptionArr: [
{ value: "all", text: "全部" },
{ value: "1", text: "有异常" },
{ value: "0", text: "无异常" },
{ value: "202410", text: "2024年10月" },
{ value: "202411", text: "2024年11月" },
],
};
},
methods: {
......@@ -104,7 +57,7 @@ export default {
.search-com-left {
display: flex;
align-items: center;
flex: 1;
width: 200px;
.uni-search-item {
margin-right: 12px;
width: 130px;
......
......@@ -9,7 +9,7 @@
"navigationBarTitleText": ""
}
},
{ //操作日志
{ //操作日志
"path": "pages/index/operLog"
},
{ //修改密码
......
......@@ -2,18 +2,17 @@
<view class="home-page">
<view class="left-tab">
<view class="user-info">
<image class="user-img" src="@/static/img/add-img/home1.png"></image>
<view class="user-img">
<image src="@/static/img/portrait.png"></image>
</view>
<text class="text">{{ userName }}</text>
</view>
<view class="button-group">
<!-- <view class="log-button" @click="updatePassword">修改密码?</view>
<view class="log-button" @click="lookLog">操作日志</view> -->
<view class="reset-password-button" @click="updatePassword"
>修改密码?</view
>
......@@ -23,9 +22,8 @@
<!-- 内容区 -->
<view class="right-container">
<MonthReport />
<RouterView />
<RouterView />
</view>
<!-- 退出账号弹出 -->
......@@ -43,16 +41,15 @@
<script>
import OperLog from "@/pages/index/operLog.vue";
import MonthReport from "@/pages/monthReport/index.vue"
import MonthReport from "@/pages/monthReport/index.vue";
export default {
components: {
OperLog,
MonthReport
MonthReport,
},
data() {
return {
userName: this.$store.state.now_user.user,
};
},
......@@ -61,12 +58,8 @@ export default {
return this.$store.state.now_user.isAdmin;
},
},
onLoad(options = {}) {
},
watch: {
},
onLoad(options = {}) {},
watch: {},
methods: {
// 修改密码
updatePassword() {
......@@ -80,7 +73,6 @@ export default {
uni.navigateTo({
url: "/pages/index/operLog",
});
},
//退出--弹出对话框
......@@ -95,9 +87,6 @@ export default {
"last_time",
this.$store.state.now_user.LastSynchronizationTime || ""
);
},
});
},
......@@ -106,7 +95,6 @@ export default {
this.$refs.inputDialog2.open();
},
toIndex() {
uni.navigateTo({
url: "/pages/index/index",
......@@ -146,6 +134,10 @@ export default {
border-radius: 50%;
overflow: hidden;
box-shadow: 5px 5px 10px #e7e7e7;
image{
height: 48px;
width: 48px;
}
}
.text {
font-size: 16px;
......
......@@ -22,12 +22,10 @@ export default {
value: {
type: Number,
default: 0,
}
},
},
data() {
return {
};
return {};
},
onLoad() {},
......@@ -36,7 +34,6 @@ export default {
let dataTmp = this.value || 0;
let max = 100;
let min = 0;
let scoresPercentage = dataTmp / max;
let name = "健康指数";
return {
backgroundColor: "#fff",
......@@ -115,7 +112,6 @@ export default {
//底部点位名称
detail: {
show: false,
},
data: [
{
......
<template>
<view class="padding_all_16 page_box">
<SearchCom @change="searchChange" />
<!-- 态势分析研判报告 -->
<view class="margin_t_16 padding_16_24 background_white">
<common-top-title
......@@ -9,7 +12,7 @@
<view class="rightOne">
<rightPie
class="margin_t_16 rightPie"
:value="detailData.report_value"
:value="detailData.report_value "
/>
<rightItem :detailData="detailData" class="rightItem" />
</view>
......@@ -280,7 +283,11 @@ import rightPie from "./components/rightPie.vue";
import rightItem from "./components/rightItem.vue";
import rightBar from "./components/rightBar.vue";
import rightLine from "./components/rightLine.vue";
import {mergeObjectsWithUnderscoreKey} from "./_monthReportUtil.js"
import { mergeObjectsWithUnderscoreKey } from "./_monthReportUtil.js";
import { getReportList } from "@/request/index.js";
import SearchCom from "@/components/searchCom/index.vue"
import {
terminal,
......@@ -305,6 +312,7 @@ export default {
rightItem,
rightBar,
rightLine,
SearchCom
},
data() {
return {
......@@ -318,16 +326,36 @@ export default {
fbData,
detailData: {}, //数据详情
allReport: [], // 所有汇报数据
defaultReportTime: "202410",// 默认选中时间
};
},
created() {
this.getDetailData();
getReportList().then((res) => {
this.allReport = res.map(item => JSON.parse(item))
this.getDetailData(this.defaultReportTime)
});
},
methods: {
getDetailData() {
getDetailData(reportTime) {
// const result = this.allReport.filter(item => item.data.reportTime == reportTime)[0]
// console.log("--result-", result)
// this.detailData = mergeObjectsWithUnderscoreKey(result.data);
this.detailData = mergeObjectsWithUnderscoreKey(result);
},
// 搜索 change
searchChange(val){
console.log("searchItem", val)
this.getDetailData(val.reportTime)
}
},
};
</script>
......
......@@ -2,7 +2,8 @@ import store from "../store/index";
import {
readLogData,
readInspectionData,
readDarfData
readDarfData,
readReportData
} from "@/utils/IoReadingAndWriting.js";
import lodash from "lodash";
......@@ -98,4 +99,25 @@ export const getDarft = () => {
reject(error)
})
})
}
\ No newline at end of file
}
// 获取所有月报数据
export const getReportList = () => {
return new Promise((resolve, reject) => {
if(store.state.reportList.length){
resolve(store.state.reportList)
return;
}
readReportData()
.then((res) => {
store.commit("SET_REPORT_LIST", res);
resolve(res)
})
.catch((error) => {
reject(error)
})
})
}
差异被折叠。
......@@ -21,6 +21,8 @@ const store = new Vuex.Store({
flgObj: false,
roomNum: null,
startTime: "",
reportList: [], // 所有月报数据
},
mutations: {
SET_STARTTIME(state, payload) {
......@@ -71,6 +73,13 @@ const store = new Vuex.Store({
// 保存 日志文件
state.log_list = payload;
},
SET_REPORT_LIST(state, payload) {
// 保存 月报数据
state.reportList = payload;
},
},
});
......
......@@ -410,3 +410,20 @@ export const readDirectoryData = () => {
});
});
};
// 读取报告数据
export const readReportData = () => {
const directoryPath = `${SYNCHRONIZE_DATA_PAD}/reportData`
return new Promise((resolve, reject) => {
readFilesInDirectory(directoryPath)
.then((res) => {
resolve(lodash.flattenDeep(res));
})
.catch((error) => reject(error));
});
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论