update_process.ftl 23 KB

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