Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
computedRoomPad
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
邓文彬
computedRoomPad
Commits
1601fb0f
提交
1601fb0f
authored
3月 17, 2025
作者:
caodi\cd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:井道
上级
ce8587c0
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
1686 行增加
和
226 行删除
+1686
-226
index.vue
pages/inspectionManagement/index.vue
+1
-0
shaftInspection.vue
pages/shaftInspection/shaftInspection.vue
+6
-1
shaftInspectionList.vue
pages/shaftInspection/shaftInspectionList.vue
+483
-62
shaftInspectionNew - 副本.vue
pages/shaftInspection/shaftInspectionNew - 副本.vue
+948
-0
shaftInspectionNew.vue
pages/shaftInspection/shaftInspectionNew.vue
+216
-144
dict.js
utils/dict.js
+32
-19
没有找到文件。
pages/inspectionManagement/index.vue
浏览文件 @
1601fb0f
...
...
@@ -165,6 +165,7 @@
});
this
.
list
=
list
;
console
.
log
(
"this.list"
,
this
.
list
)
},
coverData
(
arr
=
[])
{
...
...
pages/shaftInspection/shaftInspection.vue
浏览文件 @
1601fb0f
...
...
@@ -336,7 +336,9 @@ export default {
.
filter
((
item
)
=>
item
.
isVaild
)
.
map
((
item
)
=>
item
.
value
)
.
join
(
","
);
console
.
log
(
"baseInfo"
,
baseInfo
)
console
.
log
(
"tempForm"
,
tempForm
)
console
.
log
(
"fillCheck"
,
fillCheck
)
const
temp
=
this
.
tabList
.
map
((
item
,
index
)
=>
{
const
items
=
((
tempForm
[
index
]
||
{}).
temp
||
[]).
map
((
ele
)
=>
{
return
{
...
...
@@ -364,6 +366,7 @@ export default {
};
});
console
.
log
(
"temp"
,
temp
)
const
item
=
{
...
temp
[
0
],
isSubmit
:
0
,
...
...
@@ -378,7 +381,9 @@ export default {
tempForm
,
},
};
console
.
log
(
"item"
,
item
)
item
[
baseInfo
.
inspectionCode
]
=
temp
;
console
.
log
(
"item"
,
baseInfo
.
inspectionCode
)
return
item
;
},
...
...
pages/shaftInspection/shaftInspectionList.vue
浏览文件 @
1601fb0f
...
...
@@ -9,7 +9,7 @@
</block>
<block
slot=
"right"
class=
"nav-right"
>
<view
class=
"header-buttons"
>
<
button
class=
"button"
@
click=
"lookLog"
>
查看样表
</button
>
<
!--
<button
class=
"button"
@
click=
"lookLog"
>
查看样表
</button>
--
>
</view>
</block>
</uni-nav-bar>
...
...
@@ -21,14 +21,14 @@
<image
src=
"@/static/img/add-img/home1.png"
mode=
"aspectFit"
></image>
</view>
<view
class=
"info"
>
<view
class=
"username"
>
{{
userInfo
.
user
}}
啊啊啊
</view>
<view
class=
"number"
>
巡检编号:
<text
class=
"value"
>
111111
</text></view>
<view
class=
"username"
>
{{
userInfo
.
user
}}
</view>
<view
class=
"number"
>
巡检编号:
<text
class=
"value"
>
{{
inspectionCode
}}
</text></view>
</view>
</view>
<view
class=
"profile-right"
>
<button
class=
"record-button"
@
click=
"toListingManagement"
>
<
!--
<
button
class=
"record-button"
@
click=
"toListingManagement"
>
巡检人签字
</button>
</button>
-->
</view>
</view>
</view>
...
...
@@ -36,7 +36,7 @@
<!-- 左侧模块 -->
<view
class=
"left-side"
>
<view
v-for=
"(tab, index) in tabs"
:key=
"index"
:class=
"['tab-item',
{ active: activeTab === index }]"
@click="
activeTab = index
">
@click="
getActiveTab(index)
">
{{
tab
}}
</view>
</view>
...
...
@@ -50,17 +50,20 @@
</view>
<!-- 第二部分:卡片组 -->
<view
class=
"card-group"
>
<view
class=
"card-title"
>
{{
tabs
[
activeTab
]
}}
</view>
<view
class=
"card-list"
>
<view
v-for=
"(card, index) in cards"
:key=
"index"
class=
"card"
>
<view
class=
"card-content"
>
<view
class=
"status-line"
>
<image
src=
"/static/status-icon.png"
class=
"status-icon"
/>
<text
class=
"status-text"
>
巡检中
</text>
</view>
<view
class=
"info-line"
>
<text
class=
"info-text"
>
{{
card
}}
</text>
<view
class=
"card-box"
>
<view
class=
"card-group"
v-for=
"(item, index) in cardsInfo"
:key=
"index"
>
<view
class=
"card-title"
>
{{
item
.
name
}}
</view>
<view
class=
"card-list"
>
<view
v-for=
"position in item.position"
:key=
"position.dictValue"
class=
"card"
@
click=
"toShaftInspection(item.value,position.dictValue,item.name+position.dictLabel)"
>
<view
class=
"card-content"
>
<view
class=
"status-line"
>
<image
src=
"/static/status-icon.png"
class=
"status-icon"
/>
<text
class=
"status-text"
>
巡检中
</text>
</view>
<view
class=
"info-line"
>
<text
class=
"info-text"
>
{{
item
.
name
}}{{
position
.
dictLabel
}}
</text>
</view>
</view>
</view>
</view>
...
...
@@ -73,26 +76,436 @@
<
script
>
import
moment
from
"moment"
;
import
Tabs
from
"./model/tabs.vue"
;
import
TabContentItem
from
"./model/tabContentItem.vue"
;
import
{
addLog
,
getLogContent
,
LOG_TYPE_ENUM
,
writeDarf
,
writeInspectionData
,
}
from
"@/utils/IoReadingAndWriting.js"
;
import
{
pad_2_1_inspection_position
,
pad_2_1_floor
}
from
"@/utils/dict.js"
;
import
{
getInspectionDetails
,
getDarft
}
from
"@/request/index.js"
;
export
default
{
data
()
{
return
{
tabs
:
[
"所有井道"
,
"A座"
,
"B座"
,
"C座"
,
"D座"
,
"E座"
,
"F座"
],
// 选项卡内容
tabs
:
[
"所有井道"
],
// 选项卡内容
activeTab
:
0
,
// 默认选中的选项卡
inspectedCount
:
5
,
// 已巡检的井道数量
cards
:
[
"A座-1楼"
,
"A座-2楼"
,
"A座-3楼"
,
"A座-4楼"
,
"A座-5楼"
,
"A座-6楼"
,
"A座-7楼"
,
"A座-8楼"
],
// 卡片内容
inspectionCode
:
`JFXJ
${
moment
().
format
(
"yyyyMMDDHHmmss"
)}${(
Math
.
floor
(
Math
.
random
()
*
900
)
+
100
)}
`
,
cardsInfo
:
[],
//卡片数据
tabList
:
[],
activeTabIndex
:
0
,
baseInfo
:
{},
// 基础信息
tempForm
:
{
// 对应每个tab下的数据 [示例 0: 数据]
},
detailsInfo
:
{},
// 详情
isDisable
:
false
,
// 禁用
};
},
computed
:
{
userInfo
()
{
return
this
.
$store
.
state
.
now_user
||
{};
},
isOperationPermissions
()
{
// 是否有操作权限
const
{
uid
,
createByName
}
=
this
.
detailsInfo
;
return
!
uid
||
(
uid
&&
createByName
==
this
.
userInfo
.
user
);
},
},
onLoad
(
options
)
{
this
.
isDisable
=
options
.
isDisable
==
1
?
true
:
false
;
if
(
options
.
uid
)
{
this
.
getDetails
(
options
.
uid
);
}
else
if
(
options
.
isDarf
)
{
// 获取草稿数据
uni
.
showLoading
();
getDarft
()
.
then
((
res
)
=>
{
const
darf_data
=
res
||
{};
this
.
baseInfo
=
darf_data
.
originData
.
baseInfo
;
this
.
tempForm
=
darf_data
.
originData
.
tempForm
;
this
.
detailsInfo
=
darf_data
;
uni
.
hideLoading
();
this
.
init
();
})
.
catch
((
error
)
=>
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
uni
.
hideLoading
();
});
}
},
mounted
()
{
this
.
init
();
},
methods
:
{
// 返回
init
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
tabList
=
pad_2_1_inspection_position
.
rows
.
map
((
item
,
index
)
=>
{
this
.
tabs
.
push
(
item
.
dictLabel
)
return
{
name
:
item
.
dictLabel
,
value
:
item
.
dictValue
,
isVaild
:
false
,
// 校验通过
// type: 1, // 枚举值
position
:
pad_2_1_floor
.
rows
,
refName
:
`TabContentItem_
${
index
}
`
,
descript
:
"检查内容包括门禁、卫生、设备告警。"
,
};
});
this
.
cardsInfo
=
this
.
tabList
console
.
log
(
"this.tabList"
,
this
.
tabList
)
if
(
this
.
detailsInfo
.
inspectionType
)
{
const
fillCheck
=
this
.
detailsInfo
.
fillCheck
.
split
(
","
);
setTimeout
(()
=>
{
this
.
tabList
.
forEach
((
item
,
index
)
=>
{
item
.
isVaild
=
fillCheck
.
includes
(
item
.
value
);
this
.
tempForm
[
index
]
&&
this
.
setComponentData
(
item
.
refName
,
this
.
tempForm
[
index
]);
});
},
500
);
}
else
{
this
.
baseInfo
=
this
.
$store
.
state
.
temp_data
;
}
resolve
();
});
},
getActiveTab
(
index
)
{
this
.
activeTab
=
index
if
(
this
.
activeTab
==
0
)
{
this
.
cardsInfo
=
this
.
tabList
}
else
{
this
.
cardsInfo
=
[
this
.
tabList
[
index
+
1
]]
}
},
// 回显数据
getDetails
(
uid
)
{
uni
.
showLoading
();
getInspectionDetails
(
uid
)
.
then
((
res
)
=>
{
const
detailsInfo
=
res
;
this
.
baseInfo
=
detailsInfo
.
originData
.
baseInfo
;
this
.
tempForm
=
detailsInfo
.
originData
.
tempForm
;
this
.
detailsInfo
=
detailsInfo
;
this
.
isDisable
=
this
.
isDisable
||
detailsInfo
.
synchronization
==
1
;
// 是否禁用 1:已同步数据 0: 未同步数据
uni
.
hideLoading
();
this
.
init
();
})
.
catch
((
error
)
=>
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
uni
.
hideLoading
();
});
},
// 回显组件数据
setComponentData
(
refName
,
componentData
)
{
this
.
$refs
[
refName
][
0
]
&&
this
.
$refs
[
refName
][
0
].
setForm
(
componentData
);
},
//--弹出对话框
dialogInputConfirm2
()
{
// uni.redirectTo({
// url: "/pages/home/home?tabIndex=1",
// success: () => {
const
userInfo
=
this
.
userInfo
;
const
all_data
=
this
.
$store
.
state
.
all_data
;
const
detailsInfo
=
this
.
detailsInfo
;
const
baseInfo
=
this
.
baseInfo
;
const
tempAllData
=
all_data
.
filter
(
(
element
)
=>
element
.
uid
!=
detailsInfo
.
uid
);
// console.log(
// "---删除内容",
// all_data.filter((element) => element.uid == detailsInfo.uid)
// );
// 更新巡检list
this
.
$store
.
commit
(
"SET_ALL_DATA"
,
tempAllData
);
const
inspectList
=
tempAllData
.
filter
(
(
item
)
=>
item
.
createByName
==
userInfo
.
user
);
writeInspectionData
(
inspectList
,
userInfo
.
user
);
if
(
!
detailsInfo
.
uid
)
{
// 清空草稿数据
this
.
$store
.
commit
(
"SET_DARF_DATA"
,
{});
// 缓存[巡检信息]
writeDarf
(
""
).
then
((
res
)
=>
{
console
.
log
(
"写入草稿文件成功"
);
});
}
// 更新日志
const
log_list
=
this
.
$store
.
state
.
log_list
;
const
logContent
=
getLogContent
(
LOG_TYPE_ENUM
.
delete
,
`
${
baseInfo
.
recordName
}
(
${
baseInfo
.
inspectionCode
}
)`
,
"巡检模块"
);
logContent
.
inspectionType
=
baseInfo
.
inspectionType
;
log_list
.
push
(
logContent
);
this
.
$store
.
commit
(
"SET_LOG_LIST"
,
log_list
);
addLog
(
log_list
).
then
((
res
)
=>
{
console
.
log
(
"日志文件写入成功"
);
});
uni
.
showToast
({
icon
:
`success`
,
title
:
`删除成功`
,
});
uni
.
redirectTo
({
url
:
"/pages/home/home?tabIndex=1"
,
success
()
{
uni
.
hideLoading
();
},
});
// },
// });
},
// 删除
deleteClick
()
{
this
.
$refs
.
inputDialog2
.
open
();
},
// tab选中change 时间
changeTab
(
index
,
item
)
{
this
.
draft
(
this
.
activeTabIndex
,
false
,
false
).
then
(()
=>
{
this
.
activeTabIndex
=
index
;
});
},
lookTable
()
{
uni
.
navigateTo
({
url
:
"/pages/report/sampleTable?isJF=0"
,
});
},
// 跳转到具体的井道
toShaftInspection
(
value
,
dictValue
,
location
)
{
uni
.
navigateTo
({
url
:
`/pages/shaftInspection/shaftInspectionNew?value=
${
value
}
&dictValue=
${
dictValue
}
&inspectionCode=
${
this
.
inspectionCode
}
&location=
${
location
}
`
,
});
},
back
()
{
uni
.
navigateBack
();
},
// 处理提交数据
getParams
()
{
const
baseInfo
=
this
.
baseInfo
;
const
tempForm
=
this
.
tempForm
;
const
fillCheck
=
this
.
tabList
.
filter
((
item
)
=>
item
.
isVaild
)
.
map
((
item
)
=>
item
.
value
)
.
join
(
","
);
const
temp
=
this
.
tabList
.
map
((
item
,
index
)
=>
{
const
items
=
((
tempForm
[
index
]
||
{}).
temp
||
[]).
map
((
ele
)
=>
{
return
{
itemCode
:
ele
.
itemCode
,
measuredData
:
ele
.
measuredData
,
inspectionResult
:
ele
.
inspectionResult
,
};
});
// 一个tab栏下的数据,是否有异常
const
isException
=
((
tempForm
[
index
]
||
{}).
temp
||
[]).
filter
(
(
item
)
=>
item
.
inspectionResult
>
0
).
length
?
1
:
0
;
return
{
...
baseInfo
,
isSubmit
:
1
,
conclusion
:
(
tempForm
[
index
]
||
{}).
conclusion
||
""
,
fillCheck
,
position
:
item
.
value
,
isException
,
items
,
};
});
const
item
=
{
...
temp
[
0
],
isSubmit
:
0
,
isException
:
temp
.
filter
((
item
)
=>
item
.
isException
>
0
).
length
?
1
:
0
,
// 总的数据
items
:
[],
synchronization
:
0
,
// 是否导出过
submitTime
:
moment
().
format
(
"yyyy-MM-DD"
),
// 记录提交时间
submitMonth
:
moment
().
format
(
"yyyy-MM"
),
// 记录提交月份
originData
:
{
baseInfo
,
tempForm
,
},
};
item
[
baseInfo
.
inspectionCode
]
=
temp
;
return
item
;
},
// 提交按钮
submit
()
{
this
.
draft
(
this
.
activeTabIndex
,
false
,
false
).
then
(()
=>
{
const
vaild
=
this
.
$refs
.
tabs
.
isAllVails
();
if
(
vaild
)
{
/**
* 校验通过,
* 1.更新 store 数据,
* 2. 巡检list文件
* 3.清空草稿文件数据、store草稿数据
*/
const
params
=
this
.
getParams
();
const
all_data
=
this
.
$store
.
state
.
all_data
;
const
uid
=
this
.
detailsInfo
.
uid
;
params
.
isSubmit
=
1
;
let
logContent
=
""
;
// 新增 or 编辑
if
(
uid
)
{
const
index
=
all_data
.
findIndex
((
element
)
=>
element
.
uid
==
uid
);
params
.
uid
=
uid
;
all_data
[
index
]
=
params
;
logContent
=
getLogContent
(
LOG_TYPE_ENUM
.
edit
,
`
${
params
.
recordName
}
(
${
params
.
inspectionCode
}
)`
,
"巡检模块"
);
}
else
{
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"
,
{});
// 缓存[巡检信息]
}
uni
.
showToast
({
icon
:
`
${
vaild
?
"success"
:
"error"
}
`
,
title
:
`
${
vaild
?
"提交成功"
:
"请完善填写内容"
}
`
,
});
if
(
!
vaild
)
{
return
;
}
uni
.
redirectTo
({
url
:
"/pages/home/home?tabIndex=1"
,
success
()
{
uni
.
hideLoading
();
},
});
});
},
// 保存草稿按钮
draft
(
activeTabIndex
,
isSave
=
true
,
iSwtich
=
true
)
{
let
refName
=
this
.
tabList
[
activeTabIndex
].
refName
;
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
$refs
[
refName
][
0
].
vaildForm
().
then
(({
vaild
,
formData
})
=>
{
this
.
$refs
.
tabs
.
setTabVaild
(
activeTabIndex
,
vaild
,
iSwtich
)
.
then
(()
=>
{
this
.
tempForm
[
activeTabIndex
]
=
formData
;
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
();
});
});
});
},
},
};
</
script
>
...
...
@@ -310,55 +723,63 @@
}
}
.card-
group
{
flex: 1
;
.card-
box
{
overflow: auto
;
.card-title {
font-size: 12.8px;
font-weight: bold;
color: #333333;
margin-bottom: 12.8px;
}
.card-group {
flex: 1;
.card-list {
display: flex;
flex-wrap: wrap;
gap: 12.8px;
.card {
width: 105.6px;
height: 51.2px;
background-color: #f9f9f9;
border-radius: 6.4px;
padding: 6.4px 10.312px;
box-sizing: border-box;
.card-content {
display: flex;
flex-direction: column;
justify-content: space-between;
.status-line {
display: flex;
align-items: center;
.card-title {
font-size: 12.8px;
font-weight: bold;
color: #333333;
margin: 12.8px 0;
}
.status-icon {
width: 12.8px;
height: 12.8px;
margin-right: 7.112px;
}
.card-list {
display: flex;
flex-wrap: wrap;
gap: 12.8px;
.card {
width: 105.6px;
height: 51.2px;
background-color: #f9f9f9;
border-radius: 6.4px;
padding: 6.4px 10.312px;
box-sizing: border-box;
.status-text {
font-size: 9.6px;
color: #666666;
.card-content {
display: flex;
flex-direction: column;
justify-content: space-between;
.status-line {
display: flex;
align-items: center;
margin-bottom: 3px;
.status-icon {
width: 12.8px;
height: 12.8px;
margin-right: 7.112px;
}
.status-text {
font-size: 10.5px;
color: #7C7C7C;
text-align: center;
line-height: 16.5px;
font-weight: 400;
}
}
}
.info-line {
font-size: 9.6px;
color: #333333;
.info-text{
margin-left: 18.4rpx;
.info-line {
margin-left: 20px;
font-size: 10.5px;
color: #000000;
line-height: 16.5px;
font-weight: 400;
}
}
}
...
...
pages/shaftInspection/shaftInspectionNew - 副本.vue
0 → 100644
浏览文件 @
1601fb0f
<
template
>
<!-- 井道巡检操作 -->
<view
class=
"container"
>
<uni-nav-bar
:fixed=
"true"
background-color=
"rgba(214, 240, 255, 0.0)"
status-bar
rightWidth=
"300"
>
<block
slot=
"left"
>
<view
class=
"uni-nav-bar-text"
@
click=
"back"
>
<text
class=
"iconfont icon-Arrow-Left"
></text>
</view>
</block>
</uni-nav-bar>
<view
class=
"profile-section"
>
<view
class=
"profile-box"
>
<view
class=
"profile-left"
>
<view
class=
"avatar"
>
<image
src=
"@/static/img/add-img/home1.png"
mode=
"aspectFit"
></image>
</view>
<view
class=
"info"
>
<view
class=
"username"
>
井道巡检
</view>
<view
class=
"number"
>
巡检编号:
<text
class=
"value"
>
{{
location
}}{{
floor
}}
</text></view>
</view>
</view>
</view>
</view>
<!-- 模块1:巡检井道 -->
<!--
<view
class=
"module"
>
<view
class=
"title-bar"
>
<view
class=
"blue-line"
></view>
<text
class=
"title"
>
巡检井道
</text>
<text
class=
"location"
>
{{
location
}}{{
floor
}}
</text>
<button
class=
"submit-btn"
:class=
"
{ active: isSubmitEnabled }" :disabled="!isSubmitEnabled" @click="submit">
完成当前机房全部巡检
</button>
</view>
</view>
-->
<!-- 模块2:巡检说明 -->
<!--
<view
class=
"module"
>
<view
class=
"title-bar"
>
<view
class=
"blue-line"
></view>
<text
class=
"title"
>
巡检说明
</text>
</view>
<text
class=
"description"
>
{{
randomDescription
}}
</text>
</view>
-->
<!-- 模块3:Tab 操作区域 -->
<view
class=
"module"
>
<view
class=
"tab-buttons"
>
<view
v-for=
"(tab, index) in tabs"
:key=
"index"
:class=
"['tab-item',
{ active: activeTab === index }]"
@click="switchTab(index)">
<image
:src=
"tab.icon"
class=
"tab-icon"
></image>
<text
class=
"tab-text"
>
{{
tab
.
label
}}
</text>
<view
v-if=
"activeTab === index"
class=
"underline"
></view>
</view>
</view>
<view
class=
"tip"
>
<image
class=
"tip-icon"
src=
"@/static/img/add-img/home1.png"
mode=
"aspectFit"
></image>
请点击“需巡检井道”执行巡检
</view>
<view
class=
"tab-content"
>
<!-- 操作区域 -->
<view
class=
"form-item"
><text
class=
"form-label"
>
巡检项
</text>
<view
class=
"label"
>
<text>
{{
tabs
[
activeTab
].
label
}}
</text>
</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>
<text
class=
"photo-limit"
>
(最多5张)
</text>
<view
class=
"photo-container"
>
<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>
<button
@
click=
"takePhoto"
class=
"photo-btn"
>
拍照
</button>
</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=
"module submit-module"
>
<button
class=
"action-btn"
@
click=
"saveDraft"
>
暂存
</button>
<button
v-if=
"isSubmitEnabled"
class=
"action-btn"
:class=
"
{ active: isSubmitEnabled }" @click="submit">
完成巡检
</button>
<button
v-else
class=
"action-btn complete-btn"
@
click=
"closePopup"
>
下一项
</button>
</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>
</
template
>
<
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
{
location
:
"A座"
,
// 从上一个页面带过来的位置
floor
:
"2楼"
,
// 从上一个页面带过来的位置
isSubmitEnabled
:
false
,
// 提交按钮是否可点击
uid
:
""
,
randomDescription
:
"这是一段随机说明文字。"
,
// 随机说明文字
tabs
:
[{
label
:
"门禁"
,
icon
:
"../../static/img/add-img/home1.png"
},
{
label
:
"卫生"
,
icon
:
"../../static/img/add-img/home1.png"
},
{
label
:
"设备告警"
,
icon
:
"../../static/img/add-img/home1.png"
},
],
activeTab
:
0
,
// 当前选中的 Tab
inspectionResult
:
0
,
// Switch 值(0: 正常, 1: 异常)
conclusion
:
""
,
// 情况摘要
photos
:
[],
// 现场照片
historyData
:
null
,
// 历史数据
firstSubmitTime
:
null
,
// 首次提交时间
detailsInfo
:
{},
// 详情
baseInfo
:
{},
// 基础信息
list
:
[],
//巡检信息
inspectionCode
:
""
,
//编号
};
},
computed
:
{
userInfo
()
{
return
this
.
$store
.
state
.
now_user
||
{};
},
// isOperationPermissions() {
// // 是否有操作权限
// const {
// uid,
// createByName
// } = this.detailsInfo;
// return !uid || (uid && createByName == this.userInfo.user);
// },
},
onLoad
(
options
)
{
this
.
coverlist
();
this
.
isDisable
=
options
.
isDisable
==
1
?
true
:
false
;
this
.
uid
=
options
.
uid
this
.
inspectionCode
=
options
.
inspectionCode
console
.
log
(
"options"
,
options
)
if
(
options
.
uid
)
{
this
.
getDetails
(
options
.
uid
);
}
else
if
(
options
.
isDarf
)
{
// 获取草稿数据
uni
.
showLoading
();
getDarft
()
.
then
((
res
)
=>
{
console
.
log
(
"res"
,
res
)
const
darf_data
=
res
||
{};
this
.
baseInfo
=
darf_data
.
originData
.
baseInfo
;
this
.
list
=
darf_data
.
originData
.
tempForm
;
this
.
detailsInfo
=
darf_data
;
uni
.
hideLoading
();
this
.
init
();
})
.
catch
((
error
)
=>
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
uni
.
hideLoading
();
});
}
},
watch
:
{},
mounted
()
{
this
.
init
();
},
methods
:
{
// 初始化
init
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// 判断是否有回显数据
if
(
!
this
.
uid
)
{
// 基础数据
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
:
this
.
location
,
// 位置
floor
:
this
.
floor
,
// 楼层
isSubmit
:
""
,
// 0 是草稿态; 1 是正式提交
isSign
:
""
,
// 是否签字
conclusion
:
""
,
//摘要
creatTime
:
`
${
new
Date
().
getTime
()}
`
,
items
:
[],
};
}
console
.
log
(
2222
,
this
.
baseInfo
,
this
.
list
,
this
.
detailsInfo
)
resolve
();
});
},
// 回显数据
getDetails
(
uid
)
{
uni
.
showLoading
();
getInspectionDetails
(
uid
)
.
then
((
res
)
=>
{
const
detailsInfo
=
res
;
console
.
log
(
"getDetails"
,
res
)
this
.
baseInfo
=
detailsInfo
.
originData
.
baseInfo
;
this
.
list
=
detailsInfo
.
originData
.
tempForm
;
this
.
detailsInfo
=
detailsInfo
;
this
.
isDisable
=
this
.
isDisable
||
detailsInfo
.
synchronization
==
1
;
// 是否禁用 1:已同步数据 0: 未同步数据
uni
.
hideLoading
();
this
.
isSubmitEnabled
=
this
.
isAllTabValid
()
})
.
catch
((
error
)
=>
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
uni
.
hideLoading
();
});
},
// 加载历史数据
loadHistoryData
()
{
const
history
=
uni
.
getStorageSync
(
"inspectionHistory"
);
console
.
log
(
"history"
,
history
)
if
(
history
&&
Date
.
now
()
-
history
.
firstSubmitTime
<
168
*
60
*
60
*
1000
)
{
this
.
historyData
=
history
;
this
.
location
=
history
.
location
;
this
.
randomDescription
=
history
.
randomDescription
;
this
.
list
=
history
.
tabData
;
this
.
activeTab
=
0
;
// 默认切换到第一个 Tab
this
.
updateCurrentTabData
();
}
},
// 数据结构重组
coverlist
()
{
// 获取井道巡检的三个检查项固定数据再进行处理
const
data
=
pad_2_1_inspection_items
.
rows
.
map
((
item
)
=>
{
return
{
// ...item,
dictLabel
:
item
.
dictLabel
,
dictValue
:
item
.
dictValue
,
conclusion
:
""
,
// 情况摘要
// roomType,
inspectionResult
:
0
,
// 异常结论
itemCode
:
item
.
dictValue
,
// 检查项 如:门禁
measuredData
:
this
.
floor
,
// 逗号分隔字符串
photos
:
[],
// 照片
postionList
:
[{
...
pad_2_1_floor
.
rows
[
0
],
isActive
:
false
,
}]
};
});
this
.
list
=
data
;
},
// 更新当前 Tab 数据
updateCurrentTabData
()
{
const
currentTabData
=
this
.
list
[
this
.
activeTab
];
this
.
inspectionResult
=
currentTabData
.
inspectionResult
;
this
.
conclusion
=
currentTabData
.
conclusion
;
this
.
photos
=
currentTabData
.
photos
;
},
// 拍照
takePhoto
()
{
uni
.
chooseImage
({
count
:
1
,
success
:
(
res
)
=>
{
if
(
this
.
photos
.
length
<
5
)
{
this
.
photos
.
push
(
res
.
tempFilePaths
[
0
]);
this
.
list
[
this
.
activeTab
].
photos
=
this
.
photos
;
}
else
{
uni
.
showToast
({
title
:
"最多只能上传5张照片"
,
icon
:
"none"
,
});
}
},
});
},
// 删除照片
deletePhoto
(
index
)
{
this
.
photos
.
splice
(
index
,
1
);
this
.
list
[
this
.
activeTab
].
photos
=
this
.
photos
;
},
// 处理提交数据
getParams
()
{
const
baseInfo
=
this
.
baseInfo
;
const
tempForm
=
this
.
list
;
console
.
log
(
"this.list"
,
this
.
list
)
const
data
=
{
...
baseInfo
,
isSubmit
:
1
,
//是否提交
items
:
[],
synchronization
:
0
,
// 是否同步过
submitTime
:
moment
().
format
(
"yyyy-MM-DD"
),
// 记录提交时间
submitMonth
:
moment
().
format
(
"yyyy-MM"
),
// 记录提交月份
originData
:
{
baseInfo
,
tempForm
,
},
};
console
.
log
(
"getParams,data"
,
data
)
return
data
;
},
// 检查所有Tab 的必填项是否填写完整
isAllTabValid
()
{
const
data
=
this
.
list
// 校验函数
const
validateData
=
(
data
)
=>
{
return
data
.
every
(
(
item
)
=>
item
.
inspectionResult
!==
null
&&
item
.
conclusion
.
trim
()
!==
""
);
};
// 调用校验函数
const
isValid
=
validateData
(
data
);
console
.
log
(
141
,
isValid
)
return
isValid
},
// 检查当前 Tab 的必填项是否填写完整
isCurrentTabValid
()
{
const
currentTabData
=
this
.
list
[
this
.
activeTab
];
console
.
log
(
"currentTabData"
,
currentTabData
)
return
(
currentTabData
.
inspectionResult
!==
null
&&
// 巡检结论必填
currentTabData
.
conclusion
.
trim
()
!==
""
// 情况摘要必填
// 现场照片为非必填项,不做校验
);
},
// 暂存
saveDraft
(
isSave
=
true
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
isSave
)
{
// 写入草稿文件 更新 store 草稿内容
const
params
=
this
.
getParams
();
console
.
log
(
"params"
,
params
)
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
();
});
},
// 完成
complete
()
{
this
.
isSubmitEnabled
=
this
.
isAllTabValid
()
if
(
this
.
isCurrentTabValid
())
{
// 暂存All
this
.
saveDraft
().
then
(()
=>
{
if
(
this
.
isSubmitEnabled
)
{
this
.
openPopup
()
}
})
}
else
{
uni
.
showToast
({
title
:
"请填写完整必填项"
,
icon
:
"none"
,
});
}
},
// 提交
submit
()
{
// 校验是否通过
if
(
this
.
isCurrentTabValid
())
{
if
(
!
this
.
firstSubmitTime
)
{
this
.
firstSubmitTime
=
Date
.
now
();
this
.
$st
}
const
params
=
this
.
getParams
();
//数据获取
const
all_data
=
ore
.
state
.
all_data
;
//获取全部数据
params
.
isSubmit
=
1
;
//修改提交状态
let
logContent
=
""
;
if
(
this
.
uid
)
{
const
index
=
all_data
.
findIndex
((
element
)
=>
element
.
uid
==
this
.
uid
);
params
.
uid
=
this
.
uid
;
all_data
[
index
]
=
params
;
logContent
=
getLogContent
(
LOG_TYPE_ENUM
.
edit
,
`
${
params
.
recordName
}
(
${
params
.
inspectionCode
}
)`
,
"巡检模块"
);
}
{
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"
,
});
uni
.
navigateTo
({
url
:
"/pages/inspectionManagement/index"
,
});
}
else
{
uni
.
showToast
({
title
:
"请填写完整必填项"
,
icon
:
"none"
,
});
}
},
// 切换 Tab
switchTab
(
index
)
{
this
.
activeTab
=
index
;
this
.
updateCurrentTabData
();
},
// 设置巡检结论
setInspectionResult
(
value
)
{
this
.
inspectionResult
=
value
;
this
.
list
[
this
.
activeTab
].
inspectionResult
=
value
;
// 更新当前 Tab 的数据
this
.
onSwitchChange
(
value
);
// 触发 Switch 值变化的逻辑
},
// 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
>
<
style
scoped
lang=
"less"
>
/* 导航栏样式 */
.uni-nav-bar-text {
height: 36px;
width: 36px;
background: #ffffff;
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 18px;
color: #333;
text-align: center;
.iconfont {
font-size: 20px;
line-height: 36px;
}
}
.container {
padding: 24px;
}
.profile-section {
width: 100%;
margin-bottom: 12.8px;
.profile-box {
background-color: #fff;
border-radius: 9.6px;
padding: 12.8px 25.6px;
display: flex;
justify-content: space-between;
align-items: center;
.profile-left {
display: flex;
align-items: center;
.avatar {
position: relative;
width: 40.5px;
height: 40.5px;
border-radius: 50%;
overflow: hidden;
margin-right: 9px;
image {
width: 100%;
height: 100%;
}
.change-password {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.5);
text-align: center;
height: 17.6px;
font-family: PingFangSC-Regular;
font-size: 9.6px;
color: #ffffff;
line-height: 16px;
font-weight: 400;
}
}
.info {
.username {
font-size: 16px;
color: #000000;
line-height: 22.4px;
font-weight: 500;
margin-bottom: 7.2px;
}
.number {
font-size: 12.8px;
color: #4A4A4A;
line-height: 22.4px;
font-weight: 400;
.value {
color: #000000;
}
}
}
}
}
}
.module {
background: #FFFFFF;
border-radius: 12px;
padding: 16px 25px;
}
.title-bar {
display: flex;
align-items: center;
margin-bottom: 10px;
.blue-line {
width: 4px;
height: 16px;
background-color: #007AFF;
margin-right: 8px;
}
.title {
font-size: 16px;
font-weight: bold;
}
.location {
margin-left: 8px;
color: #666;
}
.submit-btn {
position: absolute;
right: 24px;
width: 20%;
background-color: #ccc;
color: #fff;
border-radius: 4px;
padding: 4px 8px;
font-size: 12px;
&.active {
background-color: #007AFF;
}
}
}
.description {
font-size: 14px;
color: #666;
}
.tab-buttons {
display: flex;
justify-content: flex-start;
/* 左对齐 */
align-items: center;
margin-bottom: 10px;
gap: 20px;
/* Tab 之间的间隔 */
/* 容器内边距 */
}
.tip {
width: 100%;
height: 34px;
background: rgba(55, 116, 246, 0.05);
border: 1px solid rgba(55, 116, 246, 0.3);
border-radius: 10px;
font-size: 14px;
color: #4A4A4A;
letter-spacing: 0;
line-height: 34px;
font-weight: 400;
padding: 0 12px;
.tip-icon {
width: 14px;
height: 14px;
margin-right: 8px;
}
}
.tab-item {
display: flex;
align-items: flex-start;
position: relative;
padding: 8px 0;
/* 上下内边距 */
cursor: pointer;
white-space: nowrap;
/* 防止文字换行 */
.tab-icon {
width: 10.5px;
height: 10.5px;
margin-bottom: 4px;
margin-right: 3px;
}
.tab-text {
font-size: 14px;
color: #333;
}
&.active {
.tab-text {
color: #3774F6;
/* 选中时的文字颜色 */
}
.underline {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 100%;
/* 横线宽度与内容一致 */
height: 2px;
background-color: #3774F6;
/* 选中时的横线颜色 */
}
}
}
.form-item {
display: flex;
align-items: center;
padding: 12px 0;
line-height: 36px;
border-bottom: 1px solid #F2F3F5;
;
.form-label {
font-size: 14px;
font-weight: bold;
margin-right: 32px;
width: 73px;
text-align: right;
.required {
color: red;
margin-right: 4px;
}
}
.switch-container {
display: flex;
gap: 12px;
/* 按钮之间的间隔 */
.status-btn {
flex: 1;
/* 按钮宽度平分 */
padding: 7px 24px;
font-size: 16px;
color: #000000;
background: #F2F2F2;
text-align: center;
font-weight: 400;
line-height: 22px;
border-radius: 18px;
&.active {
color: #FFFFFF;
background: #3774F6;
border: 0.4px solid rgba(224, 224, 224, 1);
}
}
}
.input-box {
flex: 1;
border: 1px solid #ddd;
border-radius: 4px;
padding: 6px;
font-size: 14px;
}
.photo-limit {
font-size: 12px;
color: #666;
}
.photo-container {
display: flex;
flex-wrap: wrap;
margin-bottom: 8px;
.photo-item {
position: relative;
margin-right: 8px;
margin-bottom: 8px;
.photo {
width: 80px;
height: 80px;
border-radius: 4px;
}
.delete-photo {
position: absolute;
top: -8px;
right: -8px;
background-color: #ff4d4f;
color: #fff;
width: 16px;
height: 16px;
border-radius: 50%;
text-align: center;
line-height: 16px;
font-size: 12px;
}
}
}
.photo-btn {
background-color: #007AFF;
color: #fff;
border-radius: 4px;
padding: 4px 8px;
font-size: 12px;
width: 80px;
text-align: center;
}
}
.submit-module {
display: flex;
justify-content: center;
gap: 20px;
.action-btn {
background-color: #007AFF;
color: #fff;
border-radius: 4px;
padding: 8px 16px;
font-size: 14px;
text-align: center;
&.complete-btn {
background-color: #007AFF;
}
}
}
// 弹窗内容样式
.popup-content {
background-color: white;
padding: 40px;
border-radius: 10px;
text-align: center;
position: relative;
width: 300px;
// 关闭按钮样式
.close-icon {
position: absolute;
top: 10px;
right: 10px;
font-size: 20px;
cursor: pointer;
}
// 成功图标样式
.icon-success {
font-size: 40px;
color: green;
margin-bottom: 20px;
}
// 成功文字样式
.success-text {
font-size: 18px;
margin-bottom: 20px;
}
// 下一项按钮样式
.next-button {
background-color: blue;
color: white;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
// 按钮 hover 效果
&:hover {
opacity: 0.9;
}
}
}
</
style
>
\ No newline at end of file
pages/shaftInspection/shaftInspectionNew.vue
浏览文件 @
1601fb0f
...
...
@@ -16,7 +16,7 @@
</view>
<view
class=
"info"
>
<view
class=
"username"
>
井道巡检
</view>
<view
class=
"number"
>
巡检编号:
<text
class=
"value"
>
{{
location
}}{{
floor
}}
</text></view>
<view
class=
"number"
>
位置:
<text
class=
"value"
>
{{
location
}}
</text></view>
</view>
</view>
</view>
...
...
@@ -81,16 +81,18 @@
</view>
<view
class=
"form-item"
>
<text
class=
"form-label"
>
现场照片
</text>
<text
class=
"photo-limit"
>
(最多5张)
</text>
<view
class=
"photo-container"
>
<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
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>
<button
@
click=
"takePhoto"
class=
"photo-btn"
>
拍照
</button>
</view>
</view>
</view>
...
...
@@ -103,12 +105,15 @@
</button>
</view>
-->
<view
class=
"module submit-module"
>
<button
class=
"action-btn"
@
click=
"s
aveDraft
"
>
暂存
</button>
<button
v-if=
"isSubmitEnabled"
class=
"action-btn
"
:class=
"
{ active: isSubmitEnabled }
" @click="submit">
<button
class=
"action-btn"
@
click=
"s
ubmit(false)
"
>
暂存
</button>
<button
v-if=
"isSubmitEnabled"
class=
"action-btn
complete-btn
"
@
click=
"submit"
>
完成巡检
</button>
<button
v-else
class=
"action-btn complete-btn"
@
click=
"closePopup"
>
下一项
</button>
<button
class=
"action-btn complete-btn"
@
click=
"submit(true)"
>
完成
</button>
</view>
<!-- 使用 uni-popup 组件 完成弹窗 -->
<uni-popup
ref=
"popup"
type=
"center"
>
...
...
@@ -152,8 +157,10 @@
export
default
{
data
()
{
return
{
location
:
"A座"
,
// 从上一个页面带过来的位置
floor
:
"2楼"
,
// 从上一个页面带过来的位置
location
:
""
,
value
:
""
,
dictValue
:
""
,
inspectionCode
:
""
,
isSubmitEnabled
:
false
,
// 提交按钮是否可点击
uid
:
""
,
randomDescription
:
"这是一段随机说明文字。"
,
// 随机说明文字
...
...
@@ -198,6 +205,10 @@
this
.
coverlist
();
this
.
isDisable
=
options
.
isDisable
==
1
?
true
:
false
;
this
.
uid
=
options
.
uid
this
.
location
=
options
.
location
this
.
value
=
options
.
value
this
.
dictValue
=
options
.
dictValue
this
.
inspectionCode
=
options
.
inspectionCode
console
.
log
(
"options"
,
options
)
if
(
options
.
uid
)
{
...
...
@@ -247,7 +258,6 @@
inspectionById
:
this
.
$store
.
state
.
now_user
.
userId
,
createByName
:
this
.
$store
.
state
.
now_user
.
user
,
isException
:
""
,
// 是否有异常
position
:
this
.
location
,
// 位置
floor
:
this
.
floor
,
// 楼层
isSubmit
:
""
,
// 0 是草稿态; 1 是正式提交
isSign
:
""
,
// 是否签字
...
...
@@ -311,10 +321,6 @@
itemCode
:
item
.
dictValue
,
// 检查项 如:门禁
measuredData
:
this
.
floor
,
// 逗号分隔字符串
photos
:
[],
// 照片
postionList
:
[{
...
pad_2_1_floor
.
rows
[
0
],
isActive
:
false
,
}]
};
});
...
...
@@ -332,9 +338,11 @@
takePhoto
()
{
uni
.
chooseImage
({
count
:
1
,
success
:
(
res
)
=>
{
sourceType
:
[
"camera"
],
// 可以从相机拍摄
success
:
async
(
res
)
=>
{
if
(
this
.
photos
.
length
<
5
)
{
this
.
photos
.
push
(
res
.
tempFilePaths
[
0
]);
const
base64
=
await
this
.
convertFileToBase64
(
res
.
tempFilePaths
[
0
]);
this
.
photos
.
push
(
base64
);
this
.
list
[
this
.
activeTab
].
photos
=
this
.
photos
;
}
else
{
uni
.
showToast
({
...
...
@@ -345,31 +353,95 @@
},
});
},
// 转化为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
)
{
this
.
photos
.
splice
(
index
,
1
);
this
.
list
[
this
.
activeTab
].
photos
=
this
.
photos
;
},
// 处理提交数据
getParams
()
{
getParams
(
isSubmit
)
{
const
baseInfo
=
this
.
baseInfo
;
const
tempForm
=
this
.
list
;
const
tabList
=
pad_2_1_inspection_position
.
rows
.
map
((
item
,
index
)
=>
{
return
{
name
:
item
.
dictLabel
,
value
:
item
.
dictValue
,
isVaild
:
false
,
// 校验通过
// type: 1, // 枚举值
position
:
pad_2_1_floor
.
rows
,
refName
:
`TabContentItem_
${
index
}
`
,
descript
:
"检查内容包括门禁、卫生、设备告警。"
,
};
});
this
.
updateDetails
(
tabList
,
this
.
value
,
this
.
dictValue
,
this
.
list
);
console
.
log
(
"this.list"
,
this
.
list
)
const
data
=
{
...
baseInfo
,
isSubmit
:
1
,
//是否提交
isSubmit
:
isSubmit
,
//是否提交
items
:
[],
synchronization
:
0
,
// 是否同步过
submitTime
:
moment
().
format
(
"yyyy-MM-DD"
),
// 记录提交时间
submitMonth
:
moment
().
format
(
"yyyy-MM"
),
// 记录提交月份
originData
:
{
baseInfo
,
tempForm
,
},
originData
:
tabList
,
//所有大楼和楼层的数据
};
console
.
log
(
"getParams,data"
,
data
)
return
data
;
},
// 操作结果赋值到对应位置
updateDetails
(
tabList
,
targetValue
,
targetDictValue
,
newDetails
)
{
// 检查传入的tabList是否有效
if
(
!
Array
.
isArray
(
tabList
))
{
console
.
error
(
"Invalid tabList: expected an array"
);
return
;
}
// 遍历tabList数组
tabList
.
forEach
((
item
)
=>
{
// 检查当前对象的value是否匹配
if
(
item
.
value
===
targetValue
)
{
// 检查position是否存在且是数组
if
(
item
.
position
&&
Array
.
isArray
(
item
.
position
))
{
// 遍历position数组
item
.
position
.
forEach
((
posItem
)
=>
{
// 检查dictValue是否匹配
if
(
posItem
.
dictValue
===
targetDictValue
)
{
// 找到匹配的对象,更新details
posItem
.
details
=
newDetails
;
posItem
.
status
=
1
//1表示已经巡检过
console
.
log
(
"Details updated successfully"
);
}
});
}
else
{
console
.
warn
(
"Invalid position property: expected an array"
);
}
}
});
},
// 检查所有Tab 的必填项是否填写完整
isAllTabValid
()
{
const
data
=
this
.
list
...
...
@@ -433,103 +505,103 @@
resolve
();
});
},
// 完成
complete
()
{
this
.
isSubmitEnabled
=
this
.
isAllTabValid
()
if
(
this
.
isCurrentTabValid
())
{
// 暂存All
this
.
saveDraft
().
then
(()
=>
{
if
(
this
.
isSubmitEnabled
)
{
this
.
openPopup
()
}
})
}
else
{
// // 完成
// complete() {
// this.isSubmitEnabled = this.isAllTabValid()
// if (this.isCurrentTabValid()) {
// // 暂存All
// this.saveDraft().then(() => {
// if (this.isSubmitEnabled) {
// this.openPopup()
// }
// })
// } else {
// uni.showToast({
// title: "请填写完整必填项",
// icon: "none",
// });
// }
// },
// 提交
submit
(
isSubmit
=
true
)
{
// 校验是否通过
if
(
isSubmit
&&
!
this
.
isCurrentTabValid
())
{
uni
.
showToast
({
title
:
"请填写完整必填项"
,
icon
:
"none"
,
});
return
false
}
},
// 提交
submit
()
{
// 校验是否通过
if
(
this
.
isCurrentTabValid
())
{
if
(
!
this
.
firstSubmitTime
)
{
this
.
firstSubmitTime
=
Date
.
now
();
this
.
$st
}
const
params
=
this
.
getParams
();
//数据获取
const
all_data
=
ore
.
state
.
all_data
;
//获取全部数据
params
.
isSubmit
=
1
;
//修改提交状态
let
logContent
=
""
;
if
(
this
.
uid
)
{
const
index
=
all_data
.
findIndex
((
element
)
=>
element
.
uid
==
this
.
uid
);
params
.
uid
=
this
.
uid
;
all_data
[
index
]
=
params
;
logContent
=
getLogContent
(
LOG_TYPE_ENUM
.
edit
,
`
${
params
.
recordName
}
(
${
params
.
inspectionCode
}
)`
,
"巡检模块"
);
}
{
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
if
(
!
this
.
firstSubmitTime
)
{
this
.
firstSubmitTime
=
Date
.
now
();
this
.
$st
}
const
params
=
this
.
getParams
(
1
);
//数据获取
const
all_data
=
this
.
$store
.
state
.
all_data
;
//获取全部数据
params
.
isSubmit
=
1
;
//修改提交状态
let
logContent
=
""
;
if
(
this
.
uid
)
{
const
index
=
all_data
.
findIndex
((
element
)
=>
element
.
uid
==
this
.
uid
);
params
.
uid
=
this
.
uid
;
all_data
[
index
]
=
params
;
logContent
=
getLogContent
(
LOG_TYPE_ENUM
.
edit
,
`
${
params
.
recordName
}
(
${
params
.
inspectionCode
}
)`
,
"巡检模块"
);
writeInspectionData
(
inspectList
,
userInfo
.
user
);
}
{
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
);
// 更新日志
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
(
"日志文件写入成功"
);
});
writeInspectionData
(
inspectList
,
userInfo
.
user
);
// 清空草稿数据
this
.
$store
.
commit
(
"SET_DARF_DATA"
,
{});
// 缓存[巡检信息]
writeDarf
(
""
).
then
((
res
)
=>
{
console
.
log
(
"写入草稿文件成功"
);
});
// 更新日志
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_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"
,
});
uni
.
navigateTo
({
url
:
"/pages/inspectionManagement/index"
,
});
}
else
{
uni
.
showToast
({
title
:
"请填写完整必填项"
,
icon
:
"none"
,
});
}
// 清空草稿数据
// 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"
,
});
uni
.
navigateTo
({
url
:
"/pages/inspectionManagement/index"
,
}
);
},
// 切换 Tab
switchTab
(
index
)
{
...
...
@@ -537,27 +609,17 @@
this
.
updateCurrentTabData
();
},
// 设置巡检结论
setInspectionResult
(
value
)
{
console
.
log
(
"value"
,
value
)
this
.
inspectionResult
=
value
;
this
.
list
[
this
.
activeTab
].
inspectionResult
=
value
;
// 更新当前 Tab 的数据
this
.
onSwitchChange
(
value
);
// 触发 Switch 值变化的逻辑
},
// 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
();
},
},
};
...
...
@@ -823,15 +885,16 @@
.input-box {
flex: 1;
border: 1px solid #ddd;
border-radius: 4px;
padding:
6px;
font-size: 1
4px;
font-size: 1
6px;
line-height: 2
4px;
}
.photo-limit {
font-size: 12px;
color: #666;
font-size: 16px;
color: #959595;
line-height: 24px;
font-weight: 400;
}
.photo-container {
...
...
@@ -845,9 +908,10 @@
margin-bottom: 8px;
.photo {
width:
80
px;
height:
80
px;
width:
72
px;
height:
72
px;
border-radius: 4px;
margin-left: 12px;
}
.delete-photo {
...
...
@@ -867,13 +931,15 @@
}
.photo-btn {
background-color: #007AFF;
color: #fff;
border-radius: 4px;
padding: 4px 8px;
font-size: 12px;
width: 80px;
background: #FFFFFF;
border: 0.34px solid rgba(221, 221, 221, 1);
border-radius: 2.05px;
width: 72px;
height: 72px;
font-size: 72px;
color: #CCCCCC;
text-align: center;
line-height: 64px;
}
}
...
...
@@ -883,15 +949,21 @@
gap: 20px;
.action-btn {
background-color: #007AFF;
color: #fff;
border-radius: 4px;
padding: 8px 16px;
font-size: 14px;
width: 182px;
height: 48px;
line-height: 48px;
background: #FFFFFF;
border: 1px solid rgba(224, 224, 224, 1);
box-shadow: 0px 10px 24px 0px rgba(185, 185, 185, 0.24);
border-radius: 27px 24px 24px 27px;
font-size: 20px;
color: #000000;
text-align: center;
font-weight: 400;
&.complete-btn {
background-color: #007AFF;
background-image: linear-gradient(180deg, #3773F6 0%, #2C57F6 99%);
color: #FFFFFF;
}
}
}
...
...
utils/dict.js
浏览文件 @
1601fb0f
...
...
@@ -952,7 +952,7 @@ export const pad_2_1_inspection_position = {
"remark"
:
null
,
"dictCode"
:
1313
,
"dictSort"
:
1
,
"dictLabel"
:
"A"
,
"dictLabel"
:
"A
座
"
,
"dictValue"
:
"1"
,
"dictType"
:
"pad_2_1_inspection_position"
,
"cssClass"
:
null
,
...
...
@@ -969,7 +969,7 @@ export const pad_2_1_inspection_position = {
"remark"
:
null
,
"dictCode"
:
1314
,
"dictSort"
:
2
,
"dictLabel"
:
"B"
,
"dictLabel"
:
"B
座
"
,
"dictValue"
:
"2"
,
"dictType"
:
"pad_2_1_inspection_position"
,
"cssClass"
:
null
,
...
...
@@ -986,7 +986,7 @@ export const pad_2_1_inspection_position = {
"remark"
:
null
,
"dictCode"
:
1315
,
"dictSort"
:
3
,
"dictLabel"
:
"C"
,
"dictLabel"
:
"C
座
"
,
"dictValue"
:
"3"
,
"dictType"
:
"pad_2_1_inspection_position"
,
"cssClass"
:
null
,
...
...
@@ -1003,7 +1003,7 @@ export const pad_2_1_inspection_position = {
"remark"
:
null
,
"dictCode"
:
1316
,
"dictSort"
:
4
,
"dictLabel"
:
"D"
,
"dictLabel"
:
"D
座
"
,
"dictValue"
:
"4"
,
"dictType"
:
"pad_2_1_inspection_position"
,
"cssClass"
:
null
,
...
...
@@ -1020,7 +1020,7 @@ export const pad_2_1_inspection_position = {
"remark"
:
null
,
"dictCode"
:
1317
,
"dictSort"
:
5
,
"dictLabel"
:
"E"
,
"dictLabel"
:
"E
座
"
,
"dictValue"
:
"5"
,
"dictType"
:
"pad_2_1_inspection_position"
,
"cssClass"
:
null
,
...
...
@@ -1037,7 +1037,7 @@ export const pad_2_1_inspection_position = {
"remark"
:
null
,
"dictCode"
:
1318
,
"dictSort"
:
6
,
"dictLabel"
:
"F"
,
"dictLabel"
:
"F
座
"
,
"dictValue"
:
"6"
,
"dictType"
:
"pad_2_1_inspection_position"
,
"cssClass"
:
null
,
...
...
@@ -1073,7 +1073,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1090,7 +1091,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1107,7 +1109,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1124,7 +1127,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1141,7 +1145,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1158,7 +1163,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1175,7 +1181,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1192,7 +1199,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1209,7 +1217,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1226,7 +1235,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1243,7 +1253,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1260,7 +1271,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
},
{
"createBy"
:
"admin"
,
...
...
@@ -1277,7 +1289,8 @@ export const pad_2_1_floor = {
"listClass"
:
"default"
,
"isDefault"
:
"N"
,
"status"
:
"0"
,
"default"
:
false
"default"
:
false
,
"details"
:[]
}
]
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论