提交 4b9c8a9d authored 作者: 邓文彬's avatar 邓文彬

fix(功能走查): 基本功能完成,待自测

上级 66584b83
......@@ -7,14 +7,17 @@
:localdata="inspectArr"
@change="(e) => change(e, 'inspectionType')"
placeholder="全部巡检"
:clear="true"
></uni-data-select>
<uni-data-select
class="uni-search-item"
v-model="searchFrom.iSynchronization"
v-model="searchFrom.synchronization"
:localdata="synchronization"
placeholder="全部"
@change="(e) => change(e, 'iSynchronization')"
@change="(e) => change(e, 'synchronization')"
:clear="true"
></uni-data-select>
<uni-data-select
......@@ -23,6 +26,8 @@
:localdata="exceptionArr"
placeholder="有无异常"
@change="(e) => change(e, 'isException')"
:clear="true"
></uni-data-select>
</view>
......@@ -43,22 +48,23 @@ export default {
return {
searchFrom: {
inspectionType: "", // 巡检类型
iSynchronization: "", // 同部数据
synchronization: "", // 同部数据
isException: "", // 有无异常
inspectionTime: "", // 时间选择
},
inspectArr: [
// { value: 0, text: "全部巡检" },
{ value: "", text: "全部" },
{ value: 1, text: "机房巡检" },
{ value: 2, text: "井道巡检" },
],
synchronization: [
{ value: 0, text: "未同步" },
{ value: 1, text: "已同步" },
{ value: "", text: "全部" },
{ value: "0", text: "未同步" },
{ value: "1", text: "已同步" },
],
exceptionArr: [
{ value: 0, text: "有无异常" },
{ value: "", text: "全部" },
{ value: 1, text: "有异常" },
{ value: 2, text: "无异常" },
],
......@@ -81,7 +87,6 @@ export default {
.search-com-left {
display: flex;
align-items: center;
border: 1px solid;
flex: 1;
.uni-search-item {
margin-right: 12px;
......@@ -95,7 +100,6 @@ export default {
width: 300px;
.uni-datetime-picker {
background: #fff;
border: 1px solid;
}
}
}
......
......@@ -211,14 +211,14 @@ export default {
const {
isException = "",
inspectionType = "",
iSynchronization = "",
synchronization = "",
} = this.searchForm;
return arr.filter((item) => {
return (
(!isException || item.isException == isException) &&
(!inspectionType || item.inspectionType == inspectionType) &&
(!iSynchronization || item.iSynchronization == iSynchronization)
(!synchronization || item.synchronization == synchronization)
);
});
},
......
<template>
<view class="operLog">
<!-- <uni-nav-bar
dark
:fixed="true"
background-color="#5474e8"
status-bar
left-icon="left"
left-text="返回"
@clickLeft="back"
title="杭州内网监管在线"
>
</uni-nav-bar> -->
<uni-nav-bar
:fixed="true"
background-color="rgba(214, 240, 255, 0.0)"
......@@ -38,7 +26,7 @@
v-model="searchFrom.type"
:localdata="typeList"
@change="change"
placeholder="全部巡检"
placeholder="全部"
></uni-data-select>
<view class="search-com-right">
......@@ -87,6 +75,7 @@
<script>
import timeSelect from "@/components/global/timeSelect.vue";
import { getLogList } from "@/request/index.js";
import { LOG_TYPE_ENUM } from "@/utils/IoReadingAndWriting.js";
export default {
components: {
timeSelect,
......@@ -94,14 +83,8 @@ export default {
data() {
return {
searchFrom: {
type: "",
type: -1,
},
inspectArr: [
// { value: 0, text: "全部巡检" },
{ value: 1, text: "机房巡检" },
{ value: 2, text: "井道巡检" },
],
searchVal: "",
allData: [],
tableData: [],
......@@ -113,11 +96,13 @@ export default {
total: 0,
loading: false,
typeList: [
{ value: "", text: "全部" },
{ value: 1, text: "机房巡检" },
{ value: 2, text: "井道巡检" },
{
text: "其他",
value: "其他",
value: "-1",
},
],
searchForm: {
......@@ -184,7 +169,11 @@ export default {
let matchType = true; // 类型筛选
let matchTime = true; // 时间筛选
if (type) {
matchType = item.module == type || item.type == type;
if (type == -1) {
matchType = Object.values(LOG_TYPE_ENUM).indexOf(item.type) > -1;
} else {
matchType = item.inspectionType == type || item.inspectionType == type;
}
}
if (startTime && endTime) {
......@@ -225,7 +214,6 @@ export default {
.search-com-left {
display: flex;
align-items: center;
border: 1px solid;
.uni-search-item {
margin-right: 12px;
width: 200px;
......@@ -238,7 +226,6 @@ export default {
width: 300px;
.uni-datetime-picker {
background: #fff;
border: 1px solid;
}
}
}
......
......@@ -315,6 +315,7 @@ export default {
`${detailsInfo.recordName}(${detailsInfo.inspectionCode})`,
"巡检模块"
);
logContent.inspectionType = detailsInfo.inspectionType
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
......@@ -402,7 +403,7 @@ export default {
const isException = items.filter((item) => item.inspectionResult > 0)
.length
? 1
: 0;
: 2;
return {
...temp,
......@@ -447,6 +448,7 @@ export default {
`${params.recordName}(${params.inspectionCode})`,
"巡检模块"
);
} else {
params.uid = new Date().getTime(); // 唯一标识 pad 端使用
all_data.push(params);
......@@ -463,6 +465,8 @@ export default {
// 更新日志
const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
......@@ -553,6 +557,8 @@ export default {
`${params.recordName}(${params.inspectionCode})`,
"巡检模块"
);
logContent.inspectionType = params.inspectionType
const log_list = this.$store.state.log_list;
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
......
......@@ -137,14 +137,15 @@ export default {
const {
isException = "",
inspectionType = "",
iSynchronization = "",
synchronization = "",
} = this.searchForm;
return arr.filter((item) => {
return (
(!isException || item.isException == isException) &&
(!inspectionType || item.inspectionType == inspectionType) &&
(!iSynchronization || item.iSynchronization == iSynchronization)
(!synchronization || item.synchronization == synchronization)
);
});
},
......
......@@ -219,14 +219,41 @@ export default {
uni.redirectTo({
url: "/pages/home/home?tabIndex=1",
success: () => {
const all_data = this.$store.state.all_data;
const detailsInfo = this.detailsInfo;
const tempAllData = all_data.filter(
(element) => element.uid != detailsInfo.uid
);
// 更新巡检list
this.$store.commit("SET_ALL_DATA", tempAllData);
writeInspectionData(tempAllData);
// 清空草稿数据
this.$store.commit("SET_DARF_DATA", {}); // 缓存[巡检信息]
writeDarf("").then((res) => {
console.log("写入草稿文件成功");
});
// 清空基础缓存信息
this.$store.commit("SET_TEMP_DATA", {}); // 缓存[巡检信息]
// 更新日志
const log_list = this.$store.state.log_list;
const logContent = getLogContent(
LOG_TYPE_ENUM.delete,
`${detailsInfo.recordName}(${detailsInfo.inspectionCode})`,
"巡检模块"
);
logContent.inspectionType = detailsInfo.inspectionType;
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => {
console.log("日志文件写入成功");
});
uni.showToast({
icon: `success`,
title: `删除成功`,
});
},
});
},
......@@ -274,7 +301,7 @@ export default {
(item) => item.inspectionResult > 0
).length
? 1
: 0;
: 2;
return {
...baseInfo,
......@@ -291,7 +318,7 @@ export default {
...temp[0],
isSubmit: 0,
isException: temp.filter((item) => item.isException > 0).length ? 1 : 0, // 总的数据
isException: temp.filter((item) => item.isException > 0).length ? 1 : 2, // 总的数据
items: [],
synchronization: 0, // 是否导出过
submitTime: moment().format("yyyy-MM-DD"), // 记录提交时间
......@@ -350,6 +377,7 @@ export default {
// 更新日志
const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType;
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => {
......@@ -418,6 +446,8 @@ export default {
);
const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType;
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => {
......
......@@ -5,7 +5,7 @@
<text class="title">待打包数据</text>
</view>
<view class="row-item count-num">
<text class="num">{{ all_data.length }}</text>
<text class="num">{{ notSynchronizationList.length }}</text>
<text></text>
</view>
......@@ -55,18 +55,25 @@ import {
LOG_TYPE_ENUM,
} from "@/utils/IoReadingAndWriting.js";
import moment from "moment";
import { getAllInspections } from "@/request/index.js";
export default {
components: {},
data() {
return {
loading: false,
all_data: [],
notSynchronizationList: [], // 未同步数据
allList: [], // 所有数据
};
},
mounted() {
this.all_data = (this.$store.state.all_data || []).filter(item =>item.synchronization ==0);
getAllInspections().then((res) => {
this.allList = res;
this.notSynchronizationList = (res || []).filter(
(item) => item.synchronization == 0
);
});
},
methods: {
change(e) {},
......@@ -108,15 +115,16 @@ export default {
// 处理数据
coverData() {
const userName = this.$store.state.now_user.name;
const all_data = this.all_data;
const notSynchronizationList = this.notSynchronizationList;
const allList = this.allList;
console.log("-同步数据--", all_data);
// 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`;
const JFXJ_DATA = all_data
const JFXJ_DATA = notSynchronizationList
.filter((item) => item.inspectionType == 1)
.map((item) => {
return {
......@@ -124,15 +132,33 @@ export default {
originData: [],
};
}); // 机房数据类型是 1
const JDXJ_DATA = all_data.filter((item) => item.inspectionType == 2); // 井道数据类型是 2
const JDXJ_DATA = notSynchronizationList.filter(
(item) => item.inspectionType == 2
); // 井道数据类型是 2
this.loading = true;
Promise.all([
this.packedData(JFXJ_DATA, JFXJ_DATA_FILE_NAME),
this.packedData(JDXJ_DATA, JDXJ_DATA_FILE_NAME),
])
.then(() => {
writeInspectionData(all_data)
// 更新巡检数据状态
const synchronizationUids = notSynchronizationList.map((item) => {
return item.uid;
});
allList.forEach((item) => {
if (synchronizationUids.includes(item.uid)) {
item.synchronization = 1;
}
});
this.$store.commit("SET_ALL_DATA", allList);
writeInspectionData(allList)
.then(() => {
setTimeout(() => {
uni.showToast({
......@@ -144,13 +170,6 @@ export default {
this.close();
this.loading = false;
// 更新巡检数据状态
const newAllData = all_data.map((item) => {
item.synchronization = 1;
return item;
});
this.$store.commit("SET_ALL_DATA", newAllData);
// 生成日志
const logContent = getLogContent(
LOG_TYPE_ENUM.sys,
......
......@@ -75,28 +75,33 @@ export default {
};
},
mounted() {
uni.showLoading();
getAllInspections()
.then((res) => {
this.all_data = res;
this.init();
uni.hideLoading();
})
.catch((error) => {
if (0 == error.code) {
uni.showToast({
title: error.msg,
icon: "none",
duration: 1000,
});
}
this.all_data = [];
uni.hideLoading();
});
this.init();
},
methods: {
init() {
uni.showLoading();
getAllInspections()
.then((res) => {
this.all_data = res;
this.getList();
uni.hideLoading();
})
.catch((error) => {
if (0 == error.code) {
uni.showToast({
title: error.msg,
icon: "none",
duration: 1000,
});
}
this.all_data = [];
uni.hideLoading();
});
},
getList() {
const all_data = this.all_data || [];
this.isPackedDataBtn =
all_data.filter((item) => item.synchronization == 0).length > 0;
......@@ -151,14 +156,14 @@ export default {
const {
isException = "",
inspectionType = "",
iSynchronization = "",
synchronization = "",
} = this.searchForm;
return arr.filter((item) => {
return (
(!isException || item.isException == isException) &&
(!inspectionType || item.inspectionType == inspectionType) &&
(!iSynchronization || item.iSynchronization == iSynchronization)
(!synchronization || item.synchronization == synchronization)
);
});
},
......@@ -166,7 +171,7 @@ export default {
console.log("----", e);
this.searchForm = e;
this.init();
this.getList();
},
openDialog(show) {
this.isDialog = show;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论