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

fix:机房事项

上级 72c8969d
<template>
<!-- 机房巡检操作 -->
<view>
<view v-for="(item, index) in itemData.detail" :key="index">
<template
v-if="!(index > 2 && itemData.detail[2].inspectionResult === 1)"
>
<view class="form-item">
<text class="form-label"
><text class="required">*</text>{{ item.label }}</text
>
<view class="switch-container">
<view
:class="['status-btn', { active: item.inspectionResult === 0 }]"
@click="setInspectionResult(index, 0, item.lableArr[0])"
>
{{ item.lableArr[0] }}
</view>
<view
:class="['status-btn', { active: item.inspectionResult === 1 }]"
@click="setInspectionResult(index, 1, item.lableArr[1])"
>
{{ item.lableArr[1] }}
</view>
</view>
</view>
<view v-if="'conclusion' in item" class="form-item">
<text class="form-label"
><text class="required">*</text>情况摘要</text
>
<text class="conclusion" @click="showPopup(index)">{{
item.conclusion || "请输入情况摘要"
}}</text>
</view>
<view class="form-item" v-if="'photos' in item">
<text class="form-label"
><text class="required">*</text>现场照片</text
>
<view class="photo-box">
<view class="photo-container">
<view @click="takePhoto(index)" class="photo-btn"> + </view>
<view
v-for="(photo, itemIndex) in item && item.photos"
:key="itemIndex"
class="photo-item"
>
<image :src="photo" class="photo"></image>
<text
class="delete-photo"
@click="deletePhoto(index, itemIndex)"
>×</text
>
</view>
</view>
<view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
>
</view>
</view></template
> </view
><custom-popup
ref="customPopup"
:inspectionItem="inspectionItem"
@confirm="handlePopupConfirm"
></custom-popup>
</view>
</template>
<script>
import customPopup from "./customPopup.vue";
import _ from "lodash";
export default {
components: {
customPopup,
},
props: {
// 父组件传递的巡检状态
status: {
type: Number,
default: 0,
},
// 父组件传递的巡检事项名
inspectionItem: {
type: String,
default: "",
},
// 父组件传递的数据
defaultData: {
type: Object,
default: {},
},
},
data() {
return {
currentIndex: 0, // 当前操作的索引
photos: [],
itemData: {
isValid: false, // false是校验未通过 true是校验通过
// status: 0, 0是未巡检 1是已巡检 2巡检异常 statusLabel: "未巡检",
inspectionItem: "", //巡检事项
detail: [
{
label: "门禁功能",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
{
label: "门禁外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "是否有监控",
inspectionResult: 0,
inspectionResultLable: "有监控",
lableArr: ["有监控", "无监控"],
},
{
label: "监控外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "监控画面清晰",
inspectionResult: 0,
inspectionResultLable: "清晰",
lableArr: ["清晰", "模糊"],
conclusion: "",
photos: [],
},
{
label: "监控存储连续",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
],
},
};
},
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
},
mounted() {
if (Object.keys(this.defaultData).length !== 0) {
this.itemData = this.defaultData;
}
},
methods: {
// 拍照
takePhoto(index) {
uni.chooseImage({
count: 1,
sourceType: ["camera"], // 可以从相机拍摄
success: async (res) => {
if (this.photos.length < 5) {
const base64 = await this.convertFileToBase64(res.tempFilePaths[0]);
this.itemData.detail[index].photos.push(base64);
} else {
uni.showToast({
title: "最多只能上传5张照片",
icon: "none",
});
}
},
});
},
// 转化为base64
convertFileToBase64(filePath) {
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
filePath,
function (entry) {
entry.file(
function (file) {
const reader = new plus.io.FileReader();
reader.onloadend = function (evt) {
const base64 = evt.target.result; // 获取 Base64 数据
resolve(base64); // 返回 Base64 数据
};
reader.readAsDataURL(file); // 读取文件并转换为 Base64
},
function (error) {
reject("获取文件对象失败:" + error.message);
}
);
},
function (error) {
reject("解析文件路径失败:" + error.message);
}
);
});
},
// 删除照片
deletePhoto(index, itemIndex) {
this.itemData.detail[index].photos.splice(itemIndex, 1);
},
// 设置巡检结论
setInspectionResult(index, value, label) {
this.itemData.detail[index].inspectionResult = value; // 0正常 1异常
this.itemData.detail[index].inspectionResultLable = label;
},
// 显示弹窗
showPopup(index) {
this.currentIndex = index;
this.$refs.customPopup.open();
},
// 处理弹窗确认
handlePopupConfirm(summary) {
this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域
},
// 处理】数据
getFromData() {
console.log(111, this.itemData);
const isValid = this.areAllObjectsValid(this.itemData.detail,2); //false不通过 true通过
// const isAllOne = this.areAllInspectionResultsOne(this.itemData.detail);
this.itemData.isValid = isValid;
this.itemData.inspectionItem = this.inspectionItem;
console.log(222, this.itemData);
// if (isAllOne) {
// // 全都是正常
// this.itemData.status = 1; //1表示已经巡检过没有异常
// this.itemData.statusLabel = "已巡检";
// } else {
// this.itemData.status = 2; //1表示已经巡检过有异常
// this.itemData.statusLabel = "巡检异常";
// }
// console.log(this.itemData);
return this.itemData;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid(arr, skipIndex) {
// 遍历数组中的每个对象
for (let i = 0; i < arr.length; i++) {
const obj = arr[i];
// 如果当前索引大于等于 skipIndex,并且 inspectionResult 为 1,则跳过后续校验
if (i >= skipIndex && obj.inspectionResult === 1) {
break;
}
// 检查对象中的每个属性是否有值
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
// 如果属性值为空(null, undefined, 空字符串等),则校验不通过
if (
obj[key] === null ||
obj[key] === undefined ||
obj[key] === ""
) {
return false;
}
}
}
}
// 如果所有对象都通过校验,返回 true
return true;
},
// 校验是否有异常
areAllInspectionResultsOne(arr) {
return arr.every((obj) => obj.inspectionResult === 0);
},
},
};
</script>
<style scoped lang="less">
.form-item {
display: flex;
align-items: center;
padding: 9.6px 0;
line-height: 28.8px;
border-bottom: 0.8px solid #f2f3f5;
.form-label {
font-size: 11.2px;
margin-right: 25.6px;
width: 88px;
text-align: right;
color: #7c7c7c;
.required {
color: red;
margin-right: 3.2px;
}
}
.conclusion {
color: #c7c7c7;
font-size: 11.2px;
.have {
color: #000;
}
}
.label {
font-size: 11.2px;
}
.switch-container {
display: flex;
gap: 9.6px;
.status-btn {
flex: 1;
padding: 5.6px 19.2px;
font-size: 12.8px;
color: #000000;
background: #f2f2f2;
text-align: center;
font-weight: 400;
line-height: 17.6px;
border-radius: 14.4px;
&.active {
color: #ffffff;
background: #3774f6;
border: 0.32px solid rgba(224, 224, 224, 1);
}
}
}
.input-box {
flex: 1;
border-radius: 3.2px;
font-size: 12.8px;
line-height: 19.2px;
}
.photo-limit {
font-size: 12.8px;
color: #959595;
line-height: 19.2px;
font-weight: 400;
}
.photo-container {
display: flex;
flex-wrap: wrap;
margin-bottom: 6.4px;
.photo-item {
position: relative;
margin-right: 6.4px;
margin-bottom: 6.4px;
.photo {
width: 57.6px;
height: 57.6px;
border-radius: 3.2px;
margin-left: 9.6px;
}
.delete-photo {
position: absolute;
top: -6.4px;
right: -6.4px;
background-color: #ff4d4f;
color: #fff;
width: 12.8px;
height: 12.8px;
border-radius: 50%;
text-align: center;
line-height: 12.8px;
font-size: 9.6px;
}
}
}
.photo-btn {
background: #ffffff;
border: 0.272px solid rgba(221, 221, 221, 1);
border-radius: 1.64px;
width: 57.6px;
height: 57.6px;
font-size: 57.6px;
color: #cccccc;
text-align: center;
line-height: 51.2px;
}
}
</style>
<template>
<!-- 机房巡检操作 -->
<view>
<view v-for="(item, index) in itemData.detail" :key="index">
<template
v-if="!(index > 2 && itemData.detail[2].inspectionResult === 1)"
>
<view class="form-item">
<text class="form-label"
><text class="required">*</text>{{ item.label }}</text
>
<view class="switch-container">
<view
:class="['status-btn', { active: item.inspectionResult === 0 }]"
@click="setInspectionResult(index, 0, item.lableArr[0])"
>
{{ item.lableArr[0] }}
</view>
<view
:class="['status-btn', { active: item.inspectionResult === 1 }]"
@click="setInspectionResult(index, 1, item.lableArr[1])"
>
{{ item.lableArr[1] }}
</view>
</view>
</view>
<view v-if="'conclusion' in item" class="form-item">
<text class="form-label"
><text class="required">*</text>情况摘要</text
>
<text class="conclusion" @click="showPopup(index)">{{
item.conclusion || "请输入情况摘要"
}}</text>
</view>
<view class="form-item" v-if="'photos' in item">
<text class="form-label"
><text class="required">*</text>现场照片</text
>
<view class="photo-box">
<view class="photo-container">
<view @click="takePhoto(index)" class="photo-btn"> + </view>
<view
v-for="(photo, itemIndex) in item && item.photos"
:key="itemIndex"
class="photo-item"
>
<image :src="photo" class="photo"></image>
<text
class="delete-photo"
@click="deletePhoto(index, itemIndex)"
>×</text
>
</view>
</view>
<view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
>
</view>
</view></template
> </view
><custom-popup
ref="customPopup"
:inspectionItem="inspectionItem"
@confirm="handlePopupConfirm"
></custom-popup>
</view>
</template>
<script>
import customPopup from "./customPopup.vue";
import _ from "lodash";
export default {
components: {
customPopup,
},
props: {
// 父组件传递的巡检状态
status: {
type: Number,
default: 0,
},
// 父组件传递的巡检事项名
inspectionItem: {
type: String,
default: "",
},
// 父组件传递的数据
defaultData: {
type: Object,
default: {},
},
},
data() {
return {
currentIndex: 0, // 当前操作的索引
photos: [],
itemData: {
isValid: false, // false是校验未通过 true是校验通过
// status: 0, 0是未巡检 1是已巡检 2巡检异常 statusLabel: "未巡检",
inspectionItem: "", //巡检事项
detail: [
{
label: "门禁功能",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
{
label: "门禁外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "是否有监控",
inspectionResult: 0,
inspectionResultLable: "有监控",
lableArr: ["有监控", "无监控"],
},
{
label: "监控外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "监控画面清晰",
inspectionResult: 0,
inspectionResultLable: "清晰",
lableArr: ["清晰", "模糊"],
conclusion: "",
photos: [],
},
{
label: "监控存储连续",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
],
},
};
},
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
},
mounted() {
if (Object.keys(this.defaultData).length !== 0) {
this.itemData = this.defaultData;
}
},
methods: {
// 拍照
takePhoto(index) {
uni.chooseImage({
count: 1,
sourceType: ["camera"], // 可以从相机拍摄
success: async (res) => {
if (this.photos.length < 5) {
const base64 = await this.convertFileToBase64(res.tempFilePaths[0]);
this.itemData.detail[index].photos.push(base64);
} else {
uni.showToast({
title: "最多只能上传5张照片",
icon: "none",
});
}
},
});
},
// 转化为base64
convertFileToBase64(filePath) {
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
filePath,
function (entry) {
entry.file(
function (file) {
const reader = new plus.io.FileReader();
reader.onloadend = function (evt) {
const base64 = evt.target.result; // 获取 Base64 数据
resolve(base64); // 返回 Base64 数据
};
reader.readAsDataURL(file); // 读取文件并转换为 Base64
},
function (error) {
reject("获取文件对象失败:" + error.message);
}
);
},
function (error) {
reject("解析文件路径失败:" + error.message);
}
);
});
},
// 删除照片
deletePhoto(index, itemIndex) {
this.itemData.detail[index].photos.splice(itemIndex, 1);
},
// 设置巡检结论
setInspectionResult(index, value, label) {
this.itemData.detail[index].inspectionResult = value; // 0正常 1异常
this.itemData.detail[index].inspectionResultLable = label;
},
// 显示弹窗
showPopup(index) {
this.currentIndex = index;
this.$refs.customPopup.open();
},
// 处理弹窗确认
handlePopupConfirm(summary) {
this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域
},
// 处理】数据
getFromData() {
console.log(111, this.itemData);
const isValid = this.areAllObjectsValid(this.itemData.detail,2); //false不通过 true通过
// const isAllOne = this.areAllInspectionResultsOne(this.itemData.detail);
this.itemData.isValid = isValid;
this.itemData.inspectionItem = this.inspectionItem;
console.log(222, this.itemData);
// if (isAllOne) {
// // 全都是正常
// this.itemData.status = 1; //1表示已经巡检过没有异常
// this.itemData.statusLabel = "已巡检";
// } else {
// this.itemData.status = 2; //1表示已经巡检过有异常
// this.itemData.statusLabel = "巡检异常";
// }
// console.log(this.itemData);
return this.itemData;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid(arr, skipIndex) {
// 遍历数组中的每个对象
for (let i = 0; i < arr.length; i++) {
const obj = arr[i];
// 如果当前索引大于等于 skipIndex,并且 inspectionResult 为 1,则跳过后续校验
if (i >= skipIndex && obj.inspectionResult === 1) {
break;
}
// 检查对象中的每个属性是否有值
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
// 如果属性值为空(null, undefined, 空字符串等),则校验不通过
if (
obj[key] === null ||
obj[key] === undefined ||
obj[key] === ""
) {
return false;
}
}
}
}
// 如果所有对象都通过校验,返回 true
return true;
},
// 校验是否有异常
areAllInspectionResultsOne(arr) {
return arr.every((obj) => obj.inspectionResult === 0);
},
},
};
</script>
<style scoped lang="less">
.form-item {
display: flex;
align-items: center;
padding: 9.6px 0;
line-height: 28.8px;
border-bottom: 0.8px solid #f2f3f5;
.form-label {
font-size: 11.2px;
margin-right: 25.6px;
width: 88px;
text-align: right;
color: #7c7c7c;
.required {
color: red;
margin-right: 3.2px;
}
}
.conclusion {
color: #c7c7c7;
font-size: 11.2px;
.have {
color: #000;
}
}
.label {
font-size: 11.2px;
}
.switch-container {
display: flex;
gap: 9.6px;
.status-btn {
flex: 1;
padding: 5.6px 19.2px;
font-size: 12.8px;
color: #000000;
background: #f2f2f2;
text-align: center;
font-weight: 400;
line-height: 17.6px;
border-radius: 14.4px;
&.active {
color: #ffffff;
background: #3774f6;
border: 0.32px solid rgba(224, 224, 224, 1);
}
}
}
.input-box {
flex: 1;
border-radius: 3.2px;
font-size: 12.8px;
line-height: 19.2px;
}
.photo-limit {
font-size: 12.8px;
color: #959595;
line-height: 19.2px;
font-weight: 400;
}
.photo-container {
display: flex;
flex-wrap: wrap;
margin-bottom: 6.4px;
.photo-item {
position: relative;
margin-right: 6.4px;
margin-bottom: 6.4px;
.photo {
width: 57.6px;
height: 57.6px;
border-radius: 3.2px;
margin-left: 9.6px;
}
.delete-photo {
position: absolute;
top: -6.4px;
right: -6.4px;
background-color: #ff4d4f;
color: #fff;
width: 12.8px;
height: 12.8px;
border-radius: 50%;
text-align: center;
line-height: 12.8px;
font-size: 9.6px;
}
}
}
.photo-btn {
background: #ffffff;
border: 0.272px solid rgba(221, 221, 221, 1);
border-radius: 1.64px;
width: 57.6px;
height: 57.6px;
font-size: 57.6px;
color: #cccccc;
text-align: center;
line-height: 51.2px;
}
}
</style>
<template>
<!-- 机房巡检操作 -->
<view>
<view v-for="(item, index) in itemData.detail" :key="index">
<template
v-if="!(index > 2 && itemData.detail[2].inspectionResult === 1)"
>
<view class="form-item">
<text class="form-label"
><text class="required">*</text>{{ item.label }}</text
>
<view class="switch-container">
<view
:class="['status-btn', { active: item.inspectionResult === 0 }]"
@click="setInspectionResult(index, 0, item.lableArr[0])"
>
{{ item.lableArr[0] }}
</view>
<view
:class="['status-btn', { active: item.inspectionResult === 1 }]"
@click="setInspectionResult(index, 1, item.lableArr[1])"
>
{{ item.lableArr[1] }}
</view>
</view>
</view>
<view v-if="'conclusion' in item" class="form-item">
<text class="form-label"
><text class="required">*</text>情况摘要</text
>
<text class="conclusion" @click="showPopup(index)">{{
item.conclusion || "请输入情况摘要"
}}</text>
</view>
<view class="form-item" v-if="'photos' in item">
<text class="form-label"
><text class="required">*</text>现场照片</text
>
<view class="photo-box">
<view class="photo-container">
<view @click="takePhoto(index)" class="photo-btn"> + </view>
<view
v-for="(photo, itemIndex) in item && item.photos"
:key="itemIndex"
class="photo-item"
>
<image :src="photo" class="photo"></image>
<text
class="delete-photo"
@click="deletePhoto(index, itemIndex)"
>×</text
>
</view>
</view>
<view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
>
</view>
</view></template
> </view
><custom-popup
ref="customPopup"
:inspectionItem="inspectionItem"
@confirm="handlePopupConfirm"
></custom-popup>
</view>
</template>
<script>
import customPopup from "./customPopup.vue";
import _ from "lodash";
export default {
components: {
customPopup,
},
props: {
// 父组件传递的巡检状态
status: {
type: Number,
default: 0,
},
// 父组件传递的巡检事项名
inspectionItem: {
type: String,
default: "",
},
// 父组件传递的数据
defaultData: {
type: Object,
default: {},
},
},
data() {
return {
currentIndex: 0, // 当前操作的索引
photos: [],
itemData: {
isValid: false, // false是校验未通过 true是校验通过
// status: 0, 0是未巡检 1是已巡检 2巡检异常 statusLabel: "未巡检",
inspectionItem: "", //巡检事项
detail: [
{
label: "门禁功能",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
{
label: "门禁外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "是否有监控",
inspectionResult: 0,
inspectionResultLable: "有监控",
lableArr: ["有监控", "无监控"],
},
{
label: "监控外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "监控画面清晰",
inspectionResult: 0,
inspectionResultLable: "清晰",
lableArr: ["清晰", "模糊"],
conclusion: "",
photos: [],
},
{
label: "监控存储连续",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
],
},
};
},
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
},
mounted() {
if (Object.keys(this.defaultData).length !== 0) {
this.itemData = this.defaultData;
}
},
methods: {
// 拍照
takePhoto(index) {
uni.chooseImage({
count: 1,
sourceType: ["camera"], // 可以从相机拍摄
success: async (res) => {
if (this.photos.length < 5) {
const base64 = await this.convertFileToBase64(res.tempFilePaths[0]);
this.itemData.detail[index].photos.push(base64);
} else {
uni.showToast({
title: "最多只能上传5张照片",
icon: "none",
});
}
},
});
},
// 转化为base64
convertFileToBase64(filePath) {
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
filePath,
function (entry) {
entry.file(
function (file) {
const reader = new plus.io.FileReader();
reader.onloadend = function (evt) {
const base64 = evt.target.result; // 获取 Base64 数据
resolve(base64); // 返回 Base64 数据
};
reader.readAsDataURL(file); // 读取文件并转换为 Base64
},
function (error) {
reject("获取文件对象失败:" + error.message);
}
);
},
function (error) {
reject("解析文件路径失败:" + error.message);
}
);
});
},
// 删除照片
deletePhoto(index, itemIndex) {
this.itemData.detail[index].photos.splice(itemIndex, 1);
},
// 设置巡检结论
setInspectionResult(index, value, label) {
this.itemData.detail[index].inspectionResult = value; // 0正常 1异常
this.itemData.detail[index].inspectionResultLable = label;
},
// 显示弹窗
showPopup(index) {
this.currentIndex = index;
this.$refs.customPopup.open();
},
// 处理弹窗确认
handlePopupConfirm(summary) {
this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域
},
// 处理】数据
getFromData() {
console.log(111, this.itemData);
const isValid = this.areAllObjectsValid(this.itemData.detail,2); //false不通过 true通过
// const isAllOne = this.areAllInspectionResultsOne(this.itemData.detail);
this.itemData.isValid = isValid;
this.itemData.inspectionItem = this.inspectionItem;
console.log(222, this.itemData);
// if (isAllOne) {
// // 全都是正常
// this.itemData.status = 1; //1表示已经巡检过没有异常
// this.itemData.statusLabel = "已巡检";
// } else {
// this.itemData.status = 2; //1表示已经巡检过有异常
// this.itemData.statusLabel = "巡检异常";
// }
// console.log(this.itemData);
return this.itemData;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid(arr, skipIndex) {
// 遍历数组中的每个对象
for (let i = 0; i < arr.length; i++) {
const obj = arr[i];
// 如果当前索引大于等于 skipIndex,并且 inspectionResult 为 1,则跳过后续校验
if (i >= skipIndex && obj.inspectionResult === 1) {
break;
}
// 检查对象中的每个属性是否有值
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
// 如果属性值为空(null, undefined, 空字符串等),则校验不通过
if (
obj[key] === null ||
obj[key] === undefined ||
obj[key] === ""
) {
return false;
}
}
}
}
// 如果所有对象都通过校验,返回 true
return true;
},
// 校验是否有异常
areAllInspectionResultsOne(arr) {
return arr.every((obj) => obj.inspectionResult === 0);
},
},
};
</script>
<style scoped lang="less">
.form-item {
display: flex;
align-items: center;
padding: 9.6px 0;
line-height: 28.8px;
border-bottom: 0.8px solid #f2f3f5;
.form-label {
font-size: 11.2px;
margin-right: 25.6px;
width: 88px;
text-align: right;
color: #7c7c7c;
.required {
color: red;
margin-right: 3.2px;
}
}
.conclusion {
color: #c7c7c7;
font-size: 11.2px;
.have {
color: #000;
}
}
.label {
font-size: 11.2px;
}
.switch-container {
display: flex;
gap: 9.6px;
.status-btn {
flex: 1;
padding: 5.6px 19.2px;
font-size: 12.8px;
color: #000000;
background: #f2f2f2;
text-align: center;
font-weight: 400;
line-height: 17.6px;
border-radius: 14.4px;
&.active {
color: #ffffff;
background: #3774f6;
border: 0.32px solid rgba(224, 224, 224, 1);
}
}
}
.input-box {
flex: 1;
border-radius: 3.2px;
font-size: 12.8px;
line-height: 19.2px;
}
.photo-limit {
font-size: 12.8px;
color: #959595;
line-height: 19.2px;
font-weight: 400;
}
.photo-container {
display: flex;
flex-wrap: wrap;
margin-bottom: 6.4px;
.photo-item {
position: relative;
margin-right: 6.4px;
margin-bottom: 6.4px;
.photo {
width: 57.6px;
height: 57.6px;
border-radius: 3.2px;
margin-left: 9.6px;
}
.delete-photo {
position: absolute;
top: -6.4px;
right: -6.4px;
background-color: #ff4d4f;
color: #fff;
width: 12.8px;
height: 12.8px;
border-radius: 50%;
text-align: center;
line-height: 12.8px;
font-size: 9.6px;
}
}
}
.photo-btn {
background: #ffffff;
border: 0.272px solid rgba(221, 221, 221, 1);
border-radius: 1.64px;
width: 57.6px;
height: 57.6px;
font-size: 57.6px;
color: #cccccc;
text-align: center;
line-height: 51.2px;
}
}
</style>
<template>
<!-- 机房巡检操作 -->
<view>
<view v-for="(item, index) in itemData.detail" :key="index">
<template
v-if="!(index > 2 && itemData.detail[2].inspectionResult === 1)"
>
<view class="form-item">
<text class="form-label"
><text class="required">*</text>{{ item.label }}</text
>
<view class="switch-container">
<view
:class="['status-btn', { active: item.inspectionResult === 0 }]"
@click="setInspectionResult(index, 0, item.lableArr[0])"
>
{{ item.lableArr[0] }}
</view>
<view
:class="['status-btn', { active: item.inspectionResult === 1 }]"
@click="setInspectionResult(index, 1, item.lableArr[1])"
>
{{ item.lableArr[1] }}
</view>
</view>
</view>
<view v-if="'conclusion' in item" class="form-item">
<text class="form-label"
><text class="required">*</text>情况摘要</text
>
<text class="conclusion" @click="showPopup(index)">{{
item.conclusion || "请输入情况摘要"
}}</text>
</view>
<view class="form-item" v-if="'photos' in item">
<text class="form-label"
><text class="required">*</text>现场照片</text
>
<view class="photo-box">
<view class="photo-container">
<view @click="takePhoto(index)" class="photo-btn"> + </view>
<view
v-for="(photo, itemIndex) in item && item.photos"
:key="itemIndex"
class="photo-item"
>
<image :src="photo" class="photo"></image>
<text
class="delete-photo"
@click="deletePhoto(index, itemIndex)"
>×</text
>
</view>
</view>
<view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
>
</view>
</view></template
> </view
><custom-popup
ref="customPopup"
:inspectionItem="inspectionItem"
@confirm="handlePopupConfirm"
></custom-popup>
</view>
</template>
<script>
import customPopup from "./customPopup.vue";
import _ from "lodash";
export default {
components: {
customPopup,
},
props: {
// 父组件传递的巡检状态
status: {
type: Number,
default: 0,
},
// 父组件传递的巡检事项名
inspectionItem: {
type: String,
default: "",
},
// 父组件传递的数据
defaultData: {
type: Object,
default: {},
},
},
data() {
return {
currentIndex: 0, // 当前操作的索引
photos: [],
itemData: {
isValid: false, // false是校验未通过 true是校验通过
// status: 0, 0是未巡检 1是已巡检 2巡检异常 statusLabel: "未巡检",
inspectionItem: "", //巡检事项
detail: [
{
label: "门禁功能",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
{
label: "门禁外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "是否有监控",
inspectionResult: 0,
inspectionResultLable: "有监控",
lableArr: ["有监控", "无监控"],
},
{
label: "监控外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "监控画面清晰",
inspectionResult: 0,
inspectionResultLable: "清晰",
lableArr: ["清晰", "模糊"],
conclusion: "",
photos: [],
},
{
label: "监控存储连续",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
],
},
};
},
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
},
mounted() {
if (Object.keys(this.defaultData).length !== 0) {
this.itemData = this.defaultData;
}
},
methods: {
// 拍照
takePhoto(index) {
uni.chooseImage({
count: 1,
sourceType: ["camera"], // 可以从相机拍摄
success: async (res) => {
if (this.photos.length < 5) {
const base64 = await this.convertFileToBase64(res.tempFilePaths[0]);
this.itemData.detail[index].photos.push(base64);
} else {
uni.showToast({
title: "最多只能上传5张照片",
icon: "none",
});
}
},
});
},
// 转化为base64
convertFileToBase64(filePath) {
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
filePath,
function (entry) {
entry.file(
function (file) {
const reader = new plus.io.FileReader();
reader.onloadend = function (evt) {
const base64 = evt.target.result; // 获取 Base64 数据
resolve(base64); // 返回 Base64 数据
};
reader.readAsDataURL(file); // 读取文件并转换为 Base64
},
function (error) {
reject("获取文件对象失败:" + error.message);
}
);
},
function (error) {
reject("解析文件路径失败:" + error.message);
}
);
});
},
// 删除照片
deletePhoto(index, itemIndex) {
this.itemData.detail[index].photos.splice(itemIndex, 1);
},
// 设置巡检结论
setInspectionResult(index, value, label) {
this.itemData.detail[index].inspectionResult = value; // 0正常 1异常
this.itemData.detail[index].inspectionResultLable = label;
},
// 显示弹窗
showPopup(index) {
this.currentIndex = index;
this.$refs.customPopup.open();
},
// 处理弹窗确认
handlePopupConfirm(summary) {
this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域
},
// 处理】数据
getFromData() {
console.log(111, this.itemData);
const isValid = this.areAllObjectsValid(this.itemData.detail,2); //false不通过 true通过
// const isAllOne = this.areAllInspectionResultsOne(this.itemData.detail);
this.itemData.isValid = isValid;
this.itemData.inspectionItem = this.inspectionItem;
console.log(222, this.itemData);
// if (isAllOne) {
// // 全都是正常
// this.itemData.status = 1; //1表示已经巡检过没有异常
// this.itemData.statusLabel = "已巡检";
// } else {
// this.itemData.status = 2; //1表示已经巡检过有异常
// this.itemData.statusLabel = "巡检异常";
// }
// console.log(this.itemData);
return this.itemData;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid(arr, skipIndex) {
// 遍历数组中的每个对象
for (let i = 0; i < arr.length; i++) {
const obj = arr[i];
// 如果当前索引大于等于 skipIndex,并且 inspectionResult 为 1,则跳过后续校验
if (i >= skipIndex && obj.inspectionResult === 1) {
break;
}
// 检查对象中的每个属性是否有值
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
// 如果属性值为空(null, undefined, 空字符串等),则校验不通过
if (
obj[key] === null ||
obj[key] === undefined ||
obj[key] === ""
) {
return false;
}
}
}
}
// 如果所有对象都通过校验,返回 true
return true;
},
// 校验是否有异常
areAllInspectionResultsOne(arr) {
return arr.every((obj) => obj.inspectionResult === 0);
},
},
};
</script>
<style scoped lang="less">
.form-item {
display: flex;
align-items: center;
padding: 9.6px 0;
line-height: 28.8px;
border-bottom: 0.8px solid #f2f3f5;
.form-label {
font-size: 11.2px;
margin-right: 25.6px;
width: 88px;
text-align: right;
color: #7c7c7c;
.required {
color: red;
margin-right: 3.2px;
}
}
.conclusion {
color: #c7c7c7;
font-size: 11.2px;
.have {
color: #000;
}
}
.label {
font-size: 11.2px;
}
.switch-container {
display: flex;
gap: 9.6px;
.status-btn {
flex: 1;
padding: 5.6px 19.2px;
font-size: 12.8px;
color: #000000;
background: #f2f2f2;
text-align: center;
font-weight: 400;
line-height: 17.6px;
border-radius: 14.4px;
&.active {
color: #ffffff;
background: #3774f6;
border: 0.32px solid rgba(224, 224, 224, 1);
}
}
}
.input-box {
flex: 1;
border-radius: 3.2px;
font-size: 12.8px;
line-height: 19.2px;
}
.photo-limit {
font-size: 12.8px;
color: #959595;
line-height: 19.2px;
font-weight: 400;
}
.photo-container {
display: flex;
flex-wrap: wrap;
margin-bottom: 6.4px;
.photo-item {
position: relative;
margin-right: 6.4px;
margin-bottom: 6.4px;
.photo {
width: 57.6px;
height: 57.6px;
border-radius: 3.2px;
margin-left: 9.6px;
}
.delete-photo {
position: absolute;
top: -6.4px;
right: -6.4px;
background-color: #ff4d4f;
color: #fff;
width: 12.8px;
height: 12.8px;
border-radius: 50%;
text-align: center;
line-height: 12.8px;
font-size: 9.6px;
}
}
}
.photo-btn {
background: #ffffff;
border: 0.272px solid rgba(221, 221, 221, 1);
border-radius: 1.64px;
width: 57.6px;
height: 57.6px;
font-size: 57.6px;
color: #cccccc;
text-align: center;
line-height: 51.2px;
}
}
</style>
<template>
<!-- 机房巡检操作 -->
<view>
<view v-for="(item, index) in itemData.detail" :key="index">
<template
v-if="!(index > 2 && itemData.detail[2].inspectionResult === 1)"
>
<view class="form-item">
<text class="form-label"
><text class="required">*</text>{{ item.label }}</text
>
<view class="switch-container">
<view
:class="['status-btn', { active: item.inspectionResult === 0 }]"
@click="setInspectionResult(index, 0, item.lableArr[0])"
>
{{ item.lableArr[0] }}
</view>
<view
:class="['status-btn', { active: item.inspectionResult === 1 }]"
@click="setInspectionResult(index, 1, item.lableArr[1])"
>
{{ item.lableArr[1] }}
</view>
</view>
</view>
<view v-if="'conclusion' in item" class="form-item">
<text class="form-label"
><text class="required">*</text>情况摘要</text
>
<text class="conclusion" @click="showPopup(index)">{{
item.conclusion || "请输入情况摘要"
}}</text>
</view>
<view class="form-item" v-if="'photos' in item">
<text class="form-label"
><text class="required">*</text>现场照片</text
>
<view class="photo-box">
<view class="photo-container">
<view @click="takePhoto(index)" class="photo-btn"> + </view>
<view
v-for="(photo, itemIndex) in item && item.photos"
:key="itemIndex"
class="photo-item"
>
<image :src="photo" class="photo"></image>
<text
class="delete-photo"
@click="deletePhoto(index, itemIndex)"
>×</text
>
</view>
</view>
<view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
>
</view>
</view></template
> </view
><custom-popup
ref="customPopup"
:inspectionItem="inspectionItem"
@confirm="handlePopupConfirm"
></custom-popup>
</view>
</template>
<script>
import customPopup from "./customPopup.vue";
import _ from "lodash";
export default {
components: {
customPopup,
},
props: {
// 父组件传递的巡检状态
status: {
type: Number,
default: 0,
},
// 父组件传递的巡检事项名
inspectionItem: {
type: String,
default: "",
},
// 父组件传递的数据
defaultData: {
type: Object,
default: {},
},
},
data() {
return {
currentIndex: 0, // 当前操作的索引
photos: [],
itemData: {
isValid: false, // false是校验未通过 true是校验通过
// status: 0, 0是未巡检 1是已巡检 2巡检异常 statusLabel: "未巡检",
inspectionItem: "", //巡检事项
detail: [
{
label: "门禁功能",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
{
label: "门禁外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "是否有监控",
inspectionResult: 0,
inspectionResultLable: "有监控",
lableArr: ["有监控", "无监控"],
},
{
label: "监控外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "监控画面清晰",
inspectionResult: 0,
inspectionResultLable: "清晰",
lableArr: ["清晰", "模糊"],
conclusion: "",
photos: [],
},
{
label: "监控存储连续",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
],
},
};
},
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
},
mounted() {
if (Object.keys(this.defaultData).length !== 0) {
this.itemData = this.defaultData;
}
},
methods: {
// 拍照
takePhoto(index) {
uni.chooseImage({
count: 1,
sourceType: ["camera"], // 可以从相机拍摄
success: async (res) => {
if (this.photos.length < 5) {
const base64 = await this.convertFileToBase64(res.tempFilePaths[0]);
this.itemData.detail[index].photos.push(base64);
} else {
uni.showToast({
title: "最多只能上传5张照片",
icon: "none",
});
}
},
});
},
// 转化为base64
convertFileToBase64(filePath) {
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
filePath,
function (entry) {
entry.file(
function (file) {
const reader = new plus.io.FileReader();
reader.onloadend = function (evt) {
const base64 = evt.target.result; // 获取 Base64 数据
resolve(base64); // 返回 Base64 数据
};
reader.readAsDataURL(file); // 读取文件并转换为 Base64
},
function (error) {
reject("获取文件对象失败:" + error.message);
}
);
},
function (error) {
reject("解析文件路径失败:" + error.message);
}
);
});
},
// 删除照片
deletePhoto(index, itemIndex) {
this.itemData.detail[index].photos.splice(itemIndex, 1);
},
// 设置巡检结论
setInspectionResult(index, value, label) {
this.itemData.detail[index].inspectionResult = value; // 0正常 1异常
this.itemData.detail[index].inspectionResultLable = label;
},
// 显示弹窗
showPopup(index) {
this.currentIndex = index;
this.$refs.customPopup.open();
},
// 处理弹窗确认
handlePopupConfirm(summary) {
this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域
},
// 处理】数据
getFromData() {
console.log(111, this.itemData);
const isValid = this.areAllObjectsValid(this.itemData.detail,2); //false不通过 true通过
// const isAllOne = this.areAllInspectionResultsOne(this.itemData.detail);
this.itemData.isValid = isValid;
this.itemData.inspectionItem = this.inspectionItem;
console.log(222, this.itemData);
// if (isAllOne) {
// // 全都是正常
// this.itemData.status = 1; //1表示已经巡检过没有异常
// this.itemData.statusLabel = "已巡检";
// } else {
// this.itemData.status = 2; //1表示已经巡检过有异常
// this.itemData.statusLabel = "巡检异常";
// }
// console.log(this.itemData);
return this.itemData;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid(arr, skipIndex) {
// 遍历数组中的每个对象
for (let i = 0; i < arr.length; i++) {
const obj = arr[i];
// 如果当前索引大于等于 skipIndex,并且 inspectionResult 为 1,则跳过后续校验
if (i >= skipIndex && obj.inspectionResult === 1) {
break;
}
// 检查对象中的每个属性是否有值
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
// 如果属性值为空(null, undefined, 空字符串等),则校验不通过
if (
obj[key] === null ||
obj[key] === undefined ||
obj[key] === ""
) {
return false;
}
}
}
}
// 如果所有对象都通过校验,返回 true
return true;
},
// 校验是否有异常
areAllInspectionResultsOne(arr) {
return arr.every((obj) => obj.inspectionResult === 0);
},
},
};
</script>
<style scoped lang="less">
.form-item {
display: flex;
align-items: center;
padding: 9.6px 0;
line-height: 28.8px;
border-bottom: 0.8px solid #f2f3f5;
.form-label {
font-size: 11.2px;
margin-right: 25.6px;
width: 88px;
text-align: right;
color: #7c7c7c;
.required {
color: red;
margin-right: 3.2px;
}
}
.conclusion {
color: #c7c7c7;
font-size: 11.2px;
.have {
color: #000;
}
}
.label {
font-size: 11.2px;
}
.switch-container {
display: flex;
gap: 9.6px;
.status-btn {
flex: 1;
padding: 5.6px 19.2px;
font-size: 12.8px;
color: #000000;
background: #f2f2f2;
text-align: center;
font-weight: 400;
line-height: 17.6px;
border-radius: 14.4px;
&.active {
color: #ffffff;
background: #3774f6;
border: 0.32px solid rgba(224, 224, 224, 1);
}
}
}
.input-box {
flex: 1;
border-radius: 3.2px;
font-size: 12.8px;
line-height: 19.2px;
}
.photo-limit {
font-size: 12.8px;
color: #959595;
line-height: 19.2px;
font-weight: 400;
}
.photo-container {
display: flex;
flex-wrap: wrap;
margin-bottom: 6.4px;
.photo-item {
position: relative;
margin-right: 6.4px;
margin-bottom: 6.4px;
.photo {
width: 57.6px;
height: 57.6px;
border-radius: 3.2px;
margin-left: 9.6px;
}
.delete-photo {
position: absolute;
top: -6.4px;
right: -6.4px;
background-color: #ff4d4f;
color: #fff;
width: 12.8px;
height: 12.8px;
border-radius: 50%;
text-align: center;
line-height: 12.8px;
font-size: 9.6px;
}
}
}
.photo-btn {
background: #ffffff;
border: 0.272px solid rgba(221, 221, 221, 1);
border-radius: 1.64px;
width: 57.6px;
height: 57.6px;
font-size: 57.6px;
color: #cccccc;
text-align: center;
line-height: 51.2px;
}
}
</style>
<template>
<!-- 机房巡检操作 -->
<view>
<view v-for="(item, index) in itemData.detail" :key="index">
<template
v-if="!(index > 2 && itemData.detail[2].inspectionResult === 1)"
>
<view class="form-item">
<text class="form-label"
><text class="required">*</text>{{ item.label }}</text
>
<view class="switch-container">
<view
:class="['status-btn', { active: item.inspectionResult === 0 }]"
@click="setInspectionResult(index, 0, item.lableArr[0])"
>
{{ item.lableArr[0] }}
</view>
<view
:class="['status-btn', { active: item.inspectionResult === 1 }]"
@click="setInspectionResult(index, 1, item.lableArr[1])"
>
{{ item.lableArr[1] }}
</view>
</view>
</view>
<view v-if="'conclusion' in item" class="form-item">
<text class="form-label"
><text class="required">*</text>情况摘要</text
>
<text class="conclusion" @click="showPopup(index)">{{
item.conclusion || "请输入情况摘要"
}}</text>
</view>
<view class="form-item" v-if="'photos' in item">
<text class="form-label"
><text class="required">*</text>现场照片</text
>
<view class="photo-box">
<view class="photo-container">
<view @click="takePhoto(index)" class="photo-btn"> + </view>
<view
v-for="(photo, itemIndex) in item && item.photos"
:key="itemIndex"
class="photo-item"
>
<image :src="photo" class="photo"></image>
<text
class="delete-photo"
@click="deletePhoto(index, itemIndex)"
>×</text
>
</view>
</view>
<view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
>
</view>
</view></template
> </view
><custom-popup
ref="customPopup"
:inspectionItem="inspectionItem"
@confirm="handlePopupConfirm"
></custom-popup>
</view>
</template>
<script>
import customPopup from "./customPopup.vue";
import _ from "lodash";
export default {
components: {
customPopup,
},
props: {
// 父组件传递的巡检状态
status: {
type: Number,
default: 0,
},
// 父组件传递的巡检事项名
inspectionItem: {
type: String,
default: "",
},
// 父组件传递的数据
defaultData: {
type: Object,
default: {},
},
},
data() {
return {
currentIndex: 0, // 当前操作的索引
photos: [],
itemData: {
isValid: false, // false是校验未通过 true是校验通过
// status: 0, 0是未巡检 1是已巡检 2巡检异常 statusLabel: "未巡检",
inspectionItem: "", //巡检事项
detail: [
{
label: "门禁功能",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
{
label: "门禁外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "是否有监控",
inspectionResult: 0,
inspectionResultLable: "有监控",
lableArr: ["有监控", "无监控"],
},
{
label: "监控外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "监控画面清晰",
inspectionResult: 0,
inspectionResultLable: "清晰",
lableArr: ["清晰", "模糊"],
conclusion: "",
photos: [],
},
{
label: "监控存储连续",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
],
},
};
},
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
},
mounted() {
if (Object.keys(this.defaultData).length !== 0) {
this.itemData = this.defaultData;
}
},
methods: {
// 拍照
takePhoto(index) {
uni.chooseImage({
count: 1,
sourceType: ["camera"], // 可以从相机拍摄
success: async (res) => {
if (this.photos.length < 5) {
const base64 = await this.convertFileToBase64(res.tempFilePaths[0]);
this.itemData.detail[index].photos.push(base64);
} else {
uni.showToast({
title: "最多只能上传5张照片",
icon: "none",
});
}
},
});
},
// 转化为base64
convertFileToBase64(filePath) {
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
filePath,
function (entry) {
entry.file(
function (file) {
const reader = new plus.io.FileReader();
reader.onloadend = function (evt) {
const base64 = evt.target.result; // 获取 Base64 数据
resolve(base64); // 返回 Base64 数据
};
reader.readAsDataURL(file); // 读取文件并转换为 Base64
},
function (error) {
reject("获取文件对象失败:" + error.message);
}
);
},
function (error) {
reject("解析文件路径失败:" + error.message);
}
);
});
},
// 删除照片
deletePhoto(index, itemIndex) {
this.itemData.detail[index].photos.splice(itemIndex, 1);
},
// 设置巡检结论
setInspectionResult(index, value, label) {
this.itemData.detail[index].inspectionResult = value; // 0正常 1异常
this.itemData.detail[index].inspectionResultLable = label;
},
// 显示弹窗
showPopup(index) {
this.currentIndex = index;
this.$refs.customPopup.open();
},
// 处理弹窗确认
handlePopupConfirm(summary) {
this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域
},
// 处理】数据
getFromData() {
console.log(111, this.itemData);
const isValid = this.areAllObjectsValid(this.itemData.detail,2); //false不通过 true通过
// const isAllOne = this.areAllInspectionResultsOne(this.itemData.detail);
this.itemData.isValid = isValid;
this.itemData.inspectionItem = this.inspectionItem;
console.log(222, this.itemData);
// if (isAllOne) {
// // 全都是正常
// this.itemData.status = 1; //1表示已经巡检过没有异常
// this.itemData.statusLabel = "已巡检";
// } else {
// this.itemData.status = 2; //1表示已经巡检过有异常
// this.itemData.statusLabel = "巡检异常";
// }
// console.log(this.itemData);
return this.itemData;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid(arr, skipIndex) {
// 遍历数组中的每个对象
for (let i = 0; i < arr.length; i++) {
const obj = arr[i];
// 如果当前索引大于等于 skipIndex,并且 inspectionResult 为 1,则跳过后续校验
if (i >= skipIndex && obj.inspectionResult === 1) {
break;
}
// 检查对象中的每个属性是否有值
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
// 如果属性值为空(null, undefined, 空字符串等),则校验不通过
if (
obj[key] === null ||
obj[key] === undefined ||
obj[key] === ""
) {
return false;
}
}
}
}
// 如果所有对象都通过校验,返回 true
return true;
},
// 校验是否有异常
areAllInspectionResultsOne(arr) {
return arr.every((obj) => obj.inspectionResult === 0);
},
},
};
</script>
<style scoped lang="less">
.form-item {
display: flex;
align-items: center;
padding: 9.6px 0;
line-height: 28.8px;
border-bottom: 0.8px solid #f2f3f5;
.form-label {
font-size: 11.2px;
margin-right: 25.6px;
width: 88px;
text-align: right;
color: #7c7c7c;
.required {
color: red;
margin-right: 3.2px;
}
}
.conclusion {
color: #c7c7c7;
font-size: 11.2px;
.have {
color: #000;
}
}
.label {
font-size: 11.2px;
}
.switch-container {
display: flex;
gap: 9.6px;
.status-btn {
flex: 1;
padding: 5.6px 19.2px;
font-size: 12.8px;
color: #000000;
background: #f2f2f2;
text-align: center;
font-weight: 400;
line-height: 17.6px;
border-radius: 14.4px;
&.active {
color: #ffffff;
background: #3774f6;
border: 0.32px solid rgba(224, 224, 224, 1);
}
}
}
.input-box {
flex: 1;
border-radius: 3.2px;
font-size: 12.8px;
line-height: 19.2px;
}
.photo-limit {
font-size: 12.8px;
color: #959595;
line-height: 19.2px;
font-weight: 400;
}
.photo-container {
display: flex;
flex-wrap: wrap;
margin-bottom: 6.4px;
.photo-item {
position: relative;
margin-right: 6.4px;
margin-bottom: 6.4px;
.photo {
width: 57.6px;
height: 57.6px;
border-radius: 3.2px;
margin-left: 9.6px;
}
.delete-photo {
position: absolute;
top: -6.4px;
right: -6.4px;
background-color: #ff4d4f;
color: #fff;
width: 12.8px;
height: 12.8px;
border-radius: 50%;
text-align: center;
line-height: 12.8px;
font-size: 9.6px;
}
}
}
.photo-btn {
background: #ffffff;
border: 0.272px solid rgba(221, 221, 221, 1);
border-radius: 1.64px;
width: 57.6px;
height: 57.6px;
font-size: 57.6px;
color: #cccccc;
text-align: center;
line-height: 51.2px;
}
}
</style>
...@@ -3,17 +3,19 @@ ...@@ -3,17 +3,19 @@
<view> <view>
<view v-for="(item, index) in itemData.detail" :key="index"> <view v-for="(item, index) in itemData.detail" :key="index">
<view class="form-item"> <view class="form-item">
<text class="form-label"><text class="required">*</text>巡检结论</text> <text class="form-label"
><text class="required">*</text>{{ item.label }}</text
>
<view class="switch-container"> <view class="switch-container">
<view <view
:class="['status-btn', { active: item.inspectionResult === 0 }]" :class="['status-btn', { active: item.inspectionResult === 0 }]"
@click="setInspectionResult(0)" @click="setInspectionResult(index, 0)"
> >
正常 正常
</view> </view>
<view <view
:class="['status-btn', { active: item.inspectionResult === 1 }]" :class="['status-btn', { active: item.inspectionResult === 1 }]"
@click="setInspectionResult(1)" @click="setInspectionResult(index, 1)"
> >
异常 异常
</view> </view>
...@@ -27,20 +29,24 @@ ...@@ -27,20 +29,24 @@
}}</text> }}</text>
</view> </view>
<view class="form-item"> <view class="form-item">
<text class="form-label">现场照片</text> <text class="form-label"><text class="required">*</text>现场照片</text>
<view class="photo-box"> <view class="photo-box">
<view class="photo-container"> <view class="photo-container">
<view @click="takePhoto" class="photo-btn"> + </view> <view @click="takePhoto(index)" class="photo-btn"> + </view>
<view <view
v-for="(photo, index) in item && item.photos" v-for="(photo, itemIndex) in item && item.photos"
:key="index" :key="itemIndex"
class="photo-item" class="photo-item"
> >
<image :src="photo" class="photo"></image> <image :src="photo" class="photo"></image>
<text class="delete-photo" @click="deletePhoto(index)">×</text> <text class="delete-photo" @click="deletePhoto(index, itemIndex)"
>×</text
>
</view> </view>
</view> </view>
<view class="photo-limit">请对检查项进行拍照留存(限5张)。</view> <view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
>
</view> </view>
</view> </view </view> </view
><custom-popup ><custom-popup
...@@ -52,7 +58,7 @@ ...@@ -52,7 +58,7 @@
</template> </template>
<script> <script>
import customPopup from "../components/customPopup.vue"; import customPopup from "./customPopup.vue";
import _ from "lodash"; import _ from "lodash";
export default { export default {
...@@ -74,8 +80,9 @@ export default { ...@@ -74,8 +80,9 @@ export default {
itemData: { itemData: {
type: Object, type: Object,
default: () => ({ default: () => ({
// 0是未巡检 1是已巡检 2巡检异常 isValid: false, // false是校验未通过 true是校验通过
status: 0, // status: 0, 0是未巡检 1是已巡检 2巡检异常 statusLabel: "未巡检",
inspectionItem: "", //巡检事项
detail: [ detail: [
{ {
label: "地板、墙壁破损", label: "地板、墙壁破损",
...@@ -114,6 +121,7 @@ export default { ...@@ -114,6 +121,7 @@ export default {
data() { data() {
return { return {
currentIndex: 0, // 当前操作的索引 currentIndex: 0, // 当前操作的索引
photos: [],
}; };
}, },
computed: { computed: {
...@@ -123,6 +131,59 @@ export default { ...@@ -123,6 +131,59 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
// 拍照
takePhoto(index) {
uni.chooseImage({
count: 1,
sourceType: ["camera"], // 可以从相机拍摄
success: async (res) => {
if (this.photos.length < 5) {
const base64 = await this.convertFileToBase64(res.tempFilePaths[0]);
this.itemData.detail[index].photos.push(base64);
} else {
uni.showToast({
title: "最多只能上传5张照片",
icon: "none",
});
}
},
});
},
// 转化为base64
convertFileToBase64(filePath) {
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
filePath,
function (entry) {
entry.file(
function (file) {
const reader = new plus.io.FileReader();
reader.onloadend = function (evt) {
const base64 = evt.target.result; // 获取 Base64 数据
resolve(base64); // 返回 Base64 数据
};
reader.readAsDataURL(file); // 读取文件并转换为 Base64
},
function (error) {
reject("获取文件对象失败:" + error.message);
}
);
},
function (error) {
reject("解析文件路径失败:" + error.message);
}
);
});
},
// 删除照片
deletePhoto(index, itemIndex) {
this.itemData.detail[index].photos.splice(itemIndex, 1);
},
// 设置巡检结论
setInspectionResult(index, value) {
this.itemData.detail[index].inspectionResult = value; // 0正常 1异常
},
// 显示弹窗 // 显示弹窗
showPopup(index) { showPopup(index) {
this.currentIndex = index; this.currentIndex = index;
...@@ -132,6 +193,58 @@ export default { ...@@ -132,6 +193,58 @@ export default {
handlePopupConfirm(summary) { handlePopupConfirm(summary) {
this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域 this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域
}, },
// 处理】数据
getFromData() {
const isValid = this.areAllObjectsValid(this.itemData.detail); //false不通过 true通过
const isAllOne = this.areAllInspectionResultsOne(this.itemData.detail);
this.itemData.isValid = isValid;
this.itemData.inspectionItem = this.inspectionItem;
// if (isAllOne) {
// // 全都是正常
// this.itemData.status = 1; //1表示已经巡检过没有异常
// this.itemData.statusLabel = "已巡检";
// } else {
// this.itemData.status = 2; //1表示已经巡检过有异常
// this.itemData.statusLabel = "巡检异常";
// }
// console.log(this.itemData);
return this.itemData;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid(arr) {
function isEmpty(value) {
return (
value === null ||
value === undefined ||
(typeof value === "string" && value.trim() === "") ||
(Array.isArray(value) && value.length === 0) ||
(typeof value === "object" &&
!Array.isArray(value) &&
Object.keys(value).length === 0)
);
}
for (let i = 0; i < arr.length; i++) {
const obj = arr[i];
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
const value = obj[key];
if (typeof value === "object") {
if (isEmpty(value) || !allPropertiesNonEmpty([value])) {
return false;
}
} else if (isEmpty(value)) {
return false;
}
}
}
}
return true;
},
// 校验是否有异常
areAllInspectionResultsOne(arr) {
return arr.every((obj) => obj.inspectionResult === 0);
},
}, },
}; };
</script> </script>
...@@ -146,7 +259,7 @@ export default { ...@@ -146,7 +259,7 @@ export default {
.form-label { .form-label {
font-size: 11.2px; font-size: 11.2px;
margin-right: 25.6px; margin-right: 25.6px;
width: 58.4px; width: 88px;
text-align: right; text-align: right;
color: #7c7c7c; color: #7c7c7c;
...@@ -158,6 +271,9 @@ export default { ...@@ -158,6 +271,9 @@ export default {
.conclusion { .conclusion {
color: #c7c7c7; color: #c7c7c7;
font-size: 11.2px; font-size: 11.2px;
.have {
color: #000;
}
} }
.label { .label {
font-size: 11.2px; font-size: 11.2px;
......
<template>
<!-- 机房巡检操作 -->
<view>
<view v-for="(item, index) in itemData.detail" :key="index">
<template
v-if="!(index > 2 && itemData.detail[2].inspectionResult === 1)"
>
<view class="form-item">
<text class="form-label"
><text class="required">*</text>{{ item.label }}</text
>
<view class="switch-container">
<view
:class="['status-btn', { active: item.inspectionResult === 0 }]"
@click="setInspectionResult(index, 0, item.lableArr[0])"
>
{{ item.lableArr[0] }}
</view>
<view
:class="['status-btn', { active: item.inspectionResult === 1 }]"
@click="setInspectionResult(index, 1, item.lableArr[1])"
>
{{ item.lableArr[1] }}
</view>
</view>
</view>
<view v-if="'conclusion' in item" class="form-item">
<text class="form-label"
><text class="required">*</text>情况摘要</text
>
<text class="conclusion" @click="showPopup(index)">{{
item.conclusion || "请输入情况摘要"
}}</text>
</view>
<view class="form-item" v-if="'photos' in item">
<text class="form-label"
><text class="required">*</text>现场照片</text
>
<view class="photo-box">
<view class="photo-container">
<view @click="takePhoto(index)" class="photo-btn"> + </view>
<view
v-for="(photo, itemIndex) in item && item.photos"
:key="itemIndex"
class="photo-item"
>
<image :src="photo" class="photo"></image>
<text
class="delete-photo"
@click="deletePhoto(index, itemIndex)"
>×</text
>
</view>
</view>
<view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
>
</view>
</view></template
> </view
><custom-popup
ref="customPopup"
:inspectionItem="inspectionItem"
@confirm="handlePopupConfirm"
></custom-popup>
</view>
</template>
<script>
import customPopup from "./customPopup.vue";
import _ from "lodash";
export default {
components: {
customPopup,
},
props: {
// 父组件传递的巡检状态
status: {
type: Number,
default: 0,
},
// 父组件传递的巡检事项名
inspectionItem: {
type: String,
default: "",
},
// 父组件传递的数据
defaultData: {
type: Object,
default: {},
},
},
data() {
return {
currentIndex: 0, // 当前操作的索引
photos: [],
itemData: {
isValid: false, // false是校验未通过 true是校验通过
// status: 0, 0是未巡检 1是已巡检 2巡检异常 statusLabel: "未巡检",
inspectionItem: "", //巡检事项
detail: [
{
label: "门禁功能",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
{
label: "门禁外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "是否有监控",
inspectionResult: 0,
inspectionResultLable: "有监控",
lableArr: ["有监控", "无监控"],
},
{
label: "监控外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "监控画面清晰",
inspectionResult: 0,
inspectionResultLable: "清晰",
lableArr: ["清晰", "模糊"],
conclusion: "",
photos: [],
},
{
label: "监控存储连续",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
],
},
};
},
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
},
mounted() {
if (Object.keys(this.defaultData).length !== 0) {
this.itemData = this.defaultData;
}
},
methods: {
// 拍照
takePhoto(index) {
uni.chooseImage({
count: 1,
sourceType: ["camera"], // 可以从相机拍摄
success: async (res) => {
if (this.photos.length < 5) {
const base64 = await this.convertFileToBase64(res.tempFilePaths[0]);
this.itemData.detail[index].photos.push(base64);
} else {
uni.showToast({
title: "最多只能上传5张照片",
icon: "none",
});
}
},
});
},
// 转化为base64
convertFileToBase64(filePath) {
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
filePath,
function (entry) {
entry.file(
function (file) {
const reader = new plus.io.FileReader();
reader.onloadend = function (evt) {
const base64 = evt.target.result; // 获取 Base64 数据
resolve(base64); // 返回 Base64 数据
};
reader.readAsDataURL(file); // 读取文件并转换为 Base64
},
function (error) {
reject("获取文件对象失败:" + error.message);
}
);
},
function (error) {
reject("解析文件路径失败:" + error.message);
}
);
});
},
// 删除照片
deletePhoto(index, itemIndex) {
this.itemData.detail[index].photos.splice(itemIndex, 1);
},
// 设置巡检结论
setInspectionResult(index, value, label) {
this.itemData.detail[index].inspectionResult = value; // 0正常 1异常
this.itemData.detail[index].inspectionResultLable = label;
},
// 显示弹窗
showPopup(index) {
this.currentIndex = index;
this.$refs.customPopup.open();
},
// 处理弹窗确认
handlePopupConfirm(summary) {
this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域
},
// 处理】数据
getFromData() {
console.log(111, this.itemData);
const isValid = this.areAllObjectsValid(this.itemData.detail,2); //false不通过 true通过
// const isAllOne = this.areAllInspectionResultsOne(this.itemData.detail);
this.itemData.isValid = isValid;
this.itemData.inspectionItem = this.inspectionItem;
console.log(222, this.itemData);
// if (isAllOne) {
// // 全都是正常
// this.itemData.status = 1; //1表示已经巡检过没有异常
// this.itemData.statusLabel = "已巡检";
// } else {
// this.itemData.status = 2; //1表示已经巡检过有异常
// this.itemData.statusLabel = "巡检异常";
// }
// console.log(this.itemData);
return this.itemData;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid(arr, skipIndex) {
// 遍历数组中的每个对象
for (let i = 0; i < arr.length; i++) {
const obj = arr[i];
// 如果当前索引大于等于 skipIndex,并且 inspectionResult 为 1,则跳过后续校验
if (i >= skipIndex && obj.inspectionResult === 1) {
break;
}
// 检查对象中的每个属性是否有值
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
// 如果属性值为空(null, undefined, 空字符串等),则校验不通过
if (
obj[key] === null ||
obj[key] === undefined ||
obj[key] === ""
) {
return false;
}
}
}
}
// 如果所有对象都通过校验,返回 true
return true;
},
// 校验是否有异常
areAllInspectionResultsOne(arr) {
return arr.every((obj) => obj.inspectionResult === 0);
},
},
};
</script>
<style scoped lang="less">
.form-item {
display: flex;
align-items: center;
padding: 9.6px 0;
line-height: 28.8px;
border-bottom: 0.8px solid #f2f3f5;
.form-label {
font-size: 11.2px;
margin-right: 25.6px;
width: 88px;
text-align: right;
color: #7c7c7c;
.required {
color: red;
margin-right: 3.2px;
}
}
.conclusion {
color: #c7c7c7;
font-size: 11.2px;
.have {
color: #000;
}
}
.label {
font-size: 11.2px;
}
.switch-container {
display: flex;
gap: 9.6px;
.status-btn {
flex: 1;
padding: 5.6px 19.2px;
font-size: 12.8px;
color: #000000;
background: #f2f2f2;
text-align: center;
font-weight: 400;
line-height: 17.6px;
border-radius: 14.4px;
&.active {
color: #ffffff;
background: #3774f6;
border: 0.32px solid rgba(224, 224, 224, 1);
}
}
}
.input-box {
flex: 1;
border-radius: 3.2px;
font-size: 12.8px;
line-height: 19.2px;
}
.photo-limit {
font-size: 12.8px;
color: #959595;
line-height: 19.2px;
font-weight: 400;
}
.photo-container {
display: flex;
flex-wrap: wrap;
margin-bottom: 6.4px;
.photo-item {
position: relative;
margin-right: 6.4px;
margin-bottom: 6.4px;
.photo {
width: 57.6px;
height: 57.6px;
border-radius: 3.2px;
margin-left: 9.6px;
}
.delete-photo {
position: absolute;
top: -6.4px;
right: -6.4px;
background-color: #ff4d4f;
color: #fff;
width: 12.8px;
height: 12.8px;
border-radius: 50%;
text-align: center;
line-height: 12.8px;
font-size: 9.6px;
}
}
}
.photo-btn {
background: #ffffff;
border: 0.272px solid rgba(221, 221, 221, 1);
border-radius: 1.64px;
width: 57.6px;
height: 57.6px;
font-size: 57.6px;
color: #cccccc;
text-align: center;
line-height: 51.2px;
}
}
</style>
<template>
<!-- 机房巡检操作 -->
<view>
<view v-for="(item, index) in itemData.detail" :key="index">
<template
v-if="!(index > 2 && itemData.detail[2].inspectionResult === 1)"
>
<view class="form-item">
<text class="form-label"
><text class="required">*</text>{{ item.label }}</text
>
<view class="switch-container">
<view
:class="['status-btn', { active: item.inspectionResult === 0 }]"
@click="setInspectionResult(index, 0, item.lableArr[0])"
>
{{ item.lableArr[0] }}
</view>
<view
:class="['status-btn', { active: item.inspectionResult === 1 }]"
@click="setInspectionResult(index, 1, item.lableArr[1])"
>
{{ item.lableArr[1] }}
</view>
</view>
</view>
<view v-if="'conclusion' in item" class="form-item">
<text class="form-label"
><text class="required">*</text>情况摘要</text
>
<text class="conclusion" @click="showPopup(index)">{{
item.conclusion || "请输入情况摘要"
}}</text>
</view>
<view class="form-item" v-if="'photos' in item">
<text class="form-label"
><text class="required">*</text>现场照片</text
>
<view class="photo-box">
<view class="photo-container">
<view @click="takePhoto(index)" class="photo-btn"> + </view>
<view
v-for="(photo, itemIndex) in item && item.photos"
:key="itemIndex"
class="photo-item"
>
<image :src="photo" class="photo"></image>
<text
class="delete-photo"
@click="deletePhoto(index, itemIndex)"
>×</text
>
</view>
</view>
<view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
>
</view>
</view></template
> </view
><custom-popup
ref="customPopup"
:inspectionItem="inspectionItem"
@confirm="handlePopupConfirm"
></custom-popup>
</view>
</template>
<script>
import customPopup from "./customPopup.vue";
import _ from "lodash";
export default {
components: {
customPopup,
},
props: {
// 父组件传递的巡检状态
status: {
type: Number,
default: 0,
},
// 父组件传递的巡检事项名
inspectionItem: {
type: String,
default: "",
},
// 父组件传递的数据
defaultData: {
type: Object,
default: {},
},
},
data() {
return {
currentIndex: 0, // 当前操作的索引
photos: [],
itemData: {
isValid: false, // false是校验未通过 true是校验通过
// status: 0, 0是未巡检 1是已巡检 2巡检异常 statusLabel: "未巡检",
inspectionItem: "", //巡检事项
detail: [
{
label: "门禁功能",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
{
label: "门禁外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "是否有监控",
inspectionResult: 0,
inspectionResultLable: "有监控",
lableArr: ["有监控", "无监控"],
},
{
label: "监控外观破损",
inspectionResult: 0,
inspectionResultLable: "无",
lableArr: ["无", "有"],
conclusion: "",
photos: [],
},
{
label: "监控画面清晰",
inspectionResult: 0,
inspectionResultLable: "清晰",
lableArr: ["清晰", "模糊"],
conclusion: "",
photos: [],
},
{
label: "监控存储连续",
inspectionResult: 0,
inspectionResultLable: "正常",
lableArr: ["正常", "异常"],
conclusion: "",
photos: [],
},
],
},
};
},
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
},
mounted() {
if (Object.keys(this.defaultData).length !== 0) {
this.itemData = this.defaultData;
}
},
methods: {
// 拍照
takePhoto(index) {
uni.chooseImage({
count: 1,
sourceType: ["camera"], // 可以从相机拍摄
success: async (res) => {
if (this.photos.length < 5) {
const base64 = await this.convertFileToBase64(res.tempFilePaths[0]);
this.itemData.detail[index].photos.push(base64);
} else {
uni.showToast({
title: "最多只能上传5张照片",
icon: "none",
});
}
},
});
},
// 转化为base64
convertFileToBase64(filePath) {
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
filePath,
function (entry) {
entry.file(
function (file) {
const reader = new plus.io.FileReader();
reader.onloadend = function (evt) {
const base64 = evt.target.result; // 获取 Base64 数据
resolve(base64); // 返回 Base64 数据
};
reader.readAsDataURL(file); // 读取文件并转换为 Base64
},
function (error) {
reject("获取文件对象失败:" + error.message);
}
);
},
function (error) {
reject("解析文件路径失败:" + error.message);
}
);
});
},
// 删除照片
deletePhoto(index, itemIndex) {
this.itemData.detail[index].photos.splice(itemIndex, 1);
},
// 设置巡检结论
setInspectionResult(index, value, label) {
this.itemData.detail[index].inspectionResult = value; // 0正常 1异常
this.itemData.detail[index].inspectionResultLable = label;
},
// 显示弹窗
showPopup(index) {
this.currentIndex = index;
this.$refs.customPopup.open();
},
// 处理弹窗确认
handlePopupConfirm(summary) {
this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域
},
// 处理】数据
getFromData() {
console.log(111, this.itemData);
const isValid = this.areAllObjectsValid(this.itemData.detail,2); //false不通过 true通过
// const isAllOne = this.areAllInspectionResultsOne(this.itemData.detail);
this.itemData.isValid = isValid;
this.itemData.inspectionItem = this.inspectionItem;
console.log(222, this.itemData);
// if (isAllOne) {
// // 全都是正常
// this.itemData.status = 1; //1表示已经巡检过没有异常
// this.itemData.statusLabel = "已巡检";
// } else {
// this.itemData.status = 2; //1表示已经巡检过有异常
// this.itemData.statusLabel = "巡检异常";
// }
// console.log(this.itemData);
return this.itemData;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid(arr, skipIndex) {
// 遍历数组中的每个对象
for (let i = 0; i < arr.length; i++) {
const obj = arr[i];
// 如果当前索引大于等于 skipIndex,并且 inspectionResult 为 1,则跳过后续校验
if (i >= skipIndex && obj.inspectionResult === 1) {
break;
}
// 检查对象中的每个属性是否有值
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
// 如果属性值为空(null, undefined, 空字符串等),则校验不通过
if (
obj[key] === null ||
obj[key] === undefined ||
obj[key] === ""
) {
return false;
}
}
}
}
// 如果所有对象都通过校验,返回 true
return true;
},
// 校验是否有异常
areAllInspectionResultsOne(arr) {
return arr.every((obj) => obj.inspectionResult === 0);
},
},
};
</script>
<style scoped lang="less">
.form-item {
display: flex;
align-items: center;
padding: 9.6px 0;
line-height: 28.8px;
border-bottom: 0.8px solid #f2f3f5;
.form-label {
font-size: 11.2px;
margin-right: 25.6px;
width: 88px;
text-align: right;
color: #7c7c7c;
.required {
color: red;
margin-right: 3.2px;
}
}
.conclusion {
color: #c7c7c7;
font-size: 11.2px;
.have {
color: #000;
}
}
.label {
font-size: 11.2px;
}
.switch-container {
display: flex;
gap: 9.6px;
.status-btn {
flex: 1;
padding: 5.6px 19.2px;
font-size: 12.8px;
color: #000000;
background: #f2f2f2;
text-align: center;
font-weight: 400;
line-height: 17.6px;
border-radius: 14.4px;
&.active {
color: #ffffff;
background: #3774f6;
border: 0.32px solid rgba(224, 224, 224, 1);
}
}
}
.input-box {
flex: 1;
border-radius: 3.2px;
font-size: 12.8px;
line-height: 19.2px;
}
.photo-limit {
font-size: 12.8px;
color: #959595;
line-height: 19.2px;
font-weight: 400;
}
.photo-container {
display: flex;
flex-wrap: wrap;
margin-bottom: 6.4px;
.photo-item {
position: relative;
margin-right: 6.4px;
margin-bottom: 6.4px;
.photo {
width: 57.6px;
height: 57.6px;
border-radius: 3.2px;
margin-left: 9.6px;
}
.delete-photo {
position: absolute;
top: -6.4px;
right: -6.4px;
background-color: #ff4d4f;
color: #fff;
width: 12.8px;
height: 12.8px;
border-radius: 50%;
text-align: center;
line-height: 12.8px;
font-size: 9.6px;
}
}
}
.photo-btn {
background: #ffffff;
border: 0.272px solid rgba(221, 221, 221, 1);
border-radius: 1.64px;
width: 57.6px;
height: 57.6px;
font-size: 57.6px;
color: #cccccc;
text-align: center;
line-height: 51.2px;
}
}
</style>
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
</template> </template>
<script> <script>
import moment from "moment"; import moment from "moment";
import { pad_1_1_inspection_position } from "@/utils/dictJF.js"; import { pad_all_inspection_position } from "@/utils/dict.js";
import { getInspectionDetails } from "@/request/index.js"; import { getInspectionDetails } from "@/request/index.js";
export default { export default {
data() { data() {
...@@ -126,7 +126,7 @@ export default { ...@@ -126,7 +126,7 @@ export default {
methods: { methods: {
init() { init() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let list = pad_1_1_inspection_position.rows.map((item, index) => { let list = pad_all_inspection_position.rows.map((item, index) => {
return item; return item;
}); });
const group1 = list.slice(0, 5); const group1 = list.slice(0, 5);
......
...@@ -52,73 +52,22 @@ ...@@ -52,73 +52,22 @@
></image ></image
></view> ></view>
<!-- 操作区域 --> <!-- 操作区域 -->
<wlhj :inspectionItem="tabs[activeTab].label"></wlhj> <!-- 物理环境 -->
<view class="form-item" <wlhj
><text class="form-label">巡检项</text> v-show="checkValueInArray(tabs, 'wlhj', activeTab)"
<view class="label"> ref="wlhj"
<text>{{ tabs[activeTab].label }}</text> :inspectionItem="tabs[activeTab].label"
:defaultData="{}"
></wlhj>
<!-- 安防系统 -->
<afxt
v-show="checkValueInArray(tabs, 'afxt', activeTab)"
ref="afxt"
:inspectionItem="tabs[activeTab].label"
:defaultData="{}"
></afxt>
</view> </view>
</view> </view>
<view class="form-item">
<text class="form-label"
><text class="required">*</text>巡检结论</text
>
<view class="switch-container">
<view
:class="['status-btn', { active: inspectionResult === 0 }]"
@click="setInspectionResult(0)"
>
正常
</view>
<view
:class="['status-btn', { active: inspectionResult === 1 }]"
@click="setInspectionResult(1)"
>
异常
</view>
</view>
</view>
<view class="form-item">
<text class="form-label"
><text class="required">*</text>情况摘要</text
>
<input
class="input-box"
v-model="list[activeTab] && list[activeTab].conclusion"
placeholder="请输入情况摘要"
/>
</view>
<view class="form-item">
<text class="form-label">现场照片</text>
<view class="photo-box">
<view class="photo-container">
<view @click="takePhoto" class="photo-btn"> + </view>
<view
v-for="(photo, index) in list[activeTab] &&
list[activeTab].photos"
:key="index"
class="photo-item"
>
<image :src="photo" class="photo"></image>
<text class="delete-photo" @click="deletePhoto(index)">×</text>
</view>
</view>
<view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
>
</view>
</view>
</view>
</view>
<!-- 模块4:提交模块 -->
<!-- <view class="module submit-module">
<button class="action-btn" @click="saveDraft">暂存</button>
<button class="action-btn complete-btn" @click="complete">
完成
</button>
</view> -->
<view class="submit-module"> <view class="submit-module">
<button class="action-btn" @click="submit(0)">暂存</button> <button class="action-btn" @click="submit(0)">暂存</button>
<button <button
...@@ -132,22 +81,6 @@ ...@@ -132,22 +81,6 @@
下一项 下一项
</button> </button>
</view> </view>
<!-- 使用 uni-popup 组件 完成弹窗 -->
<uni-popup ref="popup" type="center">
<view class="popup-content">
<!-- 关闭按钮 -->
<view class="close-icon" @click="closePopup">×</view>
<!-- 成功图标 -->
<view class="icon-success">✔️</view>
<!-- 保存成功的文字 -->
<view class="success-text">保存成功</view>
<!-- 下一项按钮 -->
<view class="next-button" @click="closePopup">下一项</view>
</view>
</uni-popup>
</view> </view>
</template> </template>
...@@ -156,6 +89,8 @@ import { ...@@ -156,6 +89,8 @@ import {
pad_2_1_inspection_items, pad_2_1_inspection_items,
pad_2_1_inspection_position, pad_2_1_inspection_position,
pad_2_1_floor, pad_2_1_floor,
tabsInfo1,
tabsInfo2,
} from "@/utils/dict.js"; //巡检位置,A座到F座 楼层2楼4楼到26楼 } from "@/utils/dict.js"; //巡检位置,A座到F座 楼层2楼4楼到26楼
import { import {
addLog, addLog,
...@@ -167,11 +102,27 @@ import { ...@@ -167,11 +102,27 @@ import {
import { getInspectionDetails } from "@/request/index.js"; import { getInspectionDetails } from "@/request/index.js";
import moment from "moment"; import moment from "moment";
import _ from "lodash"; import _ from "lodash";
import wlhj from "./model/wlhj.vue"; //物理环境 import wlhj from "./components/wlhj.vue"; //物理环境
import afxt from "./components/afxt.vue"; //安防系统
import sbgj from "./components/sbgj.vue"; //设备告警
import dczt from "./components/dczt.vue"; //电池状态
import jfwsd from "./components/sbgj.vue"; //机房温湿度
import dlxt from "./components/afxt.vue"; //电力系统
import xfxt from "./components/xfxt.vue"; //消防系统
import xlqk from "./components/xlqk.vue"; //线路情况
import qt from "./components/qt.vue"; //其它
export default { export default {
components: { components: {
wlhj, wlhj,
afxt,
sbgj,
dczt,
jfwsd,
dlxt,
xfxt,
xlqk,
qt,
}, },
data() { data() {
return { return {
...@@ -181,92 +132,9 @@ export default { ...@@ -181,92 +132,9 @@ export default {
inspectionCode: "", inspectionCode: "",
isSubmitEnabled: false, // 提交按钮是否可点击 isSubmitEnabled: false, // 提交按钮是否可点击
uid: "", uid: "",
jfType: 0, jfType: "2",
randomDescription: "这是一段随机说明文字。", // 随机说明文字 randomDescription: "这是一段随机说明文字。", // 随机说明文字
tabs: [ tabs: [],
{
label: "物理环境",
icon: "../../static/img/add-img/home1.png",
text: [
"1、地板、墙壁:检查地板是否平整,无凹陷或凸起,确保设备放置平稳;检查墙面是否完整,无脱落、开裂或霉变现象。",
"‌2、机房清洁:机房内应保持清洁,无悬浮颗粒物、无积水、无异味;机柜及设备表面应无灰尘‌。",
"机房通风:确保机房通风设施正常运转。",
"4、机房照明:应急照明和疏散指示灯功能正常‌。",
"5、漏水检测:检查机房内外地面排水系统、水阀门的完好性、漏水情况、墙体的渗漏情况、水管是否完好、窗户是否紧固等‌。",
],
},
{
label: "安防系统",
icon: "../../static/img/add-img/home1.png",
text: [
"1、门禁:门禁系统是否正常运作;门禁外观无破损。",
"2、监控:有监控的机房需确保监控摄像头‌设备正常运作;监控摄像头外观无破损。",
],
},
this.jfType === 2 || this.jfType === 3
? {
label: "设备告警",
icon: "../../static/img/add-img/home1.png",
text: [
"检查服务器、存储设备、网络设备(如交换机、路由器)等机房设备是否有异响或故障报警。‌",
],
}
: {
label: "电池状态",
icon: "../../static/img/add-img/home1.png",
text: [
"1、定期检查机房电池设备的外观是否完好无损,确保没有破损或腐蚀现象‌;",
"‌2、使用温度计检测电池组的温度,确保其工作温度在耐受范围内(15℃-30℃);并确认电池内阻在耐受范围内( <10mΩ)。",
"‌3、检查电池的容量是否在正常范围内;检查电池的连接状态,确保没有松动或损坏的连接‌。",
"‌4、定期检查电池的充电状态,确保电池组能够正常充电,并且充电过程中没有异常现象‌。",
],
},
{
label: "机房温湿度",
icon: "../../static/img/add-img/home1.png",
text: [
"机房内的温度应控制在25°C,湿度应在20%-70%之间。超出这个范围可能会影响设备的正常运行和寿命‌。",
],
},
{
label: "电力系统",
icon: "../../static/img/add-img/home1.png",
text: [
"1、检查主电源和备用电源(如UPS)是否正常工作;",
"‌2、检查UPS设备的电力状态和工作情况;如果配备发电机,需检查其启动和运行状态;",
"‌3、检查机房的电力线路是否稳定,确保没有裸露、老化或损坏的情况‌;",
"‌4、检查配电柜、开关等设备的运行状态,确保其正常工作,没有异常声音或气味‌;",
"5、检查机房设备的接地线路是否良好;",
"‌6、检查防雷设施是否正常工作;",
"7、‌定期测试备用电源的启动和运行情况,确保在紧急情况下能够迅速切换。‌",
],
},
{
label: "消防系统",
icon: "../../static/img/add-img/home1.png",
text: [
"‌1、确保机房内配备足够数量的消防设施,如灭火器、消防栓、烟雾报警器。",
"‌2、检查消防设施‌是否符合标准,定期检查电线和电缆,确保没有裸露、老化等问题。",
"3、检查机房应疏散指示和标志是否清晰;确保机房紧急出口畅通无阻‌。",
],
},
{
label: "线路情况",
icon: "../../static/img/add-img/home1.png",
text: [
"1、机柜:检查机柜及设备表面是否有灰尘;检查机柜标识和标签是否清晰牢固;‌",
"2、配线架:检查线路的布线是否整齐,无交叉或混乱现象。",
"3、电力线路:检查外观是否有破损; 接地装置完整性等。",
],
},
{
label: "其它",
icon: "../../static/img/add-img/home1.png",
text: [
"检查地面、墙壁、天花板、是否有裂痕、水渍,机房内是否有鼠患、蚁患、蟑螂活动的痕迹。",
],
},
],
activeTab: 0, // 当前选中的 Tab activeTab: 0, // 当前选中的 Tab
inspectionResult: 0, // Switch 值(0: 正常, 1: 异常) inspectionResult: 0, // Switch 值(0: 正常, 1: 异常)
conclusion: "", // 情况摘要 conclusion: "", // 情况摘要
...@@ -301,6 +169,8 @@ export default { ...@@ -301,6 +169,8 @@ export default {
this.dictValue = options.dictValue; this.dictValue = options.dictValue;
this.inspectionCode = options.inspectionCode; this.inspectionCode = options.inspectionCode;
console.log("options", options); console.log("options", options);
this.tabs =
this.jfType === "2" || this.jfType === "3" ? tabsInfo2 : tabsInfo1;
if (options.uid) { if (options.uid) {
this.getDetails(options.uid); this.getDetails(options.uid);
...@@ -319,7 +189,7 @@ export default { ...@@ -319,7 +189,7 @@ export default {
this.baseInfo = { this.baseInfo = {
inspectionType: "2", inspectionType: "2",
inspectionCode: this.inspectionCode, inspectionCode: this.inspectionCode,
recordName: `${moment().format("yyyyMMDD")}-井道巡检`, recordName: `${moment().format("yyyyMMDD")}-机房巡检`,
inspectionTime: moment().format("yyyy-MM-DD HH:mm"), inspectionTime: moment().format("yyyy-MM-DD HH:mm"),
inspectionBy: this.$store.state.now_user.user, inspectionBy: this.$store.state.now_user.user,
inspectionById: this.$store.state.now_user.userId, inspectionById: this.$store.state.now_user.userId,
...@@ -368,6 +238,15 @@ export default { ...@@ -368,6 +238,15 @@ export default {
uni.hideLoading(); uni.hideLoading();
}); });
}, },
// 根据数据来判断组件
checkValueInArray(arr, str, num) {
for (let i = 0; i < arr.length; i++) {
if (arr[i].value === str && i === num) {
return true;
}
}
return false;
},
// 数据结构重组 // 数据结构重组
coverlist() { coverlist() {
// 获取井道巡检的三个检查项固定数据再进行处理 // 获取井道巡检的三个检查项固定数据再进行处理
...@@ -556,8 +435,12 @@ export default { ...@@ -556,8 +435,12 @@ export default {
}, },
// 提交 // 提交
submit(isSubmit = 1) { submit(isSubmit = 1) {
console.log("all", this.getAllChildFormData());
let paramsObj = this.getAllChildFormData();
return false
let allValid = this.allValid(paramsObj);
// 校验是否通过 // 校验是否通过
if (isSubmit && !this.isAllTabValid()) { if (isSubmit && !allValid) {
uni.showToast({ uni.showToast({
title: "请填写完整必填项", title: "请填写完整必填项",
icon: "none", icon: "none",
...@@ -618,6 +501,29 @@ export default { ...@@ -618,6 +501,29 @@ export default {
url: "/pages/inspectionManagement/index", url: "/pages/inspectionManagement/index",
}); });
}, },
// 获取子组件数据
getAllChildFormData() {
// 获取所有子组件实例
const allData = {};
// 遍历 ref 名称数组
this.tabs.forEach((item) => {
let refName = item.value;
// 通过 this.$refs[refName] 获取子组件实例
const childComponent = this.$refs[refName];
if (childComponent && childComponent.getFromData) {
// 调用子组件的 getFromData 方法,获取数据
allData[refName] = childComponent.getFromData();
}
});
console.log("所有子组件的数据:", allData);
return allData;
},
// 判断所有tab下的数据是否通过校验
allValid(arr) {
return arr.every((item) => item.isValid === true);
},
// 检查所有Tab 的必填项是否填写完整 // 检查所有Tab 的必填项是否填写完整
isAllTabValid() { isAllTabValid() {
const data = this.list; const data = this.list;
...@@ -633,27 +539,16 @@ export default { ...@@ -633,27 +539,16 @@ export default {
console.log(141, isValid); console.log(141, isValid);
return isValid; return isValid;
}, },
// 检查当前 Tab 的必填项是否填写完整
isCurrentTabValid() {
const currentTabData = this.list[this.activeTab];
console.log("currentTabData", currentTabData);
return (
currentTabData.inspectionResult !== null && // 巡检结论必填
currentTabData.conclusion.trim() !== "" // 情况摘要必填
// 现场照片为非必填项,不做校验
);
},
// 下一项 // 下一项
nextTab() { nextTab() {
console.log(5215415, this.isCurrentTabValid()); // if (!this.isCurrentTabValid()) {
if (!this.isCurrentTabValid()) { // uni.showToast({
uni.showToast({ // title: "请填写完整必填项",
title: "请填写完整必填项", // icon: "none",
icon: "none", // });
}); // return false;
return false; // }
} if (this.activeTab === this.tabs.length - 1) {
if (this.activeTab === 2) {
this.isSubmitEnabled = true; this.isSubmitEnabled = true;
} else { } else {
this.switchTab(this.activeTab + 1); this.switchTab(this.activeTab + 1);
...@@ -662,6 +557,9 @@ export default { ...@@ -662,6 +557,9 @@ export default {
// 切换 Tab // 切换 Tab
switchTab(index) { switchTab(index) {
this.activeTab = index; this.activeTab = index;
if (this.activeTab !== this.tabs.length - 1) {
this.isSubmitEnabled = false;
}
this.updateCurrentTabData(); this.updateCurrentTabData();
}, // 设置巡检结论 }, // 设置巡检结论
setInspectionResult(value) { setInspectionResult(value) {
......
<template>
<view class="container">
<!-- 表单区域 -->
<view class="form">
<view
class="form-item"
v-for="(item, index) in formData"
:key="index"
>
<!-- 文字显示区域 -->
<view class="text-display" @click="showPopup(index)">
{{ item.text || '点击输入文字' }}
</view>
<!-- 图片上传区域 -->
<view class="image-upload">
<image
v-if="item.image"
:src="item.image"
mode="aspectFill"
class="uploaded-image"
></image>
<button @click="uploadImage(index)">上传图片</button>
</view>
</view>
</view>
<!-- 提交按钮 -->
<button class="submit-btn" @click="submitForm">提交</button>
<!-- 自定义弹窗组件 -->
<custom-popup
ref="customPopup"
:inspection-item="currentInspectionItem"
:fixed-words="fixedWords"
@confirm="handlePopupConfirm"
></custom-popup>
</view>
</template>
<script>
import CustomPopup from '@/components/CustomPopup.vue';
export default {
components: {
CustomPopup
},
data() {
return {
formData: [
{ text: '', image: '' },
{ text: '', image: '' },
{ text: '', image: '' },
{ text: '', image: '' },
{ text: '', image: '' }
],
currentIndex: -1, // 当前操作的索引
currentInspectionItem: '巡检事项', // 当前巡检事项
fixedWords: ['漏水', '损坏', '正常', '异常'] // 固定词
};
},
methods: {
// 显示弹窗
showPopup(index) {
this.currentIndex = index;
this.$refs.customPopup.open();
},
// 处理弹窗确认
handlePopupConfirm(summary) {
if (this.currentIndex !== -1) {
this.formData[this.currentIndex].text = summary; // 回显到文字显示区域
this.currentIndex = -1;
}
},
// 上传图片
uploadImage(index) {
uni.chooseImage({
count: 1,
success: (res) => {
if (this.formData[index].image) {
uni.showToast({
title: '每组只能上传一张图片',
icon: 'none'
});
return;
}
this.formData[index].image = res.tempFilePaths[0]; // 保存图片路径
}
});
},
// 提交表单
submitForm() {
let isValid = true;
this.formData.forEach((item, index) => {
if (!item.text || !item.image) {
isValid = false;
uni.showToast({
title: `第 ${index + 1} 组数据未填写完整`,
icon: 'none'
});
}
});
if (isValid) {
uni.showToast({
title: '提交成功',
icon: 'success'
});
console.log('提交的数据:', this.formData);
// 这里可以处理提交逻辑,比如将数据发送到后端
}
}
}
};
</script>
<style scoped>
.container {
padding: 20px;
}
.form {
margin-bottom: 20px;
}
.form-item {
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 8px;
padding: 10px;
}
.text-display {
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
margin-bottom: 10px;
cursor: pointer;
}
.image-upload {
display: flex;
align-items: center;
}
.uploaded-image {
width: 100px;
height: 100px;
margin-right: 10px;
border-radius: 5px;
}
.submit-btn {
background-color: #007aff;
color: #fff;
padding: 10px;
border-radius: 5px;
text-align: center;
}
</style>
\ No newline at end of file
...@@ -593,7 +593,8 @@ export default { ...@@ -593,7 +593,8 @@ export default {
switchTab(index) { switchTab(index) {
this.activeTab = index; this.activeTab = index;
this.updateCurrentTabData(); this.updateCurrentTabData();
}, // 设置巡检结论 },
// 设置巡检结论
setInspectionResult(value) { setInspectionResult(value) {
console.log("value", value); console.log("value", value);
this.inspectionResult = value; this.inspectionResult = value;
......
...@@ -1164,8 +1164,8 @@ export const pad_2_1_floor = { ...@@ -1164,8 +1164,8 @@ export const pad_2_1_floor = {
status: "0", status: "0",
default: false, default: false,
statusLable: "未巡检", statusLable: "未巡检",
details: [],//数据 details: [], //数据
isSubmit: 0,//提交状态 isSubmit: 0, //提交状态
}, },
{ {
createBy: "admin", createBy: "admin",
...@@ -1428,3 +1428,412 @@ export const pad_room_type = { ...@@ -1428,3 +1428,412 @@ export const pad_room_type = {
status: null, status: null,
map: null, map: null,
}; };
// 机房巡检_机房巡检_位置
export const pad_all_inspection_position = {
total: 11,
rows: [
{
createBy: "admin",
createTime: "2024-09-05 15:51:21",
updateBy: null,
updateTime: null,
remark: null,
dictCode: 1276,
dictSort: 1,
dictLabel: "F座3楼-内环屏蔽机房",
dictValue: "1",
dictType: "pad_1_1_inspection_items",
cssClass: null,
listClass: "default",
isDefault: "N",
status: "0",
default: false,
statusLable: "未巡检",
details: [], //数据
isSubmit: 0,
jfType: "0", //机房类型 0屏蔽 1汇聚 2电池间(1) 3电池间(2)
},
{
createBy: "admin",
createTime: "2024-09-05 15:51:35",
updateBy: null,
updateTime: null,
remark: null,
dictCode: 1277,
dictSort: 2,
dictLabel: "F座3楼-外环屏蔽机房",
dictValue: "2",
dictType: "pad_1_1_inspection_items",
cssClass: null,
listClass: "default",
isDefault: "N",
status: "0",
default: false,
statusLable: "未巡检",
details: [],
isSubmit: 0,
jfType: "0",
},
{
createBy: "admin",
createTime: "2024-09-05 15:51:41",
updateBy: null,
updateTime: null,
remark: null,
dictCode: 1278,
dictSort: 3,
dictLabel: "F座2楼-汇聚机房",
dictValue: "3",
dictType: "pad_1_1_inspection_items",
cssClass: null,
listClass: "default",
isDefault: "N",
status: "0",
default: false,
statusLable: "未巡检",
details: [],
isSubmit: 0,
jfType: "1",
},
{
createBy: "admin",
createTime: "2024-09-05 15:51:49",
updateBy: null,
updateTime: null,
remark: null,
dictCode: 1279,
dictSort: 4,
dictLabel: "A座2楼-汇聚机房",
dictValue: "4",
dictType: "pad_1_1_inspection_items",
cssClass: null,
listClass: "default",
isDefault: "N",
status: "0",
default: false,
statusLable: "未巡检",
details: [],
isSubmit: 0,
jfType: "1",
},
{
createBy: "admin",
createTime: "2024-09-05 15:51:56",
updateBy: null,
updateTime: null,
remark: null,
dictCode: 1280,
dictSort: 5,
dictLabel: "A座3楼-屏蔽机房",
dictValue: "5",
dictType: "pad_1_1_inspection_items",
cssClass: null,
listClass: "default",
isDefault: "N",
status: "0",
default: false,
statusLable: "未巡检",
details: [],
isSubmit: 0,
jfType: "0",
},
{
createBy: "admin",
createTime: "2024-09-05 15:52:03",
updateBy: null,
updateTime: null,
remark: null,
dictCode: 1281,
dictSort: 6,
dictLabel: "A座1楼-UPS间",
dictValue: "6",
dictType: "pad_1_1_inspection_items",
cssClass: null,
listClass: "default",
isDefault: "N",
status: "0",
default: false,
statusLable: "未巡检",
details: [],
isSubmit: 0,
jfType: "2",
},
{
createBy: "admin",
createTime: "2024-09-05 16:00:57",
updateBy: null,
updateTime: null,
remark: null,
dictCode: 1325,
dictSort: 7,
dictLabel: "B座2楼-汇聚机房",
dictValue: "7",
dictType: "pad_1_1_inspection_items",
cssClass: null,
listClass: "default",
isDefault: "N",
status: "0",
default: false,
statusLable: "未巡检",
details: [],
isSubmit: 0,
jfType: "1",
},
{
createBy: "admin",
createTime: "2024-09-05 16:01:08",
updateBy: null,
updateTime: null,
remark: null,
dictCode: 1326,
dictSort: 8,
dictLabel: "C座2楼-汇聚机房",
dictValue: "8",
dictType: "pad_1_1_inspection_items",
cssClass: null,
listClass: "default",
isDefault: "N",
status: "0",
default: false,
statusLable: "未巡检",
details: [],
isSubmit: 0,
jfType: "1",
},
{
createBy: "admin",
createTime: "2024-09-05 16:01:17",
updateBy: null,
updateTime: null,
remark: null,
dictCode: 1327,
dictSort: 9,
dictLabel: "D座2楼-汇聚机房",
dictValue: "9",
dictType: "pad_1_1_inspection_items",
cssClass: null,
listClass: "default",
isDefault: "N",
status: "0",
default: false,
statusLable: "未巡检",
details: [],
isSubmit: 0,
jfType: "1",
},
{
createBy: "admin",
createTime: "2024-09-05 16:01:26",
updateBy: null,
updateTime: null,
remark: null,
dictCode: 1328,
dictSort: 10,
dictLabel: "E座2楼-汇聚机房",
dictValue: "10",
dictType: "pad_1_1_inspection_items",
cssClass: null,
listClass: "default",
isDefault: "N",
status: "0",
default: false,
statusLable: "未巡检",
details: [],
isSubmit: 0,
jfType: "1",
},
{
createBy: "admin",
createTime: "2024-09-05 16:01:31",
updateBy: null,
updateTime: null,
remark: null,
dictCode: 1329,
dictSort: 11,
dictLabel: "F座2楼-UPS间",
dictValue: "11",
dictType: "pad_1_1_inspection_items",
cssClass: null,
listClass: "default",
isDefault: "N",
status: "0",
default: false,
statusLable: "未巡检",
details: [],
isSubmit: 0,
jfType: "3",
},
],
code: 200,
msg: "查询成功",
status: null,
map: null,
};
// tab配置
export const tabsInfo1 = [
{
label: "物理环境",
value: "wlhj",
icon: "../../static/img/add-img/home1.png",
text: [
"1、地板、墙壁:检查地板是否平整,无凹陷或凸起,确保设备放置平稳;检查墙面是否完整,无脱落、开裂或霉变现象。",
"‌2、机房清洁:机房内应保持清洁,无悬浮颗粒物、无积水、无异味;机柜及设备表面应无灰尘‌。",
"机房通风:确保机房通风设施正常运转。",
"4、机房照明:应急照明和疏散指示灯功能正常‌。",
"5、漏水检测:检查机房内外地面排水系统、水阀门的完好性、漏水情况、墙体的渗漏情况、水管是否完好、窗户是否紧固等‌。",
],
},
{
label: "安防系统",
icon: "../../static/img/add-img/home1.png",
value: "afxt",
text: [
"1、门禁:门禁系统是否正常运作;门禁外观无破损。",
"2、监控:有监控的机房需确保监控摄像头‌设备正常运作;监控摄像头外观无破损。",
],
},
{
label: "设备告警",
value: "sbgj",
icon: "../../static/img/add-img/home1.png",
text: [
"检查服务器、存储设备、网络设备(如交换机、路由器)等机房设备是否有异响或故障报警。‌",
],
},
{
label: "机房温湿度",
value: "jfwsd",
icon: "../../static/img/add-img/home1.png",
text: [
"机房内的温度应控制在25°C,湿度应在20%-70%之间。超出这个范围可能会影响设备的正常运行和寿命‌。",
],
},
{
label: "电力系统",
value: "dlxt",
icon: "../../static/img/add-img/home1.png",
text: [
"1、检查主电源和备用电源(如UPS)是否正常工作;",
"‌2、检查UPS设备的电力状态和工作情况;如果配备发电机,需检查其启动和运行状态;",
"‌3、检查机房的电力线路是否稳定,确保没有裸露、老化或损坏的情况‌;",
"‌4、检查配电柜、开关等设备的运行状态,确保其正常工作,没有异常声音或气味‌;",
"5、检查机房设备的接地线路是否良好;",
"‌6、检查防雷设施是否正常工作;",
"7、‌定期测试备用电源的启动和运行情况,确保在紧急情况下能够迅速切换。‌",
],
},
{
label: "消防系统",
value: "xfxt",
icon: "../../static/img/add-img/home1.png",
text: [
"‌1、确保机房内配备足够数量的消防设施,如灭火器、消防栓、烟雾报警器。",
"‌2、检查消防设施‌是否符合标准,定期检查电线和电缆,确保没有裸露、老化等问题。",
"3、检查机房应疏散指示和标志是否清晰;确保机房紧急出口畅通无阻‌。",
],
},
{
label: "线路情况",
value: "xlqk",
icon: "../../static/img/add-img/home1.png",
text: [
"1、机柜:检查机柜及设备表面是否有灰尘;检查机柜标识和标签是否清晰牢固;‌",
"2、配线架:检查线路的布线是否整齐,无交叉或混乱现象。",
"3、电力线路:检查外观是否有破损; 接地装置完整性等。",
],
},
{
label: "其它",
value: "qt",
icon: "../../static/img/add-img/home1.png",
text: [
"检查地面、墙壁、天花板、是否有裂痕、水渍,机房内是否有鼠患、蚁患、蟑螂活动的痕迹。",
],
},
];
export const tabsInfo2 = [
{
label: "物理环境",
value: "wlhj",
icon: "../../static/img/add-img/home1.png",
text: [
"1、地板、墙壁:检查地板是否平整,无凹陷或凸起,确保设备放置平稳;检查墙面是否完整,无脱落、开裂或霉变现象。",
"‌2、机房清洁:机房内应保持清洁,无悬浮颗粒物、无积水、无异味;机柜及设备表面应无灰尘‌。",
"机房通风:确保机房通风设施正常运转。",
"4、机房照明:应急照明和疏散指示灯功能正常‌。",
"5、漏水检测:检查机房内外地面排水系统、水阀门的完好性、漏水情况、墙体的渗漏情况、水管是否完好、窗户是否紧固等‌。",
],
},
{
label: "安防系统",
value: "afxt",
icon: "../../static/img/add-img/home1.png",
text: [
"1、门禁:门禁系统是否正常运作;门禁外观无破损。",
"2、监控:有监控的机房需确保监控摄像头‌设备正常运作;监控摄像头外观无破损。",
],
},
{
label: "电池状态",
value: "dczt",
icon: "../../static/img/add-img/home1.png",
text: [
"1、定期检查机房电池设备的外观是否完好无损,确保没有破损或腐蚀现象‌;",
"‌2、使用温度计检测电池组的温度,确保其工作温度在耐受范围内(15℃-30℃);并确认电池内阻在耐受范围内( <10mΩ)。",
"‌3、检查电池的容量是否在正常范围内;检查电池的连接状态,确保没有松动或损坏的连接‌。",
"‌4、定期检查电池的充电状态,确保电池组能够正常充电,并且充电过程中没有异常现象‌。",
],
},
{
label: "机房温湿度",
value: "jfwsd",
icon: "../../static/img/add-img/home1.png",
text: [
"机房内的温度应控制在25°C,湿度应在20%-70%之间。超出这个范围可能会影响设备的正常运行和寿命‌。",
],
},
{
label: "电力系统",
value: "dlxt",
icon: "../../static/img/add-img/home1.png",
text: [
"1、检查主电源和备用电源(如UPS)是否正常工作;",
"‌2、检查UPS设备的电力状态和工作情况;如果配备发电机,需检查其启动和运行状态;",
"‌3、检查机房的电力线路是否稳定,确保没有裸露、老化或损坏的情况‌;",
"‌4、检查配电柜、开关等设备的运行状态,确保其正常工作,没有异常声音或气味‌;",
"5、检查机房设备的接地线路是否良好;",
"‌6、检查防雷设施是否正常工作;",
"7、‌定期测试备用电源的启动和运行情况,确保在紧急情况下能够迅速切换。‌",
],
},
{
label: "消防系统",
value: "xfxt",
icon: "../../static/img/add-img/home1.png",
text: [
"‌1、确保机房内配备足够数量的消防设施,如灭火器、消防栓、烟雾报警器。",
"‌2、检查消防设施‌是否符合标准,定期检查电线和电缆,确保没有裸露、老化等问题。",
"3、检查机房应疏散指示和标志是否清晰;确保机房紧急出口畅通无阻‌。",
],
},
{
label: "线路情况",
value: "xlqk",
icon: "../../static/img/add-img/home1.png",
text: [
"1、机柜:检查机柜及设备表面是否有灰尘;检查机柜标识和标签是否清晰牢固;‌",
"2、配线架:检查线路的布线是否整齐,无交叉或混乱现象。",
"3、电力线路:检查外观是否有破损; 接地装置完整性等。",
],
},
{
label: "其它",
value: "qt",
icon: "../../static/img/add-img/home1.png",
text: [
"检查地面、墙壁、天花板、是否有裂痕、水渍,机房内是否有鼠患、蚁患、蟑螂活动的痕迹。",
],
},
];
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论