提交 5833726b authored 作者: 邓文彬's avatar 邓文彬

fix(功能走查): 上次登录时间逻辑, 待完善

上级 5520d488
...@@ -116,7 +116,6 @@ export default { ...@@ -116,7 +116,6 @@ export default {
.then((res) => { .then((res) => {
// 获取文件数据 // 获取文件数据
let userData = Base64.decode(res); let userData = Base64.decode(res);
console.log("---读取用户数据", res);
uni.setStorage({ uni.setStorage({
key: "user_data", key: "user_data",
......
<template> <template>
<view class="empty-components"> <view class="empty-components">
暂无数据 <image
class="bg-img"
mode="aspectFill"
src="@/static/img/add-img/empty.png"
alt=""
>
</image>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'Empty', name: "Empty",
props: { props: {
text: { text: {
type: String, type: String,
default: '' default: "",
} },
} },
} };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.empty-components{ .empty-components {
width: 100%;
height: 80%;
display: flex;
align-items: center;
justify-content: center;
// border: 1px solid;
// text-align: center;
.bg-img {
width: 200px;
height: 200px;
}
} }
</style>
</style>
\ No newline at end of file
...@@ -92,9 +92,9 @@ export default { ...@@ -92,9 +92,9 @@ export default {
height: 84px; height: 84px;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
background-image: linear-gradient(-67deg, #ffab2487, #ffab2425 50%); background-image: linear-gradient(-67deg, #ffab2423, #ffab2411 50%);
.name { .name {
background: #ffab2471; background: #ffab2423;
border-radius: 12px; border-radius: 12px;
width: 54px; width: 54px;
height: 54px; height: 54px;
...@@ -163,14 +163,14 @@ export default { ...@@ -163,14 +163,14 @@ export default {
} }
.synchronization { .synchronization {
background-image: linear-gradient(-67deg, #9c9c9c, #9c9c9c 50%); background-image: linear-gradient(-67deg, #9c9c9c16, #9c9c9c09 50%);
.name { .name {
background: #7c7c7ca0; background: #9c9c9c16;
border-radius: 12px; border-radius: 12px;
color: #4a4a4a; color: #4a4a4a;
} }
.status { .status {
background: #e0e0e0 !important; background: #9c9c9c16 !important;
color: #4a4a4a !important; color: #4a4a4a !important;
} }
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<view class="search-com"> <view class="search-com">
<view class="search-com-left"> <view class="search-com-left">
<uni-data-select <uni-data-select
v-if="!hiddenSearch.includes('inspectionType')"
class="uni-search-item" class="uni-search-item"
v-model="searchFrom.inspectionType" v-model="searchFrom.inspectionType"
:localdata="inspectArr" :localdata="inspectArr"
...@@ -11,27 +12,30 @@ ...@@ -11,27 +12,30 @@
></uni-data-select> ></uni-data-select>
<uni-data-select <uni-data-select
v-if="!hiddenSearch.includes('synchronization')"
class="uni-search-item" class="uni-search-item"
v-model="searchFrom.synchronization" v-model="searchFrom.synchronization"
:localdata="synchronization" :localdata="synchronization"
placeholder="全部" placeholder="全部"
@change="(e) => change(e, 'synchronization')" @change="(e) => change(e, 'synchronization')"
:clear="true" :clear="true"
></uni-data-select> ></uni-data-select>
<uni-data-select <uni-data-select
v-if="!hiddenSearch.includes('isException')"
class="uni-search-item" class="uni-search-item"
v-model="searchFrom.isException" v-model="searchFrom.isException"
:localdata="exceptionArr" :localdata="exceptionArr"
placeholder="有无异常" placeholder="有无异常"
@change="(e) => change(e, 'isException')" @change="(e) => change(e, 'isException')"
:clear="true" :clear="true"
></uni-data-select> ></uni-data-select>
</view> </view>
<view class="search-com-right"> <view
class="search-com-right"
v-if="!hiddenSearch.includes('inspectionTime')"
>
<uni-datetime-picker <uni-datetime-picker
class="uni-datetime-picker" class="uni-datetime-picker"
type="daterange" type="daterange"
...@@ -44,6 +48,15 @@ ...@@ -44,6 +48,15 @@
</template> </template>
<script> <script>
export default { export default {
props: {
hiddenSearch: {
// 隐藏搜索项
type: Array,
default: () => {
return [];
},
},
},
data() { data() {
return { return {
searchFrom: { searchFrom: {
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<view class="inspect-list"> <view class="inspect-list">
<InspectionItem <InspectionItem
v-for="ele in item.list" v-for="ele in item.list"
:key="ele.inspectionCode" :key="ele.uid"
:details="ele" :details="ele"
/> />
</view> </view>
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
</template> </template>
<script> <script>
import InspectionItem from "@/components/inspectionItem/index.vue";
import InspectionManagement from "@/pages/inspectionManagement/index.vue"; import InspectionManagement from "@/pages/inspectionManagement/index.vue";
import SynchronousManagement from "@/pages/synchronousManagement/index.vue"; import SynchronousManagement from "@/pages/synchronousManagement/index.vue";
import OperLog from "@/pages/index/operLog.vue"; import OperLog from "@/pages/index/operLog.vue";
...@@ -68,7 +67,6 @@ import Content from "./content.vue"; ...@@ -68,7 +67,6 @@ import Content from "./content.vue";
export default { export default {
components: { components: {
InspectionItem,
Content, Content,
InspectionManagement, InspectionManagement,
SynchronousManagement, SynchronousManagement,
......
...@@ -98,8 +98,9 @@ export default { ...@@ -98,8 +98,9 @@ export default {
typeList: [ typeList: [
{ value: "", text: "全部" }, { value: "", text: "全部" },
{ value: 1, text: "机房巡检" }, { value: "1", text: "巡检" },
{ value: 2, text: "井道巡检" }, { value: "2", text: "同步" },
{ {
text: "其他", text: "其他",
value: "-1", value: "-1",
...@@ -163,16 +164,23 @@ export default { ...@@ -163,16 +164,23 @@ export default {
getData() { getData() {
this.loading = true; this.loading = true;
const { type, startTime, endTime } = this.searchForm; const { type, startTime, endTime } = this.searchForm;
console.log("--this.recordData--", this.recordData);
this.tableData = this.recordData.filter((item) => { this.tableData = this.recordData.filter((item) => {
let matchType = true; // 类型筛选 let matchType = true; // 类型筛选
let matchTime = true; // 时间筛选 let matchTime = true; // 时间筛选
if (type) { if (type) {
if (type == -1) { if (type == -1) {
matchType = Object.values(LOG_TYPE_ENUM).indexOf(item.type) > -1; // [其他]搜索项
} else { matchType =
matchType = item.inspectionType == type || item.inspectionType == type; Object.values(LOG_TYPE_ENUM).indexOf(item.type) > -1 &&
!item.inspectionType &&
item.module.indexOf("同步") < 0;
} else if (type == 1) {
// [巡检]搜索项
matchType = (item.inspectionType || 0) > 0;
} else if (type == 2) {
// [同步]搜索项
matchType = item.module.indexOf("同步") > -1;
} }
} }
......
...@@ -103,8 +103,8 @@ export default { ...@@ -103,8 +103,8 @@ export default {
init() { init() {
this.formData = { this.formData = {
inspectionType: "1", inspectionType: "1",
inspectionCode: `JFXJ${moment().format("yyyyMMDDhhmm")}`, inspectionCode: `JFXJ${moment().format("yyyyMMDDhhmmss")}`,
recordName: `${moment().format("yyyyMMDDhhmm")}-机房巡检记录`, recordName: `${moment().format("yyyyMMDDhhmmss")}-机房巡检记录`,
inspectionTime: moment().format("yyyy-MM-DD HH:mm:ss"), inspectionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
inspectionBy: this.$store.state.now_user.name, inspectionBy: this.$store.state.now_user.name,
inspectionById: this.$store.state.now_user.id, inspectionById: this.$store.state.now_user.id,
...@@ -126,14 +126,14 @@ export default { ...@@ -126,14 +126,14 @@ export default {
}, },
change(val) { change(val) {
this.formData.recordName = `${moment().format("yyyyMMDDhhmm")}-${ this.formData.recordName = `${moment().format("yyyyMMDDhhmmss")}-${
val.detail.data.text val.detail.data.text
}`; }`;
this.formData.inspectionType = val.detail.value; this.formData.inspectionType = val.detail.value;
const inspectionCode = `${ const inspectionCode = `${
val.detail.value == 1 ? "JFXJ" : "JDXJ" val.detail.value == 1 ? "JFXJ" : "JDXJ"
}${moment().format("yyyyMMDDhhmm")}`; }${moment().format("yyyyMMDDhhmmss")}`;
this.formData.inspectionCode = inspectionCode; this.formData.inspectionCode = inspectionCode;
}, },
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<view class="inspect-list"> <view class="inspect-list">
<InspectionItem <InspectionItem
v-for="ele in item.list" v-for="ele in item.list"
:key="ele.inspectionCode" :key="ele.uid"
:details="ele" :details="ele"
/> />
</view> </view>
......
...@@ -33,7 +33,6 @@ import { ...@@ -33,7 +33,6 @@ import {
TEST, TEST,
TEST_2X, TEST_2X,
USER_FILE_NAME, USER_FILE_NAME,
} from "@/utils/systemCofig"; } from "@/utils/systemCofig";
import { import {
...@@ -46,7 +45,6 @@ import { ...@@ -46,7 +45,6 @@ import {
import moment from "moment"; import moment from "moment";
import { Base64 } from "js-base64"; import { Base64 } from "js-base64";
export default { export default {
components: { components: {
hintInput, hintInput,
...@@ -127,7 +125,7 @@ export default { ...@@ -127,7 +125,7 @@ export default {
// 是否输入账号密码 // 是否输入账号密码
if (this.person.user && this.person.pd) { if (this.person.user && this.person.pd) {
let key = null; let key = null;
console.log("-this.personList--",this.personList) console.log("-this.personList--", this.personList);
const obj = this.personList.some((item, index) => { const obj = this.personList.some((item, index) => {
if (item.user == this.person.user) { if (item.user == this.person.user) {
key = index; key = index;
...@@ -169,10 +167,16 @@ export default { ...@@ -169,10 +167,16 @@ export default {
duration: 2000, duration: 2000,
}); });
let log_list = [];
readLogData() readLogData()
.then((res) => { .then((res) => {
log_list = res; const log_list = res;
// 更新日志信息
const logContent = getLogContent(LOG_TYPE_ENUM.login);
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list);
uni.hideLoading();
}) })
.catch((error) => { .catch((error) => {
if (error.code == 0) { if (error.code == 0) {
...@@ -184,14 +188,6 @@ export default { ...@@ -184,14 +188,6 @@ export default {
return; return;
} }
}); });
// 更新日志信息
const logContent = getLogContent(LOG_TYPE_ENUM.login);
// const log_list = this.$store.state.log_list || [];
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list);
uni.hideLoading();
// 密码不正确 // 密码不正确
} else { } else {
......
<template> <template>
<view class="synchronous-management"> <view class="synchronous-management">
<!-- 搜索项 --> <!-- 搜索项 -->
<SearchCom @change="change" /> <SearchCom @change="change" :hiddenSearch="['synchronization']" />
<!-- 结果 --> <!-- 结果 -->
<view class="synchronous-management-content"> <view class="synchronous-management-content">
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<view class="inspect-list"> <view class="inspect-list">
<InspectionItem <InspectionItem
v-for="ele in item.list" v-for="ele in item.list"
:key="ele.inspectionCode" :key="ele.uid"
:details="ele" :details="ele"
:isDisable="true" :isDisable="true"
/> />
...@@ -84,7 +84,8 @@ export default { ...@@ -84,7 +84,8 @@ export default {
getAllInspections() getAllInspections()
.then((res) => { .then((res) => {
this.all_data = res; this.all_data = res.filter(item => item.synchronization == 0);
this.getList(); this.getList();
uni.hideLoading(); uni.hideLoading();
}) })
......
...@@ -186,7 +186,6 @@ export const readInspectionData = () => { ...@@ -186,7 +186,6 @@ export const readInspectionData = () => {
const temp = res.map((element) => { const temp = res.map((element) => {
return JSON.parse(Base64.decode(element)); return JSON.parse(Base64.decode(element));
}); });
// console.log("读取【巡检数据】文件--", lodash.flattenDeep(temp));
resolve(lodash.flattenDeep(temp)); resolve(lodash.flattenDeep(temp));
}) })
......
...@@ -332,84 +332,7 @@ export async function checkFileExists(directoryPath, fileName) { ...@@ -332,84 +332,7 @@ export async function checkFileExists(directoryPath, fileName) {
}); });
} }
// 读取文件夹下面所有的文件
export const readFilesInDirectory11= async (directoryPath) => {
const promiseArr = [];
return new Promise((resolve, reject) => {
plus.io.requestFileSystem(
plus.io.PRIVATE_DOC,
function (fs) {
// 获取指定文件夹路径的目录条目
fs.root.getDirectory(
directoryPath,
{ create: false },
function (dirEntry) {
// 创建一个空的目录读取器
let directoryReader = dirEntry.createReader();
// 读取目录中的所有文件和子目录
directoryReader.readEntries(
function (entries) {
// 遍历文件和子目录
for (let i = 0; i < entries.length; i++) {
let entry = entries[i];
if (entry.isFile) {
promiseArr.push(readFileContent(entry));
// 确保是文件 执行读取文件内容的操作
// readFileContent(entry).then(res => {
// console.log("读取的文件内容", Base64.decode(res))
// promiseArr.push(JSON.parse( Base64.decode(res)) )
// }).catch((error) => {
// reject(error)
// })
}
}
Promise.all(promiseArr)
.then((res) => {
resolve(res);
})
.catch((error) => {
console.log("readFilesInDirectory:", error);
reject({
...FILE_ENUM.getFileError
// "读取文件内容失败:" + error.message
});
});
},
function (error) {
console.log("readFilesInDirectory:", error);
reject({
...FILE_ENUM.readDirectoryError
// "读取目录条目失败:" + error.message
});
}
);
},
function (error) {
console.log("readFilesInDirectory:", error, directoryPath);
reject({
...FILE_ENUM.getDirectoryError
// "获取目录失败:" + error.message
});
}
);
},
function (error) {
console.log("readFilesInDirectory:", error);
reject({
...FILE_ENUM.fileSystemError
// "请求文件系统失败:" + error.message
});
}
);
});
};
export const readFilesInDirectory = async (directoryPath) => { export const readFilesInDirectory = async (directoryPath) => {
const promiseArr = []; const promiseArr = [];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论