Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspection-pad-web
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
专网
inspection-pad-web
Commits
7409b5f4
提交
7409b5f4
authored
4月 09, 2025
作者:
zs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
edit
上级
cb6b97ee
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
622 行增加
和
577 行删除
+622
-577
hoistway.js
api/hoistway.js
+2
-2
inspect.js
api/inspect.js
+165
-147
init.js
api/sqllite/init.js
+1
-5
index.vue
components/CommonUpload/index.vue
+271
-258
index.vue
components/inspectionItem/index.vue
+26
-22
index.vue
components/searchCom/index.vue
+119
-120
dialog.vue
pages/inspectionManagement/dialog.vue
+1
-3
index.vue
pages/inspectionManagement/index.vue
+37
-20
没有找到文件。
api/hoistway.js
浏览文件 @
7409b5f4
...
@@ -31,7 +31,7 @@ export default {
...
@@ -31,7 +31,7 @@ export default {
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
message
)
console
.
log
(
e
.
message
)
}
finally
{
}
finally
{
await
sqllitedb
.
closeDB
();
//
await sqllitedb.closeDB();
}
}
},
},
async
info
(
id
)
{
async
info
(
id
)
{
...
@@ -45,7 +45,7 @@ export default {
...
@@ -45,7 +45,7 @@ export default {
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
message
)
console
.
log
(
e
.
message
)
}
finally
{
}
finally
{
await
sqllitedb
.
closeDB
();
//
await sqllitedb.closeDB();
}
}
},
},
...
...
api/inspect.js
浏览文件 @
7409b5f4
import
SqlliteDbUtil
from
"@/utils/sqllitedb"
;
import
SqlliteDbUtil
from
"@/utils/sqllitedb"
;
import
table
from
"./sqllite/table.js"
;
import
table
from
"./sqllite/table.js"
;
import
{
fixNullVal
}
from
"@/utils/common"
;
import
{
fixNullVal
}
from
"@/utils/common"
;
// 巡检
// 巡检
export
default
{
export
default
{
async
selectList
()
{
async
selectList
()
{
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
try
{
try
{
let
rs
=
await
sqllitedb
.
selectSQL
(
let
rs
=
await
sqllitedb
.
selectSQL
(
`select * from
${
table
.
inspectionRecordName
}
`
`select * from
${
table
.
inspectionRecordName
}
`
);
);
return
rs
;
return
rs
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
message
);
console
.
log
(
e
.
message
);
}
finally
{
}
finally
{
await
sqllitedb
.
closeDB
();
await
sqllitedb
.
closeDB
();
}
}
},
},
async
selectDataForTime
()
{
async
selectDataForTime
(
data
)
{
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
try
{
try
{
let
rs
=
await
sqllitedb
.
selectSQL
(
let
rs
=
await
sqllitedb
.
selectSQL
(
`SELECT * FROM
${
table
.
inspectionRecordName
}
order by createTime desc`
`SELECT id,inspectionType,inspectionCode
);
,recordName
return
rs
;
,userName
}
catch
(
e
)
{
,userId
console
.
log
(
e
.
message
);
,inspectionTime
}
finally
{
,isException
await
sqllitedb
.
closeDB
();
,synFlag
}
,createTime
},
FROM
${
table
.
inspectionRecordName
}
async
info
(
id
)
{
where 1=1
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
${
data
.
inspectionType
?
`AND inspectionType = '
${
data
.
inspectionType
}
'`
:
''
}
try
{
${
data
.
synFlag
?
`AND synFlag = '
${
data
.
synFlag
}
'`
:
''
}
let
sql
=
`select * from
${
table
.
inspectionRecordName
}
where id = '
${
id
}
'`
;
${
data
.
isException
?
`AND isException = '
${
data
.
isException
}
'`
:
''
}
let
res
=
await
sqllitedb
.
selectSQL
(
sql
);
${
data
.
inspectionTime
?
`AND inspectionTime >='
${
new
Date
(
data
.
inspectionTime
[
0
]).
getTime
()
}
'`
:
''
}
if
(
res
&&
res
.
length
>
0
)
{
${
data
.
inspectionTime
?
`AND inspectionTime <='
${
new
Date
(
data
.
inspectionTime
[
1
]).
getTime
()
}
'`
:
''
}
return
res
[
0
];
order by createTime desc`
}
);
}
catch
(
e
)
{
return
rs
;
console
.
log
(
e
.
message
);
}
catch
(
e
)
{
}
finally
{
console
.
log
(
e
.
message
);
await
sqllitedb
.
closeDB
();
}
finally
{
}
await
sqllitedb
.
closeDB
();
},
}
async
remove
(
id
)
{
},
if
(
!
id
)
{
async
info
(
id
)
{
return
;
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
}
try
{
let
sql
=
`delete from
${
table
.
inspectionRecordName
}
where id = '
${
id
}
'`
;
let
sql
=
`select * from
${
table
.
inspectionRecordName
}
where id = '
${
id
}
'`
;
try
{
let
res
=
await
sqllitedb
.
selectSQL
(
sql
);
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
if
(
res
&&
res
.
length
>
0
)
{
await
sqllitedb
.
executeSQL
(
sql
);
return
res
[
0
];
}
catch
(
e
)
{
}
console
.
log
(
e
.
message
);
}
catch
(
e
)
{
}
finally
{
console
.
log
(
e
.
message
);
await
sqllitedb
.
closeDB
();
}
finally
{
}
// await sqllitedb.closeDB();
},
}
async
saveBatch
(
list
)
{
},
if
(
list
.
length
===
0
)
{
async
remove
(
id
)
{
return
;
if
(
!
id
)
{
}
return
;
console
.
log
(
"开始保存用户信息...."
+
list
.
length
);
}
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
let
sql
=
`delete from
${
table
.
inspectionRecordName
}
where id = '
${
id
}
'`
;
try
{
try
{
for
(
let
data
of
list
)
{
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
let
column
=
""
;
await
sqllitedb
.
executeSQL
(
sql
);
let
values
=
""
;
}
catch
(
e
)
{
let
idx
=
0
;
console
.
log
(
e
.
message
);
for
(
let
attr
in
data
)
{
}
finally
{
let
dataField
=
table
[
"inspectionRecord"
].
find
((
v
)
=>
{
// await sqllitedb.closeDB();
if
(
v
.
field
===
attr
)
{
}
return
v
;
},
}
async
saveBatch
(
list
)
{
});
if
(
list
.
length
===
0
)
{
if
(
!
dataField
)
{
return
;
continue
;
}
}
console
.
log
(
"开始保存用户信息...."
+
list
.
length
);
column
+=
dataField
.
field
+
","
;
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
values
+=
"'"
+
fixNullVal
(
data
[
attr
])
+
"',"
;
try
{
idx
++
;
for
(
let
data
of
list
)
{
}
let
column
=
""
;
let
values
=
""
;
let
idx
=
0
;
for
(
let
attr
in
data
)
{
let
dataField
=
table
[
"inspectionRecord"
].
find
((
v
)
=>
{
if
(
v
.
field
===
attr
)
{
return
v
;
}
});
if
(
!
dataField
)
{
continue
;
}
column
+=
dataField
.
field
+
","
;
values
+=
"'"
+
fixNullVal
(
data
[
attr
])
+
"',"
;
idx
++
;
}
column
=
column
.
endsWith
(
","
)
column
=
column
.
endsWith
(
","
)
?
?
column
.
substring
(
0
,
column
.
length
-
1
)
column
.
substring
(
0
,
column
.
length
-
1
)
:
:
column
;
column
;
values
=
values
.
endsWith
(
","
)
values
=
values
.
endsWith
(
","
)
?
?
values
.
substring
(
0
,
values
.
length
-
1
)
values
.
substring
(
0
,
values
.
length
-
1
)
:
:
values
;
values
;
let
sql
=
`insert into
${
table
.
inspectionRecordName
}
(
${
column
}
) values(
${
values
}
)`
;
let
sql
=
`insert into
${
table
.
inspectionRecordName
}
(
${
column
}
) values(
${
values
}
)`
;
let
has
=
await
this
.
info
(
data
.
id
);
let
has
=
await
this
.
info
(
data
.
id
);
if
(
has
&&
has
.
id
)
{
if
(
has
&&
has
.
id
)
{
await
this
.
remove
(
data
.
id
);
await
this
.
remove
(
data
.
id
);
}
}
await
sqllitedb
.
executeSQL
(
sql
);
await
sqllitedb
.
executeSQL
(
sql
);
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
message
);
console
.
log
(
e
.
message
);
}
finally
{
}
finally
{
await
sqllitedb
.
closeDB
();
await
sqllitedb
.
closeDB
();
}
}
console
.
log
(
"导入完成..."
);
console
.
log
(
"导入完成..."
);
},
},
async
save
(
data
)
{
async
save
(
data
)
{
console
.
log
(
"开始保存巡检记录"
,
data
);
console
.
log
(
"开始保存巡检记录"
,
data
);
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
try
{
try
{
let
sql
=
`insert into
${
table
.
inspectionRecordName
}
(
let
sql
=
`insert into
${
table
.
inspectionRecordName
}
(
inspectionType,
inspectionType,
inspectionCode,
inspectionCode,
recordName,
recordName,
...
@@ -138,24 +155,24 @@ export default {
...
@@ -138,24 +155,24 @@ export default {
'
${
JSON
.
stringify
(
data
.
inspectionData
)}
'
'
${
JSON
.
stringify
(
data
.
inspectionData
)}
'
);
);
`
;
`
;
let
result
=
await
sqllitedb
.
executeReturnDataSQL
(
sql
);
let
result
=
await
sqllitedb
.
executeReturnDataSQL
(
sql
);
console
.
log
(
result
,
"有有有有有有"
);
console
.
log
(
result
,
"有有有有有有"
);
return
result
;
return
result
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
message
);
console
.
log
(
e
.
message
);
}
finally
{
}
finally
{
await
sqllitedb
.
closeDB
();
await
sqllitedb
.
closeDB
();
}
}
console
.
log
(
"导入完成..."
);
console
.
log
(
"导入完成..."
);
},
},
async
update
(
data
)
{
async
update
(
data
)
{
console
.
log
(
"开始更新巡检记录"
,
data
);
console
.
log
(
"开始更新巡检记录"
,
data
);
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
try
{
try
{
if
(
!
data
.
id
)
{
if
(
!
data
.
id
)
{
throw
new
Error
(
"更新操作需要提供 id"
);
throw
new
Error
(
"更新操作需要提供 id"
);
}
}
let
sql
=
`UPDATE
${
table
.
inspectionRecordName
}
SET
let
sql
=
`UPDATE
${
table
.
inspectionRecordName
}
SET
inspectionType = '
${
data
.
inspectionType
}
',
inspectionType = '
${
data
.
inspectionType
}
',
inspectionCode = '
${
data
.
inspectionCode
}
',
inspectionCode = '
${
data
.
inspectionCode
}
',
recordName = '
${
data
.
recordName
}
',
recordName = '
${
data
.
recordName
}
',
...
@@ -170,30 +187,30 @@ export default {
...
@@ -170,30 +187,30 @@ export default {
updateTime = '
${
data
.
updateTime
}
',
updateTime = '
${
data
.
updateTime
}
',
inspectionData = '
${
JSON
.
stringify
(
data
.
inspectionData
)}
'
inspectionData = '
${
JSON
.
stringify
(
data
.
inspectionData
)}
'
WHERE id =
${
data
.
id
}
`
;
WHERE id =
${
data
.
id
}
`
;
await
sqllitedb
.
executeSQL
(
sql
);
await
sqllitedb
.
executeSQL
(
sql
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
message
);
console
.
log
(
e
.
message
);
}
finally
{
}
finally
{
await
sqllitedb
.
closeDB
();
await
sqllitedb
.
closeDB
();
}
}
console
.
log
(
"更新完成..."
);
console
.
log
(
"更新完成..."
);
},
},
async
updateSignImg
(
data
)
{
async
updateSignImg
(
data
)
{
console
.
log
(
"开始更新巡检签名图片"
,
data
);
console
.
log
(
"开始更新巡检签名图片"
,
data
);
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
let
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
();
try
{
try
{
if
(
!
data
.
id
)
{
if
(
!
data
.
id
)
{
throw
new
Error
(
"更新操作需要提供 id"
);
throw
new
Error
(
"更新操作需要提供 id"
);
}
}
let
sql
=
`UPDATE
${
table
.
inspectionRecordName
}
SET
let
sql
=
`UPDATE
${
table
.
inspectionRecordName
}
SET
signImg = '
${
data
.
signImg
}
'
signImg = '
${
data
.
signImg
}
'
WHERE id =
${
data
.
id
}
`
;
WHERE id =
${
data
.
id
}
`
;
await
sqllitedb
.
executeSQL
(
sql
);
await
sqllitedb
.
executeSQL
(
sql
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
message
);
console
.
log
(
e
.
message
);
}
finally
{
}
finally
{
await
sqllitedb
.
closeDB
();
await
sqllitedb
.
closeDB
();
}
}
console
.
log
(
"更新完成..."
);
console
.
log
(
"更新完成..."
);
},
},
};
};
\ No newline at end of file
api/sqllite/init.js
浏览文件 @
7409b5f4
...
@@ -60,14 +60,10 @@ export default {
...
@@ -60,14 +60,10 @@ export default {
},
},
////////// 初始化数据库////////////
////////// 初始化数据库////////////
async
initSqlLite
()
{
async
initSqlLite
(
sqllitedb
)
{
console
.
log
(
'初始化数据库开始...'
)
console
.
log
(
'初始化数据库开始...'
)
let
sqllitedb
=
null
try
{
try
{
// 创建打开数据库,已经存在表则跳过
// 创建打开数据库,已经存在表则跳过
sqllitedb
=
await
SqlliteDbUtil
.
initSqlliteDB
()
console
.
log
(
sqllitedb
,
'是否存在'
)
// console.log('创建用户表...')
await
sqllitedb
.
createTable
(
table
.
metadataName
,
table
.
metadata
)
await
sqllitedb
.
createTable
(
table
.
metadataName
,
table
.
metadata
)
await
sqllitedb
.
createTable
(
table
.
userName
,
table
.
user
)
await
sqllitedb
.
createTable
(
table
.
userName
,
table
.
user
)
await
sqllitedb
.
createTable
(
table
.
inspectionRecordName
,
table
.
inspectionRecord
)
// 巡检记录表
await
sqllitedb
.
createTable
(
table
.
inspectionRecordName
,
table
.
inspectionRecord
)
// 巡检记录表
...
...
components/CommonUpload/index.vue
浏览文件 @
7409b5f4
<
template
>
<
template
>
<view
class=
"upload-container"
>
<view
class=
"upload-container"
>
<!-- 图片展示区域 -->
<!-- 图片展示区域 -->
<view
class=
"image-list"
>
<view
class=
"image-list"
>
<!-- 添加按钮 -->
<!-- 添加按钮 -->
<view
<view
v-if=
"images.length
<
maxCount
"
class=
"add-btn"
@
click=
"chooseImage"
>
v-if=
"images.length
<
maxCount
"
</view>
class=
"add-btn"
<view
v-for=
"(item, index) in images"
:key=
"index"
class=
"image-item"
@
click=
"previewImage(index)"
>
@
click=
"chooseImage"
<image
:src=
"item"
class=
"image"
mode=
"aspectFill"
></image>
>
<text
class=
"delete-icon"
@
click
.
stop=
"deleteImage(index)"
>
×
</text>
</view>
</view>
<view
</view>
v-for=
"(item, index) in images"
<!-- 提示文字 -->
:key=
"index"
<view
class=
"tip"
>
class=
"image-item"
<slot
name=
"tip"
>
@
click=
"previewImage(index)"
请对检查项进行拍照留存(限
{{
>
<image
:src=
"item"
class=
"image"
mode=
"aspectFill"
></image>
<text
class=
"delete-icon"
@
click
.
stop=
"deleteImage(index)"
>
×
</text>
</view>
</view>
<!-- 提示文字 -->
<view
class=
"tip"
>
<slot
name=
"tip"
>
请对检查项进行拍照留存(限
{{
maxCount
maxCount
}}
张)。发现“异常、告警”时,需拍照留存。
}}
张)。发现“异常、告警”时,需拍照留存。
</slot>
</slot>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
name
:
"CommonUpload"
,
name
:
"CommonUpload"
,
props
:
{
props
:
{
value
:
{
value
:
{
type
:
Array
,
type
:
Array
,
default
:
()
=>
[],
default
:
()
=>
[],
},
},
maxCount
:
{
maxCount
:
{
type
:
Number
,
type
:
Number
,
default
:
5
,
// 默认最多上传 5 张图片
default
:
5
,
// 默认最多上传 5 张图片
},
},
sourceType
:
{
sourceType
:
{
type
:
Array
,
type
:
Array
,
default
:
()
=>
[
"camera"
],
// 默认从相机拍摄
default
:
()
=>
[
"camera"
],
// 默认从相机拍摄
},
},
sizeType
:
{
sizeType
:
{
type
:
Array
,
type
:
Array
,
default
:
()
=>
[
"compressed"
],
// 默认压缩图 ["original", "compressed"]
default
:
()
=>
[
"compressed"
],
// 默认压缩图 ["original", "compressed"]
},
},
},
},
data
()
{
data
()
{
return
{
return
{
images
:
this
.
value
,
// 绑定的图片数组
images
:
this
.
value
,
// 绑定的图片数组
};
};
},
},
watch
:
{
watch
:
{
value
(
newVal
)
{
value
(
newVal
)
{
this
.
images
=
newVal
;
this
.
images
=
newVal
;
},
},
images
(
newVal
)
{
images
(
newVal
)
{
this
.
$emit
(
"input"
,
newVal
);
// 同步更新父组件绑定的数据
this
.
$emit
(
"input"
,
newVal
);
// 同步更新父组件绑定的数据
},
},
},
},
methods
:
{
methods
:
{
// 检查并请求权限
// 检查并请求权限
// async checkAndRequestPermission() {
// async checkAndRequestPermission() {
// // 定义所需权限
// // 定义所需权限
// const permissions = [];
// const permissions = [];
// if (this.sourceType.includes("camera")) {
// if (this.sourceType.includes("camera")) {
// permissions.push("android.permission.CAMERA"); // 相机权限
// permissions.push("android.permission.CAMERA"); // 相机权限
// }
// }
// if (this.sourceType.includes("album")) {
// if (this.sourceType.includes("album")) {
// permissions.push("android.permission.READ_EXTERNAL_STORAGE"); // 相册权限
// permissions.push("android.permission.READ_EXTERNAL_STORAGE"); // 相册权限
// }
// }
// // 检查权限状态
// // 检查权限状态
// const hasPermission = await new Promise((resolve) => {
// const hasPermission = await new Promise((resolve) => {
// plus.android.requestPermissions(
// plus.android.requestPermissions(
// permissions
,
// ["android.permission.CAMERA"]
,
// (result) => {
// (result) => {
// let granted = true;
// let granted = true;
// for (let i = 0; i
<
result
.
granted
.
length
;
i
++
)
{
// for (let i = 0; i
<
result
.
granted
.
length
;
i
++
)
{
// if (!result.granted[i]) {
// if (!result.granted[i]) {
// granted = false;
// granted = false;
// break;
// break;
// }
// }
// }
// }
// resolve(granted);
// resolve(granted);
// },
// },
// (error) => {
// (error) => {
// console.error("权限请求失败:", error.message);
// console.error("权限请求失败:", error.message);
// resolve(false);
// resolve(false);
// }
// }
// );
// );
// });
// });
// if (!hasPermission) {
// if (!hasPermission) {
// // 用户拒绝授权,弹出提示
// // 用户拒绝授权,弹出提示
// uni.showModal({
// uni.showModal({
// title: "权限提示",
// title: "权限提示",
// content:
// content:
// "您拒绝了必要的权限,可能导致功能无法正常使用。是否前往设置页面开启权限?",
// "您拒绝了必要的权限,可能导致功能无法正常使用。是否前往设置页面开启权限?",
// success: (modalRes) => {
// success: (modalRes) => {
// if (modalRes.confirm) {
// if (modalRes.confirm) {
// // 打开应用设置页面
// // 打开应用设置页面
// plus.runtime.openURL(
// plus.runtime.openURL(
// "app-settings://", // 跳转到系统设置页面
// "app-settings://", // 跳转到系统设置页面
// (err) => {
// (err) => {
// console.error("跳转设置页面失败:", err.message);
// console.error("跳转设置页面失败:", err.message);
// }
// }
// );
// );
// }
// }
// },
// },
// });
// });
// return false;
// return false;
// }
// }
// return true;
// return true;
// },
// },
// // 选择图片
// // 选择图片
// async chooseImage() {
// async chooseImage() {
// // 检查权限
// // 检查权限
// const isAuthorized = await this.checkAndRequestPermission();
// const isAuthorized = await this.checkAndRequestPermission();
// if (!isAuthorized) return;
// if (!isAuthorized) return;
// const count = this.maxCount - this.images.length; // 剩余可选图片数量
// const count = this.maxCount - this.images.length; // 剩余可选图片数量
// uni.chooseImage({
// uni.chooseImage({
// count: count,
// count: count,
// sizeType: this.sizeType,
// sizeType: this.sizeType,
// sourceType: this.sourceType, // 使用传递的 sourceType
// sourceType: this.sourceType, // 使用传递的 sourceType
// success: async (res) => {
// success: async (res) => {
// const tempFilePaths = res.tempFilePaths;
// const tempFilePaths = res.tempFilePaths;
// for (const filePath of tempFilePaths) {
// for (const filePath of tempFilePaths) {
// const base64 = await this.convertFileToBase64(filePath);
// const base64 = await this.convertFileToBase64(filePath);
// this.images.push(base64);
// this.images.push(base64);
// }
// }
// },
// },
// fail: (err) => {
// fail: (err) => {
// console.error("选择图片失败:", err);
// console.error("选择图片失败:", err);
// uni.showToast({
// uni.showToast({
// title: "选择图片失败,请重试",
// title: "选择图片失败,请重试",
// icon: "none",
// icon: "none",
// });
// });
// },
// },
// });
// });
// },
// },
// 选择图片
// 选择图片
chooseImage
()
{
chooseImage
()
{
const
count
=
this
.
maxCount
-
this
.
images
.
length
;
// 剩余可选图片数量
plus
.
android
.
requestPermissions
(
uni
.
chooseImage
({
[
"android.permission.CAMERA"
],
count
:
count
,
(
result
)
=>
{
sizeType
:
this
.
sizeType
,
console
.
log
(
'success'
)
sourceType
:
this
.
sourceType
,
// 使用传递的 sourceType
resolve
();
success
:
async
(
res
)
=>
{
},
const
tempFilePaths
=
res
.
tempFilePaths
;
(
error
)
=>
{
for
(
const
filePath
of
tempFilePaths
)
{
console
.
error
(
"权限请求失败:"
,
error
.
message
);
const
base64
=
await
this
.
convertFileToBase64
(
filePath
);
resolve
(
false
);
this
.
images
.
push
(
base64
);
}
}
);
},
const
count
=
this
.
maxCount
-
this
.
images
.
length
;
// 剩余可选图片数量
});
uni
.
chooseImage
({
},
count
:
count
,
// 预览图片
sizeType
:
this
.
sizeType
,
previewImage
(
index
)
{
sourceType
:
this
.
sourceType
,
// 使用传递的 sourceType
uni
.
previewImage
({
success
:
async
(
res
)
=>
{
current
:
index
,
const
tempFilePaths
=
res
.
tempFilePaths
;
urls
:
this
.
images
,
for
(
const
filePath
of
tempFilePaths
)
{
});
const
base64
=
await
this
.
convertFileToBase64
(
filePath
);
},
this
.
images
.
push
(
base64
);
// 删除图片
}
deleteImage
(
index
)
{
},
this
.
images
.
splice
(
index
,
1
);
fail
(
e
)
{
},
console
.
log
(
e
,
'faild'
)
// 转换文件为 Base64
},
convertFileToBase64
(
filePath
)
{
});
return
new
Promise
((
resolve
,
reject
)
=>
{
},
plus
.
io
.
resolveLocalFileSystemURL
(
// 预览图片
filePath
,
previewImage
(
index
)
{
(
entry
)
=>
{
uni
.
previewImage
({
entry
.
file
(
current
:
index
,
(
file
)
=>
{
urls
:
this
.
images
,
const
reader
=
new
plus
.
io
.
FileReader
();
});
reader
.
onloadend
=
(
evt
)
=>
{
},
resolve
(
evt
.
target
.
result
);
// 返回 Base64 数据
// 删除图片
};
deleteImage
(
index
)
{
reader
.
readAsDataURL
(
file
);
// 读取文件并转换为 Base64
this
.
images
.
splice
(
index
,
1
);
},
},
(
error
)
=>
{
// 转换文件为 Base64
reject
(
"获取文件对象失败:"
+
error
.
message
);
convertFileToBase64
(
filePath
)
{
}
return
new
Promise
((
resolve
,
reject
)
=>
{
);
plus
.
io
.
resolveLocalFileSystemURL
(
},
filePath
,
(
error
)
=>
{
(
entry
)
=>
{
reject
(
"解析文件路径失败:"
+
error
.
message
);
entry
.
file
(
}
(
file
)
=>
{
);
const
reader
=
new
plus
.
io
.
FileReader
();
});
reader
.
onloadend
=
(
evt
)
=>
{
},
resolve
(
evt
.
target
.
result
);
// 返回 Base64 数据
},
};
};
reader
.
readAsDataURL
(
file
);
// 读取文件并转换为 Base64
},
(
error
)
=>
{
reject
(
"获取文件对象失败:"
+
error
.
message
);
}
);
},
(
error
)
=>
{
reject
(
"解析文件路径失败:"
+
error
.
message
);
}
);
});
},
},
};
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.upload-container
{
.upload-container
{}
}
.image-list
{
.image-list
{
display
:
flex
;
display
:
flex
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
}
}
.image-item
{
position
:
relative
;
.image-item
{
width
:
72px
;
position
:
relative
;
height
:
72px
;
width
:
72px
;
margin-right
:
10px
;
height
:
72px
;
}
margin-right
:
10px
;
.image
{
}
width
:
100%
;
height
:
100%
;
.image
{
box-sizing
:
border-box
;
width
:
100%
;
}
height
:
100%
;
.delete-icon
{
box-sizing
:
border-box
;
position
:
absolute
;
}
top
:
-6
.4px
;
right
:
-6
.4px
;
.delete-icon
{
background-color
:
#ff4d4f
;
position
:
absolute
;
color
:
#fff
;
top
:
-6
.4px
;
width
:
12
.8px
;
right
:
-6
.4px
;
height
:
12
.8px
;
background-color
:
#ff4d4f
;
border-radius
:
50%
;
color
:
#fff
;
text-align
:
center
;
width
:
12
.8px
;
line-height
:
12
.8px
;
height
:
12
.8px
;
font-size
:
9
.6px
;
border-radius
:
50%
;
}
text-align
:
center
;
.add-btn
{
line-height
:
12
.8px
;
position
:
relative
;
font-size
:
9
.6px
;
width
:
72px
;
}
height
:
72px
;
border
:
1px
dashed
#ccc
;
.add-btn
{
cursor
:
pointer
;
position
:
relative
;
margin-right
:
10px
;
width
:
72px
;
box-sizing
:
border-box
;
height
:
72px
;
&
:
:
before
{
border
:
1px
dashed
#ccc
;
position
:
absolute
;
cursor
:
pointer
;
content
:
""
;
margin-right
:
10px
;
width
:
30px
;
box-sizing
:
border-box
;
height
:
2px
;
background-color
:
#ccc
;
&
:
:
before
{
left
:
50%
;
position
:
absolute
;
top
:
50%
;
content
:
""
;
transform
:
translateX
(
-50%
)
translateY
(
-50%
);
width
:
30px
;
}
height
:
2px
;
&
:
:
after
{
background-color
:
#ccc
;
position
:
absolute
;
left
:
50%
;
content
:
""
;
top
:
50%
;
width
:
2px
;
transform
:
translateX
(
-50%
)
translateY
(
-50%
);
height
:
30px
;
}
background-color
:
#ccc
;
left
:
50%
;
&
:
:
after
{
top
:
50%
;
position
:
absolute
;
transform
:
translateX
(
-50%
)
translateY
(
-50%
);
content
:
""
;
}
width
:
2px
;
}
height
:
30px
;
.tip
{
background-color
:
#ccc
;
font-size
:
12px
;
left
:
50%
;
color
:
#999
;
top
:
50%
;
margin-top
:
5px
;
transform
:
translateX
(
-50%
)
translateY
(
-50%
);
}
}
</
style
>
}
.tip
{
font-size
:
12px
;
color
:
#999
;
margin-top
:
5px
;
}
</
style
>
\ No newline at end of file
components/inspectionItem/index.vue
浏览文件 @
7409b5f4
...
@@ -2,17 +2,17 @@
...
@@ -2,17 +2,17 @@
<view
class=
"inspect-item"
@
click=
"toPage"
>
<view
class=
"inspect-item"
@
click=
"toPage"
>
<view
class=
"content"
:class=
"details.synFlag == 1 ? 'synchronization' : ''"
>
<view
class=
"content"
:class=
"details.synFlag == 1 ? 'synchronization' : ''"
>
<view
class=
"name"
>
{{
<view
class=
"name"
>
{{
details
.
synFlag
==
0
?
"未同步"
:
"已同步"
synFlags
[
details
.
synFlag
]
}}
</view>
}}
</view>
<view
class=
"info"
>
<view
class=
"info"
>
<view
class=
"info-row"
>
<view
class=
"info-row"
>
<text
class=
"title"
>
{{
getLabel
(
details
.
inspectionType
)
}}
</text>
<text
class=
"title"
>
{{
getLabel
(
details
.
inspectionType
)
}}
</text>
<text
class=
"status"
>
{{
Exception
[
details
.
isException
]
<text
class=
"status"
:class=
"
{'error':details.isException == 1}">
{{
details
.
isException
==
0
?
'正常'
:
'异常'
}}
</text>
}}
</text>
</view>
</view>
<view
class=
"info-row info-row-code"
>
<view
class=
"info-row info-row-code"
>
<text>
巡检人:
</text>
<text>
巡检人:
</text>
<text
class=
"code-num"
>
{{
details
.
inspectionBy
}}
</text>
<text
class=
"code-num"
>
{{
details
.
userName
}}
</text>
<text>
编号:
</text>
<text>
编号:
</text>
<text
class=
"code-num"
>
{{
details
.
inspectionCode
}}
</text>
<text
class=
"code-num"
>
{{
details
.
inspectionCode
}}
</text>
<text>
巡检日期:
</text>
<text>
巡检日期:
</text>
...
@@ -43,23 +43,23 @@
...
@@ -43,23 +43,23 @@
},
},
data
()
{
data
()
{
return
{
return
{
Exception
:
{
synFlags
:
{
0
:
'
正常
'
,
0
:
'
未同步
'
,
1
:
'
异常
'
,
1
:
'
已同步
'
,
2
:
'巡检中'
2
:
'巡检中'
}
}
}
}
},
},
computed
:
{
computed
:
{
formattedDate
()
{
formattedDate
()
{
if
(
!
this
.
details
.
createTime
)
{
if
(
!
this
.
details
.
createTime
)
{
return
'无效日期'
;
return
'无效日期'
;
}
}
// 转换为数字并使用 moment 格式化日期
// 转换为数字并使用 moment 格式化日期
const
createTime
=
parseInt
(
this
.
details
.
createTime
,
10
);
const
createTime
=
parseInt
(
this
.
details
.
createTime
,
10
);
return
moment
(
createTime
).
format
(
'YYYY-MM-DD HH:mm:ss
'
);
return
moment
(
createTime
).
format
(
'YYYY-MM-DD
'
);
},
},
},
},
mounted
()
{
mounted
()
{
console
.
log
(
" this.details"
,
this
.
details
)
console
.
log
(
" this.details"
,
this
.
details
)
},
},
...
@@ -137,12 +137,18 @@
...
@@ -137,12 +137,18 @@
.status {
.status {
padding: 0 6.4px;
padding: 0 6.4px;
font-size: 9.6px;
font-size: 9.6px;
color: #
ffffff
;
color: #
0CC991
;
text-align: center;
text-align: center;
line-height: 16px;
line-height: 16px;
font-weight: 400;
font-weight: 400;
background: #ffab24;
background: #E6F9F3;
border-radius: 8px;
border-radius: 11px;
}
.error {
background: #FDEBE9;
border-radius: 11px;
color: #F55A42
}
}
.alarm {
.alarm {
...
@@ -199,10 +205,7 @@
...
@@ -199,10 +205,7 @@
color: #4a4a4a;
color: #4a4a4a;
}
}
.status {
background: #9c9c9c16 !important;
color: #4a4a4a !important;
}
}
}
}
}
</
style
>
</
style
>
\ No newline at end of file
components/searchCom/index.vue
浏览文件 @
7409b5f4
<
template
>
<
template
>
<!-- 巡检管理搜索页 -->
<!-- 巡检管理搜索页 -->
<view
class=
"search-com"
>
<view
class=
"search-com"
>
<view
class=
"search-com-left"
>
<view
class=
"search-com-left"
>
<uni-data-select
<uni-data-select
v-if=
"!hiddenSearch.includes('inspectionType')"
class=
"uni-search-item"
v-if=
"!hiddenSearch.includes('inspectionType')"
v-model=
"searchFrom.inspectionType"
:localdata=
"inspectArr"
@
change=
"(e) => change(e, 'inspectionType')"
class=
"uni-search-item"
placeholder=
"类型"
></uni-data-select>
v-model=
"searchFrom.inspectionType"
:localdata=
"inspectArr"
@
change=
"(e) => change(e, 'inspectionType')"
placeholder=
"类型"
:clear=
"true"
:key=
"new Date().getTime()"
></uni-data-select>
<uni-data-select
<uni-data-select
v-if=
"!hiddenSearch.includes('synFlag')"
class=
"uni-search-item"
v-model=
"searchFrom.synFlag"
:localdata=
"synchronization"
placeholder=
"状态"
v-if=
"!hiddenSearch.includes('synchronization')"
@
change=
"(e) => change(e, 'synFlag')"
></uni-data-select>
class=
"uni-search-item"
v-model=
"searchFrom.synchronization"
:localdata=
"synchronization"
placeholder=
"状态"
@
change=
"(e) => change(e, 'synchronization')"
:clear=
"true"
:key=
"new Date().getTime()"
></uni-data-select>
<uni-data-select
v-if=
"!hiddenSearch.includes('isException')"
class=
"uni-search-item"
v-model=
"searchFrom.isException"
:localdata=
"exceptionArr"
placeholder=
"异常"
@
change=
"(e) => change(e, 'isException')"
:key=
"new Date().getTime()"
></uni-data-select>
</view>
<uni-data-select
<view
class=
"search-com-right"
v-if=
"!hiddenSearch.includes('inspectionTime')"
>
v-if=
"!hiddenSearch.includes('isException')"
<uni-datetime-picker
class=
"uni-datetime-picker"
type=
"daterange"
v-model=
"searchFrom.inspectionTime"
class=
"uni-search-item"
:border=
"false"
@
change=
"(e) => change(e, 'inspectionTime')"
/>
v-model=
"searchFrom.isException"
</view>
:localdata=
"exceptionArr"
</view>
placeholder=
"异常"
@
change=
"(e) => change(e, 'isException')"
:clear=
"true"
:key=
"new Date().getTime()"
></uni-data-select>
</view>
<view
class=
"search-com-right"
v-if=
"!hiddenSearch.includes('inspectionTime')"
>
<uni-datetime-picker
class=
"uni-datetime-picker"
type=
"daterange"
v-model=
"searchFrom.inspectionTime"
:border=
"false"
@
change=
"(e) => change(e, 'inspectionTime')"
/>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
props
:
{
props
:
{
hiddenSearch
:
{
hiddenSearch
:
{
// 隐藏搜索项
// 隐藏搜索项
type
:
Array
,
type
:
Array
,
default
:
()
=>
{
default
:
()
=>
{
return
[];
return
[];
},
},
},
},
},
},
data
()
{
data
()
{
return
{
return
{
searchFrom
:
{
searchFrom
:
{
inspectionType
:
""
,
// 巡检类型
inspectionType
:
""
,
// 巡检类型
synchronization
:
""
,
// 同部数据
synFlag
:
""
,
// 同部数据
isException
:
""
,
// 有无异常
isException
:
""
,
// 有无异常
inspectionTime
:
""
,
// 时间选择
inspectionTime
:
""
,
// 时间选择
},
},
inspectArr
:
[
{
value
:
"all"
,
text
:
"全部"
},
{
value
:
"1"
,
text
:
"机房巡检"
},
{
value
:
"2"
,
text
:
"井道巡检"
},
],
synchronization
:
[
{
value
:
"all"
,
text
:
"全部"
},
{
value
:
"2"
,
text
:
"编辑中"
},
{
value
:
"0"
,
text
:
"待同步"
},
{
value
:
"1"
,
text
:
"已同步"
},
],
exceptionArr
:
[
{
value
:
"all"
,
text
:
"全部"
},
{
value
:
"1"
,
text
:
"有"
},
{
value
:
"0"
,
text
:
"无"
},
],
};
},
methods
:
{
change
(
e
,
key
)
{
this
.
searchFrom
[
key
]
=
e
;
this
.
$emit
(
"change"
,
this
.
searchFrom
);
inspectArr
:
[{
},
value
:
""
,
},
text
:
"全部巡检"
};
},
{
value
:
"1"
,
text
:
"机房巡检"
},
{
value
:
"2"
,
text
:
"井道巡检"
},
],
synchronization
:
[{
value
:
""
,
text
:
"全部"
},
{
value
:
"2"
,
text
:
"编辑中"
},
{
value
:
"0"
,
text
:
"未同步"
},
{
value
:
"1"
,
text
:
"已同步"
},
],
exceptionArr
:
[{
value
:
""
,
text
:
"全部"
},
{
value
:
"1"
,
text
:
"有"
},
{
value
:
"0"
,
text
:
"无"
},
],
};
},
methods
:
{
change
(
e
,
key
)
{
this
.
searchFrom
[
key
]
=
e
;
this
.
$emit
(
"change"
,
this
.
searchFrom
);
},
},
};
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
.search-com {
.search-com {
display: flex;
display: flex;
align-items: center;
align-items: center;
margin-top: 8px;
margin-top: 8px;
// width: 50%;
.search-com-left {
// width: 50%;
display: flex;
.search-com-left {
flex:1;
display: flex;
align-items: center;
align-items: center;
.uni-search-item {
width: 132px;
.uni-search-item {
height: 36px;
width: 132px;
margin-right: 16px;
height: 36px;
background: #fff;
margin-right: 16px;
border-radius: 10px;
background: #fff;
border: none !important;
border-radius: 10px;
}
border: none !important;
}
}
.search-com-right {
}
width: 300px;
.uni-datetime-picker {
.search-com-right {
height: 36px;
width: 300px;
background: #fff;
border-radius: 10px;
.uni-datetime-picker {
border: none !important;
height: 36px;
}
background: #fff;
}
border-radius: 10px;
}
border: none !important;
</
style
>
}
}
}
</
style
>
\ No newline at end of file
pages/inspectionManagement/dialog.vue
浏览文件 @
7409b5f4
...
@@ -63,9 +63,7 @@ export default {
...
@@ -63,9 +63,7 @@ export default {
props
:
{
props
:
{
list
:
{
list
:
{
type
:
Array
,
type
:
Array
,
default
:
()
=>
{
default
:
()
=>
{},
return
[];
},
},
},
},
},
components
:
{},
components
:
{},
...
...
pages/inspectionManagement/index.vue
浏览文件 @
7409b5f4
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
</block>
</block>
</uni-nav-bar>
</uni-nav-bar>
<!-- 搜索项 -->
<!-- 搜索项 -->
<
!--
<SearchCom
@
change=
"change"
/>
--
>
<
SearchCom
@
change=
"change"
/
>
<!-- 结果 -->
<!-- 结果 -->
<view
class=
"inspection-management-content"
>
<view
class=
"inspection-management-content"
>
<view
class=
"count-tatal"
>
<view
class=
"count-tatal"
>
...
@@ -26,11 +26,11 @@
...
@@ -26,11 +26,11 @@
<view
class=
"month-list"
>
<view
class=
"month-list"
>
<!-- 每月记录 -->
<!-- 每月记录 -->
<view
class=
"month-record-item"
v-for=
"(item, index) in list"
:key=
"index"
>
<view
class=
"month-record-item"
v-for=
"(item, index) in list"
:key=
"index"
>
<view
class=
"seconed-title"
>
<view
class=
"seconed-title"
>
{{
'2025-04'
}}
{{
index
}}
</view>
</view>
<view
class=
"inspect-list"
>
<view
class=
"inspect-list"
>
<InspectionItem
:details=
"item
"
/>
<InspectionItem
v-for=
"(its,index) in item"
:key=
"its.id"
:details=
"its
"
/>
</view>
</view>
</view>
</view>
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
<!-- 开始巡检 -->
<!-- 开始巡检 -->
<!--
<view
class=
"inspection-button"
@
click=
"toPage"
>
开始巡检
</view>
-->
<!--
<view
class=
"inspection-button"
@
click=
"toPage"
>
开始巡检
</view>
-->
<view
class=
"inspection-button"
@
click=
"openDialog(true)"
>
同步数据
</view>
<!-- 打包弹窗 -->
<view
class=
"inspection-button"
@
click=
"openDialog(true)"
>
同步数据
</view>
<!-- 打包弹窗 -->
<Dialog
v-show=
"isDialog
&& list.length"
:list=
"l
ist"
@
close=
"openDialog(false)"
></Dialog>
<Dialog
v-show=
"isDialog
"
:list=
"propL
ist"
@
close=
"openDialog(false)"
></Dialog>
</view>
</view>
</
template
>
</
template
>
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
getAllInspections
getAllInspections
}
from
"@/request/index.js"
;
}
from
"@/request/index.js"
;
import
Empty
from
"@/components/empty/index.vue"
;
import
Empty
from
"@/components/empty/index.vue"
;
import
moment
from
"moment"
;
import
inspectApi
from
"@/api/inspect"
;
import
inspectApi
from
"@/api/inspect"
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -69,6 +69,7 @@
...
@@ -69,6 +69,7 @@
return
{
return
{
isDialog
:
false
,
//
isDialog
:
false
,
//
list
:
[],
// 展示数据
list
:
[],
// 展示数据
propList
:
[],
all_data
:
[],
// 所有数据
all_data
:
[],
// 所有数据
searchForm
:
{
searchForm
:
{
// 搜索条件
// 搜索条件
...
@@ -77,10 +78,8 @@
...
@@ -77,10 +78,8 @@
};
};
},
},
async
mounted
()
{
async
mounted
()
{
// this.getInspectRecord()
this
.
init
(
this
.
searchForm
)
let
res
=
await
inspectApi
.
selectDataForTime
()
this
.
list
=
res
console
.
log
(
res
.
length
,
'永远永远永远永远=---=>'
)
},
},
computed
:
{
computed
:
{
userInfo
()
{
userInfo
()
{
...
@@ -88,13 +87,6 @@
...
@@ -88,13 +87,6 @@
},
},
},
},
methods
:
{
methods
:
{
async
getInspectRecord
()
{
let
res
=
await
inspectApi
.
selectList
()
console
.
log
(
'阿斗者'
,
res
)
this
.
list
=
res
||
[]
this
.
countNum
=
this
.
list
.
length
},
// 返回
// 返回
back
()
{
back
()
{
uni
.
navigateTo
({
uni
.
navigateTo
({
...
@@ -112,7 +104,29 @@
...
@@ -112,7 +104,29 @@
});
});
}
}
},
},
init
()
{
async
init
()
{
console
.
log
(
'这都是个啥'
,
this
.
searchForm
)
let
res
=
await
inspectApi
.
selectDataForTime
(
this
.
searchForm
)
this
.
propList
=
res
this
.
countNum
=
res
.
length
const
resultMap
=
{};
res
.
forEach
(
e
=>
{
if
(
e
.
createTime
)
{
const
createTime
=
parseInt
(
e
.
createTime
,
10
);
const
yearMonth
=
moment
(
createTime
).
format
(
'YYYY年M月'
);
e
.
yearMonth
=
yearMonth
if
(
!
resultMap
[
yearMonth
])
{
resultMap
[
yearMonth
]
=
[];
}
// 将当前记录添加到对应的 yearMonth 数组中
resultMap
[
yearMonth
].
push
({
...
e
});
}
});
this
.
list
=
resultMap
return
const
all_data
=
this
.
all_data
||
[];
const
all_data
=
this
.
all_data
||
[];
// this.isPackedDataBtn =
// this.isPackedDataBtn =
// all_data.filter((item) => item.synchronization == 0).length > 0;
// all_data.filter((item) => item.synchronization == 0).length > 0;
...
@@ -194,8 +208,11 @@
...
@@ -194,8 +208,11 @@
},
},
change
(
e
)
{
change
(
e
)
{
this
.
searchForm
=
e
;
this
.
searchForm
=
e
;
if
(
e
.
inspectionTime
&&
e
.
inspectionTime
.
length
==
0
)
{
this
.
init
();
delete
this
.
searchForm
.
inspectionTime
}
console
.
log
(
'搜索'
,
this
.
searchForm
)
this
.
init
(
this
.
searchForm
);
},
},
toPage
()
{
toPage
()
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论