Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
computedRoomPad
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
邓文彬
computedRoomPad
Commits
8f6f2d0a
提交
8f6f2d0a
authored
9月 18, 2024
作者:
邓文彬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(功能走查): 功能走查80%
上级
a529e2fc
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
121 行增加
和
79 行删除
+121
-79
index.vue
components/inspectionItem/index.vue
+1
-1
inspFirst.vue
pages/inspection/inspFirst.vue
+1
-1
inspectionContent.vue
pages/inspectionContent/inspectionContent.vue
+43
-26
shaftInspection.vue
pages/shaftInspection/shaftInspection.vue
+5
-5
dialog.vue
pages/synchronousManagement/dialog.vue
+27
-5
IoReadingAndWriting.js
utils/IoReadingAndWriting.js
+44
-41
没有找到文件。
components/inspectionItem/index.vue
浏览文件 @
8f6f2d0a
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
details
.
synchronization
==
0
?
"待同步"
:
"已同步"
details
.
synchronization
==
0
?
"待同步"
:
"已同步"
}}
</text>
}}
</text>
<view
v-if=
"details.isException ==
1
"
class=
"status alarm"
>
<view
v-if=
"details.isException ==
2
"
class=
"status alarm"
>
<text
class=
"iconfont icon-yichang1"
></text>
<text
class=
"iconfont icon-yichang1"
></text>
<text>
有异常
</text></view
<text>
有异常
</text></view
>
>
...
...
pages/inspection/inspFirst.vue
浏览文件 @
8f6f2d0a
...
@@ -108,7 +108,7 @@ export default {
...
@@ -108,7 +108,7 @@ export default {
inspectionTime
:
moment
().
format
(
"yyyy-MM-DD HH:mm:ss"
),
inspectionTime
:
moment
().
format
(
"yyyy-MM-DD HH:mm:ss"
),
inspectionBy
:
this
.
$store
.
state
.
now_user
.
name
,
inspectionBy
:
this
.
$store
.
state
.
now_user
.
name
,
inspectionById
:
this
.
$store
.
state
.
now_user
.
id
,
inspectionById
:
this
.
$store
.
state
.
now_user
.
id
,
c
ureat
ByName
:
this
.
$store
.
state
.
now_user
.
user
,
c
reate
ByName
:
this
.
$store
.
state
.
now_user
.
user
,
isException
:
""
,
// 是否有异常
isException
:
""
,
// 是否有异常
position
:
""
,
// 位置
position
:
""
,
// 位置
isSubmit
:
""
,
// 0 是草稿态; 1 是正式提交
isSubmit
:
""
,
// 0 是草稿态; 1 是正式提交
...
...
pages/inspectionContent/inspectionContent.vue
浏览文件 @
8f6f2d0a
...
@@ -15,7 +15,11 @@
...
@@ -15,7 +15,11 @@
<block
slot=
"right"
>
<block
slot=
"right"
>
<view
class=
"nav-right"
>
<view
class=
"nav-right"
>
<view
v-if=
"isOperationPermissions"
class=
"uni-nav-bar-text"
@
click=
"deleteClick"
>
<view
v-if=
"isOperationPermissions"
class=
"uni-nav-bar-text"
@
click=
"deleteClick"
>
<text
class=
"iconfont icon-delete"
></text
<text
class=
"iconfont icon-delete"
></text
></view>
></view>
...
@@ -82,7 +86,7 @@
...
@@ -82,7 +86,7 @@
></DutyHandover>
></DutyHandover>
</view>
</view>
<view
v-if=
"
isOperationPermissions && !isDisable"
class=
"fixed-btns"
>
<view
v-if=
"isOperationPermissions && !isDisable"
class=
"fixed-btns"
>
<view
class=
"button-group"
>
<view
class=
"button-group"
>
<!-- isSubmit 标识: 0 是草稿态; 1 是正式提交 -->
<!-- isSubmit 标识: 0 是草稿态; 1 是正式提交 -->
<view
<view
...
@@ -185,16 +189,18 @@ export default {
...
@@ -185,16 +189,18 @@ export default {
},
},
detailsInfo
:
{},
// 详情
detailsInfo
:
{},
// 详情
isDisable
:
false
,
// 禁用
isDisable
:
false
,
// 禁用
loading
:
false
,
};
};
},
},
computed
:
{
computed
:
{
userInfo
()
{
userInfo
()
{
return
this
.
$store
.
state
.
now_user
||
{};
return
this
.
$store
.
state
.
now_user
||
{};
},
},
isOperationPermissions
(){
// 是否有操作权限
isOperationPermissions
()
{
const
{
uid
,
cureatByName
}
=
this
.
detailsInfo
;
// 是否有操作权限
return
!
uid
||
(
uid
&&
cureatByName
==
this
.
userInfo
.
user
)
const
{
uid
,
createByName
}
=
this
.
detailsInfo
;
}
return
!
uid
||
(
uid
&&
createByName
==
this
.
userInfo
.
user
);
},
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
this
.
isDisable
=
options
.
isDisable
==
1
?
true
:
false
;
this
.
isDisable
=
options
.
isDisable
==
1
?
true
:
false
;
...
@@ -214,7 +220,7 @@ export default {
...
@@ -214,7 +220,7 @@ export default {
this
.
tempForm
=
darf_data
.
originData
.
tempForm
;
this
.
tempForm
=
darf_data
.
originData
.
tempForm
;
console
.
log
(
"获取草稿数据---"
,
darf_data
);
console
.
log
(
"获取草稿数据---"
,
darf_data
);
this
.
detailsInfo
=
darf_data
;
this
.
detailsInfo
=
darf_data
;
this
.
init
()
this
.
init
()
;
uni
.
hideLoading
();
uni
.
hideLoading
();
})
})
...
@@ -229,7 +235,7 @@ export default {
...
@@ -229,7 +235,7 @@ export default {
}
}
},
},
mounted
()
{
mounted
()
{
this
.
init
()
this
.
init
()
;
},
},
methods
:
{
methods
:
{
...
@@ -239,16 +245,16 @@ export default {
...
@@ -239,16 +245,16 @@ export default {
});
});
if
(
this
.
detailsInfo
.
inspectionType
)
{
if
(
this
.
detailsInfo
.
inspectionType
)
{
const
fillCheck
=
this
.
detailsInfo
.
fillCheck
.
split
(
","
);
const
fillCheck
=
this
.
detailsInfo
.
fillCheck
.
split
(
","
);
this
.
tabList
.
forEach
((
item
,
index
)
=>
{
this
.
tabList
.
forEach
((
item
,
index
)
=>
{
item
.
isVaild
=
fillCheck
.
includes
(
item
.
value
);
item
.
isVaild
=
fillCheck
.
includes
(
item
.
value
);
this
.
tempForm
[
index
]
&&
this
.
tempForm
[
index
]
&&
this
.
setComponentData
(
index
,
this
.
tempForm
[
index
]);
this
.
setComponentData
(
index
,
this
.
tempForm
[
index
]);
});
});
}
else
{
}
else
{
this
.
baseInfo
=
this
.
$store
.
state
.
temp_data
;
this
.
baseInfo
=
this
.
$store
.
state
.
temp_data
;
}
}
},
},
// 回显数据
// 回显数据
getDetails
(
uid
)
{
getDetails
(
uid
)
{
...
@@ -256,7 +262,7 @@ export default {
...
@@ -256,7 +262,7 @@ export default {
getInspectionDetails
(
uid
)
getInspectionDetails
(
uid
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
console
.
log
(
"-getInspectionDetails--"
,
res
)
console
.
log
(
"-getInspectionDetails--"
,
res
)
;
const
detailsInfo
=
res
;
const
detailsInfo
=
res
;
this
.
baseInfo
=
detailsInfo
.
originData
.
baseInfo
;
this
.
baseInfo
=
detailsInfo
.
originData
.
baseInfo
;
...
@@ -266,8 +272,7 @@ export default {
...
@@ -266,8 +272,7 @@ export default {
this
.
isDisable
=
this
.
isDisable
||
detailsInfo
.
synchronization
==
1
;
this
.
isDisable
=
this
.
isDisable
||
detailsInfo
.
synchronization
==
1
;
uni
.
hideLoading
();
uni
.
hideLoading
();
this
.
init
()
this
.
init
();
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
uni
.
showToast
({
uni
.
showToast
({
...
@@ -329,7 +334,7 @@ export default {
...
@@ -329,7 +334,7 @@ export default {
`
${
detailsInfo
.
recordName
}
(
${
detailsInfo
.
inspectionCode
}
)`
,
`
${
detailsInfo
.
recordName
}
(
${
detailsInfo
.
inspectionCode
}
)`
,
"巡检模块"
"巡检模块"
);
);
logContent
.
inspectionType
=
detailsInfo
.
inspectionType
logContent
.
inspectionType
=
detailsInfo
.
inspectionType
;
log_list
.
push
(
logContent
);
log_list
.
push
(
logContent
);
this
.
$store
.
commit
(
"SET_LOG_LIST"
,
log_list
);
this
.
$store
.
commit
(
"SET_LOG_LIST"
,
log_list
);
...
@@ -416,8 +421,8 @@ export default {
...
@@ -416,8 +421,8 @@ export default {
});
});
const
isException
=
items
.
filter
((
item
)
=>
item
.
inspectionResult
>
0
)
const
isException
=
items
.
filter
((
item
)
=>
item
.
inspectionResult
>
0
)
.
length
.
length
?
1
?
2
:
2
;
:
1
;
return
{
return
{
...
temp
,
...
temp
,
...
@@ -437,6 +442,7 @@ export default {
...
@@ -437,6 +442,7 @@ export default {
this
.
draft
(
this
.
activeTabIndex
,
false
,
false
).
then
(()
=>
{
this
.
draft
(
this
.
activeTabIndex
,
false
,
false
).
then
(()
=>
{
const
vaild
=
this
.
$refs
.
tabs
.
isAllVails
();
const
vaild
=
this
.
$refs
.
tabs
.
isAllVails
();
const
uid
=
this
.
detailsInfo
.
uid
;
const
uid
=
this
.
detailsInfo
.
uid
;
this
.
loading
=
true
;
if
(
vaild
)
{
if
(
vaild
)
{
/**
/**
...
@@ -462,7 +468,6 @@ export default {
...
@@ -462,7 +468,6 @@ export default {
`
${
params
.
recordName
}
(
${
params
.
inspectionCode
}
)`
,
`
${
params
.
recordName
}
(
${
params
.
inspectionCode
}
)`
,
"巡检模块"
"巡检模块"
);
);
}
else
{
}
else
{
params
.
uid
=
new
Date
().
getTime
();
// 唯一标识 pad 端使用
params
.
uid
=
new
Date
().
getTime
();
// 唯一标识 pad 端使用
all_data
.
push
(
params
);
all_data
.
push
(
params
);
...
@@ -479,7 +484,7 @@ export default {
...
@@ -479,7 +484,7 @@ export default {
// 更新日志
// 更新日志
const
log_list
=
this
.
$store
.
state
.
log_list
;
const
log_list
=
this
.
$store
.
state
.
log_list
;
logContent
.
inspectionType
=
params
.
inspectionType
logContent
.
inspectionType
=
params
.
inspectionType
;
log_list
.
push
(
logContent
);
log_list
.
push
(
logContent
);
this
.
$store
.
commit
(
"SET_LOG_LIST"
,
log_list
);
this
.
$store
.
commit
(
"SET_LOG_LIST"
,
log_list
);
...
@@ -498,13 +503,18 @@ export default {
...
@@ -498,13 +503,18 @@ export default {
this
.
$store
.
commit
(
"SET_TEMP_DATA"
,
{});
// 缓存[巡检信息]
this
.
$store
.
commit
(
"SET_TEMP_DATA"
,
{});
// 缓存[巡检信息]
console
.
log
(
"--提交--"
,
params
);
console
.
log
(
"--提交--"
,
params
);
this
.
loading
=
false
;
}
}
uni
.
showToast
({
uni
.
showToast
({
icon
:
`
${
vaild
?
"success"
:
"error"
}
`
,
icon
:
`
${
vaild
?
"success"
:
"error"
}
`
,
title
:
`
${
vaild
?
"校验通过"
:
"请完善填写内容"
}
`
,
title
:
`
${
vaild
?
"校验通过"
:
"请完善填写内容"
}
`
,
});
});
if
(
!
vaild
)
{
if
(
!
vaild
)
{
this
.
loading
=
false
;
return
;
return
;
}
}
...
@@ -541,12 +551,14 @@ export default {
...
@@ -541,12 +551,14 @@ export default {
refName
=
"DutyHandover"
;
refName
=
"DutyHandover"
;
break
;
break
;
}
}
if
(
this
.
loading
)
return
;
this
.
$refs
[
refName
].
vaildForm
().
then
(({
vaild
,
formData
})
=>
{
this
.
$refs
[
refName
].
vaildForm
().
then
(({
vaild
,
formData
})
=>
{
this
.
$refs
.
tabs
this
.
$refs
.
tabs
.
setTabVaild
(
activeTabIndex
,
vaild
,
iSwtich
)
.
setTabVaild
(
activeTabIndex
,
vaild
,
iSwtich
)
.
then
(()
=>
{
.
then
(()
=>
{
this
.
tempForm
[
activeTabIndex
]
=
formData
;
this
.
tempForm
[
activeTabIndex
]
=
formData
;
this
.
loading
=
true
;
if
(
isSave
)
{
if
(
isSave
)
{
console
.
log
(
"--保存草稿--"
);
console
.
log
(
"--保存草稿--"
);
...
@@ -571,7 +583,7 @@ export default {
...
@@ -571,7 +583,7 @@ export default {
`
${
params
.
recordName
}
(
${
params
.
inspectionCode
}
)`
,
`
${
params
.
recordName
}
(
${
params
.
inspectionCode
}
)`
,
"巡检模块"
"巡检模块"
);
);
logContent
.
inspectionType
=
params
.
inspectionType
logContent
.
inspectionType
=
params
.
inspectionType
;
const
log_list
=
this
.
$store
.
state
.
log_list
;
const
log_list
=
this
.
$store
.
state
.
log_list
;
log_list
.
push
(
logContent
);
log_list
.
push
(
logContent
);
...
@@ -579,7 +591,12 @@ export default {
...
@@ -579,7 +591,12 @@ export default {
addLog
(
log_list
).
then
((
res
)
=>
{
addLog
(
log_list
).
then
((
res
)
=>
{
console
.
log
(
"日志文件写入成功"
);
console
.
log
(
"日志文件写入成功"
);
});
});
this
.
loading
=
false
;
}
else
{
this
.
loading
=
false
;
}
}
resolve
();
resolve
();
});
});
});
});
...
...
pages/shaftInspection/shaftInspection.vue
浏览文件 @
8f6f2d0a
...
@@ -128,8 +128,8 @@ export default {
...
@@ -128,8 +128,8 @@ export default {
return
this
.
$store
.
state
.
now_user
||
{};
return
this
.
$store
.
state
.
now_user
||
{};
},
},
isOperationPermissions
(){
// 是否有操作权限
isOperationPermissions
(){
// 是否有操作权限
const
{
uid
,
c
ureat
ByName
}
=
this
.
detailsInfo
;
const
{
uid
,
c
reate
ByName
}
=
this
.
detailsInfo
;
return
!
uid
||
(
uid
&&
c
ureat
ByName
==
this
.
userInfo
.
user
)
return
!
uid
||
(
uid
&&
c
reate
ByName
==
this
.
userInfo
.
user
)
}
}
},
},
...
@@ -315,8 +315,8 @@ export default {
...
@@ -315,8 +315,8 @@ export default {
const
isException
=
((
tempForm
[
index
]
||
{}).
temp
||
[]).
filter
(
const
isException
=
((
tempForm
[
index
]
||
{}).
temp
||
[]).
filter
(
(
item
)
=>
item
.
inspectionResult
>
0
(
item
)
=>
item
.
inspectionResult
>
0
).
length
).
length
?
1
?
2
:
2
;
:
1
;
return
{
return
{
...
baseInfo
,
...
baseInfo
,
...
@@ -333,7 +333,7 @@ export default {
...
@@ -333,7 +333,7 @@ export default {
...
temp
[
0
],
...
temp
[
0
],
isSubmit
:
0
,
isSubmit
:
0
,
isException
:
temp
.
filter
((
item
)
=>
item
.
isException
>
0
).
length
?
1
:
2
,
// 总的数据
isException
:
temp
.
filter
((
item
)
=>
item
.
isException
>
1
).
length
?
2
:
1
,
// 总的数据
items
:
[],
items
:
[],
synchronization
:
0
,
// 是否导出过
synchronization
:
0
,
// 是否导出过
submitTime
:
moment
().
format
(
"yyyy-MM-DD"
),
// 记录提交时间
submitTime
:
moment
().
format
(
"yyyy-MM-DD"
),
// 记录提交时间
...
...
pages/synchronousManagement/dialog.vue
浏览文件 @
8f6f2d0a
...
@@ -76,7 +76,6 @@ export default {
...
@@ -76,7 +76,6 @@ export default {
});
});
},
},
methods
:
{
methods
:
{
change
(
e
)
{},
close
()
{
close
()
{
this
.
$emit
(
"close"
);
this
.
$emit
(
"close"
);
},
},
...
@@ -132,13 +131,12 @@ export default {
...
@@ -132,13 +131,12 @@ export default {
originData
:
[],
originData
:
[],
};
};
});
// 机房数据类型是 1
});
// 机房数据类型是 1
const
JDXJ_DATA
=
notSynchronizationList
.
filter
(
const
JDXJ_DATA
=
notSynchronizationList
.
filter
(
(
item
)
=>
item
.
inspectionType
==
2
(
item
)
=>
item
.
inspectionType
==
2
);
// 井道数据类型是 2
);
// 井道数据类型是 2
this
.
loading
=
true
;
this
.
loading
=
true
;
Promise
.
all
([
Promise
.
all
([
this
.
packedData
(
JFXJ_DATA
,
JFXJ_DATA_FILE_NAME
),
this
.
packedData
(
JFXJ_DATA
,
JFXJ_DATA_FILE_NAME
),
this
.
packedData
(
JDXJ_DATA
,
JDXJ_DATA_FILE_NAME
),
this
.
packedData
(
JDXJ_DATA
,
JDXJ_DATA_FILE_NAME
),
...
@@ -146,19 +144,31 @@ export default {
...
@@ -146,19 +144,31 @@ export default {
.
then
(()
=>
{
.
then
(()
=>
{
// 更新巡检数据状态
// 更新巡检数据状态
const
synchronizationUids
=
notSynchronizationList
.
map
((
item
)
=>
{
const
synchronizationUids
=
notSynchronizationList
.
map
((
item
)
=>
{
item
.
synchronization
=
1
;
return
item
.
uid
;
return
item
.
uid
;
});
});
const
userData
=
{};
allList
.
forEach
((
item
)
=>
{
allList
.
forEach
((
item
)
=>
{
if
(
synchronizationUids
.
includes
(
item
.
uid
))
{
if
(
synchronizationUids
.
includes
(
item
.
uid
))
{
item
.
synchronization
=
1
;
item
.
synchronization
=
1
;
}
}
if
(
userData
[
item
.
createByName
])
{
userData
[
item
.
createByName
].
push
(
item
);
}
else
{
userData
[
item
.
createByName
]
=
[
item
];
}
});
});
this
.
$store
.
commit
(
"SET_ALL_DATA"
,
allList
);
this
.
$store
.
commit
(
"SET_ALL_DATA"
,
allList
);
writeInspectionData
(
allList
)
const
keys
=
Object
.
keys
(
userData
);
const
promiseArr
=
keys
.
map
((
key
)
=>
{
const
val
=
userData
[
key
];
return
writeInspectionData
(
val
,
key
);
});
Promise
.
all
(
promiseArr
)
.
then
(()
=>
{
.
then
(()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
uni
.
showToast
({
uni
.
showToast
({
...
@@ -206,9 +216,21 @@ export default {
...
@@ -206,9 +216,21 @@ export default {
});
});
},
},
// 更新当前用户数据 || 更新所有数据
updateData
(
userData
)
{
const
keys
=
Object
.
keys
(
userData
);
const
promiseArr
=
keys
.
map
((
key
)
=>
{
const
val
=
userData
[
key
];
return
writeInspectionData
(
val
);
});
return
Promise
.
all
(
promiseArr
).
then
();
},
// 打包文件
// 打包文件
packedData
(
content
,
fileName
)
{
packedData
(
content
,
fileName
)
{
const
fileContent
=
setSm2
(
content
);
const
fileContent
=
setSm2
(
content
);
return
createFileWithPlusIO
(
return
createFileWithPlusIO
(
`
${
SYNCHRONIZE_DATA_PAD
}
/发送数据`
,
`
${
SYNCHRONIZE_DATA_PAD
}
/发送数据`
,
fileName
,
fileName
,
...
...
utils/IoReadingAndWriting.js
浏览文件 @
8f6f2d0a
...
@@ -10,7 +10,7 @@ import {
...
@@ -10,7 +10,7 @@ import {
readFileContent
,
readFileContent
,
readFilesInDirectory
,
readFilesInDirectory
,
checkFileExists
,
checkFileExists
,
FILE_ENUM
FILE_ENUM
,
}
from
"./systemCofig"
;
}
from
"./systemCofig"
;
import
moment
from
"moment"
;
import
moment
from
"moment"
;
import
lodash
from
"lodash"
;
import
lodash
from
"lodash"
;
...
@@ -77,11 +77,13 @@ export const readLogData = () => {
...
@@ -77,11 +77,13 @@ export const readLogData = () => {
const
now_user
=
store
.
state
.
now_user
;
const
now_user
=
store
.
state
.
now_user
;
const
isAdmin
=
now_user
.
isAdmin
;
const
isAdmin
=
now_user
.
isAdmin
;
const
directoryPath
=
isAdmin
?
`
${
SYNCHRONIZE_DATA_PAD
}
/日志文件`
:
`
${
SYNCHRONIZE_DATA_PAD
}
/日志文件/
${
now_user
.
user
}
`
;
const
directoryPath
=
isAdmin
?
`
${
SYNCHRONIZE_DATA_PAD
}
/日志文件`
:
`
${
SYNCHRONIZE_DATA_PAD
}
/日志文件/
${
now_user
.
user
}
`
;
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
readFilesInDirectory
(
directoryPath
)
readFilesInDirectory
(
directoryPath
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
console
.
log
(
"--读取日志-, "
,
directoryPath
,
res
)
console
.
log
(
"--读取日志-, "
,
directoryPath
,
res
);
const
temp
=
res
.
map
((
element
)
=>
{
const
temp
=
res
.
map
((
element
)
=>
{
return
JSON
.
parse
(
Base64
.
decode
(
element
));
return
JSON
.
parse
(
Base64
.
decode
(
element
));
...
@@ -120,27 +122,25 @@ export const readDarfData = () => {
...
@@ -120,27 +122,25 @@ export const readDarfData = () => {
console
.
log
(
"-directoryPath--"
,
directoryPath
);
console
.
log
(
"-directoryPath--"
,
directoryPath
);
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
checkFileExists
(
checkFileExists
(
`
${
SYNCHRONIZE_DATA_PAD
}
/草稿文件`
,
`
${
now_user
.
user
}
.txt`
)
`
${
SYNCHRONIZE_DATA_PAD
}
/草稿文件`
,
.
then
((
fileEntry
)
=>
{
`
${
now_user
.
user
}
.txt`
// 文件存在,
).
then
((
fileEntry
)
=>
{
return
readFileContent
(
fileEntry
)
// 文件存在,
.
then
((
res
)
=>
{
return
readFileContent
(
fileEntry
)
if
(
!
res
.
length
)
{
.
then
((
res
)
=>
{
resolve
({});
if
(
!
res
.
length
)
{
}
else
{
resolve
({});
// console.log("读取草稿文件--", JSON.parse(Base64.decode(res)));
}
else
{
resolve
(
JSON
.
parse
(
Base64
.
decode
(
res
)));
// console.log("读取草稿文件--", JSON.parse(Base64.decode(res)));
}
resolve
(
JSON
.
parse
(
Base64
.
decode
(
res
)));
})
}
.
catch
((
error
)
=>
{
})
reject
(
error
);
.
catch
((
error
)
=>
{
});
reject
(
error
);
})
});
.
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
reject
(
error
);
reject
(
error
);
});
})
});
});
};
};
...
@@ -150,20 +150,21 @@ export const readDarfData = () => {
...
@@ -150,20 +150,21 @@ export const readDarfData = () => {
* @param {*} isEncryption 是否加密
* @param {*} isEncryption 是否加密
* @returns
* @returns
*/
*/
export
const
writeInspectionData
=
(
content
,
isEncryption
=
fals
e
)
=>
{
export
const
writeInspectionData
=
(
content
,
useNam
e
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
now_user
=
store
.
state
.
now_user
;
const
now_user
=
store
.
state
.
now_user
;
const
isAdmin
=
now_user
.
isAdmin
;
let
timeStr
=
moment
().
format
(
"yyyy-MM-DD"
);
let
timeStr
=
moment
().
format
(
"yyyy-MM-DD"
);
let
fileName
=
`
${
timeStr
}
.txt`
;
let
fileName
=
`
${
timeStr
}
.txt`
;
console
.
log
(
"写入-巡检数据--"
,
content
);
console
.
log
(
"写入-巡检数据--"
,
content
);
// isEncryption
;
console
.
log
(
"写入-巡检数据- 路劲-"
,
`
${
SYNCHRONIZE_DATA_PAD
}
/巡检数据/
${
isAdmin
?
useName
:
now_user
.
user
}
`
)
;
const
temp
=
Base64
.
encode
(
JSON
.
stringify
(
content
));
const
fileContent
=
isEncryption
?
setSm2
(
temp
)
:
temp
;
const
fileContent
=
Base64
.
encode
(
JSON
.
stringify
(
content
))
;
createFileWithPlusIO
(
createFileWithPlusIO
(
`
${
SYNCHRONIZE_DATA_PAD
}
/巡检数据/
${
now_user
.
user
}
`
,
`
${
SYNCHRONIZE_DATA_PAD
}
/巡检数据/
${
isAdmin
?
useName
:
now_user
.
user
}
`
,
fileName
,
fileName
,
fileContent
fileContent
).
then
((
res
)
=>
{
).
then
((
res
)
=>
{
...
@@ -178,7 +179,10 @@ export const writeInspectionData = (content, isEncryption = false) => {
...
@@ -178,7 +179,10 @@ export const writeInspectionData = (content, isEncryption = false) => {
export
const
readInspectionData
=
()
=>
{
export
const
readInspectionData
=
()
=>
{
const
now_user
=
store
.
state
.
now_user
;
const
now_user
=
store
.
state
.
now_user
;
const
isAdmin
=
now_user
.
isAdmin
;
const
isAdmin
=
now_user
.
isAdmin
;
const
directoryPath
=
isAdmin
?
`
${
SYNCHRONIZE_DATA_PAD
}
/巡检数据`
:
`
${
SYNCHRONIZE_DATA_PAD
}
/巡检数据/
${
now_user
.
user
}
`
;
const
directoryPath
=
isAdmin
?
`
${
SYNCHRONIZE_DATA_PAD
}
/巡检数据`
:
`
${
SYNCHRONIZE_DATA_PAD
}
/巡检数据/
${
now_user
.
user
}
`
;
console
.
log
(
"---directoryPath"
,
directoryPath
)
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
readFilesInDirectory
(
directoryPath
)
readFilesInDirectory
(
directoryPath
)
...
@@ -248,7 +252,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
...
@@ -248,7 +252,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
console
.
error
(
"创建目标目录失败:"
,
error
.
message
);
console
.
error
(
"创建目标目录失败:"
,
error
.
message
);
reject
({
reject
({
...
FILE_ENUM
.
copyFileError
...
FILE_ENUM
.
copyFileError
,
});
});
}
}
);
);
...
@@ -269,7 +273,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
...
@@ -269,7 +273,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
console
.
error
(
"copyDirectory:"
,
error
);
console
.
error
(
"copyDirectory:"
,
error
);
reject
({
reject
({
...
FILE_ENUM
.
createFileError
...
FILE_ENUM
.
createFileError
,
});
});
}
}
);
);
...
@@ -280,7 +284,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
...
@@ -280,7 +284,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
console
.
error
(
"copyDirectory:"
,
error
);
console
.
error
(
"copyDirectory:"
,
error
);
reject
({
reject
({
...
FILE_ENUM
.
readDirectoryError
...
FILE_ENUM
.
readDirectoryError
,
});
});
}
}
);
);
...
@@ -289,7 +293,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
...
@@ -289,7 +293,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
console
.
error
(
"copyDirectory:"
,
error
);
console
.
error
(
"copyDirectory:"
,
error
);
reject
({
reject
({
...
FILE_ENUM
.
readDirectoryError
...
FILE_ENUM
.
readDirectoryError
,
});
});
}
}
);
);
...
@@ -298,7 +302,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
...
@@ -298,7 +302,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
console
.
error
(
"copyDirectory:"
,
error
);
console
.
error
(
"copyDirectory:"
,
error
);
reject
({
reject
({
...
FILE_ENUM
.
getDirectoryError
...
FILE_ENUM
.
getDirectoryError
,
});
});
}
}
);
);
...
@@ -307,7 +311,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
...
@@ -307,7 +311,7 @@ export function copyDirectory(sourceDirectoryPath, targetDirectoryPath) {
console
.
error
(
"copyDirectory:"
,
error
);
console
.
error
(
"copyDirectory:"
,
error
);
reject
({
reject
({
...
FILE_ENUM
.
fileSystemError
...
FILE_ENUM
.
fileSystemError
,
});
});
}
}
);
);
...
@@ -356,7 +360,7 @@ export function deleteAllFilesInDirectory(directoryPath) {
...
@@ -356,7 +360,7 @@ export function deleteAllFilesInDirectory(directoryPath) {
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
reject
({
reject
({
...
FILE_ENUM
.
deleteFileError
...
FILE_ENUM
.
deleteFileError
,
});
});
}
}
);
);
...
@@ -367,7 +371,7 @@ export function deleteAllFilesInDirectory(directoryPath) {
...
@@ -367,7 +371,7 @@ export function deleteAllFilesInDirectory(directoryPath) {
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
reject
({
reject
({
...
FILE_ENUM
.
readDirectoryError
...
FILE_ENUM
.
readDirectoryError
,
});
});
}
}
);
);
...
@@ -376,9 +380,8 @@ export function deleteAllFilesInDirectory(directoryPath) {
...
@@ -376,9 +380,8 @@ export function deleteAllFilesInDirectory(directoryPath) {
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
reject
({
reject
({
...
FILE_ENUM
.
getDirectoryError
...
FILE_ENUM
.
getDirectoryError
,
});
});
}
}
);
);
},
},
...
@@ -386,7 +389,7 @@ export function deleteAllFilesInDirectory(directoryPath) {
...
@@ -386,7 +389,7 @@ export function deleteAllFilesInDirectory(directoryPath) {
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
console
.
error
(
"deleteAllFilesInDirectory:"
,
error
);
reject
({
reject
({
...
FILE_ENUM
.
fileSystemError
...
FILE_ENUM
.
fileSystemError
,
});
});
}
}
);
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论