Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspection-pad-web
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
专网
inspection-pad-web
Commits
30272f37
提交
30272f37
authored
4月 14, 2025
作者:
JaxBBLL
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
21d7b477
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
193 行增加
和
80 行删除
+193
-80
inspect.js
api/inspect.js
+28
-28
home.vue
pages/home/home.vue
+39
-27
inspectionContentList.vue
pages/inspectionContent/inspectionContentList.vue
+51
-17
inspectionContentNew.vue
pages/inspectionContent/inspectionContentNew.vue
+23
-1
shared.js
pages/inspectionContent/shared.js
+52
-7
没有找到文件。
api/inspect.js
浏览文件 @
30272f37
import
SqlliteDbUtil
from
"@/utils/sqllitedb"
;
import
table
from
"./sqllite/table.js"
;
import
{
fixNullVal
}
from
"@/utils/common"
;
import
{
fixNullVal
}
from
"@/utils/common"
;
// 巡检
export
default
{
...
...
@@ -15,6 +13,7 @@ FROM ${table.inspectionRecordName}
WHERE userId = '
${
data
}
'
AND createTime >= strftime('%s', 'now') - 7*24*60*60
AND inspectionType = 1
AND synFlag = 1
ORDER BY createTime DESC
LIMIT 1;`
);
...
...
@@ -41,22 +40,25 @@ LIMIT 1;`
async
selectDataForTime
(
data
)
{
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
try
{
let
inspectionTimeCondition
=
''
;
if
(
Array
.
isArray
(
data
.
inspectionTime
)
&&
data
.
inspectionTime
.
length
===
2
)
{
let
inspectionTimeCondition
=
""
;
if
(
Array
.
isArray
(
data
.
inspectionTime
)
&&
data
.
inspectionTime
.
length
===
2
)
{
const
startTime
=
new
Date
(
data
.
inspectionTime
[
0
]).
getTime
();
const
endTime
=
new
Date
(
data
.
inspectionTime
[
1
]
+
'T23:59:59'
).
getTime
();
const
endTime
=
new
Date
(
data
.
inspectionTime
[
1
]
+
"T23:59:59"
).
getTime
();
inspectionTimeCondition
=
`AND inspectionTime >= '
${
startTime
}
' AND inspectionTime <= '
${
endTime
}
'`
;
}
let
isAdmin
=
''
;
let
isAdmin
=
""
;
if
(
data
.
userId
)
{
const
userResult
=
await
sqllitedb
.
selectSQL
(
`SELECT isAdmin FROM
${
table
.
userName
}
WHERE userId = '
${
data
.
userId
}
'`
);
isAdmin
=
userResult
?.[
0
]?.
isAdmin
||
''
;
isAdmin
=
userResult
?.[
0
]?.
isAdmin
||
""
;
}
const
userCondition
=
isAdmin
?
''
:
`AND userId = '
${
data
.
userId
}
'`
;
const
userCondition
=
isAdmin
?
""
:
`AND userId = '
${
data
.
userId
}
'`
;
let
sql
=
`SELECT id,inspectionType,inspectionCode
,recordName
,userName
...
...
@@ -67,17 +69,15 @@ LIMIT 1;`
,createTime,delFlag,inspectionData
FROM
${
table
.
inspectionRecordName
}
where 1=1
${
data
.
inspectionType
?
`AND inspectionType = '
${
data
.
inspectionType
}
'`
:
''
}
${
data
.
synFlag
?
`AND synFlag = '
${
data
.
synFlag
}
'`
:
''
}
${
data
.
isException
?
`AND isException = '
${
data
.
isException
}
'`
:
''
}
${
data
.
inspectionType
?
`AND inspectionType = '
${
data
.
inspectionType
}
'`
:
""
}
${
data
.
synFlag
?
`AND synFlag = '
${
data
.
synFlag
}
'`
:
""
}
${
data
.
isException
?
`AND isException = '
${
data
.
isException
}
'`
:
""
}
${
inspectionTimeCondition
}
${
userCondition
}
and delFlag = 0
order by createTime desc`
let
rs
=
await
sqllitedb
.
selectSQL
(
sql
);
console
.
log
(
'sql'
,
sql
)
order by createTime desc`
;
let
rs
=
await
sqllitedb
.
selectSQL
(
sql
);
console
.
log
(
"sql"
,
sql
);
return
rs
;
}
catch
(
e
)
{
console
.
log
(
e
.
message
);
...
...
@@ -115,12 +115,12 @@ LIMIT 1;`
},
//更新同步
async
updateSyncData
(
data
)
{
let
ids
=
'('
+
data
.
join
(
','
)
+
')'
let
ids
=
"("
+
data
.
join
(
","
)
+
")"
;
let
sql
=
`update
${
table
.
inspectionRecordName
}
set synFlag=1 where id in
${
ids
}
`
;
try
{
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
let
rs
=
await
sqllitedb
.
executeReturnDataSQL
(
sql
);
return
rs
return
rs
;
}
catch
(
e
)
{
console
.
log
(
e
.
message
);
}
finally
{
...
...
@@ -132,7 +132,7 @@ LIMIT 1;`
try
{
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
let
rs
=
await
sqllitedb
.
executeReturnDataSQL
(
sql
);
return
rs
return
rs
;
}
catch
(
e
)
{
console
.
log
(
e
.
message
);
}
finally
{
...
...
@@ -179,12 +179,12 @@ LIMIT 1;`
idx
++
;
}
column
=
column
.
endsWith
(
","
)
?
column
.
substring
(
0
,
column
.
length
-
1
)
:
column
;
values
=
values
.
endsWith
(
","
)
?
values
.
substring
(
0
,
values
.
length
-
1
)
:
values
;
column
=
column
.
endsWith
(
","
)
?
column
.
substring
(
0
,
column
.
length
-
1
)
:
column
;
values
=
values
.
endsWith
(
","
)
?
values
.
substring
(
0
,
values
.
length
-
1
)
:
values
;
let
sql
=
`insert into
${
table
.
inspectionRecordName
}
(
${
column
}
) values(
${
values
}
)`
;
let
has
=
await
this
.
info
(
data
.
id
);
...
...
pages/home/home.vue
浏览文件 @
30272f37
...
...
@@ -2,13 +2,16 @@
<!-- 首页 -->
<view
class=
"container"
>
<!-- 第一个模块 -->
<button
@
click=
"copyFile"
>
拷贝
</button>
<view
class=
"header"
>
<view
class=
"title"
>
杭州内网监管在线-运维在线
</view>
<view
class=
"header-buttons"
>
<view
class=
"log-button"
@
click=
"lookLog"
v-if=
"isAdmin"
>
操作日志
</view>
<div
class=
"exit-button"
@
click=
"logOut"
>
<image
class=
"logout"
src=
"@/static/img/logout.svg"
mode=
"aspectFit"
></image>
<image
class=
"logout"
src=
"@/static/img/logout.svg"
mode=
"aspectFit"
></image>
</div>
</view>
</view>
...
...
@@ -18,8 +21,13 @@
<view
class=
"profile-box"
>
<view
class=
"profile-left"
>
<view
class=
"avatar"
>
<image
src=
"@/static/img/add-img/defaultAvatar.png"
mode=
"aspectFit"
></image>
<view
class=
"change-password"
@
click=
"updatePassword"
>
修改密码
</view>
<image
src=
"@/static/img/add-img/defaultAvatar.png"
mode=
"aspectFit"
></image>
<view
class=
"change-password"
@
click=
"updatePassword"
>
修改密码
</view
>
</view>
<view
class=
"username"
>
{{
userName
}}
</view>
</view>
...
...
@@ -37,29 +45,38 @@
<!-- 第三个模块 -->
<view
class=
"card-section"
>
<view
class=
"card-container"
>
<view
class=
"card"
v-for=
"(card, index) in cards"
:key=
"index"
:style=
"
{ backgroundImage: `url(${card.image})` }" @click="toList(card.url)">
<view
class=
"card"
v-for=
"(card, index) in cards"
:key=
"index"
:style=
"
{ backgroundImage: `url(${card.image})` }"
@click="toList(card.url)"
>
<view
class=
"card-text"
>
{{
card
.
text
}}
</view>
</view>
</view>
</view>
<!-- 退出账号弹出 -->
<uni-popup
ref=
"inputDialog2"
type=
"dialog"
>
<uni-popup-dialog
ref=
"inputClose2"
mode=
"base"
title=
"确定退出该账号?"
@
confirm=
"dialogInputConfirm2"
>
<uni-popup-dialog
ref=
"inputClose2"
mode=
"base"
title=
"确定退出该账号?"
@
confirm=
"dialogInputConfirm2"
>
</uni-popup-dialog>
</uni-popup>
</view>
</
template
>
<
script
>
import
{
copyDirectory
}
from
"@/utils/IoReadingAndWriting.js"
import
inspectApi
from
"@/api/inspect.js"
export
default
{
import
{
copyDirectory
}
from
"@/utils/IoReadingAndWriting.js"
;
import
inspectApi
from
"@/api/inspect.js"
;
export
default
{
data
()
{
return
{
cards
:
[{
cards
:
[
{
image
:
"../../static/img/jf.png"
,
text
:
"机房巡检"
,
url
:
"/pages/inspectionContent/inspectionContentList?backValue=home"
,
...
...
@@ -87,11 +104,6 @@
console
.
log
(
this
.
$store
.
state
);
},
methods
:
{
async
copyFile
()
{
let
res
=
await
inspectApi
.
selectLastData
(
this
.
$store
.
state
.
now_user
.
userId
)
console
.
log
(
res
,
'========='
)
},
// 修改密码
updatePassword
()
{
uni
.
navigateTo
({
...
...
@@ -146,11 +158,11 @@
});
},
},
};
};
</
script
>
<
style
scoped
lang=
"less"
>
.container {
.container {
display: flex;
flex-direction: column;
align-items: center;
...
...
@@ -158,9 +170,9 @@
height: 100vh;
background-image: linear-gradient(115deg, #e8f0fb 0%, #e1ebfa 100%);
z-index: 1;
}
}
.header {
.header {
width: 100%;
display: flex;
justify-content: space-between;
...
...
@@ -217,9 +229,9 @@
}
}
}
}
}
.profile-section {
.profile-section {
width: 720px;
.profile-box {
...
...
@@ -302,9 +314,9 @@
}
}
}
}
}
.card-section {
.card-section {
width: 720px;
margin-top: 20px;
...
...
@@ -333,5 +345,5 @@
}
}
}
}
}
</
style
>
pages/inspectionContent/inspectionContentList.vue
浏览文件 @
30272f37
...
...
@@ -230,7 +230,7 @@ import startDialog from "./components/dialog.vue";
import
assRoomApi
from
"@/api/assRoom.js"
;
import
inspectApi
from
"@/api/inspect"
;
import
{
sqlToData
,
dataToSql
}
from
"./shared"
;
import
{
sqlToData
,
dataToSql
,
getHistoryData
}
from
"./shared"
;
import
Dialog
from
"@/pages/inspectionManagement/dialog.vue"
;
export
default
{
...
...
@@ -267,6 +267,7 @@ export default {
listData
:
[],
isDialog
:
false
,
propList
:
[],
did
:
""
,
// 最近7天数据的id
};
},
computed
:
{
...
...
@@ -292,7 +293,55 @@ export default {
});
}
else
{
this
.
getRoomList
().
then
((
res
)
=>
{
// 获取7日(168小时)内最后一条巡检记录回显到页面(选项、文案、照片;异常项-不调出文案及照片)
getHistoryData
().
then
((
detailsInfo
)
=>
{
if
(
detailsInfo
)
{
// 处理历史数据(选项、文案、照片;异常项-不调出文案及照片)
console
.
log
(
"detailsInfo"
,
detailsInfo
);
this
.
did
=
detailsInfo
.
id
;
delete
detailsInfo
.
id
;
this
.
listData
=
this
.
listFormat
(
detailsInfo
.
originData
);
this
.
detailsInfo
=
detailsInfo
;
this
.
inspectionNumber
=
detailsInfo
.
inspectionNumber
;
this
.
inspectionCode
=
`JFXJ
${
moment
().
format
(
"yyyyMMDDHHmmss"
)}${
Math
.
floor
(
Math
.
random
()
*
900
)
+
100
}
`
;
this
.
cardsInfo
=
detailsInfo
.
originData
;
this
.
isSubmit
=
0
;
this
.
isSign
=
false
;
// 默认选中第一个机房
this
.
detailsItem
=
detailsInfo
.
originData
[
0
].
details
;
if
(
this
.
detailsItem
.
afxt
&&
this
.
detailsItem
.
afxt
.
detail
&&
this
.
detailsItem
.
afxt
.
detail
[
2
].
inspectionResult
===
1
)
{
this
.
detailsItem
.
afxt
.
detail
=
this
.
detailsItem
.
afxt
.
detail
.
slice
(
0
,
3
);
}
this
.
allIsSubmitOne
=
detailsInfo
.
originData
.
every
(
(
item
)
=>
item
.
isSubmit
==
1
);
let
group1
=
this
.
cardsInfo
.
slice
(
0
,
5
);
let
group2
=
this
.
cardsInfo
.
slice
(
5
,
10
);
let
group3
=
this
.
cardsInfo
.
slice
(
10
);
if
(
!
this
.
isSign
)
{
group2
=
group2
.
reverse
();
}
this
.
rows
=
[
group1
,
group2
,
group3
];
this
.
detailsInfo
=
detailsInfo
;
}
else
{
this
.
init
(
res
);
}
});
});
}
}
...
...
@@ -308,7 +357,6 @@ export default {
getRoomList
()
{
return
assRoomApi
.
selectRoomList
(
1
).
then
((
res
)
=>
{
console
.
log
(
"机房列表"
,
res
);
console
.
log
(
"机房列表"
,
JSON
.
stringify
(
res
));
return
res
;
});
},
...
...
@@ -356,20 +404,6 @@ export default {
Math
.
floor
(
Math
.
random
()
*
900
)
+
100
}
`
;
}
// 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
();
});
},
...
...
@@ -504,7 +538,7 @@ export default {
toShaftInspection
(
name
,
jfType
,
value
)
{
console
.
log
(
"name, 跳转到具体的机房, value"
,
name
,
jfType
,
value
);
uni
.
navigateTo
({
url
:
`/pages/inspectionContent/inspectionContentNew?value=
${
value
}
&inspectionCode=
${
this
.
inspectionCode
}
&jfType=
${
jfType
}
&location=
${
name
}
&uid=
${
this
.
uid
}
&backValue=
${
this
.
backValue
}
`
,
url
:
`/pages/inspectionContent/inspectionContentNew?value=
${
value
}
&inspectionCode=
${
this
.
inspectionCode
}
&jfType=
${
jfType
}
&location=
${
name
}
&uid=
${
this
.
uid
}
&backValue=
${
this
.
backValue
}
&did=
${
this
.
did
}
`
,
});
},
lookTable
()
{
...
...
pages/inspectionContent/inspectionContentNew.vue
浏览文件 @
30272f37
...
...
@@ -140,7 +140,7 @@
<
script
>
import
assRoomApi
from
"@/api/assRoom.js"
;
import
inspectApi
from
"@/api/inspect.js"
;
import
{
dataToSql
,
sqlToData
}
from
"./shared"
;
import
{
dataToSql
,
sqlToData
,
getHistoryData
}
from
"./shared"
;
import
{
pad_all_inspection_position
,
...
...
@@ -253,6 +253,28 @@ export default {
if
(
options
.
uid
)
{
this
.
getDetails
(
options
.
uid
);
}
else
if
(
options
.
did
)
{
// 临时id
getHistoryData
().
then
((
detailsInfo
)
=>
{
console
.
log
(
"history"
,
detailsInfo
);
if
(
detailsInfo
)
{
// 处理历史数据(选项、文案、照片;异常项-不调出文案及照片)
this
.
list
=
detailsInfo
.
originData
[
this
.
value
-
1
].
details
;
this
.
tabs
.
forEach
((
item
)
=>
{
if
(
this
.
list
[
item
.
value
]
&&
this
.
list
[
item
.
value
].
status
!==
undefined
)
{
item
.
status
=
this
.
list
[
item
.
value
].
status
;
}
});
this
.
detailsInfo
=
detailsInfo
;
uni
.
hideLoading
();
}
else
{
this
.
init
();
this
.
paramsObjFirst
=
this
.
getAllChildFormData
();
}
});
}
else
{
this
.
init
();
this
.
paramsObjFirst
=
this
.
getAllChildFormData
();
...
...
pages/inspectionContent/shared.js
浏览文件 @
30272f37
import
moment
from
"moment"
;
import
store
from
"@/store"
;
import
inspectApi
from
"@/api/inspect.js"
;
// 将现有机房巡检数据转换为SQL数据所需要格式
export
function
dataToSql
(
data
)
{
// let isException = 0;
// if (data.isSubmit == 0) {
// isException = 2;
// } else {
// isException = data.isException;
// }
let
synFlag
=
0
;
if
(
data
.
synchronization
===
1
)
{
synFlag
=
1
;
}
else
{
if
(
data
.
synchronization
==
2
||
!
data
.
signImg
)
{
synFlag
=
2
;
}
else
{
synFlag
=
0
;
}
}
const
send
=
{
inspectionType
:
data
.
inspectionType
,
inspectionCode
:
data
.
inspectionCode
,
...
...
@@ -17,7 +22,7 @@ export function dataToSql(data) {
isException
:
data
.
isException
,
// 是否异常:0 否 1 是
userId
:
store
.
state
.
now_user
.
userId
,
userName
:
store
.
state
.
now_user
.
user
,
synFlag
:
data
.
synchronization
,
// 0.未同步,1.已同步 2.编辑
synFlag
:
synFlag
,
// 0.未同步,1.已同步 2.编辑
signImg
:
data
.
signImg
||
""
,
createBy
:
store
.
state
.
now_user
.
userId
,
createTime
:
data
.
id
?
data
.
createTime
:
`
${
new
Date
().
getTime
()}
`
,
...
...
@@ -78,3 +83,43 @@ export function sqlToData(sqlData) {
return
ret
;
}
export
function
getHistoryData
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
inspectApi
.
selectLastData
(
store
.
state
.
now_user
.
userId
).
then
((
history
)
=>
{
if
(
history
&&
history
.
length
)
{
const
detailsInfo
=
sqlToData
(
history
[
0
]);
// 处理历史数据(选项、文案、照片;异常项-不调出文案及照片)
console
.
log
(
JSON
.
stringify
(
detailsInfo
));
setHistoryData
(
detailsInfo
);
resolve
(
detailsInfo
);
}
else
{
resolve
(
null
);
}
});
});
}
function
setHistoryData
(
list
)
{
list
.
originData
.
forEach
((
item
)
=>
{
// 如果该机房有异常项,则不调出文案及照片
if
(
item
.
status
==
2
)
{
// 外面的异常标识
item
.
isSubmit
=
0
;
Object
.
keys
(
item
.
details
).
forEach
((
key
)
=>
{
const
current
=
item
.
details
[
key
];
if
(
current
.
status
)
{
// 内部的异常标识
current
.
detail
.
forEach
((
detail
)
=>
{
// 表单项的异常
if
(
detail
.
inspectionResult
==
1
)
{
detail
.
conclusion
=
""
;
detail
.
inspectionResultLable
=
""
;
detail
.
photos
=
[];
}
});
}
});
}
});
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论