loginPC.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
  5. <meta http-equiv="Pragma" content="no-cache" />
  6. <meta http-equiv="Expires" content="0" />
  7. <meta charset="utf-8">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  9. <link rel="shortcut icon" href="/img/logo.png" />
  10. <link rel="bookmark" href="/img/logo.png" />
  11. <link rel="stylesheet" href="/plugins/bootstrap-4.3.1/css/bootstrap.min.css">
  12. <link rel="stylesheet" href="/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
  13. <link rel="stylesheet" href="/main/common/StyleSheet.css" />
  14. <script src="/Plugins/jquery-3.4.1/jquery-3.4.1.min.js"></script>
  15. <script src="/Plugins/jquery.easing/jquery.easing.min.js"></script>
  16. <script src="/Plugins/virtualkeyboard/xvirtualkeyboard.js"></script>
  17. <title>东科软件</title>
  18. </head>
  19. <body class="bg-light">
  20. <!--导航菜单-->
  21. <script src="/main/common/navbar.js"></script>
  22. <div class="container pt-4">
  23. <!--登录窗体-->
  24. <form id="登录窗体" class="p-5 rounded shadow-sm bg-white position-absolute" style="width:350px;top:50%;margin-top:-800px;left:50%;margin-left:-175px;">
  25. <h5 class="text-center">用户登录</h5>
  26. <div class="form-row pt-3">
  27. <div class="form-group col-12">
  28. <label class="sr-only" for="登录类型">登录类型</label>
  29. <div class="input-group mb-2 ">
  30. <div class="input-group-prepend">
  31. <div class="input-group-text" style="width:40px;"><i class="fa fa-cog " aria-hidden="true"></i></div>
  32. </div>
  33. <select class="custom-select" id="登录类型">
  34. <option value="1">打卡并登录工位</option>
  35. <option value="0">仅打卡</option>
  36. </select>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="form-row">
  41. <div class="form-group col-12">
  42. <label class="sr-only" for="账套">账套</label>
  43. <div class="input-group mb-2">
  44. <div class="input-group-prepend">
  45. <div class="input-group-text" style="width:40px;"><i class="fa fa-address-book-o" aria-hidden="true"></i></div>
  46. </div>
  47. <input value="dongke" type="text" class="form-control" id="账套" placeholder="请输入账套">
  48. </div>
  49. </div>
  50. </div>
  51. <div class="form-row">
  52. <div class="form-group col-12">
  53. <label class="sr-only" for="用户">用户</label>
  54. <div class="input-group mb-2">
  55. <div class="input-group-prepend">
  56. <div class="input-group-text" style="width:40px;"><i class="fa fa-user" aria-hidden="true"></i></div>
  57. </div>
  58. <input onkeyup="this.value=this.value.toUpperCase()" value="" type="text" class="form-control" id="用户" placeholder="请输入用户">
  59. </div>
  60. </div>
  61. </div>
  62. <div class="form-row">
  63. <div class="form-group col-12">
  64. <label class="sr-only" for="密码">密码</label>
  65. <div class="input-group mb-2">
  66. <div class="input-group-prepend">
  67. <div class="input-group-text" style="width:40px;"><i class="fa fa-key" aria-hidden="true"></i></div>
  68. </div>
  69. <input onkeydown="if (event.keyCode == 13) doLogin();" type="password" class="form-control" id="密码" placeholder="请输入密码">
  70. </div>
  71. </div>
  72. </div>
  73. <div class="form-row col-12 justify-content-center">
  74. <button onclick="loginButton_onClick()" type="button" class="btn btn-danger" style="width:100px;">登录</button>&nbsp;&nbsp;
  75. <button type="reset" class="btn btn-secondary" style="width:100px;">重置</button>
  76. </div>
  77. </form>
  78. <!--工位窗体-->
  79. <form id="工位窗体" class="p-5 rounded shadow-sm bg-white position-absolute" style="width:350px;top:50%;margin-top:-800px;left:50%;margin-left:-175px;">
  80. <h5 class="text-center">请您确认工位</h5>
  81. <div class="form-row pt-3">
  82. <div class="form-group col-12">
  83. <label class="sr-only" for="工位">工位</label>
  84. <div class="input-group mb-2 ">
  85. <div class="input-group-prepend">
  86. <div class="input-group-text" style="width:40px;"><i class="fa fa-share-alt" aria-hidden="true"></i></div>
  87. </div>
  88. <select class="custom-select" id="工位">
  89. </select>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="form-row col-12 justify-content-center">
  94. <button onclick="workButton_onClick()" type="button" class="btn btn-danger" style="width:100px;">确定</button>&nbsp;&nbsp;
  95. <button type="reset" class="btn btn-secondary" style="width:100px;">重置</button>
  96. </div>
  97. </form>
  98. <!--打卡窗体-->
  99. <form id="打卡窗体" class="pt-5 pb-5 rounded shadow-sm bg-white position-absolute" style="width:600px;top:50%;margin-top:-800px;left:50%;margin-left:-300px;">
  100. <h5 class="text-center">请您确认当前工号员工</h5>
  101. <div class="form-row pt-3 pl-5">
  102. <div id="工号员工模板" style="display:none">
  103. <label class="checkbox-inline pt-2" style="width:250px;border-bottom:1px solid lightgray">
  104. <input type="checkbox" value="{STAFFID}"> {STAFFCODE} {STAFFNAME} {JOBSNAME}
  105. </label>
  106. </div>
  107. <!--<div id="工号员工模板" style="display:none">
  108. <label class="checkbox-inline" style="width:90px;">
  109. <input type="checkbox" value="{STAFFID}"> {STAFFNAME}
  110. </label>
  111. </div>-->
  112. <div id="工号员工" class="form-group" style="font-size:18px;">
  113. </div>
  114. </div>
  115. <div class="form-row col-12 justify-content-center">
  116. <button onclick="regButton_onClick()" type="button" class="btn btn-danger" style="width:100px;">确定</button>&nbsp;&nbsp;
  117. <button type="reset" class="btn btn-secondary" style="width:100px;">重置</button>
  118. </div>
  119. </form>
  120. </div>
  121. <!--版权信息-->
  122. <script src="/main/common/footer.js"></script>
  123. <script src="/Plugins/bootstrap-4.3.1/js/bootstrap.bundle.min.js"></script>
  124. <script src="/Plugins/sweetalert/sweetalert.min.js"></script>
  125. <script src="/Plugins/xrequest/xrequest.min.js"></script>
  126. <script src="/Plugins/md5/md5.js"></script>
  127. <script src="/main/common/xuwell.js"></script>
  128. <script>
  129. var workStation = [];
  130. $(function () {
  131. $('#登录窗体').animateShow();
  132. });
  133. function keyBoard() {
  134. //启用软键盘
  135. $('#账套').keyboard({ usePreview: false, autoAccept: true });
  136. $('#用户').keyboard({ usePreview: false, autoAccept: true });
  137. $('#密码').keyboard({ usePreview: false, autoAccept: true });
  138. swal({
  139. title: '用户登录',
  140. text: '软键盘已加载!',
  141. icon: 'success',
  142. button: '确定'
  143. });
  144. }
  145. //登录按钮
  146. function loginButton_onClick() {
  147. console.log('账套:' + $('#账套').val() + ' 用户名:' + $('#用户').val() + ' 密码:' + hex_md5($('#密码').val()).toUpperCase());
  148. doLogin();
  149. }
  150. //打卡按钮
  151. function regButton_onClick() {
  152. console.log('工号员工:' + $('#工号员工').getCheckBoxVal());
  153. $('#打卡窗体').animateHide();
  154. doRegSave();
  155. }
  156. //工位按钮
  157. function workButton_onClick() {
  158. //$("#工位").find("option:selected").text();
  159. console.log('工位:' + $('#工位').val());
  160. if ($('#工位').val() != '') {
  161. $('#工位窗体').animateHide();
  162. $('#打卡窗体').animateShow(doRegLoad());
  163. }
  164. else {
  165. swal({
  166. title: '工位选择',
  167. text: '请您选择工位!',
  168. icon: 'error',
  169. button: '确定'
  170. });
  171. }
  172. }
  173. //登录处理
  174. function doLogin() {
  175. swal({
  176. title: '用户登录',
  177. text: '正在登录,请稍候。。。',
  178. icon: 'info',
  179. button: false,
  180. closeOnClickOutside: false
  181. });
  182. var loginData = {
  183. 'accountCode': $('#账套').val(),
  184. 'userCode': $('#用户').val(),
  185. 'userPassword': hex_md5($('#密码').val()).toUpperCase()
  186. };
  187. $.get('api/LogIn_WCF.ashx', loginData, function (data) {
  188. swal.close();
  189. var json = JSON.parse(data);
  190. if (json['Status'] == '0') {
  191. //登录成功
  192. $('#登录窗体').animateHide();
  193. $('#工位窗体').animateShow(doWorkLoad());
  194. }
  195. else {
  196. swal({
  197. title: '登录失败!',
  198. text: json['Message'],
  199. icon: 'error',
  200. button: '确定'
  201. });
  202. }
  203. });
  204. }
  205. //打卡数据读取
  206. function doRegLoad() {
  207. $('#工号员工').loadHtml('api/GetWorkStationUser.ashx?UserCode=' + $('#用户').val() + '&WorkstationId=' + $('#工位').val() , '#工号员工模板', function (data) {
  208. console.log(data);
  209. $.get('api/GetClassesUser.ashx?UserCode=' + $('#用户').val(), function (data) {
  210. var json = JSON.parse(data);
  211. if (json['success'] == true) {
  212. if (json['rows'].length > 0) $('#工号员工').setCheckBoxVal(json['rows'][0]['STAFFID']);
  213. }
  214. else {
  215. //数据读取失败
  216. }
  217. });
  218. });
  219. }
  220. //打卡数据保存 登录类型 1:打卡并登录工位 0:只打卡不登录工位
  221. function doRegSave() {
  222. console.log($('#登录类型').val());
  223. //打卡操作
  224. $.get('api/GetWorkStationUserReg.ashx', {
  225. 'UserCode': $('#用户').val(),
  226. 'WorkstationId':$('#工位').val(),
  227. 'StaffId': $('#工号员工').getCheckBoxVal()
  228. }, function (data) {
  229. var json = JSON.parse(data);
  230. if (json['success'] == true) {
  231. //打卡成功
  232. swal({
  233. title: '用户登录',
  234. text: '工号 ' + $('#用户').val() + ' 打卡成功!',
  235. icon: 'success',
  236. button: '确定'
  237. }).then(function () {
  238. //按登录类型执行
  239. if ($('#登录类型').val() == "1") {
  240. //登录工位
  241. for (var i = 0; i < workStation.length; i++) {
  242. if (workStation[i]['ID'].toString() == $('#工位').val()) {
  243. window.location.href = workStation[i]['TYPEURL'];
  244. }
  245. }
  246. }
  247. else {
  248. //不登录工位
  249. $('#用户').val('');
  250. $('#密码').val('');
  251. $('#用户').focus();
  252. $('#登录窗体').animateShow();
  253. }
  254. });
  255. }
  256. else {
  257. //打卡失败
  258. swal({
  259. title: '用户登录',
  260. text: '工号 ' + $('#用户').val() + ' 打卡失败!',
  261. icon: 'success',
  262. button: '确定'
  263. });
  264. //跳回到登录窗体
  265. $('#用户').val('');
  266. $('#密码').val('');
  267. $('#用户').focus();
  268. $('#登录窗体').animateShow();
  269. }
  270. });
  271. }
  272. //工位数据加载
  273. function doWorkLoad() {
  274. $('#工位').loadSelect('api/GetWorkStation.ashx?UserCode=' + $('#用户').val(), function (data) {
  275. console.log(data);
  276. $('#工位').get(0).selectedIndex = 1;
  277. workStation = data["rows"];
  278. });
  279. }
  280. //工位数据保存
  281. function doWorkSave() {
  282. }
  283. //跳转到工位模块
  284. function doPage() {
  285. }
  286. </script>
  287. </body>
  288. </html>