Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
computedRoomPad
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
邓文彬
computedRoomPad
Commits
2a537883
提交
2a537883
authored
9月 17, 2024
作者:
邓文彬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(数据获取): 模拟接口的形式获取数据
上级
6a65e0f4
显示空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
791 行增加
和
334 行删除
+791
-334
App.vue
App.vue
+4
-56
index.vue
components/empty/index.vue
+24
-0
index.vue
components/inspectionItem/index.vue
+11
-4
content.vue
pages/home/content.vue
+183
-8
operLog.vue
pages/index/operLog.vue
+20
-5
inspFirst.vue
pages/inspection/inspFirst.vue
+1
-60
inspectionContent.vue
pages/inspectionContent/inspectionContent.vue
+39
-5
batteryRoom.vue
pages/inspectionContent/model/batteryRoom.vue
+0
-1
gatherDataCenter.vue
pages/inspectionContent/model/gatherDataCenter.vue
+0
-2
shieldedComputerRoom.vue
pages/inspectionContent/model/shieldedComputerRoom.vue
+0
-1
index.vue
pages/inspectionManagement/index.vue
+140
-7
login.vue
pages/login/login.vue
+17
-60
tabContentItem.vue
pages/shaftInspection/model/tabContentItem.vue
+1
-2
shaftInspection.vue
pages/shaftInspection/shaftInspection.vue
+35
-5
synchronization.vue
pages/synchronization/synchronization.vue
+0
-43
dialog.vue
pages/synchronousManagement/dialog.vue
+1
-2
index.vue
pages/synchronousManagement/index.vue
+42
-15
index.js
request/index.js
+106
-0
index.js
store/index.js
+4
-12
IoReadingAndWriting.js
utils/IoReadingAndWriting.js
+57
-23
common.js
utils/common.js
+5
-0
systemCofig.js
utils/systemCofig.js
+101
-23
没有找到文件。
App.vue
浏览文件 @
2a537883
...
...
@@ -12,9 +12,7 @@ import {
}
from
"./utils/systemCofig"
;
import
{
Base64
}
from
"js-base64"
;
import
{
readDirectoryData
}
from
"@/utils/IoReadingAndWriting.js"
;
import
{
readDirectoryData
}
from
"@/utils/IoReadingAndWriting.js"
;
export
default
{
onLaunch
:
function
()
{
// #ifdef APP-PLUS
...
...
@@ -56,68 +54,18 @@ export default {
},
function
(
e
)
{}
);
// #endif
// if (!uni.getStorageSync("all_data")) {
// uni.setStorageSync("all_data", []);
// } else {
// this.$store.state.all_data = uni.getStorageSync("all_data");
// }
// if (!uni.getStorageSync("last_time")) {
// uni.setStorageSync("last_time", "");
// } else {
// // console.log('有数据',2);
// this.$store.state.last_time = uni.getStorageSync("last_time");
// }
// if (!uni.getStorageSync("oper_record")) {
// uni.setStorageSync("oper_record", []);
// } else {
// // console.log('有数据',3);
// this.$store.state.oper_record = uni.getStorageSync("oper_record");
// }
// if (
// uni.getStorageSync("now_user") &&
// JSON.stringify(uni.getStorageSync("now_user")) !== "{}"
// ) {
// this.$store.commit("SET_USER", uni.getStorageSync("now_user"));
// } else {
// uni.navigateTo({
// url: "/pages/login/login",
// });
// }
},
onShow
:
function
()
{
// console.log(
// "-onShowonShowonShowonShowonShowonShowonShowonShowonShowonShow-----"
// );
// this.init();
const
now_user
=
uni
.
getStorageSync
(
"now_user"
)
||
{}
if
(
now_user
.
name
){
const
now_user
=
uni
.
getStorageSync
(
"now_user"
)
||
{};
if
(
now_user
.
name
)
{
this
.
$store
.
commit
(
"SET_USER"
,
now_user
);
console
.
log
(
'----------------------------------------------------'
)
readDirectoryData
()
}
// this.$store.state.all_data = uni.getStorageSync("all_data") || []
// this.$store.state.darf_data = uni.getStorageSync("darf_data") || {}
// this.$store.state.last_time = uni.getStorageSync("last_time") || ""
},
onHide
:
function
()
{
// app关闭时将数据存储到本地缓存
// uni.setStorageSync("darf_data", this.$store.state.darf_data);
// uni.setStorageSync("all_data", this.$store.state.all_data);
uni
.
setStorageSync
(
"now_user"
,
this
.
$store
.
state
.
now_user
);
//
uni.setStorageSync("last_time", this.$store.state.last_time);
uni
.
setStorageSync
(
"last_time"
,
this
.
$store
.
state
.
last_time
);
console
.
log
(
"--onHideonHideonHideonHideonHideonHideonHideonHideonHideonHideonHideonHideonHideonHide---"
)
// uni.clearStorage(); //测试将所有缓存清除
},
onUnload
()
{},
methods
:
{
...
...
components/empty/index.vue
0 → 100644
浏览文件 @
2a537883
<
template
>
<view
class=
"empty-components"
>
暂无数据
</view>
</
template
>
<
script
>
export
default
{
name
:
'Empty'
,
props
:
{
text
:
{
type
:
String
,
default
:
''
}
}
}
</
script
>
<
style
scoped
lang=
"less"
>
.empty-components{
}
</
style
>
\ No newline at end of file
components/inspectionItem/index.vue
浏览文件 @
2a537883
...
...
@@ -45,6 +45,9 @@ export default {
details
:
{
type
:
Object
,
},
isDisable
:
{
type
:
Boolean
,
},
},
methods
:
{
getLabel
(
val
)
{
...
...
@@ -58,13 +61,17 @@ export default {
toPage
()
{
const
url
=
this
.
details
.
inspectionType
==
1
?
"/pages/inspectionContent/inspectionContent"
:
"/pages/shaftInspection/shaftInspection"
;
?
`/pages/inspectionContent/inspectionContent?isDisable=
${
this
.
isDisable
?
1
:
0
}
`
:
`/pages/shaftInspection/shaftInspection?isDisable=
${
this
.
isDisable
?
1
:
0
}
`
;
console
.
log
(
" this.details"
,
this
.
details
.
uid
);
console
.
log
(
" this.details"
,
url
,
this
.
details
);
uni
.
navigateTo
({
url
:
`
${
url
}
?
uid=
${
this
.
details
.
uid
}
`
,
url
:
`
${
url
}
&
uid=
${
this
.
details
.
uid
}
`
,
});
},
},
...
...
pages/home/content.vue
浏览文件 @
2a537883
...
...
@@ -3,9 +3,11 @@
<!-- 内容区 -->
<view
class=
"card-list"
>
<view
class=
"card-item"
>
<view
class=
"title"
>
HI,欢迎回来巡检员001!
</view>
<view
class=
"unit"
>
所属单位:浙江泰源科技有限公司
</view>
<view
class=
"time"
>
上次登录时间:2024-08-24
</view>
<view
class=
"title"
>
HI,欢迎回来
{{
userInfo
.
name
}}{{
userInfo
.
user
}}
!
</view
>
<view
class=
"unit"
>
所属单位:
{{
userInfo
.
unitName
||
"--"
}}
</view>
<view
class=
"time"
>
上次登录时间:
{{
lastTime
||
"--"
}}
</view>
<image
class=
"bg-img"
...
...
@@ -15,7 +17,10 @@
</view>
<view
class=
"card-item"
>
<view
class=
"title2x"
>
巡检、报修记录
</view>
<view
class=
"count"
>
<text
class=
"num"
>
12
</text>
条
</view>
<view
class=
"count"
>
<text
class=
"num"
>
{{
syncCount
}}
</text
>
条
</view>
<view
class=
"button-text"
><text>
待同步
</text>
<view
class=
"iconfont icon-Arrow-Right"
></view>
...
...
@@ -27,7 +32,7 @@
src=
"@/static/img/add-img/home2.png"
></image>
</view>
<view
class=
"card-item card-item3x"
>
<view
class=
"card-item card-item3x"
@
click=
"toPage"
>
<view
class=
"title"
>
开始巡检
</view>
<view
class=
"button-text"
><text>
进入
</text>
...
...
@@ -46,22 +51,38 @@
<view
class=
"month-list"
>
<!-- 每月记录 -->
<view
class=
"month-record-item"
v-for=
"item in 20"
:key=
"item"
>
<view
class=
"seconed-title"
>
2024年08月
</view>
<view
class=
"month-record-item"
v-for=
"(item, index) in list"
:key=
"index"
>
<view
v-if=
"(item.list || []).length"
class=
"seconed-title"
>
{{
item
.
time
}}
</view>
<view
class=
"inspect-list"
>
<InspectionItem
/>
<InspectionItem
v-for=
"ele in item.list"
:key=
"ele.inspectionCode"
:details=
"ele"
/>
</view>
</view>
<Empty
v-if=
"list.length == 0"
/>
</view>
</view>
</
template
>
<
script
>
import
InspectionItem
from
"@/components/inspectionItem/index.vue"
;
import
{
getAllInspections
,
getDarft
}
from
"@/request/index.js"
;
import
Empty
from
"@/components/empty/index.vue"
;
export
default
{
components
:
{
InspectionItem
,
Empty
,
},
data
()
{
return
{
...
...
@@ -83,9 +104,131 @@ export default {
text
:
"同步管理"
,
},
],
isDialog
:
false
,
//
list
:
[],
// 展示数据
all_data
:
[],
// 所有数据
searchForm
:
{
// 搜索条件
},
countNum
:
0
,
// 统计查询总数
syncCount
:
0
,
// 待同步条数
lastTime
:
""
,
// 上次登陆时间
};
},
created
()
{
this
.
lastTime
=
uni
.
getStorageSync
(
"last_time"
)
||
""
;
},
mounted
()
{
uni
.
showLoading
();
getAllInspections
()
.
then
((
res
)
=>
{
this
.
all_data
=
res
;
this
.
init
();
uni
.
hideLoading
();
})
.
catch
((
error
)
=>
{
if
(
0
==
error
.
code
)
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
}
this
.
all_data
=
[];
uni
.
hideLoading
();
});
},
computed
:
{
userInfo
()
{
return
this
.
$store
.
state
.
now_user
||
{};
},
},
methods
:
{
// 待同步数据
initSyncCount
()
{
this
.
syncCount
=
(
this
.
all_data
||
[]).
filter
(
(
item
)
=>
item
.
synchronization
==
0
).
length
;
},
// 初始化
init
()
{
const
all_data
=
this
.
all_data
||
[];
const
tempAllData
=
{};
all_data
.
forEach
((
item
)
=>
{
const
val
=
tempAllData
[
item
.
submitTime
]
||
[];
if
(
val
.
length
)
{
tempAllData
[
item
.
submitTime
].
push
(
item
);
}
else
{
tempAllData
[
item
.
submitTime
]
=
[
item
];
}
});
const
keys
=
Object
.
keys
(
tempAllData
);
const
{
inspectionTime
=
[]
}
=
this
.
searchForm
;
const
startTime
=
inspectionTime
[
0
];
const
endTime
=
inspectionTime
[
1
];
// 第一步: 筛选有效的时间范围
const
timeFrame
=
keys
.
filter
((
key
)
=>
{
if
(
!
inspectionTime
.
length
)
{
return
true
;
}
else
{
return
(
new
Date
(
startTime
).
getTime
()
<=
new
Date
(
key
).
getTime
()
&&
new
Date
(
key
).
getTime
()
<=
new
Date
(
endTime
).
getTime
()
);
}
});
// 第二步: 根据搜索条件过滤
const
list
=
timeFrame
.
map
((
key
)
=>
{
return
{
time
:
key
,
list
:
this
.
coverData
(
tempAllData
[
key
]),
};
});
console
.
log
(
"list 数据----"
,
list
);
this
.
countNum
=
0
;
list
.
forEach
((
item
)
=>
{
this
.
countNum
+=
item
.
list
.
length
;
});
this
.
list
=
list
;
this
.
initSyncCount
();
},
coverData
(
arr
=
[])
{
const
{
isException
=
""
,
inspectionType
=
""
,
iSynchronization
=
""
,
}
=
this
.
searchForm
;
return
arr
.
filter
((
item
)
=>
{
return
(
(
!
isException
||
item
.
isException
==
isException
)
&&
(
!
inspectionType
||
item
.
inspectionType
==
inspectionType
)
&&
(
!
iSynchronization
||
item
.
iSynchronization
==
iSynchronization
)
);
});
},
change
(
e
)
{
console
.
log
(
"----"
,
e
);
this
.
searchForm
=
e
;
this
.
init
();
},
tabClick
(
item
,
index
)
{
console
.
log
(
"----"
);
this
.
activeTabIndex
=
index
;
...
...
@@ -96,6 +239,38 @@ export default {
url
:
"/pages/index/index"
,
});
},
toPage
()
{
uni
.
showLoading
();
getDarft
()
.
then
((
res
)
=>
{
const
darf_data
=
res
||
{};
if
(
darf_data
.
inspectionType
==
1
)
{
uni
.
navigateTo
({
url
:
`/pages/inspectionContent/inspectionContent?isDarf=1`
,
});
}
else
if
(
darf_data
.
inspectionType
==
2
)
{
uni
.
navigateTo
({
url
:
`/pages/shaftInspection/shaftInspection?isDarf=1`
,
});
}
else
{
uni
.
navigateTo
({
url
:
"/pages/inspection/inspFirst"
,
});
}
uni
.
hideLoading
();
})
.
catch
((
error
)
=>
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
uni
.
hideLoading
();
});
},
},
};
</
script
>
...
...
pages/index/operLog.vue
浏览文件 @
2a537883
...
...
@@ -68,6 +68,7 @@
<text
class=
"time bold"
>
{{
item
.
time
}}
</text>
<view
class=
"desc"
>
<!-- 不可删除 -->
<text
class=
"xuxian"
>
......
</text>
<text
class=
"bold"
>
{{
item
.
name
||
item
.
user
}}
</text>
...
...
@@ -85,7 +86,7 @@
<
script
>
import
timeSelect
from
"@/components/global/timeSelect.vue"
;
import
lodash
from
"lodash"
import
{
getLogList
}
from
"@/request/index.js"
;
export
default
{
components
:
{
timeSelect
,
...
...
@@ -118,7 +119,6 @@ export default {
text
:
"其他"
,
value
:
"其他"
,
},
],
searchForm
:
{
type
:
""
,
...
...
@@ -133,8 +133,24 @@ export default {
uni
.
navigateBack
();
},
onLoad
()
{
this
.
recordData
=
lodash
.
flattenDeep
(
this
.
$store
.
state
.
log_list
);
uni
.
showLoading
();
getLogList
()
.
then
((
res
)
=>
{
this
.
recordData
=
res
;
this
.
getData
();
uni
.
hideLoading
();
})
.
catch
((
error
)
=>
{
if
(
0
==
error
.
code
)
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
}
uni
.
hideLoading
();
});
},
methods
:
{
change
(
e
)
{
...
...
@@ -162,7 +178,7 @@ export default {
getData
()
{
this
.
loading
=
true
;
const
{
type
,
startTime
,
endTime
}
=
this
.
searchForm
;
console
.
log
(
"--this.recordData--"
,
this
.
recordData
)
console
.
log
(
"--this.recordData--"
,
this
.
recordData
)
;
this
.
tableData
=
this
.
recordData
.
filter
((
item
)
=>
{
let
matchType
=
true
;
// 类型筛选
...
...
@@ -180,7 +196,6 @@ export default {
});
this
.
loading
=
false
;
},
},
};
...
...
pages/inspection/inspFirst.vue
浏览文件 @
2a537883
...
...
@@ -113,6 +113,7 @@ export default {
isSubmit
:
""
,
// 0 是草稿态; 1 是正式提交
conclusion
:
""
,
//结论
fillCheck
:
""
,
// tab字典的value值, 校验通过的
creatTime
:
`
${
new
Date
().
getTime
()}
`
,
items
:
[
// {
...
...
@@ -186,66 +187,6 @@ export default {
},
});
}
return
;
this
.
$refs
.
forms
.
validate
()
.
then
((
res
)
=>
{
uni
.
showLoading
({
title
:
"加载中"
,
});
// console.log('校验通过');
// let timeStr = getDateTime.dateTimeStr("y-m-d h:i");
// let timeStr2 = getDateTime.dateTimeStr("y-m-d h:i:s");
// this.formData.type = "1"; //巡检为1
// this.formData.oid = this.$store.state.now_user.areaName; //区域名
// this.formData.status = "编辑中"; //pad端添加状态
// this.formData.isDel = "0";
// this.formData.id = "";
// this.formData.errorData = {};
// this.formData.createBy = this.$store.state.now_user.name;
// this.formData.creatTime = timeStr2;
// this.formData.uid =
// this.$store.state.now_user.oid +
// Number(
// Math.random().toString().substr(3, 10) + Date.now()
// ).toString(36);
// this.$store.state.all_data.push(this.formData);
// 记录操作日志
let
operData
=
{
name
:
this
.
$store
.
state
.
now_user
.
name
,
level
:
"秘密"
,
user
:
this
.
$store
.
state
.
now_user
.
user
,
module
:
"巡检"
,
detail
:
this
.
showRoomName
(
this
.
formData
.
room
)
+
"巡检记录"
+
"("
+
this
.
formData
.
number
+
")"
,
type
:
this
.
$store
.
state
.
oper_type
,
time
:
timeStr
,
...
this
.
formData
,
level
:
"秘密"
,
};
this
.
$store
.
state
.
oper_record
.
unshift
(
operData
);
//保存该操作记录
this
.
$store
.
commit
(
"SET_TEMP_DATA"
,
this
.
formData
);
// 缓存[巡检信息]
uni
.
redirectTo
({
url
:
"/pages/inspectionContent/inspectionContent"
,
success
()
{
uni
.
hideLoading
();
},
});
})
.
catch
((
err
)
=>
{
console
.
log
(
err
);
});
},
},
};
...
...
pages/inspectionContent/inspectionContent.vue
浏览文件 @
2a537883
...
...
@@ -132,6 +132,8 @@ import {
pad_room_type
,
}
from
"@/utils/dict.js"
;
import
{
getInspectionDetails
,
getDarft
}
from
"@/request/index.js"
;
export
default
{
components
:
{
Tabs
,
...
...
@@ -186,17 +188,35 @@ export default {
};
},
onLoad
(
options
)
{
this
.
isDisable
=
options
.
isDisable
==
1
?
true
:
false
;
this
.
init
();
if
(
options
.
uid
)
{
// 获取详情
this
.
getDetails
(
options
.
uid
);
}
else
if
(
options
.
isDarf
)
{
// 获取草稿数据
const
darf_data
=
this
.
$store
.
state
.
darf_data
;
// const darf_data = this.$store.state.darf_data;
uni
.
showLoading
();
getDarft
()
.
then
((
res
)
=>
{
const
darf_data
=
res
||
{};
this
.
baseInfo
=
darf_data
.
originData
.
baseInfo
;
this
.
tempForm
=
darf_data
.
originData
.
tempForm
;
console
.
log
(
"获取草稿数据---"
,
darf_data
);
this
.
detailsInfo
=
darf_data
;
uni
.
hideLoading
();
})
.
catch
((
error
)
=>
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
uni
.
hideLoading
();
});
}
},
mounted
()
{
...
...
@@ -221,14 +241,28 @@ export default {
},
// 回显数据
getDetails
(
uid
)
{
const
all_data
=
this
.
$store
.
state
.
all_data
||
[];
const
detailsInfo
=
all_data
.
filter
((
item
)
=>
item
.
uid
==
uid
)[
0
]
||
{};
console
.
log
(
"--detailsInfo--"
,
detailsInfo
);
uni
.
showLoading
();
getInspectionDetails
(
uid
)
.
then
((
res
)
=>
{
console
.
log
(
"-getInspectionDetails--"
,
res
)
const
detailsInfo
=
res
;
this
.
baseInfo
=
detailsInfo
.
originData
.
baseInfo
;
this
.
tempForm
=
detailsInfo
.
originData
.
tempForm
;
this
.
detailsInfo
=
detailsInfo
;
this
.
isDisable
=
detailsInfo
.
synchronization
==
1
;
this
.
isDisable
=
this
.
isDisable
||
detailsInfo
.
synchronization
==
1
;
uni
.
hideLoading
();
})
.
catch
((
error
)
=>
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
uni
.
hideLoading
();
});
},
// 回显组件数据
setComponentData
(
activeTabIndex
,
componentData
)
{
...
...
pages/inspectionContent/model/batteryRoom.vue
浏览文件 @
2a537883
...
...
@@ -187,7 +187,6 @@ export default {
});
this
.
list
=
temp
;
console
.
log
(
"---temp"
,
temp
);
},
// 回显数据
setForm
(
componentData
)
{
...
...
pages/inspectionContent/model/gatherDataCenter.vue
浏览文件 @
2a537883
...
...
@@ -188,11 +188,9 @@ export default {
});
this
.
list
=
temp
;
console
.
log
(
"---temp"
,
temp
);
},
// 回显数据
setForm
(
componentData
)
{
console
.
log
(
"-componentData---"
,
componentData
);
this
.
list
=
componentData
;
},
// 获取数据
...
...
pages/inspectionContent/model/shieldedComputerRoom.vue
浏览文件 @
2a537883
...
...
@@ -185,7 +185,6 @@ export default {
});
this
.
list
=
temp
;
console
.
log
(
"---temp"
,
temp
);
},
// 回显数据
setForm
(
componentData
)
{
...
...
pages/inspectionManagement/index.vue
浏览文件 @
2a537883
...
...
@@ -6,19 +6,31 @@
<!-- 结果 -->
<view
class=
"inspection-management-content"
>
<view
class=
"count-tatal"
>
<text
class=
"num"
>
123
条
</text>
<text
class=
"num"
>
{{
countNum
||
0
}}
条
</text>
<text>
查询结果
</text>
</view>
<view
class=
"month-list"
>
<!-- 每月记录 -->
<view
class=
"month-record-item"
v-for=
"item in 20"
:key=
"item"
>
<view
class=
"seconed-title"
>
2024年08月
</view>
<view
class=
"month-record-item"
v-for=
"(item, index) in list"
:key=
"index"
>
<view
v-if=
"(item.list || []).length"
class=
"seconed-title"
>
{{
item
.
time
}}
</view>
<view
class=
"inspect-list"
>
<InspectionItem
/>
<InspectionItem
v-for=
"ele in item.list"
:key=
"ele.inspectionCode"
:details=
"ele"
/>
</view>
</view>
<Empty
v-if=
"list.length == 0"
/>
</view>
</view>
...
...
@@ -30,23 +42,126 @@
<
script
>
import
SearchCom
from
"@/components/searchCom/index.vue"
;
import
InspectionItem
from
"@/components/inspectionItem/index.vue"
;
import
{
getDarft
}
from
"@/request/index.js"
;
import
{
getAllInspections
}
from
"@/request/index.js"
;
import
Empty
from
"@/components/empty/index.vue"
;
export
default
{
components
:
{
SearchCom
,
InspectionItem
,
Empty
,
},
data
()
{
return
{};
return
{
isDialog
:
false
,
//
list
:
[],
// 展示数据
all_data
:
[],
// 所有数据
searchForm
:
{
// 搜索条件
},
countNum
:
0
,
// 统计查询总数
};
},
mounted
()
{
uni
.
showLoading
();
getAllInspections
()
.
then
((
res
)
=>
{
this
.
all_data
=
res
;
this
.
init
();
uni
.
hideLoading
();
})
.
catch
((
error
)
=>
{
if
(
0
==
error
.
code
)
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
}
this
.
all_data
=
[];
uni
.
hideLoading
();
});
},
methods
:
{
init
()
{
const
all_data
=
this
.
all_data
||
[];
const
tempAllData
=
{};
all_data
.
forEach
((
item
)
=>
{
const
val
=
tempAllData
[
item
.
submitTime
]
||
[];
if
(
val
.
length
)
{
tempAllData
[
item
.
submitTime
].
push
(
item
);
}
else
{
tempAllData
[
item
.
submitTime
]
=
[
item
];
}
});
const
keys
=
Object
.
keys
(
tempAllData
);
const
{
inspectionTime
=
[]
}
=
this
.
searchForm
;
const
startTime
=
inspectionTime
[
0
];
const
endTime
=
inspectionTime
[
1
];
// 第一步: 筛选有效的时间范围
const
timeFrame
=
keys
.
filter
((
key
)
=>
{
if
(
!
inspectionTime
.
length
)
{
return
true
;
}
else
{
return
(
new
Date
(
startTime
).
getTime
()
<=
new
Date
(
key
).
getTime
()
&&
new
Date
(
key
).
getTime
()
<=
new
Date
(
endTime
).
getTime
()
);
}
});
// 第二步: 根据搜索条件过滤
const
list
=
timeFrame
.
map
((
key
)
=>
{
return
{
time
:
key
,
list
:
this
.
coverData
(
tempAllData
[
key
]),
};
});
console
.
log
(
"list 数据----"
,
list
);
this
.
countNum
=
0
;
list
.
forEach
((
item
)
=>
{
this
.
countNum
+=
item
.
list
.
length
;
});
this
.
list
=
list
;
},
coverData
(
arr
=
[])
{
const
{
isException
=
""
,
inspectionType
=
""
,
iSynchronization
=
""
,
}
=
this
.
searchForm
;
return
arr
.
filter
((
item
)
=>
{
return
(
(
!
isException
||
item
.
isException
==
isException
)
&&
(
!
inspectionType
||
item
.
inspectionType
==
inspectionType
)
&&
(
!
iSynchronization
||
item
.
iSynchronization
==
iSynchronization
)
);
});
},
change
(
e
)
{
console
.
log
(
"----"
,
e
);
this
.
searchForm
=
e
;
this
.
init
();
},
toPage
()
{
const
darf_data
=
this
.
$store
.
state
.
darf_data
||
{};
console
.
log
(
"---读取的草稿数据"
,
darf_data
)
uni
.
showLoading
();
getDarft
()
.
then
((
res
)
=>
{
const
darf_data
=
res
||
{};
if
(
darf_data
.
inspectionType
==
1
)
{
uni
.
navigateTo
({
url
:
`/pages/inspectionContent/inspectionContent?isDarf=1`
,
...
...
@@ -60,6 +175,24 @@ export default {
url
:
"/pages/inspection/inspFirst"
,
});
}
uni
.
hideLoading
();
})
.
catch
((
error
)
=>
{
console
.
log
(
"error"
,
error
);
if
(
error
.
code
==
0
)
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
}
uni
.
navigateTo
({
url
:
"/pages/inspection/inspFirst"
,
});
uni
.
hideLoading
();
});
},
},
};
...
...
pages/login/login.vue
浏览文件 @
2a537883
...
...
@@ -31,16 +31,16 @@ import {
checkAndCreateDirectory
,
createFileWithPlusIO
,
TEST
,
TEST_2X
TEST_2X
,
}
from
"@/utils/systemCofig"
;
import
{
LOG_TYPE_ENUM
,
getLogContent
,
addLog
,
readDirectoryData
,
}
from
"@/utils/IoReadingAndWriting.js"
;
import
moment
from
"moment"
;
export
default
{
components
:
{
...
...
@@ -49,8 +49,8 @@ export default {
data
()
{
return
{
person
:
{
user
:
"
test
"
,
pd
:
"
Aa123456
"
,
user
:
"
xhqxj
"
,
pd
:
"
JF85250920
"
,
},
backButtonPress
:
0
,
personList
:
[],
...
...
@@ -60,15 +60,7 @@ export default {
onShow
()
{
this
.
setUser
();
},
mounted
()
{
// let timeStr = getDateTime.dateTimeStr('y-m-d h-i-s')
// let fileName = "用户名" + timeStr + '.txt'
// const fileContent = this.setSm2(TEST_2X)
// console.log("---加密内容", fileContent)
// createFileWithPlusIO(`${SYNCHRONIZE_DATA_PAD}/同步数据`, fileName,fileContent ).then(res => {
// console.log("---写入成功", res)
// })
},
mounted
()
{},
// 定义返回退出
onBackPress
(
options
)
{
this
.
backButtonPress
++
;
...
...
@@ -145,64 +137,29 @@ export default {
this
.
person
.
user
==
this
.
personList
[
key
].
user
&&
this
.
person
.
pd
==
this
.
personList
[
key
].
passWord
)
{
// this.$store.state.now_user = this.personList[key]
const
last_time
=
moment
().
format
(
"yyyy-MM-DD HH:mm:ss"
);
this
.
$store
.
commit
(
"SET_USER"
,
this
.
personList
[
key
]);
uni
.
setStorageSync
(
"now_user"
,
this
.
personList
[
key
]);
this
.
$store
.
commit
(
"SET_TIME"
,
last_time
);
uni
.
setStorageSync
(
"last_time"
,
last_time
);
// let timeStr = getDateTime.dateTimeStr("y-m-d h:i");
// let operData = {
// name: this.$store.state.now_user.name,
// level: "秘密",
// user: this.$store.state.now_user.user,
// module: "其他",
// detail: "无",
// type: "登录",
// time: timeStr,
// };
uni
.
navigateTo
({
url
:
"/pages/home/home"
,
});
uni
.
showToast
({
title
:
"登录成功"
,
icon
:
"none"
,
duration
:
2000
,
});
// 读取文件夹数据
readDirectoryData
()
.
then
((
res
)
=>
{
// 更新日志信息
const
logContent
=
getLogContent
(
LOG_TYPE_ENUM
.
login
);
const
log_list
=
this
.
$store
.
state
.
log_list
;
const
log_list
=
this
.
$store
.
state
.
log_list
||
[]
;
log_list
.
push
(
logContent
);
this
.
$store
.
commit
(
"SET_LOG_LIST"
,
log_list
);
addLog
(
log_list
);
// uni.showToast({
// title: "登录成功",
// icon: "none",
// duration: 2000,
// });
uni
.
navigateTo
({
url
:
"/pages/home/home"
,
});
uni
.
hideLoading
();
})
.
catch
((
error
)
=>
{
console
.
log
(
"--login.vue--"
,
error
);
uni
.
hideLoading
();
});
// return;
// this.$store.state.oper_record.unshift(operData);
// console.log("--this.personList[key]-", this.personList[key]);
// 检查文件夹是否创建, 没有就创建
// checkAndCreateDirectory(
// `${SYNCHRONIZE_DATA_PAD}/${this.$store.state.now_user.user}`
// );
// 更新日志信息
// const logContent = getLogContent(LOG_TYPE_ENUM.login);
// addLog(logContent);
// uni.navigateTo({
// url: "/pages/home/home",
// });
// 密码不正确
}
else
{
...
...
pages/shaftInspection/model/tabContentItem.vue
浏览文件 @
2a537883
...
...
@@ -79,6 +79,7 @@ import {
pad_room_type
,
}
from
"@/utils/dict.js"
;
/**
* 汇集机房
*/
...
...
@@ -204,11 +205,9 @@ export default {
});
this
.
list
=
temp
;
// console.log("---temp", temp);
},
// 回显数据
setForm
(
componentData
)
{
console
.
log
(
"-componentData---"
,
componentData
);
this
.
list
=
componentData
.
temp
;
if
(
componentData
.
conclusion
)
{
this
.
form
=
{
...
...
pages/shaftInspection/shaftInspection.vue
浏览文件 @
2a537883
...
...
@@ -104,7 +104,7 @@ import {
}
from
"@/utils/IoReadingAndWriting.js"
;
import
{
pad_2_1_inspection_position
}
from
"@/utils/dict.js"
;
import
{
Base64
}
from
"js-base64
"
;
import
{
getInspectionDetails
,
getDarft
}
from
"@/request/index.js
"
;
export
default
{
components
:
{
...
...
@@ -124,15 +124,31 @@ export default {
};
},
onLoad
(
options
)
{
this
.
isDisable
=
options
.
isDisable
==
1
?
true
:
false
;
if
(
options
.
uid
)
{
this
.
getDetails
(
options
.
uid
);
}
else
if
(
options
.
isDarf
)
{
// 获取草稿数据
const
darf_data
=
this
.
$store
.
state
.
darf_data
;
uni
.
showLoading
();
getDarft
()
.
then
((
res
)
=>
{
const
darf_data
=
res
||
{};
this
.
baseInfo
=
darf_data
.
originData
.
baseInfo
;
this
.
tempForm
=
darf_data
.
originData
.
tempForm
;
console
.
log
(
"获取草稿数据---"
,
darf_data
);
this
.
detailsInfo
=
darf_data
;
uni
.
hideLoading
();
})
.
catch
((
error
)
=>
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
uni
.
hideLoading
();
});
}
},
mounted
()
{
...
...
@@ -171,14 +187,28 @@ export default {
},
// 回显数据
getDetails
(
uid
)
{
const
all_data
=
this
.
$store
.
state
.
all_data
||
[];
const
detailsInfo
=
all_data
.
filter
((
item
)
=>
item
.
uid
==
uid
)[
0
]
||
{};
uni
.
showLoading
();
getInspectionDetails
(
uid
)
.
then
((
res
)
=>
{
const
detailsInfo
=
res
;
// const all_data = this.$store.state.all_data || [];
// const detailsInfo = all_data.filter((item) => item.uid == uid)[0] || {};
console
.
log
(
"--detailsInfo-"
,
detailsInfo
);
this
.
baseInfo
=
detailsInfo
.
originData
.
baseInfo
;
this
.
tempForm
=
detailsInfo
.
originData
.
tempForm
;
this
.
detailsInfo
=
detailsInfo
;
this
.
isDisable
=
detailsInfo
.
synchronization
==
1
;
this
.
isDisable
=
this
.
isDisable
||
detailsInfo
.
synchronization
==
1
;
// 是否禁用 1:已同步数据 0: 未同步数据
uni
.
hideLoading
();
})
.
catch
((
error
)
=>
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
uni
.
hideLoading
();
});
},
// 回显组件数据
setComponentData
(
refName
,
componentData
)
{
...
...
pages/synchronization/synchronization.vue
浏览文件 @
2a537883
...
...
@@ -317,49 +317,6 @@
let
data
=
this
.
setSm2
(
this
.
listData
)
// plus.io.resolveLocalFileSystemURL(
// `/storage/emulated/0/Android/data/asmzx/同步数据/${this.$store.state.now_user.user}/`, //指定的目录
// function(entry) {
// // 创建或打开文件, fs.root是根目录操作对象,直接fs表示当前操作对象
// entry.getFile(
// fileName, {
// create: true // 文件不存在则创建
// },
// fileEntry => {
// // 文件在手机中的路径
// console.log(fileEntry.fullPath)
// fileEntry.createWriter(writer => {
// // 向文件中写入数据
// writer.write(
// JSON.stringify(data)
// );
// // 写入文件成功完成的回调函数
// writer.onwrite = e => {
// // uni.showToast({
// // title: '同步成功',
// // icon: 'none',
// // duration: 2000
// // })
// // _this.$refs.alertDialog.open()
// };
// });
// },
// e => {
// console.log('getFile failed: ' + e.message);
// }
// );
// },
// e => {
// console.log(e.message);
// },
// function(err) {
// console.log("访问指定目录失败:" + err.message);
// });
createFileWithPlusIO
(
`
${
SYNCHRONIZE_DATA_PAD
}
/同步数据`
,
fileName
,
data
).
then
(
res
=>
{
console
.
log
(
"---写入成功"
,
res
)
...
...
pages/synchronousManagement/dialog.vue
浏览文件 @
2a537883
...
...
@@ -66,8 +66,7 @@ export default {
},
mounted
()
{
// const all_data = this.$store.state.all_data;
this
.
all_data
=
this
.
$store
.
state
.
all_data
||
[];
this
.
all_data
=
(
this
.
$store
.
state
.
all_data
||
[]).
filter
(
item
=>
item
.
synchronization
==
0
);
},
methods
:
{
change
(
e
)
{},
...
...
pages/synchronousManagement/index.vue
浏览文件 @
2a537883
...
...
@@ -6,7 +6,7 @@
<!-- 结果 -->
<view
class=
"synchronous-management-content"
>
<view
class=
"count-tatal"
>
<text
class=
"num"
>
{{
countNum
||
0
}}
条
</text>
<text
class=
"num"
>
{{
countNum
||
0
}}
条
</text>
<text>
查询结果
</text>
</view>
...
...
@@ -17,21 +17,31 @@
v-for=
"(item, index) in list"
:key=
"index"
>
<view
class=
"seconed-title"
>
{{
item
.
time
}}
</view>
<view
v-if=
"(item.list || []).length"
class=
"seconed-title"
>
{{
item
.
time
}}
</view>
<view
class=
"inspect-list"
>
<InspectionItem
v-for=
"ele in item.list"
:key=
"ele.inspectionCode"
:details=
"ele"
:isDisable=
"true"
/>
</view>
</view>
<Empty
v-if=
"list.length == 0"
/>
</view>
</view>
<!-- 数据打包 -->
<view
v-show=
"isPackedDataBtn"
class=
"synchronous-button"
@
click=
"openDialog(true)"
>
数据打包
</view>
<view
v-show=
"isPackedDataBtn"
class=
"synchronous-button"
@
click=
"openDialog(true)"
>
数据打包
</view
>
<!-- 打包弹窗 -->
<Dialog
v-show=
"isDialog"
@
close=
"openDialog(false)"
></Dialog>
...
...
@@ -42,13 +52,15 @@
import
SearchCom
from
"@/components/searchCom/index.vue"
;
import
InspectionItem
from
"@/components/inspectionItem/index.vue"
;
import
Dialog
from
"./dialog.vue"
;
import
moment
from
"moment"
;
import
{
getAllInspections
}
from
"@/request/index.js"
;
import
Empty
from
"@/components/empty/index.vue"
;
export
default
{
components
:
{
SearchCom
,
InspectionItem
,
Dialog
,
Empty
,
},
data
()
{
return
{
...
...
@@ -59,19 +71,36 @@ export default {
// 搜索条件
},
countNum
:
0
,
// 统计查询总数
isPackedDataBtn
:
false
// 控制打包按钮显示
isPackedDataBtn
:
false
,
// 控制打包按钮显示
};
},
mounted
()
{
uni
.
showLoading
();
getAllInspections
()
.
then
((
res
)
=>
{
this
.
all_data
=
res
;
this
.
init
();
uni
.
hideLoading
();
})
.
catch
((
error
)
=>
{
if
(
0
==
error
.
code
)
{
uni
.
showToast
({
title
:
error
.
msg
,
icon
:
"none"
,
duration
:
1000
,
});
}
this
.
all_data
=
[];
uni
.
hideLoading
();
});
},
methods
:
{
init
()
{
const
all_data
=
this
.
$store
.
state
.
all_data
||
[];
console
.
log
(
"---all_data-"
,
all_data
)
this
.
isPackedDataBtn
=
all_data
.
filter
(
item
=>
item
.
synchronization
==
0
).
length
>
0
;
const
all_data
=
this
.
all_data
||
[];
this
.
isPackedDataBtn
=
all_data
.
filter
((
item
)
=>
item
.
synchronization
==
0
).
length
>
0
;
console
.
log
(
"all_data"
,
all_data
);
const
tempAllData
=
{};
all_data
.
forEach
((
item
)
=>
{
...
...
@@ -101,7 +130,6 @@ export default {
}
});
// 第二步: 根据搜索条件过滤
const
list
=
timeFrame
.
map
((
key
)
=>
{
return
{
...
...
@@ -110,10 +138,6 @@ export default {
};
});
// this.list = this.all_data
// console.log("timeFramea", timeFrame);
// console.log("this.all_data", all_data);
console
.
log
(
"list 数据----"
,
list
);
this
.
countNum
=
0
;
list
.
forEach
((
item
)
=>
{
...
...
@@ -146,6 +170,9 @@ export default {
},
openDialog
(
show
)
{
this
.
isDialog
=
show
;
if
(
!
show
)
{
this
.
init
();
}
},
},
};
...
...
request/index.js
0 → 100644
浏览文件 @
2a537883
import
store
from
"../store/index"
;
import
{
readLogData
,
readInspectionData
,
readDarfData
}
from
"@/utils/IoReadingAndWriting.js"
;
import
{
sortTimeDesc
}
from
"@/utils/common.js"
;
import
lodash
from
"lodash"
;
/**
*
* 获取所有巡检数据
* @returns
*/
export
const
getAllInspections
=
()
=>
{
const
all_data
=
store
.
state
.
all_data
||
[];
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
all_data
.
length
)
{
resolve
(
all_data
)
}
else
{
readInspectionData
()
.
then
((
res
)
=>
{
// console.log("----读出来的巡检文件", res);
const
tempRes
=
lodash
.
orderBy
(
res
,
"creatTime"
,
[
'desc'
]);
store
.
commit
(
"SET_ALL_DATA"
,
tempRes
);
resolve
(
tempRes
)
})
.
catch
((
error
)
=>
{
reject
(
error
)
})
}
})
}
/**
*
* 获取所有日志数据
* @returns
*/
export
const
getLogList
=
()
=>
{
const
log_list
=
store
.
state
.
log_list
||
[];
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
log_list
.
length
)
{
resolve
(
log_list
)
}
else
{
readLogData
()
.
then
((
res
)
=>
{
console
.
log
(
"----读出来的日志文件"
,
res
);
store
.
commit
(
"SET_LOG_LIST"
,
res
);
resolve
(
res
)
})
.
catch
((
error
)
=>
{
reject
(
error
)
})
}
})
}
/**
*
* 获取巡检数据详情
* @returns
*/
export
const
getInspectionDetails
=
(
uid
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getAllInspections
()
.
then
((
res
)
=>
{
console
.
log
(
"--list-"
,
res
)
const
detailsInfo
=
res
.
filter
((
item
)
=>
item
.
uid
==
uid
)[
0
]
||
{};
resolve
(
detailsInfo
)
})
.
catch
((
error
)
=>
{
reject
(
error
)
})
})
}
/**
*
* 获取草稿数据
* @returns
*/
export
const
getDarft
=
()
=>
{
const
darf_data
=
store
.
state
.
darf_data
||
{};
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
darf_data
.
inspectionType
)
{
resolve
(
darf_data
)
}
else
{
readDarfData
()
.
then
((
res
)
=>
{
console
.
log
(
"----读出来的草稿文件"
,
res
);
store
.
commit
(
"SET_DARF_DATA"
,
res
);
resolve
(
res
)
})
.
catch
((
error
)
=>
{
reject
(
error
)
})
}
})
}
\ No newline at end of file
store/index.js
浏览文件 @
2a537883
...
...
@@ -9,15 +9,7 @@ const store = new Vuex.Store({
log_list
:
[],
// 保存操作记录数据--日志数据
now_user
:
{
id
:
1
,
user
:
"hzsgjy"
,
passWord
:
"JFXJ85250920"
,
areaName
:
"市本级"
,
permission
:
1
,
name
:
"超管"
,
oid
:
"scq"
,
},
//保存当前登录用户
now_user
:
{
},
//保存当前登录用户
darf_data
:
{},
// 保存草稿内容
temp_data
:
{},
// 当前编辑或者查看的数据,
...
...
@@ -51,9 +43,9 @@ const store = new Vuex.Store({
//保存当前登录用户
state
.
now_user
=
payload
;
},
//
SET_TIME(state, payload) { //保存上次上报时间
//
state.last_time = payload
//
},
SET_TIME
(
state
,
payload
)
{
//保存上次上报时间
state
.
last_time
=
payload
},
DEL_DATA
(
state
,
index
)
{
//删除数据
state
.
all_data
.
splice
(
index
,
1
);
...
...
utils/IoReadingAndWriting.js
浏览文件 @
2a537883
...
...
@@ -10,6 +10,7 @@ import {
readFileContent
,
readFilesInDirectory
,
checkFileExists
,
FILE_ENUM
}
from
"./systemCofig"
;
import
moment
from
"moment"
;
import
lodash
from
"lodash"
;
...
...
@@ -30,7 +31,7 @@ export const LOG_TYPE_ENUM = {
};
// 生成日志
export
const
getLogContent
=
(
type
,
detail
=
""
,
module
=
"其他模块"
)
=>
{
export
const
getLogContent
=
(
type
,
detail
=
""
,
module
=
"其他模块"
)
=>
{
const
now_user
=
store
.
state
.
now_user
;
let
timeStr
=
moment
().
format
(
"yyyy-MM-DD HH:mm:ss"
);
return
{
...
...
@@ -134,7 +135,10 @@ export const readDarfData = () => {
.
catch
((
error
)
=>
{
reject
(
error
);
});
});
}).
catch
((
error
)
=>
{
reject
(
error
);
})
});
};
...
...
@@ -239,8 +243,11 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
}
},
function
(
error
)
{
console
.
error
(
"文件复制失败:"
,
error
.
message
);
reject
(
"文件复制失败"
);
console
.
error
(
"创建目标目录失败:"
,
error
.
message
);
reject
({
...
FILE_ENUM
.
copyFileError
});
}
);
}
else
if
(
entry
.
isDirectory
)
{
...
...
@@ -257,34 +264,49 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
);
},
function
(
error
)
{
console
.
error
(
"创建目标目录失败:"
,
error
.
message
);
reject
(
"创建目标目录失败"
);
console
.
error
(
"copyDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
createFileError
});
}
);
}
}
},
function
(
error
)
{
console
.
error
(
"读取目录条目失败:"
,
error
.
message
);
reject
(
"读取目录条目失败"
);
console
.
error
(
"copyDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
readDirectoryError
});
}
);
},
function
(
error
)
{
console
.
error
(
"获取目标目录失败:"
,
error
.
message
);
reject
(
"获取目标目录失败"
);
console
.
error
(
"copyDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
readDirectoryError
});
}
);
},
function
(
error
)
{
console
.
error
(
"获取源目录失败:"
,
error
.
message
);
reject
(
"获取源目录失败"
);
console
.
error
(
"copyDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
getDirectoryError
});
}
);
},
function
(
error
)
{
console
.
error
(
"请求文件系统失败:"
,
error
.
message
);
reject
(
"请求文件系统失败"
);
console
.
error
(
"copyDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
fileSystemError
});
}
);
});
...
...
@@ -329,29 +351,41 @@ export function deleteAllFilesInDirectory(directoryPath) {
}
},
function
(
error
)
{
reject
(
"文件删除失败"
);
console
.
error
(
"文件删除失败:"
,
error
.
message
);
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
deleteFileError
});
}
);
}
}
},
function
(
error
)
{
reject
(
"读取目录条目失败"
);
console
.
error
(
"读取目录条目失败:"
,
error
.
message
);
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
readDirectoryError
});
}
);
},
function
(
error
)
{
reject
(
"获取目录失败"
);
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
getDirectoryError
});
console
.
error
(
"获取目录失败:"
,
error
.
message
);
}
);
},
function
(
error
)
{
console
.
error
(
"请求文件系统失败:"
,
error
.
message
);
reject
(
"请求文件系统失败"
);
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
fileSystemError
});
}
);
});
...
...
@@ -380,7 +414,7 @@ export const readDirectoryData = () => {
})
.
catch
((
error
)
=>
{
console
.
log
(
"--读取数据文件-报错"
,
error
);
re
solve
(
);
re
ject
(
error
);
});
});
};
utils/common.js
0 → 100644
浏览文件 @
2a537883
// 时间倒序排列
export
const
sortTimeDesc
=
(
a
,
b
)
=>
{
return
a
.
creatTime
<
b
.
creatTime
?
1
:
-
1
;
};
\ No newline at end of file
utils/systemCofig.js
浏览文件 @
2a537883
...
...
@@ -4,19 +4,61 @@ export const BASE_PATH = "_documents/data/asmzx"; // 基础路径
export
const
SYNCHRONIZE_DATA_PATH
=
"_documents/data/asmzx"
;
// 同步数据
export
const
SYNCHRONIZE_DATA_PAD
=
"_documents/data/asmzx/pad"
;
// 存储pad端的生产数据
export
const
USER_FILE_NAME
=
"userList.txt"
;
// 存储内置用户的文件名
export
const
FILE_ENUM
=
{
// 文件枚举
fileSystemError
:
{
code
:
0
,
msg
:
"请求文件系统失败"
,
},
getDirectoryError
:
{
code
:
1
,
msg
:
"获取目录失败"
,
},
getFileError
:
{
code
:
2
,
msg
:
"获取文件失败"
,
},
readFileError
:
{
code
:
3
,
msg
:
"读取文件失败"
,
},
fileNotExist
:
{
code
:
4
,
msg
:
"文件不存在"
,
},
writeFileError
:
{
code
:
5
,
msg
:
"写入文件失败"
,
},
createFileError
:
{
code
:
6
,
msg
:
"创建文件失败"
,
},
deleteFileError
:
{
code
:
7
,
msg
:
"删除文件失败"
,
},
readDirectoryError
:
{
code
:
8
,
msg
:
"读取目录条目失败"
,
}
,
copyFileError
:
{
code
:
9
,
msg
:
"文件复制失败"
,
}
}
// 内置的用户信息
export
const
USER_LiST
=
[
{
id
:
2
,
user
:
"test"
,
// 测试账号
passWord
:
"Aa123456789"
,
areaName
:
"市本级"
,
permission
:
1
,
name
:
"巡检员"
,
oid
:
"sbj"
,
},
{
id
:
1
,
user
:
"hzsgjy"
,
...
...
@@ -25,6 +67,8 @@ export const USER_LiST = [
permission
:
1
,
name
:
"超管"
,
oid
:
"scq"
,
unitName
:
"所属单位"
},
{
id
:
3
,
...
...
@@ -258,7 +302,10 @@ export async function checkFileExists(directoryPath, fileName) {
// 文件不存在
reject
({
...
error
,
msg
:
"checkFileExists_文件不存在"
,
...
FILE_ENUM
.
fileNotExist
,
// code: FILE_ENUM
// msg: "checkFileExists_文件不存在",
});
}
);
...
...
@@ -267,7 +314,8 @@ export async function checkFileExists(directoryPath, fileName) {
console
.
error
(
"获取目录失败:"
,
error
.
message
);
reject
({
...
error
,
msg
:
"checkFileExists_获取目录失败"
,
...
FILE_ENUM
.
getDirectoryError
,
// msg: "checkFileExists_获取目录失败",
});
}
);
...
...
@@ -276,7 +324,8 @@ export async function checkFileExists(directoryPath, fileName) {
console
.
error
(
"请求文件系统失败:"
,
error
.
message
);
reject
({
...
error
,
msg
:
"checkFileExists_请求文件系统失败"
,
...
FILE_ENUM
.
fileSystemError
,
// msg: "checkFileExists_请求文件系统失败",
});
}
);
...
...
@@ -321,23 +370,42 @@ export const readFilesInDirectory = async (directoryPath) => {
resolve
(
res
);
})
.
catch
((
error
)
=>
{
reject
(
"读取文件内容失败:"
+
error
.
message
);
console
.
log
(
"readFilesInDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
getFileError
// "读取文件内容失败:" + error.message
});
});
},
function
(
error
)
{
reject
(
"读取目录条目失败:"
+
error
.
message
);
console
.
log
(
"readFilesInDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
readDirectoryError
// "读取目录条目失败:" + error.message
});
}
);
},
function
(
error
)
{
console
.
error
();
reject
(
"获取目录失败:"
+
error
.
message
);
console
.
log
(
"readFilesInDirectory:"
,
error
,
directoryPath
);
reject
({
...
FILE_ENUM
.
getDirectoryError
// "获取目录失败:" + error.message
});
}
);
},
function
(
error
)
{
console
.
error
();
reject
(
"请求文件系统失败:"
+
error
.
message
);
console
.
log
(
"readFilesInDirectory:"
,
error
);
reject
({
...
FILE_ENUM
.
fileSystemError
// "请求文件系统失败:" + error.message
});
}
);
});
...
...
@@ -360,8 +428,9 @@ export async function readFileContent(fileEntry) {
);
reject
({
msg
:
"systemCofig.js_readFileContent_读取文件失败:"
,
//
msg: "systemCofig.js_readFileContent_读取文件失败:",
...
e
.
target
.
error
,
...
FILE_ENUM
.
readFileError
});
};
// 以文本方式读取文件
...
...
@@ -404,9 +473,10 @@ export function createFileWithPlusIO(directoryPath, fileName, fileContent) {
resolve
(
fileContent
);
};
fileWriter
.
onerror
=
function
(
error
)
{
console
.
log
(
"createFileWithPlusIO_文件创建或写入失败:"
,
error
);
reject
({
...
error
,
msg
:
"createFileWithPlusIO_文件创建或写入失败:"
,
...
FILE_ENUM
.
writeFileError
,
});
};
...
...
@@ -414,25 +484,31 @@ export function createFileWithPlusIO(directoryPath, fileName, fileContent) {
fileWriter
.
write
(
fileContent
);
},
function
(
error
)
{
console
.
log
(
"createFileWithPlusIO_创建文件写入器失败:"
,
error
);
reject
({
...
error
,
msg
:
"createFileWithPlusIO_创建文件写入器失败:"
,
...
FILE_ENUM
.
createFileError
,
});
}
);
},
function
(
error
)
{
console
.
log
(
"createFileWithPlusIO_获取文件失败:"
,
error
);
reject
({
...
error
,
msg
:
"createFileWithPlusIO_获取文件失败:"
,
...
FILE_ENUM
.
getFileError
,
});
}
);
},
function
(
error
)
{
console
.
log
(
"createFileWithPlusIO_获取目录失败:"
,
error
);
reject
({
...
error
,
msg
:
"createFileWithPlusIO_获取目录失败:"
,
...
FILE_ENUM
.
getDirectoryError
,
});
}
);
...
...
@@ -440,6 +516,8 @@ export function createFileWithPlusIO(directoryPath, fileName, fileContent) {
function
(
error
)
{
reject
({
...
error
,
...
FILE_ENUM
.
fileSystemError
,
msg
:
"createFileWithPlusIO_请求文件系统失败:"
,
});
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论