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

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

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