提交 fb35d0e1 authored 作者: caodi\cd's avatar caodi\cd

fix:巡检管理

上级 9b32c3a6
...@@ -45,7 +45,7 @@ uni-page-head .uni-btn-icon { ...@@ -45,7 +45,7 @@ uni-page-head .uni-btn-icon {
} }
.uni-navbar__header { .uni-navbar__header {
padding: 0 24px !important; padding: 0 32px !important;
/* padding-right: 18px !important; */ /* padding-right: 18px !important; */
} }
......
<template> <template>
<view class="inspect-item" @click="toPage"> <view class="inspect-item" @click="toPage">
<view <view class="content" :class="details.synchronization == 1 ? 'synchronization' : ''">
class="content" <view class="name">{{
:class="details.synchronization == 1 ? 'synchronization' : ''" details.synchronization == 0 ? "待同步" : "已同步"
> }}</view>
<view class="name">{{ getLabel(details.inspectionType) }}</view> <view class="info">
<view class="info"> <view class="info-row">
<view class="info-row"> <text class="title">{{ getLabel(details.inspectionType) }}</text>
<text class="title">{{ details.recordName }}</text> <text class="status">{{
<text class="status">{{
details.synchronization == 0 ? "待同步" : "已同步" details.synchronization == 0 ? "待同步" : "已同步"
}}</text> }}</text>
<view v-if="details.isException == 1" class="status alarm"> <view v-if="details.isException == 1" class="status alarm">
<text class="iconfont icon-yichang1"></text> <text class="iconfont icon-yichang1"></text>
<text>有异常</text></view <text>有异常</text>
> </view>
</view> </view>
<view class="info-row info-row-code"> <view class="info-row info-row-code">
<text>编号:</text> <text>巡检人:</text>
<text class="code-num">{{ details.inspectionCode }}</text> <text class="code-num">admin</text>
</view> <text>编号:</text>
</view> <text class="code-num">{{ details.inspectionCode }}</text>
<view class="img"> <text>巡检日期:</text>
<image <text class="code-num">2025-01-29</text>
v-if="details.synchronization == 1" </view>
class="bg-img" </view>
src="../../static/img/add-img/default.png" <view class="img">
></image> <image v-if="details.synchronization == 1" class="bg-img" src="../../static/img/add-img/default.png"></image>
<image <!-- <image v-else class="bg-img" src="../../static/img/add-img/active.png"></image> -->
v-else </view>
class="bg-img" </view>
src="../../static/img/add-img/active.png" </view>
></image>
</view>
</view>
</view>
</template> </template>
<script> <script>
import { pad_inspection_type } from "@/utils/dict.js"; import {
pad_inspection_type
export default { } from "@/utils/dict.js";
props: {
details: { export default {
type: Object, props: {
}, details: {
isDisable: { type: Object,
type: Boolean, },
}, isDisable: {
}, type: Boolean,
methods: { },
getLabel(val) { },
const temp = methods: {
( getLabel(val) {
pad_inspection_type.rows.filter((item) => item.dictValue == val)[0] || const temp =
{} (
).dictLabel || ""; pad_inspection_type.rows.filter((item) => item.dictValue == val)[0] || {}
return temp.length ? temp.slice(0, 2) : ""; ).dictLabel || "";
}, return temp.length ? temp : "";
toPage() { },
const url = toPage() {
this.details.inspectionType == 1 const url =
? `/pages/inspectionContent/inspectionContent?isDisable=${ this.details.inspectionType == 1 ?
`/pages/inspectionContent/inspectionContent?isDisable=${
this.isDisable ? 1 : 0 this.isDisable ? 1 : 0
}` }` :
: `/pages/shaftInspection/shaftInspectionNew?isDisable=${ `/pages/shaftInspection/shaftInspectionNew?isDisable=${
this.isDisable ? 1 : 0 this.isDisable ? 1 : 0
}`; }`;
uni.navigateTo({ uni.navigateTo({
url: `${url}&uid=${this.details.uid}`, url: `${url}&uid=${this.details.uid}`,
}); });
}, },
}, },
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.inspect-item { .inspect-item {
width: 50%; width: calc(50% - 8px);
padding-right: 16px; margin-bottom: 16px;
margin-bottom: 16px;
.content { .content {
background: #fff; background: #fff;
border: 0.4px solid rgba(224, 224, 224, 1); border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 12px; border-radius: 12px;
padding: 18px 16px 14px 10px; padding: 12px;
display: flex; display: flex;
align-items: center; align-items: center;
height: 84px; height: 78px;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
background-image: linear-gradient(-67deg, #ffab2423, #ffab2411 50%);
.name { .name {
background: #ffab2423; background: #ffab2423;
border-radius: 12px; border-radius: 12px;
width: 54px; width: 54px;
height: 54px; height: 54px;
margin-right: 10px; margin-right: 10px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
color: #f39800; color: #f39800;
} }
.info {
.info-row { .info {
display: flex; .info-row {
align-items: center; display: flex;
margin-bottom: 8px; align-items: center;
&:last-of-type { margin-bottom: 8px;
margin: 0;
} &:last-of-type {
.title { margin: 0;
font-size: 12px; }
color: #000000;
font-weight: bold; .title {
margin-right: 8px; font-size: 12px;
} color: #000000;
.status { font-weight: bold;
padding: 2px 4px; margin-right: 8px;
font-size: 12px; }
color: #ffffff;
text-align: center; .status {
line-height: 20px; padding: 2px 4px;
font-weight: 400; font-size: 12px;
background: #ffab24; color: #ffffff;
border-radius: 3px; text-align: center;
} line-height: 20px;
.alarm { font-weight: 400;
margin-left: 8px; background: #ffab24;
background: rgba(255, 105, 82, 0.1); border-radius: 3px;
font-size: 12px; }
color: #ff6952;
text-align: center; .alarm {
line-height: 20px; margin-left: 8px;
font-weight: 400; background: rgba(255, 105, 82, 0.1);
} font-size: 12px;
} color: #ff6952;
.info-row-code { text-align: center;
font-size: 14px; line-height: 20px;
color: #7c7c7c; font-weight: 400;
font-weight: 400; }
.code-num { }
font-size: 14px;
color: #000000; .info-row-code {
font-weight: 400; font-size: 12px;
} color: #7c7c7c;
} font-weight: 400;
}
.code-num {
.img { font-size: 12px;
position: absolute; color: #000000;
right: 0; font-weight: 400;
top: 50%; margin-right: 10px;
transform: translateY(-50%); &:last-child{
.bg-img { margin-right: 0;
width: 80px; }
height: 80px; }
} }
} }
}
.img {
.synchronization { position: absolute;
background-image: linear-gradient(-67deg, #9c9c9c16, #9c9c9c09 50%); right: 0;
.name { top: 50%;
background: #9c9c9c16; transform: translateY(-50%);
border-radius: 12px;
color: #4a4a4a; .bg-img {
} width: 80px;
.status { height: 80px;
background: #9c9c9c16 !important; }
color: #4a4a4a !important; }
} }
}
} .synchronization {
</style> background-image: linear-gradient(-67deg, #9c9c9c16, #9c9c9c09 50%);
.name {
background: #9c9c9c16;
border-radius: 12px;
color: #4a4a4a;
}
.status {
background: #9c9c9c16 !important;
color: #4a4a4a !important;
}
}
}
</style>
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
v-model="searchFrom.inspectionType" v-model="searchFrom.inspectionType"
:localdata="inspectArr" :localdata="inspectArr"
@change="(e) => change(e, 'inspectionType')" @change="(e) => change(e, 'inspectionType')"
placeholder="巡检类型:全部" placeholder="类型"
:clear="true" :clear="true"
:key="new Date().getTime()" :key="new Date().getTime()"
></uni-data-select> ></uni-data-select>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
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"
:key="new Date().getTime()" :key="new Date().getTime()"
...@@ -29,14 +29,24 @@ ...@@ -29,14 +29,24 @@
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"
:key="new Date().getTime()" :key="new Date().getTime()"
></uni-data-select> ></uni-data-select>
<uni-data-select
v-if="!hiddenSearch.includes('inspectionTime')"
class="uni-search-item"
v-model="searchFrom.inspectionTime"
:localdata="dateArr"
placeholder="选择时间"
@change="(e) => change(e, 'inspectionTime')"
:clear="true"
:key="new Date().getTime()"
></uni-data-select>
</view> </view>
<view <!-- <view
class="search-com-right" class="search-com-right"
v-if="!hiddenSearch.includes('inspectionTime')" v-if="!hiddenSearch.includes('inspectionTime')"
> >
...@@ -47,7 +57,7 @@ ...@@ -47,7 +57,7 @@
:border="false" :border="false"
@change="(e) => change(e, 'inspectionTime')" @change="(e) => change(e, 'inspectionTime')"
/> />
</view> </view> -->
</view> </view>
</template> </template>
<script> <script>
...@@ -82,8 +92,14 @@ export default { ...@@ -82,8 +92,14 @@ export default {
], ],
exceptionArr: [ exceptionArr: [
{ value: "all", text: "全部" }, { value: "all", text: "全部" },
{ value: "1", text: "有异常" }, { value: "1", text: "有" },
{ value: "0", text: "无异常" }, { value: "0", text: "无" },
],
dateArr: [
{ value: "0", text: "本月" },
{ value: "1", text: "本季" },
{ value: "2", text: "本年" },
{ value: "3", text: "自定义" },
], ],
}; };
}, },
...@@ -101,13 +117,13 @@ export default { ...@@ -101,13 +117,13 @@ export default {
.search-com { .search-com {
display: flex; display: flex;
align-items: center; align-items: center;
width: 50%;
.search-com-left { .search-com-left {
display: flex; display: flex;
align-items: center; align-items: center;
flex: 1; flex: 1;
.uni-search-item { .uni-search-item {
margin-right: 12px; margin-right: 12px;
width: 130px;
background: #fff; background: #fff;
border-radius: 4px; border-radius: 4px;
border: none !important; border: none !important;
......
...@@ -48,6 +48,12 @@ ...@@ -48,6 +48,12 @@
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, },
// 新增配置---------
// 巡检管理
{
"path": "pages/inspectionManagement/index"
},
// 井道巡检新页面 // 井道巡检新页面
{ {
"path": "pages/shaftInspection/shaftInspectionNew", "path": "pages/shaftInspection/shaftInspectionNew",
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<view class="username">{{ userName }}</view> <view class="username">{{ userName }}</view>
</view> </view>
<view class="profile-right"> <view class="profile-right">
<button class="inspection-button">巡检管理</button> <button class="inspection-button" @click="toInspectionManagement">巡检管理</button>
<button class="record-button">上架记录</button> <button class="record-button">上架记录</button>
</view> </view>
</view> </view>
...@@ -87,6 +87,13 @@ ...@@ -87,6 +87,13 @@
url: "/pages/index/operLog", url: "/pages/index/operLog",
}); });
}, },
// 巡检管理
toInspectionManagement() {
console.log(1111)
uni.navigateTo({
url: "/pages/inspectionManagement/index",
});
},
// 井道巡检 // 井道巡检
toShaftInspection() { toShaftInspection() {
uni.navigateTo({ uni.navigateTo({
......
<template> <template>
<view class="inspection-management"> <view class="inspection-management">
<!-- 搜索项 --> <uni-nav-bar :fixed="true" background-color="rgba(214, 240, 255, 0.0)" status-bar rightWidth="300">
<SearchCom @change="change" /> <block slot="left">
<view class="uni-nav-bar-text" @click="back">
<!-- 结果 --> <text class="iconfont icon-Arrow-Left"></text>
<view class="inspection-management-content"> </view>
<view class="count-tatal"> </block>
<text class="num">{{ countNum || 0 }}</text> <block slot="right" class="nav-right">
<text>查询结果</text> <view class="header-buttons">
</view> <button class="button" @click="lookLog">机房巡检</button>
<button class="button" @click="lookLog">井道巡检</button>
<view class="month-list"> </view>
<!-- 每月记录 --> </block>
<view </uni-nav-bar>
class="month-record-item" <!-- 搜索项 -->
v-for="(item, index) in list" <SearchCom @change="change" />
:key="index"
> <!-- 结果 -->
<view v-if="(item.list || []).length" class="seconed-title"> <view class="inspection-management-content">
{{ item.submitTime || item.time}} <view class="count-tatal">
</view> <text class="num">{{ countNum || 0 }}</text>
<text calss="">查询结果</text>
<view class="inspect-list"> </view>
<InspectionItem
v-for="ele in item.list" <view class="month-list">
:key="ele.uid" <!-- 每月记录 -->
:details="ele" <view class="month-record-item" v-for="(item, index) in list" :key="index">
/> <view v-if="(item.list || []).length" class="seconed-title">
</view> {{ item.submitTime || item.time}}
</view> </view>
<Empty v-if="list.length == 0" /> <view class="inspect-list">
</view> <InspectionItem v-for="ele in item.list" :key="ele.uid" :details="ele" />
</view> </view>
</view>
<!-- 开始巡检 -->
<view class="inspection-button" @click="toPage" <Empty v-if="list.length == 0" />
>开始巡检</view </view>
> </view>
</view>
<!-- 开始巡检 -->
<view class="inspection-button" @click="toPage">同步数据</view>
</view>
</template> </template>
<script> <script>
import SearchCom from "@/components/searchCom/index.vue"; import SearchCom from "@/components/searchCom/index.vue";
import InspectionItem from "@/components/inspectionItem/index.vue"; import InspectionItem from "@/components/inspectionItem/index.vue";
import { getDarft } from "@/request/index.js"; import {
import { getAllInspections } from "@/request/index.js"; getDarft
import Empty from "@/components/empty/index.vue"; } from "@/request/index.js";
import {
export default { getAllInspections
components: { } from "@/request/index.js";
SearchCom, import Empty from "@/components/empty/index.vue";
InspectionItem,
Empty, export default {
}, components: {
data() { SearchCom,
return { InspectionItem,
isDialog: false, // Empty,
list: [], // 展示数据 },
all_data: [], // 所有数据 data() {
searchForm: { return {
// 搜索条件 isDialog: false, //
}, list: [], // 展示数据
countNum: 0, // 统计查询总数 all_data: [], // 所有数据
}; searchForm: {
}, // 搜索条件
mounted() { },
uni.showLoading(); countNum: 0, // 统计查询总数
};
getAllInspections() },
.then((res) => { mounted() {
this.all_data = res; uni.showLoading();
this.init();
uni.hideLoading(); getAllInspections()
}) .then((res) => {
.catch((error) => { this.all_data = res;
if (0 == error.code) { this.init();
uni.showToast({ uni.hideLoading();
title: error.msg, })
icon: "none", .catch((error) => {
duration: 1000, if (0 == error.code) {
}); uni.showToast({
} title: error.msg,
this.all_data = []; icon: "none",
uni.hideLoading(); duration: 1000,
}); });
}, }
computed: { this.all_data = [];
userInfo() { uni.hideLoading();
return this.$store.state.now_user || {}; });
}, },
computed: {
}, userInfo() {
methods: { return this.$store.state.now_user || {};
init() { },
const all_data = this.all_data || [];
},
const { inspectionTime = [] } = this.searchForm; methods: {
const startTime = inspectionTime[0]; // 返回
const endTime = inspectionTime[1]; back() {
uni.navigateBack();
// 第一步: 筛选有效的时间范围 },
const timeFrame = all_data.filter((item) => { init() {
if (!inspectionTime.length) { const all_data = this.all_data || [];
return true;
} else { const {
return ( inspectionTime = []
new Date(startTime).getTime() <= new Date(item.submitTime).getTime() && } = this.searchForm;
new Date(item.submitTime).getTime() <= new Date(endTime).getTime() const startTime = inspectionTime[0];
); const endTime = inspectionTime[1];
}
}); // 第一步: 筛选有效的时间范围
const timeFrame = all_data.filter((item) => {
if (!inspectionTime.length) {
// 属于同一个月的数据 聚合 return true;
const tempAllData = {}; } else {
timeFrame.forEach((item) => { return (
const val = tempAllData[item.submitMonth] || []; new Date(startTime).getTime() <= new Date(item.submitTime).getTime() &&
if (val.length) { new Date(item.submitTime).getTime() <= new Date(endTime).getTime()
tempAllData[item.submitMonth].push(item); );
} else { }
tempAllData[item.submitMonth] = [item]; });
}
});
const keys = Object.keys(tempAllData); // 属于同一个月的数据 聚合
const tempAllData = {};
// 第二步: 根据搜索条件过滤 timeFrame.forEach((item) => {
const list = keys.map((key) => { const val = tempAllData[item.submitMonth] || [];
return { if (val.length) {
time: key, tempAllData[item.submitMonth].push(item);
list: this.coverData(tempAllData[key]), } else {
}; tempAllData[item.submitMonth] = [item];
}); }
});
this.countNum = 0; const keys = Object.keys(tempAllData);
list.forEach((item) => {
this.countNum += item.list.length; // 第二步: 根据搜索条件过滤
}); const list = keys.map((key) => {
return {
this.list = list; time: key,
}, list: this.coverData(tempAllData[key]),
};
coverData(arr = []) { });
const {
isException = "", this.countNum = 0;
inspectionType = "", list.forEach((item) => {
synchronization = "", this.countNum += item.list.length;
} = this.searchForm; });
this.list = list;
},
return arr.filter((item) => {
return ( coverData(arr = []) {
( !isException || isException =="all" || item.isException == isException) && const {
( !inspectionType || inspectionType =="all" || item.inspectionType == inspectionType) && isException = "",
( !synchronization || synchronization =="all" || item.synchronization == synchronization) inspectionType = "",
); synchronization = "",
}); } = this.searchForm;
},
change(e) {
this.searchForm = e;
return arr.filter((item) => {
this.init(); return (
}, (!isException || isException == "all" || item.isException == isException) &&
(!inspectionType || inspectionType == "all" || item.inspectionType == inspectionType) &&
toPage() { (!synchronization || synchronization == "all" || item.synchronization == synchronization)
uni.showLoading(); );
});
getDarft() },
.then((res) => { change(e) {
const darf_data = res || {}; this.searchForm = e;
if (darf_data.inspectionType == 1) { this.init();
uni.navigateTo({ },
url: `/pages/inspectionContent/inspectionContent?isDarf=1`,
}); toPage() {
} else if (darf_data.inspectionType == 2) { uni.showLoading();
uni.navigateTo({
url: `/pages/shaftInspection/shaftInspection?isDarf=1`, getDarft()
}); .then((res) => {
} else { const darf_data = res || {};
uni.navigateTo({
url: "/pages/inspection/inspFirst", if (darf_data.inspectionType == 1) {
}); uni.navigateTo({
} url: `/pages/inspectionContent/inspectionContent?isDarf=1`,
uni.hideLoading(); });
}) } else if (darf_data.inspectionType == 2) {
.catch((error) => { uni.navigateTo({
if (error.code == 0) { url: `/pages/shaftInspection/shaftInspection?isDarf=1`,
uni.showToast({ });
title: error.msg, } else {
uni.navigateTo({
icon: "none", url: "/pages/inspection/inspFirst",
duration: 1000, });
}); }
} uni.hideLoading();
uni.navigateTo({ })
url: "/pages/inspection/inspFirst", .catch((error) => {
}); if (error.code == 0) {
uni.showToast({
uni.hideLoading(); title: error.msg,
});
}, icon: "none",
}, duration: 1000,
}; });
}
uni.navigateTo({
url: "/pages/inspection/inspFirst",
});
uni.hideLoading();
});
},
},
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.inspection-management { /* 导航栏样式 */
padding-top: 16px; .uni-nav-bar-text {
.count-tatal { height: 36px;
margin: 16px 0 8px 0; width: 36px;
font-size: 14px; background: #ffffff;
color: #4a4a4a; border: 0.4px solid rgba(224, 224, 224, 1);
font-weight: 400; border-radius: 18px;
.num { border-radius: 50%;
font-size: 18px; color: #333;
color: #3774f6; text-align: center;
line-height: 26px;
font-weight: 600; .iconfont {
margin-right: 5px; font-size: 20px;
} line-height: 36px;
} }
.inspection-management-content { }
.month-list {
height: calc(100vh - 26px - 16px - 8px - 36px - 62px); .nav-right {
overflow: auto; width: 240px;
padding-bottom: 140px; }
.seconed-title {
margin-top: 16px; .header-buttons {
font-size: 18px; display: flex;
color: #000000; align-items: center;
font-weight: bold; margin-left: auto; // 将按钮组推到最右侧
}
.month-record-item { .button {
margin-bottom: 24px; width: 112px;
&:last-of-type { height: 36px;
margin: 0; background: #FFFFFF;
} border-radius: 18px;
margin-left: 16px;
.inspect-list { font-family: PingFangSC-Regular;
display: flex; font-size: 16px;
flex-wrap: wrap; color: #000000;
} line-height: 36px;
} font-weight: 400;
} }
} }
.inspection-button { .inspection-management {
display: flex; background-image: linear-gradient(115deg, #E8F0FB 0%, #E1EBFA 100%);
align-items: center; padding: 0 32px;
justify-content: center;
position: fixed;
bottom: 60px; .inspection-management-content {
width: 240px; .count-tatal {
height: 48px; font-family: PingFangSC-Medium;
left: 50%; margin: 16px 0px 24px;
color: #fff; font-size: 14px;
transform: translateX(-50%); color: #4a4a4a;
background-image: linear-gradient(180deg, #3773f6 0%, #2c57f6 99%); font-weight: 400;
box-shadow: 0px 10px 24px 0px rgba(51, 104, 246, 0.24); height: 28px;
border-radius: 27px; line-height: 28px;
}
} .num {
</style> font-size: 20px;
color: #3774f6;
line-height: 28px;
font-weight: 500;
margin-right: 2px;
}
}
.month-list {
height: calc(100vh - 26px - 16px - 8px - 36px - 62px);
overflow: auto;
padding-bottom: 140px;
.seconed-title {
font-size: 20px;
color: #000000;
line-height: 28px;
font-weight: 500;
margin-bottom: 12px;
}
.month-record-item {
margin-bottom: 24px;
&:last-of-type {
margin: 0;
}
.inspect-list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
}
}
}
.inspection-button {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 60px;
width: 240px;
height: 48px;
left: 50%;
color: #fff;
transform: translateX(-50%);
background-image: linear-gradient(180deg, #3773f6 0%, #2c57f6 99%);
box-shadow: 0px 10px 24px 0px rgba(51, 104, 246, 0.24);
border-radius: 27px;
}
}
</style>
\ No newline at end of file
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
/* #endif */ /* #endif */
flex-wrap: nowrap; flex-wrap: nowrap;
flex-direction: row; flex-direction: row;
width: 120rpx; width: auto;
// padding: 0 6px; // padding: 0 6px;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论