update_process.ftl 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. <style>
  7. article, section, time, aside {
  8. display: block;
  9. }
  10. .point-time {
  11. content: "";
  12. position: absolute;
  13. width: 15px;
  14. height: 15px;
  15. line-height: 15px;
  16. top: 35%;
  17. left: 48%;
  18. background: #1c87bf;
  19. margin-left: -5px;
  20. border-radius: 50%;
  21. box-shadow: 0 0 0 5px #fff;
  22. font-size: 12px;
  23. text-align: center;
  24. color: #fff;
  25. }
  26. .text-red {
  27. color: #f6393f;
  28. }
  29. .text-blue {
  30. color: #1c87bf;
  31. }
  32. .text-green {
  33. color: #999;
  34. }
  35. .text-yellow {
  36. color: #ffb902;
  37. }
  38. .text-purple {
  39. color: #d32d93;
  40. }
  41. .text-left{
  42. text-align: left;
  43. text-indent: 1em;
  44. }
  45. .text-right{
  46. text-align: right;
  47. padding-right: 1em;
  48. }
  49. .point-red {
  50. background-color: #f6393f;
  51. }
  52. .point-blue {
  53. background-color: #1c87bf;
  54. }
  55. .point-green {
  56. background-color: #95c91e;
  57. }
  58. .point-yellow {
  59. background-color: #ffb902;
  60. }
  61. .point-gray {
  62. background-color: #999;
  63. }
  64. .point-purple {
  65. background-color: #d32d93;
  66. }
  67. .content {
  68. width: 100%;
  69. margin: 0 auto;
  70. }
  71. .content article {
  72. position: relative;
  73. }
  74. .content article > h3 {
  75. width: 100%;
  76. text-align: center;
  77. font-size: 1.4em;
  78. color: #fff;
  79. padding: 10px 0 20px;
  80. background-color: #32a3d8;
  81. margin: 0 0 10px 0;
  82. }
  83. .content article section {
  84. padding: 10px 0 10px;
  85. position: relative;
  86. }
  87. .content article section:before {
  88. content: "";
  89. width: 5px;
  90. top: 23px;
  91. bottom: -50px;
  92. left: 48%;
  93. background: #e6e6e6;
  94. position: absolute;
  95. }
  96. .content article section:last-child:before {
  97. display: none;
  98. }
  99. .content article section time {
  100. width: 45%;
  101. display: block;
  102. position: absolute;
  103. text-align: right;
  104. }
  105. .content article section time > span {
  106. display: block;
  107. }
  108. .content article section aside {
  109. color: #3a3a38;
  110. margin-left: 55%;
  111. min-height: 50px;
  112. }
  113. .content article section aside > span{
  114. display: block;
  115. }
  116. .content article section .brief {
  117. color: #9f9f9f;
  118. }
  119. .class-hidden {
  120. display: none;
  121. }
  122. /*设置Select样式*/
  123. select {
  124. border-width: 0px;
  125. border-top-style: none;
  126. border-right-style: none;
  127. border-left-style: none;
  128. border-bottom-style: none;
  129. overflow:hidden;
  130. -webkit-appearance: none;
  131. }
  132. select option {
  133. text-align: center;
  134. color: blue;
  135. }
  136. .add-title-left{position: absolute;right: 0;top: 15%;}
  137. .add-title-right{position: absolute;left: 55%;top:33%;}
  138. .my-btn-edit{padding: 6px 20px;background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 5px 0 5px 0;}
  139. .list-main{list-style-type: none;margin: 0;padding: 10px;overflow-x: scroll;white-space: nowrap;}
  140. .list-main>li{display: table-cell;min-width: 450px;position: relative;width: 450px;margin-right: 20px;border: 1px solid rgba(0,0,0,.1);}
  141. </style>
  142. <#include "/base/list_base.ftl">
  143. </head>
  144. <body>
  145. <div><input type="hidden" value="${deviceId!}" id="deviceId"></div>
  146. <ul class="list-main">
  147. <#--<li>
  148. <div class="content">
  149. <article>
  150. <h3>净水机</h3>
  151. <section>
  152. <span class="point-time point-yellow">1</span>
  153. <time>
  154. <span>净水机需求清洗物料</span>
  155. <span class="text-blue">员工:张三(a5)</span>
  156. </time>
  157. <aside>
  158. <!--<span></span>
  159. <span></span>&ndash;&gt;
  160. </aside>
  161. </section>
  162. <section>
  163. <span class="point-time point-red">2</span>
  164. <time>
  165. <!--<span></span>
  166. <span></span>&ndash;&gt;
  167. </time>
  168. <aside>
  169. <span>t1滤芯组装</span>
  170. <span class="text-blue">员工:李二二(a4)</span>
  171. </aside>
  172. </section>
  173. <section>
  174. <span class="point-time point-green">3</span>
  175. <time>
  176. <span>t3滤芯组装</span>
  177. <span class="text-blue">员工:钟小小(a4)</span>
  178. </time>
  179. <aside>
  180. <!--<span></span>
  181. <span></span>&ndash;&gt;
  182. </aside>
  183. </section>
  184. <section>
  185. <span class="point-time point-red">4</span>
  186. <time>
  187. <!--<span></span>
  188. <span></span>&ndash;&gt;
  189. </time>
  190. <aside>
  191. <span class="text-right"><button type="button" class="my-btn-edit">添加员工</button></span>
  192. <span class="text-right"><button type="button" class="my-btn-edit">添加设备</button></span>
  193. <span class="add-title-right">接头加工</span>
  194. </aside>
  195. </section>
  196. <section>
  197. <span class="point-time point-green">5</span>
  198. <time>
  199. <span class="text-left"><button type="button" class="my-btn-edit">添加员工</button></span>
  200. <span class="text-left"><button type="button" class="my-btn-edit">添加设备</button></span>
  201. <span class="add-title-left">接头加工</span>
  202. </time>
  203. <aside>
  204. <!--<span></span>
  205. <span></span>&ndash;&gt;
  206. </aside>
  207. </section>
  208. <section>
  209. <span class="point-time point-blue">6</span>
  210. <time>
  211. <!--<span></span>
  212. <span></span>&ndash;&gt;
  213. </time>
  214. <aside>
  215. <span class="text-right"><button type="button" class="my-btn-edit">添加员工</button></span>
  216. <span class="text-right"><button type="button" class="my-btn-edit">添加设备</button></span>
  217. <span class="add-title-right">接头加工</span>
  218. </aside>
  219. </section>
  220. <section>
  221. <span class="point-time point-red">7</span>
  222. <time>
  223. <span class="text-left"><button type="button" class="my-btn-edit">添加员工</button></span>
  224. <span class="text-left"><button type="button" class="my-btn-edit">添加设备</button></span>
  225. <span class="add-title-left">接头加工</span>
  226. </time>
  227. <aside>
  228. <!--<span></span>
  229. <span></span>&ndash;&gt;
  230. </aside>
  231. </section>
  232. <section>
  233. <span class="point-time point-blue">8</span>
  234. <time datetime="2012-02">
  235. <!--<span></span>
  236. <span></span>&ndash;&gt;
  237. </time>
  238. <aside>
  239. <span class="text-right"><button type="button" class="my-btn-edit">添加员工</button></span>
  240. <span class="text-right"><button type="button" class="my-btn-edit">添加设备</button></span>
  241. <span class="add-title-right">接头加工</span>
  242. </aside>
  243. </section>
  244. </article>
  245. </div>
  246. </li>
  247. <li>
  248. <div class="content">
  249. <article>
  250. <h3>净水机</h3>
  251. <section>
  252. <span class="point-time point-yellow">1</span>
  253. <time>
  254. <span>净水机需求清洗物料</span>
  255. <span class="text-blue">员工:张三(a5)</span>
  256. </time>
  257. <aside>
  258. <!--<span></span>
  259. <span></span>&ndash;&gt;
  260. </aside>
  261. </section>
  262. <section>
  263. <span class="point-time point-red">2</span>
  264. <time>
  265. <!--<span></span>
  266. <span></span>&ndash;&gt;
  267. </time>
  268. <aside>
  269. <span>t1滤芯组装</span>
  270. <span class="text-blue">员工:李二二(a4)</span>
  271. </aside>
  272. </section>
  273. <section>
  274. <span class="point-time point-green">3</span>
  275. <time>
  276. <span>t3滤芯组装</span>
  277. <span class="text-blue">员工:钟小小(a4)</span>
  278. </time>
  279. <aside>
  280. <!--<span></span>
  281. <span></span>&ndash;&gt;
  282. </aside>
  283. </section>
  284. <section>
  285. <span class="point-time point-red">4</span>
  286. <time>
  287. <!--<span></span>
  288. <span></span>&ndash;&gt;
  289. </time>
  290. <aside>
  291. <span class="text-right"><button type="button" class="my-btn-edit">添加员工</button></span>
  292. <span class="text-right"><button type="button" class="my-btn-edit">添加设备</button></span>
  293. <span class="add-title-right">接头加工</span>
  294. </aside>
  295. </section>
  296. <section>
  297. <span class="point-time point-green">5</span>
  298. <time>
  299. <span class="text-left"><button type="button" class="my-btn-edit">添加员工</button></span>
  300. <span class="text-left"><button type="button" class="my-btn-edit">添加设备</button></span>
  301. <span class="add-title-left">接头加工</span>
  302. </time>
  303. <aside>
  304. <!--<span></span>
  305. <span></span>&ndash;&gt;
  306. </aside>
  307. </section>
  308. <section>
  309. <span class="point-time point-blue">6</span>
  310. <time>
  311. <!--<span></span>
  312. <span></span>&ndash;&gt;
  313. </time>
  314. <aside>
  315. <span class="text-right"><button type="button" class="my-btn-edit">添加员工</button></span>
  316. <span class="text-right"><button type="button" class="my-btn-edit">添加设备</button></span>
  317. <span class="add-title-right">接头加工</span>
  318. </aside>
  319. </section>
  320. <section>
  321. <span class="point-time point-red">7</span>
  322. <time>
  323. <span class="text-left"><button type="button" class="my-btn-edit">添加员工</button></span>
  324. <span class="text-left"><button type="button" class="my-btn-edit">添加设备</button></span>
  325. <span class="add-title-left">接头加工</span>
  326. </time>
  327. <aside>
  328. <!--<span></span>
  329. <span></span>&ndash;&gt;
  330. </aside>
  331. </section>
  332. <section>
  333. <span class="point-time point-blue">8</span>
  334. <time datetime="2012-02">
  335. <!--<span></span>
  336. <span></span>&ndash;&gt;
  337. </time>
  338. <aside>
  339. <span class="text-right"><button type="button" class="my-btn-edit">添加员工</button></span>
  340. <span class="text-right"><button type="button" class="my-btn-edit">添加设备</button></span>
  341. <span class="add-title-right">接头加工</span>
  342. </aside>
  343. </section>
  344. </article>
  345. </div>
  346. </li>-->
  347. </ul>
  348. <script type="text/javascript">
  349. $(function(){
  350. var deviceId = $('#deviceId').val();
  351. $.ajax({
  352. cache: true,
  353. type: "POST",
  354. url: "${path}/admin/equipment/select_produce_process",
  355. async: false,
  356. success: function(data){
  357. if (data.returnCode == 200) {
  358. var data_produce = data.returnMsg.objMap.produceList;
  359. var employeeList = data.returnMsg.objMap.employeeList;
  360. var deviceList = data.returnMsg.objMap.deviceList;
  361. var table = document.body.querySelector('.list-main');
  362. var tab_name = $('#tab_title');
  363. var tab_text = '';
  364. var id_num = 1;
  365. $.each(data_produce, function(i,item){
  366. var this_produce = this;
  367. var li = document.createElement('li');
  368. var process = '';
  369. var data_process = this_produce.process;
  370. $.each(data_process, function(j,obj){
  371. id_num++;
  372. var this_process = this;
  373. var tb_user = '';
  374. var tb_device = '';
  375. var point_class = '';
  376. if (deviceId == this_process.driveId) {
  377. point_class = 'point-red';
  378. } else {
  379. point_class = 'point-blue';
  380. }
  381. if (this_process.employeeName == null || this_process.employeeName == undefined) {
  382. var employee_option = '<option value="">选择员工</option>';
  383. $.each(employeeList, function(n,nobj){
  384. var employee_list = this;
  385. employee_option += '<option value="' + employee_list.employeeId + '">' + employee_list.employeeName + '</option>';
  386. });
  387. tb_user = '<select id="user' + id_num + '" process="' + this_process.processId + '" onchange="update_process(this,1)">' + employee_option + '</select>&nbsp;&nbsp;&nbsp;&nbsp;';
  388. } else {
  389. var employee_option = '';
  390. $.each(employeeList, function(n,nobj){
  391. var employee_list = this;
  392. if (employee_list.employeeId == this_process.employeeId) {
  393. employee_option += '<option value="' + employee_list.employeeId + '" selected>' + employee_list.employeeName + '</option>';
  394. } else {
  395. employee_option += '<option value="' + employee_list.employeeId + '">' + employee_list.employeeName + '</option>';
  396. }
  397. });
  398. tb_user = '<select id="user' + id_num + '" process="' + this_process.processId + '" onchange="update_process(this,1)">' + employee_option + '</select>';
  399. }
  400. if (this_process.deviceName == null || this_process.deviceName == undefined) {
  401. var device_option = '<option value="">添加打卡设备</option>';
  402. $.each(deviceList, function(n,nobj){
  403. var device_list = this;
  404. device_option += '<option value="' + device_list.deviceId + '">' + device_list.deviceName + '</option>';
  405. });
  406. tb_device = '(<select id="device' + id_num + '" process="' + this_process.processId + '" onchange="update_process(this,2)">' + device_option + '</select>)';
  407. } else {
  408. var device_option = '';
  409. $.each(deviceList, function(n,nobj){
  410. var device_list = this;
  411. if (this_process.driveId == device_list.deviceId) {
  412. device_option += '<option value="' + device_list.deviceId + '" selected>' + device_list.deviceName + '</option>';
  413. } else {
  414. device_option += '<option value="' + device_list.deviceId + '">' + device_list.deviceName + '</option>';
  415. }
  416. });
  417. tb_device = '(<select id="device' + id_num + '" process="' + this_process.processId + '" onchange="update_process(this,2)">' + device_option + '</select>)';
  418. }
  419. if (j % 2 == 0) {
  420. process += '<section>'
  421. + '<span class="point-time ' + point_class + '">' + (j+1)
  422. + '</span>'
  423. + '<time>'
  424. + '<span>' + this_process.processName
  425. + '</span>'
  426. + '<span class="text-blue">' + tb_user + tb_device
  427. + '</span>'
  428. + '</time>'
  429. + '<aside>'
  430. + '</aside>'
  431. + '</section>'
  432. } else {
  433. process += '<section>'
  434. + '<span class="point-time ' + point_class + '">' + (j+1)
  435. + '</span>'
  436. + '<time>'
  437. + '</time>'
  438. + '<aside>'
  439. + '<span>' + this_process.processName
  440. + '</span>'
  441. + '<span class="text-blue">' + tb_user + tb_device
  442. + '</span>'
  443. + '</aside>'
  444. + '</section>'
  445. }
  446. });
  447. li.innerHTML = '<div class="content"><article><h3>' + this_produce.produceName + '</h3>' + process + '</article></div>';
  448. li.id = 'tab_li' + i;
  449. li.setAttribute("index", i);
  450. table.appendChild(li);
  451. });
  452. tab_name.html(tab_text);
  453. }
  454. },
  455. error: function(XmlHttpRequest, textStatus, errorThrown){
  456. }
  457. });
  458. });
  459. function update_process(obj,num) {
  460. var processId = obj.getAttribute("process");
  461. var id = obj.getAttribute("id");
  462. var value = $('#' + id + ' option:selected').val();
  463. var data = null;
  464. if (confirm("您确定修改吗?")) {
  465. //num=1则是修改员工信息,num=2则是修改设备信息
  466. if (num == 1) {
  467. data = {
  468. processId: processId,
  469. employeeId: value
  470. }
  471. } else if(num == 2) {
  472. data = {
  473. processId: processId,
  474. driveId: value
  475. }
  476. }
  477. $.ajax({
  478. cache: true,
  479. type: "POST",
  480. data: data,
  481. url: "${path}/admin/equipment/update_process_info",
  482. async: false,
  483. success: function(dt){
  484. if (dt.returnCode == 200) {
  485. alert('恭喜您,修改成功!');
  486. } else {
  487. alert('对不起,修改失败!');
  488. }
  489. }
  490. })
  491. } else {
  492. location.reload();
  493. }
  494. }
  495. </script>
  496. </body>
  497. </html>