Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
computedRoomPad
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
邓文彬
computedRoomPad
Commits
f687a284
提交
f687a284
authored
3月 04, 2025
作者:
caodi\cd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:提交备份
上级
9d540224
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
173 行增加
和
30 行删除
+173
-30
shaftInspectionNew.vue
pages/shaftInspection/shaftInspectionNew.vue
+167
-27
dict.js
utils/dict.js
+6
-3
没有找到文件。
pages/shaftInspection/shaftInspectionNew.vue
浏览文件 @
f687a284
...
...
@@ -46,13 +46,13 @@
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
巡检结论:
</text>
<view
class=
"switch-container"
>
<switch
:checked=
"
sliderValue
=== 1"
@
change=
"onSwitchChange"
class=
"switch"
color=
"#007AFF"
/>
<text
class=
"switch-text"
>
{{
sliderValue
===
0
?
'正常'
:
'异常'
}}
</text>
<switch
:checked=
"
inspectionResult
=== 1"
@
change=
"onSwitchChange"
class=
"switch"
color=
"#007AFF"
/>
<text
class=
"switch-text"
>
{{
inspectionResult
===
0
?
'正常'
:
'异常'
}}
</text>
</view>
</view>
<view
class=
"form-item"
>
<text
class=
"form-label"
><text
class=
"required"
>
*
</text>
情况摘要:
</text>
<input
v-model=
"
tabData[activeTab].summary
"
placeholder=
"请输入情况摘要"
class=
"input-box"
/>
<input
v-model=
"
list[activeTab].conclusion
"
placeholder=
"请输入情况摘要"
class=
"input-box"
/>
</view>
<view
class=
"form-item"
>
<text
class=
"form-label"
>
现场照片:
</text>
...
...
@@ -98,9 +98,24 @@
<
script
>
import
{
pad_2_1_inspection_items
,
pad_2_1_inspection_position
,
pad_2_1_floor
}
from
"@/utils/dict.js"
;
//巡检位置,A座到F座 楼层2楼4楼到26楼
import
{
addLog
,
getLogContent
,
LOG_TYPE_ENUM
,
writeDarf
,
writeInspectionData
,
}
from
"@/utils/IoReadingAndWriting.js"
;
import
{
getInspectionDetails
,
getDarft
}
from
"@/request/index.js"
;
import
moment
from
"moment"
;
export
default
{
data
()
{
return
{
...
...
@@ -121,27 +136,30 @@
},
],
activeTab
:
0
,
// 当前选中的 Tab
sliderValue
:
0
,
// Switch 值(0: 正常, 1: 异常)
summary
:
""
,
// 情况摘要
inspectionResult
:
0
,
// Switch 值(0: 正常, 1: 异常)
conclusion
:
""
,
// 情况摘要
photos
:
[],
// 现场照片
tabData
:
[{
sliderValue
:
0
,
summary
:
""
,
inspectionResult
:
0
,
conclusion
:
""
,
photos
:
[]
},
// 门禁
{
sliderValue
:
0
,
summary
:
""
,
inspectionResult
:
0
,
conclusion
:
""
,
photos
:
[]
},
// 卫生
{
sliderValue
:
0
,
summary
:
""
,
inspectionResult
:
0
,
conclusion
:
""
,
photos
:
[]
},
// 设备告警
],
historyData
:
null
,
// 历史数据
firstSubmitTime
:
null
,
// 首次提交时间
detailsInfo
:
{},
// 详情
baseInfo
:
{},
// 基础信息
list
:
[],
//巡检信息
};
},
watch
:
{
...
...
@@ -153,7 +171,44 @@
onLoad
()
{
this
.
loadHistoryData
();
},
mounted
()
{
this
.
init
();
this
.
coverlist
();
},
methods
:
{
// 初始化
init
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// 判断是否有回显数据
if
(
this
.
detailsInfo
&&
this
.
detailsInfo
.
inspectionType
)
{}
else
{
this
.
baseInfo
=
{
inspectionType
:
"2"
,
inspectionCode
:
`JFXJ
${
moment
().
format
(
"yyyyMMDDHHmmss"
)}${(
Math
.
floor
(
Math
.
random
()
*
900
)
+
100
)}
`
,
recordName
:
`
${
moment
().
format
(
"yyyyMMDD"
)}
-机房巡检记录`
,
inspectionTime
:
moment
().
format
(
"yyyy-MM-DD HH:mm"
),
inspectionBy
:
this
.
$store
.
state
.
now_user
.
user
,
inspectionById
:
this
.
$store
.
state
.
now_user
.
userId
,
createByName
:
this
.
$store
.
state
.
now_user
.
user
,
isException
:
""
,
// 是否有异常
position
:
""
,
// 位置
isSubmit
:
""
,
// 0 是草稿态; 1 是正式提交
conclusion
:
""
,
//摘要
creatTime
:
`
${
new
Date
().
getTime
()}
`
,
items
:
[
// {
// "itemCode": "1", // 检查项
// "measuredData": "2,3", // 异常的楼层
// "inspectionResult": "1" // 检查项的结果, 1是异常 0 是正常
// },
],
};
}
console
.
log
(
2222
,
this
.
baseInfo
)
resolve
();
});
},
// 返回
back
()
{
uni
.
navigateBack
();
...
...
@@ -174,16 +229,52 @@
this
.
historyData
=
history
;
this
.
location
=
history
.
location
;
this
.
randomDescription
=
history
.
randomDescription
;
this
.
tabData
=
history
.
tabData
;
this
.
list
=
history
.
tabData
;
this
.
activeTab
=
0
;
// 默认切换到第一个 Tab
this
.
updateCurrentTabData
();
}
},
// 数据结构重组
coverlist
()
{
const
temp
=
pad_2_1_inspection_items
.
rows
.
map
((
item
)
=>
{
return
{
// ...item,
dictLabel
:
item
.
dictLabel
,
dictValue
:
item
.
dictValue
,
conclusion
:
""
,
// 情况摘要
// roomType,
inspectionResult
:
0
,
// 异常结论
itemCode
:
item
.
dictValue
,
// 检查项 如:门禁
resultArr
:
[{
value
:
0
,
label
:
"正常"
,
isActive
:
true
,
},
{
value
:
1
,
label
:
"异常"
,
isActive
:
false
,
},
],
measuredData
:
""
,
// 逗号分隔字符串
measuredDataArr
:
[],
// 前端本地使用
photos
:
[],
// 照片
postionList
:
[{
...
pad_2_1_floor
.
rows
[
0
],
dictLabel
:
location
,
isActive
:
false
,
}]
};
});
this
.
list
=
temp
;
},
// 更新当前 Tab 数据
updateCurrentTabData
()
{
const
currentTabData
=
this
.
tabData
[
this
.
activeTab
];
this
.
sliderValue
=
currentTabData
.
sliderValue
;
this
.
summary
=
currentTabData
.
summary
;
const
currentTabData
=
this
.
list
[
this
.
activeTab
];
this
.
inspectionResult
=
currentTabData
.
inspectionResult
;
this
.
conclusion
=
currentTabData
.
conclusion
;
this
.
photos
=
currentTabData
.
photos
;
},
// 切换 Tab
...
...
@@ -193,8 +284,8 @@
},
// Switch 值变化
onSwitchChange
(
e
)
{
this
.
sliderValue
=
e
.
detail
.
value
?
1
:
0
;
this
.
tabData
[
this
.
activeTab
].
sliderValue
=
this
.
sliderValue
;
this
.
inspectionResult
=
e
.
detail
.
value
?
1
:
0
;
this
.
list
[
this
.
activeTab
].
inspectionResult
=
this
.
inspectionResult
;
},
// 拍照
takePhoto
()
{
...
...
@@ -203,7 +294,7 @@
success
:
(
res
)
=>
{
if
(
this
.
photos
.
length
<
5
)
{
this
.
photos
.
push
(
res
.
tempFilePaths
[
0
]);
this
.
tabData
[
this
.
activeTab
].
photos
=
this
.
photos
;
this
.
list
[
this
.
activeTab
].
photos
=
this
.
photos
;
}
else
{
uni
.
showToast
({
title
:
"最多只能上传5张照片"
,
...
...
@@ -216,22 +307,71 @@
// 删除照片
deletePhoto
(
index
)
{
this
.
photos
.
splice
(
index
,
1
);
this
.
tabData
[
this
.
activeTab
].
photos
=
this
.
photos
;
this
.
list
[
this
.
activeTab
].
photos
=
this
.
photos
;
},
// 处理提交数据
getParams
()
{
const
baseInfo
=
this
.
baseInfo
;
console
.
log
(
"this.list"
,
this
.
list
)
const
item
=
{
...
baseInfo
,
isSubmit
:
0
,
items
:
[],
synchronization
:
0
,
// 是否导出过
submitTime
:
moment
().
format
(
"yyyy-MM-DD"
),
// 记录提交时间
submitMonth
:
moment
().
format
(
"yyyy-MM"
),
// 记录提交月份
originData
:
{
baseInfo
,
tempForm
:
this
.
list
},
};
console
.
log
(
"item,item"
,
item
)
return
item
;
},
// 暂存
saveDraft
()
{
uni
.
showToast
({
title
:
"暂存成功"
,
icon
:
"success"
,
saveDraft
(
isSave
=
true
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
isSave
)
{
// 写入草稿文件 更新 store 草稿内容
const
params
=
this
.
getParams
();
params
.
isSubmit
=
0
;
this
.
$store
.
commit
(
"SET_DARF_DATA"
,
params
);
// 缓存[巡检信息]
writeDarf
(
params
).
then
((
res
)
=>
{
console
.
log
(
"写入草稿文件成功"
);
uni
.
showToast
({
icon
:
"success"
,
title
:
"保存草稿成功"
,
});
});
// 新增日志信息
const
logContent
=
getLogContent
(
LOG_TYPE_ENUM
.
darf
,
`
${
params
.
recordName
}
(
${
params
.
inspectionCode
}
)`
,
"巡检模块"
);
const
log_list
=
this
.
$store
.
state
.
log_list
;
logContent
.
inspectionType
=
params
.
inspectionType
;
log_list
.
push
(
logContent
);
this
.
$store
.
commit
(
"SET_LOG_LIST"
,
log_list
);
addLog
(
log_list
).
then
((
res
)
=>
{
console
.
log
(
"日志文件写入成功"
);
});
}
resolve
();
});
},
// 检查当前 Tab 的必填项是否填写完整
isCurrentTabValid
()
{
const
currentTabData
=
this
.
tabData
[
this
.
activeTab
];
const
currentTabData
=
this
.
list
[
this
.
activeTab
];
console
.
log
(
"currentTabData"
,
currentTabData
)
return
(
currentTabData
.
sliderValue
!==
null
&&
// 巡检结论必填
currentTabData
.
summary
.
trim
()
!==
""
// 情况摘要必填
currentTabData
.
inspectionResult
!==
null
&&
// 巡检结论必填
currentTabData
.
conclusion
.
trim
()
!==
""
// 情况摘要必填
// 现场照片为非必填项,不做校验
);
},
...
...
@@ -244,7 +384,7 @@
const
historyData
=
{
location
:
this
.
location
,
randomDescription
:
this
.
randomDescription
,
tabData
:
this
.
tabData
,
tabData
:
this
.
list
,
firstSubmitTime
:
this
.
firstSubmitTime
,
};
uni
.
setStorageSync
(
"inspectionHistory"
,
historyData
);
...
...
utils/dict.js
浏览文件 @
f687a284
...
...
@@ -894,7 +894,8 @@ export const pad_2_1_inspection_items = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"phones"
:[],
//现场照片
},
{
"createBy"
:
"admin"
,
...
...
@@ -911,7 +912,8 @@ export const pad_2_1_inspection_items = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"phones"
:[],
},
{
"createBy"
:
"admin"
,
...
...
@@ -928,7 +930,8 @@ export const pad_2_1_inspection_items = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"phones"
:[],
}
],
"code"
:
200
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论