Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspection-pad-web
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
专网
inspection-pad-web
Commits
59bad0b2
提交
59bad0b2
authored
3月 25, 2026
作者:
何宗全
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
巡检月报和年报
上级
713c576b
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
26 个修改的文件
包含
2086 行增加
和
31 行删除
+2086
-31
index.vue
components/inspectionItem/index.vue
+2
-2
pages.json
pages.json
+0
-22
home.vue
pages/home/home.vue
+6
-6
inspFirst.vue
pages/inspection/inspFirst.vue
+9
-1
detail.vue
pages/inspectionContent/components/detail.vue
+0
-0
detailItem.vue
pages/inspectionContent/components/detailItem.vue
+229
-0
monthFljdxt.vue
pages/inspectionContent/components/monthFljdxt.vue
+368
-0
monthGpdxt.vue
pages/inspectionContent/components/monthGpdxt.vue
+0
-0
monthKtxt.vue
pages/inspectionContent/components/monthKtxt.vue
+0
-0
monthPbxt.vue
pages/inspectionContent/components/monthPbxt.vue
+0
-0
monthUpsxt.vue
pages/inspectionContent/components/monthUpsxt.vue
+0
-0
monthZmxt.vue
pages/inspectionContent/components/monthZmxt.vue
+368
-0
yearDlhjjkxt.vue
pages/inspectionContent/components/yearDlhjjkxt.vue
+368
-0
yearFljdxt.vue
pages/inspectionContent/components/yearFljdxt.vue
+0
-0
yearKtxt.vue
pages/inspectionContent/components/yearKtxt.vue
+368
-0
yearPbxt.vue
pages/inspectionContent/components/yearPbxt.vue
+368
-0
yearUpsxt.vue
pages/inspectionContent/components/yearUpsxt.vue
+0
-0
inspectionContentList.vue
pages/inspectionContent/inspectionContentList.vue
+0
-0
inspectionContentMonthlyList.vue
pages/inspectionContent/inspectionContentMonthlyList.vue
+0
-0
inspectionContentMonthlyNew.vue
pages/inspectionContent/inspectionContentMonthlyNew.vue
+0
-0
inspectionContentNew.vue
pages/inspectionContent/inspectionContentNew.vue
+0
-0
inspectionContentYearList.vue
pages/inspectionContent/inspectionContentYearList.vue
+0
-0
inspectionContentYearNew.vue
pages/inspectionContent/inspectionContentYearNew.vue
+0
-0
shared.js
pages/inspectionContent/shared.js
+0
-0
shaftInspectionNew.vue
pages/shaftInspection/shaftInspectionNew.vue
+0
-0
dict.js
utils/dict.js
+0
-0
没有找到文件。
components/inspectionItem/index.vue
浏览文件 @
59bad0b2
...
...
@@ -73,8 +73,8 @@
},
toPage
()
{
const
url
=
this
.
details
.
inspectionType
==
1
?
`/pages/inspectionContent/inspectionContentList?isDisable=
${
this
.
details
.
inspectionType
!=
2
?
`/pages/inspectionContent/inspectionContentList?i
nspectionType=
${
this
.
details
.
inspectionType
}
&i
sDisable=
${
this
.
isDisable
?
1
:
0
}
`
:
`/pages/shaftInspection/shaftInspectionList?isDisable=
${
...
...
pages.json
浏览文件 @
59bad0b2
...
...
@@ -78,17 +78,6 @@
"navigationBarTitleText"
:
""
}
},
//
机房月度巡检列表
{
"path"
:
"pages/inspectionContent/inspectionContentMonthlyList"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"app-plus"
:
{
//
将回弹属性关掉
"bounce"
:
"none"
}
}
},
//
机房月度巡检新页面
{
"path"
:
"pages/inspectionContent/inspectionContentMonthlyNew"
,
...
...
@@ -96,17 +85,6 @@
"navigationBarTitleText"
:
""
}
},
//
机房年度巡检列表
{
"path"
:
"pages/inspectionContent/inspectionContentYearList"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"app-plus"
:
{
//
将回弹属性关掉
"bounce"
:
"none"
}
}
},
//
机房年度巡检新页面
{
"path"
:
"pages/inspectionContent/inspectionContentYearNew"
,
...
...
pages/home/home.vue
浏览文件 @
59bad0b2
...
...
@@ -72,7 +72,7 @@
<
script
>
import
{
copyDirectory
}
from
"@/utils/IoReadingAndWriting.js"
;
import
inspectApi
from
"@/api/inspect.js"
;
import
{
cleanTimeoutDataApi
}
from
'@/api/base.js'
import
{
cleanTimeoutDataApi
}
from
"@/api/base.js"
;
export
default
{
data
()
{
return
{
...
...
@@ -80,7 +80,7 @@ export default {
{
image
:
"../../static/img/jf.png"
,
text
:
"机房日常巡检"
,
url
:
"/pages/inspectionContent/inspectionContentList?backValue=home"
,
url
:
"/pages/inspectionContent/inspectionContentList?backValue=home
&inspectionType=1
"
,
},
{
image
:
"../../static/img/jd.png"
,
...
...
@@ -95,12 +95,12 @@ export default {
{
image
:
"../../static/img/jf.png"
,
text
:
"机房月度巡检"
,
url
:
"/pages/inspectionContent/inspectionContent
MonthlyList?backValue=home
"
,
url
:
"/pages/inspectionContent/inspectionContent
List?backValue=home&inspectionType=3
"
,
},
{
image
:
"../../static/img/jf.png"
,
text
:
"机房年度巡检"
,
url
:
"/pages/inspectionContent/inspectionContent
YearList?backValue=home
"
,
url
:
"/pages/inspectionContent/inspectionContent
List?backValue=home&inspectionType=4
"
,
},
],
userName
:
this
.
$store
.
state
.
now_user
.
user
,
...
...
@@ -113,7 +113,7 @@ export default {
},
created
()
{
console
.
log
(
this
.
$store
.
state
);
cleanTimeoutDataApi
();
cleanTimeoutDataApi
();
},
methods
:
{
// 修改密码
...
...
@@ -164,7 +164,7 @@ export default {
uni
.
setStorageSync
(
"now_user"
,
this
.
$store
.
state
.
now_user
);
uni
.
setStorageSync
(
"last_time"
,
this
.
$store
.
state
.
now_user
.
LastSynchronizationTime
||
""
this
.
$store
.
state
.
now_user
.
LastSynchronizationTime
||
""
,
);
},
});
...
...
pages/inspection/inspFirst.vue
浏览文件 @
59bad0b2
...
...
@@ -77,13 +77,21 @@ export default {
return
{
rooms
:
[
{
text
:
"机房巡检"
,
text
:
"机房
日常
巡检"
,
value
:
"1"
,
},
{
text
:
"井道巡检"
,
value
:
"2"
,
},
{
text
:
"机房月度巡检"
,
value
:
"11"
,
},
{
text
:
"机房年度巡检"
,
value
:
"12"
,
},
],
formData
:
{
inspectionType
:
""
,
...
...
pages/inspectionContent/components/detail.vue
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/inspectionContent/components/detailItem.vue
0 → 100644
浏览文件 @
59bad0b2
<
template
>
<view
class=
"container-item"
>
<view
class=
"title"
>
{{
title
}}
</view>
<view
class=
"cards"
>
<view
v-for=
"(item, index) in detailObj.detail"
:key=
"index"
class=
"cards-item"
v-if=
"showItem(item)"
>
<view
v-if=
"hasLabel"
class=
"name"
>
{{
item
.
label
}}
<text
class=
"status"
:class=
"
{ warning: item.inspectionResult === 1 }"
>
{{
item
.
inspectionResultLable
}}
</text
></view
>
<view
class=
"list"
v-if=
"type == 1"
>
<view
class=
"label"
>
{{
item
.
settingLabelShow
}}
:
</view>
<view
class=
"content"
>
{{
item
.
setting
}}
</view>
</view>
<view
v-if=
"type == 2 && item.inspectionResult === 1"
class=
"list"
>
<view
class=
"label"
>
故障设备:
</view>
<view
class=
"content"
>
<text
v-for=
"(current, idx) in item.cabinets"
:key=
"idx"
>
【
{{
current
.
deviceId
}}
机柜,
{{
current
.
UpositonS
}}
~
{{
current
.
UpositonE
}}
U】
</text>
</view>
</view>
<view
class=
"list"
v-if=
"type == 3"
>
<view
class=
"label"
>
{{
item
.
settingLabel
}}
:
</view>
<view
class=
"content"
>
{{
item
.
setting
}}{{
item
.
unit
}}
</view>
</view>
<view
class=
"list"
v-if=
"type == 3"
>
<view
class=
"label"
>
{{
item
.
sjLabel
}}
:
</view>
<view
class=
"content"
>
{{
item
.
value
}}{{
item
.
unit
}}
</view>
</view>
<view
class=
"name"
v-if=
"type == 4"
>
<template
v-if=
"index == 0"
>
<view>
{{
item
.
label
}}
(气压范围:
{{
item
.
setting
}}
)
<text
class=
"status"
:class=
"
{ warning: item.inspectionResult === 1 }"
>
{{
item
.
inspectionResultLable
}}
</text>
</view>
</
template
>
<
template
v-else
>
{{
item
.
label
}}
<text
class=
"status"
:class=
"
{ warning: item.inspectionResult === 1 }"
>
{{
item
.
inspectionResultLable
}}
</text>
</
template
>
</view>
<view
class=
"list"
>
<view
class=
"label"
>
{{ conclusionName || "情况描述" }}:
</view>
<view
class=
"content"
>
{{ item.conclusion }}
</view>
</view>
<view
class=
"list"
>
<view
class=
"label"
>
现场照片:
</view>
<view
v-if=
"item.photos.length === 0"
class=
"content"
>
未拍摄照片
</view>
<view
v-else
class=
"content"
>
<image
v-for=
"(url, urlIndex) in item.photos"
:key=
"urlIndex"
class=
"image-item"
:src=
"url"
mode=
"aspectFit"
@
click=
"previewImage(item.photos, urlIndex)"
></image>
</view>
</view>
</view>
</view>
</view>
</template>
<
script
>
export
default
{
props
:
{
detailObj
:
{
type
:
Object
,
default
:
()
=>
({}),
},
title
:
{
type
:
String
,
default
:
""
,
},
type
:
{
type
:
[
String
,
Number
],
default
:
""
,
},
conclusionName
:
{
type
:
String
,
default
:
"情况描述"
,
},
hasLabel
:
{
type
:
Boolean
,
default
:
true
,
},
isShowItem
:
{
type
:
Boolean
,
default
:
false
,
},
},
data
()
{
return
{};
},
methods
:
{
showItem
(
item
)
{
if
(
!
this
.
isShowItem
)
return
true
;
const
hasMonitor
=
this
.
detailsItem
.
afxt
.
detail
.
find
(
(
i
)
=>
i
.
label
===
"是否有监控"
,
);
if
(
hasMonitor
&&
hasMonitor
.
inspectionResultLable
===
"无监控"
)
{
return
!
[
"监控外观破损"
,
"监控画面清晰"
,
"监控存储连续"
].
includes
(
item
.
label
,
);
}
return
true
;
},
previewImage
(
images
,
index
)
{
uni
.
previewImage
({
current
:
index
,
urls
:
images
,
});
},
},
};
</
script
>
<
style
scoped
lang=
"less"
>
.container-item {
margin-bottom: 19.2px;
.title {
font-size: 12.8px;
color: #000000;
line-height: 19.2px;
font-weight: 500;
margin-bottom: 9.6px;
}
.cards {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.cards-item {
width: calc(50% - 6.4px);
margin-bottom: 12.8px;
background: #f9f9f9;
border-radius: 6.4px;
padding: 6.4px;
&.sbgj {
width: 100%;
}
.name {
font-size: 12.8px;
color: #000000;
line-height: 19.2px;
font-weight: 500;
margin-bottom: 9.6px;
.status {
margin-left: 6.4px;
padding: 0 6.4px;
font-size: 9.6px;
background: #e6f9f3;
border-radius: 8.8px;
color: #0cc991;
line-height: 16px;
font-weight: 400;
&.warning {
background: #fdebe9;
color: #f55a42;
}
}
}
.list {
display: flex;
align-items: flex-start;
margin-bottom: 9.6px;
&:last-child {
margin-bottom: 0;
}
.label {
width: 56px;
font-size: 11.2px;
color: #7c7c7c;
line-height: 17.6px;
font-weight: 400;
}
.content {
flex: 1;
word-wrap: break-word;
font-size: 11.2px;
color: #000000;
line-height: 17.6px;
font-weight: 400;
display: flex;
flex-wrap: nowrap;
// justify-content: space-between;
.image-item {
width: 57.6px;
height: 57.6px;
margin-right: 6.4px;
border-radius: 3.2px;
}
}
}
}
}
}
</
style
>
pages/inspectionContent/components/monthFljdxt.vue
0 → 100644
浏览文件 @
59bad0b2
<
template
>
<!-- 机房巡检操作 -->
<view>
<view
v-for=
"(item, index) in itemData.detail"
:key=
"index"
>
<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>
<template
v-if=
"item.inspectionResult === 1"
>
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
情况摘要
</text
>
<text
:class=
"['conclusion',
{ 'no-text': !item.conclusion }]"
@click="showPopup(item, index)"
>
{{
item
.
conclusion
||
"请输入情况摘要"
}}
</text
>
</view>
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
现场照片
</text
>
<CommonUpload
v-model=
"item.photos"
:max-count=
"5"
>
</CommonUpload>
</view
></
template
>
</view
><custom-popup
ref=
"customPopup"
:inspectionItem=
"inspectionItem"
@
confirm=
"handlePopupConfirm"
></custom-popup>
</view>
</template>
<
script
>
import
CommonUpload
from
"@/components/CommonUpload/index.vue"
;
import
customPopup
from
"./customPopup.vue"
;
import
_
from
"lodash"
;
import
mixin
from
"./mixin"
;
export
default
{
components
:
{
CommonUpload
,
customPopup
,
},
mixins
:
[
mixin
],
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
:
""
,
inspectionResultLable
:
"正常"
,
lableArr
:
[
"正常"
,
"异常"
],
conclusion
:
""
,
photos
:
[],
},
],
},
};
},
computed
:
{
userInfo
()
{
return
this
.
$store
.
state
.
now_user
||
{};
},
},
watch
:
{
defaultData
(
newVal
)
{
// 在这里处理数据变化
if
(
Object
.
keys
(
this
.
defaultData
).
length
!==
0
)
{
this
.
itemData
=
this
.
defaultData
;
}
},
},
async
mounted
()
{
console
.
log
(
"sdsadasd"
,
this
.
itemData
);
// 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
);
},
// 处理弹窗确认
handlePopupConfirm
(
summary
)
{
this
.
itemData
.
detail
[
this
.
currentIndex
].
conclusion
=
summary
;
// 回显到文字显示区域
},
// 处理】数据
getFromData
()
{
const
isValid
=
this
.
areAllObjectsValid
(
this
.
itemData
.
detail
);
//false不通过 true通过
console
.
log
(
"wlhj"
,
isValid
);
const
isAllOne
=
this
.
areAllInspectionResultsOne
(
this
.
itemData
.
detail
);
console
.
log
(
"isAllOne"
,
isAllOne
);
this
.
itemData
.
isValid
=
isValid
;
this
.
itemData
.
inspectionItem
=
this
.
inspectionItem
;
this
.
itemData
.
status
=
isAllOne
.
status
;
//1表示已经巡检过没有异常
this
.
itemData
.
statusLabel
=
isAllOne
.
statusLabel
;
console
.
log
(
"查看数据"
,
this
.
itemData
);
return
this
.
itemData
;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid
(
details
)
{
// 检查是否有任何项的 inspectionResult 为空字符串
const
hasEmptyResult
=
details
.
some
(
(
item
)
=>
item
.
inspectionResult
===
""
,
);
if
(
hasEmptyResult
)
{
return
false
;
}
// 遍历每一项进行检查
for
(
const
item
of
details
)
{
if
(
item
.
inspectionResult
===
0
)
{
// 如果 inspectionResult 为 0,跳过此项的其他检查
continue
;
}
else
if
(
item
.
inspectionResult
===
1
)
{
// 如果 inspectionResult 为 1,检查 conclusion 和 photos
if
(
!
item
.
conclusion
||
item
.
photos
.
length
===
0
)
{
return
false
;
}
}
else
{
// 其他情况(理论上不应该存在,根据当前规则)
return
false
;
}
}
// 所有检查都通过
return
true
;
},
areAllInspectionResultsOne
(
details
)
{
let
hasEmpty
=
false
;
let
allZero
=
true
;
let
hasOne
=
false
;
for
(
const
item
of
details
)
{
if
(
item
.
inspectionResult
===
""
)
{
hasEmpty
=
true
;
break
;
}
else
if
(
item
.
inspectionResult
===
1
)
{
hasOne
=
true
;
allZero
=
false
;
}
else
if
(
item
.
inspectionResult
===
0
)
{
// 继续检查
}
else
{
// 如果有其他值,可以在这里处理
allZero
=
false
;
}
}
if
(
hasEmpty
)
{
return
{
statusLabel
:
"未巡检"
,
status
:
0
};
}
else
if
(
allZero
)
{
return
{
statusLabel
:
"已巡检"
,
status
:
1
};
}
else
if
(
hasOne
)
{
return
{
statusLabel
:
"巡检异常"
,
status
:
2
};
}
else
{
// 默认情况,可以根据需求调整
return
{
statusLabel
:
"未巡检"
,
status
:
0
};
}
},
setNormal
()
{
this
.
itemData
.
detail
.
forEach
((
item
)
=>
{
item
.
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 {
&.no-text {
color: #c7c7c7;
}
.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
>
pages/inspectionContent/components/monthGpdxt.vue
0 → 100644
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/inspectionContent/components/monthKtxt.vue
0 → 100644
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/inspectionContent/components/monthPbxt.vue
0 → 100644
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/inspectionContent/components/monthUpsxt.vue
0 → 100644
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/inspectionContent/components/monthZmxt.vue
0 → 100644
浏览文件 @
59bad0b2
<
template
>
<!-- 机房巡检操作 -->
<view>
<view
v-for=
"(item, index) in itemData.detail"
:key=
"index"
>
<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>
<template
v-if=
"item.inspectionResult === 1"
>
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
情况摘要
</text
>
<text
:class=
"['conclusion',
{ 'no-text': !item.conclusion }]"
@click="showPopup(item, index)"
>
{{
item
.
conclusion
||
"请输入情况摘要"
}}
</text
>
</view>
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
现场照片
</text
>
<CommonUpload
v-model=
"item.photos"
:max-count=
"5"
>
</CommonUpload>
</view
></
template
>
</view
><custom-popup
ref=
"customPopup"
:inspectionItem=
"inspectionItem"
@
confirm=
"handlePopupConfirm"
></custom-popup>
</view>
</template>
<
script
>
import
CommonUpload
from
"@/components/CommonUpload/index.vue"
;
import
customPopup
from
"./customPopup.vue"
;
import
_
from
"lodash"
;
import
mixin
from
"./mixin"
;
export
default
{
components
:
{
CommonUpload
,
customPopup
,
},
mixins
:
[
mixin
],
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
:
""
,
inspectionResultLable
:
"正常"
,
lableArr
:
[
"正常"
,
"异常"
],
conclusion
:
""
,
photos
:
[],
},
],
},
};
},
computed
:
{
userInfo
()
{
return
this
.
$store
.
state
.
now_user
||
{};
},
},
watch
:
{
defaultData
(
newVal
)
{
// 在这里处理数据变化
if
(
Object
.
keys
(
this
.
defaultData
).
length
!==
0
)
{
this
.
itemData
=
this
.
defaultData
;
}
},
},
async
mounted
()
{
console
.
log
(
"sdsadasd"
,
this
.
itemData
);
// 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
);
},
// 处理弹窗确认
handlePopupConfirm
(
summary
)
{
this
.
itemData
.
detail
[
this
.
currentIndex
].
conclusion
=
summary
;
// 回显到文字显示区域
},
// 处理】数据
getFromData
()
{
const
isValid
=
this
.
areAllObjectsValid
(
this
.
itemData
.
detail
);
//false不通过 true通过
console
.
log
(
"wlhj"
,
isValid
);
const
isAllOne
=
this
.
areAllInspectionResultsOne
(
this
.
itemData
.
detail
);
console
.
log
(
"isAllOne"
,
isAllOne
);
this
.
itemData
.
isValid
=
isValid
;
this
.
itemData
.
inspectionItem
=
this
.
inspectionItem
;
this
.
itemData
.
status
=
isAllOne
.
status
;
//1表示已经巡检过没有异常
this
.
itemData
.
statusLabel
=
isAllOne
.
statusLabel
;
console
.
log
(
"查看数据"
,
this
.
itemData
);
return
this
.
itemData
;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid
(
details
)
{
// 检查是否有任何项的 inspectionResult 为空字符串
const
hasEmptyResult
=
details
.
some
(
(
item
)
=>
item
.
inspectionResult
===
""
,
);
if
(
hasEmptyResult
)
{
return
false
;
}
// 遍历每一项进行检查
for
(
const
item
of
details
)
{
if
(
item
.
inspectionResult
===
0
)
{
// 如果 inspectionResult 为 0,跳过此项的其他检查
continue
;
}
else
if
(
item
.
inspectionResult
===
1
)
{
// 如果 inspectionResult 为 1,检查 conclusion 和 photos
if
(
!
item
.
conclusion
||
item
.
photos
.
length
===
0
)
{
return
false
;
}
}
else
{
// 其他情况(理论上不应该存在,根据当前规则)
return
false
;
}
}
// 所有检查都通过
return
true
;
},
areAllInspectionResultsOne
(
details
)
{
let
hasEmpty
=
false
;
let
allZero
=
true
;
let
hasOne
=
false
;
for
(
const
item
of
details
)
{
if
(
item
.
inspectionResult
===
""
)
{
hasEmpty
=
true
;
break
;
}
else
if
(
item
.
inspectionResult
===
1
)
{
hasOne
=
true
;
allZero
=
false
;
}
else
if
(
item
.
inspectionResult
===
0
)
{
// 继续检查
}
else
{
// 如果有其他值,可以在这里处理
allZero
=
false
;
}
}
if
(
hasEmpty
)
{
return
{
statusLabel
:
"未巡检"
,
status
:
0
};
}
else
if
(
allZero
)
{
return
{
statusLabel
:
"已巡检"
,
status
:
1
};
}
else
if
(
hasOne
)
{
return
{
statusLabel
:
"巡检异常"
,
status
:
2
};
}
else
{
// 默认情况,可以根据需求调整
return
{
statusLabel
:
"未巡检"
,
status
:
0
};
}
},
setNormal
()
{
this
.
itemData
.
detail
.
forEach
((
item
)
=>
{
item
.
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 {
&.no-text {
color: #c7c7c7;
}
.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
>
pages/inspectionContent/components/yearDlhjjkxt.vue
0 → 100644
浏览文件 @
59bad0b2
<
template
>
<!-- 机房巡检操作 -->
<view>
<view
v-for=
"(item, index) in itemData.detail"
:key=
"index"
>
<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>
<template
v-if=
"item.inspectionResult === 1"
>
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
情况摘要
</text
>
<text
:class=
"['conclusion',
{ 'no-text': !item.conclusion }]"
@click="showPopup(item, index)"
>
{{
item
.
conclusion
||
"请输入情况摘要"
}}
</text
>
</view>
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
现场照片
</text
>
<CommonUpload
v-model=
"item.photos"
:max-count=
"5"
>
</CommonUpload>
</view
></
template
>
</view
><custom-popup
ref=
"customPopup"
:inspectionItem=
"inspectionItem"
@
confirm=
"handlePopupConfirm"
></custom-popup>
</view>
</template>
<
script
>
import
CommonUpload
from
"@/components/CommonUpload/index.vue"
;
import
customPopup
from
"./customPopup.vue"
;
import
_
from
"lodash"
;
import
mixin
from
"./mixin"
;
export
default
{
components
:
{
CommonUpload
,
customPopup
,
},
mixins
:
[
mixin
],
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
:
""
,
inspectionResultLable
:
"正常"
,
lableArr
:
[
"正常"
,
"异常"
],
conclusion
:
""
,
photos
:
[],
},
],
},
};
},
computed
:
{
userInfo
()
{
return
this
.
$store
.
state
.
now_user
||
{};
},
},
watch
:
{
defaultData
(
newVal
)
{
// 在这里处理数据变化
if
(
Object
.
keys
(
this
.
defaultData
).
length
!==
0
)
{
this
.
itemData
=
this
.
defaultData
;
}
},
},
async
mounted
()
{
console
.
log
(
"sdsadasd"
,
this
.
itemData
);
// 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
);
},
// 处理弹窗确认
handlePopupConfirm
(
summary
)
{
this
.
itemData
.
detail
[
this
.
currentIndex
].
conclusion
=
summary
;
// 回显到文字显示区域
},
// 处理】数据
getFromData
()
{
const
isValid
=
this
.
areAllObjectsValid
(
this
.
itemData
.
detail
);
//false不通过 true通过
console
.
log
(
"wlhj"
,
isValid
);
const
isAllOne
=
this
.
areAllInspectionResultsOne
(
this
.
itemData
.
detail
);
console
.
log
(
"isAllOne"
,
isAllOne
);
this
.
itemData
.
isValid
=
isValid
;
this
.
itemData
.
inspectionItem
=
this
.
inspectionItem
;
this
.
itemData
.
status
=
isAllOne
.
status
;
//1表示已经巡检过没有异常
this
.
itemData
.
statusLabel
=
isAllOne
.
statusLabel
;
console
.
log
(
"查看数据"
,
this
.
itemData
);
return
this
.
itemData
;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid
(
details
)
{
// 检查是否有任何项的 inspectionResult 为空字符串
const
hasEmptyResult
=
details
.
some
(
(
item
)
=>
item
.
inspectionResult
===
""
,
);
if
(
hasEmptyResult
)
{
return
false
;
}
// 遍历每一项进行检查
for
(
const
item
of
details
)
{
if
(
item
.
inspectionResult
===
0
)
{
// 如果 inspectionResult 为 0,跳过此项的其他检查
continue
;
}
else
if
(
item
.
inspectionResult
===
1
)
{
// 如果 inspectionResult 为 1,检查 conclusion 和 photos
if
(
!
item
.
conclusion
||
item
.
photos
.
length
===
0
)
{
return
false
;
}
}
else
{
// 其他情况(理论上不应该存在,根据当前规则)
return
false
;
}
}
// 所有检查都通过
return
true
;
},
areAllInspectionResultsOne
(
details
)
{
let
hasEmpty
=
false
;
let
allZero
=
true
;
let
hasOne
=
false
;
for
(
const
item
of
details
)
{
if
(
item
.
inspectionResult
===
""
)
{
hasEmpty
=
true
;
break
;
}
else
if
(
item
.
inspectionResult
===
1
)
{
hasOne
=
true
;
allZero
=
false
;
}
else
if
(
item
.
inspectionResult
===
0
)
{
// 继续检查
}
else
{
// 如果有其他值,可以在这里处理
allZero
=
false
;
}
}
if
(
hasEmpty
)
{
return
{
statusLabel
:
"未巡检"
,
status
:
0
};
}
else
if
(
allZero
)
{
return
{
statusLabel
:
"已巡检"
,
status
:
1
};
}
else
if
(
hasOne
)
{
return
{
statusLabel
:
"巡检异常"
,
status
:
2
};
}
else
{
// 默认情况,可以根据需求调整
return
{
statusLabel
:
"未巡检"
,
status
:
0
};
}
},
setNormal
()
{
this
.
itemData
.
detail
.
forEach
((
item
)
=>
{
item
.
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 {
&.no-text {
color: #c7c7c7;
}
.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
>
pages/inspectionContent/components/yearFljdxt.vue
0 → 100644
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/inspectionContent/components/yearKtxt.vue
0 → 100644
浏览文件 @
59bad0b2
<
template
>
<!-- 机房巡检操作 -->
<view>
<view
v-for=
"(item, index) in itemData.detail"
:key=
"index"
>
<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>
<template
v-if=
"item.inspectionResult === 1"
>
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
情况摘要
</text
>
<text
:class=
"['conclusion',
{ 'no-text': !item.conclusion }]"
@click="showPopup(item, index)"
>
{{
item
.
conclusion
||
"请输入情况摘要"
}}
</text
>
</view>
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
现场照片
</text
>
<CommonUpload
v-model=
"item.photos"
:max-count=
"5"
>
</CommonUpload>
</view
></
template
>
</view
><custom-popup
ref=
"customPopup"
:inspectionItem=
"inspectionItem"
@
confirm=
"handlePopupConfirm"
></custom-popup>
</view>
</template>
<
script
>
import
CommonUpload
from
"@/components/CommonUpload/index.vue"
;
import
customPopup
from
"./customPopup.vue"
;
import
_
from
"lodash"
;
import
mixin
from
"./mixin"
;
export
default
{
components
:
{
CommonUpload
,
customPopup
,
},
mixins
:
[
mixin
],
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
:
""
,
inspectionResultLable
:
"有"
,
lableArr
:
[
"有"
,
"无"
],
conclusion
:
""
,
photos
:
[],
},
],
},
};
},
computed
:
{
userInfo
()
{
return
this
.
$store
.
state
.
now_user
||
{};
},
},
watch
:
{
defaultData
(
newVal
)
{
// 在这里处理数据变化
if
(
Object
.
keys
(
this
.
defaultData
).
length
!==
0
)
{
this
.
itemData
=
this
.
defaultData
;
}
},
},
async
mounted
()
{
console
.
log
(
"sdsadasd"
,
this
.
itemData
);
// 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
);
},
// 处理弹窗确认
handlePopupConfirm
(
summary
)
{
this
.
itemData
.
detail
[
this
.
currentIndex
].
conclusion
=
summary
;
// 回显到文字显示区域
},
// 处理】数据
getFromData
()
{
const
isValid
=
this
.
areAllObjectsValid
(
this
.
itemData
.
detail
);
//false不通过 true通过
console
.
log
(
"wlhj"
,
isValid
);
const
isAllOne
=
this
.
areAllInspectionResultsOne
(
this
.
itemData
.
detail
);
console
.
log
(
"isAllOne"
,
isAllOne
);
this
.
itemData
.
isValid
=
isValid
;
this
.
itemData
.
inspectionItem
=
this
.
inspectionItem
;
this
.
itemData
.
status
=
isAllOne
.
status
;
//1表示已经巡检过没有异常
this
.
itemData
.
statusLabel
=
isAllOne
.
statusLabel
;
console
.
log
(
"查看数据"
,
this
.
itemData
);
return
this
.
itemData
;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid
(
details
)
{
// 检查是否有任何项的 inspectionResult 为空字符串
const
hasEmptyResult
=
details
.
some
(
(
item
)
=>
item
.
inspectionResult
===
""
,
);
if
(
hasEmptyResult
)
{
return
false
;
}
// 遍历每一项进行检查
for
(
const
item
of
details
)
{
if
(
item
.
inspectionResult
===
0
)
{
// 如果 inspectionResult 为 0,跳过此项的其他检查
continue
;
}
else
if
(
item
.
inspectionResult
===
1
)
{
// 如果 inspectionResult 为 1,检查 conclusion 和 photos
if
(
!
item
.
conclusion
||
item
.
photos
.
length
===
0
)
{
return
false
;
}
}
else
{
// 其他情况(理论上不应该存在,根据当前规则)
return
false
;
}
}
// 所有检查都通过
return
true
;
},
areAllInspectionResultsOne
(
details
)
{
let
hasEmpty
=
false
;
let
allZero
=
true
;
let
hasOne
=
false
;
for
(
const
item
of
details
)
{
if
(
item
.
inspectionResult
===
""
)
{
hasEmpty
=
true
;
break
;
}
else
if
(
item
.
inspectionResult
===
1
)
{
hasOne
=
true
;
allZero
=
false
;
}
else
if
(
item
.
inspectionResult
===
0
)
{
// 继续检查
}
else
{
// 如果有其他值,可以在这里处理
allZero
=
false
;
}
}
if
(
hasEmpty
)
{
return
{
statusLabel
:
"未巡检"
,
status
:
0
};
}
else
if
(
allZero
)
{
return
{
statusLabel
:
"已巡检"
,
status
:
1
};
}
else
if
(
hasOne
)
{
return
{
statusLabel
:
"巡检异常"
,
status
:
2
};
}
else
{
// 默认情况,可以根据需求调整
return
{
statusLabel
:
"未巡检"
,
status
:
0
};
}
},
setNormal
()
{
this
.
itemData
.
detail
.
forEach
((
item
)
=>
{
item
.
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: 98px;
text-align: right;
color: #7c7c7c;
.required {
color: red;
margin-right: 3.2px;
}
}
.conclusion {
&.no-text {
color: #c7c7c7;
}
.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
>
pages/inspectionContent/components/yearPbxt.vue
0 → 100644
浏览文件 @
59bad0b2
<
template
>
<!-- 机房巡检操作 -->
<view>
<view
v-for=
"(item, index) in itemData.detail"
:key=
"index"
>
<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>
<template
v-if=
"item.inspectionResult === 1"
>
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
情况摘要
</text
>
<text
:class=
"['conclusion',
{ 'no-text': !item.conclusion }]"
@click="showPopup(item, index)"
>
{{
item
.
conclusion
||
"请输入情况摘要"
}}
</text
>
</view>
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
现场照片
</text
>
<CommonUpload
v-model=
"item.photos"
:max-count=
"5"
>
</CommonUpload>
</view
></
template
>
</view
><custom-popup
ref=
"customPopup"
:inspectionItem=
"inspectionItem"
@
confirm=
"handlePopupConfirm"
></custom-popup>
</view>
</template>
<
script
>
import
CommonUpload
from
"@/components/CommonUpload/index.vue"
;
import
customPopup
from
"./customPopup.vue"
;
import
_
from
"lodash"
;
import
mixin
from
"./mixin"
;
export
default
{
components
:
{
CommonUpload
,
customPopup
,
},
mixins
:
[
mixin
],
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
:
""
,
inspectionResultLable
:
"正常"
,
lableArr
:
[
"正常"
,
"异常"
],
conclusion
:
""
,
photos
:
[],
},
],
},
};
},
computed
:
{
userInfo
()
{
return
this
.
$store
.
state
.
now_user
||
{};
},
},
watch
:
{
defaultData
(
newVal
)
{
// 在这里处理数据变化
if
(
Object
.
keys
(
this
.
defaultData
).
length
!==
0
)
{
this
.
itemData
=
this
.
defaultData
;
}
},
},
async
mounted
()
{
console
.
log
(
"sdsadasd"
,
this
.
itemData
);
// 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
);
},
// 处理弹窗确认
handlePopupConfirm
(
summary
)
{
this
.
itemData
.
detail
[
this
.
currentIndex
].
conclusion
=
summary
;
// 回显到文字显示区域
},
// 处理】数据
getFromData
()
{
const
isValid
=
this
.
areAllObjectsValid
(
this
.
itemData
.
detail
);
//false不通过 true通过
console
.
log
(
"wlhj"
,
isValid
);
const
isAllOne
=
this
.
areAllInspectionResultsOne
(
this
.
itemData
.
detail
);
console
.
log
(
"isAllOne"
,
isAllOne
);
this
.
itemData
.
isValid
=
isValid
;
this
.
itemData
.
inspectionItem
=
this
.
inspectionItem
;
this
.
itemData
.
status
=
isAllOne
.
status
;
//1表示已经巡检过没有异常
this
.
itemData
.
statusLabel
=
isAllOne
.
statusLabel
;
console
.
log
(
"查看数据"
,
this
.
itemData
);
return
this
.
itemData
;
},
// 数据校验方法 true说明有未填项
areAllObjectsValid
(
details
)
{
// 检查是否有任何项的 inspectionResult 为空字符串
const
hasEmptyResult
=
details
.
some
(
(
item
)
=>
item
.
inspectionResult
===
""
,
);
if
(
hasEmptyResult
)
{
return
false
;
}
// 遍历每一项进行检查
for
(
const
item
of
details
)
{
if
(
item
.
inspectionResult
===
0
)
{
// 如果 inspectionResult 为 0,跳过此项的其他检查
continue
;
}
else
if
(
item
.
inspectionResult
===
1
)
{
// 如果 inspectionResult 为 1,检查 conclusion 和 photos
if
(
!
item
.
conclusion
||
item
.
photos
.
length
===
0
)
{
return
false
;
}
}
else
{
// 其他情况(理论上不应该存在,根据当前规则)
return
false
;
}
}
// 所有检查都通过
return
true
;
},
areAllInspectionResultsOne
(
details
)
{
let
hasEmpty
=
false
;
let
allZero
=
true
;
let
hasOne
=
false
;
for
(
const
item
of
details
)
{
if
(
item
.
inspectionResult
===
""
)
{
hasEmpty
=
true
;
break
;
}
else
if
(
item
.
inspectionResult
===
1
)
{
hasOne
=
true
;
allZero
=
false
;
}
else
if
(
item
.
inspectionResult
===
0
)
{
// 继续检查
}
else
{
// 如果有其他值,可以在这里处理
allZero
=
false
;
}
}
if
(
hasEmpty
)
{
return
{
statusLabel
:
"未巡检"
,
status
:
0
};
}
else
if
(
allZero
)
{
return
{
statusLabel
:
"已巡检"
,
status
:
1
};
}
else
if
(
hasOne
)
{
return
{
statusLabel
:
"巡检异常"
,
status
:
2
};
}
else
{
// 默认情况,可以根据需求调整
return
{
statusLabel
:
"未巡检"
,
status
:
0
};
}
},
setNormal
()
{
this
.
itemData
.
detail
.
forEach
((
item
)
=>
{
item
.
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 {
&.no-text {
color: #c7c7c7;
}
.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
>
pages/inspectionContent/components/yearUpsxt.vue
0 → 100644
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/inspectionContent/inspectionContentList.vue
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/inspectionContent/inspectionContentMonthlyList.vue
deleted
100644 → 0
浏览文件 @
713c576b
差异被折叠。
点击展开。
pages/inspectionContent/inspectionContentMonthlyNew.vue
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/inspectionContent/inspectionContentNew.vue
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/inspectionContent/inspectionContentYearList.vue
deleted
100644 → 0
浏览文件 @
713c576b
差异被折叠。
点击展开。
pages/inspectionContent/inspectionContentYearNew.vue
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/inspectionContent/shared.js
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
pages/shaftInspection/shaftInspectionNew.vue
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
utils/dict.js
浏览文件 @
59bad0b2
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论