Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
design
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abookCheck
design
Commits
ac8179c3
Commit
ac8179c3
authored
Jun 07, 2021
by
Yujin Seo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#42180 作業一覧対応
parent
42598f40
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3183 additions
and
3 deletions
+3183
-3
app/index.html
+7
-3
app/script/check-list.js
+554
-0
app/script/check.js
+2622
-0
No files found.
app/index.html
View file @
ac8179c3
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"ja-JP"
>
<head>
...
...
@@ -10,9 +10,13 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/app.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/fontawesome_relative_path.css"
>
<script
src=
"js/jquery-1.11.2.min.js?__UPDATEID__"
></script>
<script
src=
"script/check.js?__UPDATEID__"
></script>
<script
src=
"script/check-list.js?__UPDATEID__"
></script>
</head>
<body>
<body
onload=
"CHK_L.init();"
>
<header>
<nav
class=
"navbar navbar-dark bg-primary"
>
<a
class=
"navbar-brand category-btn lht-0"
href=
"#"
>
...
...
@@ -276,7 +280,7 @@
<i
class=
"fas fa-home fs-14 p-1"
></i>
<div
class=
"fs-7"
>
ホーム
</div>
</a>
<a
class=
"d-block w-100 text-center py-2 text-decoration-none text-secondary"
>
<a
class=
"d-block w-100 text-center py-2 text-decoration-none text-secondary"
onclick=
"CHK_L.goRelationContent();"
>
<i
class=
"fas fa-folder fs-14 p-1"
></i>
<div
class=
"fs-7"
>
関連資料
</div>
</a>
...
...
app/script/check-list.js
0 → 100644
View file @
ac8179c3
// 名前空間
var
CHK_L
=
{};
/**
* 初期処理
*
*/
CHK_L
.
init
=
function
()
{
CHK
.
useKrpano
=
false
;
CHK
.
operationType
=
CHK
.
OPERATION_TYPE
.
LIST
;
//ファンクション登録
CHK
.
getSaveHotspotParam
=
CHK_L
.
getSaveHotspotParam
;
CHK
.
afterUpdateReport
=
CHK_L
.
afterUpdateReport
;
CHK
.
afterCancelTask
=
CHK_L
.
afterCancelTask
;
CHK
.
afterDeleteReport
=
CHK_L
.
afterDeleteReport
;
// 共通初期表示処理
CHK
.
initCommon
();
// リストの場合、フォーム表示を全画面表示とする
$
(
"#checkInput"
).
css
(
"width"
,
"calc(100% - 0px)"
);
if
(
CHK
.
isMobile
==
1
)
{
CHK_L
.
setMobileDisplay
();
}
var
urlParam
=
CHK
.
getUrlParameter
();
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
INSPECT
)
{
// 簡易帳票・改行改列の定期点検
if
(
isQRTableInspect
!=
0
)
{
$
(
"#editHeader"
).
hide
();
// 基本領域選択肢の作成
$
(
".addition_list"
).
empty
();
for
(
var
i
=
0
;
i
<
qrParentSelectData
.
length
;
i
+=
3
)
{
var
selectId
=
qrParentSelectData
;
var
listLi
=
$
(
"<li></li>"
,
{
id
:
"list_"
+
qrParentSelectData
[
i
],
class
:
"check"
});
var
taskInfo
=
$
(
"<div/>"
,
{
class
:
"taskInfoDiv"
});
var
codeAndExpiration
=
$
(
"<ul/>"
,
{
class
:
"codeAndExpiration"
});
codeAndExpiration
.
append
(
$
(
"<li/>"
,
{
class
:
"code"
}).
text
(
qrParentSelectData
[
i
+
1
]));
taskInfo
.
append
(
codeAndExpiration
);
taskInfo
.
append
(
$
(
"<p/>"
).
text
(
qrParentSelectData
[
i
+
2
]));
listLi
.
append
(
taskInfo
);
listLi
.
append
(
$
(
"<p/>"
,
{
"style"
:
"float: right; margin: auto; opacity: 0.2; font-size: 5em; width: 75px; text-align: right;"
}).
text
(
">"
));
listLi
.
css
(
"cursor"
,
"pointer"
);
listLi
.
on
(
"click"
,
function
()
{
qrSelectCID
=
$
(
this
).
attr
(
'id'
).
substr
(
5
);
$
(
"#editHeader"
).
show
();
$
(
".addition"
).
hide
();
$
(
"#checkListSearch"
).
empty
();
$
(
".updateInspect"
).
show
();
$
(
"#contentType"
).
text
(
getMsg
(
"inspectList"
));
$
(
".totalDivPoint"
).
text
(
getMsg
(
"inspect_totalDivPoint"
))
//作業報告ロード
if
(
CHK
.
isWeb
)
{
$
(
"#headerNav"
).
show
();
CHK_I
.
initInspectWeb
(
function
()
{
CHK_L
.
initInspect
();
});
$
(
".updateInspect"
).
attr
(
"onclick"
,
"CHK_L.updateInspectForWeb()"
);
}
else
{
CHK_I
.
initInspect
(
function
()
{
CHK_L
.
initInspect
();
});
}
});
$
(
".addition_list"
).
append
(
listLi
);
}
}
// 定期点検プロジェクト
else
{
$
(
"#editHeader"
).
show
();
$
(
".addition"
).
hide
();
$
(
"#checkListSearch"
).
empty
();
$
(
".updateInspect"
).
show
();
$
(
"#contentType"
).
text
(
getMsg
(
"inspectList"
));
$
(
".totalDivPoint"
).
text
(
getMsg
(
"inspect_totalDivPoint"
))
// $("#editHeader").hide();
//作業報告ロード
if
(
CHK
.
isWeb
)
{
$
(
"#headerNav"
).
show
();
CHK_I
.
initInspectWeb
(
function
()
{
CHK_L
.
initInspect
();
});
$
(
".updateInspect"
).
attr
(
"onclick"
,
"CHK_L.updateInspectForWeb()"
);
}
else
{
CHK_I
.
initInspect
(
function
()
{
CHK_L
.
initInspect
();
});
}
}
}
else
{
//通常プロジェクト
$
(
"#editHeader"
).
show
();
if
(
CHK
.
isWeb
)
{
$
(
"#headerNav"
).
show
();
}
//作業報告ロード
CHK
.
initReport
(
function
()
{
CHK_L
.
initReport
();
if
(
addReportFlg
==
CHK
.
ADD_REPORT_FLG
.
UNABLE
)
{
var
taskKey
=
CHK
.
taskReport
[
"taskReport_0"
].
length
>
0
?
CHK
.
taskReport
[
"taskReport_0"
][
0
].
taskKey
:
CHK
.
generateUuid
();
CHK
.
showReportForm
(
null
,
taskKey
);
}
// タスク追加権限がない場合、作業追加ボタンを隠す
if
(
CHK
.
hasAddTaskAuthority
())
{
$
(
".addition"
).
show
();
}
});
// 作業追加区分によって表示・非表示設定
if
(
addReportFlg
==
CHK
.
ADD_REPORT_FLG
.
UNABLE
)
{
$
(
"#editHeader"
).
hide
();
$
(
"#listValues"
).
hide
();
}
else
{
$
(
"#editHeader"
).
show
();
}
if
(
CHK
.
isWeb
)
{
$
(
"#headerNav"
).
show
();
}
}
if
(
CHK
.
isWeb
)
{
// OZDビューワのリサイズ処理
$
(
window
).
bind
(
"resize"
,
function
()
{
if
(
$
(
"#report_dialog"
).
is
(
":visible"
))
{
$
(
".noTitleDialog:visible"
).
width
(
"80%"
).
height
(
window
.
innerHeight
*
0.9
).
position
({
my
:
'center'
,
at
:
"center"
,
of
:
window
});
$
(
"#report_dialog"
).
height
(
$
(
".noTitleDialog:visible"
).
height
()
-
100
)
}
});
}
}
/**
* モバイルでの表示対応
*
*/
CHK_L
.
setMobileDisplay
=
function
()
{
$
(
"#editHeader"
).
css
(
"padding"
,
"10px"
);
$
(
"#editHeader"
).
height
(
"auto"
);
var
headerDiv
=
$
(
"<div/>"
,
{
class
:
"headerFormForMobile"
});
var
childDiv
=
$
(
"<div/>"
,
{
class
:
"childDiv"
});
if
(
$
(
"#editHeader"
).
width
()
<
300
)
{
var
secondChildDiv
=
$
(
"<div/>"
,
{
class
:
"childDiv"
});
childDiv
.
prepend
(
$
(
"#editHeader #listIcon"
),
$
(
"#editHeader #contentType"
).
width
(
"100%"
));
secondChildDiv
.
prepend
(
$
(
"#editHeader .totalDiv"
).
width
(
"100%"
),
$
(
"#editHeader button.addition"
).
width
(
"45%"
));
headerDiv
.
prependTo
(
$
(
"#editHeader"
));
headerDiv
.
prepend
(
childDiv
,
secondChildDiv
);
}
else
{
childDiv
.
prepend
(
$
(
"#editHeader"
).
children
());
headerDiv
.
prependTo
(
$
(
"#editHeader"
));
headerDiv
.
prepend
(
childDiv
);
$
(
"#contentType"
).
width
(
"auto"
);
}
$
(
".childDiv >button.addition"
).
text
(
getMsg
(
"Add"
));
$
(
".updateInspect"
).
text
(
getMsg
(
"Update"
));
$
(
"#checkListSearch"
).
appendTo
(
headerDiv
);
$
(
"#checkListSearch"
).
css
(
"margin-top"
,
"10px"
);
$
(
"#listValues"
).
height
(
"calc(100vh - 182px)"
);
$
(
".childDiv"
).
css
(
"justify-content"
,
"left"
);
}
/**
* 作業指示初期処理
*
*/
//CHK_L.initInstruct = function() {
// $("#instruct").show();
// CHK_L.updateList();
//}
/**
* 作業報告初期処理
*
*/
CHK_L
.
initReport
=
function
()
{
$
(
"#report"
).
show
();
CHK_L
.
updateList
();
}
/**
* 作業報告初期処理(定期点検)
*
*/
CHK_L
.
initInspect
=
function
()
{
CHK_L
.
updateInspect
();
}
/**
* リストを更新
*
*/
CHK_L
.
updateList
=
function
()
{
$
(
".addition_list"
).
empty
();
//シーケンスID順でソート
CHK
.
taskHotspot
.
hotspot
.
sort
(
function
(
a
,
b
)
{
if
(
Number
(
a
.
seqId
)
<
Number
(
b
.
seqId
))
return
-
1
;
if
(
Number
(
a
.
seqId
)
>
Number
(
b
.
seqId
))
return
1
;
return
0
;
});
// 検索文の英文字と数字を半角、小文字に設定
var
searchWord
=
CHK
.
kataToHira
(
CHK
.
fullwidthTohalfwidth
(
$
(
"#searchWord"
).
val
())).
toLowerCase
();
// 作業件数の初期化
var
count
=
0
;
// 登録されてある作業がない場合、文言を表示して処理を停止
if
(
CHK
.
taskHotspot
.
hotspot
.
length
==
0
)
{
$
(
"#noWork"
).
show
();
$
(
".totalDiv em"
).
text
(
count
);
return
;
}
else
{
$
(
"#noWork"
).
hide
();
}
// 作業の表示処理で、検索文がある場合作業名に検索文が含まれてある場合は作業件数に1を追加して表示、ない場合非表示にする
CHK
.
taskHotspot
.
hotspot
.
forEach
(
function
(
hotspot
)
{
count
+=
CHK_L
.
addTask
(
hotspot
.
taskKey
,
searchWord
);
});
$
(
".totalDiv em"
).
text
(
count
);
// 検索で表示作業がない場合、文言を表示する
if
(
count
==
0
)
{
$
(
"#nullValue"
).
show
();
}
else
{
$
(
"#nullValue"
).
hide
();
}
// style設定
if
(
!
CHK
.
isWeb
)
{
$
(
".codeAndExpiration .code"
).
css
(
"margin-bottom"
,
"10px"
);
$
(
".codeAndExpiration .period"
).
css
(
"font-size"
,
"13px"
);
$
(
".taskInfoDiv p"
).
css
(
"max-width"
,
$
(
".read"
).
width
()
+
"px"
);
}
}
CHK_L
.
goRelationContent
=
function
()
{
var
param
=
{};
param
.
cmd
=
CHK
.
getCommand
(
"goRelationContent"
);
CHK
.
sendABookCheckApi
(
param
);
}
/**
* 定期点検リストを更新
*
*/
CHK_L
.
updateInspect
=
function
()
{
$
(
".addition_list"
).
empty
();
$
(
".totalDiv em"
).
text
(
CHK
.
taskReport
.
taskReport_0
.
length
);
//作業開始日時順でソート
CHK
.
taskReport
[
"taskReport_0"
].
sort
(
function
(
a
,
b
)
{
if
(
CHK
.
isWeb
&&
isIE
())
{
a
.
reportStartDate
=
a
.
reportStartDate
.
replace
(
/-/g
,
'/'
);
b
.
reportStartDate
=
b
.
reportStartDate
.
replace
(
/-/g
,
'/'
);
}
var
aDate
=
new
Date
(
a
.
reportStartDate
);
var
bDate
=
new
Date
(
b
.
reportStartDate
);
if
(
Number
(
aDate
.
getTime
())
<
Number
(
bDate
.
getTime
()))
return
-
1
;
if
(
Number
(
aDate
.
getTime
())
>
Number
(
bDate
.
getTime
()))
return
1
;
return
0
;
});
//リスト作成
var
count
=
0
;
CHK
.
taskReport
[
"taskReport_0"
].
forEach
(
function
(
taskReport
,
idx
,
ar
)
{
var
taskKey
=
null
;
// 簡易帳票・改行改列時
if
(
qrSelectCID
>
0
)
{
// 選択したデータか確認
taskKey
=
qrTaskKeyList
[
qrSelectCID
];
// 削除が行われた直後は、taskReport 内の taskKey が消されているので、taskReportInfoId でチェックする
if
(
taskReport
.
taskReportInfo
.
length
<=
0
)
{
if
(
qrTaskReportInfoIdChoiceIdList
[
taskReport
.
taskReportInfoId
]
!=
qrSelectCID
)
{
return
}
}
// 通常は taskKey でチェック
else
{
if
(
taskReport
.
taskReportInfo
[
0
].
taskKey
!=
taskKey
)
{
return
;
}
}
// デフォルトの基本領域選択値の設定
CHK
.
taskReport
.
taskReportId
=
qrTaskReportIdList
[
qrSelectCID
];
}
var
now
=
new
Date
();
if
(
CHK
.
isWeb
&&
isIE
())
{
taskReport
.
reportStartDate
=
taskReport
.
reportStartDate
.
replace
(
/-/g
,
'/'
);
taskReport
.
reportEndDate
=
taskReport
.
reportEndDate
.
replace
(
/-/g
,
'/'
);
}
var
reportStartDate
=
new
Date
(
taskReport
.
reportStartDate
);
var
reportEndDate
=
new
Date
(
taskReport
.
reportEndDate
);
var
startDateStr
=
taskReport
.
reportStartDate
.
replace
(
/
\/
/g
,
""
).
replace
(
/:/g
,
""
).
replace
(
/ /
,
""
);
var
isReported
;
if
(
qrSelectCID
>
0
)
{
isReported
=
(
taskReport
.
taskReportInfo
&&
(
taskReport
.
taskReportInfo
.
length
>
0
)
&&
(
Object
.
keys
(
taskReport
.
taskReportInfo
[
0
].
task
).
length
>
0
));
}
else
{
isReported
=
taskReport
.
taskReportInfoId
||
taskReport
.
task
||
(
taskReport
.
taskReportInfo
&&
taskReport
.
taskReportInfo
.
length
>
0
);
}
var
listLi
=
$
(
"<li></li>"
,
{
id
:
"list_"
+
startDateStr
,
class
:
isReported
?
"check"
:
"read"
});
var
taskInfo
=
$
(
"<div/>"
,
{
class
:
"taskInfoDiv"
});
var
codeAndExpiration
=
$
(
"<ul/>"
,
{
class
:
"codeAndExpiration"
});
codeAndExpiration
.
append
(
$
(
"<li/>"
,
{
class
:
"code"
}).
text
(
getMsg
(
isReported
?
"inspect_check"
:
"inspect_read"
)));
// モバイルの場合、文字列を縦に分けて表示
if
(
CHK
.
isMobile
)
{
taskInfo
.
css
(
"width"
,
"100% - 100px)"
);
var
period
=
$
(
"<div/>"
).
text
(
getMsg
(
"Period"
)
+
":"
);
var
startDate
=
$
(
"<div/>"
).
text
(
CHK_I
.
getInspectDate
(
reportStartDate
));
var
tilde
=
$
(
"<div/>"
).
text
(
"~"
);
var
endDate
=
$
(
"<div/>"
).
text
(
CHK_I
.
getInspectDate
(
reportEndDate
));
codeAndExpiration
.
append
(
$
(
"<li/>"
,
{
class
:
"period"
}).
append
(
period
,
startDate
,
tilde
,
endDate
));
}
else
{
codeAndExpiration
.
append
(
$
(
"<li/>"
,
{
class
:
"period"
}).
text
(
getMsg
(
"Period"
)
+
":"
+
CHK_I
.
getInspectDate
(
reportStartDate
)
+
" ~ "
+
CHK_I
.
getInspectDate
(
reportEndDate
)));
}
taskInfo
.
append
(
codeAndExpiration
);
taskInfo
.
append
(
$
(
"<p/>"
));
taskInfo
.
append
(
$
(
"<p/>"
,
{
class
:
"workContent"
}));
listLi
.
append
(
taskInfo
);
if
(
taskKey
==
null
)
{
taskKey
=
CHK
.
taskHotspot
.
hotspot
[
0
].
taskKey
;
}
if
(
now
<
reportStartDate
)
{
//点検不可のため非表示
listLi
.
css
(
"cursor"
,
"default"
);
listLi
.
append
(
$
(
"<p/>"
,
{
"style"
:
"float: right; margin: auto; color: #e82e00; font-size: 3em; width: 200px; text-align: right;"
}).
text
(
getMsg
(
"unreportable"
)));
}
else
if
(
CHK_I
.
enableReport
(
taskReport
.
reportStartDate
,
taskReport
.
reportEndDate
,
isReported
,
taskReport
.
localSaveFlg
))
{
//作業報告
listLi
.
css
(
"cursor"
,
"pointer"
);
listLi
.
on
(
"click"
,
function
()
{
// 簡易帳票・改行改列時
if
(
qrSelectCID
>
0
)
{
// バックアップの作成
CHK_L
.
qrSelTaskKey
=
taskKey
;
CHK_L
.
qrSelTaskReportInfo
=
taskReport
.
taskReportInfo
;
}
if
(
CHK
.
isWeb
)
{
CHK_I
.
initInspectWeb
(
function
()
{
CHK_L
.
updateInspect
();
CHK_I
.
showTaskReportForm
(
taskReport
,
taskKey
,
isReported
);
});
}
else
{
CHK_I
.
showTaskReportForm
(
taskReport
,
taskKey
,
isReported
);
}
});
listLi
.
append
(
$
(
"<p/>"
,
{
"style"
:
"float: right; margin: auto; color: #00a200; font-size: 3em; width: 200px; text-align: right;"
}).
text
(
getMsg
(
"reportable"
)));
}
else
{
//報告内容
listLi
.
css
(
"cursor"
,
"pointer"
);
listLi
.
on
(
"click"
,
function
()
{
CHK_I
.
showTaskReportForm
(
taskReport
,
taskKey
,
isReported
);
});
listLi
.
append
(
$
(
"<p/>"
,
{
"style"
:
"float: right; margin: auto; color: #00a6e8; font-size: 3em; width: 200px; text-align: right;"
}).
text
(
getMsg
(
"reportReference"
)));
}
listLi
.
append
(
$
(
"<p/>"
,
{
"style"
:
"float: right; margin: auto; opacity: 0.2; font-size: 5em; width: 75px; text-align: right;"
}).
text
(
">"
));
$
(
".addition_list"
).
append
(
listLi
);
count
++
;
});
$
(
".totalDiv em"
).
text
(
count
);
}
/**
* タスクをリストに追加する
*
* @param taskKey タスクキー
* @param searchWord 検索文
*/
CHK_L
.
addTask
=
function
(
taskKey
,
searchWord
)
{
var
taskReport
=
CHK
.
getRecentVersionReport
(
taskKey
);
var
pointNo
=
CHK
.
getPointNo
(
taskReport
);
var
taskName
=
CHK
.
getTaskName
(
taskReport
);
// 検索文があり、対象作業名に検索文が含まれてない場合0を返して作業の追加・表示処理を停止
if
(
searchWord
&&
!
CHK
.
hasSearchWord
(
taskName
,
searchWord
))
return
0
;
var
listLi
=
$
(
"<li></li>"
,
{
id
:
"list_"
+
taskKey
,
class
:
CHK_L
.
getListClass
(
taskKey
)
});
var
taskInfo
=
$
(
"<div/>"
,
{
class
:
"taskInfoDiv"
});
var
codeAndExpiration
=
$
(
"<ul/>"
,
{
class
:
"codeAndExpiration"
});
codeAndExpiration
.
append
(
$
(
"<li/>"
,
{
class
:
"code"
}).
text
(
pointNo
));
taskInfo
.
append
(
codeAndExpiration
);
taskInfo
.
append
(
$
(
"<p/>"
).
text
(
taskName
));
listLi
.
append
(
taskInfo
);
listLi
.
append
(
$
(
"<p/>"
,
{
"style"
:
"float: right; margin: auto; opacity: 0.2; font-size: 5em; width: 75px; text-align: right;"
}).
text
(
">"
));
listLi
.
css
(
"cursor"
,
"pointer"
);
listLi
.
on
(
"click"
,
function
()
{
CHK
.
showReportForm
(
null
,
taskKey
);
});
$
(
".addition_list"
).
append
(
listLi
);
return
1
;
}
/**
* 作業登録フォームを表示
*
* @param taskKey taskKey
*/
CHK_L
.
addTaskReport
=
function
(
taskKey
)
{
if
(
!
taskKey
)
taskKey
=
CHK
.
generateUuid
();
CHK
.
showReportForm
(
null
,
taskKey
);
}
/**
* 保存処理時のホットスポット情報を取得
*
* @param param 入力パラメータ
*/
CHK_L
.
getSaveHotspotParam
=
function
(
param
)
{
var
newHotspot
=
""
;
// 登録・修正
if
(
param
.
mode
==
"0"
)
{
newHotspot
=
{
sceneId
:
""
,
seqId
:
param
.
seqId
,
taskKey
:
param
.
taskKey
,
name
:
""
,
ath
:
""
,
atv
:
""
,
x
:
""
,
y
:
""
};
if
(
CHK
.
debug
==
"1"
)
CHK
.
taskHotspot
.
hotspot
.
push
(
newHotspot
);
//DEBUG
}
else
{
newHotspot
=
CHK
.
getTaskHotspot
(
param
.
name
,
param
.
taskKey
);
}
return
newHotspot
;
}
/**
* 作業報告更新後の処理
*
* @param taskKey taskKey
*/
CHK_L
.
afterUpdateReport
=
function
(
taskKey
,
isLocalSave
)
{
// 定期点検
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
INSPECT
)
{
CHK_L
.
updateInspect
();
}
else
{
CHK_L
.
updateList
();
if
(
taskKey
)
{
$
(
"#list_"
+
taskKey
).
attr
(
"class"
,
CHK_L
.
getListClass
(
taskKey
));
}
}
if
(
!
isLocalSave
)
CHK
.
hideReportForm
();
}
/**
* 作業指示・報告キャンセル後の処理
*
* @param taskKey taskKey
*/
CHK_L
.
afterCancelTask
=
function
(
taskKey
)
{
if
(
CHK
.
changeReportFlg
&&
taskKey
)
{
CHK
.
showReportForm
(
null
,
taskKey
,
null
,
CHK
.
taskReplyNo
);
}
else
{
CHK
.
hideReportForm
();
}
}
/**
* 作業報告削除後の処理
*
* @param taskKey taskKey
*/
CHK_L
.
afterDeleteReport
=
function
(
taskKey
,
json
)
{
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
INSPECT
)
{
if
(
CHK
.
isWeb
)
{
CHK_L
.
updateInspectForWeb
();
}
else
{
CHK_I
.
initInspect
(
function
()
{
CHK_L
.
updateInspect
();
});
}
}
else
{
// 指示報告の削除対応
if
(
CHK
.
taskReplyNo
==
CHK
.
BASE_TASK_REPLY_NO
)
{
var
callback
=
function
()
{
CHK_L
.
afterUpdateReport
();
};
if
(
CHK
.
debug
!=
"1"
&&
CHK
.
isWeb
)
{
CHK
.
updateReportJsonWeb
(
json
,
callback
);
}
else
{
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskHotspot
,
function
(
jsonData
)
{
CHK
.
taskHotspot
=
jsonData
;
callback
();
});
}
}
else
{
$
(
"#list_"
+
taskKey
).
attr
(
"class"
,
CHK_L
.
getListClass
(
taskKey
));
}
}
CHK
.
hideReportForm
();
}
/**
* リストのスタイルを取得
*
* @param taskKey taskKey
*/
CHK_L
.
getListClass
=
function
(
taskKey
)
{
var
ret
;
var
progress
=
CHK
.
getTaskProgress
(
null
,
taskKey
);
// 作業状況別の表示
if
(
progress
==
"999"
)
{
ret
=
"check"
;
}
else
{
ret
=
"read"
;
}
return
ret
;
}
/**
* ウェブ版の場合、アップデートでサーバから最新の情報を取得
*
*/
CHK_L
.
updateInspectForWeb
=
function
()
{
CHK_I
.
initInspectWeb
(
function
()
{
CHK_L
.
updateInspect
();
})
}
\ No newline at end of file
app/script/check.js
0 → 100644
View file @
ac8179c3
// 名前空間
var
CHK
=
{};
CHK
.
operationType
;
//プロジェクトタイプ 0:リストコンテンツ 1:図面コンテンツ 2:360コンテンツ 3:PDFコンテンツ
CHK
.
isCms
=
false
;
//true:CMSモード
CHK
.
isWeb
=
false
;
//true:Web表示モード
CHK
.
reportMode
=
"1"
;
//報告モード default1で、定期点検で変更される
CHK
.
debug
;
//1:デバッグモード
CHK
.
isMobile
;
//1:モバイル対応で表示
CHK
.
reportType
;
//0:報告(Type1) 1:定期点検(Type2) 2:報告・回答(Type3) 3:複数工程(Type4)
CHK
.
useKrpano
=
true
;
//true:krpanoを使用 false:krpanoを使用しない
CHK
.
lookHotspot
;
//移動先ホットスポット保持用
CHK
.
saveAttachedDataUrl
;
//添付ファイルBase64文字列保持
CHK
.
content
;
//コンテンツJSON
CHK
.
taskHotspot
;
//ホットスポットJSON
CHK
.
taskReport
;
//作業報告JSON
CHK
.
workingGroup
;
//作業者グループマスタJSON
CHK
.
taskReportSuggest
;
//作業報告入力補完JSON
CHK
.
taskReportQuestion
;
//作業報告設問情報JSON
CHK
.
routineTask
;
//定期点検情報JSON
CHK
.
setBigFontFlg
;
//レポートフォント表示サイズを保存
CHK
.
taskTapMode
=
1
;
//タスク移動・報告モード 0:移動 1:報告(デフォルト)
CHK
.
appRelationVer
=
1
;
//アプリとの連携で行われた修正のバージョン
//絞り検索追加
CHK
.
questionApertureList
;
//絞り検索グループ
CHK
.
groupTreeInfo
;
//担当グループ参照用 ログインユーザーが所属しているグループ情報
CHK
.
operationGroup
;
//担当グループ参照用 作業の報告担当グループ情報
// PDFプロジェクト対応
CHK
.
pdf_numPages
;
CHK
.
pdf_pageNum
;
CHK
.
deleteName
;
//削除ホットスポット名保持用
CHK
.
reportBasePath
=
"./"
;
// レポートデータのベースパス
//JSONファイルパス
CHK
.
jsonPath
=
{
content
:
"content.json"
,
//コンテンツ
taskHotspot
:
"taskHotspot.json"
,
//ホットスポット
taskReport
:
"taskReport.json"
,
//作業報告
workingGroup
:
"workingGroup.json"
,
//作業者入力マスタ
taskReportSuggest
:
"taskReportSuggest.json"
,
//作業報告入力補完
taskReportQuestion
:
"taskReportQuestion.json"
,
//作業報告設問情報
routineTask
:
"routineTask.json"
,
//定期点検情報
operationGroup
:
"operationGroup.json"
,
//作業報告担当グループ
processInfo
:
"processInfo.json"
,
//連続作業情報
phaseInfo
:
"phaseInfo.json"
,
//連続作業工程情報
phaseStatus
:
"phaseStatus.json"
//連続作業工程状況
};
//アプリ送信用コマンド
CHK
.
apiCmd
=
{
goRelationContent
:
"goRelationContent"
,
//関連資料
editAttached
:
"editAttached"
,
//添付ファイル編集
saveAttached
:
"saveAttached"
,
//添付ファイル保存
insertReport
:
"insertTaskReport"
,
//作業報告保存
updateReport
:
"updateTaskReport"
,
//作業報告更新
moveHotspot
:
"moveHotspot"
,
//ホットスポット移動
cancelReport
:
"cancelTaskReport"
,
//作業報告キャンセル
deleteReport
:
"deleteTaskReport"
,
//作業報告削除
showReportOzd
:
"showReportOzd"
,
//作業報告レポート表示
previewReportOzd
:
"previewReportOzd"
,
//作業報告ozdプレビュー
getGpsInfo
:
"getGpsInfo"
,
//GPS取得
changeDisplayStatus
:
"changeDisplayStatus"
,
//コンテンツ表示変更(ヘルプ表示用)
showRelatedContent
:
"showRelatedContent"
,
//関連資料表示
localSave
:
"localSaveTaskReport"
,
//ローカル保存
changeReport
:
"changeTaskReport"
,
//報告レポート変更
getGroupTreeInfo
:
"getGroupTreeInfo"
,
//担当グループ参照用 ログインユーザーが所属しているグループ取得
deleteProcess
:
"deleteProcess"
};
//CMS送信用コマンド
CHK
.
actCmd
=
{
editAttached
:
"editAttached"
,
//添付ファイル編集
getTaskReport
:
"getTaskReport"
,
//初期情報取得(作業報告)
saveAttached
:
"saveAttached"
,
//添付ファイル保存
insertReport
:
"actTaskReport"
,
//作業報告保存
updateReport
:
"actTaskReport"
,
//作業報告更新
saveRoutineTaskReport
:
"actRoutineTaskReport"
,
//点検作業報告保存・更新
moveHotspot
:
"actTaskReport"
,
//ホットスポット移動
cancelReport
:
"cancelTaskReport"
,
//作業報告キャンセル
deleteReport
:
"actTaskReport"
,
//作業報告削除
deleteRoutineTaskReport
:
"actRoutineTaskReport"
,
//点検作業報告保存・更新
};
// レポートファイル保存タイプ
CHK
.
REPORT_SAVE_TYPE
=
{
OZD
:
"0"
,
PDF
:
"1"
,
HTML
:
"2"
,
JPG
:
"3"
};
// OZDビューアポストメッセージ送信用コマンド
CHK
.
ozdCmd
=
{
ozdSave
:
"ozdSave"
,
ozdClear
:
"ozdClear"
,
ozdOpened
:
"ozdOpened"
,
close
:
"close"
,
fixed
:
"fixed"
,
unfixed
:
"unfixed"
};
//プロジェクトタイプ
CHK
.
OPERATION_TYPE
=
{
LIST
:
"0"
,
DRAWING
:
"1"
,
VTOUR
:
"2"
,
PDF
:
"3"
};
// 表示状態
CHK
.
DISPLAY_STATUS
=
{
init
:
"0"
,
//初期表示
showingForm
:
"1"
,
//報告入力
previewing
:
"2"
,
//報告プレビュー
showingList
:
"3"
//作業一覧
};
//プロジェクト報告タイプ
CHK
.
REPORT_TYPE
=
{
REPORTONLY
:
"0"
,
//報告のみ
INSPECT
:
"1"
,
//定期点検
WITHREPLY
:
"2"
,
//報告・回答(チェーン)
WORKFLOW
:
"3"
//複数工程(ワークフロー)
}
// タスクレポート追加区分
CHK
.
ADD_REPORT_FLG
=
{
UNABLE
:
"0"
,
ABLE
:
"1"
}
// 一時保存区分
CHK
.
LOCAL_SAVE_FLG
=
{
UNABLE
:
"0"
,
ABLE
:
"1"
}
// 権限区分
CHK
.
HAS_AUTHORITY
=
{
FALSE
:
"0"
,
TRUE
:
"1"
}
/**
* タップモード
*
*/
CHK
.
TAP_MODE
=
{
MOVE
:
0
,
//移動
SHOW
:
1
//報告
}
// 表示・情報取得の基準となるタスクのベースチェーンNo(0)
CHK
.
BASE_TASK_REPLY_NO
=
0
;
//タイプに関係なく、基準となる報告のreplyNo
//タスク回答番号保存用
CHK
.
taskReplyNo
=
CHK
.
BASE_TASK_REPLY_NO
;
// タスクレポート追加可能ユーザか判定
CHK
.
hasAddTaskAuthority
=
function
()
{
// 追加されたタスクレポートがまだ存在しない、もしくはチェーンNoが0のタスクに権限がある場合タスク追加できるユーザだと判定する
return
CHK
.
reportType
!=
CHK
.
REPORT_TYPE
.
WITHREPLY
||
CHK
.
taskReport
.
taskReport_0
.
length
==
0
||
CHK
.
taskReport
.
taskReport_0
.
some
(
function
(
taskReport
,
i
)
{
if
(
taskReport
.
hasAuthority
==
CHK
.
HAS_AUTHORITY
.
TRUE
)
return
true
;
});
};
// 共通初期処理
CHK
.
initCommon
=
function
()
{
//JSON初期化
//作業報告情報初期化
CHK
.
taskReport
=
{
taskReport_0
:
[]};
//作業報告入力補完初期化
CHK
.
taskReportSuggest
=
{
taskReportSuggest_0
:
[]};
//ホットスポット情報初期化
CHK
.
taskHotspot
=
{
hotspot
:
[]};
var
urlParam
=
CHK
.
getUrlParameter
();
CHK
.
reportType
=
urlParam
.
report_type
;
CHK
.
isCms
=
urlParam
.
is_cms
;
CHK
.
isWeb
=
urlParam
.
is_web
;
CHK
.
isWindows
=
urlParam
.
app
&&
urlParam
.
app
==
"windows"
;
// windowsアプリの対応追加 v1.1.0
// ウェブの場合、作業一覧の表示広さを変更
if
(
CHK
.
isWeb
)
{
$
(
"#checkList"
).
addClass
(
"web"
);
}
CHK
.
debug
=
urlParam
.
debug
;
CHK
.
isMobile
=
urlParam
.
mobile_flg
&&
urlParam
.
mobile_flg
==
"1"
;
if
(
CHK
.
isCms
)
{
CHK
.
setBeforeunload
();
}
if
(
CHK
.
isMobile
!=
1
)
{
if
(
CHK
.
isFullScreen
())
CHK
.
isMobile
=
1
;
}
// モバイルまたはリストの場合、フォーム・作業リストを全画面表示
// 以外の場合、min-widthを400pxとして表示する
if
(
CHK
.
isMobile
==
1
||
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
LIST
)
{
$
(
"#checkInput"
).
css
(
"width"
,
"calc(100% - 0px)"
);
$
(
"#checkList"
).
css
(
"width"
,
"calc(100% - 2px)"
);
}
else
{
$
(
"#checkInput"
).
css
(
"min-width"
,
"400px"
);
$
(
"#checkList"
).
css
(
"min-width"
,
"400px"
);
}
}
/**
* 初期処理
*
*/
CHK
.
init
=
function
()
{
//共通処理
CHK
.
initCommon
();
//VR設定
krpano
.
call
(
"set(content[def].useVr, false);"
);
if
(
!
CHK
.
operationType
)
CHK
.
operationType
=
CHK
.
OPERATION_TYPE
.
VTOUR
;
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
VTOUR
)
{
//360
CHK_V
.
init
();
$
(
"#sceneName"
).
text
(
krpano
.
get
(
"scene[get(xml.scene)].title"
));
if
(
$
(
"#topnav"
).
length
>
0
)
{
$
(
"#sceneName"
).
css
(
"margin"
,
"45px 10px"
);
}
}
else
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
DRAWING
)
{
//図面
CHK_Z
.
init
();
$
(
"#sceneName"
).
hide
();
}
// 表示状態変更通知
CHK
.
sendDisplayStatus
(
$
(
"#checkList"
).
is
(
':visible'
)?
CHK
.
DISPLAY_STATUS
.
showingList
:
CHK
.
DISPLAY_STATUS
.
init
);
$
(
window
).
bind
(
"resize"
,
function
()
{
if
(
krpano
.
get
(
"isOpen"
)
==
"1"
)
{
krpano
.
call
(
"toggleAllTaskLayerOnMap()"
);
setTimeout
(
function
()
{
krpano
.
call
(
"update_scale()"
);
krpano
.
call
(
"delayedcall(0.5, toggleAllTaskLayerOnMap();)"
);
},
1000
);
}
$
(
".ui-dialog"
).
css
(
"top"
,
"calc(50%)"
);
});
if
(
CHK
.
isWeb
)
{
// OZDビューワのリサイズ処理
$
(
window
).
bind
(
"resize"
,
function
()
{
if
(
$
(
"#report_dialog"
).
is
(
":visible"
))
{
$
(
".noTitleDialog:visible"
).
width
(
"80%"
).
height
(
window
.
innerHeight
*
0.9
).
position
({
my
:
'center'
,
at
:
"center"
,
of
:
window
});
$
(
"#report_dialog"
).
height
(
$
(
".noTitleDialog:visible"
).
height
()
-
100
);
}
});
}
}
/**
* 全画面判定
*
*/
CHK
.
isFullScreen
=
function
()
{
if
(
CHK
.
isWeb
)
return
false
;
var
minSize
=
550
;
console
.
log
(
"innerWidth:"
+
window
.
innerWidth
);
console
.
log
(
"innerHeight:"
+
window
.
innerHeight
);
return
window
.
innerWidth
<
minSize
||
window
.
innerHeight
<
minSize
;
}
/**
* 作業報告初期処理
*
* @param callback コールバック
*/
CHK
.
initReport
=
function
(
callback
)
{
console
.
log
(
"initReport start"
);
if
(
!
CHK
.
reportMode
)
{
//報告モード切り替えボタンを表示
$
(
"#editHeader"
).
show
();
CHK
.
changeReportMode
(
"1"
);
}
if
(
CHK
.
isWeb
)
{
CHK
.
initReportWeb
(
callback
);
}
else
{
CHK
.
initReportApp
(
callback
);
}
}
/**
* 作業報告初期処理、アプリ
*
* @param callback コールバック
*/
CHK
.
initReportApp
=
function
(
callback
)
{
//作業報告情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskReport
,
function
(
taskReport
)
{
CHK
.
taskReport
=
taskReport
;
//ホットスポット情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskHotspot
,
function
(
jsonData
)
{
CHK
.
taskHotspot
=
jsonData
;
callback
();
});
});
//作業者グループマスタをロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
workingGroup
,
function
(
workingGroup
)
{
CHK
.
workingGroup
=
workingGroup
;
});
//コンテンツ情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
content
,
function
(
content
)
{
CHK
.
content
=
content
;
//絞り検索グループ情報をロード
CHK
.
loadJson
(
CHK
.
content
.
masterPath
,
function
(
questionAperture
)
{
CHK
.
questionApertureList
=
questionAperture
;
});
});
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskReportSuggest
,
function
(
taskReportSuggest
)
{
CHK
.
taskReportSuggest
=
taskReportSuggest
;
});
//作業報告設問情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskReportQuestion
,
function
(
taskReportQuestion
)
{
CHK
.
taskReportQuestion
=
taskReportQuestion
;
});
//担当グループ参照情報の取得
CHK
.
sendABookCheckApi
({
cmd
:
CHK
.
apiCmd
.
getGroupTreeInfo
},
null
);
//作業報告担当グループ情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
operationGroup
,
function
(
operationGroup
)
{
CHK
.
operationGroup
=
operationGroup
;
});
}
/**
* 作業報告初期処理、Web
*
* @param callback コールバック
*/
CHK
.
initReportWeb
=
function
(
callback
)
{
CHK
.
cmsAjax
(
CHK
.
getActionUrl
(
CHK
.
actCmd
.
getTaskReport
),
""
,
function
(
json
)
{
CHK
.
updateReportJsonWeb
(
json
,
callback
);
});
}
/**
* 作業報告「登録、更新、削除」の後、json更新
*
* @param json CMSから貰った物
* @param callback コールバック
*/
CHK
.
updateReportJsonWeb
=
function
(
json
,
callback
)
{
console
.
log
(
json
);
//JSON初期化
CHK
.
taskReport
=
{
taskReport_0
:
[]};
// オペレーションタイプが報告・回答の場合、念のためtaskReport_1のオブジェクトを作成しておく
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
WITHREPLY
)
{
CHK
.
taskReport
.
taskReport_1
=
[];
}
CHK
.
taskReportSuggest
=
{
taskReportSuggest_0
:
{}};
CHK
.
taskHotspot
=
{
hotspot
:
[]};
CHK
.
workingGroup
=
{
taskGroup_0
:
[]};
json
.
taskReport_0
.
forEach
(
function
(
task
)
{
task
.
taskHotspotInfo
.
taskId
=
task
.
taskId
;
//ホットスポット情報をロード
CHK
.
taskHotspot
.
hotspot
.
push
(
task
.
taskHotspotInfo
);
//作業報告情報をロード
if
(
task
.
taskReportInfo
)
{
task
.
taskReportInfo
.
hasAuthority
=
task
.
hasAuthority
;
CHK
.
taskReport
.
taskReport_0
.
push
(
task
.
taskReportInfo
);
}
});
json
.
taskReport_1
.
forEach
(
function
(
task
)
{
task
.
taskHotspotInfo
.
taskId
=
task
.
taskId
;
//作業報告情報をロード
if
(
task
.
taskReportInfo
)
{
task
.
taskReportInfo
.
hasAuthority
=
task
.
hasAuthority
;
CHK
.
taskReport
.
taskReport_1
.
push
(
task
.
taskReportInfo
);
}
});
//絞り検索
if
(
CHK
.
questionApertureList
==
null
){
CHK
.
questionApertureList
=
json
.
apertureMaster
;
}
if
(
callback
)
callback
();
//作業者グループマスタをロード
json
.
workingGroup
.
taskGroup_0
.
forEach
(
function
(
workingGroup
)
{
CHK
.
workingGroup
.
taskGroup_0
.
push
(
workingGroup
)
});
//作業報告入力補完情報をロード
CHK
.
taskReportSuggest
=
json
.
taskReportSuggest
;
//作業報告設問情報をロード
CHK
.
taskReportQuestion
=
json
.
taskReportQuestion
;
//コンテンツ情報をロード
CHK
.
content
=
json
.
content
;
}
/**
* JSONファイルをロード
*
* @param fileName JSONファイル名
* @param callback コールバック
*/
CHK
.
loadJson
=
function
(
fileName
,
callback
)
{
//キャッシュ対応
fileName
=
fileName
+
"?"
+
new
Date
().
getTime
().
toString
(
16
);
$
.
getJSON
(
fileName
,
function
(
json
)
{
console
.
log
(
"load json file"
,
fileName
,
json
);
callback
(
json
);
}).
error
(
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
console
.
log
(
"エラー:"
+
textStatus
);
console
.
log
(
"テキスト:"
+
jqXHR
.
responseText
);
});
}
/**
* JSONファイルを再ロード
*
* @param fileName JSONファイル名
*/
CHK
.
reloadJson
=
function
(
fileName
)
{
CHK
.
loadJson
(
fileName
,
function
(
json
)
{
for
(
var
key
in
CHK
.
jsonPath
)
{
if
(
CHK
.
jsonPath
[
key
]
==
fileName
)
{
CHK
[
key
]
=
json
;
}
}
});
}
/**
* ダイアログを表示
*
* @param message 表示メッセージ
* @param ok OKボタン押下時の処理
* @param cancel キャンセルボタン押下時の処理
* @param isError true:エラーダイアログ
*/
CHK
.
showDialog
=
function
(
message
,
ok
,
cancel
,
isError
,
callback
)
{
// メッセージがなく、ok時の処理があるとok処理を実行し、その以外は何もせずに処理を止める(ダイアログ表示しない)
if
(
!
message
)
{
if
(
ok
)
ok
();
else
CHK
.
closeLoading
();
return
;
}
var
okButton
=
{
text
:
"OK"
,
class
:
"dialog_okButton"
,
click
:
function
()
{
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
)
$
(
"body"
).
css
(
"overflow"
,
"visible"
);
// スクロール制御
if
(
ok
)
ok
();
$
(
"#check_dialog"
).
dialog
(
'close'
);
}
}
var
buttons
=
{
OK
:
okButton
};
if
(
!
isError
)
{
buttons
[
getMsg
(
"cancel"
)]
=
{
text
:
getMsg
(
"cancel"
),
class
:
"dialog_cancelButton"
,
click
:
function
()
{
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
)
$
(
"body"
).
css
(
"overflow"
,
"visible"
);
// スクロール制御
if
(
cancel
)
cancel
();
$
(
"#check_dialog"
).
dialog
(
'close'
);
}
};
}
$
(
"#check_dialog"
).
dialog
({
dialogClass
:
'noTitleDialog ui-dialog-titlebar dialogNoBorder'
,
autoOpen
:
false
,
resizable
:
false
,
modal
:
true
,
width
:
CHK
.
isMobile
==
1
?
"90%"
:
"auto"
,
height
:
'auto'
,
title
:
' '
,
buttons
:
buttons
,
open
:
function
(
e
)
{
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
)
$
(
"body"
).
css
(
"overflow"
,
"hidden"
);
// スクロール制御
$
(
e
.
target
).
parent
().
css
(
'background-color'
,
'rgba(128,128,128)'
);
$
(
e
.
target
).
parent
().
css
(
'position'
,
'absolute'
);
$
(
e
.
target
).
parent
().
css
(
'top'
,
'calc(50% + '
+
$
(
document
).
scrollTop
()
+
'px)'
);
$
(
e
.
target
).
parent
().
css
(
'left'
,
'calc(50% + '
+
$
(
document
).
scrollLeft
()
+
'px)'
);
$
(
e
.
target
).
parent
().
css
(
'transform'
,
'translateY(-50%) translateX(-50%)'
);
$
(
e
.
target
).
parent
().
css
(
'-webkit- transform'
,
'translateY(-50%) translateX(-50%)'
);
$
(
e
.
target
).
parent
().
children
(
".ui-dialog-buttonpane"
).
css
(
'background-color'
,
'rgba(128,128,128)'
).
css
(
'border'
,
'none'
);
$
(
"#checkDialogMessage"
).
html
(
message
);
if
(
callback
)
callback
();
},
close
:
function
()
{}
});
$
(
"#check_dialog"
).
dialog
(
'open'
);
}
/**
* ローディングを表示
*
* @param message 表示メッセージ
*/
CHK
.
showLoading
=
function
(
message
)
{
$
(
"#check_loading"
).
dialog
({
dialogClass
:
'noTitleDialog ui-dialog-titlebar dialogNoBorder'
,
autoOpen
:
false
,
resizable
:
false
,
modal
:
true
,
width
:
"40%"
,
height
:
'auto'
,
title
:
' '
,
open
:
function
(
e
)
{
$
(
e
.
target
).
parent
().
css
(
'background-color'
,
'rgba(128,128,128)'
);
$
(
e
.
target
).
parent
().
css
(
'position'
,
'absolute'
);
$
(
e
.
target
).
parent
().
css
(
'top'
,
'50%'
);
$
(
e
.
target
).
parent
().
css
(
'left'
,
'50%'
);
$
(
e
.
target
).
parent
().
css
(
'transform'
,
'translateY(-50%) translateX(-50%)'
);
$
(
e
.
target
).
parent
().
css
(
'-webkit- transform'
,
'translateY(-50%) translateX(-50%)'
);
$
(
e
.
target
).
parent
().
children
(
".ui-dialog-buttonpane"
).
css
(
'background-color'
,
'rgba(128,128,128)'
).
css
(
'border'
,
'none'
);
$
(
"#checkLoadingMessage"
).
html
(
message
);
},
close
:
function
()
{}
});
$
(
"#check_loading"
).
dialog
(
'open'
);
}
/**
* ローディングを閉じる
*
*/
CHK
.
closeLoading
=
function
()
{
if
(
$
(
"#check_loading"
).
hasClass
(
"ui-dialog-content"
))
{
$
(
"#check_loading"
).
dialog
(
'close'
);
}
}
/**
* 作業報告フォームを表示
*
* @param name ホットスポット名
* @param taskKey taskKey
* @param lookto true:視点移動する
*/
CHK
.
showTaskReportForm
=
function
(
name
,
taskKey
,
lookto
,
element
)
{
// ウェブでの対応
if
(
CHK
.
isWeb
)
{
var
formType
=
CHK
.
taskReplyNo
==
CHK
.
BASE_TASK_REPLY_NO
?
"instruct"
:
"report"
;
element
.
setAttribute
(
"src"
,
CHK
.
getShopUrl
()
+
"enqueteReply/"
+
formType
+
"/"
+
operationId
+
"/"
+
CHK
.
getTaskId
(
name
,
taskKey
));
$
(
"#checkInput"
).
css
(
"top"
,
"36px"
);
$
(
"#checkInput"
).
css
(
"height"
,
"calc(100% - 36px)"
);
}
element
.
setAttribute
(
"frameborder"
,
"0"
);
element
.
width
=
"100%"
;
element
.
height
=
"100%"
;
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
LIST
)
{
$
(
"#checkInput"
).
css
(
"border"
,
"none"
);
}
$
(
"#checkInput"
).
css
(
"opacity"
,
"0"
);
CHK
.
showCheckInput
(
element
,
taskKey
);
if
(
lookto
)
{
var
fov
=
krpano
.
get
(
"view.fov"
);
krpano
.
call
(
"looktohotspot("
+
name
+
","
+
fov
+
")"
);
}
element
.
onload
=
function
()
{
// 連続作業の場合申し送り部、承認部の生成
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
WORKFLOW
)
{
element
.
contentWindow
.
createProcessParts
();
}
var
taskReport
=
CHK
.
getTaskReport
(
name
,
taskKey
);
var
isPreview
=
false
;
// 既存報告情報があるか確認
if
(
taskReport
&&
taskReport
.
task
)
{
var
baseReport
=
CHK
.
getRecentVersionReport
(
taskKey
);
var
param
=
{
name
:
name
,
taskKey
:
taskKey
,
pointNo
:
CHK
.
getPointNo
(
baseReport
),
taskProgress
:
CHK
.
getTaskProgress
(
name
,
taskKey
),
taskName
:
CHK
.
getTaskName
(
baseReport
),
mode
:
"1"
,
attachedChangeFlag
:
"0"
};
var
replyReportList
;
var
createTaskBtnFlg
;
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
WITHREPLY
)
{
replyReportList
=
CHK
.
getTaskReplyReportList
(
taskKey
);
if
(
replyReportList
.
length
||
CHK
.
taskReplyNo
!=
CHK
.
BASE_TASK_REPLY_NO
)
createTaskBtnFlg
=
true
;
}
// 報告権限がある場合は報告画面を、ない場合はプレビュー画面を表示する
// Type1の場合はプレビューなし
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
WITHREPLY
&&
(
taskReport
.
hasAuthority
==
CHK
.
HAS_AUTHORITY
.
FALSE
||
(
CHK
.
isCms
&&
CHK
.
taskReplyNo
!=
CHK
.
BASE_TASK_REPLY_NO
)))
{
var
reportMode
=
CHK
.
reportMode
==
"1"
?
0
:
1
;
isPreview
=
true
;
element
.
contentWindow
.
createPreview
(
taskReport
,
CHK
.
taskReportQuestion
,
CHK
.
workingGroup
,
CHK
.
content
,
reportMode
,
replyReportList
,
param
);
if
(
createTaskBtnFlg
)
element
.
contentWindow
.
createTaskButton
(
name
,
taskKey
,
true
);
CHK
.
sendDisplayStatus
(
CHK
.
DISPLAY_STATUS
.
previewing
,
taskKey
);
}
else
{
element
.
contentWindow
.
setCheckInitData
(
taskReport
,
CHK
.
taskReportQuestion
,
CHK
.
content
,
CHK
.
taskReportSuggest
,
param
,
replyReportList
);
if
(
createTaskBtnFlg
)
element
.
contentWindow
.
createTaskButton
(
name
,
taskKey
);
CHK
.
sendDisplayStatus
(
CHK
.
DISPLAY_STATUS
.
showingForm
,
taskKey
);
}
//絞り検索追加: 初期化
element
.
contentWindow
.
initSavedApertureSelectBox
();
}
else
{
var
param
=
{
name
:
name
,
taskKey
:
taskKey
,
seqId
:
CHK
.
getNextSeqId
(),
mode
:
"0"
,
attachedChangeFlag
:
"0"
};
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
WITHREPLY
&&
CHK
.
taskReplyNo
!=
CHK
.
BASE_TASK_REPLY_NO
)
{
var
baseReport
=
CHK
.
getRecentVersionReport
(
taskKey
);
param
.
pointNo
=
CHK
.
getPointNo
(
baseReport
);
param
.
taskName
=
CHK
.
getTaskName
(
baseReport
);
param
.
taskProgress
=
CHK
.
getTaskProgress
(
name
,
taskKey
);
element
.
contentWindow
.
createTaskButton
(
name
,
taskKey
);
}
element
.
contentWindow
.
setCheckInitData
(
taskReport
,
CHK
.
taskReportQuestion
,
CHK
.
content
,
CHK
.
taskReportSuggest
,
param
);
CHK
.
sendDisplayStatus
(
CHK
.
DISPLAY_STATUS
.
showingForm
,
taskKey
);
//絞り検索追加: 初期化
element
.
contentWindow
.
initApertureSelectBox
();
}
//端末別に上段バーの選択
if
(
CHK
.
isMobile
||
CHK
.
operationType
!=
CHK
.
OPERATION_TYPE
.
LIST
)
{
element
.
contentWindow
.
createDoubleHeader
(
isPreview
);
}
else
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
WORKFLOW
)
{
//連続作業ならタブ表示
element
.
contentWindow
.
initTab
(
false
);
}
element
.
contentWindow
.
changeFontSize
(
CHK
.
setBigFontFlg
);
}
}
/**
* iOS不具合対策
* 報告フォームを一瞬再描画する
* アプリとの連携で問題があったため、hide->showからheightの変更に修正
*
*/
CHK
.
delayReportFormInit
=
function
(
closeLoading
)
{
$
(
"#checkInput"
).
css
(
"opacity"
,
"0"
);
$
(
"#checkInput"
).
height
(
0
);
$
(
"#checkInput [id^='reportForm']"
).
height
(
0
);
setTimeout
(
function
()
{
var
checkInputHeight
=
CHK
.
isWeb
?
"calc(100% - 36px)"
:
"100%"
;
$
(
"#checkInput"
).
height
(
checkInputHeight
);
// フォーム表示非表示設定
if
(
closeLoading
)
{
$
(
"#checkInput [id^='reportForm']"
).
each
(
function
()
{
// 現在表示対象フォーム以外の高さを0に設定(リダイレクトの場合は常に100%)
var
reportFormDoc
=
this
.
contentWindow
.
document
;
if
(
this
.
id
==
"reportForm"
+
CHK
.
taskReplyNo
||
this
.
id
==
"reportForm"
)
{
$
(
"body"
,
reportFormDoc
).
show
();
// IPAD対応
$
(
this
).
height
(
"100%"
);
$
(
"#checkInput"
).
css
(
"opacity"
,
"1"
);
$
(
".content"
,
reportFormDoc
).
css
(
"overflow"
,
"hidden"
);
$
(
".content"
,
reportFormDoc
).
css
(
"-webkit-overflow-scrolling"
,
"none"
);
setTimeout
(
function
()
{
$
(
".content"
,
reportFormDoc
).
css
(
"overflow"
,
"auto"
);
$
(
".content"
,
reportFormDoc
).
css
(
"-webkit-overflow-scrolling"
,
"touch"
);
$
(
"#whiteFrame"
).
hide
();
CHK
.
closeLoading
();
},
500
);
}
else
{
$
(
"body"
,
reportFormDoc
).
hide
();
// IPAD対応
}
});
}
},
500
);
}
/**
* ホットスポットクリック時フォームを表示
* TODO
*
* @param name ホットスポット名
* @param taskKey taskKey
* @param lookto true:視点移動する
*/
CHK
.
showReportForm
=
function
(
name
,
taskKey
,
lookto
,
replyNo
,
message
)
{
CHK
.
showLoading
(
getMsg
(
"Processing_w_dot"
));
// TODO 画面切り替え中に作業一覧を隠す
if
(
$
(
"#checkInput iframe[id^='reportForm']"
).
length
)
{
CHK
.
showWhiteFrame
();
}
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
&&
!
name
)
name
=
CHK
.
generateUuid
();
// PDFタイプのみname値がない場合新規作成とする
console
.
log
({
name
:
name
});
if
(
!
taskKey
)
taskKey
=
CHK
.
getTaskKeyByName
(
name
);
if
(
!
replyNo
)
replyNo
=
CHK
.
BASE_TASK_REPLY_NO
;
// replyNoの値が空の場合0を設定
// グローバル変数として回答番号を設定
CHK
.
taskReplyNo
=
replyNo
;
var
element
;
// リダイレクトフラグがtrueの場合はiframeを1つ、以外の場合はiframeを2つ作って管理する
if
(
CHK
.
isRedirectForm
(
taskKey
))
{
element
=
document
.
getElementById
(
"reportForm"
);
console
.
log
(
element
);
if
(
!
element
)
{
element
=
document
.
createElement
(
"iframe"
);
element
.
id
=
"reportForm"
;
element
.
setAttribute
(
"src"
,
CHK
.
reportBasePath
+
"taskReport_"
+
replyNo
+
"/index.html?wmode=transparent"
);
CHK
.
showTaskReportForm
(
name
,
taskKey
,
lookto
,
element
);
}
else
{
CHK
.
showDialog
(
message
,
function
()
{
$
(
"#checkInput"
).
hide
();
$
(
"#checkInput"
).
empty
();
CHK
.
changeReport
(
taskKey
);
},
function
()
{
$
(
"#whiteFrame"
).
hide
();
CHK
.
closeLoading
();
});
}
}
else
{
element
=
document
.
getElementById
(
"reportForm"
+
replyNo
);
if
(
!
element
)
{
element
=
document
.
createElement
(
"iframe"
);
element
.
id
=
"reportForm"
+
replyNo
;
element
.
setAttribute
(
"src"
,
CHK
.
reportBasePath
+
"taskReport_"
+
replyNo
+
"/index.html?wmode=transparent"
);
CHK
.
showTaskReportForm
(
name
,
taskKey
,
lookto
,
element
);
CHK
.
delayReportFormInit
();
}
else
{
CHK
.
delayReportFormInit
(
true
);
element
.
contentWindow
.
changeFontSize
(
CHK
.
setBigFontFlg
);
}
}
CHK
.
closeLoading
();
}
/**
* 報告フォームを表示
*
* @param element 表示するHTML
*/
CHK
.
showCheckInput
=
function
(
element
,
taskKey
)
{
// 新規・リダイレクト・初期表示の場合checkInputエレメントを空に設定する
if
(
!
taskKey
||
CHK
.
isRedirectForm
(
taskKey
)
||
$
(
"#unsupport_browser"
).
length
)
{
$
(
"#checkInput"
).
empty
();
}
// checkInputに対象フォームが存在しない場合対象フォームを挿入する
if
(
!
$
(
"#checkInput"
).
has
(
element
).
length
)
{
$
(
"#checkInput"
).
append
(
element
);
}
// 表示処理を隠す
CHK
.
showWhiteFrame
();
$
(
"#checkInput"
).
show
();
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
VTOUR
)
{
krpano
.
call
(
"set(layer[skin_control_bar].visible,false);"
);
krpano
.
call
(
"skin_close_settings();"
);
krpano
.
call
(
"skin_hideskin();"
);
}
}
/**
* 作業報告フォームを非表示
*
*/
CHK
.
hideReportForm
=
function
()
{
// 作業追加区分なしの場合、画面を閉じる
if
(
CHK
.
isWeb
&&
addReportFlg
==
CHK
.
ADD_REPORT_FLG
.
UNABLE
)
{
CHK
.
close
();
}
else
{
$
(
"#checkInput"
).
hide
();
$
(
"#checkInput"
).
empty
();
if
(
CHK
.
useKrpano
)
{
krpano
.
call
(
"clear_blink()"
);
krpano
.
call
(
"clear_selected()"
);
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
VTOUR
)
{
krpano
.
call
(
"set(layer[skin_control_bar].visible,true);"
);
krpano
.
call
(
"skin_showskin();"
);
}
}
else
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
&&
CHK
.
isWeb
)
{
CHK_P
.
showToolbar
();
CHK_P
.
selectedHsTaskKey
=
null
;
$
(
"#checkList"
).
css
(
"visibility"
,
"visible"
);
$
(
".hotspot"
).
removeClass
(
"blinking"
);
}
// 表示状態変更通知
CHK
.
sendDisplayStatus
(
$
(
"#checkList"
).
is
(
':visible'
)
?
CHK
.
DISPLAY_STATUS
.
showingList
:
CHK
.
DISPLAY_STATUS
.
init
);
// 回答番号を0に設定する
CHK
.
taskReplyNo
=
CHK
.
BASE_TASK_REPLY_NO
;
}
$
(
"#whiteFrame"
).
remove
();
}
/**
* 作業報告登録フォームの入力を保存
*
* @param param 入力パラメータ
*/
CHK
.
saveReportForm
=
function
(
param
)
{
console
.
log
(
param
);
var
inspect
=
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
INSPECT
;
var
isInsert
=
false
;
var
taskReport
;
// 定期点検対応
if
(
inspect
)
{
var
routineTaskReport
=
CHK_I
.
getTaskReport
(
param
.
reportStartDate
);
if
(
routineTaskReport
&&
routineTaskReport
.
task
)
{
taskReport
=
routineTaskReport
;
}
}
else
{
taskReport
=
CHK
.
getTaskReport
(
null
,
param
.
taskKey
);
}
// 更新・登録確認
if
(
taskReport
&&
taskReport
.
task
)
{
taskReport
.
task
=
param
.
task
;
taskReport
.
taskReply
=
param
.
taskReply
;
taskReport
.
attached
=
param
.
attached
;
taskReport
.
suggest
=
param
.
suggest
;
}
else
{
isInsert
=
true
;
param
.
mode
=
"0"
;
var
reportKey
=
"taskReport_"
+
CHK
.
taskReplyNo
;
taskReport
=
{};
taskReport
.
taskKey
=
param
.
taskKey
;
taskReport
.
task
=
param
.
task
;
taskReport
.
taskReply
=
param
.
taskReply
;
taskReport
.
attached
=
param
.
attached
;
taskReport
.
suggest
=
param
.
suggest
;
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
WORKFLOW
)
{
taskReport
.
processKey
=
CHK_PR
.
selectedProcessKey
;
}
if
(
!
CHK
.
taskReport
[
reportKey
])
CHK
.
taskReport
[
reportKey
]
=
[];
if
(
CHK
.
debug
==
"1"
)
CHK
.
taskReport
[
reportKey
].
push
(
taskReport
);
//DEBUG
}
// 報告(回答)の場合、バージョンを追加
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
WITHREPLY
)
{
var
recentVersionNum
=
CHK
.
getRecentVersionNum
(
param
.
taskKey
);
console
.
log
(
"recentVersionNum: "
+
recentVersionNum
);
taskReport
.
task
.
version
=
recentVersionNum
+
1
;
}
var
callbackABookCheckApi
=
null
;
if
(
CHK
.
isWeb
)
{
callbackABookCheckApi
=
function
(
json
)
{
CHK
.
closeLoading
();
if
(
inspect
)
{
CHK_I
.
updateInspectReportJsonWeb
(
json
);
}
else
{
CHK
.
updateReportJsonWeb
(
json
);
}
CHK
.
afterUpdateReport
(
param
.
taskKey
);
};
}
//アプリ・CMSに送信
var
apiParam
=
{};
if
(
CHK
.
taskReplyNo
==
CHK
.
BASE_TASK_REPLY_NO
)
{
var
hotspot
=
CHK
.
getSaveHotspotParam
(
param
);
apiParam
.
hotspot
=
CHK
.
encodeParam
(
JSON
.
stringify
(
hotspot
));
apiParam
.
delFlag
=
0
;
}
apiParam
.
cmd
=
param
.
isLocalSave
?
CHK
.
getCommand
(
"localSave"
)
:
isInsert
?
CHK
.
getCommand
(
"insertReport"
)
:
CHK
.
getCommand
(
"updateReport"
);
apiParam
.
taskKey
=
param
.
taskKey
;
apiParam
.
taskReport
=
CHK
.
encodeParam
(
JSON
.
stringify
(
taskReport
));
apiParam
.
attachedChangeFlag
=
param
.
attachedChangeFlag
;
apiParam
.
taskReportLevel
=
CHK
.
taskReplyNo
;
apiParam
.
addReport
=
addReportFlg
;
// 定期点検対応
if
(
inspect
)
{
apiParam
.
taskReportId
=
param
.
taskReportId
;
apiParam
.
reportStartDate
=
CHK_I
.
getInspectIsoDate
(
new
Date
(
param
.
reportStartDate
));
if
(
CHK
.
isWeb
)
{
apiParam
.
reportStartDate
=
apiParam
.
reportStartDate
.
replace
(
"T"
,
" "
);
if
(
!
apiParam
.
taskReportInfo
)
{
apiParam
.
taskReportInfo
=
{};
}
apiParam
.
taskReportInfo
.
task
=
taskReport
.
task
;
apiParam
.
taskReportInfo
.
attached
=
taskReport
.
attached
;
apiParam
.
taskReportInfo
=
JSON
.
stringify
(
apiParam
.
taskReportInfo
);
if
(
!
isInsert
&&
param
.
taskReportInfoId
)
{
apiParam
.
taskReportInfoId
=
param
.
taskReportInfoId
;
}
}
}
// 連続作業対応
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
WORKFLOW
)
{
apiParam
.
phaseNo
=
CHK_PR
.
selectedPhaseInfo
.
phaseNo
;
apiParam
.
processKey
=
CHK_PR
.
selectedProcessKey
;
//連続作業の場合は保存後閉じさせない
apiParam
.
addReport
=
CHK
.
ADD_REPORT_FLG
.
ABLE
;
}
CHK
.
sendABookCheckApi
(
apiParam
,
callbackABookCheckApi
);
//DEBUG
if
(
CHK
.
debug
==
"1"
)
{
CHK
.
closeLoading
();
CHK
.
afterUpdateReport
(
param
.
taskKey
);
}
}
/**
* アプリにデータを送信
*
* @param param パラメータ
*/
CHK
.
sendABookCheckApi
=
function
(
param
,
callback
)
{
if
(
CHK
.
isWeb
)
{
var
url
=
CHK
.
getActionUrl
(
param
.
cmd
);
CHK
.
cmsAjax
(
url
,
param
,
callback
);
}
else
if
(
CHK
.
isWindows
)
{
// windowsアプリの場合の対応
window
.
external
.
notify
(
JSON
.
stringify
(
param
));
}
else
{
var
query
=
""
;
for
(
var
key
in
param
)
{
if
(
!
query
)
{
query
=
"?"
+
key
+
"="
+
param
[
key
];
}
else
{
query
=
query
+
"&"
+
key
+
"="
+
param
[
key
];
}
}
var
uri
=
"abookcheck-api://"
+
query
;
console
.
log
({
uri
:
uri
});
if
(
CHK
.
debug
!=
"1"
)
{
var
link
=
document
.
createElement
(
'a'
);
link
.
href
=
uri
;
link
.
click
();
}
}
}
/**
* アプリに添付ファイル情報を送信
*
* @param taskKey taskKey
* @param attachedKey 添付ファイルのkey値
* @param fileName ファイル名
* @param dataUrl 添付ファイルBase64文字列
*/
CHK
.
sendAttachedFileName
=
function
(
taskKey
,
attachedKey
,
fileName
,
dataUrl
,
editable
)
{
var
param
=
{};
param
.
cmd
=
CHK
.
getCommand
(
"saveAttached"
);
param
.
taskKey
=
taskKey
;
param
.
attachedKey
=
attachedKey
;
param
.
filename
=
fileName
;
param
.
editable
=
editable
;
CHK
.
saveAttachedDataUrl
=
dataUrl
;
CHK
.
sendABookCheckApi
(
param
);
if
(
CHK
.
debug
==
"1"
)
{
CHK
.
closeLoading
();
}
}
/**
* アプリに編集したい添付ファイル情報を送信
*
* @param taskKey taskKey
* @param fileName ファイル名
* @param filePath ファイルパス
*/
CHK
.
editAttachedFile
=
function
(
taskKey
,
fileName
,
filePath
)
{
var
param
=
{};
param
.
cmd
=
CHK
.
getCommand
(
"editAttached"
);
param
.
taskKey
=
taskKey
;
param
.
filename
=
fileName
;
param
.
filePath
=
filePath
;
CHK
.
sendABookCheckApi
(
param
);
if
(
CHK
.
debug
==
"1"
)
{
CHK
.
closeLoading
();
}
}
/**
* 添付ファイルのBase64文字列を返却
*
*/
CHK
.
getAttachedDataUrl
=
function
()
{
var
ret
=
CHK
.
saveAttachedDataUrl
;
CHK
.
saveAttachedDataUrl
=
""
;
return
ret
;
}
/**
* アプリデータ送信結果コールバック
*
* @param cmd コマンド文字列
* @param taskKey taskKey
* @param result 処理結果(0:成功)
* @param message エラーメッセージ
* @param extParam 拡張パラメータ JSON形式
*/
CHK
.
afterABookCheckApi
=
function
(
cmd
,
taskKey
,
result
,
message
,
extParam
)
{
console
.
log
(
"afterABookCheckApi"
,
cmd
,
taskKey
,
result
,
message
,
extParam
);
// 結果が成功じゃない場合
if
(
result
!=
"0"
)
{
if
(
cmd
==
CHK
.
apiCmd
.
getGpsInfo
)
{
//手動取得時はエラーダイアログを表示
var
targetContentwindow
;
if
(
$
(
"#checkInput"
).
find
(
"iframe#reportForm0"
).
length
)
{
targetContentwindow
=
$
(
"#checkInput"
).
find
(
"iframe#reportForm"
+
CHK
.
taskReplyNo
)[
0
].
contentWindow
;
}
else
{
targetContentwindow
=
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
;
}
if
(
targetContentwindow
&&
targetContentwindow
.
isGpsManual
())
{
CHK
.
showDialog
(
getMsg
(
"errorOccurred"
)
+
"<br>"
+
message
,
null
,
null
,
true
);
}
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
getGpsInfoAfter
();
}
else
if
(
addReportFlg
==
CHK
.
ADD_REPORT_FLG
.
UNABLE
&&
(
cmd
==
CHK
.
apiCmd
.
insertReport
||
cmd
==
CHK
.
apiCmd
.
updateReport
))
{
CHK
.
closeLoading
();
}
else
{
CHK
.
showDialog
(
getMsg
(
"errorOccurred"
)
+
"<br>"
+
message
,
null
,
null
,
true
);
if
(
cmd
==
CHK
.
apiCmd
.
saveAttached
)
{
$
(
"#checkInput"
).
children
()[
0
].
contentWindow
.
deleteFile
(
extParam
.
key
);
CHK
.
closeLoading
();
}
else
if
(
cmd
==
CHK
.
apiCmd
.
editAttached
)
{
$
(
"#checkInput"
).
children
()[
0
].
contentWindow
.
deleteFile
(
extParam
.
key
);
CHK
.
closeLoading
();
}
}
return
;
}
//JSON再ロード
switch
(
cmd
)
{
case
CHK
.
apiCmd
.
saveAttached
:
{
CHK
.
closeLoading
();
break
;
}
case
CHK
.
apiCmd
.
editAttached
:
{
CHK
.
closeLoading
();
break
;
}
case
CHK
.
apiCmd
.
insertReport
:
case
CHK
.
apiCmd
.
updateReport
:
{
CHK
.
closeLoading
();
//作業報告情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskReport
,
function
(
taskReport
)
{
CHK
.
taskReport
=
taskReport
;
//ホットスポット情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskHotspot
,
function
(
jsonData
)
{
CHK
.
taskHotspot
=
jsonData
;
CHK
.
afterUpdateReport
(
taskKey
);
});
});
//作業報告入力補完情報をロード
CHK
.
reloadJson
(
CHK
.
jsonPath
.
taskReportSuggest
);
break
;
}
case
CHK
.
apiCmd
.
cancelReport
:
{
CHK
.
afterCancelTask
();
break
;
}
case
CHK
.
apiCmd
.
deleteReport
:
{
CHK
.
closeLoading
();
//作業報告情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskReport
,
function
(
taskReport
)
{
CHK
.
taskReport
=
taskReport
;
CHK
.
afterDeleteReport
(
taskKey
);
});
break
;
}
case
CHK
.
apiCmd
.
moveHotspot
:
{
//ホットスポット情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskHotspot
,
function
(
jsonData
)
{
CHK
.
taskHotspot
=
jsonData
;
var
taskHotspot
=
CHK
.
getTaskHotspot
(
null
,
taskKey
);
var
object
=
krpano
.
get
(
"layer["
+
taskHotspot
.
name
+
"]"
);
//ウィンドウサイズ変更時の対応
if
(
object
)
object
.
origin_x
=
taskHotspot
.
x
;
if
(
object
)
object
.
origin_y
=
taskHotspot
.
y
;
});
break
;
}
case
CHK
.
apiCmd
.
getGpsInfo
:
{
//GPS情報取得
var
gps
=
{};
gps
.
latitude
=
extParam
.
latitude
;
gps
.
longitude
=
extParam
.
longitude
;
if
(
$
(
"#checkInput"
).
find
(
"iframe#reportForm0"
).
length
)
{
$
(
"#checkInput"
).
find
(
"iframe#reportForm"
+
CHK
.
taskReplyNo
)[
0
].
contentWindow
.
getGpsInfoAfter
(
gps
);
}
else
{
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
getGpsInfoAfter
(
gps
);
}
break
;
}
case
CHK
.
apiCmd
.
localSave
:
{
CHK
.
closeLoading
();
//作業報告情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskReport
,
function
(
taskReport
)
{
CHK
.
taskReport
=
taskReport
;
//ホットスポット情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskHotspot
,
function
(
jsonData
)
{
CHK
.
taskHotspot
=
jsonData
;
CHK
.
afterUpdateReport
(
taskKey
,
true
);
});
});
//作業報告入力補完情報をロード
CHK
.
reloadJson
(
CHK
.
jsonPath
.
taskReportSuggest
);
break
;
}
case
CHK
.
apiCmd
.
changeReport
:
{
// 添付ファイルの削除後レポート表示
CHK
.
showReportForm
(
null
,
taskKey
,
null
,
CHK
.
taskReplyNo
);
break
;
}
case
CHK
.
apiCmd
.
getGroupTreeInfo
:
{
// ログインユーザーの所属グループを保存
CHK
.
groupTreeInfo
=
extParam
;
}
}
}
/**
* 作業報告更新後の処理
*
* @param taskKey taskKey
*/
CHK
.
afterUpdateReport
=
function
(
taskKey
,
isLocalSave
)
{
// テキストを更新
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
)
{
CHK
.
updateHotspotText
(
taskKey
);
}
else
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
VTOUR
)
{
var
taskHotspot
=
CHK
.
getTaskHotspot
(
null
,
taskKey
);
var
taskReport
=
CHK
.
getRecentVersionReport
(
taskKey
);
var
pointNo
=
CHK
.
getPointNo
(
taskReport
);
CHK
.
changeTextColor
(
taskHotspot
.
name
,
pointNo
);
}
// リスト更新、入力フォームをクローズ
CHK
.
updateTaskList
();
if
(
!
isLocalSave
)
CHK
.
hideReportForm
();
// 新規作成時削除対象になってあるため、クリア
CHK
.
deleteName
=
null
;
}
/**
* 作業報告キャンセル後の処理
*
* @param taskKey taskKey
*/
CHK
.
afterCancelTask
=
function
()
{
if
(
CHK
.
deleteName
)
{
//ホットスポットを削除
CHK
.
deleteHotspot
(
CHK
.
deleteName
);
CHK
.
deleteName
=
null
;
}
CHK
.
hideReportForm
();
}
/**
* 作業報告削除後の処理
*
* @param taskKey taskKey
*/
CHK
.
afterDeleteReport
=
function
(
taskKey
,
json
)
{
// 指示報告か回答報告かを確認
if
(
CHK
.
taskReplyNo
==
CHK
.
BASE_TASK_REPLY_NO
)
{
//ホットスポットを削除
var
targetHsName
=
taskKey
;
if
(
CHK
.
operationType
!=
CHK
.
OPERATION_TYPE
.
PDF
)
{
targetHsName
=
"hs"
+
CHK
.
getSceneId
()
+
"-"
+
taskKey
;
}
CHK
.
deleteHotspot
(
targetHsName
);
CHK
.
hideReportForm
();
if
(
CHK
.
isWeb
)
{
//ホットスポット情報をロード
CHK
.
updateReportJsonWeb
(
json
);
//ホットスポット一覧更新
CHK
.
updateTaskList
();
}
else
{
//ホットスポット情報をロード
CHK
.
loadJson
(
CHK
.
jsonPath
.
taskHotspot
,
function
(
jsonData
)
{
CHK
.
taskHotspot
=
jsonData
;
//ホットスポット一覧更新
CHK
.
updateTaskList
();
});
}
}
else
{
// テキストの色変更
if
(
CHK
.
operationType
!=
CHK
.
OPERATION_TYPE
.
PDF
)
{
var
taskHotspot
=
CHK
.
getTaskHotspot
(
null
,
taskKey
);
var
taskReport
=
CHK
.
getRecentVersionReport
(
taskKey
);
var
pointNo
=
CHK
.
getPointNo
(
taskReport
);
CHK
.
changeTextColor
(
taskHotspot
.
name
,
pointNo
);
}
// リスト更新、入力フォームをクローズ
CHK
.
updateTaskList
();
CHK
.
hideReportForm
();
}
}
/**
* ホットスポットのテキストを更新
*
* @param taskKey taskKey
*/
CHK
.
updateHotspotText
=
function
(
taskKey
)
{
var
taskHotspot
=
CHK
.
getTaskHotspot
(
null
,
taskKey
);
var
taskReport
=
CHK
.
getRecentVersionReport
(
taskKey
);
var
pointNo
=
CHK
.
getPointNo
(
taskReport
);
if
(
CHK
.
operationType
!=
CHK
.
OPERATION_TYPE
.
DRAWING
&&
taskHotspot
.
sceneId
!=
"0"
)
{
var
layer
=
krpano
.
get
(
"layer["
+
taskHotspot
.
name
+
"_inner]"
);
if
(
layer
)
layer
.
html
=
"[font size='4' color='#ffffff' style='border-style:solid;border-width:1px;border-color:#ffffff;padding:5px 15px;background-color:#ff7700;'][b]"
+
pointNo
+
"[/b][/font]"
;
}
else
{
var
layer
=
krpano
.
get
(
"layer["
+
taskHotspot
.
name
+
"]"
);
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
DRAWING
)
{
layer
.
html
=
"[font color='#ffffff' style='border-style:solid;border-width:1px;border-color:#ffffff;padding:5px 15px;background-color:#ff7700;'][b]"
+
pointNo
+
"[/b][/font]"
;
}
else
{
layer
.
html
=
"[font color='#ffffff' style='border-style:solid;border-width:1px;border-color:#ffffff;padding:5px 15px;background-color:#ff7700;'][b]"
+
pointNo
+
"[/b][/font]"
;
}
}
}
/**
* ホットスポットのテキストカラーを変更
*
* @param name ホットスポット名
* @param pointNo 指摘No
*/
CHK
.
changeTextColor
=
function
(
name
,
pointNo
)
{
var
isHotspot
=
true
;
var
layer
=
krpano
.
get
(
"layer["
+
name
+
"_inner]"
);
if
(
!
layer
)
{
isHotspot
=
false
;
layer
=
krpano
.
get
(
"layer["
+
name
+
"]"
);
if
(
!
layer
)
return
;
}
layer
.
html
=
CHK
.
getHotspotHtml
(
name
,
isHotspot
,
pointNo
);
}
/**
* 作業報告を削除
*
* @param taskKey taskKey
*/
CHK
.
deleteReport
=
function
(
taskKey
)
{
//アプリに作業報告の削除情報を送信
var
apiParam
=
{};
apiParam
.
cmd
=
CHK
.
getCommand
(
"deleteReport"
);
apiParam
.
taskKey
=
taskKey
;
apiParam
.
delFlag
=
1
;
apiParam
.
taskReportLevel
=
CHK
.
taskReplyNo
;
apiParam
.
addReport
=
addReportFlg
;
var
callbackABookCheckApi
=
null
;
if
(
CHK
.
isWeb
)
{
callbackABookCheckApi
=
function
(
json
)
{
CHK
.
closeLoading
();
//作業報告情報をロード
CHK
.
updateReportJsonWeb
(
json
);
CHK
.
afterDeleteReport
(
taskKey
,
json
);
};
}
CHK
.
sendABookCheckApi
(
apiParam
,
callbackABookCheckApi
);
//DEBUG
if
(
CHK
.
debug
==
"1"
)
{
var
taskReport
=
CHK
.
getTaskReport
(
null
,
taskKey
);
CHK
.
closeLoading
();
var
index
=
0
;
taskReport
.
some
(
function
(
report
,
i
)
{
if
(
report
.
taskKey
==
taskKey
)
{
index
=
i
;
return
true
;
}
});
taskReport
.
splice
(
index
,
1
);
CHK
.
afterDeleteReport
(
taskKey
);
}
}
/**
* ホットスポットを削除
*
* @param name ホットスポット名
*/
CHK
.
deleteHotspot
=
function
(
name
)
{
var
isHotspot
=
krpano
.
get
(
"hotspot["
+
name
+
"]"
)
!=
null
;
if
(
isHotspot
)
{
krpano
.
call
(
"removehotspot("
+
name
+
")"
);
krpano
.
call
(
"removelayer("
+
name
+
"_inner)"
);
}
else
{
krpano
.
call
(
"removelayer("
+
name
+
")"
);
}
}
/**
* 作業報告キャンセル処理
*
*/
CHK
.
cancelTask
=
function
(
taskKey
)
{
var
apiParam
=
{};
apiParam
.
cmd
=
CHK
.
getCommand
(
"cancelReport"
);
apiParam
.
taskKey
=
taskKey
;
apiParam
.
taskReportLevel
=
CHK
.
taskReplyNo
;
//連続作業の場合追加無しでも工程一覧に戻したい
if
(
window
.
parent
.
CHK
.
reportType
==
window
.
parent
.
CHK
.
REPORT_TYPE
.
WORKFLOW
)
{
apiParam
.
addReport
=
CHK
.
ADD_REPORT_FLG
.
ABLE
;
}
else
{
apiParam
.
addReport
=
addReportFlg
;
}
CHK
.
sendABookCheckApi
(
apiParam
);
if
(
CHK
.
debug
==
"1"
||
CHK
.
isWeb
)
{
CHK
.
afterCancelTask
();
}
}
/**
* 作業報告変更処理
*
*/
CHK
.
changeReport
=
function
(
taskKey
)
{
var
apiParam
=
{};
apiParam
.
cmd
=
CHK
.
getCommand
(
"changeReport"
);
apiParam
.
taskKey
=
taskKey
;
CHK
.
sendABookCheckApi
(
apiParam
);
}
/**
* 指摘No一覧の表示を切り替える
*
*/
CHK
.
showTaskList
=
function
()
{
// フォームが表示されてる場合は何もしない
if
(
CHK
.
isShowingForm
())
{
return
;
}
if
(
$
(
"#checkListValues"
).
css
(
'display'
)
!=
"none"
)
{
$
(
"#checkListValues"
).
hide
();
$
(
"#checkListValues #checkListCount"
).
hide
();
$
(
"#checkListValues"
).
height
(
"0px"
);
$
(
"#checkList"
).
height
(
"0px"
);
$
(
"#checkList"
).
hide
();
// 表示状態変更通知
CHK
.
sendDisplayStatus
(
CHK
.
DISPLAY_STATUS
.
init
);
}
else
{
$
(
"#checkListValues"
).
show
();
$
(
"#checkListValues #checkListCount"
).
show
();
if
(
$
(
"#topnav"
).
length
>
0
)
{
$
(
"#checkList"
).
css
(
"top"
,
"36px"
);
}
$
(
"#checkListValues"
).
height
(
"100%"
);
$
(
"#checkList"
).
height
(
"100%"
);
$
(
"#checkList"
).
show
();
// 表示状態変更通知
CHK
.
sendDisplayStatus
(
CHK
.
DISPLAY_STATUS
.
showingList
);
}
}
/**
* フォントサイズ調整
*
*/
CHK
.
changeFontSize
=
function
(
flg
)
{
if
(
flg
)
{
$
(
".fontBtn.small"
).
removeClass
(
"selected"
);
$
(
".fontBtn.big"
).
addClass
(
"selected"
);
$
(
"#checkList"
).
addClass
(
"big"
);
}
else
{
$
(
".fontBtn.small"
).
addClass
(
"selected"
);
$
(
".fontBtn.big"
).
removeClass
(
"selected"
);
$
(
"#checkList"
).
removeClass
(
"big"
);
}
CHK
.
setBigFontFlg
=
flg
;
}
/**
* 指摘No一覧を更新
*
* @param searchWord 検索文
*/
CHK
.
updateTaskList
=
function
(
searchWord
)
{
$
(
"#checkListValues"
).
empty
();
$
(
"#fontBtnDiv"
).
clone
().
appendTo
(
$
(
"#checkListValues"
));
$
(
"#checkListValues #fontBtnDiv"
).
css
(
"display"
,
"flex"
);
$
(
"#closeBtn"
).
clone
().
appendTo
(
$
(
"#checkListValues"
));
$
(
"#checkListValues #closeBtn"
).
show
();
var
ckeckList
=
[];
CHK
.
taskHotspot
.
hotspot
.
forEach
(
function
(
hotspot
)
{
var
taskReport
=
CHK
.
getRecentVersionReport
(
hotspot
.
name
,
hotspot
.
taskKey
);
ckeckList
.
push
({
sceneId
:
hotspot
.
sceneId
,
name
:
hotspot
.
name
?
hotspot
.
name
:
hotspot
.
taskKey
,
pointno
:
CHK
.
getPointNo
(
taskReport
),
hotspot
:
hotspot
.
sceneId
!=
"0"
});
});
ckeckList
.
sort
(
function
(
a
,
b
)
{
if
(
a
.
sceneId
!=
"0"
&&
b
.
sceneId
==
"0"
)
return
-
1
;
if
(
a
.
sceneId
==
"0"
&&
b
.
sceneId
!=
"0"
)
return
1
;
if
(
a
.
sceneId
<
b
.
sceneId
)
return
-
1
;
if
(
a
.
sceneId
>
b
.
sceneId
)
return
1
;
if
(
a
.
pointno
<
b
.
pointno
)
return
-
1
;
if
(
a
.
pointno
>
b
.
pointno
)
return
1
;
return
0
;
});
var
count
=
0
;
var
sceneId
=
""
;
if
(
!
searchWord
)
searchWord
=
""
;
$
(
"#searchWord"
).
val
(
searchWord
);
$
(
"#checkListSearch"
).
clone
().
appendTo
(
$
(
"#checkListValues"
));
$
(
"#checkListSearch"
).
css
(
"display"
,
"flex"
);
$
(
"#checkListCount"
).
clone
().
appendTo
(
$
(
"#checkListValues"
));
$
(
"#checkListCount"
).
show
();
$
(
"#checkListValues"
).
append
(
"<div id='values'></div>"
);
var
sceneCnt
=
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
?
CHK
.
pdf_numPages
:
krpano
.
get
(
"scene"
).
count
;
if
(
CHK
.
operationType
!=
CHK
.
OPERATION_TYPE
.
PDF
&&
krpano
.
get
(
"layer[map].url"
))
{
sceneCnt
+=
1
;
}
// シーンから追加
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
VTOUR
)
{
for
(
var
i
=
0
;
i
<
sceneCnt
;
i
++
)
{
var
scene
=
krpano
.
get
(
"scene["
+
i
+
"]"
);
if
(
!
scene
)
{
sceneId
=
"0"
;
}
else
{
sceneId
=
scene
.
name
.
substring
(
5
);
}
var
checkListSceneDiv
=
$
(
"<div/>"
,
{
class
:
"checkListSceneDiv"
});
checkListSceneDiv
.
append
(
$
(
"<div/>"
,
{
class
:
"checkListScene"
,
onclick
:
"CHK.clickTaskList("
+
sceneId
+
")"
}).
append
(
$
(
"<div/>"
).
text
(
CHK
.
getSceneName
(
sceneId
))));
checkListSceneDiv
.
append
(
$
(
"<div/>"
,
{
id
:
sceneId
+
"_accordionBtn"
,
class
:
"accordionBtn"
}).
append
(
$
(
"<p/>"
).
text
(
"▽"
)));
$
(
"#values"
).
append
(
checkListSceneDiv
);
$
(
"#values"
).
append
(
$
(
"<div/>"
,
{
id
:
sceneId
+
"_values"
,
class
:
"sceneValues"
}));
// 表示中のシーンの作業リストはオープンするため、ボタンのスタイルを設定
if
(
searchWord
||
krpano
.
get
(
"xml.scene"
)
==
"scene"
+
sceneId
)
{
$
(
"#"
+
sceneId
+
"_accordionBtn >p"
).
css
({
transform
:
"rotate(180deg)"
,
zIndex
:
"1"
});
}
// 作業がないシーンの表示
$
(
"#nullValue"
).
clone
().
appendTo
(
$
(
"#"
+
sceneId
+
"_values"
));
$
(
"#nullValue"
).
show
();
}
}
else
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
DRAWING
)
{
$
(
"#values"
).
css
(
"margin-top"
,
"20px"
);
$
(
"#nullValue"
).
clone
().
appendTo
(
$
(
"#values"
));
$
(
"#nullValue"
).
show
();
}
else
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
)
{
for
(
var
i
=
1
;
i
<=
sceneCnt
;
i
++
)
{
sceneId
=
i
;
var
checkListSceneDiv
=
$
(
"<div/>"
,
{
class
:
"checkListSceneDiv"
});
checkListSceneDiv
.
append
(
$
(
"<div/>"
,
{
class
:
"checkListScene"
,
onclick
:
"CHK.clickTaskList("
+
sceneId
+
")"
}).
append
(
$
(
"<div/>"
).
text
(
sceneId
+
getMsg
(
"page"
))));
checkListSceneDiv
.
append
(
$
(
"<div/>"
,
{
id
:
sceneId
+
"_accordionBtn"
,
class
:
"accordionBtn"
}).
append
(
$
(
"<p/>"
).
text
(
"▽"
)));
$
(
"#values"
).
append
(
checkListSceneDiv
);
$
(
"#values"
).
append
(
$
(
"<div/>"
,
{
id
:
sceneId
+
"_values"
,
class
:
"sceneValues"
}));
// 表示中のシーンの作業リストはオープンするため、ボタンのスタイルを設定
if
(
searchWord
||
CHK
.
pdf_pageNum
==
sceneId
)
{
$
(
"#"
+
sceneId
+
"_accordionBtn >p"
).
css
({
transform
:
"rotate(180deg)"
,
zIndex
:
"1"
});
}
// 作業がないシーンの表示
$
(
"#nullValue"
).
clone
().
appendTo
(
$
(
"#"
+
sceneId
+
"_values"
));
$
(
"#nullValue"
).
show
();
}
}
// 検索文の英文字と数字を半角、小文字に設定
var
convertedSearchWord
=
CHK
.
kataToHira
(
CHK
.
fullwidthTohalfwidth
(
searchWord
)).
toLowerCase
();
// 作業をシーンごとに配置・表示
for
(
var
i
=
0
;
i
<
ckeckList
.
length
;
i
++
)
{
var
ckeck
=
ckeckList
[
i
];
var
taskReport
=
CHK
.
getRecentVersionReport
(
ckeck
.
name
,
ckeck
.
taskKey
);
var
taskName
=
CHK
.
getTaskName
(
taskReport
);
sceneId
=
ckeck
.
sceneId
;
if
(
CHK
.
hasSearchWord
(
taskName
,
convertedSearchWord
))
{
var
color
=
CHK
.
getTextColor
(
ckeck
.
name
);
var
targetList
=
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
DRAWING
?
$
(
"#values"
):
$
(
"#"
+
sceneId
+
"_values"
);
var
onclickAction
=
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
?
"CHK.clickTaskList('"
+
sceneId
+
"', '"
+
ckeck
.
name
+
"')"
:
"CHK.clickTaskList('"
+
sceneId
+
"', '"
+
ckeck
.
name
+
"', "
+
ckeck
.
hotspot
+
")"
;
var
checkListValue
=
$
(
"<div/>"
,
{
class
:
'checkListValue'
,
style
:
"color:"
+
color
,
onclick
:
onclickAction
});
checkListValue
.
append
(
$
(
"<div/>"
).
append
(
$
(
"<span/>"
).
text
(
ckeck
.
pointno
)).
append
(
$
(
"<div/>"
).
text
(
taskName
)));
targetList
.
append
(
checkListValue
);
// 表示中のシーン以外の作業はクローズ
var
isOtherScene
=
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
?
CHK
.
pdf_pageNum
!=
sceneId
:
krpano
.
get
(
"xml.scene"
)
!=
"scene"
+
sceneId
;
if
(
!
searchWord
&&
isOtherScene
)
{
$
(
"#"
+
sceneId
+
"_values"
).
hide
();
}
// 作業があるシーンの表示
if
(
$
(
"#"
+
sceneId
+
"_values #nullValue"
))
{
// 360
$
(
"#"
+
sceneId
+
"_values #nullValue"
).
remove
();
$
(
"#"
+
sceneId
+
"_accordionBtn"
).
css
({
'color'
:
'#0068CB'
,
'background-color'
:
'#fff'
,
'border'
:
'1px solid #0068CB'
,
'cursor'
:
'pointer'
});
}
if
(
$
(
"#values > #nullValue"
))
{
// 図面
$
(
"#values > #nullValue"
).
remove
();
}
// 合計作業数(検索結果)
count
++
;
}
}
$
(
"#checkListNum"
).
text
(
count
);
// 作業一覧が表示されてる状態でシーン移動すると、該当シーンの作業一覧にスクロール移動する
if
(
!
searchWord
&&
CHK
.
operationType
!=
CHK
.
OPERATION_TYPE
.
DRAWING
)
{
var
idx
=
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
?
CHK
.
pdf_pageNum
-
1
:
krpano
.
get
(
"scene[get(xml.scene)].index"
);
$
(
"#values"
).
scrollTop
(
$
(
$
(
".checkListSceneDiv"
)[
idx
]).
position
().
top
+
$
(
"#values"
).
scrollTop
()
-
$
(
"#values"
).
position
().
top
);
}
// アコーディオンボタンクリックイベント
$
(
".accordionBtn"
).
on
(
"click"
,
function
()
{
var
panel
=
$
(
this
).
parent
().
next
();
if
(
$
(
panel
.
children
()[
0
]).
attr
(
"id"
)
==
"nullValue"
)
return
;
var
btnImg
=
$
(
$
(
this
).
children
()[
0
]);
if
(
panel
.
is
(
':visible'
)
&&
$
(
"#"
+
$
(
panel
[
0
]).
prop
(
"id"
)
+
" .checkListValue"
).
length
>
0
)
{
btnImg
.
animate
({
zIndex
:
0
},
{
duration
:
500
,
step
:
function
(
now
){
btnImg
.
css
({
transform
:
'rotate('
+
now
*
180
+
'deg)'
});
},
complete
:
function
(){
}});
// アコーディオンボタンのイメージアニメーション
panel
.
animate
({
zIndex
:
1
},
{
duration
:
500
,
step
:
function
(
now
){
panel
.
css
(
"max-height"
,
100
-
(
now
*
100
)
+
"%"
);
},
complete
:
function
(){
panel
.
hide
();
panel
.
css
(
"max-height"
,
""
);
}});
// パネルを閉めるアニメーション
}
else
{
panel
.
show
();
btnImg
.
animate
({
zIndex
:
1
},
{
duration
:
500
,
step
:
function
(
now
){
btnImg
.
css
({
transform
:
'rotate('
+
now
*
180
+
'deg)'
});
},
complete
:
function
(){
}});
// アコーディオンボタンのイメージアニメーション
panel
.
animate
({
zIndex
:
1
},
{
duration
:
500
,
step
:
function
(
now
){
panel
.
css
(
"max-height"
,
now
*
100
+
"%"
);
},
complete
:
function
(){
panel
.
css
(
"max-height"
,
""
);
}});
// パネルを開くアニメーション
$
(
this
).
parent
().
parent
().
animate
({
scrollTop
:
$
(
this
).
parent
().
position
().
top
+
$
(
"#values"
).
scrollTop
()
-
$
(
"#values"
).
position
().
top
},
600
,
"swing"
);
// 作業一覧のスクロール移動アニメーション
}
});
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
)
{
$
(
"#checkList .checkListSceneDiv"
).
css
({
"color"
:
"#FFF"
});
}
}
/**
* 文章のカタカナをひらがなに変換
*
* @param str 変換対象文章
*/
CHK
.
kataToHira
=
function
(
str
)
{
if
(
str
)
{
return
str
.
replace
(
/
[\u
30a1-
\u
30f6
]
/g
,
function
(
match
)
{
var
chr
=
match
.
charCodeAt
(
0
)
-
0x60
;
return
String
.
fromCharCode
(
chr
);
});
}
return
""
;
}
/**
* 文章の全角を半角に変換(英文字と数字のみ)
*
* @param str 変換対象文章
*/
CHK
.
fullwidthTohalfwidth
=
function
(
str
)
{
if
(
str
)
{
return
str
.
replace
(
/
[
A-Za-z0-9
]
/g
,
function
(
match
)
{
var
chr
=
match
.
charCodeAt
(
0
)
-
0xFEE0
;
return
String
.
fromCharCode
(
chr
);
});
}
return
""
;
}
/**
* targetStrを変換し、convertedSearchStrと比較する
* targetStrがconvertedSearchStrの文字を含んだ場合はtrueを返す
*
* @param targetStr 検索対象文
* @param convertedSearchStr 検索文
*/
CHK
.
hasSearchWord
=
function
(
targetStr
,
convertedSearchStr
)
{
return
CHK
.
kataToHira
(
CHK
.
fullwidthTohalfwidth
(
targetStr
)).
toLowerCase
().
indexOf
(
convertedSearchStr
)
!=
-
1
;
}
/**
* 作業検索処理
*
*/
CHK
.
searchTask
=
function
()
{
CHK
.
updateTaskList
(
$
(
"#searchWord"
).
val
()
?
$
(
"#searchWord"
).
val
()
:
""
);
}
/**
* シーン名を取得
*
* @param sceneId シーンID
*/
CHK
.
getSceneName
=
function
(
sceneId
)
{
var
ret
=
""
;
if
(
sceneId
==
"0"
)
{
ret
=
getMsg
(
"radarmap"
);
}
else
{
var
sceneArray
=
krpano
.
get
(
"scene"
).
getArray
();
sceneArray
.
some
(
function
(
scene
)
{
if
(
scene
.
name
.
substring
(
5
)
==
sceneId
)
{
ret
=
scene
.
title
;
return
true
;
}
});
}
return
ret
;
}
/**
* 指摘No一覧のクリック処理
*
* @param name ホットスポット名
* @param isHotspot true:ホットスポット false:レイヤー
*/
CHK
.
clickTaskList
=
function
(
sceneId
,
name
,
isHotspot
)
{
if
(
CHK
.
operationType
!=
CHK
.
OPERATION_TYPE
.
DRAWING
&&
sceneId
!=
"0"
&&
CHK
.
getSceneId
()
!=
sceneId
)
{
krpano
.
call
(
"loadSceneAction("
+
"scene"
+
sceneId
+
", null, "
+
krpano
.
get
(
"skin_settings.loadscene_flags"
)
+
")"
);
if
(
isHotspot
&&
name
)
{
CHK
.
lookHotspot
=
name
;
}
else
{
CHK
.
lookHotspot
=
null
;
}
}
// シーン名項目クリック時の処理
if
(
!
name
)
{
if
((
sceneId
!=
"0"
&&
krpano
.
get
(
"isOpen"
)
==
"1"
)
||
(
sceneId
==
"0"
))
{
// レーダーマップ項目クリック時の処理
if
(
sceneId
==
"0"
&&
krpano
.
get
(
"isOpen"
)
!=
"1"
&&
!
$
(
"#0_values"
).
is
(
':visible'
))
{
$
(
"#0_accordionBtn"
).
click
();
}
krpano
.
call
(
"togglemap()"
);
}
return
;
}
if
((
isHotspot
&&
krpano
.
get
(
"isOpen"
)
==
"1"
)
||
(
!
isHotspot
&&
krpano
.
get
(
"isOpen"
)
!=
"1"
))
{
krpano
.
call
(
"togglemap()"
);
}
if
(
isHotspot
&&
CHK
.
operationType
!=
CHK
.
OPERATION_TYPE
.
DRAWING
)
{
krpano
.
call
(
"hs_onclick_action("
+
name
+
", null, "
+
isHotspot
+
")"
);
}
else
{
krpano
.
call
(
"ly_onclick_action("
+
name
+
", null, "
+
isHotspot
+
")"
);
}
}
/**
* 作業ホットスポットを取得
*
* @param name ホットスポット名
* @param taskKey taskKey
*/
CHK
.
getTaskHotspot
=
function
(
name
,
taskKey
)
{
if
(
!
taskKey
)
taskKey
=
CHK
.
getTaskKeyByName
(
name
);
var
ret
;
CHK
.
taskHotspot
.
hotspot
.
some
(
function
(
taskHotspot
)
{
if
(
taskHotspot
.
taskKey
==
taskKey
)
{
ret
=
taskHotspot
;
return
true
;
}
});
return
ret
;
}
/**
* taskIdを取得
*
* @param name ホットスポット名
* @param taskKey taskKey
*/
CHK
.
getTaskId
=
function
(
name
,
taskKey
)
{
if
(
!
taskKey
)
taskKey
=
CHK
.
getTaskKeyByName
(
name
);
var
ret
=
-
1
;
CHK
.
taskHotspot
.
hotspot
.
some
(
function
(
hotspot
)
{
if
(
hotspot
.
taskKey
==
taskKey
)
{
ret
=
hotspot
.
taskId
;
return
true
;
}
});
return
ret
;
}
/**
* 指摘Noを取得
*
* @param taskReport 作業報告内容
*/
CHK
.
getPointNo
=
function
(
taskReport
)
{
var
ret
=
""
;
if
(
taskReport
&&
taskReport
.
task
)
{
for
(
var
key
in
taskReport
.
task
)
{
if
(
key
.
indexOf
(
"q_1_"
)
!=
-
1
)
{
ret
=
taskReport
.
task
[
key
];
}
}
}
return
ret
;
}
/**
* 作業名を取得
*
* @param taskReport 作業報告内容
*/
CHK
.
getTaskName
=
function
(
taskReport
)
{
var
ret
=
""
;
if
(
taskReport
&&
taskReport
.
task
)
{
for
(
var
key
in
taskReport
.
task
)
{
if
(
key
.
indexOf
(
"q_2_"
)
!=
-
1
)
{
ret
=
taskReport
.
task
[
key
];
}
}
}
return
ret
;
}
/**
* 作業報告情報を取得
*
* @param name ホットスポット名
*/
CHK
.
getTaskReport
=
function
(
name
,
taskKey
,
replyNo
)
{
if
(
!
taskKey
)
taskKey
=
CHK
.
getTaskKeyByName
(
name
);
if
(
!
replyNo
&&
replyNo
!=
0
)
replyNo
=
CHK
.
taskReplyNo
?
CHK
.
taskReplyNo
:
0
;
var
ret
;
if
(
!
CHK
.
taskReport
[
"taskReport_"
+
replyNo
]
||
CHK
.
taskReport
[
"taskReport_"
+
replyNo
].
length
==
0
)
return
ret
;
CHK
.
taskReport
[
"taskReport_"
+
replyNo
].
some
(
function
(
taskReport
)
{
if
(
taskReport
.
taskKey
==
taskKey
)
{
ret
=
taskReport
;
return
true
;
}
});
return
ret
;
}
/**
* 作業の進捗を取得
*
*/
CHK
.
getTaskProgress
=
function
(
name
,
taskKey
)
{
var
ret
=
"0"
;
if
(
!
taskKey
)
taskKey
=
CHK
.
getTaskKeyByName
(
name
);
var
taskReport
=
CHK
.
getRecentVersionReport
(
taskKey
);
if
(
taskReport
&&
taskReport
.
task
)
{
for
(
var
key
in
taskReport
.
task
)
{
if
(
key
.
indexOf
(
"q_3_"
)
!=
-
1
)
{
ret
=
taskReport
.
task
[
key
];
}
}
}
return
ret
;
}
/**
* ホットスポットに設定するhtmlを取得
*
* @param name ホットスポット名
* @param isHotspot true:ホットスポット false:レイヤー
* @param value 表示する値
*/
CHK
.
getHotspotHtml
=
function
(
name
,
isHotspot
,
value
)
{
//新規追加時
if
(
!
value
)
return
"[img src="
+
TARGET_IMAGE
+
" style='width:50px;height:50px;pointer-events:none;'][/img]"
;
var
color
=
CHK
.
getTextColor
(
name
);
if
(
isHotspot
)
{
return
"[font size='4' color='#ffffff' style='border-style:solid;border-width:1px;border-color:#ffffff;padding:5px 15px;background-color:"
+
color
+
";'][b]"
+
value
+
"[/b][/font]"
;
}
else
{
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
DRAWING
)
{
return
"[font color='#ffffff' style='border-style:solid;border-width:1px;border-color:#ffffff;padding:5px 15px;background-color:"
+
color
+
";'][b]"
+
value
+
"[/b][/font]"
;
}
else
{
return
"[font color='#ffffff' style='border-style:solid;border-width:1px;border-color:#ffffff;padding:5px 15px;background-color:"
+
color
+
";'][b]"
+
value
+
"[/b][/font]"
;
}
}
}
/**
* ホットスポットの文字色を取得
*
* @param name ホットスポット名
*/
CHK
.
getTextColor
=
function
(
name
)
{
var
ret
=
"#ff7700"
;
//作業報告時は作業進捗によって文字色を判定
var
progress
=
CHK
.
getTaskProgress
(
name
);
if
(
progress
==
"999"
)
ret
=
"#1b1bd2"
;
return
ret
;
}
/**
* ホットスポット名からtaskKeyを取得
*
* @param name ホットスポット名
*/
CHK
.
getTaskKeyByName
=
function
(
name
)
{
if
(
name
.
indexOf
(
"hs"
)
!=
0
)
return
name
;
// PDFの場合、taskKeyをnameとして送る
return
name
.
substring
(
name
.
indexOf
(
"-"
)
+
1
);
}
/**
* seqIdを採番
*
*/
CHK
.
getNextSeqId
=
function
()
{
var
seqId
=
0
;
CHK
.
taskHotspot
.
hotspot
.
forEach
(
function
(
hotspot
)
{
if
(
Number
(
hotspot
.
seqId
)
>
seqId
)
{
seqId
=
Number
(
hotspot
.
seqId
);
}
});
return
seqId
+
1
;
}
/**
* シーンIDを取得
*
*/
CHK
.
getSceneId
=
function
()
{
var
scene
=
krpano
.
get
(
"xml.scene"
);
return
scene
.
substring
(
5
);
}
/**
* 特定のホットスポットへ視点を移動
*
* @param name ホットスポット名
*/
CHK
.
lookToHotspot
=
function
(
name
)
{
var
fov
=
krpano
.
get
(
"view.fov"
);
krpano
.
call
(
"looktohotspot("
+
name
+
","
+
fov
+
")"
);
}
/**
* UUIDを生成
*
*/
CHK
.
generateUuid
=
function
()
{
var
chars
=
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
.
split
(
""
);
for
(
var
i
=
0
,
len
=
chars
.
length
;
i
<
len
;
i
++
)
{
switch
(
chars
[
i
])
{
case
"x"
:
chars
[
i
]
=
Math
.
floor
(
Math
.
random
()
*
16
).
toString
(
16
);
break
;
case
"y"
:
chars
[
i
]
=
(
Math
.
floor
(
Math
.
random
()
*
4
)
+
8
).
toString
(
16
);
break
;
}
}
return
chars
.
join
(
""
);
}
/**
* URLパラメータを取得
*
*/
CHK
.
getUrlParameter
=
function
()
{
var
ret
;
if
(
location
.
search
)
{
var
param
=
{};
location
.
search
.
substring
(
1
).
split
(
'&'
).
forEach
(
function
(
val
)
{
var
kv
=
val
.
split
(
'='
);
param
[
kv
[
0
]]
=
kv
[
1
];
});
ret
=
param
;
}
console
.
log
({
ret
:
ret
});
return
ret
;
}
/**
* get command of API or Action
*
* @param command name
*/
CHK
.
getCommand
=
function
(
cmd
)
{
if
(
CHK
.
isWeb
)
{
return
CHK
.
actCmd
[
cmd
];
}
else
{
return
CHK
.
apiCmd
[
cmd
];
}
}
/**
* get URL for CMS action
* @param action
*/
CHK
.
getActionUrl
=
function
(
action
)
{
return
CHK
.
getShopUrl
()
+
"taskVtour/"
+
action
+
"/"
+
operationId
+
"/"
;
}
/**
* get shop URL
*/
CHK
.
getShopUrl
=
function
()
{
return
baseUrl
+
"/shop/"
;
}
/**
* 作業報告初期処理、CMS
*
* @param callback コールバック
*/
CHK
.
cmsAjax
=
function
(
url
,
param
,
callback
)
{
$
.
ajax
({
type
:
"POST"
,
url
:
url
,
data
:
param
,
dataType
:
"json"
,
cache
:
false
,
success
:
function
(
result
)
{
if
(
result
.
status
==
"200"
)
{
if
(
callback
)
callback
(
result
);
}
else
{
CHK
.
showDialog
(
result
.
message
,
null
,
null
,
true
);
}
},
error
:
function
(
XMLHttpRequest
,
textStatus
,
errorThrown
)
{
CHK
.
showDialog
(
getMsg
(
"errorOccurred"
),
null
,
null
,
true
);
}
});
}
/**
* ファイル情報のAPI送信処理
*
*/
CHK
.
sendAttachedFile
=
function
(
taskKey
,
key
,
fileName
,
file
,
fileString
,
callback
)
{
var
url
=
CHK
.
getActionUrl
(
CHK
.
apiCmd
.
saveAttached
);
var
formData
=
new
FormData
();
formData
.
append
(
'taskKey'
,
taskKey
);
formData
.
append
(
'attachedKey'
,
key
);
formData
.
append
(
'filename'
,
fileName
);
// ファイル情報がstringかformか区別
if
(
fileString
)
{
formData
.
append
(
'fileString'
,
fileString
);
}
else
{
formData
.
append
(
'formFile'
,
file
,
fileName
);
}
CHK
.
sendEncodedFile
(
url
,
formData
,
callback
);
}
/**
* CMSでのOZDファイル編集後のTempファイル保存処理
*
* @param callback コールバック
*/
CHK
.
saveTempOzdForCms
=
function
(
type
,
taskKey
,
report
,
idx
,
callback
)
{
var
url
=
CHK
.
getActionUrl
(
CHK
.
apiCmd
.
saveAttached
);
var
fileName
=
"taskReportOzd_"
+
idx
;
switch
(
type
)
{
case
CHK
.
REPORT_SAVE_TYPE
.
OZD
:
fileName
+=
".ozd"
;
break
;
case
CHK
.
REPORT_SAVE_TYPE
.
PDF
:
fileName
+=
".pdf"
;
break
;
case
CHK
.
REPORT_SAVE_TYPE
.
JPG
:
fileName
+=
".html"
;
break
;
}
var
formData
=
new
FormData
();
formData
.
append
(
'taskKey'
,
taskKey
);
formData
.
append
(
'attachedKey'
,
type
);
formData
.
append
(
'filename'
,
fileName
);
formData
.
append
(
'ozdFileStr'
,
report
);
formData
.
append
(
'replyNo'
,
CHK
.
taskReplyNo
);
CHK
.
sendEncodedFile
(
url
,
formData
,
callback
);
}
/**
* フォームデータのajaxでの送信処理
*
* @param callback コールバック
*/
CHK
.
sendEncodedFile
=
function
(
url
,
formData
,
callback
)
{
jQuery
.
ajax
({
type
:
"POST"
,
enctype
:
'multipart/form-data'
,
url
:
url
,
data
:
formData
,
processData
:
false
,
contentType
:
false
,
cache
:
false
,
timeout
:
600000
,
success
:
function
(
result
)
{
if
(
result
.
status
==
"200"
)
{
if
(
callback
)
{
callback
(
result
);
if
(
callback
.
subCallback
)
callback
.
subCallback
();
}
}
else
{
CHK
.
showDialog
(
getMsg
(
"errorOccurred"
)
+
"<br>"
+
result
.
message
,
null
,
null
,
true
);
}
},
error
:
function
(
XMLHttpRequest
,
textStatus
,
errorThrown
)
{
CHK
.
showDialog
(
getMsg
(
"errorOccurred"
),
null
,
null
,
true
);
}
});
}
/**
* OZDレポートビューワ表示
*
* @param taskKey 作業タスクキー
*/
CHK
.
showOzdReport
=
function
(
taskKey
,
isPreview
,
saveMessage
,
replyNo
,
taskReportId
,
reportStartDate
)
{
if
(
CHK
.
debug
||
CHK
.
isWeb
)
{
// CMSでのOZDビューア表示処理
// 保存、クリアボタンタップ時の対応
$
(
window
).
off
(
'message'
);
$
(
window
).
on
(
'message'
,
function
(
e
)
{
var
jsonData
=
JSON
.
parse
(
e
.
originalEvent
.
data
);
var
ozdAction
=
jsonData
.
action
;
switch
(
ozdAction
)
{
case
CHK
.
ozdCmd
.
ozdSave
:
{
// OZD形式のファイル保存
// 保存処理が完了すると、PDF保存処理をする
CHK
.
saveTempOzdForCms
(
CHK
.
REPORT_SAVE_TYPE
.
OZD
,
taskKey
,
jsonData
.
report
,
replyNo
,
function
()
{
$
(
"#report_dialog"
).
dialog
(
'close'
);
$
(
"#report_dialog"
).
empty
();
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
setOzdAttachedInfo
(
"taskReportOzd"
,
replyNo
);
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
saveTaskForReport
();
CHK
.
closeLoading
();
});
break
;
}
case
CHK
.
ozdCmd
.
ozdOpened
:
{
CHK
.
closeLoading
();
break
;
}
case
CHK
.
ozdCmd
.
fixed
:
{
// 変更がある場合、OZD保存処理をする
CHK
.
showLoading
(
saveMessage
);
// ダイアログの表示を待つ
setTimeout
(
function
(){
var
message
=
{
action
:
CHK
.
ozdCmd
.
ozdSave
};
$
(
"#reportViewer"
)[
0
].
contentWindow
.
postMessage
(
JSON
.
stringify
(
message
),
"*"
);
},
500
);
break
;
}
case
CHK
.
ozdCmd
.
unfixed
:
{
// 変更がない場合、閉じる処理のみ実行
$
(
"#report_dialog"
).
dialog
(
'close'
);
$
(
"#report_dialog"
).
empty
();
CHK
.
closeLoading
();
break
;
}
}
});
var
src
=
CHK
.
getShopUrl
()
+
"ozdViewer"
+
"?taskId="
+
CHK
.
getTaskId
(
null
,
taskKey
)
+
"&taskKey="
+
taskKey
+
"&operationId="
+
operationId
+
"&reportIdx="
+
CHK
.
taskReplyNo
;
if
(
taskReportId
&&
reportStartDate
)
{
var
taskReportInfoId
=
0
;
var
targetTaskReportInfo
=
CHK
.
taskReport
.
taskReport
.
filter
(
function
(
obj
)
{
return
obj
.
reportStartDate
==
reportStartDate
;
})[
0
];
if
(
targetTaskReportInfo
)
taskReportInfoId
=
targetTaskReportInfo
.
taskReportInfoId
;
src
+=
"&taskReportInfoId="
+
taskReportInfoId
;
}
$
(
"#report_dialog"
).
empty
();
var
buttons
=
{};
buttons
[
getMsg
(
"Close"
)]
=
function
()
{
// 閉じるボタンが押されたことをOZDビューアに通知(変更があるかを確認)
if
(
isPreview
)
{
$
(
"#report_dialog"
).
dialog
(
'close'
);
$
(
"#report_dialog"
).
empty
();
return
;
}
};
// index.htmlのreport_dialogにビューアを挿入
$
(
"#report_dialog"
).
prepend
(
"<iframe id='reportViewer' width='100%' height='100%' src='"
+
src
+
"' style='margin-top:5px;border-width:0px;' >"
+
"</iframe>"
);
$
(
"#report_dialog"
).
dialog
({
dialogClass
:
'noTitleDialog ui-dialog-titlebar dialogNoBorder'
,
autoOpen
:
false
,
resizable
:
false
,
modal
:
true
,
width
:
"80%"
,
height
:
window
.
innerHeight
*
0.9
,
title
:
''
,
// 画面中央へ表示
position
:
{
my
:
'center'
,
at
:
"center"
,
of
:
window
},
buttons
:
buttons
,
open
:
function
(
e
)
{
$
(
e
.
target
).
parent
().
css
(
'background-color'
,
'rgba(128,128,128)'
);
$
(
e
.
target
).
parent
().
children
(
".ui-dialog-buttonpane"
).
css
(
'background-color'
,
'rgba(128,128,128)'
).
css
(
'border'
,
'none'
);
},
close
:
function
()
{
}
});
$
(
"#report_dialog"
).
dialog
(
'open'
);
CHK
.
showLoading
(
getMsg
(
"Processing_w_dot"
));
}
else
{
// アプリへOZD表示コマンドを送信
var
apiParam
=
{};
if
(
taskReportId
)
{
apiParam
.
taskReportId
=
taskReportId
;
apiParam
.
reportStartDate
=
CHK_I
.
getInspectIsoDate
(
new
Date
(
reportStartDate
));
}
// 連続作業の場合
if
(
window
.
parent
.
CHK
.
reportType
==
window
.
parent
.
CHK
.
REPORT_TYPE
.
WORKFLOW
)
{
apiParam
.
phaseNo
=
CHK_PR
.
selectedPhaseInfo
.
phaseNo
;
apiParam
.
processKey
=
CHK_PR
.
selectedProcessKey
;
apiParam
.
addReport
=
addReportFlg
;
// REVIEW 定期点検や報告(回答)も対応させる場合は要動作確認
}
if
(
isPreview
)
{
apiParam
.
cmd
=
CHK
.
getCommand
(
"previewReportOzd"
);
apiParam
.
taskKey
=
taskKey
;
apiParam
.
fileName
=
"taskReport_"
+
CHK
.
taskReplyNo
+
".ozd"
;
apiParam
.
taskReportLevel
=
CHK
.
taskReplyNo
;
CHK
.
sendABookCheckApi
(
apiParam
);
}
else
{
var
fileType
=
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
getOzdFileTypeForApp
();
apiParam
.
cmd
=
CHK
.
getCommand
(
"showReportOzd"
);
apiParam
.
taskKey
=
taskKey
;
apiParam
.
fileName
=
"taskReport_"
+
CHK
.
taskReplyNo
+
"."
+
fileType
.
toLowerCase
();
apiParam
.
localSave
=
localSaveFlg
;
apiParam
.
addReport
=
addReportFlg
;
apiParam
.
taskReportLevel
=
CHK
.
taskReplyNo
;
CHK
.
sendABookCheckApi
(
apiParam
);
}
}
}
/**
* encode string
*
* @param str
*/
CHK
.
encodeParam
=
function
(
str
)
{
if
(
CHK
.
isWeb
)
{
return
str
;
}
else
{
return
encodeURIComponent
(
str
);
}
}
/**
* 自画面を閉じる
*
*/
CHK
.
close
=
function
()
{
if
(
CHK
.
isCms
)
{
if
(
window
.
opener
)
{
window
.
opener
.
location
.
href
=
reloadUrl
;
}
CHK
.
unloadAuth
();
$
(
window
).
unbind
(
"unload"
);
}
window
.
close
();
window
.
open
(
''
,
'_self'
).
close
();
// for chrome
}
/**
* beforeunload処理を登録
*
*/
CHK
.
setBeforeunload
=
function
()
{
if
(
CHK
.
isCms
)
{
$
(
window
).
bind
(
"unload"
,
function
(
eventObject
)
{
CHK
.
unloadAuth
();
if
(
window
.
opener
)
{
window
.
opener
.
location
.
href
=
reloadUrl
;
}
});
}
}
/**
* ロック解除を依頼
*
* @param callback コールバック
*/
CHK
.
unloadAuth
=
function
(
callback
)
{
$
.
ajax
({
async
:
false
,
url
:
CHK
.
getShopUrl
()
+
"vtour/unloadAuth/"
+
contentId
+
"/"
,
cache
:
false
,
success
:
function
(
result
)
{
if
(
callback
)
callback
();
}
});
}
/**
* 拡大、縮小ボタン処理
*
*/
CHK
.
changeZoom
=
function
(
flg
)
{
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
VTOUR
)
{
//360
CHK_V
.
changeZoom
(
flg
);
}
else
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
DRAWING
)
{
//図面
CHK_Z
.
changeZoom
(
flg
);
}
}
/**
* GPS情報を取得
*
* @param gpsType 1:自動 2:手動
*/
CHK
.
getGpsInfo
=
function
(
gpsType
)
{
if
(
CHK
.
isWeb
)
{
if
(
gpsType
==
"1"
)
{
// 自動の場合、web版で何も処理を行わないで処理中のダイアログを非表示にする
CHK
.
closeLoading
();
}
else
{
// 手動
navigator
.
geolocation
.
getCurrentPosition
(
function
(
pos
)
{
var
gps
=
{};
var
crd
=
pos
.
coords
;
if
(
crd
.
latitude
&&
crd
.
longitude
)
{
gps
.
latitude
=
crd
.
latitude
;
gps
.
longitude
=
crd
.
longitude
;
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
getGpsInfoAfter
(
gps
);
}
},
function
(
err
)
{
console
.
log
(
err
.
message
);
CHK
.
closeLoading
();
},
{
enableHighAccuracy
:
true
,
timeout
:
5000
}
);
}
}
else
{
var
apiParam
=
{};
apiParam
.
cmd
=
CHK
.
getCommand
(
"getGpsInfo"
);
apiParam
.
gpsType
=
gpsType
;
apiParam
.
taskReportLevel
=
CHK
.
taskReplyNo
;
CHK
.
sendABookCheckApi
(
apiParam
);
}
//DEBUG
if
(
CHK
.
debug
==
"1"
)
{
var
gps
=
{};
gps
.
latitude
=
35.658
;
gps
.
longitude
=
139.754
;
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
getGpsInfoAfter
(
gps
);
}
}
/**
* アプリのヘルプ用に表示状態の変更を通知
*
* @param displayStatus 表示状態
*/
CHK
.
sendDisplayStatus
=
function
(
displayStatus
,
taskKey
)
{
if
(
CHK
.
isWeb
||
!
addReportFlg
)
return
;
// Webの場合とaddReportFlgがfalseの場合、通知不要
var
apiParam
=
{};
apiParam
.
cmd
=
CHK
.
getCommand
(
"changeDisplayStatus"
);
apiParam
.
statusCode
=
displayStatus
;
apiParam
.
addReport
=
addReportFlg
;
// アプリで値が変わる場合があるため、ここでもパラメータ生成する
if
(
taskKey
&&
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
)
apiParam
.
taskKey
=
taskKey
;
console
.
log
(
apiParam
);
CHK
.
sendABookCheckApi
(
apiParam
);
}
/**
* 作業報告書が表示中かどうかを返す
*
*/
CHK
.
isShowingForm
=
function
()
{
return
$
(
"#checkInput iframe"
).
is
(
":visible"
);
}
/**
* 関連資料ボタンタップ通知
*/
CHK
.
showRelatedContent
=
function
(
urlPath
,
contentId
,
pageNum
)
{
var
apiParam
=
{};
if
(
!
pageNum
)
pageNum
=
1
;
var
key
=
""
;
if
(
CHK
.
isWeb
)
{
var
url
=
CHK
.
getShopUrl
()
+
"checkWebContent/onetimekey/"
+
contentId
+
"/"
CHK
.
getOneTimeKey
(
url
,
function
(
key
)
{
window
.
open
(
"/acms/webvw/checkview.html?urlPath="
+
urlPath
+
"&pageNo="
+
pageNum
+
"&key="
+
key
);
});
}
else
{
apiParam
.
cmd
=
CHK
.
getCommand
(
"showRelatedContent"
);
apiParam
.
contentId
=
contentId
;
apiParam
.
pageNum
=
pageNum
;
console
.
log
(
apiParam
);
CHK
.
sendABookCheckApi
(
apiParam
);
}
}
CHK
.
getOneTimeKey
=
function
(
url
,
callback
)
{
$
.
ajax
({
type
:
"GET"
,
url
:
url
,
cache
:
false
,
success
:
function
(
result
)
{
if
(
callback
)
callback
(
result
);
},
error
:
function
(
XMLHttpRequest
,
textStatus
,
errorThrown
)
{
CHK
.
showDialog
(
getMsg
(
"errorOccurred"
),
null
,
null
,
true
);
}
});
}
/**
* 全ホットスポットの表示・非表示ボタン処理
*
* @showFlg 処理後のホットスポット表示状態 false:非表示 true:表示
*/
CHK
.
toggleHotspotVisible
=
function
(
showFlg
)
{
for
(
var
hotspotIdx
in
CHK
.
taskHotspot
.
hotspot
)
{
var
hotspot
=
CHK
.
taskHotspot
.
hotspot
[
hotspotIdx
];
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
)
{
if
(
showFlg
)
{
$
(
".hotspot[name="
+
hotspot
.
taskKey
+
"]"
).
show
();
}
else
{
$
(
".hotspot[name="
+
hotspot
.
taskKey
+
"]"
).
hide
();
}
}
else
{
var
target
=
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
DRAWING
?
"layer"
:
"hotspot"
;
krpano
.
call
(
"set("
+
target
+
"["
+
hotspot
.
name
+
"].visible, "
+
showFlg
+
")"
);
}
}
}
/**
* アプリOZReport保存処理対応
*
*/
CHK
.
saveOzReport
=
function
()
{
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
setOzdAttachedInfo
(
"taskReport"
,
CHK
.
taskReplyNo
);
// 連続作業の場合シンプルフォームに戻るため保存は行わない
if
(
window
.
parent
.
CHK
.
reportType
!=
window
.
parent
.
CHK
.
REPORT_TYPE
.
WORKFLOW
)
{
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
saveTaskForReport
();
}
}
/**
* アプリOZReport一時保存処理対応
*
*/
CHK
.
localSaveOzReport
=
function
()
{
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
setOzdAttachedInfo
(
"taskReport"
,
CHK
.
taskReplyNo
);
// 連続作業の場合シンプルフォームに戻るため保存は行わない
if
(
window
.
parent
.
CHK
.
reportType
!=
window
.
parent
.
CHK
.
REPORT_TYPE
.
WORKFLOW
)
{
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
saveTaskForReport
(
true
);
}
}
/**
* アプリOZReportキャンセル処理対応
*
*/
CHK
.
cancelOzReport
=
function
()
{
// 連続作業の場合シンプルフォームに戻るためスキップ
if
(
window
.
parent
.
CHK
.
reportType
!=
window
.
parent
.
CHK
.
REPORT_TYPE
.
WORKFLOW
)
{
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
taskClose
();
}
}
/**
* アプリOZReport削除処理対応
*
*/
CHK
.
deleteOzReport
=
function
()
{
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
.
deleteTask
();
}
/**
* タスクの回答情報リストを取得
*
* @param taskKey taskKey
*/
CHK
.
getTaskReplyReportList
=
function
(
taskKey
)
{
var
taskReplyReportList
=
[];
Object
.
keys
(
CHK
.
taskReport
).
forEach
(
function
(
key
)
{
if
(
key
!=
"taskReport_0"
)
{
CHK
.
taskReport
[
key
].
forEach
(
function
(
taskReport
)
{
if
(
taskReport
.
taskKey
==
taskKey
&&
(
taskReport
.
task
||
taskReport
.
hasAuthority
==
CHK
.
HAS_AUTHORITY
.
TRUE
))
{
taskReplyReportList
.
push
(
taskReport
);
return
false
;
}
})
}
});
return
taskReplyReportList
;
}
/**
* タスクフォームの報告・回答転換時、リダイレクトするかしないかを判断
*
* @param taskKey taskKey
*/
CHK
.
isRedirectForm
=
function
(
taskKey
)
{
var
ret
=
true
;
if
(
CHK
.
isCms
||
CHK
.
getTaskReport
(
null
,
taskKey
,
1
)
&&
CHK
.
getTaskReport
(
null
,
taskKey
,
0
).
hasAuthority
!=
CHK
.
getTaskReport
(
null
,
taskKey
,
1
).
hasAuthority
)
ret
=
false
;
return
ret
;
}
/**
* OZレポート表示の場合、checkInputエレメントを透明に設定する
*
*/
CHK
.
setTransparentCheckInput
=
function
()
{
$
(
"#checkInput"
).
css
(
"visibility"
,
"hidden"
);
}
/**
* 一番最近のバージョン値を取得
*
*/
CHK
.
getRecentVersionNum
=
function
(
taskKey
)
{
var
ret
=
0
;
Object
.
keys
(
CHK
.
taskReport
).
forEach
(
function
(
key
)
{
CHK
.
taskReport
[
key
].
forEach
(
function
(
taskReport
)
{
if
(
taskReport
.
taskKey
==
taskKey
&&
taskReport
.
task
&&
taskReport
.
task
.
version
&&
taskReport
.
task
.
version
>
ret
)
{
ret
=
taskReport
.
task
.
version
;
}
});
});
return
ret
;
}
/**
* 一番最近のバージョンのレポートを取得
*
*/
CHK
.
getRecentVersionReport
=
function
(
name
,
taskKey
)
{
var
level
;
if
(
!
taskKey
)
taskKey
=
CHK
.
getTaskKeyByName
(
name
);
var
recentVersion
=
CHK
.
getRecentVersionNum
(
taskKey
);
Object
.
keys
(
CHK
.
taskReport
).
forEach
(
function
(
key
)
{
CHK
.
taskReport
[
key
].
forEach
(
function
(
taskReport
)
{
if
(
taskReport
.
taskKey
==
taskKey
&&
taskReport
.
task
&&
taskReport
.
task
.
version
&&
taskReport
.
task
.
version
==
recentVersion
)
{
level
=
key
.
split
(
"_"
)[
1
];
return
false
;
}
});
if
(
level
||
level
==
"0"
)
return
false
;
});
if
(
!
level
)
level
=
0
;
return
CHK
.
getTaskReport
(
null
,
taskKey
,
level
);
}
//絞り検索
CHK
.
getSelectDataJson
=
function
(
setIndex
,
itemIndex
)
{
if
(
!
CHK
.
questionApertureList
){
return
;
}
//返還するjsonリストを生成する
var
returnList
=
new
Array
();
var
enqueteApertureJson
;
enqueteApertureJson
=
CHK
.
getEnqueteApertureJson
(
setIndex
);
if
(
enqueteApertureJson
!=
null
){
//子グループリスト取得
Object
.
keys
(
enqueteApertureJson
).
forEach
(
function
(
key
)
{
if
(
enqueteApertureJson
[
key
].
parent_id
==
itemIndex
&&
enqueteApertureJson
[
key
].
parent_id
!=
0
)
{
var
itemObject
=
new
Object
();
itemObject
.
id
=
enqueteApertureJson
[
key
].
item_id
;
itemObject
.
value
=
enqueteApertureJson
[
key
].
item_name
;
returnList
.
push
(
itemObject
);
}
});
}
// ID順にソートして返却
returnList
.
sort
(
function
(
a
,
b
)
{
return
a
.
id
-
b
.
id
;
});
return
returnList
;
}
CHK
.
getEnqueteApertureJson
=
function
(
setIndex
){
var
enqueteApertureJson
=
new
Object
();
var
apertureList
=
CHK
.
questionApertureList
;
var
enqueteKey
=
"set_"
+
setIndex
;
Object
.
keys
(
apertureList
).
forEach
(
function
(
key
)
{
if
(
key
==
enqueteKey
)
{
enqueteApertureJson
=
apertureList
[
key
];
}
});
return
enqueteApertureJson
;
}
/**
* setからitemIdと同じparent_idを持っているitemを探してListをreturnする
*/
CHK
.
getApertureSiblingList
=
function
(
setId
,
itemId
)
{
var
currentId
=
itemId
;
var
itemDepth
=
-
1
;
var
returnList
=
new
Array
();
var
enqueteApertureJson
=
CHK
.
getEnqueteApertureJson
(
setId
);
var
parent_id
;
if
(
currentId
!=
""
)
{
if
(
enqueteApertureJson
!=
null
)
{
Object
.
keys
(
enqueteApertureJson
).
forEach
(
function
(
key
)
{
if
(
enqueteApertureJson
[
key
].
item_id
==
currentId
)
{
itemDepth
=
enqueteApertureJson
[
key
].
depth
;
parent_id
=
enqueteApertureJson
[
key
].
parent_id
;
}
});
}
}
if
(
itemDepth
!=
-
1
)
{
if
(
enqueteApertureJson
!=
null
){
Object
.
keys
(
enqueteApertureJson
).
forEach
(
function
(
key
){
if
(
enqueteApertureJson
[
key
].
parent_id
==
parent_id
&&
enqueteApertureJson
[
key
].
depth
==
itemDepth
)
{
var
itemObject
=
new
Object
();
itemObject
.
id
=
enqueteApertureJson
[
key
].
item_id
;
itemObject
.
value
=
enqueteApertureJson
[
key
].
item_name
;
returnList
.
push
(
itemObject
);
}
});
}
}
// ID順にソートして返却
returnList
.
sort
(
function
(
a
,
b
)
{
return
a
.
id
-
b
.
id
;
});
return
returnList
;
}
/**
* 報告グループチェック時、報告グループ情報返還
* 絞り検索例外チェック処理追加
*/
CHK
.
getCheckResultGroupDataExist
=
function
(
setNo
,
itemId
)
{
var
result
=
new
Object
();
result
.
saveFlag
=
false
;
result
.
group_id
=
0
;
var
enqueteApertureJson
=
CHK
.
getEnqueteApertureJson
(
setNo
);
if
(
CHK
.
workingGroup
==
null
){
return
result
;
}
Object
.
keys
(
enqueteApertureJson
).
forEach
(
function
(
key
)
{
if
(
enqueteApertureJson
[
key
].
item_id
==
itemId
)
{
if
(
enqueteApertureJson
[
key
].
group_flag
)
{
if
(
Object
.
keys
(
CHK
.
workingGroup
).
length
>
0
)
{
Object
.
keys
(
CHK
.
workingGroup
).
forEach
(
function
(
taskGroup
){
var
groupList
=
CHK
.
workingGroup
[
taskGroup
];
Object
.
keys
(
groupList
).
forEach
(
function
(
group
){
if
(
enqueteApertureJson
[
key
].
group_id
==
groupList
[
group
].
groupId
)
{
result
.
group_id
=
groupList
[
group
].
groupId
;
result
.
saveFlag
=
true
;
result
.
groupName
=
groupList
[
group
].
groupName
;
}
});
});
}
}
}
});
return
result
;
}
//#Bug 34466 関連対応
/**
* Androidで修正したイメージのThumbnailを更新する。
*
* @param filename ファイル名
* @param base64String base64ファイルデーター
*/
CHK
.
changeReportFormThumbnailImageForiOS
=
function
(
filename
,
base64String
)
{
var
targetContentwindow
;
if
(
$
(
"#checkInput"
).
find
(
"iframe#reportForm0"
).
length
)
{
targetContentwindow
=
$
(
"#checkInput"
).
find
(
"iframe#reportForm"
+
CHK
.
taskReplyNo
)[
0
].
contentWindow
;
}
else
{
targetContentwindow
=
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
;
}
targetContentwindow
.
changeThumbnailTag
(
filename
,
base64String
);
}
//#Bug 34466 関連対応
/**
* Androidで修正したイメージのThumbnailを更新する。
*
* @param filePath ファイルパス
* @param fileName ファイル名
*/
CHK
.
changeReportFormThumbnailImageForAnd
=
function
(
filename
,
filePath
){
var
targetContentwindow
;
if
(
$
(
"#checkInput"
).
find
(
"iframe#reportForm0"
).
length
)
{
targetContentwindow
=
$
(
"#checkInput"
).
find
(
"iframe#reportForm"
+
CHK
.
taskReplyNo
)[
0
].
contentWindow
;
}
else
{
targetContentwindow
=
$
(
"#checkInput"
).
find
(
"iframe"
)[
0
].
contentWindow
;
}
targetContentwindow
.
changeThumbnailTagForAnd
(
filename
,
filePath
);
}
/**
* フォーム作成・切り替え時のフレーム表示処理
* ロード終了時に非表示にする
* フォームを閉じる時に削除
*
*/
CHK
.
showWhiteFrame
=
function
()
{
if
(
CHK
.
reportType
==
CHK
.
REPORT_TYPE
.
INSPECT
)
return
;
if
(
$
(
"#whiteFrame"
).
length
==
0
)
{
$
(
"#checkInput"
).
after
(
$
(
"<div/>"
,
{
id
:
"whiteFrame"
}));
}
if
(
CHK
.
isWeb
)
{
$
(
"#whiteFrame"
).
css
(
"height"
,
"calc(100% - 36px)"
);
$
(
"#whiteFrame"
).
css
(
"top"
,
"36px"
);
}
else
if
(
CHK
.
operationType
==
CHK
.
OPERATION_TYPE
.
PDF
)
{
$
(
"#whiteFrame"
).
css
(
"background-color"
,
"#5c5c5c"
);
}
// リストではない場合フレームのサイズやオフセットを調整する
if
(
CHK
.
operationType
!=
CHK
.
OPERATION_TYPE
.
LIST
)
{
$
(
"#whiteFrame"
).
width
(
$
(
"#checkInput"
).
width
());
$
(
"#whiteFrame"
).
css
(
"right"
,
$
(
"#checkInput"
).
css
(
"right"
));
}
$
(
"#whiteFrame"
).
show
();
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment