teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

標題を質問内容と一致させました。

2021/12/13 07:18

投稿

ikesan
ikesan

スコア2

title CHANGED
@@ -1,1 +1,1 @@
1
- Javascriptの処理について
1
+ Javascript(JQuery)の処理について
body CHANGED
File without changes

1

全体を見た方が把握できるのではないかとのご指摘を頂いたので、全体のコードも追加いたします。

2021/12/13 07:18

投稿

ikesan
ikesan

スコア2

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,134 @@
1
- このコードについて、Javascript内でどのような処理をしているのかという事が理解できません。
1
+ ```html
2
+ <!DOCTYPE html>
3
+ <html lang="ja"
4
+ xmlns:th="http://www.thymeleaf.org"
5
+ xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
6
+ layout:decorate="~{common/layout}"
7
+ xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity">
8
+
9
+ <head>
10
+ <title>アカウント一覧</title>
11
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
12
+ </head>
13
+
14
+ <body id="page" class="staft">
15
+ <!-- ヘッダー -->
16
+ <label layout:fragment="headerTitle" class="headerTitle">アカウント一覧</label>
17
+ <!-- パンクズ -->
18
+ <th:block layout:fragment="breadcrumb" >
19
+ <label class="fLeft">アカウント一覧</label>
20
+ </th:block>
21
+
22
+ <!-- 本文 -->
23
+ <div layout:fragment="contents">
24
+ <script type="text/javascript">
25
+ // アカウント登録画面遷移用
26
+ function seqNo(obj){
27
+ // SEQ No
28
+ var seqNo = $(obj).parent().parent().find('input:hidden[name="id.seqNo"]').val();
29
+ $('form.accountRegistForm').children('input:hidden[name="seqNo"]').val(seqNo);
30
+ // submit
31
+ $('form.accountRegistForm').submit();
32
+ return false;
33
+ }
34
+ // ログイン履歴画面遷移用
35
+ function userId(obj){
36
+ // userId
37
+ var userId = $(obj).parent().parent().find('input:hidden[name="id.userId"]').val();
38
+ $('form.accountLoginHistoryListForm').children('input:hidden[name="userId"]').val(userId);
39
+ // submit
40
+ $('form.accountLoginHistoryListForm').submit();
41
+ return false;
42
+ }
43
+ </script>
44
+ <div class='wrapTypeB'>
45
+ <form id='edit_form' name='edit_form' th:action="@{/maintenance/account/list}" th:object="${accountListForm}" method="post">
46
+ <!-- エラーメッセージ -->
47
+ <th:block th:replace="common/erromsg :: errorMessage"></th:block>
48
+ <!-- 検索結果0件メッセージ -->
49
+ <th:block th:replace="common/erromsg :: noResultMessage"></th:block>
50
+ </form>
51
+ <!-- 処理完了メッセージ -->
52
+ <th:block th:replace="common/erromsg :: completeMessage"></th:block>
53
+ </div>
54
+ <div class='clearfix' style="margin-left: 50px; margin-top: 10px;">
55
+ <div class='input'>
56
+ <form id='edit_form' name='edit_form' th:action="@{/maintenance/account/regist}" method="post" th:if="${#authentication.principal.mAccount.authorityKbn.value} == ${T(com.pssj.saie.manager.app.common.consts.AuthorityKbn).SYSTEM_ADMIN.getValue()}">
57
+ <input type="submit" value="新規登録" class="fNone fRight w80 mainBtn" th:classappend="${@authority.isLimit('/maintenance/account/list','create')}">
58
+ </form>
59
+ <form th:action="@{/maintenance/account/list}" th:object="${accountListForm}" method="post">
60
+ <!-- 検索キー -->
61
+ <input type='text' th:field="*{searchKey}" maxlength="255" class='w200' th:errorclass="fieldError">
62
+ <input type="hidden" name="size" th:value="*{pageWrapper.page.size}" />
63
+ <input type="submit" name="search" value="検索" class="fNone fLeft w80 mL12 mainBtn" th:classappend="${@authority.isLimit('/maintenance/account/list','search')}">
64
+ <th:block th:replace="common/erromsg :: formErrorMessage(formName = 'searchKey')"></th:block>
65
+ </form>
66
+ </div>
67
+ <div style="display:flex;width:100%">
68
+ <!-- 検索結果、表示プルダウン -->
69
+ <th:block th:replace="common/pagination :: pageSize('/maintenance/account/list', ${accountListForm})"></th:block>
70
+ <!-- ページング -->
71
+ <th:block th:replace="common/pagination :: paginationbar(${accountListForm})"></th:block>
72
+ </div>
73
+ <div>
74
+ <div>
75
+ <table id='tablearea' class="fLeft tableareaB" th:unless="${accountListForm.pageWrapper.page.getTotalElements() == 0}">
76
+ <thead>
77
+ <tr class='tableheader'>
78
+ <th scope="col" style="width:125px">ユーザーID</th>
79
+ <th scope="col" style="width:125px">ユーザー名</th>
80
+ <th scope="col" style="width: 125px;">所属</th>
81
+ <th scope="col" style="width: 100px;">利用権限</th>
82
+ <th scope="col" style="width: 150px;">画像確認許可</th>
83
+ <th scope="col" style="width: 150px;">最終ログイン日時</th>
84
+ </tr>
85
+ </thead>
86
+ <tbody th:if="${accountListForm.pageWrapper != null}">
87
+ <tr th:each="line, stat : ${accountListForm.pageWrapper.page}">
88
+ <td style="text-align: left">
89
+ <input type="hidden" name="id.seqNo" th:value="${line.id.seqNo}" />
90
+ <a class="linkTitle" href="javascript:void(0);" th:text="${line.id.userId}" onclick="seqNo(this)" th:classappend="${@authority.isLimit('/maintenance/account/list','userId')}"></a>
91
+ </td>
92
+ <td style="text-align: left" th:text="${line.userName}"></td>
93
+ <td style="text-align: left" th:if="${line.userDep != null}" th:text="${line.userDep}"></td>
94
+ <td style="text-align: left" th:if="${line.userDep == null}">-</td>
95
+ <td style="text-align: left" th:text="${line.authorityKbn.text}"></td>
96
+ <td style="text-align: left" th:if="${line.angleauthFlg == null}">許可なし</td>
97
+ <td style="text-align: left" th:if="${line.angleauthFlg != null}">
98
+ <label th:if="${line.angleauthFlg.value} == ${T(com.pssj.saie.manager.app.common.consts.AngleauthFlg).WITHOUT_PERMISSION.getValue()}" th:text="${line.angleauthFlg.text}">
99
+ </label>
100
+ <label th:if="${line.angleauthFlg.value} == ${T(com.pssj.saie.manager.app.common.consts.AngleauthFlg).WITH_PERMISSION.getValue()}" th:text="${line.angleauthFlg.text} + ' (' + ${#temporals.format(line.angleauthFrom, 'yyyy/MM/dd')} + ' ~ ' + ${#temporals.format(line.angleauthTo, 'yyyy/MM/dd')} + ')'">
101
+ </label>
102
+ </td>
103
+ <td>
104
+ <input type="hidden" name="id.userId" th:value="${line.id.userId}" />
105
+ <a class="linkTitle" href="javascript:void(0);" th:if="${line.lastLoginDatetime != null}" th:text="${#temporals.format(line.lastLoginDatetime, 'yyyy/MM/dd HH:mm:ss')}" onclick="userId(this)" th:classappend="${@authority.isLimit('/maintenance/account/loginHistory','search')}">
106
+ </a>
107
+ <label th:if="${line.lastLoginDatetime == null}" th:text="ログイン履歴なし">
108
+ </label>
109
+ </td>
110
+ </tr>
111
+ </tbody>
112
+ </table>
113
+ </div>
114
+ </div>
115
+ <!-- ページング -->
116
+ <th:block th:replace="common/pagination :: paginationbar(${accountListForm})"></th:block>
117
+ <th:block th:replace="common/pagination :: form('/maintenance/account/list', ${accountListForm})"></th:block>
118
+ <!-- 新規登録画面遷移用のForm -->
119
+ <form th:action="@{/maintenance/account/regist}" th:object="${accountRegistForm}" name="accountLRegistForm" method="post" class="accountRegistForm">
120
+ <!-- SEQNo -->
121
+ <input type="hidden" name="seqNo" />
122
+ </form>
123
+ <!-- ログイン履歴画面遷移用のForm -->
124
+ <form th:action="@{/maintenance/account/loginHistory}" th:object="${accountLoginHistoryListForm}" name="accountLoginHistoryListForm" method="post" class="accountLoginHistoryListForm">
125
+ <input type="hidden" name="userId" />
126
+ </form>
127
+ </div>
128
+ </div>
129
+ </body>
130
+ </html>
131
+ ```このコードについて、Javascript内でどのような処理をしているのかという事が理解できません。
2
132
  具体的にこのコードはどのような処理をしているのでしょうか?
3
133
  ```Javascript
4
134
  <script type="text/javascript">