Pastebin: HTML JavaScriptソースメモ

Format
Plain text
Post date
2016-12-06 23:34
Publication Period
Unlimited
  1. HTML
  2. <!DOCTYPE html>
  3. <html lang="ja">
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <title>シフト管理サンプル</title>
  8. <link rel="stylesheet" href="../../style.css" type="text/css">
  9. <link rel="stylesheet" href="PC005.css" type="text/css">
  10. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
  11. <script type="text/javascript" src="../../01_common/import.js"></script>
  12. <script type="text/javascript" src="/PACLibrary/header.js"></script>
  13. <script type="text/javascript" src="PC005.js"></script>
  14. </head>
  15. <body class="clearfix">
  16. <script type="text/javascript">header(true);</script>
  17. <script type="text/javascript">sideMenu(false);</script>
  18. <div class="wrapper clearfix">
  19. <h3>作業区分マスタ保守</h3>
  20. <table class="table" id="work_kbn_table_id">
  21. <tr>
  22. <th>作業区分</th>
  23. <th>作業区分名</th>
  24. <th>編集</th>
  25. </tr>
  26. </table>
  27. <table class="form">
  28. <tr>
  29. <th>作業区分</th>
  30. <td><input type="text" id="work_kbn_input"/></td>
  31. <th>作業区分名</th>
  32. <td><input type="text" id="work_name_input"/></td>
  33. </tr>
  34. </table>
  35. <ul class="button-list">
  36. <li><input type="button" class="button_delete" id="button_delete" value="廃 止" /></li>
  37. <li><input type="button" class="button_insert" id="button_insert" value="保 存" /></li>
  38. <li><input type="button" class="button_clear" id="button_clear" value="クリア" /></li>
  39. </ul>
  40. </div>
  41. <script type="text/javascript">footer();</script>
  42. </body>
  43. </html>
  44. js
  45. /**
  46. * 画面ID:PC005
  47. * 画面名:作業区分マスタ
  48. */
  49. const SCREEN_ID = 'PC005';
  50. var work_kbn = document.getElementById("work_kbn") ;
  51. var work_name = document.getElementById("work_name") ;
  52. var button_edit = document.getElementById("button_edit") ;
  53. var work_kbn_input = document.getElementById("work_kbn_input") ;
  54. var work_name_input = document.getElementById("work_name_input") ;
  55. var button_delete = document.getElementById("button_delete") ;
  56. var button_insert = document.getElementById("button_insert") ;
  57. var button_clear = document.getElementById("button_clear") ;
  58. doAjax() ;
  59. function doAjax(){
  60. $.ajax({
  61. url: API_PATH + "/action/PC005" ,
  62. typr: 'GET' ,
  63. dataType: 'json'
  64. })
  65. .done(success)
  66. .fail(error)
  67. function success(jsonData){
  68. if( jsonData.result == true && Object.keys(jsonData).length > 0 ){
  69. var table = document.getElementById("work_kbn_table_id") ;
  70. var button_delete = document.getElementById("button_delete") ;
  71. var button_insert = document.getElementById("button_insert") ;
  72. var button_clear = document.getElementById("button_clear") ;
  73. var json_Array = [] ;
  74. var json_indent = 0 ;
  75. select( jsonData , json_Array , json_indent) ;
  76. data( json_Array , json_indent ,table ) ;
  77. }else{
  78. alert("NO!") ;
  79. }
  80. }
  81. function error(jsonData){
  82. alert("ERROR!") ;
  83. }
  84. }
  85. function select(jsonData , json_Array , json_indent ){
  86. for( var k = 0 ; k < jsonData.data.length ; k++ ){
  87. json_Array[json_indent] = {
  88. 'EigyoCd' : jsonData.data[k].eigyoCd
  89. , 'WorkKbn' : jsonData.data[k].workKbn
  90. , 'WorkName' : jsonData.data[k].workName
  91. , 'DeleteFlag' : jsonData.data[k].delFlg
  92. , 'UpdateCount' : jsonData.data[k].updateCount
  93. , 'CreateDt' : jsonData.data[k].createDt
  94. , 'CreateTermid' : jsonData.data[k].createTermid
  95. , 'CreatePgmid' : jsonData.data[k].createPgmid
  96. , 'UpdateDt' : jsonData.data[k].updateDt
  97. , 'UpdateTermid' : jsonData.data[k].updateTermid
  98. , 'UpdatePgmid' : jsonData.data[k].updatePgmid
  99. }
  100. json_indent++ ;
  101. }
  102. }
  103. function data(json_Array , json_indent , table ){
  104. var work_kbn = document.getElementById("work_kbn") ;
  105. var work_name = document.getElementById("work_name") ;
  106. for (var j = 0 ; j < json_Array.length ; j++ ){
  107. // 行を行末に追加
  108. var row = table.insertRow(-1);
  109. // セルの挿入
  110. var cell1 = row.insertCell(-1);
  111. cell1.appendChild(document.createTextNode(json_Array[j].WorkKbn)) ;
  112. var cell2 = row.insertCell(-1);
  113. cell2.appendChild(document.createTextNode(json_Array[j].WorkName)) ;
  114. var cell3 = row.insertCell(-1);
  115. // cell3.appendChild(button_edit) ;
  116. }
  117. }
Download Printable view

URL of this paste

Embed with JavaScript

Embed with iframe

Raw text