Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
computedRoomPad
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
邓文彬
computedRoomPad
Commits
c3cdfd16
提交
c3cdfd16
authored
3月 13, 2025
作者:
caodi\cd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:保存
上级
07767b16
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
538 行增加
和
86 行删除
+538
-86
manifest.json
manifest.json
+3
-1
pages.json
pages.json
+78
-82
dialog.vue
pages/listingManagement/dialog.vue
+355
-0
index.vue
pages/listingManagement/index.vue
+0
-0
index.js
request/index.js
+46
-1
index.js
store/index.js
+2
-1
IoReadingAndWriting.js
utils/IoReadingAndWriting.js
+54
-1
没有找到文件。
manifest.json
浏览文件 @
c3cdfd16
...
...
@@ -20,7 +20,9 @@
"delay"
:
0
},
/*
模块配置
*/
"modules"
:
{},
"modules"
:
{
"Camera"
:
{}
},
/*
应用发布信息
*/
"distribute"
:
{
/*
android打包配置
*/
...
...
pages.json
浏览文件 @
c3cdfd16
{
"pages"
:
[
//pages数组中第一项表示应用启动页,参考:https
:
//uniapp.dcloud.io/collocation/pages
{
"path"
:
"pages/login/login"
},
{
"path"
:
"pages/home/home"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
{
//操作日志
"path"
:
"pages/index/operLog"
},
"pages"
:
[
//pages数组中第一项表示应用启动页,参考:https
:
//uniapp.dcloud.io/collocation/pages
{
"path"
:
"pages/login/login"
},
{
"path"
:
"pages/home/home"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
{
//操作日志
"path"
:
"pages/index/operLog"
},
//杭州内网机房巡检
//杭州内网机房巡检
{
"path"
:
"pages/inspection/inspFirst"
},
{
"path"
:
"pages/inspection/inspFirst"
},
{
"path"
:
"pages/report/sampleTable"
},
{
"path"
:
"pages/report/sampleTable"
},
{
//修改密码
"path"
:
"pages/index/editPd"
},
{
"path"
:
"pages/home/home"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
//
机房巡检列表页
{
"path"
:
"pages/inspectionContent/inspectionContent"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
//
井道巡检
{
"path"
:
"pages/shaftInspection/shaftInspection"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
{
//修改密码
"path"
:
"pages/index/editPd"
},
{
"path"
:
"pages/home/home"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
//
新增配置---------
//
机房巡检
{
"path"
:
"pages/inspectionContent/inspectionContent"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
//
井道巡检
{
"path"
:
"pages/shaftInspection/shaftInspection"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
//
机房巡检
{
"path"
:
"pages/inspectionContent/inspectionContentList"
},
//
井道巡检新页面
{
"path"
:
"pages/shaftInspection/shaftInspectionNew"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
//
设备上架管理
{
"path"
:
"pages/listingManagement/index"
}
],
"globalStyle"
:
{
"pageOrientation"
:
"landscape"
,
"navigationStyle"
:
"custom"
,
"rpxCalcMaxDeviceWidth"
:
2000
,
"rpxCalcIncludeWidth"
:
750
},
"uniIdRouter"
:
{},
"condition"
:
{
//模式配置,仅开发期间生效
"current"
:
0
,
//当前激活的模式(list
的索引项)
"list"
:
[
{
"name"
:
""
,
//模式名称
"path"
:
""
,
//启动页面,必选
"query"
:
""
//启动参数,在页面的onLoad函数里面得到
}
]
}
}
//
新增配置---------
//
巡检管理
{
"path"
:
"pages/inspectionManagement/index"
},
//
设备上架管理
{
"path"
:
"pages/listingManagement/index"
},
//
井道巡检新页面
{
"path"
:
"pages/shaftInspection/shaftInspectionNew"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
}
],
"globalStyle"
:
{
"pageOrientation"
:
"landscape"
,
"navigationStyle"
:
"custom"
,
"rpxCalcBaseDeviceWidth"
:
1280
,
//
设计稿基准宽度
"rpxCalcMaxDeviceWidth"
:
2560
,
//
设备最大宽度
"rpxCalcIncludeWidth"
:
1024
//
包含宽度
},
"uniIdRouter"
:
{},
"condition"
:
{
//模式配置,仅开发期间生效
"current"
:
0
,
//当前激活的模式(list
的索引项)
"list"
:
[{
"name"
:
""
,
//模式名称
"path"
:
""
,
//启动页面,必选
"query"
:
""
//启动参数,在页面的onLoad函数里面得到
}]
}
}
\ No newline at end of file
pages/listingManagement/dialog.vue
0 → 100644
浏览文件 @
c3cdfd16
<
template
>
<view
class=
"synchronous-dialog"
>
<view
class=
"synchronous-content"
>
<view
class=
"row-item"
>
<text
class=
"title"
>
待打包数据
</text>
</view>
<view
class=
"row-item count-num"
>
<text
class=
"num"
>
{{
list
.
length
}}
</text>
<text>
条
</text>
</view>
<view
class=
"operating-instructions"
>
<view
class=
"title"
>
操作说明:
</view>
<view
class=
"instructions-item"
>
1、在PAD端,点击“数据打包”,做好同步准备。
</view>
<view
class=
"instructions-item"
>
2、完成打包后,将PAD直联PC机,等待PC机自动导入需同步记录。
</view>
<view
class=
"instructions-item"
>
3、PC端自动导入完成后,请点击“同步数据”,同步成功后,列表自动刷新展示同步数据;且PAD同步的数据不支持修改。
</view>
</view>
<view
class=
"row-item bottom-row"
>
<button
class=
"button"
:loading=
"loading"
@
click=
"clickHandle"
>
数据打包
</button>
</view>
<!-- 关闭按钮 -->
<div
class=
"close-button"
>
<text
class=
"iconfont icon-a-bianzu16beifen"
@
click=
"close"
></text>
</div>
</view>
</view>
</
template
>
<
script
>
import
{
SYNCHRONIZE_DATA_PAD
,
checkAndCreateDirectory
,
createFileWithPlusIO
,
setSm2
,
USER_FILE_NAME
,
getUserList
,
}
from
"@/utils/systemCofig"
;
import
{
copyDirectory
,
deleteAllFilesInDirectory
,
addLog
,
getLogContent
,
LOG_TYPE_ENUM
,
writeDeviceData
,
}
from
"@/utils/IoReadingAndWriting.js"
;
import
moment
from
"moment"
;
import
{
Base64
}
from
"js-base64"
;
export
default
{
props
:
{
list
:
{
type
:
Array
,
default
:
()
=>
{
return
[];
},
},
photos
:
{
type
:
Array
,
default
:
()
=>
{
return
[];
},
},
},
components
:
{},
data
()
{
return
{
loading
:
false
,
};
},
mounted
()
{},
watch
:
{
list
(
newData
)
{
const
temp
=
[];
newData
.
forEach
((
item
)
=>
{
temp
.
push
(...(
item
.
list
||
[]));
});
},
},
methods
:
{
close
()
{
this
.
$emit
(
"close"
);
},
getDetails
()
{
this
.
$emit
(
"getDetails"
);
},
/**
* 1.生成两个文件. 机房文件 和 井道文件
* 2. 更新巡检数据状态 synchronization 置为 1
* 3. 写入数据
* 读取上一次打包的文件, 复制到 [ history ] 文件夹中
*/
clickHandle
()
{
if
(
this
.
loading
)
return
;
const
directoryPath
=
`
${
SYNCHRONIZE_DATA_PAD
}
/发送数据`
;
const
targetDirectoryPath
=
`
${
SYNCHRONIZE_DATA_PAD
}
/history/listingManagement`
;
checkAndCreateDirectory
(
directoryPath
).
then
(()
=>
{
copyDirectory
(
directoryPath
,
targetDirectoryPath
)
.
then
(()
=>
{
return
deleteAllFilesInDirectory
(
directoryPath
);
})
.
then
(()
=>
{
this
.
coverData
();
})
.
catch
((
error
)
=>
{
uni
.
showToast
({
title
:
error
,
icon
:
"none"
,
duration
:
1000
,
});
});
});
},
// 处理数据
coverData
()
{
const
userName
=
this
.
$store
.
state
.
now_user
.
user
;
let
syncedData
=
this
.
list
;
let
timeStr
=
moment
().
format
(
"yyyy_MM_DD_hh_mm_ss"
);
syncedData
.
forEach
((
item
)
=>
{
item
.
synchronization
=
true
;
item
.
selected
=
false
;
item
.
status
=
"已同步"
;
});
console
.
log
(
"syncedData"
,
syncedData
);
this
.
loading
=
true
;
let
SBSJ_DATA_FILE_NAME
=
`
${
userName
}
_SBSJ_
${
timeStr
}
.txt`
;
const
tmepList
=
this
.
packedData
(
syncedData
,
SBSJ_DATA_FILE_NAME
);
let
arr
=
this
.
photos
.
map
((
item
)
=>
{
// 查找 B 数组中是否有对应的对象
const
updatedItem
=
syncedData
.
find
((
bItem
)
=>
bItem
.
id
===
item
.
id
);
// 如果有,则返回 B 数组中的对象,否则返回原对象
return
updatedItem
?
updatedItem
:
item
;
});
writeDeviceData
(
tmepList
,
userName
)
.
then
((
res
)
=>
{
console
.
log
(
"tmepList"
,
tmepList
);
this
.
$store
.
commit
(
"SET_DEVICEDATA"
,
arr
);
console
.
log
(
"arr"
,
arr
)
setTimeout
(()
=>
{
uni
.
showToast
({
title
:
"打包成功"
,
icon
:
"none"
,
duration
:
2000
,
});
this
.
close
();
this
.
loading
=
false
;
let
length
=
tmepList
.
length
;
// 生成日志
const
logContent
=
getLogContent
(
LOG_TYPE_ENUM
.
sys
,
`
${
length
}
张照同步`
,
"同步"
);
const
log_list
=
this
.
$store
.
state
.
log_list
;
log_list
.
push
(
logContent
);
this
.
$store
.
commit
(
"SET_LOG_LIST"
,
log_list
);
addLog
(
log_list
).
then
(()
=>
{});
// 更新同步时间
this
.
updateSysTime
();
this
.
getDetails
();
},
2
*
1000
);
})
.
catch
((
error
)
=>
{
this
.
loading
=
false
;
uni
.
showToast
({
title
:
error
,
icon
:
"none"
,
duration
:
2000
,
});
})
.
catch
(()
=>
{
setTimeout
(()
=>
{
uni
.
showToast
({
title
:
"打包失败"
,
icon
:
"none"
,
duration
:
2000
,
});
this
.
loading
=
false
;
},
2
*
1000
);
});
},
// 打包文件
packedData
(
content
,
fileName
)
{
const
fileContent
=
setSm2
(
content
);
return
createFileWithPlusIO
(
`
${
SYNCHRONIZE_DATA_PAD
}
/发送数据`
,
fileName
,
fileContent
);
},
// 更新最近一次同步时间
updateSysTime
()
{
getUserList
().
then
((
personList
)
=>
{
const
now_user
=
this
.
$store
.
state
.
now_user
;
const
key
=
personList
.
findIndex
(
(
item
)
=>
item
.
userId
==
now_user
.
userId
);
// 更新用户同步时间
const
userInfo
=
personList
[
key
];
const
LastSynchronizationTime
=
moment
().
format
(
"yyyy-MM-DD HH:mm"
);
personList
[
key
].
LastSynchronizationTime
=
LastSynchronizationTime
;
userInfo
.
LastSynchronizationTime
=
LastSynchronizationTime
;
this
.
$store
.
commit
(
"SET_USER"
,
userInfo
);
uni
.
setStorageSync
(
"last_time"
,
userInfo
.
LastSynchronizationTime
||
""
);
// 更新用户数据
const
fileContent
=
JSON
.
stringify
(
Base64
.
encode
(
JSON
.
stringify
(
personList
))
);
uni
.
setStorage
({
key
:
"user_data"
,
data
:
JSON
.
stringify
(
personList
),
fail
:
(
error
)
=>
{
console
.
log
(
"APP.vue 存储数据失败"
,
error
);
},
});
createFileWithPlusIO
(
SYNCHRONIZE_DATA_PAD
,
USER_FILE_NAME
,
fileContent
)
.
then
(()
=>
{
console
.
log
(
"---用户数据更新成功"
);
})
.
catch
((
error
)
=>
{
console
.
log
(
"---用户数据更新失败"
,
error
);
});
});
},
},
};
</
script
>
<
style
scoped
lang=
"less"
>
.synchronous-dialog {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
.synchronous-content {
padding: 3% 20px 32px 24px;
width: 400px;
height: 60%;
box-sizing: border-box;
background-image: linear-gradient(
-6deg,
#f9ffe7 0%,
#ffffff 12%,
#fcfeff 73%,
#ccf1ff 100%
);
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 12px;
position: relative;
.row-item {
display: flex;
align-items: center;
justify-content: center;
}
.title {
font-family: PingFangSC-Medium;
font-size: 18px;
color: #000000;
text-align: center;
line-height: 26px;
font-weight: 500;
}
.count-num {
margin: 5% 0 5% 0;
align-items: flex-end;
.num {
display: inline-block;
font-family: AlibabaPuHuiTi_2_65_Medium;
font-size: 50px;
color: #3774f6;
line-height: 44px;
font-weight: 500;
}
}
.operating-instructions {
margin-bottom: 8%;
.title {
font-size: 13px;
color: #4a4a4a;
line-height: 24px;
font-weight: 600;
text-align: left;
}
.instructions-item {
font-size: 12px;
color: #7c7c7c;
line-height: 22px;
font-weight: 400;
}
}
// 打包按钮
.bottom-row {
position: absolute;
bottom: 24px;
left: 50%;
transform: translateX(-50%);
.button {
display: flex;
align-items: center;
justify-content: center;
background-image: linear-gradient(180deg, #3773f6 0%, #2c57f6 99%);
box-shadow: 0px 10px 24px 0px rgba(51, 104, 246, 0.24);
border-radius: 27px;
width: 160px;
height: 40px;
color: #fff;
}
}
// 关闭按钮
.close-button {
position: absolute;
bottom: -40px;
left: 50%;
transform: translateX(-50%);
.iconfont {
color: #fff;
font-size: 24px;
}
}
}
}
</
style
>
pages/listingManagement/index.vue
浏览文件 @
c3cdfd16
差异被折叠。
点击展开。
request/index.js
浏览文件 @
c3cdfd16
...
...
@@ -2,7 +2,8 @@ import store from "../store/index";
import
{
readLogData
,
readInspectionData
,
readDarfData
readDarfData
,
readDeviceData
}
from
"@/utils/IoReadingAndWriting.js"
;
import
lodash
from
"lodash"
;
...
...
@@ -98,4 +99,47 @@ export const getDarft = () => {
reject
(
error
)
})
})
}
// 获取设备上架所有图片信息
export
const
getAllDeviceData
=
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
store
.
state
.
deviceData
.
length
)
if
(
store
.
state
.
deviceData
.
length
){
const
tempRes
=
lodash
.
orderBy
(
store
.
state
.
deviceData
,
"creatTime"
,
[
'desc'
]);
const
result
=
lodash
.
orderBy
(
tempRes
,
"synchronization"
,
[
'asc'
]);
resolve
(
result
)
return
;
}
readDeviceData
()
.
then
((
res
)
=>
{
const
tempRes
=
lodash
.
orderBy
(
res
,
"creatTime"
,
[
'desc'
]);
const
result
=
lodash
.
orderBy
(
tempRes
,
"synchronization"
,
[
'asc'
]);
store
.
commit
(
"SET_DEVICEDATA"
,
result
);
resolve
(
result
)
})
.
catch
((
error
)
=>
{
reject
(
error
)
})
})
}
/**
*
* 获取设备上架数据详情
* @returns
*/
export
const
getDeviceDataDetails
=
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getAllDeviceData
()
.
then
((
res
)
=>
{
const
detailsInfo
=
res
resolve
(
detailsInfo
)
})
.
catch
((
error
)
=>
{
reject
(
error
)
})
})
}
\ No newline at end of file
store/index.js
浏览文件 @
c3cdfd16
...
...
@@ -72,7 +72,8 @@ const store = new Vuex.Store({
// 保存 日志文件
state
.
log_list
=
payload
;
},
SET_DEVICEDATA
(
state
,
payload
)
{
//保存上次上报时间
SET_DEVICEDATA
(
state
,
payload
)
{
//保存设备上架数据
state
.
deviceData
=
payload
},
DEL_DEVICEDATA
(
state
,
index
)
{
...
...
utils/IoReadingAndWriting.js
浏览文件 @
c3cdfd16
...
...
@@ -23,10 +23,11 @@ import { Base64 } from "js-base64";
export
const
LOG_TYPE_ENUM
=
{
login
:
"登录"
,
add
:
"新增成功"
,
photo
:
"拍照"
,
edit
:
"编辑成功"
,
darf
:
"草稿"
,
delete
:
"删除"
,
sys
:
"同步
数据
"
,
sys
:
"同步"
,
updatePassword
:
"修改密码"
,
};
...
...
@@ -192,6 +193,58 @@ export const readInspectionData = () => {
.
catch
((
error
)
=>
reject
(
error
));
});
};
/**
* // 写入【设备上架】文件
* @param {*} content 写入内容
* @param {*} isEncryption 是否加密
* @returns
*/
export
const
writeDeviceData
=
(
content
,
userName
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
fileName
=
`list.txt`
;
const
fileContent
=
Base64
.
encode
(
JSON
.
stringify
(
content
));
createFileWithPlusIO
(
`
${
SYNCHRONIZE_DATA_PAD
}
/设备上架/
${
userName
}
`
,
fileName
,
fileContent
).
then
((
res
)
=>
{
// store 更新 设备上架. 缓存数据置为空,让接口重新读取文件数据
store
.
commit
(
"SET_DEVICEDATA"
,
[]);
resolve
();
});
});
};
// 读取【设备上架】文件
export
const
readDeviceData
=
()
=>
{
const
now_user
=
store
.
state
.
now_user
;
console
.
log
(
"now_user"
,
now_user
)
const
isAdmin
=
now_user
.
isAdmin
;
// const directoryPath = isAdmin
// ? `${SYNCHRONIZE_DATA_PAD}/设备上架`
// : `${SYNCHRONIZE_DATA_PAD}/设备上架/${now_user.user}`;
const
directoryPath
=
`
${
SYNCHRONIZE_DATA_PAD
}
/设备上架/
${
now_user
.
user
}
`
;
console
.
log
(
"directoryPath"
,
directoryPath
)
return
new
Promise
((
resolve
,
reject
)
=>
{
readFilesInDirectory
(
directoryPath
)
.
then
((
res
)
=>
{
console
.
log
(
"directoryPathres"
,
res
)
const
temp
=
res
.
map
((
element
)
=>
{
return
JSON
.
parse
(
Base64
.
decode
(
element
));
});
resolve
(
lodash
.
flattenDeep
(
temp
));
})
.
catch
((
error
)
=>
reject
(
error
));
});
};
// 复制文件夹中的所有数据到另一个文件夹
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论