Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
computedRoomPad
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
邓文彬
computedRoomPad
Commits
4952c520
提交
4952c520
authored
3月 04, 2025
作者:
caodi\cd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:校验
上级
f687a284
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
139 行增加
和
98 行删除
+139
-98
shaftInspectionNew.vue
pages/shaftInspection/shaftInspectionNew.vue
+139
-98
没有找到文件。
pages/shaftInspection/shaftInspectionNew.vue
浏览文件 @
4952c520
...
@@ -13,8 +13,8 @@
...
@@ -13,8 +13,8 @@
<view
class=
"title-bar"
>
<view
class=
"title-bar"
>
<view
class=
"blue-line"
></view>
<view
class=
"blue-line"
></view>
<text
class=
"title"
>
巡检井道:
</text>
<text
class=
"title"
>
巡检井道:
</text>
<text
class=
"location"
>
{{
location
}}
</text>
<text
class=
"location"
>
{{
location
}}
{{
floor
}}
</text>
<button
class=
"submit-btn"
:class=
"
{ active: isSubmitEnabled }" :disabled="!isSubmitEnabled">
<button
class=
"submit-btn"
:class=
"
{ active: isSubmitEnabled }" :disabled="!isSubmitEnabled"
@click="submit"
>
提交
提交
</button>
</button>
</view>
</view>
...
@@ -58,7 +58,7 @@
...
@@ -58,7 +58,7 @@
<text
class=
"form-label"
>
现场照片:
</text>
<text
class=
"form-label"
>
现场照片:
</text>
<text
class=
"photo-limit"
>
(最多5张)
</text>
<text
class=
"photo-limit"
>
(最多5张)
</text>
<view
class=
"photo-container"
>
<view
class=
"photo-container"
>
<view
v-for=
"(photo, index) in
tabData
[activeTab].photos"
:key=
"index"
class=
"photo-item"
>
<view
v-for=
"(photo, index) in
list
[activeTab].photos"
:key=
"index"
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)"
>
×
</text>
</view>
</view>
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
<!-- 模块4:提交模块 -->
<!-- 模块4:提交模块 -->
<view
class=
"module submit-module"
>
<view
class=
"module submit-module"
>
<button
class=
"action-btn"
@
click=
"saveDraft"
>
暂存
</button>
<button
class=
"action-btn"
@
click=
"saveDraft"
>
暂存
</button>
<button
class=
"action-btn complete-btn"
@
click=
"
submit
"
>
<button
class=
"action-btn complete-btn"
@
click=
"
complete
"
>
完成
完成
</button>
</button>
</view>
</view>
...
@@ -119,7 +119,8 @@
...
@@ -119,7 +119,8 @@
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
location
:
"A座2楼"
,
// 从上一个页面带过来的位置
location
:
"A座"
,
// 从上一个页面带过来的位置
floor
:
"2楼"
,
// 从上一个页面带过来的位置
isSubmitEnabled
:
false
,
// 提交按钮是否可点击
isSubmitEnabled
:
false
,
// 提交按钮是否可点击
randomDescription
:
"这是一段随机说明文字。"
,
// 随机说明文字
randomDescription
:
"这是一段随机说明文字。"
,
// 随机说明文字
tabs
:
[{
tabs
:
[{
...
@@ -139,22 +140,6 @@
...
@@ -139,22 +140,6 @@
inspectionResult
:
0
,
// Switch 值(0: 正常, 1: 异常)
inspectionResult
:
0
,
// Switch 值(0: 正常, 1: 异常)
conclusion
:
""
,
// 情况摘要
conclusion
:
""
,
// 情况摘要
photos
:
[],
// 现场照片
photos
:
[],
// 现场照片
tabData
:
[{
inspectionResult
:
0
,
conclusion
:
""
,
photos
:
[]
},
// 门禁
{
inspectionResult
:
0
,
conclusion
:
""
,
photos
:
[]
},
// 卫生
{
inspectionResult
:
0
,
conclusion
:
""
,
photos
:
[]
},
// 设备告警
],
historyData
:
null
,
// 历史数据
historyData
:
null
,
// 历史数据
firstSubmitTime
:
null
,
// 首次提交时间
firstSubmitTime
:
null
,
// 首次提交时间
detailsInfo
:
{},
// 详情
detailsInfo
:
{},
// 详情
...
@@ -162,18 +147,24 @@
...
@@ -162,18 +147,24 @@
list
:
[],
//巡检信息
list
:
[],
//巡检信息
};
};
},
},
watch
:
{
computed
:
{
// 监听当前 Tab 数据变化,更新提交按钮状态
userInfo
()
{
isCurrentTabValid
(
newVal
)
{
return
this
.
$store
.
state
.
now_user
||
{};
this
.
isSubmitEnabled
=
newVal
;
},
},
// isOperationPermissions() {
// // 是否有操作权限
// const {
// uid,
// createByName
// } = this.detailsInfo;
// return !uid || (uid && createByName == this.userInfo.user);
// },
},
},
onLoad
()
{
onLoad
()
{
this
.
loadHistoryData
();
this
.
loadHistoryData
();
},
},
mounted
()
{
mounted
()
{
this
.
init
();
this
.
init
();
this
.
coverlist
();
},
},
methods
:
{
methods
:
{
// 初始化
// 初始化
...
@@ -181,50 +172,33 @@
...
@@ -181,50 +172,33 @@
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// 判断是否有回显数据
// 判断是否有回显数据
if
(
this
.
detailsInfo
&&
this
.
detailsInfo
.
inspectionType
)
{}
else
{
if
(
this
.
detailsInfo
&&
this
.
detailsInfo
.
inspectionType
)
{}
else
{
// 基础数据
this
.
baseInfo
=
{
this
.
baseInfo
=
{
inspectionType
:
"2"
,
inspectionType
:
"2"
,
inspectionCode
:
`JFXJ
${
moment
().
format
(
"yyyyMMDDHHmmss"
)}${(
Math
.
floor
(
Math
.
random
()
*
900
)
+
100
)}
`
,
inspectionCode
:
`JFXJ
${
moment
().
format
(
"yyyyMMDDHHmmss"
)}${(
Math
.
floor
(
Math
.
random
()
*
900
)
+
100
)}
`
,
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
,
createByName
:
this
.
$store
.
state
.
now_user
.
user
,
createByName
:
this
.
$store
.
state
.
now_user
.
user
,
isException
:
""
,
// 是否有异常
isException
:
""
,
// 是否有异常
position
:
""
,
// 位置
position
:
this
.
location
,
// 位置
floor
:
this
.
floor
,
// 楼层
isSubmit
:
""
,
// 0 是草稿态; 1 是正式提交
isSubmit
:
""
,
// 0 是草稿态; 1 是正式提交
conclusion
:
""
,
//摘要
conclusion
:
""
,
//摘要
creatTime
:
`
${
new
Date
().
getTime
()}
`
,
creatTime
:
`
${
new
Date
().
getTime
()}
`
,
items
:
[],
items
:
[
// {
// "itemCode": "1", // 检查项
// "measuredData": "2,3", // 异常的楼层
// "inspectionResult": "1" // 检查项的结果, 1是异常 0 是正常
// },
],
};
};
}
}
console
.
log
(
2222
,
this
.
baseInfo
)
console
.
log
(
2222
,
this
.
baseInfo
)
this
.
coverlist
();
resolve
();
resolve
();
});
});
},
},
// 返回
back
()
{
uni
.
navigateBack
();
},
// 打开弹窗
openPopup
()
{
this
.
$refs
.
popup
.
open
();
},
// 关闭弹窗
closePopup
()
{
this
.
switchTab
((
this
.
activeTab
+
1
)
%
this
.
tabs
.
length
);
this
.
$refs
.
popup
.
close
();
},
// 加载历史数据
// 加载历史数据
loadHistoryData
()
{
loadHistoryData
()
{
const
history
=
uni
.
getStorageSync
(
"inspectionHistory"
);
const
history
=
uni
.
getStorageSync
(
"inspectionHistory"
);
console
.
log
(
"history"
,
history
)
if
(
history
&&
Date
.
now
()
-
history
.
firstSubmitTime
<
168
*
60
*
60
*
1000
)
{
if
(
history
&&
Date
.
now
()
-
history
.
firstSubmitTime
<
168
*
60
*
60
*
1000
)
{
this
.
historyData
=
history
;
this
.
historyData
=
history
;
this
.
location
=
history
.
location
;
this
.
location
=
history
.
location
;
...
@@ -236,7 +210,8 @@
...
@@ -236,7 +210,8 @@
},
},
// 数据结构重组
// 数据结构重组
coverlist
()
{
coverlist
()
{
const
temp
=
pad_2_1_inspection_items
.
rows
.
map
((
item
)
=>
{
// 获取井道巡检的三个检查项固定数据再进行处理
const
data
=
pad_2_1_inspection_items
.
rows
.
map
((
item
)
=>
{
return
{
return
{
// ...item,
// ...item,
dictLabel
:
item
.
dictLabel
,
dictLabel
:
item
.
dictLabel
,
...
@@ -245,29 +220,16 @@
...
@@ -245,29 +220,16 @@
// roomType,
// roomType,
inspectionResult
:
0
,
// 异常结论
inspectionResult
:
0
,
// 异常结论
itemCode
:
item
.
dictValue
,
// 检查项 如:门禁
itemCode
:
item
.
dictValue
,
// 检查项 如:门禁
resultArr
:
[{
measuredData
:
this
.
floor
,
// 逗号分隔字符串
value
:
0
,
label
:
"正常"
,
isActive
:
true
,
},
{
value
:
1
,
label
:
"异常"
,
isActive
:
false
,
},
],
measuredData
:
""
,
// 逗号分隔字符串
measuredDataArr
:
[],
// 前端本地使用
photos
:
[],
// 照片
photos
:
[],
// 照片
postionList
:
[{
postionList
:
[{
...
pad_2_1_floor
.
rows
[
0
],
...
pad_2_1_floor
.
rows
[
0
],
dictLabel
:
location
,
isActive
:
false
,
isActive
:
false
,
}]
}]
};
};
});
});
this
.
list
=
temp
;
this
.
list
=
data
;
},
},
// 更新当前 Tab 数据
// 更新当前 Tab 数据
...
@@ -277,16 +239,6 @@
...
@@ -277,16 +239,6 @@
this
.
conclusion
=
currentTabData
.
conclusion
;
this
.
conclusion
=
currentTabData
.
conclusion
;
this
.
photos
=
currentTabData
.
photos
;
this
.
photos
=
currentTabData
.
photos
;
},
},
// 切换 Tab
switchTab
(
index
)
{
this
.
activeTab
=
index
;
this
.
updateCurrentTabData
();
},
// Switch 值变化
onSwitchChange
(
e
)
{
this
.
inspectionResult
=
e
.
detail
.
value
?
1
:
0
;
this
.
list
[
this
.
activeTab
].
inspectionResult
=
this
.
inspectionResult
;
},
// 拍照
// 拍照
takePhoto
()
{
takePhoto
()
{
uni
.
chooseImage
({
uni
.
chooseImage
({
...
@@ -311,22 +263,23 @@
...
@@ -311,22 +263,23 @@
},
// 处理提交数据
},
// 处理提交数据
getParams
()
{
getParams
()
{
const
baseInfo
=
this
.
baseInfo
;
const
baseInfo
=
this
.
baseInfo
;
console
.
log
(
"this.list"
,
this
.
list
)
const
tempForm
=
this
.
list
;
console
.
log
(
"this.list"
,
this
.
list
)
const
item
=
{
const
data
=
{
...
baseInfo
,
...
baseInfo
,
isSubmit
:
0
,
isSubmit
:
1
,
//是否提交
items
:
[],
items
:
[],
synchronization
:
0
,
// 是否
导出
过
synchronization
:
0
,
// 是否
同步
过
submitTime
:
moment
().
format
(
"yyyy-MM-DD"
),
// 记录提交时间
submitTime
:
moment
().
format
(
"yyyy-MM-DD"
),
// 记录提交时间
submitMonth
:
moment
().
format
(
"yyyy-MM"
),
// 记录提交月份
submitMonth
:
moment
().
format
(
"yyyy-MM"
),
// 记录提交月份
originData
:
{
originData
:
{
baseInfo
,
baseInfo
,
tempForm
:
this
.
list
tempForm
,
},
},
};
};
console
.
log
(
"
item,item"
,
item
)
console
.
log
(
"
getParams,data"
,
data
)
return
item
;
return
data
;
},
},
// 暂存
// 暂存
saveDraft
(
isSave
=
true
)
{
saveDraft
(
isSave
=
true
)
{
...
@@ -335,6 +288,7 @@
...
@@ -335,6 +288,7 @@
if
(
isSave
)
{
if
(
isSave
)
{
// 写入草稿文件 更新 store 草稿内容
// 写入草稿文件 更新 store 草稿内容
const
params
=
this
.
getParams
();
const
params
=
this
.
getParams
();
console
.
log
(
"params"
,
params
)
params
.
isSubmit
=
0
;
params
.
isSubmit
=
0
;
this
.
$store
.
commit
(
"SET_DARF_DATA"
,
params
);
// 缓存[巡检信息]
this
.
$store
.
commit
(
"SET_DARF_DATA"
,
params
);
// 缓存[巡检信息]
...
@@ -367,28 +321,92 @@
...
@@ -367,28 +321,92 @@
},
},
// 检查当前 Tab 的必填项是否填写完整
// 检查当前 Tab 的必填项是否填写完整
isCurrentTabValid
()
{
isCurrentTabValid
()
{
const
currentTabData
=
this
.
list
[
this
.
activeTab
];
const
data
=
this
.
list
console
.
log
(
"currentTabData"
,
currentTabData
)
// 校验函数
return
(
const
validateData
=
(
data
)
=>
{
currentTabData
.
inspectionResult
!==
null
&&
// 巡检结论必填
return
data
.
every
(
currentTabData
.
conclusion
.
trim
()
!==
""
// 情况摘要必填
(
item
)
=>
// 现场照片为非必填项,不做校验
item
.
inspectionResult
!==
null
&&
item
.
conclusion
.
trim
()
!==
""
);
);
};
// 调用校验函数
const
isValid
=
validateData
(
data
);
console
.
log
(
141
,
isValid
)
return
isValid
},
},
// 完成
// 完成
complete
()
{
this
.
saveDraft
().
then
(()
=>
{
if
(
this
.
isCurrentTabValid
())
{
this
.
isSubmitEnabled
=
true
}
else
{
this
.
isSubmitEnabled
=
false
this
.
openPopup
()
}
})
},
// 提交
submit
()
{
submit
()
{
// 校验是否通过
if
(
this
.
isCurrentTabValid
())
{
if
(
this
.
isCurrentTabValid
())
{
if
(
!
this
.
firstSubmitTime
)
{
if
(
!
this
.
firstSubmitTime
)
{
this
.
firstSubmitTime
=
Date
.
now
();
this
.
firstSubmitTime
=
Date
.
now
();
}
}
const
historyData
=
{
const
params
=
this
.
getParams
();
//数据获取
location
:
this
.
location
,
const
all_data
=
this
.
$store
.
state
.
all_data
;
//获取全部数据
randomDescription
:
this
.
randomDescription
,
const
uid
=
""
tabData
:
this
.
list
,
params
.
isSubmit
=
1
;
//修改提交状态
firstSubmitTime
:
this
.
firstSubmitTime
,
let
logContent
=
""
;
};
if
(
uid
)
{
uni
.
setStorageSync
(
"inspectionHistory"
,
historyData
);
this
.
openPopup
()
}
{
params
.
uid
=
new
Date
().
getTime
();
// 唯一标识 pad 端使用
all_data
.
push
(
params
);
logContent
=
getLogContent
(
LOG_TYPE_ENUM
.
add
,
`
${
params
.
recordName
}
(
${
params
.
inspectionCode
}
)`
,
"巡检模块"
);
}
// 更新巡检list
const
userInfo
=
this
.
userInfo
;
this
.
$store
.
commit
(
"SET_ALL_DATA"
,
all_data
);
const
inspectList
=
all_data
.
filter
(
(
item
)
=>
item
.
createByName
==
userInfo
.
user
);
writeInspectionData
(
inspectList
,
userInfo
.
user
);
// 更新日志
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
(
"日志文件写入成功"
);
});
// 清空草稿数据
this
.
$store
.
commit
(
"SET_DARF_DATA"
,
{});
// 缓存[巡检信息]
writeDarf
(
""
).
then
((
res
)
=>
{
console
.
log
(
"写入草稿文件成功"
);
});
// 清空基础缓存信息
this
.
$store
.
commit
(
"SET_TEMP_DATA"
,
{});
// 缓存[巡检信息]
// const historyData = {
// location: this.location,
// randomDescription: this.randomDescription,
// tabData: this.list,
// firstSubmitTime: this.firstSubmitTime,
// };
// uni.setStorageSync("inspectionHistory", historyData);
uni
.
showToast
({
title
:
"提交成功"
,
icon
:
"success"
,
});
}
else
{
}
else
{
uni
.
showToast
({
uni
.
showToast
({
title
:
"请填写完整必填项"
,
title
:
"请填写完整必填项"
,
...
@@ -396,6 +414,29 @@
...
@@ -396,6 +414,29 @@
});
});
}
}
},
},
// 切换 Tab
switchTab
(
index
)
{
this
.
activeTab
=
index
;
this
.
updateCurrentTabData
();
},
// Switch 值变化
onSwitchChange
(
e
)
{
this
.
inspectionResult
=
e
.
detail
.
value
?
1
:
0
;
this
.
list
[
this
.
activeTab
].
inspectionResult
=
this
.
inspectionResult
;
},
// 返回
back
()
{
uni
.
navigateBack
();
},
// 打开弹窗
openPopup
()
{
this
.
$refs
.
popup
.
open
();
},
// 关闭弹窗
closePopup
()
{
this
.
switchTab
((
this
.
activeTab
+
1
)
%
this
.
tabs
.
length
);
this
.
$refs
.
popup
.
close
();
},
},
},
};
};
</
script
>
</
script
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论